summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Lucifredi <flucifredi@acm.org>2007-05-06 20:12:18 +0000
committerFederico Lucifredi <flucifredi@acm.org>2007-05-06 20:12:18 +0000
commit8a49fc26776c8b95ce299e69903198df7bbebe11 (patch)
treef16ed29141aff95792cf73e3c636efcd534bf2bd
parent1fef746edf313d8fb1d8417a17d536a915ca69cd (diff)
parenta6a4c936ad8c9071b891bb19c4edf5779e027a19 (diff)
refreshing branch to latest release.
git-svn-id: file:///home/lennart/svn/public/avahi/branches/federico@1455 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
-rw-r--r--Makefile.am82
-rw-r--r--avahi-autoipd/Makefile.am (renamed from trunk/avahi-autoipd/Makefile.am)21
-rwxr-xr-x[-rw-r--r--]avahi-autoipd/avahi-autoipd.action.bsd (renamed from release-0.6.9/service-type-database/Makefile.am)38
-rwxr-xr-xavahi-autoipd/avahi-autoipd.action.linux (renamed from trunk/avahi-autoipd/avahi-autoipd.action)0
-rwxr-xr-xavahi-autoipd/dhclient-enter-hook.in (renamed from trunk/avahi-autoipd/dhclient-enter-hook.in)0
-rwxr-xr-xavahi-autoipd/dhclient-exit-hook.in (renamed from trunk/avahi-autoipd/dhclient-exit-hook.in)0
-rw-r--r--avahi-autoipd/iface-bsd.c416
-rw-r--r--avahi-autoipd/iface-linux.c (renamed from trunk/avahi-autoipd/iface-linux.c)40
-rw-r--r--avahi-autoipd/iface.h (renamed from trunk/avahi-autoipd/iface.h)0
-rw-r--r--avahi-autoipd/main.c (renamed from trunk/avahi-autoipd/main.c)348
-rw-r--r--avahi-autoipd/main.h (renamed from trunk/avahi-autoipd/main.h)0
-rw-r--r--avahi-client/client-test.c6
-rw-r--r--avahi-client/client.c80
-rw-r--r--avahi-client/client.h8
-rw-r--r--avahi-client/entrygroup.c35
-rw-r--r--avahi-client/internal.h1
-rw-r--r--avahi-client/publish.h2
-rw-r--r--avahi-client/resolver.c11
-rw-r--r--avahi-common/address.h8
-rw-r--r--avahi-common/alternative-test.c55
-rw-r--r--avahi-common/alternative.c30
-rw-r--r--avahi-common/dbus-watch-glue.c18
-rw-r--r--avahi-common/dbus.c3
-rw-r--r--avahi-common/dbus.h7
-rw-r--r--avahi-common/defs.h61
-rw-r--r--avahi-common/error.c5
-rw-r--r--avahi-common/error.h5
-rw-r--r--avahi-common/simple-watch.c16
-rw-r--r--avahi-common/thread-watch.h2
-rw-r--r--avahi-common/timeval.h4
-rw-r--r--avahi-common/watch.h8
-rw-r--r--avahi-compat-howl/compat.c2
-rw-r--r--avahi-compat-libdns_sd/Makefile.am14
-rw-r--r--avahi-compat-libdns_sd/compat.c309
-rw-r--r--avahi-compat-libdns_sd/dns_sd.h86
-rw-r--r--avahi-compat-libdns_sd/null-test.c (renamed from trunk/avahi-compat-libdns_sd/null-test.c)0
-rw-r--r--avahi-compat-libdns_sd/txt-test.c2
-rw-r--r--avahi-compat-libdns_sd/unsupported.c17
-rw-r--r--avahi-core/Makefile.am11
-rw-r--r--avahi-core/announce.c2
-rw-r--r--avahi-core/avahi-test.c10
-rw-r--r--avahi-core/browse.c3
-rw-r--r--avahi-core/cache.c2
-rw-r--r--avahi-core/core.h5
-rw-r--r--avahi-core/dns-spin-test.c124
-rw-r--r--avahi-core/dns.c19
-rw-r--r--avahi-core/dns.h6
-rw-r--r--avahi-core/domain-util.c65
-rw-r--r--avahi-core/entry.c12
-rwxr-xr-xavahi-core/findstatic.pl (renamed from trunk/avahi-core/findstatic.pl)0
-rw-r--r--avahi-core/iface-linux.c10
-rw-r--r--avahi-core/iface-pfroute.c164
-rw-r--r--avahi-core/iface.c79
-rw-r--r--avahi-core/netlink.c41
-rw-r--r--avahi-core/probe-sched.c5
-rw-r--r--avahi-core/response-sched.c5
-rw-r--r--avahi-core/server.c79
-rw-r--r--avahi-core/socket.c75
-rw-r--r--avahi-core/wide-area.c4
-rw-r--r--avahi-daemon/Makefile.am9
-rw-r--r--avahi-daemon/Server.introspect3
-rw-r--r--avahi-daemon/avahi-daemon.conf2
-rw-r--r--avahi-daemon/avahi-dbus.conf.in16
-rw-r--r--avahi-daemon/chroot.c4
-rw-r--r--avahi-daemon/dbus-async-address-resolver.c7
-rw-r--r--avahi-daemon/dbus-async-host-name-resolver.c6
-rw-r--r--avahi-daemon/dbus-async-service-resolver.c6
-rw-r--r--avahi-daemon/dbus-domain-browser.c8
-rw-r--r--avahi-daemon/dbus-entry-group.c7
-rw-r--r--avahi-daemon/dbus-protocol.c128
-rw-r--r--avahi-daemon/dbus-record-browser.c7
-rw-r--r--avahi-daemon/dbus-service-browser.c16
-rw-r--r--avahi-daemon/dbus-service-type-browser.c8
-rw-r--r--avahi-daemon/dbus-util.c9
-rw-r--r--avahi-daemon/inotify-nosys.h181
-rw-r--r--avahi-daemon/main.c164
-rw-r--r--avahi-daemon/setproctitle.c13
-rw-r--r--avahi-daemon/setproctitle.h4
-rw-r--r--avahi-daemon/sftp-ssh.service (renamed from trunk/avahi-daemon/sftp-ssh.service)0
-rw-r--r--avahi-daemon/ssh.service2
-rw-r--r--avahi-daemon/static-hosts.c111
-rw-r--r--avahi-daemon/static-services.c25
-rw-r--r--avahi-discover-standalone/Makefile.am4
-rw-r--r--avahi-dnsconfd/main.c3
-rw-r--r--avahi-glib/glib-malloc.h2
-rw-r--r--avahi-glib/glib-watch.c42
-rw-r--r--avahi-glib/glib-watch.h5
-rw-r--r--avahi-python/Makefile.am18
-rwxr-xr-xavahi-python/avahi-bookmarks.in98
-rw-r--r--avahi-python/avahi-discover.desktop.in4
-rwxr-xr-xavahi-python/avahi-discover.in29
-rw-r--r--avahi-python/avahi/Makefile.am24
-rw-r--r--avahi-python/avahi/ServiceTypeDatabase.py.in10
-rw-r--r--avahi-sharp/Makefile.am4
-rw-r--r--avahi-ui.pc.in11
-rw-r--r--avahi-ui/Makefile.am80
-rw-r--r--avahi-ui/avahi-ui.c1371
-rw-r--r--avahi-ui/avahi-ui.h156
-rw-r--r--avahi-ui/zssh.c140
-rw-r--r--avahi-ui/zssh.desktop.in12
-rw-r--r--avahi-ui/zvnc.desktop.in12
-rw-r--r--avahi-utils/Makefile.am11
-rw-r--r--avahi-utils/avahi-browse.c55
-rw-r--r--avahi-utils/avahi-publish.c8
-rw-r--r--avahi-utils/avahi-resolve.c6
-rw-r--r--avahi-utils/avahi-set-host-name.c (renamed from trunk/avahi-utils/avahi-set-host-name.c)2
-rw-r--r--avahi-utils/stdb.c101
-rw-r--r--avahi-utils/stdb.h2
-rw-r--r--common/acx_pthread.m419
-rw-r--r--common/doxygen.m44
-rw-r--r--common/gcc_stack_protect.m499
-rw-r--r--configure.ac311
-rw-r--r--docs/INSTALL3
-rw-r--r--docs/NEWS204
-rw-r--r--docs/README2
-rw-r--r--docs/avahi-favicon.png (renamed from trunk/docs/avahi-favicon.png)bin684 -> 684 bytes
-rw-r--r--docs/avahi-logo.png (renamed from trunk/docs/avahi-logo.png)bin8417 -> 8417 bytes
-rw-r--r--docs/avahi-trac.png (renamed from trunk/docs/avahi-trac.png)bin11406 -> 11406 bytes
-rw-r--r--docs/mdns-paket.dia (renamed from trunk/docs/mdns-paket.dia)0
-rw-r--r--docs/multicast.dia (renamed from trunk/docs/multicast.dia)0
-rw-r--r--docs/socket-auto-port.c49
-rw-r--r--docs/utilities-avahi1.svg (renamed from trunk/docs/utilities-avahi1.svg)0
-rw-r--r--docs/utilities-avahi2.svg (renamed from trunk/docs/utilities-avahi2.svg)0
-rw-r--r--docs/zeroconf-stack-de.dia (renamed from trunk/docs/zeroconf-stack-de.dia)0
-rw-r--r--doxygen.cfg14
-rw-r--r--examples/client-browse-services.c2
-rw-r--r--examples/client-publish-service.c26
-rw-r--r--examples/core-browse-services.c2
-rw-r--r--examples/core-publish-service.c12
-rwxr-xr-xinitscript/debian/avahi-daemon.in20
-rwxr-xr-xinitscript/debian/avahi-dnsconfd.in20
-rw-r--r--initscript/fedora/avahi-daemon.in5
-rw-r--r--initscript/fedora/avahi-dnsconfd.in5
-rw-r--r--man/Makefile.am45
-rw-r--r--man/avahi-autoipd.8.xml.in (renamed from trunk/man/avahi-autoipd.8.xml.in)2
-rw-r--r--man/avahi-autoipd.action.8.xml.in (renamed from trunk/man/avahi-autoipd.action.8.xml.in)0
-rw-r--r--man/avahi-bookmarks.1.xml.in2
-rw-r--r--man/avahi-browse.1.xml.in8
-rw-r--r--man/avahi-daemon.8.xml.in26
-rw-r--r--man/avahi-daemon.conf.5.xml.in24
-rw-r--r--man/avahi-discover.1.xml.in2
-rw-r--r--man/avahi-dnsconfd.8.xml.in6
-rw-r--r--man/avahi-dnsconfd.action.8.xml.in2
-rw-r--r--man/avahi-publish.1.xml.in2
-rw-r--r--man/avahi-resolve.1.xml.in2
-rw-r--r--man/avahi-set-host-name.1.xml.in (renamed from trunk/man/avahi-set-host-name.1.xml.in)0
-rw-r--r--man/avahi.hosts.5.xml.in2
-rw-r--r--man/avahi.service.5.xml.in2
-rw-r--r--release-0.6.9/LICENSE510
-rw-r--r--release-0.6.9/Makefile.am215
-rw-r--r--release-0.6.9/acinclude.m41
-rwxr-xr-xrelease-0.6.9/autogen.sh64
-rw-r--r--release-0.6.9/avahi-client.pc.in10
-rw-r--r--release-0.6.9/avahi-client/Makefile.am85
-rw-r--r--release-0.6.9/avahi-client/browser.c1028
-rw-r--r--release-0.6.9/avahi-client/check-nss-test.c32
-rw-r--r--release-0.6.9/avahi-client/check-nss.c57
-rw-r--r--release-0.6.9/avahi-client/client-test.c330
-rw-r--r--release-0.6.9/avahi-client/client.c868
-rw-r--r--release-0.6.9/avahi-client/client.h103
-rw-r--r--release-0.6.9/avahi-client/entrygroup.c875
-rw-r--r--release-0.6.9/avahi-client/internal.h173
-rw-r--r--release-0.6.9/avahi-client/lookup.h271
-rw-r--r--release-0.6.9/avahi-client/publish.h160
-rw-r--r--release-0.6.9/avahi-client/resolver.c781
-rw-r--r--release-0.6.9/avahi-client/rr-test.c113
-rw-r--r--release-0.6.9/avahi-client/srv-test.c78
-rw-r--r--release-0.6.9/avahi-client/xdg-config-test.c38
-rw-r--r--release-0.6.9/avahi-client/xdg-config.c66
-rw-r--r--release-0.6.9/avahi-client/xdg-config.h29
-rw-r--r--release-0.6.9/avahi-common/Makefile.am121
-rw-r--r--release-0.6.9/avahi-common/address.c157
-rw-r--r--release-0.6.9/avahi-common/address.h107
-rw-r--r--release-0.6.9/avahi-common/alternative-test.c50
-rw-r--r--release-0.6.9/avahi-common/alternative.c93
-rw-r--r--release-0.6.9/avahi-common/alternative.h45
-rw-r--r--release-0.6.9/avahi-common/cdecl.h40
-rw-r--r--release-0.6.9/avahi-common/dbus-watch-glue.c347
-rw-r--r--release-0.6.9/avahi-common/dbus-watch-glue.h35
-rw-r--r--release-0.6.9/avahi-common/dbus.c139
-rw-r--r--release-0.6.9/avahi-common/dbus.h120
-rw-r--r--release-0.6.9/avahi-common/defs.h310
-rw-r--r--release-0.6.9/avahi-common/domain-test.c125
-rw-r--r--release-0.6.9/avahi-common/domain.c607
-rw-r--r--release-0.6.9/avahi-common/domain.h106
-rw-r--r--release-0.6.9/avahi-common/error.c95
-rw-r--r--release-0.6.9/avahi-common/error.h108
-rw-r--r--release-0.6.9/avahi-common/gccmacro.h67
-rw-r--r--release-0.6.9/avahi-common/llist.h77
-rw-r--r--release-0.6.9/avahi-common/malloc.c259
-rw-r--r--release-0.6.9/avahi-common/malloc.h96
-rw-r--r--release-0.6.9/avahi-common/rlist.c64
-rw-r--r--release-0.6.9/avahi-common/rlist.h51
-rw-r--r--release-0.6.9/avahi-common/simple-watch.c645
-rw-r--r--release-0.6.9/avahi-common/simple-watch.h87
-rw-r--r--release-0.6.9/avahi-common/strlst-test.c129
-rw-r--r--release-0.6.9/avahi-common/strlst.c505
-rw-r--r--release-0.6.9/avahi-common/strlst.h152
-rw-r--r--release-0.6.9/avahi-common/thread-watch.c186
-rw-r--r--release-0.6.9/avahi-common/thread-watch.h82
-rw-r--r--release-0.6.9/avahi-common/timeval-test.c45
-rw-r--r--release-0.6.9/avahi-common/timeval.c125
-rw-r--r--release-0.6.9/avahi-common/timeval.h56
-rw-r--r--release-0.6.9/avahi-common/watch-test.c117
-rw-r--r--release-0.6.9/avahi-common/watch.h99
-rw-r--r--release-0.6.9/avahi-compat-howl.pc.in10
-rw-r--r--release-0.6.9/avahi-compat-howl/Makefile.am111
-rw-r--r--release-0.6.9/avahi-compat-howl/address-test.c53
-rw-r--r--release-0.6.9/avahi-compat-howl/address.c214
-rw-r--r--release-0.6.9/avahi-compat-howl/browse-domain-test.c76
-rw-r--r--release-0.6.9/avahi-compat-howl/compat.c1184
-rw-r--r--release-0.6.9/avahi-compat-howl/funcs.txt184
-rw-r--r--release-0.6.9/avahi-compat-howl/include/corby/buffer.h330
-rw-r--r--release-0.6.9/avahi-compat-howl/include/corby/channel.h186
-rw-r--r--release-0.6.9/avahi-compat-howl/include/corby/corby.h68
-rw-r--r--release-0.6.9/avahi-compat-howl/include/corby/message.h60
-rw-r--r--release-0.6.9/avahi-compat-howl/include/corby/object.h113
-rw-r--r--release-0.6.9/avahi-compat-howl/include/corby/orb.h199
-rw-r--r--release-0.6.9/avahi-compat-howl/include/discovery/discovery.h327
-rw-r--r--release-0.6.9/avahi-compat-howl/include/discovery/text_record.h143
-rw-r--r--release-0.6.9/avahi-compat-howl/include/howl.h44
-rw-r--r--release-0.6.9/avahi-compat-howl/include/rendezvous/rendezvous.h101
-rw-r--r--release-0.6.9/avahi-compat-howl/include/rendezvous/text_record.h36
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/address.h128
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/debug.h230
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/interface.h115
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/platform.h438
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/salt.h215
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/signal.h61
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/socket.h263
-rw-r--r--release-0.6.9/avahi-compat-howl/include/salt/time.h100
-rw-r--r--release-0.6.9/avahi-compat-howl/samples/Makefile.am53
-rw-r--r--release-0.6.9/avahi-compat-howl/samples/browse.c184
-rw-r--r--release-0.6.9/avahi-compat-howl/samples/publish.c110
-rw-r--r--release-0.6.9/avahi-compat-howl/samples/query.c98
-rw-r--r--release-0.6.9/avahi-compat-howl/samples/resolve.c111
-rw-r--r--release-0.6.9/avahi-compat-howl/text-test.c99
-rw-r--r--release-0.6.9/avahi-compat-howl/text.c261
-rw-r--r--release-0.6.9/avahi-compat-howl/unsupported.c1021
-rw-r--r--release-0.6.9/avahi-compat-howl/warn.c31
-rw-r--r--release-0.6.9/avahi-compat-howl/warn.h35
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd.pc.in10
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/Makefile.am67
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/compat.c1078
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/dns_sd.h1670
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/funcs.txt37
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/txt-test.c130
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/txt.c491
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/unsupported.c122
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/warn.c126
-rw-r--r--release-0.6.9/avahi-compat-libdns_sd/warn.h38
-rw-r--r--release-0.6.9/avahi-core.pc.in10
-rw-r--r--release-0.6.9/avahi-core/Makefile.am160
-rw-r--r--release-0.6.9/avahi-core/addr-util.c79
-rw-r--r--release-0.6.9/avahi-core/addr-util.h45
-rw-r--r--release-0.6.9/avahi-core/announce.c526
-rw-r--r--release-0.6.9/avahi-core/announce.h71
-rw-r--r--release-0.6.9/avahi-core/avahi-reflector.c63
-rw-r--r--release-0.6.9/avahi-core/avahi-test.c401
-rw-r--r--release-0.6.9/avahi-core/browse-dns-server.c324
-rw-r--r--release-0.6.9/avahi-core/browse-domain.c237
-rw-r--r--release-0.6.9/avahi-core/browse-service-type.c159
-rw-r--r--release-0.6.9/avahi-core/browse-service.c169
-rw-r--r--release-0.6.9/avahi-core/browse.c614
-rw-r--r--release-0.6.9/avahi-core/browse.h62
-rw-r--r--release-0.6.9/avahi-core/cache.c508
-rw-r--r--release-0.6.9/avahi-core/cache.h101
-rw-r--r--release-0.6.9/avahi-core/conformance-test.c160
-rw-r--r--release-0.6.9/avahi-core/core.h153
-rw-r--r--release-0.6.9/avahi-core/dns-srv-rr.h89
-rw-r--r--release-0.6.9/avahi-core/dns-test.c115
-rw-r--r--release-0.6.9/avahi-core/dns.c838
-rw-r--r--release-0.6.9/avahi-core/dns.h111
-rw-r--r--release-0.6.9/avahi-core/domain-util.c132
-rw-r--r--release-0.6.9/avahi-core/domain-util.h47
-rw-r--r--release-0.6.9/avahi-core/entry.c1206
-rw-r--r--release-0.6.9/avahi-core/fdutil.c73
-rw-r--r--release-0.6.9/avahi-core/fdutil.h35
-rw-r--r--release-0.6.9/avahi-core/hashmap-test.c64
-rw-r--r--release-0.6.9/avahi-core/hashmap.c250
-rw-r--r--release-0.6.9/avahi-core/hashmap.h55
-rw-r--r--release-0.6.9/avahi-core/iface-linux.c361
-rw-r--r--release-0.6.9/avahi-core/iface-linux.h42
-rw-r--r--release-0.6.9/avahi-core/iface-pfroute.c356
-rw-r--r--release-0.6.9/avahi-core/iface-pfroute.h39
-rw-r--r--release-0.6.9/avahi-core/iface.c812
-rw-r--r--release-0.6.9/avahi-core/iface.h192
-rw-r--r--release-0.6.9/avahi-core/internal.h227
-rw-r--r--release-0.6.9/avahi-core/log.c88
-rw-r--r--release-0.6.9/avahi-core/log.h75
-rw-r--r--release-0.6.9/avahi-core/lookup.h237
-rw-r--r--release-0.6.9/avahi-core/multicast-lookup.c352
-rw-r--r--release-0.6.9/avahi-core/multicast-lookup.h53
-rw-r--r--release-0.6.9/avahi-core/netlink.c177
-rw-r--r--release-0.6.9/avahi-core/netlink.h43
-rw-r--r--release-0.6.9/avahi-core/prioq-test.c122
-rw-r--r--release-0.6.9/avahi-core/prioq.c390
-rw-r--r--release-0.6.9/avahi-core/prioq.h51
-rw-r--r--release-0.6.9/avahi-core/probe-sched.c402
-rw-r--r--release-0.6.9/avahi-core/probe-sched.h36
-rw-r--r--release-0.6.9/avahi-core/publish.h177
-rw-r--r--release-0.6.9/avahi-core/querier-test.c124
-rw-r--r--release-0.6.9/avahi-core/querier.c271
-rw-r--r--release-0.6.9/avahi-core/querier.h50
-rw-r--r--release-0.6.9/avahi-core/query-sched.c452
-rw-r--r--release-0.6.9/avahi-core/query-sched.h38
-rw-r--r--release-0.6.9/avahi-core/resolve-address.c270
-rw-r--r--release-0.6.9/avahi-core/resolve-host-name.c299
-rw-r--r--release-0.6.9/avahi-core/resolve-service.c491
-rw-r--r--release-0.6.9/avahi-core/response-sched.c516
-rw-r--r--release-0.6.9/avahi-core/response-sched.h39
-rw-r--r--release-0.6.9/avahi-core/rr-util.h64
-rw-r--r--release-0.6.9/avahi-core/rr.c703
-rw-r--r--release-0.6.9/avahi-core/rr.h174
-rw-r--r--release-0.6.9/avahi-core/rrlist.c190
-rw-r--r--release-0.6.9/avahi-core/rrlist.h42
-rw-r--r--release-0.6.9/avahi-core/server.c1702
-rw-r--r--release-0.6.9/avahi-core/socket.c910
-rw-r--r--release-0.6.9/avahi-core/socket.h49
-rw-r--r--release-0.6.9/avahi-core/timeeventq-test.c69
-rw-r--r--release-0.6.9/avahi-core/timeeventq.c227
-rw-r--r--release-0.6.9/avahi-core/timeeventq.h48
-rw-r--r--release-0.6.9/avahi-core/update-test.c92
-rw-r--r--release-0.6.9/avahi-core/util.c122
-rw-r--r--release-0.6.9/avahi-core/util.h43
-rw-r--r--release-0.6.9/avahi-core/wide-area.c725
-rw-r--r--release-0.6.9/avahi-core/wide-area.h54
-rw-r--r--release-0.6.9/avahi-daemon/AddressResolver.introspect52
-rw-r--r--release-0.6.9/avahi-daemon/DomainBrowser.introspect62
-rw-r--r--release-0.6.9/avahi-daemon/EntryGroup.introspect103
-rw-r--r--release-0.6.9/avahi-daemon/HostNameResolver.introspect52
-rw-r--r--release-0.6.9/avahi-daemon/Makefile.am163
-rw-r--r--release-0.6.9/avahi-daemon/RecordBrowser.introspect67
-rw-r--r--release-0.6.9/avahi-daemon/Server.introspect218
-rw-r--r--release-0.6.9/avahi-daemon/ServiceBrowser.introspect65
-rw-r--r--release-0.6.9/avahi-daemon/ServiceResolver.introspect57
-rw-r--r--release-0.6.9/avahi-daemon/ServiceTypeBrowser.introspect63
-rw-r--r--release-0.6.9/avahi-daemon/avahi-daemon.conf60
-rw-r--r--release-0.6.9/avahi-daemon/avahi-dbus.conf.in25
-rw-r--r--release-0.6.9/avahi-daemon/avahi-service.dtd20
-rw-r--r--release-0.6.9/avahi-daemon/caps.c116
-rw-r--r--release-0.6.9/avahi-daemon/caps.h29
-rw-r--r--release-0.6.9/avahi-daemon/chroot.c415
-rw-r--r--release-0.6.9/avahi-daemon/chroot.h36
-rw-r--r--release-0.6.9/avahi-daemon/dbus-async-address-resolver.c134
-rw-r--r--release-0.6.9/avahi-daemon/dbus-async-host-name-resolver.c134
-rw-r--r--release-0.6.9/avahi-daemon/dbus-async-service-resolver.c173
-rw-r--r--release-0.6.9/avahi-daemon/dbus-domain-browser.c126
-rw-r--r--release-0.6.9/avahi-daemon/dbus-entry-group.c363
-rw-r--r--release-0.6.9/avahi-daemon/dbus-internal.h248
-rw-r--r--release-0.6.9/avahi-daemon/dbus-protocol.c1107
-rw-r--r--release-0.6.9/avahi-daemon/dbus-protocol.h29
-rw-r--r--release-0.6.9/avahi-daemon/dbus-record-browser.c158
-rw-r--r--release-0.6.9/avahi-daemon/dbus-service-browser.c137
-rw-r--r--release-0.6.9/avahi-daemon/dbus-service-type-browser.c129
-rw-r--r--release-0.6.9/avahi-daemon/dbus-sync-address-resolver.c92
-rw-r--r--release-0.6.9/avahi-daemon/dbus-sync-host-name-resolver.c92
-rw-r--r--release-0.6.9/avahi-daemon/dbus-sync-service-resolver.c130
-rw-r--r--release-0.6.9/avahi-daemon/dbus-util.c395
-rw-r--r--release-0.6.9/avahi-daemon/dbus-util.h59
-rw-r--r--release-0.6.9/avahi-daemon/example.service52
-rw-r--r--release-0.6.9/avahi-daemon/hosts29
-rw-r--r--release-0.6.9/avahi-daemon/ini-file-parser-test.c60
-rw-r--r--release-0.6.9/avahi-daemon/ini-file-parser.c194
-rw-r--r--release-0.6.9/avahi-daemon/ini-file-parser.h57
-rw-r--r--release-0.6.9/avahi-daemon/introspect.dtd37
-rw-r--r--release-0.6.9/avahi-daemon/introspect.xsl104
-rw-r--r--release-0.6.9/avahi-daemon/main.c1217
-rw-r--r--release-0.6.9/avahi-daemon/main.h33
-rw-r--r--release-0.6.9/avahi-daemon/setproctitle.c102
-rw-r--r--release-0.6.9/avahi-daemon/setproctitle.h28
-rw-r--r--release-0.6.9/avahi-daemon/simple-protocol.c540
-rw-r--r--release-0.6.9/avahi-daemon/simple-protocol.h31
-rw-r--r--release-0.6.9/avahi-daemon/ssh.service36
-rw-r--r--release-0.6.9/avahi-daemon/static-hosts.c229
-rw-r--r--release-0.6.9/avahi-daemon/static-hosts.h30
-rw-r--r--release-0.6.9/avahi-daemon/static-services.c712
-rw-r--r--release-0.6.9/avahi-daemon/static-services.h30
-rw-r--r--release-0.6.9/avahi-discover-standalone/Makefile.am62
-rw-r--r--release-0.6.9/avahi-discover-standalone/avahi-discover.glade91
-rw-r--r--release-0.6.9/avahi-discover-standalone/avahi-discover.gladep8
-rw-r--r--release-0.6.9/avahi-discover-standalone/main.c371
-rw-r--r--release-0.6.9/avahi-dnsconfd/Makefile.am45
-rwxr-xr-xrelease-0.6.9/avahi-dnsconfd/avahi-dnsconfd.action62
-rw-r--r--release-0.6.9/avahi-dnsconfd/main.c652
-rw-r--r--release-0.6.9/avahi-glib.pc.in11
-rw-r--r--release-0.6.9/avahi-glib/Makefile.am56
-rw-r--r--release-0.6.9/avahi-glib/glib-malloc.c57
-rw-r--r--release-0.6.9/avahi-glib/glib-malloc.h41
-rw-r--r--release-0.6.9/avahi-glib/glib-watch-test.c91
-rw-r--r--release-0.6.9/avahi-glib/glib-watch.c388
-rw-r--r--release-0.6.9/avahi-glib/glib-watch.h53
-rw-r--r--release-0.6.9/avahi-python/Makefile.am61
-rwxr-xr-xrelease-0.6.9/avahi-python/avahi-bookmarks.in183
-rw-r--r--release-0.6.9/avahi-python/avahi-discover.desktop.in10
-rwxr-xr-xrelease-0.6.9/avahi-python/avahi-discover.in252
-rw-r--r--release-0.6.9/avahi-python/avahi/Makefile.am44
-rw-r--r--release-0.6.9/avahi-python/avahi/ServiceTypeDatabase.py.in109
-rw-r--r--release-0.6.9/avahi-python/avahi/SimpleGladeApp.py341
-rw-r--r--release-0.6.9/avahi-python/avahi/__init__.py114
-rw-r--r--release-0.6.9/avahi-qt/Makefile.am72
-rw-r--r--release-0.6.9/avahi-qt/qt-watch.cpp200
-rw-r--r--release-0.6.9/avahi-qt/qt-watch.h36
-rw-r--r--release-0.6.9/avahi-qt3.pc.in11
-rw-r--r--release-0.6.9/avahi-qt4.pc.in11
-rw-r--r--release-0.6.9/avahi-sharp.pc.in8
-rw-r--r--release-0.6.9/avahi-sharp/AddressResolver.cs192
-rw-r--r--release-0.6.9/avahi-sharp/AssemblyInfo.cs50
-rw-r--r--release-0.6.9/avahi-sharp/AvahiTest.cs132
-rw-r--r--release-0.6.9/avahi-sharp/BrowserBase.cs52
-rw-r--r--release-0.6.9/avahi-sharp/Client.cs372
-rw-r--r--release-0.6.9/avahi-sharp/ClientException.cs125
-rw-r--r--release-0.6.9/avahi-sharp/DomainBrowser.cs200
-rw-r--r--release-0.6.9/avahi-sharp/EntryGroup.cs374
-rw-r--r--release-0.6.9/avahi-sharp/HostNameResolver.cs169
-rw-r--r--release-0.6.9/avahi-sharp/Makefile.am84
-rw-r--r--release-0.6.9/avahi-sharp/RecordBrowser.cs227
-rw-r--r--release-0.6.9/avahi-sharp/ResolverBase.cs36
-rw-r--r--release-0.6.9/avahi-sharp/ServiceBrowser.cs216
-rw-r--r--release-0.6.9/avahi-sharp/ServiceResolver.cs224
-rw-r--r--release-0.6.9/avahi-sharp/ServiceTypeBrowser.cs199
-rw-r--r--release-0.6.9/avahi-sharp/Utility.cs114
-rw-r--r--release-0.6.9/avahi-sharp/avahi-sharp-docs.source4
-rw-r--r--release-0.6.9/avahi-sharp/avahi-sharp.dll.config.in5
-rw-r--r--release-0.6.9/avahi-sharp/avahi.snkbin596 -> 0 bytes
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi.xml6
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/AddressResolver.xml113
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/BrowserBase.xml59
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/Client.xml178
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ClientException.xml29
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ClientFlags.xml51
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ClientState.xml66
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ClientStateArgs.xml41
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ClientStateHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/DomainBrowser.xml101
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/DomainBrowserType.xml66
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/DomainInfo.xml61
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/DomainInfoArgs.xml41
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/DomainInfoHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/EntryGroup.xml491
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/EntryGroupState.xml66
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml41
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ErrorCode.xml526
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeArgs.xml41
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/HostAddressArgs.xml55
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/HostAddressHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/HostNameResolver.xml115
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/LookupFlags.xml71
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/LookupResultFlags.xml81
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/Protocol.xml46
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/PublishFlags.xml121
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/RecordBrowser.xml107
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/RecordClass.xml26
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/RecordInfo.xml94
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/RecordInfoArgs.xml41
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/RecordInfoHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/RecordType.xml116
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ResolverBase.xml37
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceBrowser.xml119
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceInfo.xml138
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoArgs.xml41
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceResolver.xml125
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml113
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfo.xml72
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml41
-rw-r--r--release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml23
-rw-r--r--release-0.6.9/avahi-sharp/en/index.xml79
-rwxr-xr-xrelease-0.6.9/avahi-sharp/gencfg.sh12
-rw-r--r--release-0.6.9/avahi-utils/Makefile.am56
-rw-r--r--release-0.6.9/avahi-utils/avahi-browse.c789
-rw-r--r--release-0.6.9/avahi-utils/avahi-publish.c419
-rw-r--r--release-0.6.9/avahi-utils/avahi-resolve.c343
-rw-r--r--release-0.6.9/avahi-utils/sigint.c146
-rw-r--r--release-0.6.9/avahi-utils/sigint.h30
-rw-r--r--release-0.6.9/avahi-utils/stdb.c113
-rw-r--r--release-0.6.9/avahi-utils/stdb.h30
-rwxr-xr-xrelease-0.6.9/bootstrap.sh62
-rw-r--r--release-0.6.9/common/Makefile.am23
-rw-r--r--release-0.6.9/common/acx_pthread.m4238
-rw-r--r--release-0.6.9/common/doxygen.m4312
-rw-r--r--release-0.6.9/common/doxygen.mk187
-rw-r--r--release-0.6.9/common/python.m462
-rw-r--r--release-0.6.9/configure.ac850
-rw-r--r--release-0.6.9/docs/API-CHANGES-0.677
-rw-r--r--release-0.6.9/docs/AUTHORS12
-rw-r--r--release-0.6.9/docs/COMPAT-LAYERS18
-rw-r--r--release-0.6.9/docs/DBUS-API15
-rw-r--r--release-0.6.9/docs/HACKING91
-rw-r--r--release-0.6.9/docs/INSTALL52
-rw-r--r--release-0.6.9/docs/MALLOC10
-rw-r--r--release-0.6.9/docs/NEWS372
-rw-r--r--release-0.6.9/docs/README50
-rw-r--r--release-0.6.9/docs/TODO106
-rw-r--r--release-0.6.9/docs/avahi-poll.dia1042
-rw-r--r--release-0.6.9/docs/overview.dia1495
-rw-r--r--release-0.6.9/docs/server-states.dia975
-rw-r--r--release-0.6.9/doxygen.cfg213
-rw-r--r--release-0.6.9/examples/Makefile.am65
-rw-r--r--release-0.6.9/examples/client-browse-services.c199
-rw-r--r--release-0.6.9/examples/client-publish-service.c236
-rw-r--r--release-0.6.9/examples/core-browse-services.c215
-rw-r--r--release-0.6.9/examples/core-publish-service.c240
-rw-r--r--release-0.6.9/examples/glib-integration.c148
-rw-r--r--release-0.6.9/initscript/Makefile.am56
-rw-r--r--release-0.6.9/initscript/archlinux/Makefile.am40
-rw-r--r--release-0.6.9/initscript/archlinux/avahi-daemon.in74
-rwxr-xr-xrelease-0.6.9/initscript/archlinux/avahi-dnsconfd.in74
-rw-r--r--release-0.6.9/initscript/darwin/Makefile.am40
-rw-r--r--release-0.6.9/initscript/darwin/org.freedesktop.avahi-daemon.plist.in16
-rw-r--r--release-0.6.9/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in16
-rw-r--r--release-0.6.9/initscript/debian/Makefile.am46
-rwxr-xr-xrelease-0.6.9/initscript/debian/avahi-daemon.in168
-rwxr-xr-xrelease-0.6.9/initscript/debian/avahi-dnsconfd.in166
-rw-r--r--release-0.6.9/initscript/fedora/Makefile.am34
-rw-r--r--release-0.6.9/initscript/fedora/avahi-daemon.in102
-rw-r--r--release-0.6.9/initscript/fedora/avahi-dnsconfd.in99
-rw-r--r--release-0.6.9/initscript/freebsd/Makefile.am43
-rw-r--r--release-0.6.9/initscript/freebsd/avahi-daemon.sh.in36
-rw-r--r--release-0.6.9/initscript/freebsd/avahi-dnsconfd.sh.in39
-rw-r--r--release-0.6.9/initscript/gentoo/Makefile.am45
-rw-r--r--release-0.6.9/initscript/gentoo/avahi-daemon.in29
-rw-r--r--release-0.6.9/initscript/gentoo/avahi-dnsconfd.in29
-rw-r--r--release-0.6.9/initscript/mandriva/Makefile.am34
-rw-r--r--release-0.6.9/initscript/mandriva/avahi-daemon.in94
-rw-r--r--release-0.6.9/initscript/mandriva/avahi-dnsconfd.in94
-rw-r--r--release-0.6.9/initscript/slackware/Makefile.am34
-rw-r--r--release-0.6.9/initscript/slackware/avahi-daemon.in80
-rw-r--r--release-0.6.9/initscript/slackware/avahi-dnsconfd.in80
-rw-r--r--release-0.6.9/initscript/suse/Makefile.am34
-rw-r--r--release-0.6.9/initscript/suse/avahi-daemon.in47
-rw-r--r--release-0.6.9/initscript/suse/avahi-dnsconfd.in47
-rw-r--r--release-0.6.9/man/Makefile.am191
-rw-r--r--release-0.6.9/man/avahi-bookmarks.1.xml.in101
-rw-r--r--release-0.6.9/man/avahi-browse.1.xml.in126
-rw-r--r--release-0.6.9/man/avahi-daemon.8.xml.in170
-rw-r--r--release-0.6.9/man/avahi-daemon.conf.5.xml.in303
-rw-r--r--release-0.6.9/man/avahi-discover.1.xml.in61
-rw-r--r--release-0.6.9/man/avahi-dnsconfd.8.xml.in104
-rw-r--r--release-0.6.9/man/avahi-dnsconfd.action.8.xml.in92
-rw-r--r--release-0.6.9/man/avahi-publish.1.xml.in124
-rw-r--r--release-0.6.9/man/avahi-resolve.1.xml.in107
-rw-r--r--release-0.6.9/man/avahi.hosts.5.xml.in62
-rw-r--r--release-0.6.9/man/avahi.service.5.xml.in124
-rw-r--r--release-0.6.9/man/xmltoman.css30
-rw-r--r--release-0.6.9/man/xmltoman.dtd39
-rw-r--r--release-0.6.9/man/xmltoman.xsl129
-rwxr-xr-xrelease-0.6.9/service-type-database/build-db.in46
-rw-r--r--release-0.6.9/service-type-database/service-types109
-rw-r--r--release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-02.txt1798
-rw-r--r--release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-03.txt1856
-rw-r--r--release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-03.txt2494
-rw-r--r--release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-04.txt2494
-rw-r--r--release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-05.txt2640
-rw-r--r--release-0.6.9/tests/Makefile.am55
-rwxr-xr-xrelease-0.6.9/tests/c-plus-plus-test-gen.py68
-rw-r--r--release-0.6.9/tests/c-plus-plus-test.cc84
-rwxr-xr-xrelease-0.6.9/tests/fuzz-mdns.py8
-rw-r--r--service-type-database/Makefile.am27
-rwxr-xr-xservice-type-database/build-db.in4
-rw-r--r--service-type-database/service-types123
-rw-r--r--specs/draft-cheshire-dnsext-dns-sd-04.txt (renamed from trunk/specs/draft-cheshire-dnsext-dns-sd-04.txt)0
-rw-r--r--specs/draft-cheshire-dnsext-multicastdns-06.txt (renamed from trunk/specs/draft-cheshire-dnsext-multicastdns-06.txt)0
-rw-r--r--trunk/LICENSE510
-rw-r--r--trunk/Makefile.am236
-rw-r--r--trunk/acinclude.m41
-rwxr-xr-xtrunk/autogen.sh64
-rw-r--r--trunk/avahi-client.pc.in10
-rw-r--r--trunk/avahi-client/Makefile.am85
-rw-r--r--trunk/avahi-client/browser.c1028
-rw-r--r--trunk/avahi-client/check-nss-test.c32
-rw-r--r--trunk/avahi-client/check-nss.c57
-rw-r--r--trunk/avahi-client/client-test.c330
-rw-r--r--trunk/avahi-client/client.c943
-rw-r--r--trunk/avahi-client/client.h103
-rw-r--r--trunk/avahi-client/entrygroup.c892
-rw-r--r--trunk/avahi-client/internal.h174
-rw-r--r--trunk/avahi-client/lookup.h271
-rw-r--r--trunk/avahi-client/publish.h160
-rw-r--r--trunk/avahi-client/resolver.c781
-rw-r--r--trunk/avahi-client/rr-test.c113
-rw-r--r--trunk/avahi-client/srv-test.c78
-rw-r--r--trunk/avahi-client/xdg-config-test.c38
-rw-r--r--trunk/avahi-client/xdg-config.c66
-rw-r--r--trunk/avahi-client/xdg-config.h29
-rw-r--r--trunk/avahi-common/Makefile.am131
-rw-r--r--trunk/avahi-common/address.c157
-rw-r--r--trunk/avahi-common/address.h107
-rw-r--r--trunk/avahi-common/alternative-test.c85
-rw-r--r--trunk/avahi-common/alternative.c107
-rw-r--r--trunk/avahi-common/alternative.h45
-rw-r--r--trunk/avahi-common/cdecl.h40
-rw-r--r--trunk/avahi-common/dbus-watch-glue.c351
-rw-r--r--trunk/avahi-common/dbus-watch-glue.h35
-rw-r--r--trunk/avahi-common/dbus.c140
-rw-r--r--trunk/avahi-common/dbus.h121
-rw-r--r--trunk/avahi-common/defs.h307
-rw-r--r--trunk/avahi-common/domain-test.c125
-rw-r--r--trunk/avahi-common/domain.c611
-rw-r--r--trunk/avahi-common/domain.h106
-rw-r--r--trunk/avahi-common/error.c96
-rw-r--r--trunk/avahi-common/error.h109
-rw-r--r--trunk/avahi-common/gccmacro.h67
-rw-r--r--trunk/avahi-common/llist.h77
-rw-r--r--trunk/avahi-common/malloc.c259
-rw-r--r--trunk/avahi-common/malloc.h96
-rw-r--r--trunk/avahi-common/rlist.c64
-rw-r--r--trunk/avahi-common/rlist.h51
-rw-r--r--trunk/avahi-common/simple-watch.c645
-rw-r--r--trunk/avahi-common/simple-watch.h87
-rw-r--r--trunk/avahi-common/strlst-test.c129
-rw-r--r--trunk/avahi-common/strlst.c505
-rw-r--r--trunk/avahi-common/strlst.h152
-rw-r--r--trunk/avahi-common/thread-watch.c186
-rw-r--r--trunk/avahi-common/thread-watch.h82
-rw-r--r--trunk/avahi-common/timeval-test.c45
-rw-r--r--trunk/avahi-common/timeval.c125
-rw-r--r--trunk/avahi-common/timeval.h56
-rw-r--r--trunk/avahi-common/utf8-test.c37
-rw-r--r--trunk/avahi-common/utf8.c115
-rw-r--r--trunk/avahi-common/utf8.h35
-rw-r--r--trunk/avahi-common/watch-test.c117
-rw-r--r--trunk/avahi-common/watch.h99
-rw-r--r--trunk/avahi-compat-howl.pc.in10
-rw-r--r--trunk/avahi-compat-howl/Makefile.am111
-rw-r--r--trunk/avahi-compat-howl/address-test.c53
-rw-r--r--trunk/avahi-compat-howl/address.c214
-rw-r--r--trunk/avahi-compat-howl/browse-domain-test.c76
-rw-r--r--trunk/avahi-compat-howl/compat.c1184
-rw-r--r--trunk/avahi-compat-howl/funcs.txt184
-rw-r--r--trunk/avahi-compat-howl/include/corby/buffer.h330
-rw-r--r--trunk/avahi-compat-howl/include/corby/channel.h186
-rw-r--r--trunk/avahi-compat-howl/include/corby/corby.h68
-rw-r--r--trunk/avahi-compat-howl/include/corby/message.h60
-rw-r--r--trunk/avahi-compat-howl/include/corby/object.h113
-rw-r--r--trunk/avahi-compat-howl/include/corby/orb.h199
-rw-r--r--trunk/avahi-compat-howl/include/discovery/discovery.h327
-rw-r--r--trunk/avahi-compat-howl/include/discovery/text_record.h143
-rw-r--r--trunk/avahi-compat-howl/include/howl.h44
-rw-r--r--trunk/avahi-compat-howl/include/rendezvous/rendezvous.h101
-rw-r--r--trunk/avahi-compat-howl/include/rendezvous/text_record.h36
-rw-r--r--trunk/avahi-compat-howl/include/salt/address.h128
-rw-r--r--trunk/avahi-compat-howl/include/salt/debug.h230
-rw-r--r--trunk/avahi-compat-howl/include/salt/interface.h115
-rw-r--r--trunk/avahi-compat-howl/include/salt/platform.h438
-rw-r--r--trunk/avahi-compat-howl/include/salt/salt.h215
-rw-r--r--trunk/avahi-compat-howl/include/salt/signal.h61
-rw-r--r--trunk/avahi-compat-howl/include/salt/socket.h263
-rw-r--r--trunk/avahi-compat-howl/include/salt/time.h100
-rw-r--r--trunk/avahi-compat-howl/samples/Makefile.am53
-rw-r--r--trunk/avahi-compat-howl/samples/browse.c184
-rw-r--r--trunk/avahi-compat-howl/samples/publish.c110
-rw-r--r--trunk/avahi-compat-howl/samples/query.c98
-rw-r--r--trunk/avahi-compat-howl/samples/resolve.c111
-rw-r--r--trunk/avahi-compat-howl/text-test.c99
-rw-r--r--trunk/avahi-compat-howl/text.c261
-rw-r--r--trunk/avahi-compat-howl/unsupported.c1021
-rw-r--r--trunk/avahi-compat-howl/warn.c31
-rw-r--r--trunk/avahi-compat-howl/warn.h35
-rw-r--r--trunk/avahi-compat-libdns_sd.pc.in10
-rw-r--r--trunk/avahi-compat-libdns_sd/Makefile.am75
-rw-r--r--trunk/avahi-compat-libdns_sd/compat.c1253
-rw-r--r--trunk/avahi-compat-libdns_sd/dns_sd.h1722
-rw-r--r--trunk/avahi-compat-libdns_sd/funcs.txt37
-rw-r--r--trunk/avahi-compat-libdns_sd/txt-test.c130
-rw-r--r--trunk/avahi-compat-libdns_sd/txt.c491
-rw-r--r--trunk/avahi-compat-libdns_sd/unsupported.c109
-rw-r--r--trunk/avahi-compat-libdns_sd/warn.c126
-rw-r--r--trunk/avahi-compat-libdns_sd/warn.h38
-rw-r--r--trunk/avahi-core.pc.in10
-rw-r--r--trunk/avahi-core/Makefile.am160
-rw-r--r--trunk/avahi-core/addr-util.c79
-rw-r--r--trunk/avahi-core/addr-util.h45
-rw-r--r--trunk/avahi-core/announce.c526
-rw-r--r--trunk/avahi-core/announce.h71
-rw-r--r--trunk/avahi-core/avahi-reflector.c63
-rw-r--r--trunk/avahi-core/avahi-test.c403
-rw-r--r--trunk/avahi-core/browse-dns-server.c324
-rw-r--r--trunk/avahi-core/browse-domain.c237
-rw-r--r--trunk/avahi-core/browse-service-type.c159
-rw-r--r--trunk/avahi-core/browse-service.c169
-rw-r--r--trunk/avahi-core/browse.c615
-rw-r--r--trunk/avahi-core/browse.h62
-rw-r--r--trunk/avahi-core/cache.c508
-rw-r--r--trunk/avahi-core/cache.h101
-rw-r--r--trunk/avahi-core/conformance-test.c160
-rw-r--r--trunk/avahi-core/core.h153
-rw-r--r--trunk/avahi-core/dns-srv-rr.h89
-rw-r--r--trunk/avahi-core/dns-test.c115
-rw-r--r--trunk/avahi-core/dns.c856
-rw-r--r--trunk/avahi-core/dns.h112
-rw-r--r--trunk/avahi-core/domain-util.c135
-rw-r--r--trunk/avahi-core/domain-util.h47
-rw-r--r--trunk/avahi-core/entry.c1206
-rw-r--r--trunk/avahi-core/fdutil.c73
-rw-r--r--trunk/avahi-core/fdutil.h35
-rw-r--r--trunk/avahi-core/hashmap-test.c64
-rw-r--r--trunk/avahi-core/hashmap.c250
-rw-r--r--trunk/avahi-core/hashmap.h55
-rw-r--r--trunk/avahi-core/iface-linux.c371
-rw-r--r--trunk/avahi-core/iface-linux.h42
-rw-r--r--trunk/avahi-core/iface-pfroute.c521
-rw-r--r--trunk/avahi-core/iface-pfroute.h39
-rw-r--r--trunk/avahi-core/iface.c812
-rw-r--r--trunk/avahi-core/iface.h192
-rw-r--r--trunk/avahi-core/internal.h227
-rw-r--r--trunk/avahi-core/log.c88
-rw-r--r--trunk/avahi-core/log.h75
-rw-r--r--trunk/avahi-core/lookup.h237
-rw-r--r--trunk/avahi-core/multicast-lookup.c352
-rw-r--r--trunk/avahi-core/multicast-lookup.h53
-rw-r--r--trunk/avahi-core/netlink.c211
-rw-r--r--trunk/avahi-core/netlink.h43
-rw-r--r--trunk/avahi-core/prioq-test.c122
-rw-r--r--trunk/avahi-core/prioq.c390
-rw-r--r--trunk/avahi-core/prioq.h51
-rw-r--r--trunk/avahi-core/probe-sched.c402
-rw-r--r--trunk/avahi-core/probe-sched.h36
-rw-r--r--trunk/avahi-core/publish.h177
-rw-r--r--trunk/avahi-core/querier-test.c124
-rw-r--r--trunk/avahi-core/querier.c271
-rw-r--r--trunk/avahi-core/querier.h50
-rw-r--r--trunk/avahi-core/query-sched.c452
-rw-r--r--trunk/avahi-core/query-sched.h38
-rw-r--r--trunk/avahi-core/resolve-address.c270
-rw-r--r--trunk/avahi-core/resolve-host-name.c299
-rw-r--r--trunk/avahi-core/resolve-service.c491
-rw-r--r--trunk/avahi-core/response-sched.c516
-rw-r--r--trunk/avahi-core/response-sched.h39
-rw-r--r--trunk/avahi-core/rr-util.h64
-rw-r--r--trunk/avahi-core/rr.c703
-rw-r--r--trunk/avahi-core/rr.h174
-rw-r--r--trunk/avahi-core/rrlist.c190
-rw-r--r--trunk/avahi-core/rrlist.h42
-rw-r--r--trunk/avahi-core/server.c1723
-rw-r--r--trunk/avahi-core/socket.c930
-rw-r--r--trunk/avahi-core/socket.h49
-rw-r--r--trunk/avahi-core/timeeventq-test.c69
-rw-r--r--trunk/avahi-core/timeeventq.c227
-rw-r--r--trunk/avahi-core/timeeventq.h48
-rw-r--r--trunk/avahi-core/update-test.c92
-rw-r--r--trunk/avahi-core/util.c122
-rw-r--r--trunk/avahi-core/util.h43
-rw-r--r--trunk/avahi-core/wide-area.c725
-rw-r--r--trunk/avahi-core/wide-area.h54
-rw-r--r--trunk/avahi-daemon/AddressResolver.introspect52
-rw-r--r--trunk/avahi-daemon/DomainBrowser.introspect62
-rw-r--r--trunk/avahi-daemon/EntryGroup.introspect103
-rw-r--r--trunk/avahi-daemon/HostNameResolver.introspect52
-rw-r--r--trunk/avahi-daemon/Makefile.am165
-rw-r--r--trunk/avahi-daemon/RecordBrowser.introspect67
-rw-r--r--trunk/avahi-daemon/Server.introspect221
-rw-r--r--trunk/avahi-daemon/ServiceBrowser.introspect65
-rw-r--r--trunk/avahi-daemon/ServiceResolver.introspect57
-rw-r--r--trunk/avahi-daemon/ServiceTypeBrowser.introspect63
-rw-r--r--trunk/avahi-daemon/avahi-daemon.conf60
-rw-r--r--trunk/avahi-daemon/avahi-dbus.conf.in27
-rw-r--r--trunk/avahi-daemon/avahi-service.dtd20
-rw-r--r--trunk/avahi-daemon/caps.c116
-rw-r--r--trunk/avahi-daemon/caps.h29
-rw-r--r--trunk/avahi-daemon/chroot.c417
-rw-r--r--trunk/avahi-daemon/chroot.h36
-rw-r--r--trunk/avahi-daemon/dbus-async-address-resolver.c139
-rw-r--r--trunk/avahi-daemon/dbus-async-host-name-resolver.c138
-rw-r--r--trunk/avahi-daemon/dbus-async-service-resolver.c177
-rw-r--r--trunk/avahi-daemon/dbus-domain-browser.c130
-rw-r--r--trunk/avahi-daemon/dbus-entry-group.c366
-rw-r--r--trunk/avahi-daemon/dbus-internal.h252
-rw-r--r--trunk/avahi-daemon/dbus-protocol.c1178
-rw-r--r--trunk/avahi-daemon/dbus-protocol.h29
-rw-r--r--trunk/avahi-daemon/dbus-record-browser.c161
-rw-r--r--trunk/avahi-daemon/dbus-service-browser.c141
-rw-r--r--trunk/avahi-daemon/dbus-service-type-browser.c133
-rw-r--r--trunk/avahi-daemon/dbus-sync-address-resolver.c92
-rw-r--r--trunk/avahi-daemon/dbus-sync-host-name-resolver.c92
-rw-r--r--trunk/avahi-daemon/dbus-sync-service-resolver.c130
-rw-r--r--trunk/avahi-daemon/dbus-util.c395
-rw-r--r--trunk/avahi-daemon/dbus-util.h59
-rw-r--r--trunk/avahi-daemon/example.service52
-rw-r--r--trunk/avahi-daemon/hosts29
-rw-r--r--trunk/avahi-daemon/ini-file-parser-test.c60
-rw-r--r--trunk/avahi-daemon/ini-file-parser.c194
-rw-r--r--trunk/avahi-daemon/ini-file-parser.h57
-rw-r--r--trunk/avahi-daemon/introspect.dtd37
-rw-r--r--trunk/avahi-daemon/introspect.xsl104
-rw-r--r--trunk/avahi-daemon/main.c1227
-rw-r--r--trunk/avahi-daemon/main.h33
-rw-r--r--trunk/avahi-daemon/setproctitle.c113
-rw-r--r--trunk/avahi-daemon/setproctitle.h30
-rw-r--r--trunk/avahi-daemon/simple-protocol.c547
-rw-r--r--trunk/avahi-daemon/simple-protocol.h31
-rw-r--r--trunk/avahi-daemon/ssh.service36
-rw-r--r--trunk/avahi-daemon/static-hosts.c234
-rw-r--r--trunk/avahi-daemon/static-hosts.h30
-rw-r--r--trunk/avahi-daemon/static-services.c727
-rw-r--r--trunk/avahi-daemon/static-services.h30
-rw-r--r--trunk/avahi-discover-standalone/Makefile.am60
-rw-r--r--trunk/avahi-discover-standalone/avahi-discover.glade91
-rw-r--r--trunk/avahi-discover-standalone/avahi-discover.gladep8
-rw-r--r--trunk/avahi-discover-standalone/main.c371
-rw-r--r--trunk/avahi-dnsconfd/Makefile.am45
-rwxr-xr-xtrunk/avahi-dnsconfd/avahi-dnsconfd.action62
-rw-r--r--trunk/avahi-dnsconfd/main.c663
-rw-r--r--trunk/avahi-glib.pc.in11
-rw-r--r--trunk/avahi-glib/Makefile.am56
-rw-r--r--trunk/avahi-glib/glib-malloc.c57
-rw-r--r--trunk/avahi-glib/glib-malloc.h41
-rw-r--r--trunk/avahi-glib/glib-watch-test.c91
-rw-r--r--trunk/avahi-glib/glib-watch.c404
-rw-r--r--trunk/avahi-glib/glib-watch.h56
-rw-r--r--trunk/avahi-python/Makefile.am61
-rwxr-xr-xtrunk/avahi-python/avahi-bookmarks.in183
-rw-r--r--trunk/avahi-python/avahi-discover.desktop.in10
-rwxr-xr-xtrunk/avahi-python/avahi-discover.in272
-rw-r--r--trunk/avahi-python/avahi/Makefile.am64
-rw-r--r--trunk/avahi-python/avahi/ServiceTypeDatabase.py.in110
-rw-r--r--trunk/avahi-python/avahi/SimpleGladeApp.py341
-rw-r--r--trunk/avahi-python/avahi/__init__.py114
-rw-r--r--trunk/avahi-qt/Makefile.am72
-rw-r--r--trunk/avahi-qt/qt-watch.cpp200
-rw-r--r--trunk/avahi-qt/qt-watch.h36
-rw-r--r--trunk/avahi-qt3.pc.in11
-rw-r--r--trunk/avahi-qt4.pc.in11
-rw-r--r--trunk/avahi-sharp.pc.in8
-rw-r--r--trunk/avahi-sharp/AddressResolver.cs192
-rw-r--r--trunk/avahi-sharp/AssemblyInfo.cs50
-rw-r--r--trunk/avahi-sharp/AvahiTest.cs133
-rw-r--r--trunk/avahi-sharp/BrowserBase.cs52
-rw-r--r--trunk/avahi-sharp/Client.cs385
-rw-r--r--trunk/avahi-sharp/ClientException.cs125
-rw-r--r--trunk/avahi-sharp/DomainBrowser.cs200
-rw-r--r--trunk/avahi-sharp/EntryGroup.cs378
-rw-r--r--trunk/avahi-sharp/HostNameResolver.cs169
-rw-r--r--trunk/avahi-sharp/Makefile.am84
-rw-r--r--trunk/avahi-sharp/RecordBrowser.cs227
-rw-r--r--trunk/avahi-sharp/ResolverBase.cs36
-rw-r--r--trunk/avahi-sharp/ServiceBrowser.cs216
-rw-r--r--trunk/avahi-sharp/ServiceResolver.cs224
-rw-r--r--trunk/avahi-sharp/ServiceTypeBrowser.cs199
-rw-r--r--trunk/avahi-sharp/Utility.cs114
-rw-r--r--trunk/avahi-sharp/avahi-sharp-docs.source4
-rw-r--r--trunk/avahi-sharp/avahi-sharp.dll.config.in5
-rw-r--r--trunk/avahi-sharp/avahi.snkbin596 -> 0 bytes
-rw-r--r--trunk/avahi-sharp/en/Avahi.xml6
-rw-r--r--trunk/avahi-sharp/en/Avahi/AddressResolver.xml113
-rw-r--r--trunk/avahi-sharp/en/Avahi/BrowserBase.xml59
-rw-r--r--trunk/avahi-sharp/en/Avahi/Client.xml178
-rw-r--r--trunk/avahi-sharp/en/Avahi/ClientException.xml29
-rw-r--r--trunk/avahi-sharp/en/Avahi/ClientFlags.xml51
-rw-r--r--trunk/avahi-sharp/en/Avahi/ClientState.xml66
-rw-r--r--trunk/avahi-sharp/en/Avahi/ClientStateArgs.xml41
-rw-r--r--trunk/avahi-sharp/en/Avahi/ClientStateHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/Avahi/DomainBrowser.xml101
-rw-r--r--trunk/avahi-sharp/en/Avahi/DomainBrowserType.xml66
-rw-r--r--trunk/avahi-sharp/en/Avahi/DomainInfo.xml61
-rw-r--r--trunk/avahi-sharp/en/Avahi/DomainInfoArgs.xml41
-rw-r--r--trunk/avahi-sharp/en/Avahi/DomainInfoHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/Avahi/EntryGroup.xml491
-rw-r--r--trunk/avahi-sharp/en/Avahi/EntryGroupState.xml66
-rw-r--r--trunk/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml41
-rw-r--r--trunk/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/Avahi/ErrorCode.xml526
-rw-r--r--trunk/avahi-sharp/en/Avahi/ErrorCodeArgs.xml41
-rw-r--r--trunk/avahi-sharp/en/Avahi/ErrorCodeHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/Avahi/HostAddressArgs.xml55
-rw-r--r--trunk/avahi-sharp/en/Avahi/HostAddressHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/Avahi/HostNameResolver.xml115
-rw-r--r--trunk/avahi-sharp/en/Avahi/LookupFlags.xml71
-rw-r--r--trunk/avahi-sharp/en/Avahi/LookupResultFlags.xml81
-rw-r--r--trunk/avahi-sharp/en/Avahi/Protocol.xml46
-rw-r--r--trunk/avahi-sharp/en/Avahi/PublishFlags.xml121
-rw-r--r--trunk/avahi-sharp/en/Avahi/RecordBrowser.xml107
-rw-r--r--trunk/avahi-sharp/en/Avahi/RecordClass.xml26
-rw-r--r--trunk/avahi-sharp/en/Avahi/RecordInfo.xml94
-rw-r--r--trunk/avahi-sharp/en/Avahi/RecordInfoArgs.xml41
-rw-r--r--trunk/avahi-sharp/en/Avahi/RecordInfoHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/Avahi/RecordType.xml116
-rw-r--r--trunk/avahi-sharp/en/Avahi/ResolverBase.xml37
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceBrowser.xml119
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceInfo.xml138
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceInfoArgs.xml41
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceInfoHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceResolver.xml125
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml113
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceTypeInfo.xml72
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml41
-rw-r--r--trunk/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml23
-rw-r--r--trunk/avahi-sharp/en/index.xml79
-rwxr-xr-xtrunk/avahi-sharp/gencfg.sh12
-rw-r--r--trunk/avahi-utils/Makefile.am65
-rw-r--r--trunk/avahi-utils/avahi-browse.c791
-rw-r--r--trunk/avahi-utils/avahi-publish.c423
-rw-r--r--trunk/avahi-utils/avahi-resolve.c339
-rw-r--r--trunk/avahi-utils/sigint.c146
-rw-r--r--trunk/avahi-utils/sigint.h30
-rw-r--r--trunk/avahi-utils/stdb.c160
-rw-r--r--trunk/avahi-utils/stdb.h30
-rwxr-xr-xtrunk/bootstrap.sh62
-rw-r--r--trunk/common/Makefile.am23
-rw-r--r--trunk/common/acx_pthread.m4348
-rw-r--r--trunk/common/doxygen.m4312
-rw-r--r--trunk/common/doxygen.mk187
-rw-r--r--trunk/common/python.m462
-rw-r--r--trunk/configure.ac982
-rw-r--r--trunk/docs/API-CHANGES-0.677
-rw-r--r--trunk/docs/AUTHORS12
-rw-r--r--trunk/docs/COMPAT-LAYERS18
-rw-r--r--trunk/docs/DBUS-API15
-rw-r--r--trunk/docs/HACKING91
-rw-r--r--trunk/docs/INSTALL55
-rw-r--r--trunk/docs/MALLOC10
-rw-r--r--trunk/docs/NEWS552
-rw-r--r--trunk/docs/README50
-rw-r--r--trunk/docs/TODO106
-rw-r--r--trunk/docs/avahi-poll.dia1042
-rw-r--r--trunk/docs/overview.dia1495
-rw-r--r--trunk/docs/server-states.dia975
-rw-r--r--trunk/doxygen.cfg213
-rw-r--r--trunk/examples/Makefile.am65
-rw-r--r--trunk/examples/client-browse-services.c199
-rw-r--r--trunk/examples/client-publish-service.c246
-rw-r--r--trunk/examples/core-browse-services.c215
-rw-r--r--trunk/examples/core-publish-service.c246
-rw-r--r--trunk/examples/glib-integration.c148
-rw-r--r--trunk/initscript/Makefile.am56
-rw-r--r--trunk/initscript/archlinux/Makefile.am40
-rw-r--r--trunk/initscript/archlinux/avahi-daemon.in74
-rwxr-xr-xtrunk/initscript/archlinux/avahi-dnsconfd.in74
-rw-r--r--trunk/initscript/darwin/Makefile.am40
-rw-r--r--trunk/initscript/darwin/org.freedesktop.avahi-daemon.plist.in16
-rw-r--r--trunk/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in16
-rw-r--r--trunk/initscript/debian/Makefile.am46
-rwxr-xr-xtrunk/initscript/debian/avahi-daemon.in160
-rwxr-xr-xtrunk/initscript/debian/avahi-dnsconfd.in166
-rw-r--r--trunk/initscript/fedora/Makefile.am34
-rw-r--r--trunk/initscript/fedora/avahi-daemon.in102
-rw-r--r--trunk/initscript/fedora/avahi-dnsconfd.in99
-rw-r--r--trunk/initscript/freebsd/Makefile.am43
-rw-r--r--trunk/initscript/freebsd/avahi-daemon.sh.in36
-rw-r--r--trunk/initscript/freebsd/avahi-dnsconfd.sh.in39
-rw-r--r--trunk/initscript/gentoo/Makefile.am45
-rw-r--r--trunk/initscript/gentoo/avahi-daemon.in29
-rw-r--r--trunk/initscript/gentoo/avahi-dnsconfd.in29
-rw-r--r--trunk/initscript/mandriva/Makefile.am34
-rw-r--r--trunk/initscript/mandriva/avahi-daemon.in94
-rw-r--r--trunk/initscript/mandriva/avahi-dnsconfd.in94
-rw-r--r--trunk/initscript/slackware/Makefile.am34
-rw-r--r--trunk/initscript/slackware/avahi-daemon.in80
-rw-r--r--trunk/initscript/slackware/avahi-dnsconfd.in80
-rw-r--r--trunk/initscript/suse/Makefile.am34
-rw-r--r--trunk/initscript/suse/avahi-daemon.in56
-rw-r--r--trunk/initscript/suse/avahi-dnsconfd.in47
-rw-r--r--trunk/man/Makefile.am232
-rw-r--r--trunk/man/avahi-bookmarks.1.xml.in101
-rw-r--r--trunk/man/avahi-browse.1.xml.in126
-rw-r--r--trunk/man/avahi-daemon.8.xml.in170
-rw-r--r--trunk/man/avahi-daemon.conf.5.xml.in305
-rw-r--r--trunk/man/avahi-discover.1.xml.in61
-rw-r--r--trunk/man/avahi-dnsconfd.8.xml.in104
-rw-r--r--trunk/man/avahi-dnsconfd.action.8.xml.in92
-rw-r--r--trunk/man/avahi-publish.1.xml.in124
-rw-r--r--trunk/man/avahi-resolve.1.xml.in107
-rw-r--r--trunk/man/avahi.hosts.5.xml.in62
-rw-r--r--trunk/man/avahi.service.5.xml.in124
-rw-r--r--trunk/man/xmltoman.css30
-rw-r--r--trunk/man/xmltoman.dtd39
-rw-r--r--trunk/man/xmltoman.xsl129
-rw-r--r--trunk/service-type-database/Makefile.am59
-rwxr-xr-xtrunk/service-type-database/build-db.in46
-rw-r--r--trunk/service-type-database/service-types136
-rw-r--r--trunk/specs/draft-cheshire-dnsext-dns-sd-02.txt1798
-rw-r--r--trunk/specs/draft-cheshire-dnsext-dns-sd-03.txt1856
-rw-r--r--trunk/specs/draft-cheshire-dnsext-multicastdns-03.txt2494
-rw-r--r--trunk/specs/draft-cheshire-dnsext-multicastdns-04.txt2494
-rw-r--r--trunk/specs/draft-cheshire-dnsext-multicastdns-05.txt2640
-rw-r--r--trunk/tests/Makefile.am55
-rwxr-xr-xtrunk/tests/c-plus-plus-test-gen.py68
-rw-r--r--trunk/tests/c-plus-plus-test.cc84
-rwxr-xr-xtrunk/tests/fuzz-mdns.py8
981 files changed, 5690 insertions, 170552 deletions
diff --git a/Makefile.am b/Makefile.am
index 3c75e1e..bc51911 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,8 @@ EXTRA_DIST = \
avahi-qt4.pc.in \
avahi-sharp.pc.in \
avahi-compat-libdns_sd.pc.in \
- avahi-compat-howl.pc.in
+ avahi-compat-howl.pc.in \
+ avahi-ui.pc.in
SUBDIRS = \
common \
@@ -67,37 +68,70 @@ SUBDIRS = \
tests \
service-type-database \
avahi-compat-libdns_sd \
- avahi-compat-howl
-
+ avahi-compat-howl \
+ avahi-autoipd \
+ avahi-ui
DX_INPUT = \
- $(srcdir)/avahi-core/core.h \
- $(srcdir)/avahi-core/lookup.h \
- $(srcdir)/avahi-core/publish.h \
$(srcdir)/avahi-common/address.h \
- $(srcdir)/avahi-core/rr.h \
$(srcdir)/avahi-common/strlst.h \
$(srcdir)/avahi-common/alternative.h \
- $(srcdir)/avahi-core/log.h \
$(srcdir)/avahi-common/defs.h \
- $(srcdir)/avahi-client/client.h \
- $(srcdir)/avahi-client/lookup.h \
- $(srcdir)/avahi-client/publish.h \
$(srcdir)/avahi-common/error.h \
$(srcdir)/avahi-common/malloc.h \
$(srcdir)/avahi-common/domain.h \
$(srcdir)/avahi-common/watch.h \
$(srcdir)/avahi-common/simple-watch.h \
$(srcdir)/avahi-common/thread-watch.h \
- $(srcdir)/avahi-glib/glib-watch.h \
- $(srcdir)/avahi-glib/glib-malloc.h \
- $(srcdir)/avahi-common/timeval.h \
- $(srcdir)/avahi-qt/qt-watch.h
+ $(srcdir)/avahi-common/timeval.h
DX_EXAMPLE_PATH = $(srcdir)/examples
-
DX_EXAMPLE_PATTERNS = *.c
+if HAVE_QT3
+DX_INPUT += \
+ $(srcdir)/avahi-qt/qt-watch.h
+else
+if HAVE_QT4
+DX_INPUT += \
+ $(srcdir)/avahi-qt/qt-watch.h
+endif
+endif
+
+if HAVE_GLIB
+DX_INPUT += \
+ $(srcdir)/avahi-glib/glib-watch.h \
+ $(srcdir)/avahi-glib/glib-malloc.h
+endif
+
+if HAVE_DBUS
+DX_INPUT += \
+ $(srcdir)/avahi-client/client.h \
+ $(srcdir)/avahi-client/lookup.h \
+ $(srcdir)/avahi-client/publish.h
+endif
+
+if HAVE_DBUS
+if HAVE_GTK
+DX_INPUT += \
+ $(srcdir)/avahi-ui/avahi-ui.h
+endif
+endif
+
+if ENABLE_CORE_DOCS
+DX_INPUT += \
+ $(srcdir)/avahi-core/core.h \
+ $(srcdir)/avahi-core/lookup.h \
+ $(srcdir)/avahi-core/publish.h \
+ $(srcdir)/avahi-core/rr.h \
+ $(srcdir)/avahi-core/log.h
+endif
+
+if HAVE_GTK
+DX_INPUT += \
+ $(srcdir)/avahi-ui/avahi-ui.h
+endif
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = avahi-core.pc
@@ -173,6 +207,21 @@ CLEANFILES += avahi-glib.pc
endif
+if HAVE_GTK
+if HAVE_DBUS
+
+pkgconfig_DATA += avahi-ui.pc
+
+avahi-ui.pc: avahi-ui.pc.in
+ sed -e 's,@prefix\@,$(prefix),g' \
+ -e 's,@libdir\@,$(libdir),g' \
+ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
+
+CLEANFILES += avahi-ui.pc
+
+endif
+endif
+
if HAVE_QT3
pkgconfig_DATA += avahi-qt3.pc
@@ -209,6 +258,7 @@ homepage:
scp avahi-daemon/*.introspect avahi-daemon/introspect.dtd avahi-daemon/introspect.xsl\
man/*.xml man/xmltoman.dtd man/xmltoman.xsl \
tango:www/avahi.org/tree/download/
+ scp avahi-$(PACKAGE_VERSION).tar.gz tango:www/avahi.org/tree/download/
rm -rf doxygen
$(MAKE) doxygen-run
ssh tango rm -rf www/avahi.org/tree/download/doxygen
diff --git a/trunk/avahi-autoipd/Makefile.am b/avahi-autoipd/Makefile.am
index 11e6493..eb6c3f8 100644
--- a/trunk/avahi-autoipd/Makefile.am
+++ b/avahi-autoipd/Makefile.am
@@ -36,15 +36,30 @@ sbin_PROGRAMS = avahi-autoipd
avahi_autoipd_SOURCES = \
main.c main.h \
../avahi-daemon/setproctitle.c ../avahi-daemon/setproctitle.h \
- iface.h iface-linux.c \
+ iface.h \
../avahi-common/malloc.h ../avahi-common/malloc.c \
../avahi-common/timeval.h ../avahi-common/timeval.c
avahi_autoipd_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
avahi_autoipd_LDADD = $(AM_LDADD) $(LIBDAEMON_LIBS)
+if TARGET_FREEBSD
+avahi_autoipd_SOURCES += iface-bsd.c
+avahi_autoipd_LDADD += -lpcap
+else
+avahi_autoipd_SOURCES += iface-linux.c
+endif
+
pkgsysconf_SCRIPTS=avahi-autoipd.action
+if TARGET_FREEBSD
+avahi-autoipd.action: avahi-autoipd.action.bsd
+ cp $< $@
+else
+avahi-autoipd.action: avahi-autoipd.action.linux
+ cp $< $@
+endif
+
if TARGET_DEBIAN
noinst_SCRIPTS = dhclient-enter-hook dhclient-exit-hook
@@ -76,6 +91,6 @@ endif
endif
endif
-EXTRA_DIST=avahi-autoipd.action dhclient-enter-hook.in dhclient-exit-hook.in
+EXTRA_DIST=avahi-autoipd.action dhclient-enter-hook.in dhclient-exit-hook.in avahi-autoipd.action.linux avahi-autoipd.action.bsd
-CLEANFILES=dhclient-enter-hook dhclient-exit-hook
+CLEANFILES=dhclient-enter-hook dhclient-exit-hook avahi-autoipd.action
diff --git a/release-0.6.9/service-type-database/Makefile.am b/avahi-autoipd/avahi-autoipd.action.bsd
index 2b20512..db39c4e 100644..100755
--- a/release-0.6.9/service-type-database/Makefile.am
+++ b/avahi-autoipd/avahi-autoipd.action.bsd
@@ -1,3 +1,5 @@
+#!/bin/sh
+
# $Id$
#
# This file is part of avahi.
@@ -17,22 +19,32 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-EXTRA_DIST=build-db.in service-types
-
-pkgdata_DATA=service-types
+set -e
-if HAVE_PYTHON
+# Command line arguments:
+# $1 event that happened:
+# BIND: Successfully claimed address
+# CONFLICT: An IP address conflict happened
+# UNBIND: The IP address is no longer needed
+# STOP: The daemon is terminating
+# $2 interface name
+# $3 IP adddress
-noinst_SCRIPTS=build-db
-pkgdata_DATA+=service-types.db
+# We have the BSD ifconfig tool
-build-db: build-db.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' $< > $@
- chmod +x $@
+case "$1" in
+BIND)
+ ifconfig "$2" "$3"/16
+ ;;
-service-types.db: service-types build-db
- $(PYTHON) build-db $(srcdir)/$< $@
+CONFLICT|STOP|UNBIND)
+ ifconfig "$2" "$3"/16 delete
+ ;;
-CLEANFILES = service-types.db build-db
+*)
+ echo "Unknown event $1" >&2
+ exit 1
+ ;;
+esac
-endif
+exit 0
diff --git a/trunk/avahi-autoipd/avahi-autoipd.action b/avahi-autoipd/avahi-autoipd.action.linux
index 27f00bb..27f00bb 100755
--- a/trunk/avahi-autoipd/avahi-autoipd.action
+++ b/avahi-autoipd/avahi-autoipd.action.linux
diff --git a/trunk/avahi-autoipd/dhclient-enter-hook.in b/avahi-autoipd/dhclient-enter-hook.in
index 0c274b9..0c274b9 100755
--- a/trunk/avahi-autoipd/dhclient-enter-hook.in
+++ b/avahi-autoipd/dhclient-enter-hook.in
diff --git a/trunk/avahi-autoipd/dhclient-exit-hook.in b/avahi-autoipd/dhclient-exit-hook.in
index 4f7167e..4f7167e 100755
--- a/trunk/avahi-autoipd/dhclient-exit-hook.in
+++ b/avahi-autoipd/dhclient-exit-hook.in
diff --git a/avahi-autoipd/iface-bsd.c b/avahi-autoipd/iface-bsd.c
new file mode 100644
index 0000000..23c02dd
--- /dev/null
+++ b/avahi-autoipd/iface-bsd.c
@@ -0,0 +1,416 @@
+/* rcs tags go here */
+/* Original author: Bruce M. Simpson <bms@FreeBSD.org> */
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with avahi; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+
+#include <net/if.h>
+#include <net/route.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include <unistd.h>
+
+#include <libdaemon/dlog.h>
+
+#include <avahi-common/llist.h>
+#include <avahi-common/malloc.h>
+
+#include "iface.h"
+
+#ifndef IN_LINKLOCAL
+#define IN_LINKLOCAL(i) (((u_int32_t)(i) & (0xffff0000)) == (0xa9fe0000))
+#endif
+
+#ifndef elementsof
+#define elementsof(array) (sizeof(array)/sizeof(array[0]))
+#endif
+
+#ifndef so_set_nonblock
+#define so_set_nonblock(s, val) \
+ do { \
+ int __flags; \
+ __flags = fcntl((s), F_GETFL); \
+ if (__flags == -1) \
+ break; \
+ if (val != 0) \
+ __flags |= O_NONBLOCK; \
+ else \
+ __flags &= ~O_NONBLOCK; \
+ (void)fcntl((s), F_SETFL, __flags); \
+ } while (0)
+#endif
+
+#define MAX_RTMSG_SIZE 2048
+
+struct rtm_dispinfo {
+ u_char *di_buf;
+ ssize_t di_buflen;
+ ssize_t di_len;
+};
+
+union rtmunion {
+ struct rt_msghdr rtm;
+ struct if_msghdr ifm;
+ struct ifa_msghdr ifam;
+ struct ifma_msghdr ifmam;
+ struct if_announcemsghdr ifan;
+};
+typedef union rtmunion rtmunion_t;
+
+struct Address;
+typedef struct Address Address;
+
+struct Address {
+ in_addr_t address;
+ AVAHI_LLIST_FIELDS(Address, addresses);
+};
+
+static int rtm_dispatch(void);
+static int rtm_dispatch_newdeladdr(struct rtm_dispinfo *di);
+static int rtm_dispatch_ifannounce(struct rtm_dispinfo *di);
+static struct sockaddr *next_sa(struct sockaddr *sa);
+
+static int fd = -1;
+static int ifindex = -1;
+static AVAHI_LLIST_HEAD(Address, addresses) = NULL;
+
+int
+iface_init(int idx)
+{
+
+ fd = socket(PF_ROUTE, SOCK_RAW, 0);
+ if (fd == -1) {
+ daemon_log(LOG_ERR, "socket(PF_ROUTE): %s", strerror(errno));
+ return (-1);
+ }
+
+ so_set_nonblock(fd, 1);
+
+ ifindex = idx;
+
+ return (fd);
+}
+
+int
+iface_get_initial_state(State *state)
+{
+ int mib[6];
+ char *buf;
+ struct if_msghdr *ifm;
+ struct ifa_msghdr *ifam;
+ char *lim;
+ char *next;
+ struct sockaddr *sa;
+ size_t len;
+ int naddrs;
+
+ assert(state != NULL);
+ assert(fd != -1);
+
+ naddrs = 0;
+
+ mib[0] = CTL_NET;
+ mib[1] = PF_ROUTE;
+ mib[2] = 0;
+ mib[3] = 0;
+ mib[4] = NET_RT_IFLIST;
+ mib[5] = ifindex;
+
+ if (sysctl(mib, elementsof(mib), NULL, &len, NULL, 0) != 0) {
+ daemon_log(LOG_ERR, "sysctl(NET_RT_IFLIST): %s",
+ strerror(errno));
+ return (-1);
+ }
+
+ buf = malloc(len);
+ if (buf == NULL) {
+ daemon_log(LOG_ERR, "malloc(%d): %s", len, strerror(errno));
+ return (-1);
+ }
+
+ if (sysctl(mib, elementsof(mib), buf, &len, NULL, 0) != 0) {
+ daemon_log(LOG_ERR, "sysctl(NET_RT_IFLIST): %s",
+ strerror(errno));
+ free(buf);
+ return (-1);
+ }
+
+ lim = buf + len;
+ for (next = buf; next < lim; next += ifm->ifm_msglen) {
+ ifm = (struct if_msghdr *)next;
+ if (ifm->ifm_type == RTM_NEWADDR) {
+ ifam = (struct ifa_msghdr *)next;
+ sa = (struct sockaddr *)(ifam + 1);
+ if (sa->sa_family != AF_INET)
+ continue;
+ ++naddrs;
+ }
+ }
+ free(buf);
+
+ *state = (naddrs > 0) ? STATE_SLEEPING : STATE_START;
+
+ return (0);
+}
+
+int
+iface_process(Event *event)
+{
+ int b;
+
+ assert(fd != -1);
+
+ b = !!addresses;
+
+ if (rtm_dispatch() == -1)
+ return (-1);
+
+ if (b && !addresses)
+ *event = EVENT_ROUTABLE_ADDR_UNCONFIGURED;
+ else if (!b && addresses)
+ *event = EVENT_ROUTABLE_ADDR_CONFIGURED;
+
+ return (0);
+}
+
+void
+iface_done(void)
+{
+ Address *a;
+
+ if (fd != -1) {
+ close(fd);
+ fd = -1;
+ }
+
+ while ((a = addresses) != NULL) {
+ AVAHI_LLIST_REMOVE(Address, addresses, addresses, a);
+ avahi_free(a);
+ }
+}
+
+/*
+ * Dispatch kernel routing socket messages.
+ */
+static int
+rtm_dispatch(void)
+{
+ struct msghdr mh;
+ struct iovec iov[1];
+ struct rt_msghdr *rtm;
+ struct rtm_dispinfo *di;
+ ssize_t len;
+ int retval;
+
+ di = malloc(sizeof(*di));
+ if (di == NULL) {
+ daemon_log(LOG_ERR, "malloc(%d): %s", sizeof(*di),
+ strerror(errno));
+ return (-1);
+ }
+ di->di_buflen = MAX_RTMSG_SIZE;
+ di->di_buf = calloc(MAX_RTMSG_SIZE, 1);
+ if (di->di_buf == NULL) {
+ free(di);
+ daemon_log(LOG_ERR, "calloc(%d): %s", MAX_RTMSG_SIZE,
+ strerror(errno));
+ return (-1);
+ }
+
+ memset(&mh, 0, sizeof(mh));
+ iov[0].iov_base = di->di_buf;
+ iov[0].iov_len = di->di_buflen;
+ mh.msg_iov = iov;
+ mh.msg_iovlen = 1;
+
+ retval = 0;
+ for (;;) {
+ len = recvmsg(fd, &mh, MSG_DONTWAIT);
+ if (len == -1) {
+ if (errno == EWOULDBLOCK)
+ break;
+ else {
+ daemon_log(LOG_ERR, "recvmsg(): %s",
+ strerror(errno));
+ retval = -1;
+ break;
+ }
+ }
+
+ rtm = (void *)di->di_buf;
+ if (rtm->rtm_version != RTM_VERSION) {
+ daemon_log(LOG_ERR,
+ "unknown routing socket message (version %d)\n",
+ rtm->rtm_version);
+ /* this is non-fatal; just ignore it for now. */
+ continue;
+ }
+
+ switch (rtm->rtm_type) {
+ case RTM_NEWADDR:
+ case RTM_DELADDR:
+ retval = rtm_dispatch_newdeladdr(di);
+ break;
+ case RTM_IFANNOUNCE:
+ retval = rtm_dispatch_ifannounce(di);
+ break;
+ default:
+ break;
+ }
+
+ /*
+ * If we got an error; assume our position on the call
+ * stack is enclosed by a level-triggered event loop,
+ * and signal the error condition.
+ */
+ if (retval != 0)
+ break;
+ }
+ free(di->di_buf);
+ free(di);
+
+ return (retval);
+}
+
+/* handle link coming or going away */
+static int
+rtm_dispatch_ifannounce(struct rtm_dispinfo *di)
+{
+ rtmunion_t *rtm = (void *)di->di_buf;
+
+ assert(rtm->rtm.rtm_type == RTM_IFANNOUNCE);
+
+ switch (rtm->ifan.ifan_what) {
+ case IFAN_ARRIVAL:
+ if (rtm->ifan.ifan_index == ifindex) {
+ daemon_log(LOG_ERR,
+"RTM_IFANNOUNCE IFAN_ARRIVAL, for ifindex %d, which we already manage.",
+ ifindex);
+ return (-1);
+ }
+ break;
+ case IFAN_DEPARTURE:
+ if (rtm->ifan.ifan_index == ifindex) {
+ daemon_log(LOG_ERR, "Interface vanished.");
+ return (-1);
+ }
+ break;
+ default:
+ /* ignore */
+ break;
+ }
+
+ return (0);
+}
+
+static struct sockaddr *
+next_sa(struct sockaddr *sa)
+{
+ void *p;
+ size_t sa_size;
+
+ sa_size = sa->sa_len;
+ if (sa_size < sizeof(u_long))
+ sa_size = sizeof(u_long);
+ p = ((char *)sa) + sa_size;
+
+ return (struct sockaddr *)p;
+}
+
+/* handle address coming or going away */
+static int
+rtm_dispatch_newdeladdr(struct rtm_dispinfo *di)
+{
+ Address *ap;
+ rtmunion_t *rtm;
+ struct sockaddr *sa;
+ struct sockaddr_in *sin;
+
+/* macro to skip to next RTA; has side-effects */
+#define SKIPRTA(rtmsgp, rta, sa) \
+ do { \
+ if ((rtmsgp)->rtm_addrs & (rta)) \
+ (sa) = next_sa((sa)); \
+ } while (0)
+
+ rtm = (void *)di->di_buf;
+
+ assert(rtm->rtm.rtm_type == RTM_NEWADDR ||
+ rtm->rtm.rtm_type == RTM_DELADDR);
+
+ if (rtm->rtm.rtm_index != ifindex)
+ return (0);
+
+ if (!(rtm->rtm.rtm_addrs & RTA_IFA)) {
+ daemon_log(LOG_ERR, "ifa msg has no RTA_IFA.");
+ return (0);
+ }
+
+ /* skip over rtmsg padding correctly */
+ sa = (struct sockaddr *)((&rtm->ifam) + 1);
+ SKIPRTA(&rtm->rtm, RTA_DST, sa);
+ SKIPRTA(&rtm->rtm, RTA_GATEWAY, sa);
+ SKIPRTA(&rtm->rtm, RTA_NETMASK, sa);
+ SKIPRTA(&rtm->rtm, RTA_GENMASK, sa);
+ SKIPRTA(&rtm->rtm, RTA_IFP, sa);
+
+ /*
+ * sa now points to RTA_IFA sockaddr; we are only interested
+ * in updates for link-local addresses.
+ */
+ if (sa->sa_family != AF_INET)
+ return (0);
+ sin = (struct sockaddr_in *)sa;
+ if (!IN_LINKLOCAL(ntohl(sin->sin_addr.s_addr)))
+ return (0);
+
+ for (ap = addresses; ap; ap = ap->addresses_next) {
+ if (ap->address == sin->sin_addr.s_addr)
+ break;
+ }
+ if (rtm->rtm.rtm_type == RTM_DELADDR && ap != NULL) {
+ AVAHI_LLIST_REMOVE(Address, addresses, addresses, ap);
+ avahi_free(ap);
+ }
+ if (rtm->rtm.rtm_type == RTM_NEWADDR && ap == NULL) {
+ ap = avahi_new(Address, 1);
+ ap->address = sin->sin_addr.s_addr;
+ AVAHI_LLIST_PREPEND(Address, addresses, addresses, ap);
+ }
+
+ return (0);
+#undef SKIPRTA
+}
diff --git a/trunk/avahi-autoipd/iface-linux.c b/avahi-autoipd/iface-linux.c
index 2ad8a61..bd3fd57 100644
--- a/trunk/avahi-autoipd/iface-linux.c
+++ b/avahi-autoipd/iface-linux.c
@@ -66,6 +66,7 @@ AVAHI_LLIST_HEAD(Address, addresses) = NULL;
int iface_init(int i) {
struct sockaddr_nl addr;
+ int on = 1;
if ((fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
daemon_log(LOG_ERR, "socket(PF_NETLINK): %s", strerror(errno));
@@ -81,6 +82,11 @@ int iface_init(int i) {
daemon_log(LOG_ERR, "bind(): %s", strerror(errno));
goto fail;
}
+
+ if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
+ daemon_log(LOG_ERR, "SO_PASSCRED: %s", strerror(errno));
+ goto fail;
+ }
ifindex = i;
@@ -178,14 +184,42 @@ static int process_response(int wait_for_done, unsigned seq) {
do {
size_t bytes;
ssize_t r;
- char replybuf[2048];
+ char replybuf[8*1024];
+ char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
+ struct msghdr msghdr;
+ struct cmsghdr *cmsghdr;
+ struct ucred *ucred;
+ struct iovec iov;
struct nlmsghdr *p = (struct nlmsghdr *) replybuf;
+
+ memset(&iov, 0, sizeof(iov));
+ iov.iov_base = replybuf;
+ iov.iov_len = sizeof(replybuf);
+
+ memset(&msghdr, 0, sizeof(msghdr));
+ msghdr.msg_name = (void*) NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = &iov;
+ msghdr.msg_iovlen = 1;
+ msghdr.msg_control = cred_msg;
+ msghdr.msg_controllen = sizeof(cred_msg);
+ msghdr.msg_flags = 0;
+
+ if ((r = recvmsg(fd, &msghdr, 0)) < 0) {
+ daemon_log(LOG_ERR, "recvmsg() failed: %s", strerror(errno));
+ return -1;
+ }
- if ((r = recv(fd, replybuf, sizeof(replybuf), 0)) < 0) {
- daemon_log(LOG_ERR, "recv() failed: %s", strerror(errno));
+ if (!(cmsghdr = CMSG_FIRSTHDR(&msghdr)) || cmsghdr->cmsg_type != SCM_CREDENTIALS) {
+ daemon_log(LOG_WARNING, "No sender credentials received, ignoring data.");
return -1;
}
+ ucred = (struct ucred*) CMSG_DATA(cmsghdr);
+
+ if (ucred->uid != 0)
+ return -1;
+
bytes = (size_t) r;
for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
diff --git a/trunk/avahi-autoipd/iface.h b/avahi-autoipd/iface.h
index 017c90d..017c90d 100644
--- a/trunk/avahi-autoipd/iface.h
+++ b/avahi-autoipd/iface.h
diff --git a/trunk/avahi-autoipd/main.c b/avahi-autoipd/main.c
index ff2cfee..bf3e775 100644
--- a/trunk/avahi-autoipd/main.c
+++ b/avahi-autoipd/main.c
@@ -23,32 +23,49 @@
#include <config.h>
#endif
-#include <stdlib.h>
-#include <unistd.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <sys/wait.h>
+#ifdef __FreeBSD__
+#include <sys/sysctl.h>
+#endif
+
+#ifdef __linux__
#include <netpacket/packet.h>
+#endif
#include <net/ethernet.h>
-#include <fcntl.h>
-#include <time.h>
+#include <net/if.h>
+#ifdef __FreeBSD__
+#include <net/if_dl.h>
+#include <net/route.h>
+#endif
+#include <arpa/inet.h>
+
#include <assert.h>
#include <errno.h>
-#include <string.h>
#include <inttypes.h>
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include <sys/ioctl.h>
-#include <poll.h>
-#include <net/if.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include <stdio.h>
-#include <getopt.h>
#include <signal.h>
-#include <sys/wait.h>
-#include <pwd.h>
+#include <string.h>
+#include <time.h>
+#include <getopt.h>
+
#include <grp.h>
+#include <poll.h>
+#include <pwd.h>
+#include <unistd.h>
+
+#ifndef __linux__
+#include <pcap.h>
+#endif
#include <avahi-common/malloc.h>
#include <avahi-common/timeval.h>
-
#include <avahi-daemon/setproctitle.h>
#include <libdaemon/dfork.h>
@@ -60,10 +77,6 @@
#include "main.h"
#include "iface.h"
-#ifndef __linux__
-#error "avahi-autoipd is only available on Linux for now"
-#endif
-
/* An implementation of RFC 3927 */
/* Constants from the RFC */
@@ -84,6 +97,7 @@
#define IPV4LL_BROADCAST 0xA9FEFFFFL
#define ETHER_ADDRLEN 6
+#define ETHER_HDR_SIZE (2+2*ETHER_ADDRLEN)
#define ARP_PACKET_SIZE (8+4+4+2*ETHER_ADDRLEN)
typedef enum ArpOperation {
@@ -98,6 +112,11 @@ typedef struct ArpPacketInfo {
uint8_t sender_hw_address[ETHER_ADDRLEN], target_hw_address[ETHER_ADDRLEN];
} ArpPacketInfo;
+typedef struct ArpPacket {
+ uint8_t *ether_header;
+ uint8_t *ether_payload;
+} ArpPacket;
+
static State state = STATE_START;
static int n_iteration = 0;
static int n_conflict = 0;
@@ -249,16 +268,44 @@ fail:
return -1;
}
-static void* packet_new(const ArpPacketInfo *info, size_t *packet_len) {
+/*
+ * Allocate a buffer with two pointers in front, one of which is
+ * guaranteed to point ETHER_HDR_SIZE bytes into it.
+ */
+static ArpPacket* packet_new(size_t packet_len) {
+ ArpPacket *p;
+ uint8_t *b;
+
+ assert(packet_len > 0);
+
+#ifdef __linux__
+ b = avahi_new0(uint8_t, sizeof(struct ArpPacket) + packet_len);
+ p = (ArpPacket*) b;
+ p->ether_header = NULL;
+ p->ether_payload = b + sizeof(struct ArpPacket);
+
+#else
+ b = avahi_new0(uint8_t, sizeof(struct ArpPacket) + ETHER_HDR_SIZE + packet_len);
+ p = (ArpPacket*) b;
+ p->ether_header = b + sizeof(struct ArpPacket);
+ p->ether_payload = b + sizeof(struct ArpPacket) + ETHER_HDR_SIZE;
+#endif
+
+ return p;
+}
+
+static ArpPacket* packet_new_with_info(const ArpPacketInfo *info, size_t *packet_len) {
+ ArpPacket *p = NULL;
uint8_t *r;
assert(info);
- assert(packet_len);
assert(info->operation == ARP_REQUEST || info->operation == ARP_RESPONSE);
+ assert(packet_len != NULL);
*packet_len = ARP_PACKET_SIZE;
- r = avahi_new0(uint8_t, *packet_len);
-
+ p = packet_new(*packet_len);
+ r = p->ether_payload;
+
r[1] = 1; /* HTYPE */
r[2] = 8; /* PTYPE */
r[4] = ETHER_ADDRLEN; /* HLEN */
@@ -270,10 +317,10 @@ static void* packet_new(const ArpPacketInfo *info, size_t *packet_len) {
memcpy(r+18, info->target_hw_address, ETHER_ADDRLEN);
memcpy(r+24, &info->target_ip_address, 4);
- return r;
+ return p;
}
-static void *packet_new_probe(uint32_t ip_address, const uint8_t*hw_address, size_t *packet_len) {
+static ArpPacket *packet_new_probe(uint32_t ip_address, const uint8_t*hw_address, size_t *packet_len) {
ArpPacketInfo info;
memset(&info, 0, sizeof(info));
@@ -281,10 +328,10 @@ static void *packet_new_probe(uint32_t ip_address, const uint8_t*hw_address, siz
memcpy(info.sender_hw_address, hw_address, ETHER_ADDRLEN);
info.target_ip_address = ip_address;
- return packet_new(&info, packet_len);
+ return packet_new_with_info(&info, packet_len);
}
-static void *packet_new_announcement(uint32_t ip_address, const uint8_t* hw_address, size_t *packet_len) {
+static ArpPacket *packet_new_announcement(uint32_t ip_address, const uint8_t* hw_address, size_t *packet_len) {
ArpPacketInfo info;
memset(&info, 0, sizeof(info));
@@ -293,13 +340,15 @@ static void *packet_new_announcement(uint32_t ip_address, const uint8_t* hw_addr
info.target_ip_address = ip_address;
info.sender_ip_address = ip_address;
- return packet_new(&info, packet_len);
+ return packet_new_with_info(&info, packet_len);
}
-static int packet_parse(const void *data, size_t packet_len, ArpPacketInfo *info) {
- const uint8_t *p = data;
+static int packet_parse(const ArpPacket *packet, size_t packet_len, ArpPacketInfo *info) {
+ const uint8_t *p;
- assert(data);
+ assert(packet);
+ p = (uint8_t *)packet->ether_payload;
+ assert(p);
if (packet_len < ARP_PACKET_SIZE)
return -1;
@@ -392,6 +441,10 @@ fail:
return -1;
}
+#ifdef __linux__
+
+/* Linux 'packet socket' specific implementation */
+
static int open_socket(int iface, uint8_t *hw_address) {
int fd = -1;
struct sockaddr_ll sa;
@@ -437,7 +490,7 @@ fail:
return -1;
}
-static int send_packet(int fd, int iface, void *packet, size_t packet_len) {
+static int send_packet(int fd, int iface, ArpPacket *packet, size_t packet_len) {
struct sockaddr_ll sa;
assert(fd >= 0);
@@ -459,7 +512,7 @@ static int send_packet(int fd, int iface, void *packet, size_t packet_len) {
return 0;
}
-static int recv_packet(int fd, void **packet, size_t *packet_len) {
+static int recv_packet(int fd, ArpPacket **packet, size_t *packet_len) {
int s;
struct sockaddr_ll sa;
socklen_t sa_len;
@@ -479,10 +532,10 @@ static int recv_packet(int fd, void **packet, size_t *packet_len) {
if (s <= 0)
s = 4096;
- *packet = avahi_new(uint8_t, s);
+ *packet = packet_new(s);
sa_len = sizeof(sa);
- if ((r = recvfrom(fd, *packet, s, 0, (struct sockaddr*) &sa, &sa_len)) < 0) {
+ if ((r = recvfrom(fd, (*packet)->ether_payload, s, 0, (struct sockaddr*) &sa, &sa_len)) < 0) {
daemon_log(LOG_ERR, "recvfrom() failed: %s", strerror(errno));
goto fail;
}
@@ -499,7 +552,214 @@ fail:
return -1;
}
-
+
+static void
+close_socket(int fd) {
+ close(fd);
+}
+
+#else /* !__linux__ */
+/* PCAP-based implementation */
+
+static pcap_t *__pp;
+static char __pcap_errbuf[PCAP_ERRBUF_SIZE];
+static uint8_t __lladdr[ETHER_ADDRLEN];
+
+#ifndef elementsof
+#define elementsof(array) (sizeof(array)/sizeof(array[0]))
+#endif
+
+static int
+__get_ether_addr(int ifindex, u_char *lladdr)
+{
+ int mib[6];
+ char *buf;
+ struct if_msghdr *ifm;
+ char *lim;
+ char *next;
+ struct sockaddr_dl *sdl;
+ size_t len;
+
+ mib[0] = CTL_NET;
+ mib[1] = PF_ROUTE;
+ mib[2] = 0;
+ mib[3] = 0;
+ mib[4] = NET_RT_IFLIST;
+ mib[5] = ifindex;
+
+ if (sysctl(mib, elementsof(mib), NULL, &len, NULL, 0) != 0) {
+ daemon_log(LOG_ERR, "sysctl(NET_RT_IFLIST): %s",
+ strerror(errno));
+ return (-1);
+ }
+
+ buf = malloc(len);
+ if (buf == NULL) {
+ daemon_log(LOG_ERR, "malloc(%d): %s", len, strerror(errno));
+ return (-1);
+ }
+
+ if (sysctl(mib, elementsof(mib), buf, &len, NULL, 0) != 0) {
+ daemon_log(LOG_ERR, "sysctl(NET_RT_IFLIST): %s",
+ strerror(errno));
+ free(buf);
+ return (-1);
+ }
+
+ lim = buf + len;
+ for (next = buf; next < lim; next += ifm->ifm_msglen) {
+ ifm = (struct if_msghdr *)next;
+ if (ifm->ifm_type == RTM_IFINFO) {
+ sdl = (struct sockaddr_dl *)(ifm + 1);
+ memcpy(lladdr, LLADDR(sdl), ETHER_ADDRLEN);
+ }
+ }
+ free(buf);
+
+ return (0);
+}
+
+static int
+open_socket(int iface, uint8_t *hw_address)
+{
+ struct bpf_program bpf;
+ char ifname[IFNAMSIZ];
+ pcap_t *pp;
+ int err;
+ int fd;
+
+ assert(__pp == NULL);
+
+ if (interface_up(iface) < 0) {
+ return (-1);
+ }
+ if (__get_ether_addr(iface, __lladdr) == -1) {
+ return (-1);
+ }
+ if (if_indextoname(iface, ifname) == NULL) {
+ return (-1);
+ }
+
+ pp = pcap_open_live(ifname, 1500, 0, 0, __pcap_errbuf);
+ if (pp == NULL) {
+ return (-1);
+ }
+ err = pcap_set_datalink(pp, DLT_EN10MB);
+ if (err == -1) {
+ daemon_log(LOG_ERR, "pcap_set_datalink: %s", pcap_geterr(pp));
+ pcap_close(pp);
+ return (-1);
+ }
+ err = pcap_setdirection(pp, PCAP_D_IN);
+ if (err == -1) {
+ daemon_log(LOG_ERR, "pcap_setdirection: %s", pcap_geterr(pp));
+ pcap_close(pp);
+ return (-1);
+ }
+
+ fd = pcap_get_selectable_fd(pp);
+ if (fd == -1) {
+ pcap_close(pp);
+ return (-1);
+ }
+#if 0
+ /* XXX: can we use this with pcap_next_ex() ? */
+ err = pcap_setnonblock(pp, 1, __pcap_errbuf);
+ if (err == -1) {
+ pcap_close(pp);
+ return (-1);
+ }
+#endif
+
+ err = pcap_compile(pp, &bpf,
+ "arp and ether dst ff:ff:ff:ff:ff:ff", 1, 0);
+ if (err == -1) {
+ daemon_log(LOG_ERR, "pcap_compile: %s", pcap_geterr(pp));
+ pcap_close(pp);
+ return (-1);
+ }
+ err = pcap_setfilter(pp, &bpf);
+ if (err == -1) {
+ daemon_log(LOG_ERR, "pcap_setfilter: %s", pcap_geterr(pp));
+ pcap_close(pp);
+ return (-1);
+ }
+ pcap_freecode(&bpf);
+
+ /* Stash pcap-specific context away. */
+ memcpy(hw_address, __lladdr, ETHER_ADDRLEN);
+ __pp = pp;
+
+ return (fd);
+}
+
+static void
+close_socket(int fd __unused)
+{
+
+ assert(__pp != NULL);
+ pcap_close(__pp);
+ __pp = NULL;
+}
+
+/*
+ * We trick avahi into allocating sizeof(packet) + sizeof(ether_header),
+ * and prepend the required ethernet header information before sending.
+ */
+static int
+send_packet(int fd __unused, int iface __unused, ArpPacket *packet,
+ size_t packet_len)
+{
+ struct ether_header *eh;
+
+ assert(__pp != NULL);
+ assert(packet != NULL);
+
+ eh = (struct ether_header *)packet->ether_header;
+ memset(eh->ether_dhost, 0xFF, ETHER_ADDRLEN);
+ memcpy(eh->ether_shost, __lladdr, ETHER_ADDRLEN);
+ eh->ether_type = htons(0x0806);
+
+ return (pcap_inject(__pp, (void *)eh, packet_len + sizeof(*eh)));
+}
+
+static int
+recv_packet(int fd __unused, ArpPacket **packet, size_t *packet_len)
+{
+ struct pcap_pkthdr *ph;
+ u_char *pd;
+ ArpPacket *ap;
+ int err;
+ int retval;
+
+ assert(__pp != NULL);
+ assert(packet != NULL);
+ assert(packet_len != NULL);
+
+ *packet = NULL;
+ *packet_len = 0;
+ retval = -1;
+
+ err = pcap_next_ex(__pp, &ph, (const u_char **)&pd);
+ if (err == 1 && ph->caplen <= ph->len) {
+ ap = packet_new(ph->caplen);
+ memcpy(ap->ether_header, pd, ph->caplen);
+ *packet = ap;
+ *packet_len = (ph->caplen - sizeof(struct ether_header));
+ retval = 0;
+ } else {
+ if (err == 1) {
+ daemon_log(LOG_ERR, "pcap len > caplen");
+ } else {
+ daemon_log(LOG_ERR, "pcap_next_ex: %s",
+ pcap_geterr(__pp));
+ }
+ }
+
+ return (retval);
+}
+#endif /* __linux__ */
+
int is_ll_address(uint32_t addr) {
return
(ntohl(addr) & IPV4LL_NETMASK) == IPV4LL_NETWORK &&
@@ -507,6 +767,7 @@ int is_ll_address(uint32_t addr) {
ntohl(addr) != IPV4LL_BROADCAST;
}
+
static struct timeval *elapse_time(struct timeval *tv, unsigned msec, unsigned jitter) {
assert(tv);
@@ -656,6 +917,9 @@ static int drop_privs(void) {
int r;
mode_t u;
+ pw = NULL;
+ gr = NULL;
+
/* Get user/group ID */
if (!no_drop_root) {
@@ -762,7 +1026,7 @@ static int drop_privs(void) {
set_env("LOGNAME", pw->pw_name);
set_env("HOME", pw->pw_dir);
- daemon_log(LOG_ERR, "Successfully dropped root privileges.");
+ daemon_log(LOG_INFO, "Successfully dropped root privileges.");
}
return 0;
@@ -780,13 +1044,13 @@ static int loop(int iface, uint32_t addr) {
struct timeval next_wakeup;
int next_wakeup_valid = 0;
char buf[64];
- void *in_packet = NULL;
+ ArpPacket *in_packet = NULL;
size_t in_packet_len;
- void *out_packet = NULL;
+ ArpPacket *out_packet = NULL;
size_t out_packet_len;
uint8_t hw_address[ETHER_ADDRLEN];
struct pollfd pollfds[FD_MAX];
- int iface_fd;
+ int iface_fd = -1;
Event event = EVENT_NULL;
int retval_sent = !daemonize;
State st;
@@ -1054,7 +1318,7 @@ static int loop(int iface, uint32_t addr) {
if (pollfds[FD_ARP].revents == POLLERR) {
/* The interface is probably down, let's recreate our socket */
- close(fd);
+ close_socket(fd);
if ((fd = open_socket(iface, hw_address)) < 0)
goto fail;
@@ -1124,7 +1388,7 @@ fail:
avahi_free(in_packet);
if (fd >= 0)
- close(fd);
+ close_socket(fd);
if (iface_fd >= 0)
iface_done();
@@ -1200,7 +1464,6 @@ static int parse_command_line(int argc, char *argv[]) {
{ NULL, 0, NULL, 0 }
};
- opterr = 0;
while ((c = getopt_long(argc, argv, "hDskrcVS:w", long_options, NULL)) >= 0) {
switch(c) {
@@ -1259,7 +1522,6 @@ static int parse_command_line(int argc, char *argv[]) {
#endif
default:
- fprintf(stderr, "Invalid command line argument: %c\n", c);
return -1;
}
}
diff --git a/trunk/avahi-autoipd/main.h b/avahi-autoipd/main.h
index adadc99..adadc99 100644
--- a/trunk/avahi-autoipd/main.h
+++ b/avahi-autoipd/main.h
diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c
index ac5546d..7d30651 100644
--- a/avahi-client/client-test.c
+++ b/avahi-client/client-test.c
@@ -59,7 +59,7 @@ static void avahi_domain_browser_callback(
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void *userdata) {
- printf ("DOMAIN-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, domain, (char*)userdata);
+ printf ("DOMAIN-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, domain ? domain : "NULL", (char*)userdata);
}
static void avahi_service_resolver_callback(
@@ -102,7 +102,7 @@ static void avahi_service_browser_callback (
AvahiServiceResolver *sr;
- printf ("SERVICE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, name, type, domain, (char*)userdata);
+ printf ("SERVICE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, name ? name : "NULL", type, domain ? domain : "NULL", (char*)userdata);
if (b && name)
{
@@ -121,7 +121,7 @@ static void avahi_service_type_browser_callback (
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void *userdata) {
- printf ("SERVICE-TYPE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, type, domain, (char*)userdata);
+ printf ("SERVICE-TYPE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, type ? type : "NULL", domain ? domain : "NULL", (char*)userdata);
}
static void avahi_address_resolver_callback (
diff --git a/avahi-client/client.c b/avahi-client/client.c
index 90686fc..f665613 100644
--- a/avahi-client/client.c
+++ b/avahi-client/client.c
@@ -67,7 +67,11 @@ static void client_set_state (AvahiClient *client, AvahiServerState state) {
switch (client->state) {
case AVAHI_CLIENT_FAILURE:
if (client->bus) {
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
+ dbus_connection_close(client->bus);
+#else
dbus_connection_disconnect(client->bus);
+#endif
dbus_connection_unref(client->bus);
client->bus = NULL;
}
@@ -437,12 +441,18 @@ static int init_server(AvahiClient *client, int *ret_error) {
}
/* This function acts like dbus_bus_get but creates a private
- * connection instead. Eventually this should be replaced by a DBUS
- * provided version. */
+ * connection instead. */
static DBusConnection* avahi_dbus_bus_get(DBusError *error) {
DBusConnection *c;
- const char *a;
+#ifdef HAVE_DBUS_BUS_GET_PRIVATE
+ if (!(c = dbus_bus_get_private(DBUS_BUS_SYSTEM, error)))
+ return NULL;
+
+ dbus_connection_set_exit_on_disconnect(c, FALSE);
+#else
+ const char *a;
+
if (!(a = getenv("DBUS_SYSTEM_BUS_ADDRESS")) || !*a)
a = DBUS_SYSTEM_BUS_DEFAULT_ADDRESS;
@@ -452,10 +462,15 @@ static DBusConnection* avahi_dbus_bus_get(DBusError *error) {
dbus_connection_set_exit_on_disconnect(c, FALSE);
if (!dbus_bus_register(c, error)) {
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
dbus_connection_close(c);
+#else
+ dbus_connection_disconnect(c);
+#endif
dbus_connection_unref(c);
return NULL;
}
+#endif
return c;
}
@@ -598,7 +613,11 @@ void avahi_client_free(AvahiClient *client) {
if (client->bus)
/* Disconnect in advance, so that the free() functions won't
* issue needless server calls */
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
+ dbus_connection_close(client->bus);
+#else
dbus_connection_disconnect(client->bus);
+#endif
while (client->groups)
avahi_entry_group_free(client->groups);
@@ -867,3 +886,58 @@ int avahi_client_is_connected(AvahiClient *client) {
dbus_connection_get_is_connected(client->bus) &&
(client->state == AVAHI_CLIENT_S_RUNNING || client->state == AVAHI_CLIENT_S_REGISTERING || client->state == AVAHI_CLIENT_S_COLLISION);
}
+
+int avahi_client_set_host_name(AvahiClient* client, const char *name) {
+ DBusMessage *message = NULL, *reply = NULL;
+ DBusError error;
+
+ assert(client);
+
+ if (!avahi_client_is_connected(client))
+ return avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
+
+ dbus_error_init (&error);
+
+ if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "SetHostName"))) {
+ avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
+ avahi_client_set_errno (client, AVAHI_ERR_NO_MEMORY);
+ goto fail;
+ }
+
+ reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error);
+
+ if (!reply || dbus_error_is_set (&error))
+ goto fail;
+
+ if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
+ dbus_error_is_set (&error))
+ goto fail;
+
+ dbus_message_unref(message);
+ dbus_message_unref(reply);
+
+ avahi_free(client->host_name);
+ client->host_name = NULL;
+ avahi_free(client->host_name_fqdn);
+ client->host_name_fqdn = NULL;
+
+ return 0;
+
+fail:
+
+ if (message)
+ dbus_message_unref(message);
+ if (reply)
+ dbus_message_unref(reply);
+
+ if (dbus_error_is_set(&error)) {
+ avahi_client_set_dbus_error(client, &error);
+ dbus_error_free(&error);
+ }
+
+ return client->error;
+}
diff --git a/avahi-client/client.h b/avahi-client/client.h
index 16fde91..6a12e9a 100644
--- a/avahi-client/client.h
+++ b/avahi-client/client.h
@@ -33,9 +33,6 @@
/** \file client.h Definitions and functions for the client API over D-Bus */
-/** \example glib-integration.c Example of how to integrate
- * avahi use with GLIB/GTK applications */
-
AVAHI_C_DECL_BEGIN
/** A connection context */
@@ -65,7 +62,7 @@ typedef void (*AvahiClientCallback) (
AvahiClient* avahi_client_new (
const AvahiPoll *poll_api /**< The abstract event loop API to use */,
AvahiClientFlags flags /**< Some flags to modify the behaviour of the client library */,
- AvahiClientCallback callback /**< A callback that is called whenever the state of the client changes. This may be NULL */,
+ AvahiClientCallback callback /**< A callback that is called whenever the state of the client changes. This may be NULL. Please note that this function is called for the first time from within the avahi_client_new() context! Thus, in the callback you should not make use of global variables that are initialized only after your call to avahi_client_new(). A common mistake is to store the AvahiClient pointer returned by avahi_client_new() in a global variable and assume that this global variable already contains the valid pointer when the callback is called for the first time. A work-around for this is to always use the AvahiClient pointer passed to the callback function instead of the global pointer. */,
void *userdata /**< Some arbitrary user data pointer that will be passed to the callback function */,
int *error /**< If creation of the client fails, this integer will contain the error cause. May be NULL if you aren't interested in the reason why avahi_client_new() failed. */);
@@ -80,6 +77,9 @@ const char* avahi_client_get_version_string (AvahiClient*);
/** Get host name */
const char* avahi_client_get_host_name (AvahiClient*);
+/** Set host name. \since 0.6.13 */
+int avahi_client_set_host_name(AvahiClient*, const char *name);
+
/** Get domain name */
const char* avahi_client_get_domain_name (AvahiClient*);
diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c
index e43a44f..e2fc3b9 100644
--- a/avahi-client/entrygroup.c
+++ b/avahi-client/entrygroup.c
@@ -41,10 +41,11 @@
void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state) {
assert(group);
- if (group->state == state)
+ if (group->state_valid && group->state == state)
return;
group->state = state;
+ group->state_valid = 1;
if (group->callback)
group->callback(group, state, group->userdata);
@@ -82,9 +83,7 @@ static int retrieve_state(AvahiEntryGroup *group) {
dbus_message_unref(message);
dbus_message_unref(reply);
- avahi_entry_group_set_state(group, (AvahiEntryGroupState) state);
-
- return AVAHI_OK;
+ return state;
fail:
if (dbus_error_is_set(&error)) {
@@ -106,6 +105,7 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
char *path;
+ int state;
assert(client);
@@ -124,7 +124,7 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall
group->client = client;
group->callback = callback;
group->userdata = userdata;
- group->state = AVAHI_ENTRY_GROUP_UNCOMMITED;
+ group->state_valid = 0;
group->path = NULL;
AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, client->groups, group);
@@ -157,8 +157,12 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall
goto fail;
}
- if (retrieve_state(group) < 0)
+ if ((state = retrieve_state(group)) < 0) {
+ avahi_client_set_errno(client, state);
goto fail;
+ }
+
+ avahi_entry_group_set_state(group, (AvahiEntryGroupState) state);
dbus_message_unref(message);
dbus_message_unref(reply);
@@ -249,27 +253,40 @@ int avahi_entry_group_free(AvahiEntryGroup *group) {
}
int avahi_entry_group_commit(AvahiEntryGroup *group) {
+ int ret;
assert(group);
if (!group->path || !avahi_client_is_connected(group->client))
return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
- return entry_group_simple_method_call(group, "Commit");
+ if ((ret = entry_group_simple_method_call(group, "Commit")) < 0)
+ return ret;
+
+ group->state_valid = 0;
+ return ret;
}
int avahi_entry_group_reset(AvahiEntryGroup *group) {
+ int ret;
assert(group);
if (!group->path || !avahi_client_is_connected(group->client))
return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
- return entry_group_simple_method_call(group, "Reset");
+ if ((ret = entry_group_simple_method_call(group, "Reset")) < 0)
+ return ret;
+
+ group->state_valid = 0;
+ return ret;
}
int avahi_entry_group_get_state (AvahiEntryGroup *group) {
assert (group);
- return group->state;
+ if (group->state_valid)
+ return group->state;
+
+ return retrieve_state(group);
}
AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup *group) {
diff --git a/avahi-client/internal.h b/avahi-client/internal.h
index 7a79dd7..e49dd15 100644
--- a/avahi-client/internal.h
+++ b/avahi-client/internal.h
@@ -56,6 +56,7 @@ struct AvahiClient {
struct AvahiEntryGroup {
char *path;
AvahiEntryGroupState state;
+ int state_valid;
AvahiClient *client;
AvahiEntryGroupCallback callback;
void *userdata;
diff --git a/avahi-client/publish.h b/avahi-client/publish.h
index 053ea88..98f4f98 100644
--- a/avahi-client/publish.h
+++ b/avahi-client/publish.h
@@ -53,7 +53,7 @@ typedef void (*AvahiEntryGroupCallback) (
/** Create a new AvahiEntryGroup object */
AvahiEntryGroup* avahi_entry_group_new(
AvahiClient* c,
- AvahiEntryGroupCallback callback /**< This callback is called whenever the state of this entry group changes. May not be NULL. */,
+ AvahiEntryGroupCallback callback /**< This callback is called whenever the state of this entry group changes. May not be NULL. Please note that this function is called for the first time from within the avahi_entry_group_new() context! Thus, in the callback you should not make use of global variables that are initialized only after your call to avahi_entry_group_new(). A common mistake is to store the AvahiEntryGroup pointer returned by avahi_entry_group_new() in a global variable and assume that this global variable already contains the valid pointer when the callback is called for the first time. A work-around for this is to always use the AvahiEntryGroup pointer passed to the callback function instead of the global pointer. */,
void *userdata /**< This arbitrary user data pointer will be passed to the callback functon */);
/** Clean up and free an AvahiEntryGroup object */
diff --git a/avahi-client/resolver.c b/avahi-client/resolver.c
index 2d9f808..4403a12 100644
--- a/avahi-client/resolver.c
+++ b/avahi-client/resolver.c
@@ -106,6 +106,8 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
for (;;) {
DBusMessageIter sub2;
int at;
+ const uint8_t *k;
+ int n;
if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
break;
@@ -119,13 +121,10 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
dbus_message_iter_recurse(&sub, &sub2);
- if (dbus_message_iter_get_array_len(&sub2) > 0) {
- uint8_t *k;
- int n;
-
- dbus_message_iter_get_fixed_array(&sub2, &k, &n);
+ k = NULL; n = 0;
+ dbus_message_iter_get_fixed_array(&sub2, &k, &n);
+ if (k && n > 0)
strlst = avahi_string_list_add_arbitrary(strlst, k, n);
- }
dbus_message_iter_next(&sub);
}
diff --git a/avahi-common/address.h b/avahi-common/address.h
index 6315d31..b8706ee 100644
--- a/avahi-common/address.h
+++ b/avahi-common/address.h
@@ -53,7 +53,7 @@ enum {
#define AVAHI_ADDRESS_STR_MAX 40 /* IPv6 Max = 4*8 + 7 + 1 for NUL */
/** Return TRUE if the specified interface index is valid */
-#define AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_PROTO_UNSPEC))
+#define AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_IF_UNSPEC))
/** Return TRUE if the specified protocol is valid */
#define AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC))
@@ -73,9 +73,9 @@ typedef struct AvahiAddress {
AvahiProtocol proto; /**< Address family */
union {
- AvahiIPv6Address ipv6; /** Address when IPv6 */
- AvahiIPv4Address ipv4; /** Address when IPv4 */
- uint8_t data[1]; /** Type independant data field */
+ AvahiIPv6Address ipv6; /**< Address when IPv6 */
+ AvahiIPv4Address ipv4; /**< Address when IPv4 */
+ uint8_t data[1]; /**< Type independant data field */
} data;
} AvahiAddress;
diff --git a/avahi-common/alternative-test.c b/avahi-common/alternative-test.c
index 010478c..b3ee4e9 100644
--- a/avahi-common/alternative-test.c
+++ b/avahi-common/alternative-test.c
@@ -29,19 +29,54 @@
#include "malloc.h"
int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
+ const char* const test_strings[] = {
+ "gurke",
+ "",
+ "-",
+ " #",
+ "1",
+ "#0",
+ " #0",
+ " #1",
+ "#-1",
+ " #-1",
+ "-0",
+ "--0",
+ "-1",
+ "--1",
+ "-2",
+ "gurke1",
+ "gurke0",
+ "gurke-2",
+ "gurke #0",
+ "gurke #1",
+ "gurke #",
+ "gurke#1",
+ "gurke-",
+ "gurke---",
+ "gurke #",
+ "gurke ###",
+ NULL
+ };
+
char *r = NULL;
- int i, k;
+ int i, j, k;
+
+ for (k = 0; test_strings[k]; k++) {
- for (k = 0; k < 2; k++) {
+ printf(">>>>>%s<<<<\n", test_strings[k]);
+
+ for (j = 0; j < 2; j++) {
- for (i = 0; i < 20; i++) {
- char *n;
-
- n = i == 0 ? avahi_strdup("gurke") : (k ? avahi_alternative_service_name(r) : avahi_alternative_host_name(r));
- avahi_free(r);
- r = n;
-
- printf("%s\n", r);
+ for (i = 0; i < 20; i++) {
+ char *n;
+
+ n = i == 0 ? avahi_strdup(test_strings[k]) : (j ? avahi_alternative_service_name(r) : avahi_alternative_host_name(r));
+ avahi_free(r);
+ r = n;
+
+ printf("%s\n", r);
+ }
}
}
diff --git a/avahi-common/alternative.c b/avahi-common/alternative.c
index 436a0d4..77470ba 100644
--- a/avahi-common/alternative.c
+++ b/avahi-common/alternative.c
@@ -32,20 +32,31 @@
#include "malloc.h"
char * avahi_alternative_host_name(const char *s) {
- const char *p, *e;
+ const char *e;
char *r;
assert(s);
- e = s;
-
- for (p = s; *p; p++)
- if (!isdigit(*p))
- e = p+1;
+ e = strrchr(s, '-');
+
+ if (e) {
+ const char *p;
+
+ for (p = e+1; *p; p++)
+ if (!isdigit(*p)) {
+ e = NULL;
+ break;
+ }
+
+ if (e && (*(e+1) == '0' || (*(e+1) == 0)))
+ e = NULL;
+ }
- if (*e) {
+ if (e) {
char *c;
+ e++;
+
if (!(c = avahi_strndup(s, e-s)))
return NULL;
@@ -53,7 +64,7 @@ char * avahi_alternative_host_name(const char *s) {
avahi_free(c);
} else
- r = avahi_strdup_printf("%s2", s);
+ r = avahi_strdup_printf("%s-2", s);
return r;
}
@@ -76,6 +87,9 @@ char *avahi_alternative_service_name(const char *s) {
e = NULL;
break;
}
+
+ if (e && (*e == '0' || *e == 0))
+ e = NULL;
}
if (e) {
diff --git a/avahi-common/dbus-watch-glue.c b/avahi-common/dbus-watch-glue.c
index b2b4bb2..a8779d5 100644
--- a/avahi-common/dbus-watch-glue.c
+++ b/avahi-common/dbus-watch-glue.c
@@ -81,13 +81,15 @@ static void connection_data_unref(ConnectionData *d) {
}
}
-static void request_dispatch(ConnectionData *d) {
+static void request_dispatch(ConnectionData *d, int enable) {
static const struct timeval tv = { 0, 0 };
assert(d);
- assert(dbus_connection_get_dispatch_status(d->connection) == DBUS_DISPATCH_DATA_REMAINS);
-
- d->poll_api->timeout_update(d->dispatch_timeout, &tv);
+ if (enable) {
+ assert(dbus_connection_get_dispatch_status(d->connection) == DBUS_DISPATCH_DATA_REMAINS);
+ d->poll_api->timeout_update(d->dispatch_timeout, &tv);
+ } else
+ d->poll_api->timeout_update(d->dispatch_timeout, NULL);
}
static void dispatch_timeout_callback(AvahiTimeout *t, void *userdata) {
@@ -100,7 +102,9 @@ static void dispatch_timeout_callback(AvahiTimeout *t, void *userdata) {
if (dbus_connection_dispatch(d->connection) == DBUS_DISPATCH_DATA_REMAINS)
/* If there's still data, request that this handler is called again */
- request_dispatch(d);
+ request_dispatch(d, 1);
+ else
+ request_dispatch(d, 0);
dbus_connection_unref(d->connection);
connection_data_unref(d);
@@ -301,7 +305,7 @@ static void dispatch_status(AVAHI_GCC_UNUSED DBusConnection *connection, DBusDis
ConnectionData *d = userdata;
if (new_status == DBUS_DISPATCH_DATA_REMAINS)
- request_dispatch(d);
+ request_dispatch(d, 1);
}
int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
@@ -329,7 +333,7 @@ int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
dbus_connection_set_dispatch_status_function(c, dispatch_status, connection_data_ref(d), (DBusFreeFunction)connection_data_unref);
if (dbus_connection_get_dispatch_status(c) == DBUS_DISPATCH_DATA_REMAINS)
- request_dispatch(d);
+ request_dispatch(d, 1);
connection_data_unref(d);
diff --git a/avahi-common/dbus.c b/avahi-common/dbus.c
index e044b53..ac54848 100644
--- a/avahi-common/dbus.c
+++ b/avahi-common/dbus.c
@@ -88,7 +88,8 @@ static const char * const table[- AVAHI_ERR_MAX] = {
AVAHI_DBUS_ERR_NOT_PERMITTED,
AVAHI_DBUS_ERR_INVALID_ARGUMENT,
- AVAHI_DBUS_ERR_IS_EMPTY
+ AVAHI_DBUS_ERR_IS_EMPTY,
+ AVAHI_DBUS_ERR_NO_CHANGE
};
struct error_map {
diff --git a/avahi-common/dbus.h b/avahi-common/dbus.h
index 39718d1..a93988d 100644
--- a/avahi-common/dbus.h
+++ b/avahi-common/dbus.h
@@ -22,7 +22,7 @@
USA.
***/
-/** \file dbus.h Some definitions for the DBUS interface */
+/** \file dbus.h Some definitions for the D-Bus interface */
#include <avahi-common/cdecl.h>
#include <dbus/dbus.h>
@@ -41,14 +41,14 @@ AVAHI_C_DECL_BEGIN
#define AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER AVAHI_DBUS_NAME".ServiceResolver"
#define AVAHI_DBUS_INTERFACE_RECORD_BROWSER AVAHI_DBUS_NAME".RecordBrowser"
-/** The DBUS API version identifier. The first byte specifies the API
+/** The D-Bus API version identifier. The first byte specifies the API
release, the second byte specifies the revision. If the revision
number is increased the API has been extended but is downwards
compatible. If the release changes compatibility is lost.
Avahi 0.6 implements API version 0x0201;
Avahi 0.6.1 implements API version 0x0202 */
-#define AVAHI_DBUS_API_VERSION ((uint32_t) 0x0202)
+#define AVAHI_DBUS_API_VERSION ((uint32_t) 0x0203)
#define AVAHI_DBUS_ERR_OK "org.freedesktop.Avahi.Success"
#define AVAHI_DBUS_ERR_FAILURE "org.freedesktop.Avahi.Failure"
@@ -108,6 +108,7 @@ Avahi 0.6.1 implements API version 0x0202 */
#define AVAHI_DBUS_ERR_NOT_PERMITTED "org.freedesktop.Avahi.NotPermittedError"
#define AVAHI_DBUS_ERR_INVALID_ARGUMENT "org.freedesktop.Avahi.InvalidArgumentError"
#define AVAHI_DBUS_ERR_IS_EMPTY "org.freedesktop.Avahi.IsEmptyError"
+#define AVAHI_DBUS_ERR_NO_CHANGE "org.freedesktop.Avahi.NoChangeError"
/** Convert a DBus error string into an Avahi error number */
int avahi_error_dbus_to_number(const char *s);
diff --git a/avahi-common/defs.h b/avahi-common/defs.h
index 100c9f5..4efa5ad 100644
--- a/avahi-common/defs.h
+++ b/avahi-common/defs.h
@@ -33,17 +33,17 @@
* Avahi provides three programming APIs for integration of
* mDNS/DNS-SD features into your progams:
*
- * \li avahi-core: an API for embedding a complete mDNS/DNS-SD stack
+ * \li <b>avahi-core</b>: an API for embedding a complete mDNS/DNS-SD stack
* into your software. This is intended for developers of embedded
* ampliances only. We dissuade from using this API in normal desktop
* applications since it is not a good idea to run multiple mDNS
* stacks simultaneously on the same host.
- * \li The DBUS API: an extensive DBUS interface for browsing and
+ * \li <b>the D-Bus API</b>: an extensive D-Bus interface for browsing and
* registering mDNS/DNS-SD services using avahi-daemon. We recommend
* to use this API for software written in any language but
- * C. (i.e. python)
- * \li avahi-client: a simplifying C wrapper around the DBUS API. We
- * recommend to use this API in C or C++ progams. The DBUS internals
+ * C. (i.e. Python)
+ * \li <b>avahi-client</b>: a simplifying C wrapper around the D-Bus API. We
+ * recommend to use this API in C or C++ progams. The D-Bus internals
* are hidden completely.
*
* All three APIs are very similar, however avahi-core is the most powerful.
@@ -60,52 +60,52 @@
* Please note that these compatibility layers are incomplete and
* generally a waste of resources. We strongly encourage everyone to
* use our native APIs for newly written programs and to port older
- * programs to one of them!
+ * programs to avahi-client!
*
* \section error_reporting Error Reporting
*
* Some notes on the Avahi error handling:
*
* - Error codes are negative integers and defined as AVAHI_ERR_xx
- * - If a function returns some kind of non-negative integer value
- * on success, a failure is indicated by returning the error code
+ * - If a function returns some kind of non-negative integer value on
+ * success, a failure is indicated by returning the error code
* directly.
* - If a function returns a pointer of some kind on success, a
* failure is indicated by returning NULL
* - The last error number may be retrieved by calling
- * avahi_server_errno() (for the server API) or avahi_client_errno()
- * (for the client API)
- * - Just like the libc errno variable the Avahi errno is NOT reset
- * to AVAHI_OK if a function call succeeds.
- * - You may convert a numeric error code into a human readable
- * string using avahi_strerror()
- * - The constructor functions avahi_server_new() and
- * avahi_client_new() return the error code in a call-by-reference
- * argument
+ * avahi_client_errno()
+ * - Just like the libc errno variable the Avahi errno is NOT reset to
+ * AVAHI_OK if a function call succeeds.
+ * - You may convert a numeric error code into a human readable string
+ * using avahi_strerror()
+ * - The constructor function avahi_client_new() returns the error
+ * code in a call-by-reference argument
*
* \section event_loop Event Loop Abstraction
*
- * Avahi uses for both avahi-client and avahi-core a simple event loop
- * abstraction layer.A table AvahiPoll which contains function
- * pointers for user defined timeout and I/O condition event source
- * implementations, needs to be passed to avahi_server_new() and
+ * Avahi uses a simple event loop abstraction laye. A table AvahiPoll
+ * which contains function pointers for user defined timeout and I/O
+ * condition event source implementations needs to be passed to
* avahi_client_new(). An adapter for this abstraction layer is
* available for the GLib main loop in the object AvahiGLibPoll. A
* simple stand-alone implementation is available under the name
- * AvahiSimplePoll.
+ * AvahiSimplePoll. An adpater for the Qt main loop is available from
+ * avahi_qt_poll_get().
*
* \section good_publish How to Register Services
*
* - Subscribe to server state changes. Pass a callback function
- * pointer to avahi_client_new()/avahi_server_new(). It will be called
+ * pointer to avahi_client_new(). It will be called
* whenever the server state changes.
* - Only register your services when the server is in state
* AVAHI_SERVER_RUNNING. If you register your services in other server
* states they might not be accessible since the local host name is
* not established.
* - Remove your services when the server enters
- * AVAHI_SERVER_COLLISION state. Your services may no be reachable
- * anymore since the local host name is no longer established.
+ * AVAHI_SERVER_COLLISION or AVAHI_SERVER_REGISTERING state. Your
+ * services may no be reachable anymore since the local host name is
+ * no longer established or is currently in the process of being
+ * established.
* - When registering services, use the following algorithm:
* - Create a new entry group (i.e. avahi_entry_group_new())
* - Add your service(s)/additional host names (i.e. avahi_entry_group_add_service())
@@ -129,8 +129,6 @@
* that's exactly what you should do in that case. First call
* avahi_entry_group_reset() to remove it and than readd it normally.
*
- * The linked functions belong to avahi-client. They all have counterparts in the DBUS API and avahi-core.
- *
* \section good_browse How to Browse for Services
*
* - For normal applications you need to call avahi_service_browser_new()
@@ -143,11 +141,10 @@
* - Network monitor software may use avahi_service_type_browser_new()
* to browse for the list of available service types on the LAN. This
* API should NOT be used in normal software since it increases
- * traffic heavily.
+ * traffic immensly. In addition not all DNS-SD implementations
+ * announce their services in away that they can be found with
+ * avahi_server_type_browser_new().
* - There is no need to subscribe to server state changes.
- *
- * The linked functions belong to avahi-client. They all have
- * counterparts in the DBUS API and avahi-core.
*
* \section daemon_dies How to Write a Client That Can Deal with Daemon Restarts
*
@@ -172,7 +169,7 @@
* all kinds of background daemons, but not in software like iChat
* compatible IM software.
*
- * For now AVAHI_CLIENT_NO_FAIL cannot deal with DBUS daemon restarts.
+ * For now AVAHI_CLIENT_NO_FAIL cannot deal with D-Bus daemon restarts.
*
* \section domains How to Deal Properly with Browsing Domains
*
diff --git a/avahi-common/error.c b/avahi-common/error.c
index f6f561a..92a2234 100644
--- a/avahi-common/error.c
+++ b/avahi-common/error.c
@@ -52,7 +52,7 @@ const char *avahi_strerror(int error) {
"Access denied",
"Invalid operation",
- "An unexpected DBUS error occured",
+ "An unexpected D-Bus error occured",
"Daemon connection failed",
"Memory exhausted",
"The object passed in was not valid",
@@ -85,7 +85,8 @@ const char *avahi_strerror(int error) {
"Not permitted",
"Invalid argument",
- "Is empty"
+ "Is empty",
+ "The requested operation is invalid because redundant"
};
if (-error < 0 || -error >= -AVAHI_ERR_MAX)
diff --git a/avahi-common/error.h b/avahi-common/error.h
index 2cf3bc2..3e014c2 100644
--- a/avahi-common/error.h
+++ b/avahi-common/error.h
@@ -54,7 +54,7 @@ enum {
AVAHI_ERR_ACCESS_DENIED = -20, /**< Access denied */
AVAHI_ERR_INVALID_OPERATION = -21, /**< Invalid operation */
- AVAHI_ERR_DBUS_ERROR = -22, /**< An unexpected DBUS error occured */
+ AVAHI_ERR_DBUS_ERROR = -22, /**< An unexpected D-Bus error occured */
AVAHI_ERR_DISCONNECTED = -23, /**< Daemon connection failed */
AVAHI_ERR_NO_MEMORY = -24, /**< Memory exhausted */
AVAHI_ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */
@@ -88,6 +88,7 @@ enum {
AVAHI_ERR_NOT_PERMITTED = -50, /**< Operation not permitted */
AVAHI_ERR_INVALID_ARGUMENT = -51, /**< Invalid argument */
AVAHI_ERR_IS_EMPTY = -52, /**< Is empty */
+ AVAHI_ERR_NO_CHANGE = -53, /**< The requested operation is invalid because redundant */
/****
**** IF YOU ADD A NEW ERROR CODE HERE, PLEASE DON'T FORGET TO ADD
@@ -97,7 +98,7 @@ enum {
**** Also remember to update the MAX value below.
****/
- AVAHI_ERR_MAX = -53
+ AVAHI_ERR_MAX = -54
};
/** Return a human readable error string for the specified error code */
diff --git a/avahi-common/simple-watch.c b/avahi-common/simple-watch.c
index 65d9d18..c970c3c 100644
--- a/avahi-common/simple-watch.c
+++ b/avahi-common/simple-watch.c
@@ -523,17 +523,13 @@ int avahi_simple_poll_run(AvahiSimplePoll *s) {
s->state = STATE_RUNNING;
- if (s->prepared_timeout != 0) {
-
- if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) {
- s->state = STATE_FAILURE;
- return -1;
- }
+ if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) {
+ s->state = STATE_FAILURE;
+ return -1;
+ }
- /* The poll events are now valid again */
- s->events_valid = 1;
- } else
- s->events_valid = 0;
+ /* The poll events are now valid again */
+ s->events_valid = 1;
/* Update state */
s->state = STATE_RAN;
diff --git a/avahi-common/thread-watch.h b/avahi-common/thread-watch.h
index 469ffe5..e603293 100644
--- a/avahi-common/thread-watch.h
+++ b/avahi-common/thread-watch.h
@@ -46,7 +46,7 @@ void avahi_threaded_poll_free(AvahiThreadedPoll *p);
* called. \since 0.6.4 */
const AvahiPoll* avahi_threaded_poll_get(AvahiThreadedPoll *p);
-/** Start the event loop helper thread. After the thread has startet
+/** Start the event loop helper thread. After the thread has started
* you must make sure to access the event loop object
* (AvahiThreadedPoll, AvahiPoll and all its associated objects)
* synchronized, i.e. with proper locking. You may want to use
diff --git a/avahi-common/timeval.h b/avahi-common/timeval.h
index 8bdb073..a441c08 100644
--- a/avahi-common/timeval.h
+++ b/avahi-common/timeval.h
@@ -34,10 +34,10 @@ AVAHI_C_DECL_BEGIN
/** A numeric data type for storing microsecond values. (signed 64bit integer) */
typedef int64_t AvahiUsec;
-/** Compare two timeval structures and return a ngeative value when a < b, 0 when a == b and a positive value otherwise */
+/** Compare two timeval structures and return a negative value when a < b, 0 when a == b and a positive value otherwise */
int avahi_timeval_compare(const struct timeval *a, const struct timeval *b);
-/** Calculate the difference between to timeval structures as microsecond value */
+/** Calculate the difference between two timeval structures as microsecond value */
AvahiUsec avahi_timeval_diff(const struct timeval *a, const struct timeval *b);
/** Add a number of microseconds to the specified timeval structure and return it. *a is modified. */
diff --git a/avahi-common/watch.h b/avahi-common/watch.h
index 6d1a36e..80ed888 100644
--- a/avahi-common/watch.h
+++ b/avahi-common/watch.h
@@ -42,10 +42,10 @@ typedef struct AvahiPoll AvahiPoll;
/** Type of watch events */
typedef enum {
- AVAHI_WATCH_IN = POLLIN, /** Input event */
- AVAHI_WATCH_OUT = POLLOUT, /** Output event */
- AVAHI_WATCH_ERR = POLLERR, /** Error event */
- AVAHI_WATCH_HUP = POLLHUP /** Hangup event */
+ AVAHI_WATCH_IN = POLLIN, /**< Input event */
+ AVAHI_WATCH_OUT = POLLOUT, /**< Output event */
+ AVAHI_WATCH_ERR = POLLERR, /**< Error event */
+ AVAHI_WATCH_HUP = POLLHUP /**< Hangup event */
} AvahiWatchEvent;
/** Called whenever an I/O event happens on an I/O watch */
diff --git a/avahi-compat-howl/compat.c b/avahi-compat-howl/compat.c
index a7e2809..e436208 100644
--- a/avahi-compat-howl/compat.c
+++ b/avahi-compat-howl/compat.c
@@ -711,13 +711,13 @@ static void reg_client_callback(oid_data *data, AvahiClientState state) {
}
case AVAHI_CLIENT_S_COLLISION:
+ case AVAHI_CLIENT_S_REGISTERING:
/* Remove our entry */
avahi_entry_group_reset(data->object);
break;
case AVAHI_CLIENT_CONNECTING:
- case AVAHI_CLIENT_S_REGISTERING:
/* Ignore */
break;
}
diff --git a/avahi-compat-libdns_sd/Makefile.am b/avahi-compat-libdns_sd/Makefile.am
index fc1421b..a5cb202 100644
--- a/avahi-compat-libdns_sd/Makefile.am
+++ b/avahi-compat-libdns_sd/Makefile.am
@@ -32,7 +32,7 @@ avahi_compat_libdns_sd_HEADERS = dns_sd.h
lib_LTLIBRARIES = libdns_sd.la
if ENABLE_TESTS
-noinst_PROGRAMS = txt-test
+noinst_PROGRAMS = txt-test null-test
endif
libdns_sd_la_SOURCES = \
@@ -52,14 +52,22 @@ txt_test_SOURCES = \
txt_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
txt_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la
+null_test_SOURCES = \
+ dns_sd.h \
+ compat.c \
+ null-test.c \
+ warn.c warn.h
+null_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
+null_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la
+
# You can test the compatibility layer by sticking in mDNSResponder's
# dns-sd.c source here, naming it "libdns_sd-test.c" and running "make
# libdns_sd-test" manually. We do not distribute that file due to
# licensing restrictions.
libdns_sd-test: libdns_sd-test.c libdns_sd.la
- $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test.o -c libdns_sd-test.c
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test libdns_sd-test.o $(PTHREAD_LIBS) ../avahi-common/libavahi-common.la libdns_sd.la
+ $(LIBTOOL) --mode=compile $(CC) $(AM_CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test.o -c libdns_sd-test.c
+ $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test libdns_sd-test.o $(PTHREAD_LIBS) ../avahi-common/libavahi-common.la libdns_sd.la
CLEANFILES = libdns_sd-test.o libdns_sd-test
diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c
index effa0e7..36bb84a 100644
--- a/avahi-compat-libdns_sd/compat.c
+++ b/avahi-compat-libdns_sd/compat.c
@@ -56,6 +56,12 @@ enum {
COMMAND_POLL_FAILED = 'F'
};
+struct type_info {
+ char *type;
+ AvahiStringList *subtypes;
+ int n_subtypes;
+};
+
struct _DNSServiceRef_t {
int n_ref;
@@ -79,7 +85,8 @@ struct _DNSServiceRef_t {
AvahiServiceResolver *service_resolver;
AvahiDomainBrowser *domain_browser;
- char *service_name, *service_name_chosen, *service_regtype, *service_domain, *service_host;
+ struct type_info type_info;
+ char *service_name, *service_name_chosen, *service_domain, *service_host;
uint16_t service_port;
AvahiIfIndex service_interface;
AvahiStringList *service_txt;
@@ -154,6 +161,91 @@ static DNSServiceErrorType map_error(int error) {
return kDNSServiceErr_Unknown;
}
+static void type_info_init(struct type_info *i) {
+ assert(i);
+ i->type = NULL;
+ i->subtypes = NULL;
+ i->n_subtypes = 0;
+}
+
+static void type_info_free(struct type_info *i) {
+ assert(i);
+
+ avahi_free(i->type);
+ avahi_string_list_free(i->subtypes);
+
+ type_info_init(i);
+}
+
+static int type_info_parse(struct type_info *i, const char *t) {
+ char *token = NULL;
+
+ assert(i);
+ assert(t);
+
+ type_info_init(i);
+
+ for (;;) {
+ size_t l;
+
+ if (*t == 0)
+ break;
+
+ l = strcspn(t, ",");
+
+ if (l <= 0)
+ goto fail;
+
+ token = avahi_strndup(t, l);
+
+ if (!token)
+ goto fail;
+
+ if (!i->type) {
+ /* This is the first token, hence the main type */
+
+ if (!avahi_is_valid_service_type_strict(token))
+ goto fail;
+
+ i->type = token;
+ token = NULL;
+ } else {
+ char *fst;
+
+ /* This is not the first token, hence a subtype */
+
+ if (!(fst = avahi_strdup_printf("%s._sub.%s", token, i->type)))
+ goto fail;
+
+ if (!avahi_is_valid_service_subtype(fst)) {
+ avahi_free(fst);
+ goto fail;
+ }
+
+ i->subtypes = avahi_string_list_add(i->subtypes, fst);
+ avahi_free(fst);
+
+ avahi_free(token);
+ token = NULL;
+
+ i->n_subtypes++;
+ }
+
+ t += l;
+
+ if (*t == ',')
+ t++;
+ }
+
+ if (i->type)
+ return 0;
+
+fail:
+ type_info_free(i);
+ avahi_free(token);
+ return -1;
+}
+
static const char *add_trailing_dot(const char *s, char *buf, size_t buf_len) {
if (!s)
return NULL;
@@ -287,9 +379,11 @@ static DNSServiceRef sdref_new(void) {
sdref->domain_browser = NULL;
sdref->entry_group = NULL;
- sdref->service_name = sdref->service_name_chosen = sdref->service_regtype = sdref->service_domain = sdref->service_host = NULL;
+ sdref->service_name = sdref->service_name_chosen = sdref->service_domain = sdref->service_host = NULL;
sdref->service_txt = NULL;
+ type_info_init(&sdref->type_info);
+
ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
ASSERT_SUCCESS(pthread_mutex_init(&sdref->mutex, &mutex_attr));
@@ -349,10 +443,11 @@ static void sdref_free(DNSServiceRef sdref) {
avahi_free(sdref->service_name);
avahi_free(sdref->service_name_chosen);
- avahi_free(sdref->service_regtype);
avahi_free(sdref->service_domain);
avahi_free(sdref->service_host);
+ type_info_free(&sdref->type_info);
+
avahi_string_list_free(sdref->service_txt);
avahi_free(sdref);
@@ -374,25 +469,26 @@ static void sdref_unref(DNSServiceRef sdref) {
}
int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdref) {
- if (!sdref || sdref->n_ref <= 0)
- return -1;
AVAHI_WARN_LINKAGE;
+ if (!sdref || sdref->n_ref <= 0)
+ return -1;
+
return sdref->main_fd;
}
DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) {
DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
AVAHI_WARN_LINKAGE;
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
+ if (!sdref || sdref->n_ref <= 0)
+ return kDNSServiceErr_BadParam;
+
sdref_ref(sdref);
+
+ ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
/* Cleanup notification socket */
if (read_command(sdref->main_fd) != COMMAND_POLL_DONE)
@@ -417,10 +513,10 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) {
finish:
- sdref_unref(sdref);
-
ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
+ sdref_unref(sdref);
+
return ret;
}
@@ -500,32 +596,45 @@ static void generic_client_callback(AvahiClient *s, AvahiClientState state, void
}
DNSServiceErrorType DNSSD_API DNSServiceBrowse(
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *regtype,
- const char *domain,
- DNSServiceBrowseReply callback,
- void *context) {
+ DNSServiceRef *ret_sdref,
+ DNSServiceFlags flags,
+ uint32_t interface,
+ const char *regtype,
+ const char *domain,
+ DNSServiceBrowseReply callback,
+ void *context) {
DNSServiceErrorType ret = kDNSServiceErr_Unknown;
int error;
DNSServiceRef sdref = NULL;
AvahiIfIndex ifindex;
+ struct type_info type_info;
AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(regtype);
- assert(callback);
+
+ if (!ret_sdref || !regtype)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) {
AVAHI_WARN_UNSUPPORTED;
return kDNSServiceErr_Unsupported;
}
- if (!(sdref = sdref_new()))
+ type_info_init(&type_info);
+
+ if (type_info_parse(&type_info, regtype) < 0 || type_info.n_subtypes > 1) {
+ type_info_free(&type_info);
+
+ if (!avahi_is_valid_service_type_generic(regtype))
+ return kDNSServiceErr_Unsupported;
+ } else
+ regtype = type_info.subtypes ? (char*) type_info.subtypes->text : type_info.type;
+
+ if (!(sdref = sdref_new())) {
+ type_info_free(&type_info);
return kDNSServiceErr_Unknown;
+ }
sdref->context = context;
sdref->service_browser_callback = callback;
@@ -554,6 +663,8 @@ finish:
if (ret != kDNSServiceErr_NoError)
DNSServiceRefDeallocate(sdref);
+ type_info_free(&type_info);
+
return ret;
}
@@ -597,7 +708,7 @@ static void service_resolver_callback(
strcat(full_name, ".");
- sdref->service_resolver_callback(sdref, 0, interface, kDNSServiceErr_NoError, full_name, host_name, htons(port), l, p, sdref->context);
+ sdref->service_resolver_callback(sdref, 0, interface, kDNSServiceErr_NoError, full_name, host_name, htons(port), l, (unsigned char*) p, sdref->context);
avahi_free(p);
break;
@@ -626,11 +737,9 @@ DNSServiceErrorType DNSSD_API DNSServiceResolve(
AVAHI_WARN_LINKAGE;
- assert(ret_sdref);
- assert(name);
- assert(regtype);
- assert(domain);
- assert(callback);
+ if (!ret_sdref || !name || !regtype || !domain || !callback)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) {
AVAHI_WARN_UNSUPPORTED;
@@ -679,9 +788,8 @@ int DNSSD_API DNSServiceConstructFullName (
AVAHI_WARN_LINKAGE;
- assert(fullName);
- assert(regtype);
- assert(domain);
+ if (!fullName || !regtype || !domain)
+ return -1;
if (avahi_service_name_join(fullName, kDNSServiceMaxDomainName, service, regtype, domain) < 0)
return -1;
@@ -740,8 +848,9 @@ DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains(
AVAHI_WARN_LINKAGE;
- assert(ret_sdref);
- assert(callback);
+ if (!ret_sdref || !callback)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
if (interface == kDNSServiceInterfaceIndexLocalOnly ||
(flags != kDNSServiceFlagsBrowseDomains && flags != kDNSServiceFlagsRegistrationDomains)) {
@@ -790,9 +899,10 @@ static void reg_report_error(DNSServiceRef sdref, DNSServiceErrorType error) {
assert(sdref);
assert(sdref->n_ref >= 1);
- assert(sdref->service_register_callback);
+ if (!sdref->service_register_callback)
+ return;
- regtype = add_trailing_dot(sdref->service_regtype, regtype_fixed, sizeof(regtype_fixed));
+ regtype = add_trailing_dot(sdref->type_info.type, regtype_fixed, sizeof(regtype_fixed));
domain = add_trailing_dot(sdref->service_domain, domain_fixed, sizeof(domain_fixed));
sdref->service_register_callback(
@@ -805,28 +915,25 @@ static void reg_report_error(DNSServiceRef sdref, DNSServiceErrorType error) {
static int reg_create_service(DNSServiceRef sdref) {
int ret;
- const char *real_type;
+ AvahiStringList *l;
assert(sdref);
assert(sdref->n_ref >= 1);
- real_type = avahi_get_type_from_subtype(sdref->service_regtype);
-
if ((ret = avahi_entry_group_add_service_strlst(
sdref->entry_group,
sdref->service_interface,
AVAHI_PROTO_UNSPEC,
0,
sdref->service_name_chosen,
- real_type ? real_type : sdref->service_regtype,
+ sdref->type_info.type,
sdref->service_domain,
sdref->service_host,
sdref->service_port,
sdref->service_txt)) < 0)
return ret;
-
- if (real_type) {
+ for (l = sdref->type_info.subtypes; l; l = l->next) {
/* Create a subtype entry */
if (avahi_entry_group_add_service_subtype(
@@ -835,11 +942,10 @@ static int reg_create_service(DNSServiceRef sdref) {
AVAHI_PROTO_UNSPEC,
0,
sdref->service_name_chosen,
- real_type,
+ sdref->type_info.type,
sdref->service_domain,
- sdref->service_regtype) < 0)
+ (const char*) l->text) < 0)
return ret;
-
}
if ((ret = avahi_entry_group_commit(sdref->entry_group)) < 0)
@@ -896,6 +1002,7 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us
}
case AVAHI_CLIENT_S_COLLISION:
+ case AVAHI_CLIENT_S_REGISTERING:
/* Remove our entry */
avahi_entry_group_reset(sdref->entry_group);
@@ -903,7 +1010,6 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us
break;
case AVAHI_CLIENT_CONNECTING:
- case AVAHI_CLIENT_S_REGISTERING:
/* Ignore */
break;
}
@@ -917,6 +1023,7 @@ static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState st
switch (state) {
case AVAHI_ENTRY_GROUP_ESTABLISHED:
+
/* Inform the user */
reg_report_error(sdref, kDNSServiceErr_NoError);
@@ -962,49 +1069,61 @@ static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState st
}
DNSServiceErrorType DNSSD_API DNSServiceRegister (
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *name,
- const char *regtype,
- const char *domain,
- const char *host,
- uint16_t port,
- uint16_t txtLen,
- const void *txtRecord,
- DNSServiceRegisterReply callback,
- void *context) {
+ DNSServiceRef *ret_sdref,
+ DNSServiceFlags flags,
+ uint32_t interface,
+ const char *name,
+ const char *regtype,
+ const char *domain,
+ const char *host,
+ uint16_t port,
+ uint16_t txtLen,
+ const void *txtRecord,
+ DNSServiceRegisterReply callback,
+ void *context) {
DNSServiceErrorType ret = kDNSServiceErr_Unknown;
int error;
DNSServiceRef sdref = NULL;
AvahiStringList *txt = NULL;
+ struct type_info type_info;
AVAHI_WARN_LINKAGE;
- assert(ret_sdref);
- assert(callback);
- assert(regtype);
+ if (!ret_sdref || !regtype)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
+
+ if (!txtRecord) {
+ txtLen = 1;
+ txtRecord = "";
+ }
if (interface == kDNSServiceInterfaceIndexLocalOnly || flags) {
AVAHI_WARN_UNSUPPORTED;
return kDNSServiceErr_Unsupported;
}
- if (txtRecord && txtLen > 0)
+ if (txtLen > 0)
if (avahi_string_list_parse(txtRecord, txtLen, &txt) < 0)
return kDNSServiceErr_Invalid;
+
+ if (type_info_parse(&type_info, regtype) < 0) {
+ avahi_string_list_free(txt);
+ return kDNSServiceErr_Invalid;
+ }
if (!(sdref = sdref_new())) {
avahi_string_list_free(txt);
+ type_info_free(&type_info);
return kDNSServiceErr_Unknown;
}
sdref->context = context;
sdref->service_register_callback = callback;
+ sdref->type_info = type_info;
sdref->service_name = avahi_strdup(name);
- sdref->service_regtype = regtype ? avahi_normalize_name_strdup(regtype) : NULL;
sdref->service_domain = domain ? avahi_normalize_name_strdup(domain) : NULL;
sdref->service_host = host ? avahi_normalize_name_strdup(host) : NULL;
sdref->service_interface = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
@@ -1076,3 +1195,65 @@ finish:
return ret;
}
+DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
+ DNSServiceRef sdref,
+ DNSRecordRef rref,
+ DNSServiceFlags flags,
+ uint16_t rdlen,
+ const void *rdata,
+ AVAHI_GCC_UNUSED uint32_t ttl) {
+
+ int ret = kDNSServiceErr_Unknown;
+ AvahiStringList *txt = NULL;
+
+ AVAHI_WARN_LINKAGE;
+
+ if (!sdref || sdref->n_ref <= 0)
+ return kDNSServiceErr_BadParam;
+
+ if (flags || rref) {
+ AVAHI_WARN_UNSUPPORTED;
+ return kDNSServiceErr_Unsupported;
+ }
+
+ if (rdlen > 0)
+ if (avahi_string_list_parse(rdata, rdlen, &txt) < 0)
+ return kDNSServiceErr_Invalid;
+
+ ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
+
+ if (!avahi_string_list_equal(txt, sdref->service_txt)) {
+
+ avahi_string_list_free(sdref->service_txt);
+ sdref->service_txt = txt;
+
+ if (avahi_client_get_state(sdref->client) == AVAHI_CLIENT_S_RUNNING &&
+ sdref->entry_group &&
+ (avahi_entry_group_get_state(sdref->entry_group) == AVAHI_ENTRY_GROUP_ESTABLISHED ||
+ avahi_entry_group_get_state(sdref->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING))
+
+ if (avahi_entry_group_update_service_txt_strlst(
+ sdref->entry_group,
+ sdref->service_interface,
+ AVAHI_PROTO_UNSPEC,
+ 0,
+ sdref->service_name_chosen,
+ sdref->type_info.type,
+ sdref->service_domain,
+ sdref->service_txt) < 0) {
+
+ ret = map_error(avahi_client_errno(sdref->client));
+ goto finish;
+ }
+
+ } else
+ avahi_string_list_free(txt);
+
+ ret = kDNSServiceErr_NoError;
+
+finish:
+ ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
+
+ return ret;
+}
+
diff --git a/avahi-compat-libdns_sd/dns_sd.h b/avahi-compat-libdns_sd/dns_sd.h
index 0d8a583..b7eb8a2 100644
--- a/avahi-compat-libdns_sd/dns_sd.h
+++ b/avahi-compat-libdns_sd/dns_sd.h
@@ -1,4 +1,5 @@
-/*
+/* -*- Mode: C; tab-width: 4 -*-
+ *
* Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,17 +34,32 @@
#endif
/* standard calling convention under Win32 is __stdcall */
-#if defined(_WIN32)
+/* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */
+/* _WIN32 symbol is defined by the compiler even though it's NOT compiling code for Windows32 */
+#if defined(_WIN32) && !defined(EFI32) && !defined(EFI64)
#define DNSSD_API __stdcall
#else
#define DNSSD_API
#endif
-#if defined(__FreeBSD_version) && (__FreeBSD_version < 500000) || defined(__OpenBSD__)
/* stdint.h does not exist on FreeBSD 4.x; its types are defined in sys/types.h instead */
+#if defined(__FreeBSD__) && (__FreeBSD__ < 5)
#include <sys/types.h>
+
+/* Likewise, on Sun, standard integer types are in sys/types.h */
#elif defined(__sun__)
#include <sys/types.h>
+
+/* EFI does not have stdint.h, or anything else equivalent */
+#elif defined(EFI32) || defined(EFI64)
+typedef UINT8 uint8_t;
+typedef INT8 int8_t;
+typedef UINT16 uint16_t;
+typedef INT16 int16_t;
+typedef UINT32 uint32_t;
+typedef INT32 int32_t;
+
+/* Windows has its own differences */
#elif defined(_WIN32)
#include <windows.h>
#define _UNUSED
@@ -56,6 +72,8 @@ typedef INT16 int16_t;
typedef UINT32 uint32_t;
typedef INT32 int32_t;
#endif
+
+/* All other Posix platforms use stdint.h */
#else
#include <stdint.h>
#endif
@@ -128,10 +146,15 @@ enum
* (queries from hosts more than one hop away; hosts not directly connected to the local link).
*/
- kDNSServiceFlagsForceMulticast = 0x400
+ kDNSServiceFlagsForceMulticast = 0x400,
/* Flag for signifying that a query or registration should be performed exclusively via multicast DNS,
* even for a name in a domain (e.g. foo.apple.com.) that would normally imply unicast DNS.
*/
+
+ kDNSServiceFlagsReturnCNAME = 0x800
+ /* Flag for returning CNAME records in the DNSServiceQueryRecord call. CNAME records are
+ * normally followed without indicating to the client that there was a CNAME record.
+ */
};
/*
@@ -179,7 +202,7 @@ enum
kDNSServiceType_KEY = 25, /* Security key. */
kDNSServiceType_PX = 26, /* X.400 mail mapping. */
kDNSServiceType_GPOS = 27, /* Geographical position (withdrawn). */
- kDNSServiceType_AAAA = 28, /* Ip6 Address. */
+ kDNSServiceType_AAAA = 28, /* IPv6 Address. */
kDNSServiceType_LOC = 29, /* Location Information. */
kDNSServiceType_NXT = 30, /* Next domain (security). */
kDNSServiceType_EID = 31, /* Endpoint identifier. */
@@ -189,7 +212,7 @@ enum
kDNSServiceType_NAPTR = 35, /* Naming Authority PoinTeR */
kDNSServiceType_KX = 36, /* Key Exchange */
kDNSServiceType_CERT = 37, /* Certification record */
- kDNSServiceType_A6 = 38, /* IPv6 address (deprecates AAAA) */
+ kDNSServiceType_A6 = 38, /* IPv6 Address (deprecated) */
kDNSServiceType_DNAME = 39, /* Non-terminal DNAME (for IPv6) */
kDNSServiceType_SINK = 40, /* Kitchen sink (experimentatl) */
kDNSServiceType_OPT = 41, /* EDNS0 option (meta-RR) */
@@ -301,7 +324,7 @@ enum
*
* If the client passes 0 for interface index, that means "do the right thing",
* which (at present) means, "if the name is in an mDNS local multicast domain
- * (e.g. 'local.', '254.169.in-addr.arpa.', '0.8.E.F.ip6.arpa.') then multicast
+ * (e.g. 'local.', '254.169.in-addr.arpa.', '{8,9,A,B}.E.F.ip6.arpa.') then multicast
* on all applicable interfaces, otherwise send via unicast to the appropriate
* DNS server." Normally, most clients will use 0 for interface index to
* automatically get the default sensible behaviour.
@@ -606,6 +629,9 @@ typedef void (DNSSD_API *DNSServiceRegisterReply)
* i.e. it creates a TXT record of length one containing a single empty string.
* RFC 1035 doesn't allow a TXT record to contain *zero* strings, so a single empty
* string is the smallest legal DNS TXT record.
+ * As with the other parameters, the DNSServiceRegister call copies the txtRecord
+ * data; e.g. if you allocated the storage for the txtRecord parameter with malloc()
+ * then you can safely free that memory right after the DNSServiceRegister call returns.
*
* callBack: The function to be called when the registration completes or asynchronously
* fails. The client MAY pass NULL for the callback - The client will NOT be notified
@@ -621,7 +647,6 @@ typedef void (DNSSD_API *DNSServiceRegisterReply)
* errors are delivered to the callback), otherwise returns an error code indicating
* the error that occurred (the callback is never invoked and the DNSServiceRef
* is not initialized.)
- *
*/
DNSServiceErrorType DNSSD_API DNSServiceRegister
@@ -648,6 +673,12 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister
* The record can later be updated or deregistered by passing the RecordRef initialized
* by this function to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
*
+ * Note that the DNSServiceAddRecord/UpdateRecord/RemoveRecord are *NOT* thread-safe
+ * with respect to a single DNSServiceRef. If you plan to have multiple threads
+ * in your program simultaneously add, update, or remove records from the same
+ * DNSServiceRef, then it's the caller's responsibility to use a mutext lock
+ * or take similar appropriate precautions to serialize those calls.
+ *
*
* Parameters;
*
@@ -897,9 +928,23 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse
*
* txtRecord: The service's primary txt record, in standard txt record format.
*
-
* context: The context pointer that was passed to the callout.
*
+ * NOTE: In earlier versions of this header file, the txtRecord parameter was declared "const char *"
+ * This is incorrect, since it contains length bytes which are values in the range 0 to 255, not -128 to +127.
+ * Depending on your compiler settings, this change may cause signed/unsigned mismatch warnings.
+ * These should be fixed by updating your own callback function definition to match the corrected
+ * function signature using "const unsigned char *txtRecord". Making this change may also fix inadvertent
+ * bugs in your callback function, where it could have incorrectly interpreted a length byte with value 250
+ * as being -6 instead, with various bad consequences ranging from incorrect operation to software crashes.
+ * If you need to maintain portable code that will compile cleanly with both the old and new versions of
+ * this header file, you should update your callback function definition to use the correct unsigned value,
+ * and then in the place where you pass your callback function to DNSServiceResolve(), use a cast to eliminate
+ * the compiler warning, e.g.:
+ * DNSServiceResolve(sd, flags, index, name, regtype, domain, (DNSServiceResolveReply)MyCallback, context);
+ * This will ensure that your code compiles cleanly without warnings (and more importantly, works correctly)
+ * with both the old header and with the new corrected version.
+ *
*/
typedef void (DNSSD_API *DNSServiceResolveReply)
@@ -912,7 +957,7 @@ typedef void (DNSSD_API *DNSServiceResolveReply)
const char *hosttarget,
uint16_t port,
uint16_t txtLen,
- const char *txtRecord,
+ const unsigned char *txtRecord,
void *context
);
@@ -1005,7 +1050,7 @@ DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef);
* DNSServiceRegisterRecordReply() parameters:
*
* sdRef: The connected DNSServiceRef initialized by
- * DNSServiceDiscoveryConnect().
+ * DNSServiceCreateConnection().
*
* RecordRef: The DNSRecordRef initialized by DNSServiceRegisterRecord(). If the above
* DNSServiceRef is passed to DNSServiceRefDeallocate(), this DNSRecordRef is
@@ -1220,7 +1265,7 @@ DNSServiceErrorType DNSSD_API DNSServiceQueryRecord
*
*/
-void DNSSD_API DNSServiceReconfirmRecord
+DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
(
DNSServiceFlags flags,
uint32_t interfaceIndex,
@@ -1300,7 +1345,7 @@ int DNSSD_API DNSServiceConstructFullName
* Note: Represents a DNS-SD TXT record.
*/
-typedef struct _TXTRecordRef_t { char privatedata[16]; } TXTRecordRef;
+typedef union _TXTRecordRef_t { char PrivateData[16]; char *ForceNaturalAlignment; } TXTRecordRef;
/* TXTRecordCreate()
@@ -1426,7 +1471,6 @@ DNSServiceErrorType DNSSD_API TXTRecordSetValue
* return value: Returns kDNSServiceErr_NoError on success.
* Returns kDNSServiceErr_NoSuchKey if the "key" does not
* exist in the TXTRecordRef.
- *
*/
DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
@@ -1446,7 +1490,6 @@ DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
* which you can pass directly to DNSServiceRegister() or
* to DNSServiceUpdateRecord().
* Returns 0 if the TXTRecordRef is empty.
- *
*/
uint16_t DNSSD_API TXTRecordGetLength
@@ -1464,7 +1507,6 @@ uint16_t DNSSD_API TXTRecordGetLength
* return value: Returns a pointer to the raw bytes inside the TXTRecordRef
* which you can pass directly to DNSServiceRegister() or
* to DNSServiceUpdateRecord().
- *
*/
const void * DNSSD_API TXTRecordGetBytesPtr
@@ -1519,7 +1561,6 @@ const void * DNSSD_API TXTRecordGetBytesPtr
*
* return value: Returns 1 if the TXT Record contains the specified key.
* Otherwise, it returns 0.
- *
*/
int DNSSD_API TXTRecordContainsKey
@@ -1663,6 +1704,17 @@ DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser
#endif //__APPLE_API_PRIVATE
+// Some C compiler cleverness. We can make the compiler check certain things for us,
+// and report errors at compile-time if anything is wrong. The usual way to do this would
+// be to use a run-time "if" statement or the conventional run-time "assert" mechanism, but
+// then you don't find out what's wrong until you run the software. This way, if the assertion
+// condition is false, the array size is negative, and the complier complains immediately.
+
+struct DNS_SD_CompileTimeAssertionChecks
+ {
+ char assert0[(sizeof(union _TXTRecordRef_t) == 16) ? 1 : -1];
+ };
+
#ifdef __cplusplus
}
#endif
diff --git a/trunk/avahi-compat-libdns_sd/null-test.c b/avahi-compat-libdns_sd/null-test.c
index a6c03df..a6c03df 100644
--- a/trunk/avahi-compat-libdns_sd/null-test.c
+++ b/avahi-compat-libdns_sd/null-test.c
diff --git a/avahi-compat-libdns_sd/txt-test.c b/avahi-compat-libdns_sd/txt-test.c
index 5999dd4..149a38c 100644
--- a/avahi-compat-libdns_sd/txt-test.c
+++ b/avahi-compat-libdns_sd/txt-test.c
@@ -28,7 +28,7 @@
#include <stdio.h>
#include <avahi-common/gccmacro.h>
-#include "dns_sd.h"
+#include <dns_sd.h>
static void hexdump(const void* p, size_t size) {
const uint8_t *c = p;
diff --git a/avahi-compat-libdns_sd/unsupported.c b/avahi-compat-libdns_sd/unsupported.c
index 0e08ad6..a460b41 100644
--- a/avahi-compat-libdns_sd/unsupported.c
+++ b/avahi-compat-libdns_sd/unsupported.c
@@ -62,7 +62,7 @@ DNSServiceErrorType DNSSD_API DNSServiceQueryRecord (
return kDNSServiceErr_Unsupported;
}
-void DNSSD_API DNSServiceReconfirmRecord (
+DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord (
AVAHI_GCC_UNUSED DNSServiceFlags flags,
AVAHI_GCC_UNUSED uint32_t interfaceIndex,
AVAHI_GCC_UNUSED const char *fullname,
@@ -73,7 +73,7 @@ void DNSSD_API DNSServiceReconfirmRecord (
AVAHI_WARN_UNSUPPORTED;
- return;
+ return kDNSServiceErr_Unsupported;
}
DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(AVAHI_GCC_UNUSED DNSServiceRef *sdRef) {
@@ -96,19 +96,6 @@ DNSServiceErrorType DNSSD_API DNSServiceAddRecord(
return kDNSServiceErr_Unsupported;
}
-DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata,
- AVAHI_GCC_UNUSED uint32_t ttl) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord(
AVAHI_GCC_UNUSED DNSServiceRef sdRef,
AVAHI_GCC_UNUSED DNSRecordRef RecordRef,
diff --git a/avahi-core/Makefile.am b/avahi-core/Makefile.am
index cb2d8f9..6e1d992 100644
--- a/avahi-core/Makefile.am
+++ b/avahi-core/Makefile.am
@@ -41,10 +41,16 @@ noinst_PROGRAMS = \
conformance-test \
avahi-reflector \
dns-test \
+ dns-spin-test \
timeeventq-test \
hashmap-test \
querier-test \
update-test
+
+TESTS = \
+ dns-spin-test \
+ dns-test \
+ hashmap-test
endif
libavahi_core_la_SOURCES = \
@@ -138,6 +144,11 @@ dns_test_SOURCES = \
dns_test_CFLAGS = $(AM_CFLAGS)
dns_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
+dns_spin_test_SOURCES = \
+ dns-spin-test.c
+dns_spin_test_CFLAGS = $(AM_CFLAGS)
+dns_spin_test_LDADD = $(AM_LDADD) libavahi-core.la
+
timeeventq_test_SOURCES = \
timeeventq-test.c \
timeeventq.h timeeventq.c \
diff --git a/avahi-core/announce.c b/avahi-core/announce.c
index 4a87e1d..a77fbb6 100644
--- a/avahi-core/announce.c
+++ b/avahi-core/announce.c
@@ -498,7 +498,7 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye
assert(i);
if (send_goodbye)
- if (avahi_interface_is_relevant(i)) {
+ if (i->announcing) {
AvahiEntry *e;
for (e = s->entries; e; e = e->entries_next)
diff --git a/avahi-core/avahi-test.c b/avahi-core/avahi-test.c
index f540cf4..cb7b97e 100644
--- a/avahi-core/avahi-test.c
+++ b/avahi-core/avahi-test.c
@@ -192,9 +192,11 @@ static void create_entries(int new_name) {
r->data.cname.name = avahi_strdup("cocaine.local");
if (avahi_server_add(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, r) < 0) {
+ avahi_record_unref(r);
avahi_log_error("Failed to add CNAME record");
goto fail;
}
+ avahi_record_unref(r);
avahi_s_entry_group_commit(group);
return;
@@ -248,7 +250,7 @@ static void db_callback(
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain, browser_event_to_string(event));
+ avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain ? domain : "NULL", browser_event_to_string(event));
}
static void stb_callback(
@@ -261,7 +263,7 @@ static void stb_callback(
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type, domain, browser_event_to_string(event));
+ avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type ? service_type : "NULL", domain ? domain : "NULL", browser_event_to_string(event));
}
static void sb_callback(
@@ -274,7 +276,7 @@ static void sb_callback(
const char *domain,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain, browser_event_to_string(event));
+ avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name ? name : "NULL", service_type ? service_type : "NULL", domain ? domain : "NULL", browser_event_to_string(event));
}
static void sr_callback(
@@ -321,7 +323,7 @@ static void dsb_callback(
if (a)
avahi_address_snprint(t, sizeof(t), a);
- avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname, t, port, browser_event_to_string(event));
+ avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname ? hostname : "NULL", t, port, browser_event_to_string(event));
}
int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
diff --git a/avahi-core/browse.c b/avahi-core/browse.c
index dd4fe3c..16d8954 100644
--- a/avahi-core/browse.c
+++ b/avahi-core/browse.c
@@ -195,7 +195,6 @@ static void browser_cancel(AvahiSRecordBrowser *b) {
}
}
-
static void lookup_wide_area_callback(
AvahiWideAreaLookupEngine *e,
AvahiBrowserEvent event,
@@ -208,6 +207,7 @@ static void lookup_wide_area_callback(
assert(e);
assert(l);
+ assert(l->ref >= 1);
b = l->record_browser;
@@ -422,6 +422,7 @@ static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, Avahi
l->cname_lookups = avahi_rlist_prepend(l->cname_lookups, lookup_ref(n));
lookup_go(n);
+ lookup_unref(n);
}
static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
diff --git a/avahi-core/cache.c b/avahi-core/cache.c
index 3a8f849..4ba88b5 100644
--- a/avahi-core/cache.c
+++ b/avahi-core/cache.c
@@ -480,7 +480,7 @@ void avahi_cache_start_poof(AvahiCache *c, AvahiKey *key, const AvahiAddress *a)
assert(c);
assert(key);
- avahi_cache_walk(c, key, start_poof_callback, a);
+ avahi_cache_walk(c, key, start_poof_callback, (void*) a);
}
void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddress *a) {
diff --git a/avahi-core/core.h b/avahi-core/core.h
index e73abd2..c8e6fd6 100644
--- a/avahi-core/core.h
+++ b/avahi-core/core.h
@@ -63,6 +63,8 @@ typedef struct AvahiServerConfig {
AvahiStringList *browse_domains; /**< Additional browsing domains */
int disable_publishing; /**< Disable publishing of any record */
int allow_point_to_point; /**< Enable publishing on POINTOPOINT interfaces */
+ int publish_a_on_ipv6; /**< Publish an IPv4 A RR on IPv6 sockets */
+ int publish_aaaa_on_ipv4; /**< Publish an IPv4 A RR on IPv6 sockets */
} AvahiServerConfig;
/** Allocate a new mDNS responder object. */
@@ -148,6 +150,9 @@ uint32_t avahi_server_get_local_service_cookie(AvahiServer *s);
/** Set the wide area DNS servers */
int avahi_server_set_wide_area_servers(AvahiServer *s, const AvahiAddress *a, unsigned n);
+/** Return the current configuration of the server \since 0.6.17 */
+const AvahiServerConfig* avahi_server_get_config(AvahiServer *s);
+
AVAHI_C_DECL_END
#endif
diff --git a/avahi-core/dns-spin-test.c b/avahi-core/dns-spin-test.c
new file mode 100644
index 0000000..d93e508
--- /dev/null
+++ b/avahi-core/dns-spin-test.c
@@ -0,0 +1,124 @@
+/* $Id$ */
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with avahi; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+/* Regression test for Avahi bug #84.
+ * This program tests whether the avahi_dns_packet_consume_name function
+ * returns (rather than spinning forever). For a function as simple as
+ * avahi_dns_packet_consume_name, we assume that 1 second of CPU time ≈ forever
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/time.h>
+
+#include "dns.h"
+
+#define MAX_CPU_SECONDS 1
+
+#define TEST_NAME "dns-spin-test"
+
+static void fail(const char *fmt, ...) __attribute__((format(printf, 1, 2), noreturn));
+static void unresolved(const char *fmt, ...) __attribute__((format(printf, 1, 2), noreturn));
+static void stdlib_fail(const char *msg) __attribute__((noreturn));
+static void handle(int sig) __attribute__((noreturn));
+
+void stdlib_fail(const char *msg) {
+ perror(msg);
+
+ printf("UNRESOLVED: " TEST_NAME " (stdlib failure)\n");
+
+ exit(77);
+}
+
+void unresolved(const char *fmt, ...) {
+ va_list ap;
+
+ printf("UNRESOLVED: " TEST_NAME ": ");
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+ printf("\n");
+
+ exit(77);
+}
+
+void fail(const char *fmt, ...) {
+ va_list ap;
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ va_end(ap);
+ printf("\n");
+
+ exit(EXIT_FAILURE);
+}
+
+void handle(AVAHI_GCC_UNUSED int sig) {
+ fail("Interrupted after %d second of CPU time", MAX_CPU_SECONDS);
+}
+
+#define TRY_EXCEPT(cmd, badresult) \
+ do { \
+ if ((cmd) == (badresult)) \
+ unresolved("%s returned %s", #cmd, #badresult); \
+ } while (0)
+
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
+ struct itimerval itval;
+ AvahiDnsPacket *packet;
+ char name[512];
+ int ret;
+ uint8_t badrr[] = {
+ 0xC0, AVAHI_DNS_PACKET_HEADER_SIZE, /* self-referential QNAME pointer */
+ 0, 1, /* QTYPE A (host addr) */
+ 0, 1, /* QCLASS IN (internet/ipv4) */
+ };
+
+ if (signal(SIGVTALRM, handle) == SIG_ERR)
+ stdlib_fail("signal(SIGVTALRM)");
+
+ memset(&itval, 0, sizeof(itval));
+ itval.it_value.tv_sec = MAX_CPU_SECONDS;
+
+ if (setitimer(ITIMER_VIRTUAL, &itval, NULL) == -1)
+ stdlib_fail("setitimer()");
+
+ TRY_EXCEPT(packet = avahi_dns_packet_new_query(512), NULL);
+ TRY_EXCEPT(avahi_dns_packet_append_bytes(packet, badrr, sizeof(badrr)), NULL);
+
+ /* This is expected to fail (if it returns) */
+ ret = avahi_dns_packet_consume_name(packet, name, sizeof(name));
+
+ if (ret != -1)
+ fail("avahi_dns_packet_consume_name() returned %d; -1 was expected", ret);
+
+ return EXIT_SUCCESS;
+}
+
+/* vim:ts=4:sw=4:et
+ */
diff --git a/avahi-core/dns.c b/avahi-core/dns.c
index c545c00..0206ec7 100644
--- a/avahi-core/dns.c
+++ b/avahi-core/dns.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <assert.h>
+#include <sys/types.h>
#include <netinet/in.h>
#include <avahi-common/defs.h>
@@ -332,9 +333,11 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
int ret = 0;
int compressed = 0;
int first_label = 1;
+ unsigned label_ptr;
+ int i;
assert(p && ret_name && l);
- for (;;) {
+ for (i = 0; i < AVAHI_DNS_LABELS_MAX; i++) {
uint8_t n;
if (idx+1 > p->size)
@@ -384,7 +387,12 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
if (idx+2 > p->size)
return -1;
- idx = ((unsigned) (AVAHI_DNS_PACKET_DATA(p)[idx] & ~0xC0)) << 8 | AVAHI_DNS_PACKET_DATA(p)[idx+1];
+ label_ptr = ((unsigned) (AVAHI_DNS_PACKET_DATA(p)[idx] & ~0xC0)) << 8 | AVAHI_DNS_PACKET_DATA(p)[idx+1];
+
+ if ((label_ptr < AVAHI_DNS_PACKET_HEADER_SIZE) || (label_ptr >= idx))
+ return -1;
+
+ idx = label_ptr;
if (!compressed)
ret += 2;
@@ -393,6 +401,8 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
} else
return -1;
}
+
+ return -1;
}
int avahi_dns_packet_consume_name(AvahiDnsPacket *p, char *ret_name, size_t l) {
@@ -579,6 +589,7 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
if (rdlength > 0) {
r->data.generic.data = avahi_memdup(avahi_dns_packet_get_rptr(p), rdlength);
+ r->data.generic.size = rdlength;
if (avahi_dns_packet_skip(p, rdlength) < 0)
return -1;
@@ -744,7 +755,7 @@ static int append_rdata(AvahiDnsPacket *p, AvahiRecord *r) {
default:
if (r->data.generic.size)
- if (avahi_dns_packet_append_bytes(p, r->data.generic.data, r->data.generic.size))
+ if (!avahi_dns_packet_append_bytes(p, r->data.generic.data, r->data.generic.size))
return -1;
break;
@@ -776,7 +787,7 @@ uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int c
goto fail;
size = avahi_dns_packet_extend(p, 0) - start;
- assert(size <= 0xFFFF);
+ assert(size <= AVAHI_DNS_RDATA_MAX);
/* avahi_log_debug("appended %u", size); */
diff --git a/avahi-core/dns.h b/avahi-core/dns.h
index 4696e00..d485510 100644
--- a/avahi-core/dns.h
+++ b/avahi-core/dns.h
@@ -25,9 +25,11 @@
#include "rr.h"
#include "hashmap.h"
-#define AVAHI_DNS_PACKET_SIZE_MAX 9000
#define AVAHI_DNS_PACKET_HEADER_SIZE 12
#define AVAHI_DNS_PACKET_EXTRA_SIZE 48
+#define AVAHI_DNS_LABELS_MAX 127
+#define AVAHI_DNS_RDATA_MAX 0xFFFF
+#define AVAHI_DNS_PACKET_SIZE_MAX (AVAHI_DNS_PACKET_HEADER_SIZE + 256 + 2 + 2 + 4 + 2 + AVAHI_DNS_RDATA_MAX)
typedef struct AvahiDnsPacket {
size_t size, rindex, max_size;
@@ -105,7 +107,5 @@ size_t avahi_dns_packet_space(AvahiDnsPacket *p);
#define AVAHI_MDNS_SUFFIX_ADDR_IPV4 "254.169.in-addr.arpa"
#define AVAHI_MDNS_SUFFIX_ADDR_IPV6 "0.8.e.f.ip6.arpa"
-#define AVAHI_DNS_RDATA_MAX 65535
-
#endif
diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c
index 3aeba12..777a064 100644
--- a/avahi-core/domain-util.c
+++ b/avahi-core/domain-util.c
@@ -33,6 +33,7 @@
#include <avahi-common/malloc.h>
+#include "log.h"
#include "domain-util.h"
#include "util.h"
@@ -51,6 +52,40 @@ static void strip_bad_chars(char *s) {
*d = 0;
}
+#ifdef __linux__
+static int load_lsb_distrib_id(char *ret_s, size_t size) {
+ FILE *f;
+
+ assert(ret_s);
+ assert(size > 0);
+
+ if (!(f = fopen("/etc/lsb-release", "r")))
+ return -1;
+
+ while (!feof(f)) {
+ char ln[256], *p;
+
+ if (!fgets(ln, sizeof(ln), f))
+ break;
+
+ if (strncmp(ln, "DISTRIB_ID=", 11))
+ continue;
+
+ p = ln + 11;
+ p += strspn(p, "\"");
+ p[strcspn(p, "\"")] = 0;
+
+ snprintf(ret_s, size, "%s", p);
+
+ fclose(f);
+ return 0;
+ }
+
+ fclose(f);
+ return -1;
+}
+#endif
+
char *avahi_get_host_name(char *ret_s, size_t size) {
assert(ret_s);
assert(size > 0);
@@ -61,19 +96,39 @@ char *avahi_get_host_name(char *ret_s, size_t size) {
} else
*ret_s = 0;
+ if (strcmp(ret_s, "localhost") == 0 || strncmp(ret_s, "localhost.", 10) == 0) {
+ *ret_s = 0;
+ avahi_log_warn("System host name is set to 'localhost'. This is not a suitable mDNS host name, looking for alternatives.");
+ }
+
if (*ret_s == 0) {
- struct utsname utsname;
-
/* No hostname was set, so let's take the OS name */
- if (uname(&utsname) >= 0) {
- snprintf(ret_s, size, "%s", utsname.sysname);
+#ifdef __linux__
+
+ /* Try LSB distribution name first */
+ if (load_lsb_distrib_id(ret_s, size) >= 0) {
strip_bad_chars(ret_s);
avahi_strdown(ret_s);
}
if (*ret_s == 0)
- snprintf(ret_s, size, "unnamed");
+#endif
+
+ {
+ /* Try uname() second */
+ struct utsname utsname;
+
+ if (uname(&utsname) >= 0) {
+ snprintf(ret_s, size, "%s", utsname.sysname);
+ strip_bad_chars(ret_s);
+ avahi_strdown(ret_s);
+ }
+
+ /* Give up */
+ if (*ret_s == 0)
+ snprintf(ret_s, size, "unnamed");
+ }
}
if (size >= AVAHI_LABEL_MAX)
diff --git a/avahi-core/entry.c b/avahi-core/entry.c
index 9e9c0dd..e2a7c6c 100644
--- a/avahi-core/entry.c
+++ b/avahi-core/entry.c
@@ -1014,6 +1014,11 @@ void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState
if (avahi_age(&g->established_at) > 5000000)
g->n_register_try = 0;
+ } else if (g->state == AVAHI_ENTRY_GROUP_REGISTERING) {
+ if (g->register_time_event) {
+ avahi_time_event_free(g->register_time_event);
+ g->register_time_event = NULL;
+ }
}
if (state == AVAHI_ENTRY_GROUP_ESTABLISHED)
@@ -1153,15 +1158,8 @@ void avahi_s_entry_group_reset(AvahiSEntryGroup *g) {
}
g->server->need_entry_cleanup = 1;
- if (g->register_time_event) {
- avahi_time_event_free(g->register_time_event);
- g->register_time_event = NULL;
- }
-
g->n_probing = 0;
- gettimeofday(&g->register_time, NULL);
-
avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED);
}
diff --git a/trunk/avahi-core/findstatic.pl b/avahi-core/findstatic.pl
index 43a4916..43a4916 100755
--- a/trunk/avahi-core/findstatic.pl
+++ b/avahi-core/findstatic.pl
diff --git a/avahi-core/iface-linux.c b/avahi-core/iface-linux.c
index 910000d..c8ed9e0 100644
--- a/avahi-core/iface-linux.c
+++ b/avahi-core/iface-linux.c
@@ -34,6 +34,16 @@
#include "iface.h"
#include "iface-linux.h"
+#ifndef IFLA_RTA
+#include <linux/if_addr.h>
+#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
+#endif
+
+#ifndef IFA_RTA
+#include <linux/if_addr.h>
+#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
+#endif
+
static int netlink_list_items(AvahiNetlink *nl, uint16_t type, unsigned *ret_seq) {
struct nlmsghdr *n;
struct rtgenmsg *gen;
diff --git a/avahi-core/iface-pfroute.c b/avahi-core/iface-pfroute.c
index 51f6773..f96bfc2 100644
--- a/avahi-core/iface-pfroute.c
+++ b/avahi-core/iface-pfroute.c
@@ -34,6 +34,8 @@
#include <sys/param.h>
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
+#else
+#include <sys/sockio.h>
#endif
#include <net/route.h>
@@ -260,10 +262,11 @@ static void socket_event(AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent
int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
int fd = -1;
- m->osdep.pfroute = NULL;
assert(m);
+ m->osdep.pfroute = NULL;
+
if ((fd = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0) {
avahi_log_error(__FILE__": socket(PF_ROUTE): %s", strerror(errno));
goto fail;
@@ -316,7 +319,117 @@ void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m) {
}
}
+#if defined (SIOCGLIFNUM) && defined(HAVE_STRUCT_LIFCONF) /* Solaris 8 and later; Sol 7? */
+/*
+ * I got this function from GNU zsbra
+ */
+static int ip6_masklen (struct in6_addr netmask) {
+ int len = 0;
+ unsigned char val;
+ unsigned char *pnt;
+
+ pnt = (unsigned char *) & netmask;
+
+ while ((*pnt == 0xff) && len < 128) {
+ len += 8;
+ pnt++;
+ }
+
+ if (len < 128) {
+ val = *pnt;
+ while (val) {
+ len++;
+ val <<= 1;
+ }
+ }
+ return len;
+}
+
+static void if_add_interface(struct lifreq *lifreq, AvahiInterfaceMonitor *m, int fd, int count)
+{
+ AvahiHwInterface *hw;
+ AvahiAddress addr;
+ struct lifreq lifrcopy;
+ unsigned int index;
+ int flags;
+ int mtu;
+ int prefixlen;
+ AvahiInterfaceAddress *addriface;
+ AvahiInterface *iface;
+ struct sockaddr_in mask;
+ struct sockaddr_in6 mask6;
+ char caddr[AVAHI_ADDRESS_STR_MAX];
+
+ lifrcopy = *lifreq;
+
+ if (ioctl(fd, SIOCGLIFFLAGS, &lifrcopy) < 0) {
+ avahi_log_error(__FILE__": ioctl(SIOCGLIFFLAGS) %s", strerror(errno));
+ return;
+ }
+ flags = lifrcopy.lifr_flags;
+
+ if (ioctl(fd, SIOCGLIFMTU, &lifrcopy) < 0) {
+ avahi_log_error(__FILE__": ioctl(SIOCGLIFMTU) %s", strerror(errno));
+ return;
+ }
+ mtu = lifrcopy.lifr_metric;
+
+ if (ioctl(fd, SIOCGLIFADDR, &lifrcopy) < 0) {
+ avahi_log_error(__FILE__": ioctl(SIOCGLIFADDR) %s", strerror(errno));
+ return;
+ }
+ addr.proto = avahi_af_to_proto(lifreq->lifr_addr.ss_family);
+ if (ioctl(fd, SIOCGLIFNETMASK, &lifrcopy) < 0) {
+ avahi_log_error(__FILE__": ioctl(SIOCGLIFNETMASK) %s", strerror(errno));
+ return;
+ }
+ switch (lifreq->lifr_addr.ss_family) {
+ case AF_INET:
+ memcpy(addr.data.data, &((struct sockaddr_in *)&lifreq->lifr_addr)->sin_addr, sizeof(struct in_addr));
+ memcpy(&mask, &((struct sockaddr_in *)&lifrcopy.lifr_addr)->sin_addr, sizeof(struct in_addr));
+ prefixlen = bitcount((unsigned int) mask.sin_addr.s_addr);
+ break;
+ case AF_INET6:
+ memcpy(addr.data.data, &((struct sockaddr_in6 *)&lifreq->lifr_addr)->sin6_addr, sizeof(struct in6_addr));
+ memcpy(&mask6, &((struct sockaddr_in6 *)&lifrcopy.lifr_addr)->sin6_addr, sizeof(struct in6_addr));
+ prefixlen = lifrcopy.lifr_addrlen;
+ break;
+ default:
+ break;
+ }
+ index = if_nametoindex(lifreq->lifr_name);
+
+ if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) index))) {
+ if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) index)))
+ return; /* OOM */
+
+ hw->flags_ok =
+ (flags & IFF_UP) &&
+ (!m->server->config.use_iff_running || (flags & IFF_RUNNING)) &&
+ !(flags & IFF_LOOPBACK) &&
+ (flags & IFF_MULTICAST) &&
+ (m->server->config.allow_point_to_point || !(flags & IFF_POINTOPOINT));
+ hw->name = avahi_strdup(lifreq->lifr_name);
+ hw->mtu = mtu;
+ /* TODO get mac address */
+ }
+
+ if (!(iface = avahi_interface_monitor_get_interface(m, (AvahiIfIndex)index, addr.proto)))
+ return;
+
+ if (!(addriface = avahi_interface_monitor_get_address(m, iface, &addr)))
+ if (!(addriface = avahi_interface_address_new(m, iface, &addr, prefixlen)))
+ return; /* OOM */
+
+ addriface->global_scope = 1;
+
+ avahi_hw_interface_check_relevant(hw);
+ avahi_hw_interface_update_rrs(hw, 0);
+}
+#endif
+
void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
+#ifndef HAVE_STRUCT_LIFCONF
size_t needed;
int mib[6];
char *buf, *lim, *next, count = 0;
@@ -325,7 +438,6 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
assert(m);
retry2:
-#ifdef HAVE_SYS_SYSCTL_H
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
mib[2] = 0; /* protocol */
@@ -338,13 +450,11 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
avahi_log_error("route-sysctl-estimate");
return;
}
-#endif
if ((buf = avahi_malloc(needed)) == NULL)
{
avahi_log_error("malloc failed in avahi_interface_monitor_sync");
return;
}
-#ifdef HAVE_SYS_SYSCTL_H
if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
avahi_log_warn("sysctl failed: %s", strerror(errno));
if (errno == ENOMEM && count++ < 10) {
@@ -354,7 +464,6 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
goto retry2;
}
}
-#endif
lim = buf + needed;
for (next = buf; next < lim; next += rtm->rtm_msglen) {
rtm = (struct rt_msghdr *)next;
@@ -365,4 +474,49 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
avahi_interface_monitor_check_relevant(m);
avahi_interface_monitor_update_rrs(m, 0);
avahi_log_info("Network interface enumeration completed.");
+#elif defined (SIOCGLIFNUM) && defined(HAVE_STRUCT_LIFCONF) /* Solaris 8 and later; Sol 7? */
+ int sockfd;
+ int ret;
+ int n;
+ struct lifnum lifn;
+ struct lifconf lifc;
+ struct lifreq *lifreq;
+
+ if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ avahi_log_error(__FILE__": socket(PFROUTE): %s", strerror(errno));
+ return;
+ }
+ lifc.lifc_buf = NULL;
+ lifn.lifn_family = AF_UNSPEC;
+ lifn.lifn_flags = 0;
+ if (ioctl(sockfd, SIOCGLIFNUM, &lifn) < 0) {
+ avahi_log_error(__FILE__": ioctl(SIOCGLIFNUM): %s", strerror(errno));
+ goto end;
+ }
+ lifc.lifc_len = lifn.lifn_count * sizeof (struct lifreq);
+ if ((lifc.lifc_buf = avahi_malloc(lifc.lifc_len)) == NULL) {
+ avahi_log_error("malloc failed in avahi_interface_monitor_sync");
+ goto end;
+ }
+ lifc.lifc_family = NULL;
+ lifc.lifc_flags = 0;
+ if(ioctl(sockfd, SIOCGLIFCONF, &lifc) < 0) {
+ avahi_log_error(__FILE__": ioctl(SIOCGLIFCONF): %s", strerror(errno));
+ goto end;
+ }
+ lifreq = lifc.lifc_req;
+
+ for (n = 0; n < lifc.lifc_len; n += sizeof(struct lifreq)) {
+ if_add_interface(lifreq, m, sockfd, lifn.lifn_count);
+ lifreq++;
+ }
+ m->list_complete = 1;
+ avahi_interface_monitor_check_relevant(m);
+ avahi_interface_monitor_update_rrs(m, 0);
+end:
+ close(sockfd);
+ avahi_free(lifc.lifc_buf);
+
+ avahi_log_info("Network interface enumeration completed.");
+#endif
}
diff --git a/avahi-core/iface.c b/avahi-core/iface.c
index 5685618..f90a61a 100644
--- a/avahi-core/iface.c
+++ b/avahi-core/iface.c
@@ -50,9 +50,9 @@ void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs
assert(a);
m = a->monitor;
- if (a->interface->announcing &&
- m->list_complete &&
+ if (m->list_complete &&
avahi_interface_address_is_relevant(a) &&
+ avahi_interface_is_relevant(a->interface) &&
!remove_rrs &&
m->server->config.publish_addresses &&
(m->server->state == AVAHI_SERVER_RUNNING ||
@@ -67,11 +67,15 @@ void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs
if (avahi_s_entry_group_is_empty(a->entry_group)) {
char t[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(t, sizeof(t), &a->address);
+ AvahiProtocol p;
- avahi_log_info("Registering new address record for %s on %s.", t, a->interface->hardware->name);
+ p = (a->interface->protocol == AVAHI_PROTO_INET && m->server->config.publish_a_on_ipv6) ||
+ (a->interface->protocol == AVAHI_PROTO_INET6 && m->server->config.publish_aaaa_on_ipv4) ? AVAHI_PROTO_UNSPEC : a->interface->protocol;
+
+ avahi_address_snprint(t, sizeof(t), &a->address);
+ avahi_log_info("Registering new address record for %s on %s.%s.", t, a->interface->hardware->name, p == AVAHI_PROTO_UNSPEC ? "*" : avahi_proto_to_string(p));
- if (avahi_server_add_address(m->server, a->entry_group, a->interface->hardware->index, a->interface->protocol, 0, NULL, &a->address) < 0) {
+ if (avahi_server_add_address(m->server, a->entry_group, a->interface->hardware->index, p, 0, NULL, &a->address) < 0) {
avahi_log_warn(__FILE__": avahi_server_add_address() failed: %s", avahi_strerror(m->server->error));
avahi_s_entry_group_free(a->entry_group);
a->entry_group = NULL;
@@ -171,6 +175,10 @@ static int interface_mdns_mcast_join(AvahiInterface *i, int join) {
if (!!join == !!i->mcast_joined)
return 0;
+
+ if ((i->protocol == AVAHI_PROTO_INET6 && i->monitor->server->fd_ipv6 < 0) ||
+ (i->protocol == AVAHI_PROTO_INET && i->monitor->server->fd_ipv4 < 0))
+ return -1;
if (join) {
AvahiInterfaceAddress *a;
@@ -186,10 +194,8 @@ static int interface_mdns_mcast_join(AvahiInterface *i, int join) {
a = i->addresses;
/* Hmm, there is no address available. */
- if (!a) {
- avahi_log_warn(__FILE__": interface_mdns_mcast_join() called but no local address available.");
+ if (!a)
return -1;
- }
i->local_mcast_address = a->address;
}
@@ -387,9 +393,9 @@ AvahiHwInterface *avahi_hw_interface_new(AvahiInterfaceMonitor *m, AvahiIfIndex
avahi_hashmap_insert(m->hashmap, &hw->index, hw);
- if (m->server->fd_ipv4 >= 0)
+ if (m->server->fd_ipv4 >= 0 || m->server->config.publish_a_on_ipv6)
avahi_interface_new(m, hw, AVAHI_PROTO_INET);
- if (m->server->fd_ipv6 >= 0)
+ if (m->server->fd_ipv6 >= 0 || m->server->config.publish_aaaa_on_ipv4)
avahi_interface_new(m, hw, AVAHI_PROTO_INET6);
return hw;
@@ -426,13 +432,16 @@ void avahi_interface_check_relevant(AvahiInterface *i) {
b = avahi_interface_is_relevant(i);
if (m->list_complete && b && !i->announcing) {
- avahi_log_info("New relevant interface %s.%s for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol));
-
interface_mdns_mcast_join(i, 1);
- i->announcing = 1;
- avahi_announce_interface(m->server, i);
- avahi_multicast_lookup_engine_new_interface(m->server->multicast_lookup_engine, i);
+ if (i->mcast_joined) {
+ avahi_log_info("New relevant interface %s.%s for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol));
+
+ i->announcing = 1;
+ avahi_announce_interface(m->server, i);
+ avahi_multicast_lookup_engine_new_interface(m->server->multicast_lookup_engine, i);
+ }
+
} else if (!b && i->announcing) {
avahi_log_info("Interface %s.%s no longer relevant for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol));
@@ -530,7 +539,7 @@ AvahiInterface* avahi_interface_monitor_get_interface(AvahiInterfaceMonitor *m,
AvahiHwInterface* avahi_interface_monitor_get_hw_interface(AvahiInterfaceMonitor *m, AvahiIfIndex idx) {
assert(m);
- assert(idx > 0);
+ assert(idx >= 0);
return avahi_hashmap_lookup(m->hashmap, &idx);
}
@@ -553,7 +562,7 @@ void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, c
assert(i);
assert(p);
- if (!avahi_interface_is_relevant(i))
+ if (!i->announcing)
return;
assert(!a || a->proto == i->protocol);
@@ -575,10 +584,10 @@ int avahi_interface_post_query(AvahiInterface *i, AvahiKey *key, int immediately
assert(i);
assert(key);
- if (avahi_interface_is_relevant(i))
- return avahi_query_scheduler_post(i->query_scheduler, key, immediately, ret_id);
-
- return 0;
+ if (!i->announcing)
+ return 0;
+
+ return avahi_query_scheduler_post(i->query_scheduler, key, immediately, ret_id);
}
int avahi_interface_withraw_query(AvahiInterface *i, unsigned id) {
@@ -590,20 +599,20 @@ int avahi_interface_post_response(AvahiInterface *i, AvahiRecord *record, int fl
assert(i);
assert(record);
- if (avahi_interface_is_relevant(i))
- return avahi_response_scheduler_post(i->response_scheduler, record, flush_cache, querier, immediately);
-
- return 0;
+ if (!i->announcing)
+ return 0;
+
+ return avahi_response_scheduler_post(i->response_scheduler, record, flush_cache, querier, immediately);
}
int avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *record, int immediately) {
assert(i);
assert(record);
- if (avahi_interface_is_relevant(i))
- return avahi_probe_scheduler_post(i->probe_scheduler, record, immediately);
+ if (!i->announcing)
+ return 0;
- return 0;
+ return avahi_probe_scheduler_post(i->probe_scheduler, record, immediately);
}
int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void* userdata) {
@@ -625,21 +634,19 @@ int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void
int avahi_interface_is_relevant(AvahiInterface *i) {
AvahiInterfaceAddress *a;
- int relevant_address;
assert(i);
- relevant_address = 0;
+ if (!i->hardware->flags_ok)
+ return 0;
for (a = i->addresses; a; a = a->address_next)
- if (avahi_interface_address_is_relevant(a)) {
- relevant_address = 1;
- break;
- }
+ if (avahi_interface_address_is_relevant(a))
+ return 1;
- return i->hardware->flags_ok && relevant_address;
+ return 0;
}
-
+
int avahi_interface_address_is_relevant(AvahiInterfaceAddress *a) {
AvahiInterfaceAddress *b;
assert(a);
diff --git a/avahi-core/netlink.c b/avahi-core/netlink.c
index b2a6684..5050801 100644
--- a/avahi-core/netlink.c
+++ b/avahi-core/netlink.c
@@ -47,19 +47,46 @@ struct AvahiNetlink {
int avahi_netlink_work(AvahiNetlink *nl, int block) {
ssize_t bytes;
+ struct msghdr smsg;
+ struct cmsghdr *cmsg;
+ struct ucred *cred;
+ struct iovec iov;
struct nlmsghdr *p;
+ char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
assert(nl);
-
- if ((bytes = recv(nl->fd, nl->buffer, nl->buffer_length, block ? 0 : MSG_DONTWAIT)) < 0) {
-
+
+ iov.iov_base = nl->buffer;
+ iov.iov_len = nl->buffer_length;
+
+ smsg.msg_name = NULL;
+ smsg.msg_namelen = 0;
+ smsg.msg_iov = &iov;
+ smsg.msg_iovlen = 1;
+ smsg.msg_control = cred_msg;
+ smsg.msg_controllen = sizeof(cred_msg);
+ smsg.msg_flags = (block ? 0 : MSG_DONTWAIT);
+
+ if ((bytes = recvmsg(nl->fd, &smsg, 0)) < 0) {
if (errno == EAGAIN || errno == EINTR)
return 0;
- avahi_log_error(__FILE__": recv() failed: %s", strerror(errno));
+ avahi_log_error(__FILE__": recvmsg() failed: %s", strerror(errno));
return -1;
}
+ cmsg = CMSG_FIRSTHDR(&smsg);
+
+ if (!cmsg || cmsg->cmsg_type != SCM_CREDENTIALS) {
+ avahi_log_warn("No sender credentials received, ignoring data.");
+ return -1;
+ }
+
+ cred = (struct ucred*) CMSG_DATA(cmsg);
+
+ if (cred->uid != 0)
+ return -1;
+
p = (struct nlmsghdr *) nl->buffer;
assert(nl->callback);
@@ -88,6 +115,7 @@ static void socket_event(AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent
AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void (*cb) (AvahiNetlink *nl, struct nlmsghdr *n, void* userdata), void* userdata) {
int fd = -1;
+ const int on = 1;
struct sockaddr_nl addr;
AvahiNetlink *nl = NULL;
@@ -109,6 +137,11 @@ AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void
goto fail;
}
+ if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
+ avahi_log_error(__FILE__": SO_PASSCRED: %s", strerror(errno));
+ goto fail;
+ }
+
if (!(nl = avahi_new(AvahiNetlink, 1))) {
avahi_log_error(__FILE__": avahi_new() failed.");
goto fail;
diff --git a/avahi-core/probe-sched.c b/avahi-core/probe-sched.c
index f430bce..106bb81 100644
--- a/avahi-core/probe-sched.c
+++ b/avahi-core/probe-sched.c
@@ -250,10 +250,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
avahi_record_get_estimate_size(pj->record) +
AVAHI_DNS_PACKET_HEADER_SIZE;
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(p = avahi_dns_packet_new_query(size)))
+ if (!(p = avahi_dns_packet_new_query(size + AVAHI_DNS_PACKET_EXTRA_SIZE)))
return; /* OOM */
if (!(k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY))) {
diff --git a/avahi-core/response-sched.c b/avahi-core/response-sched.c
index ef10eca..b194ef3 100644
--- a/avahi-core/response-sched.c
+++ b/avahi-core/response-sched.c
@@ -247,10 +247,7 @@ static void send_response_packet(AvahiResponseScheduler *s, AvahiResponseJob *rj
/* OK, the packet was too small, so create one that fits */
size = avahi_record_get_estimate_size(rj->record) + AVAHI_DNS_PACKET_HEADER_SIZE;
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(p = avahi_dns_packet_new_response(size, 1)))
+ if (!(p = avahi_dns_packet_new_response(size + AVAHI_DNS_PACKET_EXTRA_SIZE, 1)))
return; /* OOM */
if (!packet_add_response_job(s, p, rj)) {
diff --git a/avahi-core/server.c b/avahi-core/server.c
index 9d4026d..61f488f 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -370,7 +370,7 @@ void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsP
AvahiDnsPacket *reply;
AvahiRecord *r;
- if (!(reply = avahi_dns_packet_new_reply(p, 512 /* unicast DNS maximum packet size is 512 */ , 1, 1)))
+ if (!(reply = avahi_dns_packet_new_reply(p, 512 + AVAHI_DNS_PACKET_EXTRA_SIZE /* unicast DNS maximum packet size is 512 */ , 1, 1)))
return; /* OOM */
while ((r = avahi_record_list_next(s->record_list, NULL, NULL, NULL))) {
@@ -438,7 +438,6 @@ void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsP
* the specific header field, and return to the caller */
avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
-
break;
}
@@ -449,21 +448,32 @@ void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsP
avahi_dns_packet_free(reply);
size = avahi_record_get_estimate_size(r) + AVAHI_DNS_PACKET_HEADER_SIZE;
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
- if (!(reply = avahi_dns_packet_new_reply(p, size, 0, 1)))
+ if (!(reply = avahi_dns_packet_new_reply(p, size + AVAHI_DNS_PACKET_EXTRA_SIZE, 0, 1)))
break; /* OOM */
- if (!avahi_dns_packet_append_record(reply, r, flush_cache, 0)) {
+ if (avahi_dns_packet_append_record(reply, r, flush_cache, 0)) {
+
+ /* Appending this record succeeded, so incremeant
+ * the specific header field, and return to the caller */
+
+ avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
+ break;
+
+ } else {
+
+ /* We completely fucked up, there's
+ * nothing we can do. The RR just doesn't
+ * fit in. Let's ignore it. */
+
char *t;
avahi_dns_packet_free(reply);
+ reply = NULL;
t = avahi_record_to_string(r);
avahi_log_warn("Record [%s] too large, doesn't fit in any packet!", t);
avahi_free(t);
break;
- } else
- avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
+ }
}
/* Appending the record didn't succeeed, so let's send this packet, and create a new one */
@@ -803,7 +813,7 @@ static void reflect_legacy_unicast_query_packet(AvahiServer *s, AvahiDnsPacket *
avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->id);
for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (avahi_interface_is_relevant(j) &&
+ if (j->announcing &&
j != i &&
(s->config.reflect_ipv || j->protocol == i->protocol)) {
@@ -884,7 +894,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
assert(src_address->proto == dst_address->proto);
if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, src_address->proto)) ||
- !avahi_interface_is_relevant(i)) {
+ !i->announcing) {
avahi_log_warn("Recieved packet from invalid interface.");
return;
}
@@ -977,7 +987,7 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p) {
}
if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.proto)) ||
- !avahi_interface_is_relevant(j))
+ !j->announcing)
return;
/* Patch the original ID into this response */
@@ -1226,17 +1236,27 @@ static void update_fqdn(AvahiServer *s) {
}
int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
+ char *hn = NULL;
assert(s);
- assert(host_name);
+
+ AVAHI_CHECK_VALIDITY(s, !host_name || avahi_is_valid_host_name(host_name), AVAHI_ERR_INVALID_HOST_NAME);
- if (host_name && !avahi_is_valid_host_name(host_name))
- return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
+ if (!host_name) {
+ hn = avahi_get_host_name_strdup();
+ hn[strcspn(hn, ".")] = 0;
+ host_name = hn;
+ }
+ if (avahi_domain_equal(s->host_name, host_name) && s->state != AVAHI_SERVER_COLLISION) {
+ avahi_free(hn);
+ return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
+ }
+
withdraw_host_rrs(s);
avahi_free(s->host_name);
- s->host_name = host_name ? avahi_normalize_name_strdup(host_name) : avahi_get_host_name_strdup();
- s->host_name[strcspn(s->host_name, ".")] = 0;
+ s->host_name = hn ? hn : avahi_strdup(host_name);
+
update_fqdn(s);
register_stuff(s);
@@ -1244,19 +1264,30 @@ int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
}
int avahi_server_set_domain_name(AvahiServer *s, const char *domain_name) {
+ char *dn = NULL;
assert(s);
- assert(domain_name);
- if (domain_name && !avahi_is_valid_domain_name(domain_name))
- return avahi_server_set_errno(s, AVAHI_ERR_INVALID_DOMAIN_NAME);
+ AVAHI_CHECK_VALIDITY(s, !domain_name || avahi_is_valid_domain_name(domain_name), AVAHI_ERR_INVALID_DOMAIN_NAME);
+
+ if (!domain_name) {
+ dn = avahi_strdup("local");
+ domain_name = dn;
+ }
+
+ if (avahi_domain_equal(s->domain_name, domain_name)) {
+ avahi_free(dn);
+ return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
+ }
withdraw_host_rrs(s);
avahi_free(s->domain_name);
- s->domain_name = domain_name ? avahi_normalize_name_strdup(domain_name) : avahi_strdup("local");
+ s->domain_name = avahi_normalize_name_strdup(domain_name);
update_fqdn(s);
register_stuff(s);
+
+ avahi_free(dn);
return AVAHI_OK;
}
@@ -1539,6 +1570,8 @@ AvahiServerConfig* avahi_server_config_init(AvahiServerConfig *c) {
c->browse_domains = NULL;
c->disable_publishing = 0;
c->allow_point_to_point = 0;
+ c->publish_aaaa_on_ipv4 = 1;
+ c->publish_a_on_ipv6 = 0;
return c;
}
@@ -1700,3 +1733,9 @@ int avahi_server_set_wide_area_servers(AvahiServer *s, const AvahiAddress *a, un
avahi_wide_area_set_servers(s->wide_area_lookup_engine, a, n);
return AVAHI_OK;
}
+
+const AvahiServerConfig* avahi_server_get_config(AvahiServer *s) {
+ assert(s);
+
+ return &s->config;
+}
diff --git a/avahi-core/socket.c b/avahi-core/socket.c
index 90e1d74..61b5eb4 100644
--- a/avahi-core/socket.c
+++ b/avahi-core/socket.c
@@ -475,10 +475,10 @@ int avahi_send_dns_packet_ipv4(
struct iovec io;
#ifdef IP_PKTINFO
struct cmsghdr *cmsg;
- uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in_pktinfo))];
+ size_t cmsg_data[( CMSG_SPACE(sizeof(struct in_pktinfo)) / sizeof(size_t)) + 1];
#elif defined(IP_SENDSRCADDR)
struct cmsghdr *cmsg;
- uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in_addr))];
+ size_t cmsg_data[( CMSG_SPACE(sizeof(struct in_addr)) / sizeof(size_t)) + 1];
#endif
assert(fd >= 0);
@@ -560,12 +560,19 @@ int avahi_send_dns_packet_ipv4(
return sendmsg_loop(fd, &msg, 0);
}
-int avahi_send_dns_packet_ipv6(int fd, AvahiIfIndex interface, AvahiDnsPacket *p, const AvahiIPv6Address *src_address, const AvahiIPv6Address *dst_address, uint16_t dst_port) {
+int avahi_send_dns_packet_ipv6(
+ int fd,
+ AvahiIfIndex interface,
+ AvahiDnsPacket *p,
+ const AvahiIPv6Address *src_address,
+ const AvahiIPv6Address *dst_address,
+ uint16_t dst_port) {
+
struct sockaddr_in6 sa;
struct msghdr msg;
struct iovec io;
struct cmsghdr *cmsg;
- uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in6_pktinfo))];
+ size_t cmsg_data[(CMSG_SPACE(sizeof(struct in6_pktinfo))/sizeof(size_t)) + 1];
assert(fd >= 0);
assert(p);
@@ -617,7 +624,14 @@ int avahi_send_dns_packet_ipv6(int fd, AvahiIfIndex interface, AvahiDnsPacket *p
return sendmsg_loop(fd, &msg, 0);
}
-AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv4Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl) {
+AvahiDnsPacket *avahi_recv_dns_packet_ipv4(
+ int fd,
+ AvahiIPv4Address *ret_src_address,
+ uint16_t *ret_src_port,
+ AvahiIPv4Address *ret_dst_address,
+ AvahiIfIndex *ret_iface,
+ uint8_t *ret_ttl) {
+
AvahiDnsPacket *p= NULL;
struct msghdr msg;
struct iovec io;
@@ -635,6 +649,11 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_add
goto fail;
}
+ if (ms < 0) {
+ avahi_log_warn("FIONREAD returned negative value.");
+ goto fail;
+ }
+
p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
io.iov_base = AVAHI_DNS_PACKET_DATA(p);
@@ -650,7 +669,14 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_add
msg.msg_flags = 0;
if ((l = recvmsg(fd, &msg, 0)) < 0) {
- avahi_log_warn("recvmsg(): %s", strerror(errno));
+ /* Linux returns EAGAIN when an invalid IP packet has been
+ recieved. We suppress warnings in this case because this might
+ create quite a bit of log traffic on machines with unstable
+ links. (See #60) */
+
+ if (errno != EAGAIN)
+ avahi_log_warn("recvmsg(): %s", strerror(errno));
+
goto fail;
}
@@ -714,7 +740,11 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_add
struct sockaddr_dl *sdl = (struct sockaddr_dl *) CMSG_DATA (cmsg);
if (ret_iface)
+#ifdef __sun
+ *ret_iface = *(uint_t*) sdl;
+#else
*ret_iface = (int) sdl->sdl_index;
+#endif
break;
}
@@ -747,7 +777,14 @@ fail:
return NULL;
}
-AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv6Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl) {
+AvahiDnsPacket *avahi_recv_dns_packet_ipv6(
+ int fd,
+ AvahiIPv6Address *ret_src_address,
+ uint16_t *ret_src_port,
+ AvahiIPv6Address *ret_dst_address,
+ AvahiIfIndex *ret_iface,
+ uint8_t *ret_ttl) {
+
AvahiDnsPacket *p = NULL;
struct msghdr msg;
struct iovec io;
@@ -764,6 +801,11 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_add
avahi_log_warn("ioctl(): %s", strerror(errno));
goto fail;
}
+
+ if (ms < 0) {
+ avahi_log_warn("FIONREAD returned negative value.");
+ goto fail;
+ }
p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
@@ -781,7 +823,14 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_add
msg.msg_flags = 0;
if ((l = recvmsg(fd, &msg, 0)) < 0) {
- avahi_log_warn("recvmsg(): %s", strerror(errno));
+ /* Linux returns EAGAIN when an invalid IP packet has been
+ recieved. We suppress warnings in this case because this might
+ create quite a bit of log traffic on machines with unstable
+ links. (See #60) */
+
+ if (errno != EAGAIN)
+ avahi_log_warn("recvmsg(): %s", strerror(errno));
+
goto fail;
}
@@ -836,7 +885,7 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_add
assert(found_iface);
assert(found_ttl);
-
+
return p;
fail:
@@ -888,13 +937,19 @@ fail:
int avahi_open_unicast_socket_ipv6(void) {
struct sockaddr_in6 local;
- int fd = -1;
+ int fd = -1, yes;
if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
avahi_log_warn("socket() failed: %s", strerror(errno));
goto fail;
}
+ yes = 1;
+ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes)) < 0) {
+ avahi_log_warn("IPV6_V6ONLY failed: %s", strerror(errno));
+ goto fail;
+ }
+
memset(&local, 0, sizeof(local));
local.sin6_family = AF_INET6;
diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c
index 4072f83..bf3f60d 100644
--- a/avahi-core/wide-area.c
+++ b/avahi-core/wide-area.c
@@ -579,8 +579,8 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
e->cleanup_dead = 0;
/* Create sockets */
- e->fd_ipv4 = avahi_open_unicast_socket_ipv4();
- e->fd_ipv6 = avahi_open_unicast_socket_ipv6();
+ e->fd_ipv4 = s->config.use_ipv4 ? avahi_open_unicast_socket_ipv4() : -1;
+ e->fd_ipv6 = s->config.use_ipv6 ? avahi_open_unicast_socket_ipv6() : -1;
if (e->fd_ipv4 < 0 && e->fd_ipv6 < 0) {
avahi_log_error(__FILE__": Failed to create wide area sockets: %s", strerror(errno));
diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am
index 15cbb57..2bb2325 100644
--- a/avahi-daemon/Makefile.am
+++ b/avahi-daemon/Makefile.am
@@ -53,7 +53,8 @@ avahi_daemon_SOURCES = \
static-hosts.c static-hosts.h \
ini-file-parser.c ini-file-parser.h \
setproctitle.c setproctitle.h \
- ../avahi-client/check-nss.c
+ ../avahi-client/check-nss.c \
+ inotify-nosys.h
avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) -lexpat
@@ -70,7 +71,8 @@ pkgsysconf_DATA = \
hosts
service_DATA = \
- ssh.service
+ ssh.service \
+ sftp-ssh.service
pkgdata_DATA = \
avahi-service.dtd
@@ -114,7 +116,7 @@ avahi_daemon_SOURCES += \
avahi_daemon_LDADD += \
$(DBUS_LIBS)
-avahi_daemon_CFLAGS += $(DBUS_CFLAGS)
+avahi_daemon_CFLAGS += $(DBUS_CFLAGS) -DDBUS_SYSTEM_BUS_DEFAULT_ADDRESS=\"$(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)\"
dbusservice_DATA = avahi-dbus.conf
@@ -148,6 +150,7 @@ EXTRA_DIST = \
HostNameResolver.introspect \
RecordBrowser.introspect \
ssh.service \
+ sftp-ssh.service \
hosts \
example.service \
introspect.dtd \
diff --git a/avahi-daemon/Server.introspect b/avahi-daemon/Server.introspect
index 6635618..9d743ba 100644
--- a/avahi-daemon/Server.introspect
+++ b/avahi-daemon/Server.introspect
@@ -44,6 +44,9 @@
<method name="GetHostName">
<arg name="name" type="s" direction="out"/>
</method>
+ <method name="SetHostName">
+ <arg name="name" type="s" direction="in"/>
+ </method>
<method name="GetHostNameFqdn">
<arg name="name" type="s" direction="out"/>
</method>
diff --git a/avahi-daemon/avahi-daemon.conf b/avahi-daemon/avahi-daemon.conf
index 1992a67..21fa166 100644
--- a/avahi-daemon/avahi-daemon.conf
+++ b/avahi-daemon/avahi-daemon.conf
@@ -45,6 +45,8 @@ enable-wide-area=yes
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
+#publish-aaaa-on-ipv4=yes
+#publish-a-on-ipv6=no
[reflector]
#enable-reflector=no
diff --git a/avahi-daemon/avahi-dbus.conf.in b/avahi-daemon/avahi-dbus.conf.in
index 416c8dc..e439e07 100644
--- a/avahi-daemon/avahi-dbus.conf.in
+++ b/avahi-daemon/avahi-dbus.conf.in
@@ -11,15 +11,17 @@
<allow own="org.freedesktop.Avahi"/>
</policy>
- <!-- Allow anyone to invoke methods on the Manager and Device interfaces -->
+ <!-- Allow anyone to invoke methods on Avahi server, except SetHostName -->
<policy context="default">
- <allow send_interface="org.freedesktop.Avahi"/>
+ <allow send_destination="org.freedesktop.Avahi"/>
+ <allow receive_sender="org.freedesktop.Avahi"/>
- <allow receive_interface="org.freedesktop.Avahi"
- receive_sender="org.freedesktop.Avahi"/>
+ <deny send_interface="org.freedesktop.Avahi.Server" send_member="SetHostName"/>
</policy>
- <limit name="max_match_rules_per_connection">512</limit>
- <limit name="max_connections_per_user">20</limit>
-
+ <!-- Allow everything, including access to SetHostName to users of the group "@AVAHI_PRIV_ACCESS_GROUP@" -->
+ <policy group="@AVAHI_PRIV_ACCESS_GROUP@">
+ <allow send_destination="org.freedesktop.Avahi"/>
+ <allow receive_sender="org.freedesktop.Avahi"/>
+ </policy>
</busconfig>
diff --git a/avahi-daemon/chroot.c b/avahi-daemon/chroot.c
index 5ca605d..20e2f03 100644
--- a/avahi-daemon/chroot.c
+++ b/avahi-daemon/chroot.c
@@ -314,7 +314,9 @@ int avahi_chroot_helper_start(const char *argv0) {
/* Drop all remaining capabilities */
avahi_caps_drop_all();
- avahi_set_proc_title("%s: chroot helper process", argv0);
+ avahi_set_proc_title(argv0, "%s: chroot helper", argv0);
+
+ daemon_retval_done();
close(sock[0]);
helper_main(sock[1]);
diff --git a/avahi-daemon/dbus-async-address-resolver.c b/avahi-daemon/dbus-async-address-resolver.c
index f51d205..f05af8f 100644
--- a/avahi-daemon/dbus-async-address-resolver.c
+++ b/avahi-daemon/dbus-async-address-resolver.c
@@ -38,7 +38,12 @@ void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i) {
if (i->address_resolver)
avahi_s_address_resolver_free(i->address_resolver);
- dbus_connection_unregister_object_path(server->bus, i->path);
+
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
+
AVAHI_LLIST_REMOVE(AsyncAddressResolverInfo, async_address_resolvers, i->client->async_address_resolvers, i);
i->client->n_objects--;
diff --git a/avahi-daemon/dbus-async-host-name-resolver.c b/avahi-daemon/dbus-async-host-name-resolver.c
index 38b5c2a..a2c99a7 100644
--- a/avahi-daemon/dbus-async-host-name-resolver.c
+++ b/avahi-daemon/dbus-async-host-name-resolver.c
@@ -38,7 +38,11 @@ void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i) {
if (i->host_name_resolver)
avahi_s_host_name_resolver_free(i->host_name_resolver);
- dbus_connection_unregister_object_path(server->bus, i->path);
+
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
AVAHI_LLIST_REMOVE(AsyncHostNameResolverInfo, async_host_name_resolvers, i->client->async_host_name_resolvers, i);
i->client->n_objects--;
diff --git a/avahi-daemon/dbus-async-service-resolver.c b/avahi-daemon/dbus-async-service-resolver.c
index 9fea5a1..a9a1364 100644
--- a/avahi-daemon/dbus-async-service-resolver.c
+++ b/avahi-daemon/dbus-async-service-resolver.c
@@ -39,7 +39,11 @@ void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i) {
if (i->service_resolver)
avahi_s_service_resolver_free(i->service_resolver);
- dbus_connection_unregister_object_path(server->bus, i->path);
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
+
AVAHI_LLIST_REMOVE(AsyncServiceResolverInfo, async_service_resolvers, i->client->async_service_resolvers, i);
i->client->n_objects--;
diff --git a/avahi-daemon/dbus-domain-browser.c b/avahi-daemon/dbus-domain-browser.c
index a17de8f..b529ede 100644
--- a/avahi-daemon/dbus-domain-browser.c
+++ b/avahi-daemon/dbus-domain-browser.c
@@ -38,8 +38,12 @@ void avahi_dbus_domain_browser_free(DomainBrowserInfo *i) {
if (i->domain_browser)
avahi_s_domain_browser_free(i->domain_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
+
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
+
AVAHI_LLIST_REMOVE(DomainBrowserInfo, domain_browsers, i->client->domain_browsers, i);
i->client->n_objects--;
diff --git a/avahi-daemon/dbus-entry-group.c b/avahi-daemon/dbus-entry-group.c
index 1d8c957..0e1a21c 100644
--- a/avahi-daemon/dbus-entry-group.c
+++ b/avahi-daemon/dbus-entry-group.c
@@ -40,8 +40,11 @@ void avahi_dbus_entry_group_free(EntryGroupInfo *i) {
if (i->entry_group)
avahi_s_entry_group_free(i->entry_group);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
+
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
AVAHI_LLIST_REMOVE(EntryGroupInfo, entry_groups, i->client->entry_groups, i);
i->client->n_objects--;
diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c
index 5b9bc50..9bfc151 100644
--- a/avahi-daemon/dbus-protocol.c
+++ b/avahi-daemon/dbus-protocol.c
@@ -43,7 +43,6 @@
#include <avahi-common/dbus.h>
#include <avahi-common/llist.h>
#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
#include <avahi-common/dbus-watch-glue.h>
#include <avahi-common/alternative.h>
#include <avahi-common/error.h>
@@ -190,7 +189,7 @@ static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection
struct timeval tv;
if (server->reconnect) {
- avahi_log_warn("Disconnnected from D-BUS, trying to reconnect in %ims...", RECONNECT_MSEC);
+ avahi_log_warn("Disconnnected from D-Bus, trying to reconnect in %ims...", RECONNECT_MSEC);
dbus_disconnect();
@@ -201,7 +200,7 @@ static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection
else
server->reconnect_timeout = server->poll_api->timeout_new(server->poll_api, &tv, reconnect_callback, NULL);
} else {
- avahi_log_warn("Disconnnected from D-BUS, exiting.");
+ avahi_log_warn("Disconnnected from D-Bus, exiting.");
raise(SIGQUIT);
}
@@ -265,6 +264,22 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_string(c, m, avahi_server_get_host_name(avahi_server));
+ } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "SetHostName")) {
+
+ char *name;
+
+ if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
+ avahi_log_warn("Error parsing Server::SetHostName message");
+ goto fail;
+ }
+
+ if (avahi_server_set_host_name(avahi_server, name) < 0)
+ return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
+
+ avahi_log_info("Changing host name to '%s'.", name);
+
+ return avahi_dbus_respond_ok(c, m);
+
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetDomainName")) {
if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
@@ -331,9 +346,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetNetworkInterfaceNameByIndex")) {
int32_t idx;
- int fd;
char name[IF_NAMESIZE];
-
if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INT32, &idx, DBUS_TYPE_INVALID))) {
avahi_log_warn("Error parsing Server::GetNetworkInterfaceNameByIndex message");
@@ -343,29 +356,17 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
#ifdef VALGRIND_WORKAROUND
return respond_string(c, m, "blah");
#else
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
if ((!if_indextoname(idx, name))) {
char txt[256];
snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- close(fd);
return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
}
-
- close(fd);
return avahi_dbus_respond_string(c, m, name);
#endif
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetNetworkInterfaceIndexByName")) {
char *n;
- int fd;
int32_t idx;
if (!(dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID)) || !n) {
@@ -376,21 +377,11 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
#ifdef VALGRIND_WORKAROUND
return respond_int32(c, m, 1);
#else
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
if (!(idx = if_nametoindex(n))) {
char txt[256];
snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- close(fd);
return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
}
-
- close(fd);
return avahi_dbus_respond_int32(c, m, idx);
#endif
@@ -456,7 +447,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(EntryGroupInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
+ i->path = NULL;
i->n_entries = 0;
AVAHI_LLIST_PREPEND(EntryGroupInfo, entry_groups, client->entry_groups, i);
client->n_objects++;
@@ -466,6 +457,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
}
+ i->path = avahi_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -599,7 +591,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(DomainBrowserInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
+ i->path = NULL;
AVAHI_LLIST_PREPEND(DomainBrowserInfo, domain_browsers, client->domain_browsers, i);
client->n_objects++;
@@ -607,7 +599,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_dbus_domain_browser_free(i);
return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
}
-
+
+ i->path = avahi_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -653,7 +646,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(ServiceTypeBrowserInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
+ i->path = NULL;
AVAHI_LLIST_PREPEND(ServiceTypeBrowserInfo, service_type_browsers, client->service_type_browsers, i);
client->n_objects++;
@@ -662,6 +655,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
}
+ i->path = avahi_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -708,7 +702,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(ServiceBrowserInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
+ i->path = NULL;
AVAHI_LLIST_PREPEND(ServiceBrowserInfo, service_browsers, client->service_browsers, i);
client->n_objects++;
@@ -716,7 +710,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_dbus_service_browser_free(i);
return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
}
-
+
+ i->path = avahi_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -818,7 +813,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(AsyncServiceResolverInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/ServiceResolver%u", client->id, i->id);
+ i->path = NULL;
AVAHI_LLIST_PREPEND(AsyncServiceResolverInfo, async_service_resolvers, client->async_service_resolvers, i);
client->n_objects++;
@@ -829,6 +824,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
/* avahi_log_debug(__FILE__": [%s], new service resolver for <%s.%s.%s>", i->path, name, type, domain); */
+ i->path = avahi_strdup_printf("/Client%u/ServiceResolver%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -872,7 +868,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(AsyncHostNameResolverInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/HostNameResolver%u", client->id, i->id);
+ i->path = NULL;
AVAHI_LLIST_PREPEND(AsyncHostNameResolverInfo, async_host_name_resolvers, client->async_host_name_resolvers, i);
client->n_objects++;
@@ -880,7 +876,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_dbus_async_host_name_resolver_free(i);
return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
}
-
+
+ i->path = avahi_strdup_printf("/Client%u/HostNameResolver%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -927,7 +924,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(AsyncAddressResolverInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/AddressResolver%u", client->id, i->id);
+ i->path = NULL;
AVAHI_LLIST_PREPEND(AsyncAddressResolverInfo, async_address_resolvers, client->async_address_resolvers, i);
client->n_objects++;
@@ -935,7 +932,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_dbus_async_address_resolver_free(i);
return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
}
-
+
+ i->path = avahi_strdup_printf("/Client%u/AddressResolver%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -985,7 +983,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
i = avahi_new(RecordBrowserInfo, 1);
i->id = ++client->current_id;
i->client = client;
- i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);
+ i->path = NULL;
AVAHI_LLIST_PREPEND(RecordBrowserInfo, record_browsers, client->record_browsers, i);
client->n_objects++;
@@ -1000,6 +998,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_key_unref(key);
+ i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
}
@@ -1052,12 +1051,34 @@ static int dbus_connect(void) {
assert(!server->bus);
dbus_error_init(&error);
-
- if (!(server->bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) {
+
+#ifdef HAVE_DBUS_BUS_GET_PRIVATE
+ if (!(server->bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error))) {
assert(dbus_error_is_set(&error));
- avahi_log_error("dbus_bus_get(): %s", error.message);
+ avahi_log_error("dbus_bus_get_private(): %s", error.message);
goto fail;
}
+#else
+ {
+ const char *a;
+
+ if (!(a = getenv("DBUS_SYSTEM_BUS_ADDRESS")) || !*a)
+ a = DBUS_SYSTEM_BUS_DEFAULT_ADDRESS;
+
+ if (!(server->bus = dbus_connection_open_private(a, &error))) {
+ assert(dbus_error_is_set(&error));
+ avahi_log_error("dbus_bus_open_private(): %s", error.message);
+ goto fail;
+ }
+
+ if (!dbus_bus_register(server->bus, &error)) {
+ assert(dbus_error_is_set(&error));
+ avahi_log_error("dbus_bus_register(): %s", error.message);
+ goto fail;
+ }
+ }
+#endif
+
if (avahi_dbus_connection_glue(server->bus, server->poll_api) < 0) {
avahi_log_error("avahi_dbus_connection_glue() failed");
goto fail;
@@ -1068,10 +1089,10 @@ static int dbus_connect(void) {
if (dbus_bus_request_name(
server->bus,
AVAHI_DBUS_NAME,
-#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 60)
- DBUS_NAME_FLAG_DO_NOT_QUEUE,
-#else
+#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR < 60)
DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT,
+#else
+ DBUS_NAME_FLAG_DO_NOT_QUEUE,
#endif
&error) != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
if (dbus_error_is_set(&error)) {
@@ -1079,7 +1100,7 @@ static int dbus_connect(void) {
goto fail;
}
- avahi_log_error("Failed to acquire DBUS name '"AVAHI_DBUS_NAME"'");
+ avahi_log_error("Failed to acquire D-Bus name '"AVAHI_DBUS_NAME"'");
goto fail;
}
@@ -1107,7 +1128,11 @@ fail:
dbus_error_free(&error);
if (server->bus) {
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
+ dbus_connection_close(server->bus);
+#else
dbus_connection_disconnect(server->bus);
+#endif
dbus_connection_unref(server->bus);
server->bus = NULL;
}
@@ -1124,7 +1149,11 @@ static void dbus_disconnect(void) {
assert(server->n_clients == 0);
if (server->bus) {
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
+ dbus_connection_close(server->bus);
+#else
dbus_connection_disconnect(server->bus);
+#endif
dbus_connection_unref(server->bus);
server->bus = NULL;
}
@@ -1149,7 +1178,7 @@ int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_pub
if (!force)
goto fail;
- avahi_log_warn("WARNING: Failed to contact D-BUS daemon, retrying in %ims.", RECONNECT_MSEC);
+ avahi_log_warn("WARNING: Failed to contact D-Bus daemon, retrying in %ims.", RECONNECT_MSEC);
avahi_elapse_time(&tv, RECONNECT_MSEC, 0);
server->reconnect_timeout = server->poll_api->timeout_new(server->poll_api, &tv, reconnect_callback, NULL);
@@ -1159,7 +1188,12 @@ int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_pub
fail:
if (server->bus) {
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
+ dbus_connection_close(server->bus);
+#else
dbus_connection_disconnect(server->bus);
+#endif
+
dbus_connection_unref(server->bus);
}
diff --git a/avahi-daemon/dbus-record-browser.c b/avahi-daemon/dbus-record-browser.c
index 0ddd7b8..ea23fe4 100644
--- a/avahi-daemon/dbus-record-browser.c
+++ b/avahi-daemon/dbus-record-browser.c
@@ -38,8 +38,11 @@ void avahi_dbus_record_browser_free(RecordBrowserInfo *i) {
if (i->record_browser)
avahi_s_record_browser_free(i->record_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
+
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
AVAHI_LLIST_REMOVE(RecordBrowserInfo, record_browsers, i->client->record_browsers, i);
i->client->n_objects--;
diff --git a/avahi-daemon/dbus-service-browser.c b/avahi-daemon/dbus-service-browser.c
index 975cce9..1515ddf 100644
--- a/avahi-daemon/dbus-service-browser.c
+++ b/avahi-daemon/dbus-service-browser.c
@@ -38,8 +38,12 @@ void avahi_dbus_service_browser_free(ServiceBrowserInfo *i) {
if (i->service_browser)
avahi_s_service_browser_free(i->service_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
+
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
+
AVAHI_LLIST_REMOVE(ServiceBrowserInfo, service_browsers, i->client->service_browsers, i);
i->client->n_objects--;
@@ -101,10 +105,6 @@ void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex i
assert(b);
assert(i);
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, avahi_dbus_map_browse_signal_name(event));
if (event == AVAHI_BROWSER_NEW) {
@@ -114,6 +114,10 @@ void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex i
flags |= AVAHI_LOOKUP_RESULT_OUR_OWN;
}
+ i_interface = (int32_t) interface;
+ i_protocol = (int32_t) protocol;
+ u_flags = (uint32_t) flags;
+
if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
assert(name);
assert(type);
diff --git a/avahi-daemon/dbus-service-type-browser.c b/avahi-daemon/dbus-service-type-browser.c
index ac2a17c..9207a74 100644
--- a/avahi-daemon/dbus-service-type-browser.c
+++ b/avahi-daemon/dbus-service-type-browser.c
@@ -38,8 +38,12 @@ void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i) {
if (i->service_type_browser)
avahi_s_service_type_browser_free(i->service_type_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
+
+ if (i->path) {
+ dbus_connection_unregister_object_path(server->bus, i->path);
+ avahi_free(i->path);
+ }
+
AVAHI_LLIST_REMOVE(ServiceTypeBrowserInfo, service_type_browsers, i->client->service_type_browsers, i);
i->client->n_objects--;
diff --git a/avahi-daemon/dbus-util.c b/avahi-daemon/dbus-util.c
index c9ef949..d1a7a20 100644
--- a/avahi-daemon/dbus-util.c
+++ b/avahi-daemon/dbus-util.c
@@ -341,12 +341,9 @@ int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) {
dbus_message_iter_recurse(&sub, &sub2);
- if (dbus_message_iter_get_array_len(&sub2) > 0)
- dbus_message_iter_get_fixed_array(&sub2, &k, &n);
- else {
- k = (const uint8_t*) "";
- n = 0;
- }
+ k = (const uint8_t*) "";
+ n = 0;
+ dbus_message_iter_get_fixed_array(&sub2, &k, &n);
strlst = avahi_string_list_add_arbitrary(strlst, k, n);
diff --git a/avahi-daemon/inotify-nosys.h b/avahi-daemon/inotify-nosys.h
new file mode 100644
index 0000000..6af44dc
--- /dev/null
+++ b/avahi-daemon/inotify-nosys.h
@@ -0,0 +1,181 @@
+/*
+ * This header is used if <sys/inotify.h> cannot be found.
+ *
+ * Inode based directory notification for Linux
+ *
+ * Copyright (C) 2005 John McCutchan
+ */
+
+#ifndef _LINUX_INOTIFY_H
+#define _LINUX_INOTIFY_H
+
+#include <stdint.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <asm/unistd.h>
+
+/*
+ * struct inotify_event - structure read from the inotify device for each event
+ *
+ * When you are watching a directory, you will receive the filename for events
+ * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
+ */
+struct inotify_event {
+ int wd; /* watch descriptor */
+ uint32_t mask; /* watch mask */
+ uint32_t cookie; /* cookie to synchronize two events */
+ uint32_t len; /* length (including nulls) of name */
+ char name __flexarr; /* stub for possible name */
+};
+
+/* the following are legal, implemented events that user-space can watch for */
+#define IN_ACCESS 0x00000001 /* File was accessed */
+#define IN_MODIFY 0x00000002 /* File was modified */
+#define IN_ATTRIB 0x00000004 /* Metadata changed */
+#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */
+#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
+#define IN_OPEN 0x00000020 /* File was opened */
+#define IN_MOVED_FROM 0x00000040 /* File was moved from X */
+#define IN_MOVED_TO 0x00000080 /* File was moved to Y */
+#define IN_CREATE 0x00000100 /* Subfile was created */
+#define IN_DELETE 0x00000200 /* Subfile was deleted */
+#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
+#define IN_MOVE_SELF 0x00000800 /* Self was moved */
+
+/* the following are legal events. they are sent as needed to any watch */
+#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
+#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
+#define IN_IGNORED 0x00008000 /* File was ignored */
+
+/* helper events */
+#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
+#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
+
+/* special flags */
+#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
+#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
+#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
+#define IN_ISDIR 0x40000000 /* event occurred against dir */
+#define IN_ONESHOT 0x80000000 /* only send event once */
+
+/*
+ * All of the events - we build the list by hand so that we can add flags in
+ * the future and not break backward compatibility. Apps will get only the
+ * events that they originally wanted. Be sure to add new events here!
+ */
+#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
+ IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
+ IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
+ IN_MOVE_SELF)
+
+#if 0
+#if defined (__alpha__)
+# define __NR_inotify_init 444
+# define __NR_inotify_add_watch 445
+# define __NR_inotify_rm_watch 446
+
+#elif defined (__arm__)
+# define __NR_inotify_init (__NR_SYSCALL_BASE+316)
+# define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
+# define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
+
+#elif defined (__frv__)
+# define __NR_inotify_init 291
+# define __NR_inotify_add_watch 292
+# define __NR_inotify_rm_watch 293
+
+#elif defined(__i386__)
+# define __NR_inotify_init 291
+# define __NR_inotify_add_watch 292
+# define __NR_inotify_rm_watch 293
+
+#elif defined (__ia64__)
+# define __NR_inotify_init 1277
+# define __NR_inotify_add_watch 1278
+# define __NR_inotify_rm_watch 1279
+
+#elif defined (__mips__)
+# if _MIPS_SIM == _MIPS_SIM_ABI32
+# define __NR_inotify_init (__NR_Linux + 284)
+# define __NR_inotify_add_watch (__NR_Linux + 285)
+# define __NR_inotify_rm_watch (__NR_Linux + 286)
+# endif
+# if _MIPS_SIM == _MIPS_SIM_ABI64
+# define __NR_inotify_init (__NR_Linux + 243)
+# define __NR_inotify_add_watch (__NR_Linux + 243)
+# define __NR_inotify_rm_watch (__NR_Linux + 243)
+# endif
+# if _MIPS_SIM == _MIPS_SIM_NABI32
+# define __NR_inotify_init (__NR_Linux + 247)
+# define __NR_inotify_add_watch (__NR_Linux + 248)
+# define __NR_inotify_rm_watch (__NR_Linux + 249)
+# endif
+
+#elif defined(__parisc__)
+# define __NR_inotify_init (__NR_Linux + 269)
+# define __NR_inotify_add_watch (__NR_Linux + 270)
+# define __NR_inotify_rm_watch (__NR_Linux + 271)
+
+#elif defined(__powerpc__) || defined(__powerpc64__)
+# define __NR_inotify_init 275
+# define __NR_inotify_add_watch 276
+# define __NR_inotify_rm_watch 277
+
+#elif defined (__s390__)
+# define __NR_inotify_init 284
+# define __NR_inotify_add_watch 285
+# define __NR_inotify_rm_watch 286
+
+#elif defined (__sh__)
+# define __NR_inotify_init 290
+# define __NR_inotify_add_watch 291
+# define __NR_inotify_rm_watch 292
+
+#elif defined (__sh64__)
+# define __NR_inotify_init 318
+# define __NR_inotify_add_watch 319
+# define __NR_inotify_rm_watch 320
+
+#elif defined (__sparc__) || defined (__sparc64__)
+# define __NR_inotify_init 151
+# define __NR_inotify_add_watch 152
+# define __NR_inotify_rm_watch 156
+
+#elif defined(__x86_64__)
+# define __NR_inotify_init 253
+# define __NR_inotify_add_watch 254
+# define __NR_inotify_rm_watch 255
+
+#else
+# error "Unsupported architecture!"
+#endif
+#endif
+
+#ifndef __NR_inotify_init
+# error "Unsupported architecture!"
+#endif
+#ifndef __NR_inotify_add_watch
+# error "Unsupported architecture!"
+#endif
+#ifndef __NR_inotify_rm_watch
+# error "Unsupported architecture!"
+#endif
+
+
+static inline int inotify_init (void)
+{
+ return syscall (__NR_inotify_init);
+}
+
+static inline int inotify_add_watch (int fd, const char *name, uint32_t mask)
+{
+ return syscall (__NR_inotify_add_watch, fd, name, mask);
+}
+
+static inline int inotify_rm_watch (int fd, uint32_t wd)
+{
+ return syscall (__NR_inotify_rm_watch, fd, wd);
+}
+
+
+#endif /* _LINUX_INOTIFY_H */
diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c
index 82a1679..0367b98 100644
--- a/avahi-daemon/main.c
+++ b/avahi-daemon/main.c
@@ -33,6 +33,7 @@
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
@@ -41,6 +42,12 @@
#include <sys/resource.h>
#include <sys/socket.h>
+#ifdef HAVE_SYS_INOTIFY_H
+#include <sys/inotify.h>
+#else
+#include "inotify-nosys.h"
+#endif
+
#include <libdaemon/dfork.h>
#include <libdaemon/dsignal.h>
#include <libdaemon/dlog.h>
@@ -267,7 +274,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void *userda
case AVAHI_SERVER_RUNNING:
avahi_log_info("Server startup complete. Host name is %s. Local service cookie is %u.", avahi_server_get_host_name_fqdn(s), avahi_server_get_local_service_cookie(s));
- avahi_set_proc_title("%s: running [%s]", argv0, avahi_server_get_host_name_fqdn(s));
+ avahi_set_proc_title(argv0, "%s: running [%s]", argv0, avahi_server_get_host_name_fqdn(s));
static_service_add_to_server();
static_hosts_add_to_server();
@@ -286,18 +293,17 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void *userda
case AVAHI_SERVER_COLLISION: {
char *n;
+ avahi_set_proc_title(argv0, "%s: collision", argv0);
+
static_service_remove_from_server();
static_hosts_remove_from_server();
-
remove_dns_server_entry_groups();
-
+
n = avahi_alternative_host_name(avahi_server_get_host_name(s));
avahi_log_warn("Host name conflict, retrying with <%s>", n);
avahi_server_set_host_name(s, n);
avahi_free(n);
- avahi_set_proc_title("%s: collision", argv0);
-
break;
}
@@ -308,8 +314,14 @@ static void server_callback(AvahiServer *s, AvahiServerState state, void *userda
break;
case AVAHI_SERVER_REGISTERING:
- avahi_set_proc_title("%s: registering [%s]", argv0, avahi_server_get_host_name_fqdn(s));
+ avahi_set_proc_title(argv0, "%s: registering [%s]", argv0, avahi_server_get_host_name_fqdn(s));
+
+ static_service_remove_from_server();
+ static_hosts_remove_from_server();
+ remove_dns_server_entry_groups();
+
+ break;
case AVAHI_SERVER_INVALID:
break;
@@ -374,7 +386,6 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
assert(c);
- opterr = 0;
while ((o = getopt_long(argc, argv, "hDkVf:rcs", long_options, NULL)) >= 0) {
switch(o) {
@@ -421,7 +432,6 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
c->debug = 1;
break;
default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
return -1;
}
}
@@ -437,7 +447,7 @@ static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
static int is_yes(const char *s) {
assert(s);
- return *s == 'y' || *s == 'Y';
+ return *s == 'y' || *s == 'Y' || *s == '1' || *s == 't' || *s == 'T';
}
static int load_config_file(DaemonConfig *c) {
@@ -536,8 +546,12 @@ static int load_config_file(DaemonConfig *c) {
c->server_config.add_service_cookie = is_yes(p->value);
else if (strcasecmp(p->key, "publish-dns-servers") == 0) {
avahi_strfreev(c->publish_dns_servers);
- c->publish_dns_servers = avahi_split_csv(p->value);
- } else {
+ c->publish_dns_servers = avahi_split_csv(p->value);
+ } else if (strcasecmp(p->key, "publish-a-on-ipv6") == 0)
+ c->server_config.publish_a_on_ipv6 = is_yes(p->value);
+ else if (strcasecmp(p->key, "publish-aaaa-on-ipv4") == 0)
+ c->server_config.publish_aaaa_on_ipv4 = is_yes(p->value);
+ else {
avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
goto finish;
}
@@ -594,10 +608,12 @@ static int load_config_file(DaemonConfig *c) {
} else if (strcasecmp(p->key, "rlimit-stack") == 0) {
c->rlimit_stack_set = 1;
c->rlimit_stack = atoi(p->value);
-#ifdef RLIMIT_NPROC
} else if (strcasecmp(p->key, "rlimit-nproc") == 0) {
+#ifdef RLIMIT_NPROC
c->rlimit_nproc_set = 1;
c->rlimit_nproc = atoi(p->value);
+#else
+ avahi_log_error("Ignoring configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
#endif
} else {
avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
@@ -645,6 +661,81 @@ static void dump(const char *text, AVAHI_GCC_UNUSED void* userdata) {
avahi_log_info("%s", text);
}
+#ifdef HAVE_INOTIFY
+
+static int inotify_fd = -1;
+
+static void add_inotify_watches(void) {
+ int c = 0;
+ /* We ignore the return values, because one or more of these files
+ * might not exist and we're OK with that. In addition we never
+ * want to remove these watches, hence we keep their ids? */
+
+#ifdef ENABLE_CHROOT
+ c = config.use_chroot;
+#endif
+
+ inotify_add_watch(inotify_fd, c ? "/services" : AVAHI_SERVICE_DIR, IN_CLOSE_WRITE|IN_DELETE|IN_DELETE_SELF|IN_MOVED_FROM|IN_MOVED_TO|IN_MOVE_SELF|IN_ONLYDIR);
+ inotify_add_watch(inotify_fd, c ? "/" : AVAHI_CONFIG_DIR, IN_CLOSE_WRITE|IN_DELETE|IN_DELETE_SELF|IN_MOVED_FROM|IN_MOVED_TO|IN_MOVE_SELF|IN_ONLYDIR);
+}
+
+#endif
+
+static void reload_config(void) {
+
+#ifdef HAVE_INOTIFY
+ /* Refresh in case the config dirs have been removed */
+ add_inotify_watches();
+#endif
+
+#ifdef ENABLE_CHROOT
+ static_service_load(config.use_chroot);
+ static_hosts_load(config.use_chroot);
+#else
+ static_service_load(0);
+ static_hosts_load(0);
+#endif
+ static_service_add_to_server();
+ static_hosts_add_to_server();
+
+ if (resolv_conf_entry_group)
+ avahi_s_entry_group_reset(resolv_conf_entry_group);
+
+ load_resolv_conf();
+
+ update_wide_area_servers();
+
+ if (config.publish_resolv_conf && resolv_conf && resolv_conf[0])
+ resolv_conf_entry_group = add_dns_servers(avahi_server, resolv_conf_entry_group, resolv_conf);
+}
+
+#ifdef HAVE_INOTIFY
+
+static void inotify_callback(AvahiWatch *watch, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
+ char* buffer;
+ int n = 0;
+
+ assert(fd == inotify_fd);
+ assert(watch);
+
+ ioctl(inotify_fd, FIONREAD, &n);
+ if (n <= 0)
+ n = 128;
+
+ buffer = avahi_malloc(n);
+ if (read(inotify_fd, buffer, n) < 0 ) {
+ avahi_free(buffer);
+ avahi_log_error("Failed to read inotify event: %s", avahi_strerror(errno));
+ return;
+ }
+ avahi_free(buffer);
+
+ avahi_log_info("Files changed, reloading.");
+ reload_config();
+}
+
+#endif
+
static void signal_callback(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
int sig;
const AvahiPoll *poll_api;
@@ -673,26 +764,8 @@ static void signal_callback(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AVAHI_GC
case SIGHUP:
avahi_log_info("Got SIGHUP, reloading.");
-#ifdef ENABLE_CHROOT
- static_service_load(config.use_chroot);
- static_hosts_load(config.use_chroot);
-#else
- static_service_load(0);
- static_hosts_load(0);
-#endif
- static_service_add_to_server();
- static_service_remove_from_server();
-
- if (resolv_conf_entry_group)
- avahi_s_entry_group_reset(resolv_conf_entry_group);
-
- load_resolv_conf();
-
- update_wide_area_servers();
-
- if (config.publish_resolv_conf && resolv_conf && resolv_conf[0])
- resolv_conf_entry_group = add_dns_servers(avahi_server, resolv_conf_entry_group, resolv_conf);
+ reload_config();
break;
case SIGUSR1:
@@ -715,6 +788,9 @@ static int run_server(DaemonConfig *c) {
const AvahiPoll *poll_api = NULL;
AvahiWatch *sig_watch = NULL;
int retval_is_sent = 0;
+#ifdef HAVE_INOTIFY
+ AvahiWatch *inotify_watch = NULL;
+#endif
assert(c);
@@ -749,7 +825,7 @@ static int run_server(DaemonConfig *c) {
#endif
) < 0) {
- avahi_log_warn("WARNING: Failed to contact D-BUS daemon.");
+ avahi_log_warn("WARNING: Failed to contact D-Bus daemon.");
if (c->fail_on_missing_dbus)
goto finish;
@@ -777,6 +853,19 @@ static int run_server(DaemonConfig *c) {
#endif
+#ifdef HAVE_INOTIFY
+ if ((inotify_fd = inotify_init()) < 0)
+ avahi_log_warn( "Failed to initialize inotify: %s", strerror(errno));
+ else {
+ add_inotify_watches();
+
+ if (!(inotify_watch = poll_api->watch_new(poll_api, inotify_fd, AVAHI_WATCH_IN, inotify_callback, NULL))) {
+ avahi_log_error( "Failed to create inotify watcher");
+ goto finish;
+ }
+ }
+#endif
+
load_resolv_conf();
#ifdef ENABLE_CHROOT
static_service_load(config.use_chroot);
@@ -840,6 +929,13 @@ finish:
if (sig_watch)
poll_api->watch_free(sig_watch);
+#ifdef HAVE_INOTIFY
+ if (inotify_watch)
+ poll_api->watch_free(inotify_watch);
+ if (inotify_fd >= 0)
+ close(inotify_fd);
+#endif
+
if (simple_poll_api) {
avahi_simple_poll_free(simple_poll_api);
simple_poll_api = NULL;
@@ -1016,7 +1112,7 @@ static void init_rand_seed(void) {
}
/* If the initialization failed by some reason, we add the time to the seed*/
- seed |= (unsigned) time(NULL);
+ seed ^= (unsigned) time(NULL);
srand(seed);
}
@@ -1186,7 +1282,7 @@ int main(int argc, char *argv[]) {
#endif
avahi_log_info("%s "PACKAGE_VERSION" starting up.", argv0);
- avahi_set_proc_title("%s: starting up", argv0);
+ avahi_set_proc_title(argv0, "%s: starting up", argv0);
if (run_server(&config) == 0)
r = 0;
diff --git a/avahi-daemon/setproctitle.c b/avahi-daemon/setproctitle.c
index f8d3ddb..09b7f65 100644
--- a/avahi-daemon/setproctitle.c
+++ b/avahi-daemon/setproctitle.c
@@ -29,6 +29,10 @@
#include <stdarg.h>
#include <unistd.h>
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
+
#include <avahi-common/malloc.h>
#include "setproctitle.h"
@@ -73,7 +77,7 @@ void avahi_init_proc_title(int argc, char **argv) {
#endif
}
-void avahi_set_proc_title(const char *fmt,...) {
+void avahi_set_proc_title(const char *name, const char *fmt,...) {
#ifdef HAVE_SETPROCTITLE
char t[256];
@@ -99,4 +103,11 @@ void avahi_set_proc_title(const char *fmt,...) {
memset(argv_buffer[0] + l, 0, argv_size - l);
argv_buffer[1] = NULL;
#endif
+
+#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME)
+
+ if (name)
+ prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0);
+
+#endif
}
diff --git a/avahi-daemon/setproctitle.h b/avahi-daemon/setproctitle.h
index 6ac7612..a8f2a1a 100644
--- a/avahi-daemon/setproctitle.h
+++ b/avahi-daemon/setproctitle.h
@@ -22,7 +22,9 @@
USA.
***/
+#include <avahi-common/gccmacro.h>
+
void avahi_init_proc_title(int argc, char **argv);
-void avahi_set_proc_title(const char *fmt, ...);
+void avahi_set_proc_title(const char *name, const char *fmt, ...) AVAHI_GCC_PRINTF_ATTR23;
#endif
diff --git a/trunk/avahi-daemon/sftp-ssh.service b/avahi-daemon/sftp-ssh.service
index c65535a..c65535a 100644
--- a/trunk/avahi-daemon/sftp-ssh.service
+++ b/avahi-daemon/sftp-ssh.service
diff --git a/avahi-daemon/ssh.service b/avahi-daemon/ssh.service
index 41e3a5a..a493444 100644
--- a/avahi-daemon/ssh.service
+++ b/avahi-daemon/ssh.service
@@ -26,7 +26,7 @@
<service-group>
- <name replace-wildcards="yes">Remote Terminal on %h</name>
+ <name replace-wildcards="yes">%h</name>
<service>
<type>_ssh._tcp</type>
diff --git a/avahi-daemon/static-hosts.c b/avahi-daemon/static-hosts.c
index 17b268b..c0a5952 100644
--- a/avahi-daemon/static-hosts.c
+++ b/avahi-daemon/static-hosts.c
@@ -40,13 +40,16 @@ typedef struct StaticHost StaticHost;
struct StaticHost {
AvahiSEntryGroup *group;
+ int iteration;
- char *host, *ip;
+ char *host;
+ AvahiAddress address;
AVAHI_LLIST_FIELDS(StaticHost, hosts);
};
static AVAHI_LLIST_HEAD(StaticHost, hosts) = NULL;
+static int current_iteration = 0;
static void add_static_host_to_server(StaticHost *h);
static void remove_static_host_from_server(StaticHost *h);
@@ -86,7 +89,7 @@ static StaticHost *static_host_new(void) {
s->group = NULL;
s->host = NULL;
- s->ip = NULL;
+ s->iteration = current_iteration;
AVAHI_LLIST_PREPEND(StaticHost, hosts, hosts, s);
@@ -98,73 +101,93 @@ static void static_host_free(StaticHost *s) {
AVAHI_LLIST_REMOVE(StaticHost, hosts, hosts, s);
- avahi_s_entry_group_free (s->group);
+ if (s->group)
+ avahi_s_entry_group_free (s->group);
avahi_free(s->host);
- avahi_free(s->ip);
avahi_free(s);
}
+static StaticHost *static_host_find(const char *host, const AvahiAddress *a) {
+ StaticHost *h;
+
+ assert(host);
+ assert(a);
+
+ for (h = hosts; h; h = h->hosts_next)
+ if (!strcmp(h->host, host) && !avahi_address_cmp(a, &h->address))
+ return h;
+
+ return NULL;
+}
+
static void add_static_host_to_server(StaticHost *h)
{
- AvahiAddress a;
- int err;
if (!h->group)
- h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h);
+ if (!(h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h))) {
+ avahi_log_error("avahi_s_entry_group_new() failed: %s", avahi_strerror(avahi_server_errno(avahi_server)));
+ return;
+ }
- if (!avahi_address_parse (h->ip, AVAHI_PROTO_UNSPEC, &a)) {
- avahi_log_error("Static host name %s: avahi_address_parse failed", h->host);
- return;
- }
+ if (avahi_s_entry_group_is_empty(h->group)) {
+ AvahiProtocol p;
+ int err;
+ const AvahiServerConfig *config;
+ config = avahi_server_get_config(avahi_server);
+
+ p = (h->address.proto == AVAHI_PROTO_INET && config->publish_a_on_ipv6) ||
+ (h->address.proto == AVAHI_PROTO_INET6 && config->publish_aaaa_on_ipv4) ? AVAHI_PROTO_UNSPEC : h->address.proto;
+
+ if ((err = avahi_server_add_address(avahi_server, h->group, AVAHI_IF_UNSPEC, p, 0, h->host, &h->address)) < 0) {
+ avahi_log_error ("Static host name %s: avahi_server_add_address failure: %s", h->host, avahi_strerror(err));
+ return;
+ }
- if ((err = avahi_server_add_address(avahi_server, h->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, h->host, &a))) {
- avahi_log_error ("Static host name %s: avahi_server_add_address failure: %s", h->host, avahi_strerror(err));
- return;
+ avahi_s_entry_group_commit (h->group);
}
-
- avahi_s_entry_group_commit (h->group);
}
static void remove_static_host_from_server(StaticHost *h)
{
- avahi_s_entry_group_reset (h->group);
+ if (h->group)
+ avahi_s_entry_group_reset (h->group);
}
void static_hosts_add_to_server(void) {
StaticHost *h;
- for (h = hosts; h; h = h->hosts_next) {
+ for (h = hosts; h; h = h->hosts_next)
add_static_host_to_server(h);
- }
}
void static_hosts_remove_from_server(void) {
StaticHost *h;
- for (h = hosts; h; h = h->hosts_next) {
+ for (h = hosts; h; h = h->hosts_next)
remove_static_host_from_server(h);
- }
}
void static_hosts_load(int in_chroot) {
FILE *f;
unsigned int line = 0;
- const char *filename = (in_chroot ? "/hosts" : AVAHI_CONFIG_DIR "/hosts");
+ StaticHost *h, *next;
+ const char *filename = in_chroot ? "/hosts" : AVAHI_CONFIG_DIR "/hosts";
- if (!(f = fopen(filename, "r")))
- {
+ if (!(f = fopen(filename, "r"))) {
if (errno != ENOENT)
avahi_log_error ("Failed to open static hosts file: %s", strerror (errno));
return;
}
+ current_iteration++;
+
while (!feof(f)) {
unsigned int len;
char ln[256], *s;
char *host, *ip;
- StaticHost *h;
+ AvahiAddress a;
if (!fgets(ln, sizeof (ln), f))
break;
@@ -197,7 +220,7 @@ void static_hosts_load(int in_chroot) {
avahi_log_error("%s:%d: Error, unexpected end of line!", filename, line);
avahi_free(host);
avahi_free(ip);
- break;
+ goto fail;
}
/* Skip over the host */
@@ -211,14 +234,42 @@ void static_hosts_load(int in_chroot) {
avahi_log_error ("%s:%d: Junk on the end of the line!", filename, line);
avahi_free(host);
avahi_free(ip);
- break;
+ goto fail;
+ }
+
+ if (!avahi_address_parse(ip, AVAHI_PROTO_UNSPEC, &a)) {
+ avahi_log_error("Static host name %s: failed to parse address %s", host, ip);
+ avahi_free(host);
+ avahi_free(ip);
+ goto fail;
+ }
+
+ avahi_free(ip);
+
+ if ((h = static_host_find(host, &a)))
+ avahi_free(host);
+ else {
+ h = static_host_new();
+ h->host = host;
+ h->address = a;
+
+ avahi_log_info("Loading new static hostname %s.", h->host);
}
- h = static_host_new();
- h->host = host;
- h->ip = ip;
+ h->iteration = current_iteration;
+ }
+
+ for (h = hosts; h; h = next) {
+ next = h->hosts_next;
+
+ if (h->iteration != current_iteration) {
+ avahi_log_info("Static hostname %s vanished, removing.", h->host);
+ static_host_free(h);
+ }
}
+fail:
+
fclose(f);
}
diff --git a/avahi-daemon/static-services.c b/avahi-daemon/static-services.c
index cba22c6..b9a852c 100644
--- a/avahi-daemon/static-services.c
+++ b/avahi-daemon/static-services.c
@@ -222,7 +222,9 @@ static void add_static_service_group_to_server(StaticServiceGroup *g) {
/* This service group is already registered in the server */
return;
- if (!g->chosen_name) {
+ if (!g->chosen_name || (g->replace_wildcards && strstr(g->name, "%h"))) {
+
+ avahi_free(g->chosen_name);
if (g->replace_wildcards)
g->chosen_name = replacestr(g->name, "%h", avahi_server_get_host_name(avahi_server));
@@ -682,20 +684,25 @@ void static_service_load(int in_chroot) {
}
memset(&globbuf, 0, sizeof(globbuf));
+
if ((globret = glob(in_chroot ? "/services/*.service" : AVAHI_SERVICE_DIR "/*.service", GLOB_ERR, NULL, &globbuf)) != 0)
+
switch (globret) {
+#ifdef GLOB_NOSPACE
case GLOB_NOSPACE:
- avahi_log_error("Not enough memory to read service directory.");
+ avahi_log_error("Not enough memory to read service directory "AVAHI_SERVICE_DIR".");
break;
-
- case GLOB_ABORTED:
- avahi_log_error("Failed to read %s.", AVAHI_SERVICE_DIR);
- break;
-
+#endif
+#ifdef GLOB_NOMATCH
case GLOB_NOMATCH:
- avahi_log_info("No service found in %s.", AVAHI_SERVICE_DIR);
+ avahi_log_info("No service file found in "AVAHI_SERVICE_DIR".");
+ break;
+#endif
+ default:
+ avahi_log_error("Failed to read "AVAHI_SERVICE_DIR".");
break;
- }
+ }
+
else {
for (p = globbuf.gl_pathv; *p; p++)
load_file(*p);
diff --git a/avahi-discover-standalone/Makefile.am b/avahi-discover-standalone/Makefile.am
index bbf1895..e20797b 100644
--- a/avahi-discover-standalone/Makefile.am
+++ b/avahi-discover-standalone/Makefile.am
@@ -48,14 +48,12 @@ interfaces_DATA = $(interfaces)
else
-if HAVE_PYTHON
-if HAVE_DBUS
+if HAVE_PYTHON_DBUS
interfaces_DATA = $(interfaces)
endif
endif
-endif
EXTRA_DIST = \
$(interfaces) \
diff --git a/avahi-dnsconfd/main.c b/avahi-dnsconfd/main.c
index dafa718..d10374b 100644
--- a/avahi-dnsconfd/main.c
+++ b/avahi-dnsconfd/main.c
@@ -393,9 +393,9 @@ static int parse_command_line(int argc, char *argv[]) {
{ "version", no_argument, NULL, 'V' },
{ "refresh", no_argument, NULL, 'r' },
{ "check", no_argument, NULL, 'c' },
+ { NULL, 0, NULL, 0 }
};
- opterr = 0;
while ((c = getopt_long(argc, argv, "hDkVrc", long_options, NULL)) >= 0) {
switch(c) {
@@ -418,7 +418,6 @@ static int parse_command_line(int argc, char *argv[]) {
command = DAEMON_CHECK;
break;
default:
- fprintf(stderr, "Invalid command line argument: %c\n", c);
return -1;
}
}
diff --git a/avahi-glib/glib-malloc.h b/avahi-glib/glib-malloc.h
index 5982e08..675ccb5 100644
--- a/avahi-glib/glib-malloc.h
+++ b/avahi-glib/glib-malloc.h
@@ -32,7 +32,7 @@
AVAHI_C_DECL_BEGIN
/** Return a pointer to a memory allocator that uses GLib's g_malloc()
- and frinds. Th returned structure is statically allocated, and needs
+ and friends. The returned structure is statically allocated, and needs
not to be copied or freed. Pass this directly to avahi_set_allocator(). */
const AvahiAllocator * avahi_glib_allocator(void);
diff --git a/avahi-glib/glib-watch.c b/avahi-glib/glib-watch.c
index 9d80440..f0fd934 100644
--- a/avahi-glib/glib-watch.c
+++ b/avahi-glib/glib-watch.c
@@ -92,7 +92,23 @@ static void cleanup_watches(AvahiGLibPoll *g, int all) {
g->watch_req_cleanup = 0;
}
-static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata) {
+static gushort map_events_to_glib(AvahiWatchEvent events) {
+ return
+ (events & AVAHI_WATCH_IN ? G_IO_IN : 0) |
+ (events & AVAHI_WATCH_OUT ? G_IO_OUT : 0) |
+ (events & AVAHI_WATCH_ERR ? G_IO_ERR : 0) |
+ (events & AVAHI_WATCH_HUP ? G_IO_HUP : 0);
+}
+
+static AvahiWatchEvent map_events_from_glib(gushort events) {
+ return
+ (events & G_IO_IN ? AVAHI_WATCH_IN : 0) |
+ (events & G_IO_OUT ? AVAHI_WATCH_OUT : 0) |
+ (events & G_IO_ERR ? AVAHI_WATCH_ERR : 0) |
+ (events & G_IO_HUP ? AVAHI_WATCH_HUP : 0);
+}
+
+static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent events, AvahiWatchCallback callback, void *userdata) {
AvahiWatch *w;
AvahiGLibPoll *g;
@@ -108,11 +124,7 @@ static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event
w->glib_poll = g;
w->pollfd.fd = fd;
- w->pollfd.events =
- (event & AVAHI_WATCH_IN ? G_IO_IN : 0) |
- (event & AVAHI_WATCH_OUT ? G_IO_OUT : 0) |
- (event & AVAHI_WATCH_ERR ? G_IO_ERR : 0) |
- (event & AVAHI_WATCH_HUP ? G_IO_HUP : 0);
+ w->pollfd.events = map_events_to_glib(events);
w->pollfd.revents = 0;
w->callback = callback;
w->userdata = userdata;
@@ -130,14 +142,14 @@ static void watch_update(AvahiWatch *w, AvahiWatchEvent events) {
assert(w);
assert(!w->dead);
- w->pollfd.events = events;
+ w->pollfd.events = map_events_to_glib(events);
}
static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
assert(w);
assert(!w->dead);
- return w->pollfd.revents;
+ return map_events_from_glib(w->pollfd.revents);
}
static void watch_free(AvahiWatch *w) {
@@ -146,7 +158,7 @@ static void watch_free(AvahiWatch *w) {
if (w->pollfd_added) {
g_source_remove_poll(&w->glib_poll->source, &w->pollfd);
- w->pollfd_added = TRUE;
+ w->pollfd_added = FALSE;
}
w->dead = TRUE;
@@ -266,11 +278,14 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
usec = avahi_timeval_diff(&next_timeout->expiry, &tvnow);
- if (usec <= 0)
+ if (usec <= 0) {
+ *timeout = 0;
return TRUE;
+ }
*timeout = (gint) (usec / 1000);
- }
+ } else
+ *timeout = -1;
return FALSE;
}
@@ -289,7 +304,7 @@ static gboolean check_func(GSource *source) {
tvnow.tv_sec = now.tv_sec;
tvnow.tv_usec = now.tv_usec;
- if (avahi_timeval_compare(&next_timeout->expiry, &tvnow) < 0)
+ if (avahi_timeval_compare(&next_timeout->expiry, &tvnow) <= 0)
return TRUE;
}
@@ -323,7 +338,7 @@ static gboolean dispatch_func(GSource *source, AVAHI_GCC_UNUSED GSourceFunc call
for (w = g->watches; w; w = w->watches_next)
if (w->pollfd.revents > 0) {
assert(w->callback);
- w->callback(w, w->pollfd.fd, w->pollfd.revents, w->userdata);
+ w->callback(w, w->pollfd.fd, map_events_from_glib(w->pollfd.revents), w->userdata);
w->pollfd.revents = 0;
return TRUE;
}
@@ -365,6 +380,7 @@ AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority) {
g_source_attach(&g->source, g->context);
g_source_set_priority(&g->source, priority);
+ g_source_set_can_recurse(&g->source, FALSE);
return g;
}
diff --git a/avahi-glib/glib-watch.h b/avahi-glib/glib-watch.h
index 895a686..78f7742 100644
--- a/avahi-glib/glib-watch.h
+++ b/avahi-glib/glib-watch.h
@@ -24,6 +24,9 @@
/** \file glib-watch.h GLib main loop adapter */
+/** \example glib-integration.c Example of how to integrate
+ * avahi use with GLIB/GTK applications */
+
#include <glib.h>
#include <avahi-common/cdecl.h>
@@ -37,7 +40,7 @@ typedef struct AvahiGLibPoll AvahiGLibPoll;
/** Create a new GLib main loop adapter attached to the specified
context. If context is NULL, the default main loop context is
used. You can attach as many AvahiGLibPoll objects to the same context
- as you want. priority takes on of GLib's G_PRIORITY constants. */
+ as you want. priority takes one of GLib's G_PRIORITY constants. */
AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority);
/** Free GLib main loop adapter */
diff --git a/avahi-python/Makefile.am b/avahi-python/Makefile.am
index 7f4980a..d59b19f 100644
--- a/avahi-python/Makefile.am
+++ b/avahi-python/Makefile.am
@@ -34,15 +34,25 @@ if HAVE_PYTHON_DBUS
if HAVE_PYGTK
pythonscripts = \
- avahi-bookmarks \
- avahi-discover
+ avahi-bookmarks
desktopdir = $(datadir)/applications
-desktop_DATA = avahi-discover.desktop
+desktop_DATA =
+
+if HAVE_GDBM
+pythonscripts += \
+ avahi-discover
+desktop_DATA += avahi-discover.desktop
+endif
+
+if HAVE_DBM
+pythonscripts += \
+ avahi-discover
+desktop_DATA += avahi-discover.desktop
+endif
avahi-discover.desktop: avahi-discover.desktop.in
sed -e 's,@bindir\@,$(bindir),g' $< > $@
- chmod +x $@
avahi-discover: avahi-discover.in
sed -e 's,@PYTHON\@,$(PYTHON),g' \
diff --git a/avahi-python/avahi-bookmarks.in b/avahi-python/avahi-bookmarks.in
index 6466a22..a1e8d0c 100755
--- a/avahi-python/avahi-bookmarks.in
+++ b/avahi-python/avahi-bookmarks.in
@@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-import sys, getopt
+import sys, getopt, os
try:
import avahi, gobject, dbus
@@ -32,29 +32,19 @@ try:
except ImportError:
pass
-try:
- from twisted.internet import glib2reactor
- glib2reactor.install()
- from twisted.internet import reactor
- from twisted.web import server, resource
-except ImportError:
- print "Sorry, to use this tool you need to install twisted and twisted.web."
- sys.exit(1)
-
urlproto = { "_http._tcp" : "http", "_https._tcp" : "https", "_ftp._tcp" : "ftp" }
port = 8080
address = "127.0.0.1"
use_host_names = None
+use_CGI = None
domain = "local"
+timeout = 3000
-class AvahiBookmarks(resource.Resource):
- isLeaf = True
-
+class AvahiBookmarks:
services = {}
def __init__(self, use_host_names):
- resource.Resource.__init__(self)
self.bus = dbus.SystemBus()
self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
@@ -75,11 +65,13 @@ class AvahiBookmarks(resource.Resource):
def browse_service_type(self, stype):
- global domain
+ global domain, use_CGI
browser = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, stype, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
browser.connect_to_signal('ItemNew', self.new_service)
browser.connect_to_signal('ItemRemove', self.remove_service)
+ if use_CGI:
+ browser.connect_to_signal('AllForNow', self.all_for_now)
def find_path(self, txt):
@@ -94,12 +86,14 @@ class AvahiBookmarks(resource.Resource):
return "/"
- def render_GET(self, request):
+ def render_html(self):
- t = '<html><head><title>Zeroconf Bookmarks</title></head><body><h1>Zeroconf Bookmarks</h1>'
+ global domain
+
+ t = '<html><head><title>%s Zeroconf Bookmarks</title></head><body><h1>%s Zeroconf Bookmarks</h1>' % (domain, domain)
if len(self.services) == 0:
- t += '<p>Sorry, no web services have been registered on the local LAN.</p>'
+ t += '<p>Sorry, no Zeroconf web services have been registered on the %s domain.</p>' % domain
else:
t += '<ul style="padding: 0px; margin: 20px; list-style-type: none">'
@@ -135,12 +129,22 @@ class AvahiBookmarks(resource.Resource):
self.services[(interface, protocol, name, type, domain)] = (host, aprotocol, h, port, txt)
def remove_service(self, interface, protocol, name, type, domain):
+
del self.services[(interface, protocol, name, type, domain)]
+ # Only reachable with use_CGI
+ def all_for_now(self):
+
+ mainloop.quit()
+
def usage(retval = 0):
+
print "%s [options]\n" % sys.argv[0]
print " -h --help Show this help"
+ print " -c --cgi Run as a CGI instead of as a server (default to server"
+ print " unless environment variable GATEWAY_INTERFACE is set)"
+ print " -t --timeout MS Specify the max time for CGI browsing (default %u)" % timeout
print " -p --port PORT Specify the port to use (default %u)" % port
print " -a --address ADDRESS Specify the address to bind to (default %s)" % address
print " -H --host-names Show links with real hostnames"
@@ -149,7 +153,7 @@ def usage(retval = 0):
sys.exit(retval)
try:
- opts, args = getopt.getopt(sys.argv[1:], "hp:a:HAd:", ["help", "port=", "address=", "host-names", "addresses", "domain="])
+ opts, args = getopt.getopt(sys.argv[1:], "hct:p:a:HAd:", ["help", "cgi", "port=", "timeout=", "address=", "host-names", "addresses", "domain="])
except getopt.GetoptError:
usage(2)
@@ -157,6 +161,12 @@ for o, a in opts:
if o in ("-h", "--help"):
usage()
+ if o in ("-c", "--cgi"):
+ use_CGI = True
+
+ if o in ("-t", "--timeout"):
+ timeout = int(a)
+
if o in ("-p", "--port"):
port = int(a)
@@ -172,12 +182,48 @@ for o, a in opts:
if o in ("-d", "--domain"):
domain = a
-site = server.Site(AvahiBookmarks(use_host_names))
-reactor.listenTCP(port, site, interface=address)
+if use_CGI is None:
+ use_CGI = os.environ.has_key("GATEWAY_INTERFACE")
-print "Now point your web browser to http://%s:%u/!" % (address, port)
+if use_CGI:
+ cgi = AvahiBookmarks(use_host_names)
-try:
- reactor.run()
-except KeyboardInterrupt, k:
- pass
+ mainloop = gobject.MainLoop()
+ gobject.timeout_add(timeout, mainloop.quit)
+
+ try:
+ mainloop.run()
+ except KeyboardInterrupt:
+ pass
+
+ print 'Content-type: text/html\n\n' + cgi.render_html()
+
+else:
+ try:
+ from twisted.internet import glib2reactor
+ glib2reactor.install()
+ from twisted.internet import reactor
+ from twisted.web import server, resource
+ except ImportError:
+ print "Sorry, to use this tool as a server you need to install twisted and twisted.web.\n"
+ sys.exit(1)
+
+ class AvahiBookmarksServer(AvahiBookmarks, resource.Resource):
+ isLeaf = True
+
+ def __init__(self, use_host_names):
+ resource.Resource.__init__(self)
+ AvahiBookmarks.__init__(self, use_host_names)
+
+ def render_GET(self, request):
+ return self.render_html()
+
+ site = server.Site(AvahiBookmarksServer(use_host_names))
+ reactor.listenTCP(port, site, interface=address)
+
+ print "Now point your web browser to http://%s:%u/!" % (address, port)
+
+ try:
+ reactor.run()
+ except KeyboardInterrupt:
+ pass
diff --git a/avahi-python/avahi-discover.desktop.in b/avahi-python/avahi-discover.desktop.in
index c5d0d82..bdd413c 100644
--- a/avahi-python/avahi-discover.desktop.in
+++ b/avahi-python/avahi-discover.desktop.in
@@ -1,10 +1,12 @@
[Desktop Entry]
+Version=1.0
Encoding=UTF-8
Name=Avahi Zeroconf Browser
Comment=Browse for Zeroconf services available on your network
Exec=@bindir@/avahi-discover
Terminal=false
Type=Application
-Icon=gnome-nettool
+Icon=network-wired
Categories=GNOME;Application;System;Utility;
StartupNotify=false
+GenericName=
diff --git a/avahi-python/avahi-discover.in b/avahi-python/avahi-discover.in
index 5174b5a..23dee80 100755
--- a/avahi-python/avahi-discover.in
+++ b/avahi-python/avahi-discover.in
@@ -24,11 +24,16 @@ import os, sys
try:
import avahi, gtk, gobject, dbus, avahi.ServiceTypeDatabase
from avahi.SimpleGladeApp import SimpleGladeApp
-except ImportError:
- print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus."
+except ImportError, e:
+ print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus.\n Error: %s" % e
sys.exit(1)
+
+## !!NOTE!! ##
+# It's really important to do this, else you won't see any events
+##
try:
+ from dbus import DBusException
import dbus.glib
except ImportError, e:
pass
@@ -36,6 +41,14 @@ except ImportError, e:
service_type_browsers = {}
service_browsers = {}
+def error_msg(msg):
+ d = gtk.MessageDialog(parent=None, flags=gtk.DIALOG_MODAL,
+ type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
+ d.set_markup(msg)
+ d.show_all()
+ d.run()
+ d.destroy()
+
glade_dir = "@interfacesdir@"
service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase()
@@ -43,7 +56,7 @@ service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase()
class Main_window(SimpleGladeApp):
def __init__(self, path="avahi-discover.glade", root="main_window", domain=None, **kwargs):
path = os.path.join(glade_dir, path)
- gtk.window_set_default_icon_name("gnome-networktool")
+ gtk.window_set_default_icon_name("network-wired")
SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
def on_tree_view_cursor_changed(self, widget, *args):
@@ -158,8 +171,14 @@ class Main_window(SimpleGladeApp):
if self.stype is None:
print "Browsing domain '%s' on %i.%i ..." % (domain, interface, protocol)
-
- b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceTypeBrowserNew(interface, protocol, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_TYPE_BROWSER)
+
+ try:
+ b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceTypeBrowserNew(interface, protocol, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_TYPE_BROWSER)
+ except DBusException, e:
+ print e
+ error_msg("You should check that the avahi daemon is running.\n\nError : %s" % e)
+ sys.exit(0)
+
b.connect_to_signal('ItemNew', self.new_service_type)
service_type_browsers[(interface, protocol, domain)] = b
diff --git a/avahi-python/avahi/Makefile.am b/avahi-python/avahi/Makefile.am
index b1ebe22..5582d51 100644
--- a/avahi-python/avahi/Makefile.am
+++ b/avahi-python/avahi/Makefile.am
@@ -23,17 +23,39 @@ if HAVE_PYTHON
avahidir = $(pythondir)/avahi
+
+if HAVE_GDBM
avahi_SCRIPTS = ServiceTypeDatabase.py
ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,gdbm,g' \
+ -e 's,@FIRST_KEY\@,key = self.db.firstkey(),g' \
+ -e 's,@CHECK_KEY\@,while key is not None:,g' \
+ -e 's,@NEXT_KEY\@,key = self.db.nextkey(key),g' \
-e 's,@pkgdatadir\@,$(pkgdatadir),g' $< > $@
chmod +x $@
+endif
+
+if HAVE_DBM
+avahi_SCRIPTS = ServiceTypeDatabase.py
+
+ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
+ sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,dbm,g' \
+ -e 's,@FIRST_KEY\@,keys = self.db.keys(),g' \
+ -e 's,@CHECK_KEY\@,for key in keys:,g' \
+ -e 's,@NEXT_KEY\@,,g' \
+ -e 's,@pkgdatadir\@,$(pkgdatadir),g' $< > $@
+ chmod +x $@
+endif
+
+avahi_PYTHON = $(avahi_SCRIPTS)
if HAVE_PYGTK
if HAVE_PYTHON_DBUS
-avahi_PYTHON = __init__.py SimpleGladeApp.py
+avahi_PYTHON += __init__.py SimpleGladeApp.py
endif
endif
diff --git a/avahi-python/avahi/ServiceTypeDatabase.py.in b/avahi-python/avahi/ServiceTypeDatabase.py.in
index 25807f3..95c03a4 100644
--- a/avahi-python/avahi/ServiceTypeDatabase.py.in
+++ b/avahi-python/avahi/ServiceTypeDatabase.py.in
@@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-import gdbm
+import @DBM@
import locale
import re
@@ -29,7 +29,7 @@ class ServiceTypeDatabase:
def __init__(self, filename = "@pkgdatadir@/service-types.db"):
- self.db = gdbm.open(filename, "r")
+ self.db = @DBM@.open(filename, "r")
l = locale.getlocale(locale.LC_MESSAGES)
@@ -69,12 +69,12 @@ class ServiceTypeDatabase:
def items(self):
items = []
- key = self.db.firstkey()
- while key is not None:
+ @FIRST_KEY@
+ @CHECK_KEY@
if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key) and not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key):
localized_service_name = self[key]
items.append((key, localized_service_name))
- key = self.db.nextkey(key)
+ @NEXT_KEY@
return items
def has_key(self, key):
diff --git a/avahi-sharp/Makefile.am b/avahi-sharp/Makefile.am
index 4ca3c11..43ab428 100644
--- a/avahi-sharp/Makefile.am
+++ b/avahi-sharp/Makefile.am
@@ -69,8 +69,8 @@ avahi-sharp-docs.zip: avahi-sharp-docs.tree
avahi-sharp-docs.tree: $(srcdir)/en/*/*
$(MDASSEMBLER) --out avahi-sharp-docs --ecma $(srcdir)/en
-docdir = $(MONODOC_DIR)
-doc_DATA = avahi-sharp-docs.zip avahi-sharp-docs.tree avahi-sharp-docs.source
+monodocdir = $(MONODOC_DIR)
+monodoc_DATA = avahi-sharp-docs.zip avahi-sharp-docs.tree avahi-sharp-docs.source
endif
diff --git a/avahi-ui.pc.in b/avahi-ui.pc.in
new file mode 100644
index 0000000..ca9c2ef
--- /dev/null
+++ b/avahi-ui.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=${prefix}/include
+
+Name: avahi-ui
+Description: Avahi Multicast DNS Responder (Common GTK UI support)
+Requires: gtk+-2.0 avahi-client avahi-glib
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lavahi-ui
+Cflags: -D_REENTRANT -I${includedir}
diff --git a/avahi-ui/Makefile.am b/avahi-ui/Makefile.am
new file mode 100644
index 0000000..da5eb01
--- /dev/null
+++ b/avahi-ui/Makefile.am
@@ -0,0 +1,80 @@
+# $Id$
+#
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# avahi is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with avahi; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+
+AM_CFLAGS=-I$(top_srcdir)
+
+# This cool debug trap works on i386/gcc only
+AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
+
+desktopdir = $(datadir)/applications
+desktop_DATA =
+
+EXTRA_DIST = zssh.desktop.in zvnc.desktop.in
+
+
+if HAVE_GTK
+if HAVE_DBUS
+
+avahiincludedir=$(includedir)/avahi-ui
+
+avahiinclude_HEADERS = \
+ avahi-ui.h
+
+lib_LTLIBRARIES = \
+ libavahi-ui.la
+
+libavahi_ui_la_SOURCES = \
+ avahi-ui.h avahi-ui.c
+libavahi_ui_la_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
+libavahi_ui_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la ../avahi-glib/libavahi-glib.la $(GTK20_LIBS)
+libavahi_ui_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_UI_VERSION_INFO)
+
+if HAVE_GDBM
+libavahi_ui_la_SOURCES += ../avahi-utils/stdb.h ../avahi-utils/stdb.c
+libavahi_ui_la_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\"
+libavahi_ui_la_LIBADD += -lgdbm
+endif
+
+if HAVE_DBM
+libavahi_ui_la_SOURCES += ../avahi-utils/stdb.h ../avahi-utils/stdb.c
+libavahi_ui_la_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\"
+endif
+
+bin_PROGRAMS = zssh
+desktop_DATA += zssh.desktop zvnc.desktop
+
+zssh_SOURCES = zssh.c
+zssh_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
+zssh_LDADD = $(AM_LDADD) $(GTK20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la libavahi-ui.la
+
+install-exec-local:
+ cd $(DESTDIR)/$(bindir) && \
+ rm -f zvnc && \
+ $(LN_S) zssh zvnc
+
+zssh.desktop: zssh.desktop.in
+ sed -e 's,@bindir\@,$(bindir),g' $< > $@
+
+zvnc.desktop: zvnc.desktop.in
+ sed -e 's,@bindir\@,$(bindir),g' $< > $@
+
+endif
+endif
+
+CLEANFILES = $(desktop_DATA)
diff --git a/avahi-ui/avahi-ui.c b/avahi-ui/avahi-ui.c
new file mode 100644
index 0000000..a2a73d5
--- /dev/null
+++ b/avahi-ui/avahi-ui.c
@@ -0,0 +1,1371 @@
+/* $Id$ */
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with avahi; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdarg.h>
+#include <net/if.h>
+
+#include <gtk/gtk.h>
+
+#include <avahi-glib/glib-watch.h>
+#include <avahi-client/client.h>
+#include <avahi-client/lookup.h>
+#include <avahi-common/error.h>
+#include <avahi-common/address.h>
+#include <avahi-common/domain.h>
+
+#include "avahi-ui.h"
+
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+#include "../avahi-utils/stdb.h"
+#endif
+
+/* todo: i18n, HIGify */
+
+struct _AuiServiceDialogPrivate {
+ AvahiGLibPoll *glib_poll;
+ AvahiClient *client;
+ AvahiServiceBrowser **browsers;
+ AvahiServiceResolver *resolver;
+ AvahiDomainBrowser *domain_browser;
+
+ gchar **browse_service_types;
+ gchar *service_type;
+ gchar *domain;
+ gchar *service_name;
+ AvahiProtocol address_family;
+
+ AvahiAddress address;
+ gchar *host_name;
+ AvahiStringList *txt_data;
+ guint16 port;
+
+ gboolean resolve_service, resolve_service_done;
+ gboolean resolve_host_name, resolve_host_name_done;
+
+ GtkWidget *domain_label;
+ GtkWidget *domain_button;
+ GtkWidget *service_tree_view;
+ GtkWidget *service_progress_bar;
+
+ GtkListStore *service_list_store, *domain_list_store;
+
+ guint service_pulse_timeout;
+ guint domain_pulse_timeout;
+ guint start_idle;
+
+ AvahiIfIndex common_interface;
+ AvahiProtocol common_protocol;
+
+ GtkWidget *domain_dialog;
+ GtkWidget *domain_entry;
+ GtkWidget *domain_tree_view;
+ GtkWidget *domain_progress_bar;
+ GtkWidget *domain_ok_button;
+};
+
+enum {
+ PROP_0,
+ PROP_BROWSE_SERVICE_TYPES,
+ PROP_DOMAIN,
+ PROP_SERVICE_TYPE,
+ PROP_SERVICE_NAME,
+ PROP_ADDRESS,
+ PROP_PORT,
+ PROP_HOST_NAME,
+ PROP_TXT_DATA,
+ PROP_RESOLVE_SERVICE,
+ PROP_RESOLVE_HOST_NAME,
+ PROP_ADDRESS_FAMILY
+};
+
+enum {
+ SERVICE_COLUMN_IFACE,
+ SERVICE_COLUMN_PROTO,
+ SERVICE_COLUMN_TYPE,
+ SERVICE_COLUMN_NAME,
+ SERVICE_COLUMN_PRETTY_IFACE,
+ SERVICE_COLUMN_PRETTY_TYPE,
+ N_SERVICE_COLUMNS
+};
+
+enum {
+ DOMAIN_COLUMN_NAME,
+ DOMAIN_COLUMN_REF,
+ N_DOMAIN_COLUMNS
+};
+
+static void aui_service_dialog_finalize(GObject *object);
+static void aui_service_dialog_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void aui_service_dialog_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+
+G_DEFINE_TYPE(AuiServiceDialog, aui_service_dialog, GTK_TYPE_DIALOG)
+
+static void aui_service_dialog_class_init(AuiServiceDialogClass *klass) {
+ GObjectClass *object_class;
+
+ object_class = (GObjectClass*) klass;
+
+ object_class->finalize = aui_service_dialog_finalize;
+ object_class->set_property = aui_service_dialog_set_property;
+ object_class->get_property = aui_service_dialog_get_property;
+
+ g_object_class_install_property(
+ object_class,
+ PROP_BROWSE_SERVICE_TYPES,
+ g_param_spec_pointer("browse_service_types", "Browse Service Types", "A NULL terminated list of service types to browse for",
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_DOMAIN,
+ g_param_spec_string("domain", "Domain", "The domain to browse in, or NULL for the default domain",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_SERVICE_TYPE,
+ g_param_spec_string("service_type", "Service Type", "The service type of the selected service",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_SERVICE_NAME,
+ g_param_spec_string("service_name", "Service Name", "The service name of the selected service",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_ADDRESS,
+ g_param_spec_pointer("address", "Address", "The address of the resolved service",
+ G_PARAM_READABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_PORT,
+ g_param_spec_uint("port", "Port", "The IP port number of the resolved service",
+ 0, 0xFFFF, 0,
+ G_PARAM_READABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_HOST_NAME,
+ g_param_spec_string("host_name", "Host Name", "The host name of the resolved service",
+ NULL,
+ G_PARAM_READABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_TXT_DATA,
+ g_param_spec_pointer("txt_data", "TXT Data", "The TXT data of the resolved service",
+ G_PARAM_READABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_RESOLVE_SERVICE,
+ g_param_spec_boolean("resolve_service", "Resolve service", "Resolve service",
+ TRUE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_RESOLVE_HOST_NAME,
+ g_param_spec_boolean("resolve_host_name", "Resolve service host name", "Resolve service host name",
+ TRUE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property(
+ object_class,
+ PROP_ADDRESS_FAMILY,
+ g_param_spec_int("address_family", "Address family", "The address family for host name resolution",
+ AVAHI_PROTO_UNSPEC, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+}
+
+
+GtkWidget *aui_service_dialog_new_valist(
+ gchar *title,
+ GtkWindow *parent,
+ const gchar *first_button_text,
+ va_list varargs) {
+
+ const gchar *button_text;
+
+ GtkWidget *w = GTK_WIDGET(g_object_new(
+ AUI_TYPE_SERVICE_DIALOG,
+ "has-separator", FALSE,
+ "title", title,
+ NULL));
+
+ if (parent)
+ gtk_window_set_transient_for(GTK_WINDOW(w), parent);
+
+ button_text = first_button_text;
+ while (button_text) {
+ gint response_id;
+
+ response_id = va_arg(varargs, gint);
+ gtk_dialog_add_button(GTK_DIALOG(w), button_text, response_id);
+ button_text = va_arg(varargs, const gchar *);
+ }
+
+ return w;
+}
+
+GtkWidget* aui_service_dialog_new(
+ const gchar *title,
+ GtkWindow *parent,
+ const gchar *first_button_text,
+ ...) {
+
+ GtkWidget *w;
+
+ va_list varargs;
+ va_start(varargs, first_button_text);
+ w = aui_service_dialog_new_valist((gchar*) title, parent, first_button_text, varargs);
+ va_end(varargs);
+
+ return w;
+}
+
+static gboolean service_pulse_callback(gpointer data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(data);
+
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(d->priv->service_progress_bar));
+ return TRUE;
+}
+
+static gboolean domain_pulse_callback(gpointer data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(data);
+
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(d->priv->domain_progress_bar));
+ return TRUE;
+}
+
+static void client_callback(AvahiClient *c, AvahiClientState state, void *userdata) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(userdata);
+
+ if (state == AVAHI_CLIENT_FAILURE) {
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Avahi client failure: %s",
+ avahi_strerror(avahi_client_errno(c)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ }
+}
+
+static void resolve_callback(
+ AvahiServiceResolver *r,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiResolverEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ const char *host_name,
+ const AvahiAddress *a,
+ uint16_t port,
+ AvahiStringList *txt,
+ AvahiLookupResultFlags flags,
+ void *userdata) {
+
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(userdata);
+
+ switch (event) {
+ case AVAHI_RESOLVER_FOUND:
+
+ d->priv->resolve_service_done = 1;
+
+ g_free(d->priv->service_name);
+ d->priv->service_name = g_strdup(name);
+
+ g_free(d->priv->service_type);
+ d->priv->service_type = g_strdup(type);
+
+ g_free(d->priv->domain);
+ d->priv->domain = g_strdup(domain);
+
+ g_free(d->priv->host_name);
+ d->priv->host_name = g_strdup(host_name);
+
+ d->priv->port = port;
+
+ avahi_string_list_free(d->priv->txt_data);
+ d->priv->txt_data = avahi_string_list_copy(txt);
+
+ if (a) {
+ d->priv->resolve_host_name_done = 1;
+ d->priv->address = *a;
+ }
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT);
+
+ break;
+
+ case AVAHI_RESOLVER_FAILURE: {
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Avahi resolver failure: %s",
+ avahi_strerror(avahi_client_errno(d->priv->client)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ break;
+ }
+ }
+}
+
+
+static void browse_callback(
+ AvahiServiceBrowser *b,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiBrowserEvent event,
+ const char *name,
+ const char *type,
+ const char *domain,
+ AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ void* userdata) {
+
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(userdata);
+
+ switch (event) {
+
+ case AVAHI_BROWSER_NEW: {
+ gchar *ifs;
+ const gchar *pretty_type;
+ char ifname[IFNAMSIZ];
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+
+ if (!(if_indextoname(interface, ifname)))
+ g_snprintf(ifname, sizeof(ifname), "%i", interface);
+
+ ifs = g_strdup_printf("%s %s", ifname, protocol == AVAHI_PROTO_INET ? "IPv4" : "IPv6");
+
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ pretty_type = stdb_lookup(type);
+#else
+ pretty_type = type;
+#endif
+
+ gtk_list_store_append(d->priv->service_list_store, &iter);
+
+ gtk_list_store_set(d->priv->service_list_store, &iter,
+ SERVICE_COLUMN_IFACE, interface,
+ SERVICE_COLUMN_PROTO, protocol,
+ SERVICE_COLUMN_NAME, name,
+ SERVICE_COLUMN_TYPE, type,
+ SERVICE_COLUMN_PRETTY_IFACE, ifs,
+ SERVICE_COLUMN_PRETTY_TYPE, pretty_type,
+ -1);
+
+ g_free(ifs);
+
+ if (d->priv->common_protocol == AVAHI_PROTO_UNSPEC)
+ d->priv->common_protocol = protocol;
+
+ if (d->priv->common_interface == AVAHI_IF_UNSPEC)
+ d->priv->common_interface = interface;
+
+ if (d->priv->common_interface != interface || d->priv->common_protocol != protocol) {
+ gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(d->priv->service_tree_view), 0), TRUE);
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(d->priv->service_tree_view), TRUE);
+ }
+
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(d->priv->service_tree_view));
+ if (!gtk_tree_selection_get_selected(selection, NULL, NULL)) {
+
+ if (!d->priv->service_type ||
+ !d->priv->service_name ||
+ (avahi_domain_equal(d->priv->service_type, type) && strcasecmp(d->priv->service_name, name) == 0)) {
+ GtkTreePath *path;
+
+ gtk_tree_selection_select_iter(selection, &iter);
+
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(d->priv->service_list_store), &iter);
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(d->priv->service_tree_view), path, NULL, FALSE);
+ gtk_tree_path_free(path);
+ }
+
+ }
+
+ break;
+ }
+
+ case AVAHI_BROWSER_REMOVE: {
+ GtkTreeIter iter;
+ gboolean valid;
+
+ valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(d->priv->service_list_store), &iter);
+ while (valid) {
+ gint _interface, _protocol;
+ gchar *_name, *_type;
+ gboolean found;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(d->priv->service_list_store), &iter,
+ SERVICE_COLUMN_IFACE, &_interface,
+ SERVICE_COLUMN_PROTO, &_protocol,
+ SERVICE_COLUMN_NAME, &_name,
+ SERVICE_COLUMN_TYPE, &_type,
+ -1);
+
+ found = _interface == interface && _protocol == protocol && strcasecmp(_name, name) == 0 && avahi_domain_equal(_type, type);
+ g_free(_name);
+
+ if (found) {
+ gtk_list_store_remove(d->priv->service_list_store, &iter);
+ break;
+ }
+
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(d->priv->service_list_store), &iter);
+ }
+
+ break;
+ }
+
+ case AVAHI_BROWSER_FAILURE: {
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Browsing for service type %s in domain %s failed: %s",
+ type, domain,
+ avahi_strerror(avahi_client_errno(d->priv->client)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ /* Fall through */
+ }
+
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ if (d->priv->service_pulse_timeout > 0) {
+ g_source_remove(d->priv->service_pulse_timeout);
+ d->priv->service_pulse_timeout = 0;
+ gtk_widget_hide(d->priv->service_progress_bar);
+ }
+ break;
+
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ ;
+ }
+}
+
+static void domain_make_default_selection(AuiServiceDialog *d, const gchar *name, GtkTreeIter *iter) {
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(d->priv->domain_tree_view));
+ if (!gtk_tree_selection_get_selected(selection, NULL, NULL)) {
+
+ if (avahi_domain_equal(gtk_entry_get_text(GTK_ENTRY(d->priv->domain_entry)), name)) {
+ GtkTreePath *path;
+
+ gtk_tree_selection_select_iter(selection, iter);
+
+ path = gtk_tree_model_get_path(GTK_TREE_MODEL(d->priv->domain_list_store), iter);
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(d->priv->domain_tree_view), path, NULL, FALSE);
+ gtk_tree_path_free(path);
+ }
+
+ }
+}
+
+static void domain_browse_callback(
+ AvahiDomainBrowser *b,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiBrowserEvent event,
+ const char *name,
+ AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ void* userdata) {
+
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(userdata);
+
+ switch (event) {
+
+ case AVAHI_BROWSER_NEW: {
+ GtkTreeIter iter;
+ gboolean found = FALSE, valid;
+ gint ref;
+
+ valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(d->priv->domain_list_store), &iter);
+ while (valid) {
+ gchar *_name;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(d->priv->domain_list_store), &iter,
+ DOMAIN_COLUMN_NAME, &_name,
+ DOMAIN_COLUMN_REF, &ref,
+ -1);
+
+ found = avahi_domain_equal(_name, name);
+ g_free(_name);
+
+ if (found)
+ break;
+
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(d->priv->domain_list_store), &iter);
+ }
+
+ if (found)
+ gtk_list_store_set(d->priv->domain_list_store, &iter, DOMAIN_COLUMN_REF, ref + 1, -1);
+ else {
+ gtk_list_store_append(d->priv->domain_list_store, &iter);
+
+ gtk_list_store_set(d->priv->domain_list_store, &iter,
+ DOMAIN_COLUMN_NAME, name,
+ DOMAIN_COLUMN_REF, 1,
+ -1);
+ }
+
+ domain_make_default_selection(d, name, &iter);
+
+ break;
+ }
+
+ case AVAHI_BROWSER_REMOVE: {
+ gboolean valid;
+ GtkTreeIter iter;
+
+ valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(d->priv->domain_list_store), &iter);
+ while (valid) {
+ gint ref;
+ gchar *_name;
+ gboolean found;
+
+ gtk_tree_model_get(GTK_TREE_MODEL(d->priv->domain_list_store), &iter,
+ DOMAIN_COLUMN_NAME, &_name,
+ DOMAIN_COLUMN_REF, &ref,
+ -1);
+
+ found = avahi_domain_equal(_name, name);
+ g_free(_name);
+
+ if (found) {
+ if (ref <= 1)
+ gtk_list_store_remove(d->priv->service_list_store, &iter);
+ else
+ gtk_list_store_set(d->priv->domain_list_store, &iter, DOMAIN_COLUMN_REF, ref - 1, -1);
+ break;
+ }
+
+ valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(d->priv->domain_list_store), &iter);
+ }
+
+ break;
+ }
+
+
+ case AVAHI_BROWSER_FAILURE: {
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Avahi domain browser failure: %s",
+ avahi_strerror(avahi_client_errno(d->priv->client)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ /* Fall through */
+ }
+
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ if (d->priv->domain_pulse_timeout > 0) {
+ g_source_remove(d->priv->domain_pulse_timeout);
+ d->priv->domain_pulse_timeout = 0;
+ gtk_widget_hide(d->priv->domain_progress_bar);
+ }
+ break;
+
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ ;
+ }
+}
+
+static const gchar *get_domain_name(AuiServiceDialog *d) {
+ const gchar *domain;
+
+ g_return_val_if_fail(d, NULL);
+
+ if (d->priv->domain)
+ return d->priv->domain;
+
+ if (!(domain = avahi_client_get_domain_name(d->priv->client))) {
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Failed to read Avahi domain : %s",
+ avahi_strerror(avahi_client_errno(d->priv->client)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ return NULL;
+ }
+
+ return domain;
+}
+
+static gboolean start_callback(gpointer data) {
+ int error;
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(data);
+ gchar **st;
+ AvahiServiceBrowser **sb;
+ unsigned i;
+ const char *domain;
+
+ d->priv->start_idle = 0;
+
+ if (!d->priv->browse_service_types || !*d->priv->browse_service_types) {
+ g_warning("Browse service type list is empty!");
+ return FALSE;
+ }
+
+ if (!d->priv->client) {
+ if (!(d->priv->client = avahi_client_new(avahi_glib_poll_get(d->priv->glib_poll), 0, client_callback, d, &error))) {
+
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Failed to connect to Avahi server: %s",
+ avahi_strerror(error));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ return FALSE;
+ }
+ }
+
+ if (!(domain = get_domain_name(d))) {
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ return FALSE;
+ }
+
+ g_assert(domain);
+
+ if (avahi_domain_equal(domain, "local."))
+ gtk_label_set_markup(GTK_LABEL(d->priv->domain_label), "Browsing for services on <b>local network</b>:");
+ else {
+ gchar *t = g_strdup_printf("Browsing for services in domain <b>%s</b>:", domain);
+ gtk_label_set_markup(GTK_LABEL(d->priv->domain_label), t);
+ g_free(t);
+ }
+
+ if (d->priv->browsers) {
+ for (sb = d->priv->browsers; *sb; sb++)
+ avahi_service_browser_free(*sb);
+
+ g_free(d->priv->browsers);
+ d->priv->browsers = NULL;
+ }
+
+ gtk_list_store_clear(GTK_LIST_STORE(d->priv->service_list_store));
+ d->priv->common_interface = AVAHI_IF_UNSPEC;
+ d->priv->common_protocol = AVAHI_PROTO_UNSPEC;
+
+ gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(d->priv->service_tree_view), 0), FALSE);
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(d->priv->service_tree_view), gtk_tree_view_column_get_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(d->priv->service_tree_view), 2)));
+ gtk_widget_show(d->priv->service_progress_bar);
+
+ if (d->priv->service_pulse_timeout <= 0)
+ d->priv->service_pulse_timeout = g_timeout_add(100, service_pulse_callback, d->priv);
+
+ for (i = 0; d->priv->browse_service_types[i]; i++)
+ ;
+ g_assert(i > 0);
+
+ d->priv->browsers = g_new0(AvahiServiceBrowser*, i+1);
+ for (st = d->priv->browse_service_types, sb = d->priv->browsers; *st; st++, sb++) {
+
+ if (!(*sb = avahi_service_browser_new(d->priv->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, *st, d->priv->domain, 0, browse_callback, d))) {
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Failed to create browser for %s: %s",
+ *st,
+ avahi_strerror(avahi_client_errno(d->priv->client)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ return FALSE;
+
+ }
+ }
+
+ return FALSE;
+}
+
+static void aui_service_dialog_finalize(GObject *object) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(object);
+
+ if (d->priv->domain_pulse_timeout > 0)
+ g_source_remove(d->priv->domain_pulse_timeout);
+
+ if (d->priv->service_pulse_timeout > 0)
+ g_source_remove(d->priv->service_pulse_timeout);
+
+ if (d->priv->start_idle > 0)
+ g_source_remove(d->priv->start_idle);
+
+ g_free(d->priv->host_name);
+ g_free(d->priv->domain);
+ g_free(d->priv->service_name);
+
+ avahi_string_list_free(d->priv->txt_data);
+
+ g_strfreev(d->priv->browse_service_types);
+
+ if (d->priv->domain_browser)
+ avahi_domain_browser_free(d->priv->domain_browser);
+
+ if (d->priv->resolver)
+ avahi_service_resolver_free(d->priv->resolver);
+
+ if (d->priv->browsers) {
+ AvahiServiceBrowser **sb;
+
+ for (sb = d->priv->browsers; *sb; sb++)
+ avahi_service_browser_free(*sb);
+
+ g_free(d->priv->browsers);
+ }
+
+ if (d->priv->client)
+ avahi_client_free(d->priv->client);
+
+ if (d->priv->glib_poll)
+ avahi_glib_poll_free(d->priv->glib_poll);
+
+ g_free(d->priv);
+ d->priv = NULL;
+
+ G_OBJECT_CLASS(aui_service_dialog_parent_class)->finalize(object);
+}
+
+static void service_row_activated_callback(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT);
+}
+
+static void service_selection_changed_callback(GtkTreeSelection *selection, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT, gtk_tree_selection_get_selected(selection, NULL, NULL));
+}
+
+static void response_callback(GtkDialog *dialog, gint response, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+
+ if (response == GTK_RESPONSE_ACCEPT &&
+ ((d->priv->resolve_service && !d->priv->resolve_service_done) ||
+ (d->priv->resolve_host_name && !d->priv->resolve_host_name_done))) {
+
+ GtkTreeIter iter;
+ gint interface, protocol;
+ gchar *name, *type;
+ GdkCursor *cursor;
+
+ g_signal_stop_emission(dialog, g_signal_lookup("response", gtk_dialog_get_type()), 0);
+
+ if (d->priv->resolver)
+ return;
+
+ g_return_if_fail(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(d->priv->service_tree_view)), NULL, &iter));
+
+ gtk_tree_model_get(GTK_TREE_MODEL(d->priv->service_list_store), &iter,
+ SERVICE_COLUMN_IFACE, &interface,
+ SERVICE_COLUMN_PROTO, &protocol,
+ SERVICE_COLUMN_NAME, &name,
+ SERVICE_COLUMN_TYPE, &type, -1);
+
+ g_return_if_fail(d->priv->client);
+
+ gtk_widget_set_sensitive(GTK_WIDGET(dialog), FALSE);
+ cursor = gdk_cursor_new(GDK_WATCH);
+ gdk_window_set_cursor(GTK_WIDGET(dialog)->window, cursor);
+ gdk_cursor_unref(cursor);
+
+ if (!(d->priv->resolver = avahi_service_resolver_new(
+ d->priv->client, interface, protocol, name, type, d->priv->domain,
+ d->priv->address_family, !d->priv->resolve_host_name ? AVAHI_LOOKUP_NO_ADDRESS : 0, resolve_callback, d))) {
+
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Failed to create resolver for %s of type %s in domain %s: %s",
+ name, type, d->priv->domain,
+ avahi_strerror(avahi_client_errno(d->priv->client)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ return;
+ }
+ }
+}
+
+static gboolean is_valid_domain_suffix(const gchar *n) {
+ gchar label[AVAHI_LABEL_MAX];
+
+ if (!avahi_is_valid_domain_name(n))
+ return FALSE;
+
+ if (!avahi_unescape_label(&n, label, sizeof(label)))
+ return FALSE;
+
+ /* At least one label */
+
+ return !!label[0];
+}
+
+static void domain_row_activated_callback(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+
+ if (is_valid_domain_suffix(gtk_entry_get_text(GTK_ENTRY(d->priv->domain_entry))))
+ gtk_dialog_response(GTK_DIALOG(d->priv->domain_dialog), GTK_RESPONSE_ACCEPT);
+}
+
+static void domain_selection_changed_callback(GtkTreeSelection *selection, gpointer user_data) {
+ GtkTreeIter iter;
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+ gchar *name;
+
+ g_return_if_fail(gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(d->priv->domain_tree_view)), NULL, &iter));
+
+ gtk_tree_model_get(GTK_TREE_MODEL(d->priv->domain_list_store), &iter,
+ DOMAIN_COLUMN_NAME, &name, -1);
+
+ gtk_entry_set_text(GTK_ENTRY(d->priv->domain_entry), name);
+}
+
+static void domain_entry_changed_callback(GtkEditable *editable, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+
+ gtk_widget_set_sensitive(d->priv->domain_ok_button, is_valid_domain_suffix(gtk_entry_get_text(GTK_ENTRY(d->priv->domain_entry))));
+}
+
+static void domain_button_clicked(GtkButton *button, gpointer user_data) {
+ GtkWidget *vbox, *vbox2, *scrolled_window;
+ GtkTreeSelection *selection;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+ AuiServiceDialogPrivate *p = d->priv;
+ const gchar *domain;
+ GtkTreeIter iter;
+
+ g_return_if_fail(!p->domain_dialog);
+ g_return_if_fail(!p->domain_browser);
+
+ if (!(domain = get_domain_name(d))) {
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ return;
+ }
+
+ if (!(p->domain_browser = avahi_domain_browser_new(p->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, domain_browse_callback, d))) {
+ GtkWidget *m = gtk_message_dialog_new(GTK_WINDOW(d),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Failed to create domain browser: %s",
+ avahi_strerror(avahi_client_errno(p->client)));
+ gtk_dialog_run(GTK_DIALOG(m));
+ gtk_widget_destroy(m);
+
+ gtk_dialog_response(GTK_DIALOG(d), GTK_RESPONSE_CANCEL);
+ return;
+ }
+
+ p->domain_dialog = gtk_dialog_new();
+ gtk_container_set_border_width(GTK_CONTAINER(p->domain_dialog), 5);
+ gtk_window_set_title(GTK_WINDOW(p->domain_dialog), "Change domain");
+ gtk_dialog_set_has_separator(GTK_DIALOG(p->domain_dialog), FALSE);
+
+ vbox = gtk_vbox_new(FALSE, 8);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(p->domain_dialog)->vbox), vbox, TRUE, TRUE, 0);
+
+ p->domain_entry = gtk_entry_new_with_max_length(AVAHI_DOMAIN_NAME_MAX);
+ gtk_entry_set_text(GTK_ENTRY(p->domain_entry), domain);
+ gtk_entry_set_activates_default(GTK_ENTRY(p->domain_entry), TRUE);
+ g_signal_connect(p->domain_entry, "changed", G_CALLBACK(domain_entry_changed_callback), d);
+ gtk_box_pack_start(GTK_BOX(vbox), p->domain_entry, FALSE, FALSE, 0);
+
+ vbox2 = gtk_vbox_new(FALSE, 8);
+ gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0);
+
+ scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN);
+ gtk_box_pack_start(GTK_BOX(vbox2), scrolled_window, TRUE, TRUE, 0);
+
+ p->domain_list_store = gtk_list_store_new(N_DOMAIN_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
+
+ p->domain_tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(p->domain_list_store));
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(p->domain_tree_view), FALSE);
+ g_signal_connect(p->domain_tree_view, "row-activated", G_CALLBACK(domain_row_activated_callback), d);
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(p->domain_tree_view));
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
+ g_signal_connect(selection, "changed", G_CALLBACK(domain_selection_changed_callback), d);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Service Name", renderer, "text", DOMAIN_COLUMN_NAME, NULL);
+ gtk_tree_view_column_set_expand(column, TRUE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(p->domain_tree_view), column);
+
+ gtk_tree_view_set_search_column(GTK_TREE_VIEW(p->domain_tree_view), DOMAIN_COLUMN_NAME);
+ gtk_container_add(GTK_CONTAINER(scrolled_window), p->domain_tree_view);
+
+ p->domain_progress_bar = gtk_progress_bar_new();
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(p->domain_progress_bar), "Browsing ...");
+ gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(p->domain_progress_bar), 0.1);
+ gtk_box_pack_end(GTK_BOX(vbox2), p->domain_progress_bar, FALSE, FALSE, 0);
+
+ gtk_dialog_add_button(GTK_DIALOG(p->domain_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ p->domain_ok_button = GTK_WIDGET(gtk_dialog_add_button(GTK_DIALOG(p->domain_dialog), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT));
+ gtk_dialog_set_default_response(GTK_DIALOG(p->domain_dialog), GTK_RESPONSE_ACCEPT);
+ gtk_widget_set_sensitive(p->domain_ok_button, is_valid_domain_suffix(gtk_entry_get_text(GTK_ENTRY(p->domain_entry))));
+
+ gtk_widget_grab_default(p->domain_ok_button);
+ gtk_widget_grab_focus(p->domain_entry);
+
+ gtk_window_set_default_size(GTK_WINDOW(p->domain_dialog), 300, 300);
+
+ gtk_widget_show_all(vbox);
+
+ gtk_list_store_append(p->domain_list_store, &iter);
+ gtk_list_store_set(p->domain_list_store, &iter, DOMAIN_COLUMN_NAME, "local", DOMAIN_COLUMN_REF, 1, -1);
+ domain_make_default_selection(d, "local", &iter);
+
+ p->domain_pulse_timeout = g_timeout_add(100, domain_pulse_callback, d);
+
+ if (gtk_dialog_run(GTK_DIALOG(p->domain_dialog)) == GTK_RESPONSE_ACCEPT)
+ aui_service_dialog_set_domain(d, gtk_entry_get_text(GTK_ENTRY(p->domain_entry)));
+
+ gtk_widget_destroy(p->domain_dialog);
+ p->domain_dialog = NULL;
+
+ if (p->domain_pulse_timeout > 0) {
+ g_source_remove(p->domain_pulse_timeout);
+ p->domain_pulse_timeout = 0;
+ }
+
+ avahi_domain_browser_free(p->domain_browser);
+ p->domain_browser = NULL;
+}
+
+static void aui_service_dialog_init(AuiServiceDialog *d) {
+ GtkWidget *vbox, *vbox2, *scrolled_window;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+ AuiServiceDialogPrivate *p;
+
+ p = d->priv = g_new(AuiServiceDialogPrivate, 1);
+
+ p->host_name = NULL;
+ p->domain = NULL;
+ p->service_name = NULL;
+ p->service_type = NULL;
+ p->txt_data = NULL;
+ p->browse_service_types = NULL;
+ memset(&p->address, 0, sizeof(p->address));
+ p->port = 0;
+ p->resolve_host_name = p->resolve_service = TRUE;
+ p->resolve_host_name_done = p->resolve_service_done = FALSE;
+ p->address_family = AVAHI_PROTO_UNSPEC;
+
+ p->glib_poll = NULL;
+ p->client = NULL;
+ p->browsers = NULL;
+ p->resolver = NULL;
+ p->domain_browser = NULL;
+
+ p->service_pulse_timeout = 0;
+ p->domain_pulse_timeout = 0;
+ p->start_idle = 0;
+ p->common_interface = AVAHI_IF_UNSPEC;
+ p->common_protocol = AVAHI_PROTO_UNSPEC;
+
+ p->domain_dialog = NULL;
+ p->domain_entry = NULL;
+ p->domain_tree_view = NULL;
+ p->domain_progress_bar = NULL;
+ p->domain_ok_button = NULL;
+
+ p->service_list_store = p->domain_list_store = NULL;
+
+ gtk_widget_push_composite_child();
+
+ gtk_container_set_border_width(GTK_CONTAINER(d), 5);
+
+ vbox = gtk_vbox_new(FALSE, 8);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), vbox, TRUE, TRUE, 0);
+
+ p->domain_label = gtk_label_new("Initializing...");
+ gtk_label_set_ellipsize(GTK_LABEL(p->domain_label), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(p->domain_label), 0, 0.5);
+ gtk_box_pack_start(GTK_BOX(vbox), p->domain_label, FALSE, FALSE, 0);
+
+
+ vbox2 = gtk_vbox_new(FALSE, 8);
+ gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0);
+
+ scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_ETCHED_IN);
+ gtk_box_pack_start(GTK_BOX(vbox2), scrolled_window, TRUE, TRUE, 0);
+
+ p->service_list_store = gtk_list_store_new(N_SERVICE_COLUMNS, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+
+ p->service_tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(p->service_list_store));
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(p->service_tree_view), FALSE);
+ g_signal_connect(p->service_tree_view, "row-activated", G_CALLBACK(service_row_activated_callback), d);
+ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(p->service_tree_view));
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
+ g_signal_connect(selection, "changed", G_CALLBACK(service_selection_changed_callback), d);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Location", renderer, "text", SERVICE_COLUMN_PRETTY_IFACE, NULL);
+ gtk_tree_view_column_set_visible(column, FALSE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(p->service_tree_view), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", SERVICE_COLUMN_NAME, NULL);
+ gtk_tree_view_column_set_expand(column, TRUE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(p->service_tree_view), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Type", renderer, "text", SERVICE_COLUMN_PRETTY_TYPE, NULL);
+ gtk_tree_view_column_set_visible(column, FALSE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(p->service_tree_view), column);
+
+ gtk_tree_view_set_search_column(GTK_TREE_VIEW(p->service_tree_view), SERVICE_COLUMN_NAME);
+ gtk_container_add(GTK_CONTAINER(scrolled_window), p->service_tree_view);
+
+ p->service_progress_bar = gtk_progress_bar_new();
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(p->service_progress_bar), "Browsing ...");
+ gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(p->service_progress_bar), 0.1);
+ gtk_box_pack_end(GTK_BOX(vbox2), p->service_progress_bar, FALSE, FALSE, 0);
+
+ p->domain_button = gtk_button_new_with_mnemonic("_Domain...");
+ gtk_button_set_image(GTK_BUTTON(p->domain_button), gtk_image_new_from_stock(GTK_STOCK_NETWORK, GTK_ICON_SIZE_BUTTON));
+ g_signal_connect(p->domain_button, "clicked", G_CALLBACK(domain_button_clicked), d);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), p->domain_button, FALSE, TRUE, 0);
+ gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(GTK_DIALOG(d)->action_area), p->domain_button, TRUE);
+ gtk_widget_show(p->domain_button);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT, FALSE);
+
+ gtk_widget_grab_focus(p->service_tree_view);
+
+ gtk_window_set_default_size(GTK_WINDOW(d), 400, 300);
+
+ gtk_widget_show_all(vbox);
+
+ gtk_widget_pop_composite_child();
+
+ p->glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
+
+ p->service_pulse_timeout = g_timeout_add(100, service_pulse_callback, d);
+ p->start_idle = g_idle_add(start_callback, d);
+
+ g_signal_connect(d, "response", G_CALLBACK(response_callback), d);
+}
+
+static void restart_browsing(AuiServiceDialog *d) {
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+
+ if (d->priv->start_idle <= 0)
+ d->priv->start_idle = g_idle_add(start_callback, d);
+}
+
+void aui_service_dialog_set_browse_service_types(AuiServiceDialog *d, const char *type, ...) {
+ va_list ap, apcopy;
+ const char *t;
+ unsigned u;
+
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+ g_return_if_fail(type);
+
+ g_strfreev(d->priv->browse_service_types);
+
+ va_copy(apcopy, ap);
+
+ va_start(ap, type);
+ for (u = 1; va_arg(ap, const char *); u++)
+ ;
+ va_end(ap);
+
+ d->priv->browse_service_types = g_new0(gchar*, u+1);
+ d->priv->browse_service_types[0] = g_strdup(type);
+
+ va_start(apcopy, type);
+ for (u = 1; (t = va_arg(apcopy, const char*)); u++)
+ d->priv->browse_service_types[u] = g_strdup(t);
+ va_end(apcopy);
+
+ if (d->priv->browse_service_types[0] && d->priv->browse_service_types[1]) {
+ /* Multiple service types, enable headers */
+
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(d->priv->service_tree_view), TRUE);
+ gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(d->priv->service_tree_view), 2), TRUE);
+ }
+
+ restart_browsing(d);
+}
+
+void aui_service_dialog_set_browse_service_typesv(AuiServiceDialog *d, const char *const*types) {
+
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+ g_return_if_fail(types);
+ g_return_if_fail(*types);
+
+ g_strfreev(d->priv->browse_service_types);
+ d->priv->browse_service_types = g_strdupv((char**) types);
+
+ if (d->priv->browse_service_types[0] && d->priv->browse_service_types[1]) {
+ /* Multiple service types, enable headers */
+
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(d->priv->service_tree_view), TRUE);
+ gtk_tree_view_column_set_visible(gtk_tree_view_get_column(GTK_TREE_VIEW(d->priv->service_tree_view), 2), TRUE);
+ }
+
+ restart_browsing(d);
+}
+
+const gchar*const* aui_service_dialog_get_browse_service_types(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), NULL);
+
+ return (const char* const*) d->priv->browse_service_types;
+}
+
+void aui_service_dialog_set_domain(AuiServiceDialog *d, const char *domain) {
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+ g_return_if_fail(!domain || is_valid_domain_suffix(domain));
+
+ g_free(d->priv->domain);
+ d->priv->domain = domain ? avahi_normalize_name_strdup(domain) : NULL;
+
+ restart_browsing(d);
+}
+
+const char* aui_service_dialog_get_domain(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), NULL);
+
+ return d->priv->domain;
+}
+
+void aui_service_dialog_set_service_name(AuiServiceDialog *d, const char *name) {
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+
+ g_free(d->priv->service_name);
+ d->priv->service_name = g_strdup(name);
+}
+
+const char* aui_service_dialog_get_service_name(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), NULL);
+
+ return d->priv->service_name;
+}
+
+void aui_service_dialog_set_service_type(AuiServiceDialog *d, const char*stype) {
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+
+ g_free(d->priv->service_type);
+ d->priv->service_type = g_strdup(stype);
+}
+
+const char* aui_service_dialog_get_service_type(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), NULL);
+
+ return d->priv->service_type;
+}
+
+const AvahiAddress* aui_service_dialog_get_address(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), NULL);
+ g_return_val_if_fail(d->priv->resolve_service_done && d->priv->resolve_host_name_done, NULL);
+
+ return &d->priv->address;
+}
+
+guint16 aui_service_dialog_get_port(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), 0);
+ g_return_val_if_fail(d->priv->resolve_service_done, 0);
+
+ return d->priv->port;
+}
+
+const char* aui_service_dialog_get_host_name(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), NULL);
+ g_return_val_if_fail(d->priv->resolve_service_done, NULL);
+
+ return d->priv->host_name;
+}
+
+const AvahiStringList *aui_service_dialog_get_txt_data(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), NULL);
+ g_return_val_if_fail(d->priv->resolve_service_done, NULL);
+
+ return d->priv->txt_data;
+}
+
+void aui_service_dialog_set_resolve_service(AuiServiceDialog *d, gboolean resolve) {
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+
+ d->priv->resolve_service = resolve;
+}
+
+gboolean aui_service_dialog_get_resolve_service(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), FALSE);
+
+ return d->priv->resolve_service;
+}
+
+void aui_service_dialog_set_resolve_host_name(AuiServiceDialog *d, gboolean resolve) {
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+
+ d->priv->resolve_host_name = resolve;
+}
+
+gboolean aui_service_dialog_get_resolve_host_name(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), FALSE);
+
+ return d->priv->resolve_host_name;
+}
+
+void aui_service_dialog_set_address_family(AuiServiceDialog *d, AvahiProtocol proto) {
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+ g_return_if_fail(proto == AVAHI_PROTO_UNSPEC || proto == AVAHI_PROTO_INET || proto == AVAHI_PROTO_INET6);
+
+ d->priv->address_family = proto;
+}
+
+AvahiProtocol aui_service_dialog_get_address_family(AuiServiceDialog *d) {
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(d), AVAHI_PROTO_UNSPEC);
+
+ return d->priv->address_family;
+}
+
+static void aui_service_dialog_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(object);
+
+ switch (prop_id) {
+ case PROP_BROWSE_SERVICE_TYPES:
+ aui_service_dialog_set_browse_service_typesv(d, g_value_get_pointer(value));
+ break;
+
+ case PROP_DOMAIN:
+ aui_service_dialog_set_domain(d, g_value_get_string(value));
+ break;
+
+ case PROP_SERVICE_TYPE:
+ aui_service_dialog_set_service_type(d, g_value_get_string(value));
+ break;
+
+ case PROP_SERVICE_NAME:
+ aui_service_dialog_set_service_name(d, g_value_get_string(value));
+ break;
+
+ case PROP_RESOLVE_SERVICE:
+ aui_service_dialog_set_resolve_service(d, g_value_get_boolean(value));
+ break;
+
+ case PROP_RESOLVE_HOST_NAME:
+ aui_service_dialog_set_resolve_host_name(d, g_value_get_boolean(value));
+ break;
+
+ case PROP_ADDRESS_FAMILY:
+ aui_service_dialog_set_address_family(d, g_value_get_int(value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
+static void aui_service_dialog_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(object);
+
+ switch (prop_id) {
+ case PROP_BROWSE_SERVICE_TYPES:
+ g_value_set_pointer(value, (gpointer) aui_service_dialog_get_browse_service_types(d));
+ break;
+
+ case PROP_DOMAIN:
+ g_value_set_string(value, aui_service_dialog_get_domain(d));
+ break;
+
+ case PROP_SERVICE_TYPE:
+ g_value_set_string(value, aui_service_dialog_get_service_type(d));
+ break;
+
+ case PROP_SERVICE_NAME:
+ g_value_set_string(value, aui_service_dialog_get_service_name(d));
+ break;
+
+ case PROP_ADDRESS:
+ g_value_set_pointer(value, (gpointer) aui_service_dialog_get_address(d));
+ break;
+
+ case PROP_PORT:
+ g_value_set_uint(value, aui_service_dialog_get_port(d));
+ break;
+
+ case PROP_HOST_NAME:
+ g_value_set_string(value, aui_service_dialog_get_host_name(d));
+ break;
+
+ case PROP_TXT_DATA:
+ g_value_set_pointer(value, (gpointer) aui_service_dialog_get_txt_data(d));
+ break;
+
+ case PROP_RESOLVE_SERVICE:
+ g_value_set_boolean(value, aui_service_dialog_get_resolve_service(d));
+ break;
+
+ case PROP_RESOLVE_HOST_NAME:
+ g_value_set_boolean(value, aui_service_dialog_get_resolve_host_name(d));
+ break;
+
+ case PROP_ADDRESS_FAMILY:
+ g_value_set_int(value, aui_service_dialog_get_address_family(d));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ break;
+ }
+}
+
diff --git a/avahi-ui/avahi-ui.h b/avahi-ui/avahi-ui.h
new file mode 100644
index 0000000..592d09b
--- /dev/null
+++ b/avahi-ui/avahi-ui.h
@@ -0,0 +1,156 @@
+#ifndef fooavahiuihfoo
+#define fooavahiuihfoo
+
+/* $Id$ */
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with avahi; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkdialog.h>
+
+#include <avahi-client/client.h>
+
+/** \file avahi-ui.h A Gtk dialog for browsing for services */
+
+G_BEGIN_DECLS
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+
+#define AUI_TYPE_SERVICE_DIALOG (aui_service_dialog_get_type())
+#define AUI_SERVICE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AUI_TYPE_SERVICE_DIALOG, AuiServiceDialog))
+#define AUI_SERVICE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), AUI_TYPE_SERVICE_DIALOG, AuiServiceDialogClass))
+#define AUI_IS_SERVICE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), AUI_TYPE_SERVICE_DIALOG))
+#define AUI_IS_SERVICE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), AUI_TYPE_SERVICE_DIALOG))
+#define AUI_SERVICE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), AUI_TYPE_SERVICE_DIALOG, AuiServiceDialogClass))
+
+typedef struct _AuiServiceDialogPrivate AuiServiceDialogPrivate;
+typedef struct _AuiServiceDialogClass AuiServiceDialogClass;
+
+struct _AuiServiceDialogClass {
+ GtkDialogClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_aui_reserved1)(void);
+ void (*_aui_reserved2)(void);
+ void (*_aui_reserved3)(void);
+ void (*_aui_reserved4)(void);
+};
+
+struct _AuiServiceDialog {
+ GtkDialog parent_instance;
+ AuiServiceDialogPrivate *priv;
+};
+
+/* ServiceDialog */
+GType aui_service_dialog_get_type(void) G_GNUC_CONST;
+
+#endif
+
+/** The GTK service dialog structure */
+typedef struct _AuiServiceDialog AuiServiceDialog;
+
+/** Create a new service browser dialog with the specific title,
+ * parent window and the speicified buttons. The buttons are specified
+ * in a similar way to GtkFileChooserDialog. Please note that at least
+ * one button has to respond GTK_RESPONSE_ACCEPT. */
+GtkWidget* aui_service_dialog_new(
+ const gchar *title,
+ GtkWindow *parent,
+ const gchar *first_button_text, ...) G_GNUC_NULL_TERMINATED;
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+GtkWidget *aui_service_dialog_new_valist(
+ gchar *title,
+ GtkWindow *parent,
+ const gchar *first_button_text,
+ va_list varargs);
+#endif
+
+/** Select the service types to browse for. Takes a NULL terminated list of DNS-SD service types. i.e. _http._tcp */
+void aui_service_dialog_set_browse_service_types(AuiServiceDialog *d, const gchar *type, ...) G_GNUC_NULL_TERMINATED;
+/** Same as aui_service_dialog_set_browse_service_types() but take a NULL terminated array */
+void aui_service_dialog_set_browse_service_typesv(AuiServiceDialog *d, const gchar *const*type);
+/** Return the service types currently browsed for. i.e. what was previously set with aui_service_dialog_set_browse_service_types() */
+const gchar*const* aui_service_dialog_get_browse_service_types(AuiServiceDialog *d);
+
+/** Set the domain to browse in */
+void aui_service_dialog_set_domain(AuiServiceDialog *d, const gchar *domain);
+/** Query the domain that is browsed in */
+const gchar* aui_service_dialog_get_domain(AuiServiceDialog *d);
+
+/** Set the service type for the service to select */
+void aui_service_dialog_set_service_type(AuiServiceDialog *d, const gchar *name);
+
+/** Query the service type of the currently selected service */
+const gchar* aui_service_dialog_get_service_type(AuiServiceDialog *d);
+
+/** Set the service name for the service to select */
+void aui_service_dialog_set_service_name(AuiServiceDialog *d, const gchar *name);
+
+/** Query the service name of the currently select service */
+const gchar* aui_service_dialog_get_service_name(AuiServiceDialog *d);
+
+/** Return the IP address of the selected service. (Only valid if host name resolving has not been disabled via aui_service_dialog_set_resolve_host_name()) */
+const AvahiAddress* aui_service_dialog_get_address(AuiServiceDialog *d);
+
+/** Return the IP port number of the selected service */
+guint16 aui_service_dialog_get_port(AuiServiceDialog *d);
+
+/** Return the host name of the selected service */
+const gchar* aui_service_dialog_get_host_name(AuiServiceDialog *d);
+
+/** Return the TXT metadata of the selected service */
+const AvahiStringList *aui_service_dialog_get_txt_data(AuiServiceDialog *d);
+
+/** Disable/Enable automatic service resolving. Disabling this feature
+ * will require you to resolve the selected service on our own. I.e. the port
+ * number, the TXT data and the host name/IP address will not be
+ * available after a service has been selected. This functionality
+ * offers a certain optimization in the traffic imposed on the
+ * network. Most people will not want to touch this. */
+void aui_service_dialog_set_resolve_service(AuiServiceDialog *d, gboolean resolve);
+
+/** Query the last status of aui_service_dialog_set_resolve_service() */
+gboolean aui_service_dialog_get_resolve_service(AuiServiceDialog *d);
+
+/** Disable/Enable automatic host name resolving. Disabling this
+ * feature will cause aui_service_dialog_get_address() return NULL in
+ * all case because avahi-ui will not resolve the host name of the
+ * selected service to an address. This is a slight optimization
+ * regarding the traffic imposed by this query to the network. By
+ * default, avahi-ui will resolve the host names of selected services. */
+void aui_service_dialog_set_resolve_host_name(AuiServiceDialog *d, gboolean resolve);
+
+/** Query the last status of aui_service_dialog_set_resolve_host_name() */
+gboolean aui_service_dialog_get_resolve_host_name(AuiServiceDialog *d);
+
+/** Select the address family to look for services of. This can be
+used to look only for IPv6 services or only for IPv4 services. By
+default avahi-ui will browse for both IPv4 and IPv6 services.*/
+void aui_service_dialog_set_address_family(AuiServiceDialog *d, AvahiProtocol proto);
+
+/** Query the address family we're looking for. */
+AvahiProtocol aui_service_dialog_get_address_family(AuiServiceDialog *d);
+
+G_END_DECLS
+
+#endif
+
+
diff --git a/avahi-ui/zssh.c b/avahi-ui/zssh.c
new file mode 100644
index 0000000..b49d332
--- /dev/null
+++ b/avahi-ui/zssh.c
@@ -0,0 +1,140 @@
+/* $Id$ */
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with avahi; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+
+#include <avahi-client/client.h>
+#include <avahi-common/strlst.h>
+#include <avahi-common/malloc.h>
+#include <avahi-common/domain.h>
+
+#include "avahi-ui.h"
+
+int main(int argc, char*argv[]) {
+ GtkWidget *d;
+
+ gtk_init(&argc, &argv);
+
+ if (g_str_has_suffix(argv[0], "zvnc")) {
+ d = aui_service_dialog_new("Choose VNC server", NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT, NULL);
+ aui_service_dialog_set_browse_service_types(AUI_SERVICE_DIALOG(d), "_rfb._tcp", NULL);
+ } else {
+ d = aui_service_dialog_new("Choose SSH server", NULL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CONNECT, GTK_RESPONSE_ACCEPT, NULL);
+ aui_service_dialog_set_browse_service_types(AUI_SERVICE_DIALOG(d), "_ssh._tcp", NULL);
+ }
+
+ aui_service_dialog_set_resolve_service(AUI_SERVICE_DIALOG(d), TRUE);
+ aui_service_dialog_set_resolve_host_name(AUI_SERVICE_DIALOG(d), !avahi_nss_support());
+
+ gtk_window_present(GTK_WINDOW(d));
+
+ if (gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_ACCEPT) {
+ char a[AVAHI_ADDRESS_STR_MAX], *u = NULL, *n = NULL;
+ char *h = NULL, *t = NULL;
+ const AvahiStringList *txt;
+
+ t = g_strdup(aui_service_dialog_get_service_type(AUI_SERVICE_DIALOG(d)));
+ n = g_strdup(aui_service_dialog_get_service_name(AUI_SERVICE_DIALOG(d)));
+
+ if (avahi_nss_support())
+ h = g_strdup(aui_service_dialog_get_host_name(AUI_SERVICE_DIALOG(d)));
+ else
+ h = g_strdup(avahi_address_snprint(a, sizeof(a), aui_service_dialog_get_address(AUI_SERVICE_DIALOG(d))));
+
+ g_print("Connecting to '%s' ...\n", n);
+
+ if (avahi_domain_equal(t, "_rfb._tcp")) {
+ char p[AVAHI_DOMAIN_NAME_MAX+16];
+ snprintf(p, sizeof(p), "%s:%u", h, aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d))-5900);
+
+ gtk_widget_destroy(d);
+
+ g_print("xvncviewer %s\n", p);
+ execlp("xvncviewer", "xvncviewer", p, NULL);
+
+ } else {
+ char p[16];
+
+ snprintf(p, sizeof(p), "%u", aui_service_dialog_get_port(AUI_SERVICE_DIALOG(d)));
+
+ for (txt = aui_service_dialog_get_txt_data(AUI_SERVICE_DIALOG(d)); txt; txt = txt->next) {
+ char *key, *value;
+
+ if (avahi_string_list_get_pair((AvahiStringList*) txt, &key, &value, NULL) < 0)
+ break;
+
+ if (strcmp(key, "u") == 0)
+ u = g_strdup(value);
+
+ avahi_free(key);
+ avahi_free(value);
+ }
+
+ gtk_widget_destroy(d);
+
+ if (u) {
+ g_print("ssh -p %s -l %s %s\n", p, u, h);
+
+ if (isatty(0) || !getenv("DISPLAY"))
+ execlp("ssh", "ssh", "-p", p, "-l", u, h, NULL);
+ else {
+ execlp("x-terminal-emulator", "x-terminal-emulator", "-T", n, "-e", "ssh", "-p", p, "-l", u, h, NULL);
+ execlp("gnome-terminal", "gnome-terminal", "-t", n, "-x", "ssh", "-p", p, "-l", u, h, NULL);
+ execlp("xterm", "xterm", "-T", n, "-e", "ssh", "-p", p, "-l", u, h, NULL);
+ }
+ } else {
+ g_print("ssh -p %s %s\n", p, h);
+
+ if (isatty(0) || !getenv("DISPLAY"))
+ execlp("ssh", "ssh", "-p", p, h, NULL);
+ else {
+ execlp("x-terminal-emulator", "x-terminal-emulator", "-T", n, "-e", "ssh", "-p", p, h, NULL);
+ execlp("gnome-terminal", "gnome-terminal", "-t", n, "-x", "ssh", "-p", p, h, NULL);
+ execlp("xterm", "xterm", "-T", n, "-e", "ssh", "-p", p, h, NULL);
+ }
+ }
+ }
+
+ g_warning("execlp() failed: %s\n", strerror(errno));
+
+ g_free(h);
+ g_free(u);
+ g_free(t);
+ g_free(n);
+
+ } else {
+ gtk_widget_destroy(d);
+
+ g_print("Canceled.\n");
+ }
+
+ return 1;
+
+}
diff --git a/avahi-ui/zssh.desktop.in b/avahi-ui/zssh.desktop.in
new file mode 100644
index 0000000..4571089
--- /dev/null
+++ b/avahi-ui/zssh.desktop.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=Avahi SSH Server Browser
+Comment=Browse for Zeroconf-enabled SSH Servers
+Exec=@bindir@/zssh
+Terminal=false
+Type=Application
+Icon=network-wired
+Categories=GNOME;Application;System;Utility;
+StartupNotify=false
+GenericName=
diff --git a/avahi-ui/zvnc.desktop.in b/avahi-ui/zvnc.desktop.in
new file mode 100644
index 0000000..cbeed4c
--- /dev/null
+++ b/avahi-ui/zvnc.desktop.in
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=Avahi VNC Server Browser
+Comment=Browse for Zeroconf-enabled VNC Servers
+Exec=@bindir@/zvnc
+Terminal=false
+Type=Application
+Icon=network-wired
+Categories=GNOME;Application;System;Utility;
+StartupNotify=false
+GenericName=
diff --git a/avahi-utils/Makefile.am b/avahi-utils/Makefile.am
index 61268d3..3d371b0 100644
--- a/avahi-utils/Makefile.am
+++ b/avahi-utils/Makefile.am
@@ -24,7 +24,7 @@ AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
if HAVE_DBUS
-bin_PROGRAMS = avahi-browse avahi-resolve avahi-publish
+bin_PROGRAMS = avahi-browse avahi-resolve avahi-publish avahi-set-host-name
avahi_browse_SOURCES = avahi-browse.c sigint.c sigint.h
avahi_browse_CFLAGS = $(AM_CFLAGS)
@@ -36,6 +36,11 @@ avahi_browse_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\"
avahi_browse_LDADD += -lgdbm
endif
+if HAVE_DBM
+avahi_browse_SOURCES += stdb.h stdb.c
+avahi_browse_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\"
+endif
+
avahi_resolve_SOURCES = avahi-resolve.c sigint.c sigint.h
avahi_resolve_CFLAGS = $(AM_CFLAGS)
avahi_resolve_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
@@ -44,6 +49,10 @@ avahi_publish_SOURCES = avahi-publish.c sigint.c sigint.h
avahi_publish_CFLAGS = $(AM_CFLAGS)
avahi_publish_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
+avahi_set_host_name_SOURCES = avahi-set-host-name.c sigint.c sigint.h
+avahi_set_host_name_CFLAGS = $(AM_CFLAGS)
+avahi_set_host_name_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
+
install-exec-local:
cd $(DESTDIR)/$(bindir) && \
rm -f avahi-resolve-host-name avahi-resolve-address avahi-browse-domains avahi-publish-address avahi-publish-service && \
diff --git a/avahi-utils/avahi-browse.c b/avahi-utils/avahi-browse.c
index 7abd53e..71964e6 100644
--- a/avahi-utils/avahi-browse.c
+++ b/avahi-utils/avahi-browse.c
@@ -43,7 +43,7 @@
#include "sigint.h"
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
#include "stdb.h"
#endif
@@ -53,6 +53,9 @@ typedef enum {
COMMAND_BROWSE_SERVICES,
COMMAND_BROWSE_ALL_SERVICES,
COMMAND_BROWSE_DOMAINS
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ , COMMAND_DUMP_STDB
+#endif
} Command;
typedef struct Config {
@@ -65,7 +68,7 @@ typedef struct Config {
Command command;
int resolve;
int no_fail;
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
int no_db_lookup;
#endif
} Config;
@@ -138,7 +141,7 @@ static ServiceInfo *find_service(AvahiIfIndex interface, AvahiProtocol protocol,
static void print_service_line(Config *config, char c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
char ifname[IF_NAMESIZE];
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
if (!config->no_db_lookup)
type = stdb_lookup(type);
#endif
@@ -148,6 +151,7 @@ static void print_service_line(Config *config, char c, AvahiIfIndex interface, A
interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a",
n_columns-35, name, type, domain);
+ fflush(stdout);
}
static void service_resolver_callback(
@@ -206,6 +210,7 @@ static void service_resolver_callback(
assert(n_resolving > 0);
n_resolving--;
check_terminate(i->config);
+ fflush(stdout);
}
static ServiceInfo *add_service(Config *c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
@@ -579,7 +584,11 @@ static void help(FILE *f, const char *argv0) {
fprintf(f,
"%s [options] <service type>\n"
"%s [options] -a\n"
- "%s [options] -D\n\n",
+ "%s [options] -D\n"
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ "%s [options] -b\n",
+#endif
+ "\n",
argv0, argv0, argv0);
fprintf(f,
@@ -594,8 +603,9 @@ static void help(FILE *f, const char *argv0) {
" -l --ignore-local Ignore local services\n"
" -r --resolve Resolve services found\n"
" -f --no-fail Don't fail if the daemon is not available\n"
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
" -k --no-db-lookup Don't lookup service types\n"
+ " -b --dump-db Dump service type database\n"
#endif
);
}
@@ -615,8 +625,9 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
{ "ignore-local", no_argument, NULL, 'l' },
{ "resolve", no_argument, NULL, 'r' },
{ "no-fail", no_argument, NULL, 'f' },
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
{ "no-db-lookup", no_argument, NULL, 'k' },
+ { "dump-db", no_argument, NULL, 'b' },
#endif
{ NULL, 0, NULL, 0 }
};
@@ -632,14 +643,13 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
c->no_fail = 0;
c->domain = c->stype = NULL;
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
c->no_db_lookup = 0;
#endif
- opterr = 0;
while ((o = getopt_long(argc, argv, "hVd:avtclrDf"
-#ifdef HAVE_GDBM
- "k"
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ "kb"
#endif
, long_options, NULL)) >= 0) {
@@ -678,13 +688,15 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
case 'f':
c->no_fail = 1;
break;
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
case 'k':
c->no_db_lookup = 1;
break;
+ case 'b':
+ c->command = COMMAND_DUMP_STDB;
+ break;
#endif
default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
return -1;
}
}
@@ -760,6 +772,23 @@ int main(int argc, char *argv[]) {
avahi_simple_poll_loop(simple_poll);
ret = 0;
break;
+
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ case COMMAND_DUMP_STDB: {
+ char *t;
+ stdb_setent();
+
+ while ((t = stdb_getent())) {
+ if (config.no_db_lookup)
+ printf("%s\n", t);
+ else
+ printf("%s\n", stdb_lookup(t));
+ }
+
+ ret = 0;
+ break;
+ }
+#endif
}
@@ -781,7 +810,7 @@ fail:
avahi_string_list_free(browsed_types);
-#ifdef HAVE_GDBM
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
stdb_shutdown();
#endif
diff --git a/avahi-utils/avahi-publish.c b/avahi-utils/avahi-publish.c
index 9ca2df2..4e75176 100644
--- a/avahi-utils/avahi-publish.c
+++ b/avahi-utils/avahi-publish.c
@@ -189,7 +189,11 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
if (config->verbose)
fprintf(stderr, "Host name conflict\n");
+
+ /* Fall through */
+ case AVAHI_CLIENT_S_REGISTERING:
+
if (entry_group) {
avahi_entry_group_free(entry_group);
entry_group = NULL;
@@ -200,9 +204,9 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
if (config->verbose)
fprintf(stderr, "Waiting for daemon ...\n");
+
break;
- case AVAHI_CLIENT_S_REGISTERING:
;
}
}
@@ -252,7 +256,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
c->port = 0;
c->txt = c->subtypes = NULL;
- opterr = 0;
while ((o = getopt_long(argc, argv, "hVsavd:H:f", long_options, NULL)) >= 0) {
switch(o) {
@@ -286,7 +289,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
c->subtypes = avahi_string_list_add(c->subtypes, optarg);
break;
default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
return -1;
}
}
diff --git a/avahi-utils/avahi-resolve.c b/avahi-utils/avahi-resolve.c
index 2dafbf0..47e7ebf 100644
--- a/avahi-utils/avahi-resolve.c
+++ b/avahi-utils/avahi-resolve.c
@@ -43,10 +43,6 @@
#include "sigint.h"
-#ifdef HAVE_GDBM
-#include "stdb.h"
-#endif
-
typedef enum {
COMMAND_UNSPEC,
COMMAND_HELP,
@@ -190,7 +186,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
c->proto = AVAHI_PROTO_UNSPEC;
c->verbose = 0;
- opterr = 0;
while ((o = getopt_long(argc, argv, "hVnav46", long_options, NULL)) >= 0) {
switch(o) {
@@ -216,7 +211,6 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
c->proto = AVAHI_PROTO_INET6;
break;
default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
return -1;
}
}
diff --git a/trunk/avahi-utils/avahi-set-host-name.c b/avahi-utils/avahi-set-host-name.c
index 06f5322..bad6e4f 100644
--- a/trunk/avahi-utils/avahi-set-host-name.c
+++ b/avahi-utils/avahi-set-host-name.c
@@ -93,7 +93,6 @@ static int parse_command_line(Config *c, int argc, char *argv[]) {
c->command = COMMAND_UNSPEC;
c->verbose = 0;
- opterr = 0;
while ((o = getopt_long(argc, argv, "hVv", long_options, NULL)) >= 0) {
switch(o) {
@@ -107,7 +106,6 @@ static int parse_command_line(Config *c, int argc, char *argv[]) {
c->verbose = 1;
break;
default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
return -1;
}
}
diff --git a/avahi-utils/stdb.c b/avahi-utils/stdb.c
index 53be776..a420364 100644
--- a/avahi-utils/stdb.c
+++ b/avahi-utils/stdb.c
@@ -19,7 +19,14 @@
USA.
***/
+#include <config.h>
+#ifdef HAVE_GDBM
#include <gdbm.h>
+#endif
+#ifdef HAVE_DBM
+#include <ndbm.h>
+#include <fcntl.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <locale.h>
@@ -29,16 +36,31 @@
#include "stdb.h"
+#ifdef HAVE_GDBM
static GDBM_FILE gdbm_file = NULL;
+#endif
+#ifdef HAVE_DBM
+static DBM *dbm_file = NULL;
+#endif
static char *buffer = NULL;
+static char *enum_key = NULL;
static int init(void) {
+#ifdef HAVE_GDBM
if (gdbm_file)
return 0;
if (!(gdbm_file = gdbm_open((char*) DATABASE_FILE, 0, GDBM_READER, 0, NULL)))
return -1;
+#endif
+#ifdef HAVE_DBM
+ if (dbm_file)
+ return 0;
+
+ if (!(dbm_file = dbm_open((char*) DATABASE_FILE, O_RDONLY, 0)))
+ return -1;
+#endif
return 0;
}
@@ -59,7 +81,12 @@ const char* stdb_lookup(const char *name) {
snprintf(k, sizeof(k), "%s[%s]", name, loc);
key.dptr = k;
key.dsize = strlen(k);
+#ifdef HAVE_GDBM
data = gdbm_fetch(gdbm_file, key);
+#endif
+#ifdef HAVE_DBM
+ data = dbm_fetch(dbm_file, key);
+#endif
if (!data.dptr) {
char l[32], *e;
@@ -70,7 +97,12 @@ const char* stdb_lookup(const char *name) {
snprintf(k, sizeof(k), "%s[%s]", name, l);
key.dptr = k;
key.dsize = strlen(k);
+#ifdef HAVE_GDBM
data = gdbm_fetch(gdbm_file, key);
+#endif
+#ifdef HAVE_DBM
+ data = dbm_fetch(dbm_file, key);
+#endif
}
if (!data.dptr) {
@@ -79,7 +111,12 @@ const char* stdb_lookup(const char *name) {
snprintf(k, sizeof(k), "%s[%s]", name, l);
key.dptr = k;
key.dsize = strlen(k);
+#ifdef HAVE_GDBM
data = gdbm_fetch(gdbm_file, key);
+#endif
+#ifdef HAVE_DBM
+ data = dbm_fetch(dbm_file, key);
+#endif
}
}
}
@@ -88,7 +125,12 @@ const char* stdb_lookup(const char *name) {
if (!data.dptr) {
key.dptr = (char*) name;
key.dsize = strlen(name);
+#ifdef HAVE_GDBM
data = gdbm_fetch(gdbm_file, key);
+#endif
+#ifdef HAVE_DBM
+ data = dbm_fetch(dbm_file, key);
+#endif
}
if (!data.dptr)
@@ -106,8 +148,67 @@ fail:
}
void stdb_shutdown(void) {
+#ifdef HAVE_GDBM
if (gdbm_file)
gdbm_close(gdbm_file);
+ gdbm_file = NULL;
+#endif
+#ifdef HAVE_DBM
+ if (dbm_file)
+ dbm_close(dbm_file);
+
+ dbm_file = NULL;
+#endif
+
avahi_free(buffer);
+ avahi_free(enum_key);
+
+ buffer = enum_key = NULL;
+}
+
+char *stdb_getent(void) {
+ datum key;
+
+ if (init() < 0)
+ return NULL;
+
+ for (;;) {
+
+ if (!enum_key) {
+#ifdef HAVE_GDBM
+ key = gdbm_firstkey(gdbm_file);
+#endif
+#ifdef HAVE_DBM
+ key = dbm_firstkey(dbm_file);
+#endif
+ } else {
+ key.dptr = enum_key;
+ key.dsize = strlen(enum_key);
+
+#ifdef HAVE_GDBM
+ key = gdbm_nextkey(gdbm_file, key);
+#endif
+#ifdef HAVE_DBM
+ key = dbm_nextkey(dbm_file, key);
+#endif
+ }
+
+ avahi_free(enum_key);
+ enum_key = NULL;
+
+ if (!key.dptr)
+ return NULL;
+
+ enum_key = avahi_strndup(key.dptr, key.dsize);
+ free(key.dptr);
+
+ if (!strchr(enum_key, '['))
+ return enum_key;
+ }
+}
+
+void stdb_setent(void) {
+ avahi_free(enum_key);
+ enum_key = NULL;
}
diff --git a/avahi-utils/stdb.h b/avahi-utils/stdb.h
index 92c2651..3f8ccc0 100644
--- a/avahi-utils/stdb.h
+++ b/avahi-utils/stdb.h
@@ -26,5 +26,7 @@
const char* stdb_lookup(const char *name);
void stdb_shutdown(void);
+char *stdb_getent(void);
+void stdb_setent(void);
#endif
diff --git a/common/acx_pthread.m4 b/common/acx_pthread.m4
index a96d31d..dcf6332 100644
--- a/common/acx_pthread.m4
+++ b/common/acx_pthread.m4
@@ -43,7 +43,7 @@ dnl We are also grateful for the helpful feedback of numerous users.
dnl
dnl @category InstalledPackages
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
-dnl @version 2005-06-15
+dnl @version 2006-05-29
dnl @license GPLWithACException
dnl
dnl Checks for GCC shared/pthread inconsistency based on work by
@@ -219,19 +219,24 @@ if test "x$acx_pthread_ok" = xyes; then
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: must compile with cc_r
- AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+ # More AIX lossage: must compile with xlc_r or cc_r
+ if test x"$GCC" != xyes; then
+ AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
+ else
+ PTHREAD_CC=$CC
+ fi
# The next part tries to detect GCC inconsistency with -shared on some
# architectures and systems. The problem is that in certain
# configurations, when -shared is specified, GCC "forgets" to
# internally use various flags which are still necessary.
- # First, check whether caller wants us to skip -shared checks
- # this is useful
AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
- if test x"$3" = x1; then
+ check_inconsistencies=yes
+ case "${host_cpu}-${host_os}" in
+ *-darwin*) check_inconsistencies=no ;;
+ esac
+ if test x"$GCC" != xyes -o "x$check_inconsistencies" != xyes ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
diff --git a/common/doxygen.m4 b/common/doxygen.m4
index e4688de..e9c56c2 100644
--- a/common/doxygen.m4
+++ b/common/doxygen.m4
@@ -78,7 +78,7 @@ AC_DEFUN([DX_REQUIRE_PROG], [
AC_PATH_TOOL([$1], [$2])
if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
- AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0)
+ AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0)
fi
])
@@ -101,7 +101,7 @@ test "$DX_FLAG_$1" = "$2" \
# ----------------------------------------------------------
# Turn off the DX_CURRENT_FEATURE if the required feature is off.
AC_DEFUN([DX_CLEAR_DEPEND], [
-test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0)
+test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0)
])
# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
diff --git a/common/gcc_stack_protect.m4 b/common/gcc_stack_protect.m4
new file mode 100644
index 0000000..13c5e0a
--- /dev/null
+++ b/common/gcc_stack_protect.m4
@@ -0,0 +1,99 @@
+dnl
+dnl Useful macros for autoconf to check for ssp-patched gcc
+dnl 1.0 - September 2003 - Tiago Sousa <mirage@kaotik.org>
+dnl 1.1 - August 2006 - Ted Percival <ted@midg3t.net>
+dnl * Stricter language checking (C or C++)
+dnl * Adds GCC_STACK_PROTECT_LIB to add -lssp to LDFLAGS as necessary
+dnl * Caches all results
+dnl * Uses macros to ensure correct ouput in quiet/silent mode
+dnl 1.2 - April 2007 - Ted Percival <ted@midg3t.net>
+dnl * Added GCC_STACK_PROTECTOR macro for simpler (one-line) invocation
+dnl * GCC_STACK_PROTECT_LIB now adds -lssp to LIBS rather than LDFLAGS
+dnl
+dnl About ssp:
+dnl GCC extension for protecting applications from stack-smashing attacks
+dnl http://www.research.ibm.com/trl/projects/security/ssp/
+dnl
+dnl Usage:
+dnl Most people will simply call GCC_STACK_PROTECTOR.
+dnl If you only use one of C or C++, you can save time by only calling the
+dnl macro appropriate for that language. In that case you should also call
+dnl GCC_STACK_PROTECT_LIB first.
+dnl
+dnl GCC_STACK_PROTECTOR
+dnl Tries to turn on stack protection for C and C++ by calling the following
+dnl three macros with the right languages.
+dnl
+dnl GCC_STACK_PROTECT_CC
+dnl checks -fstack-protector with the C compiler, if it exists then updates
+dnl CFLAGS and defines ENABLE_SSP_CC
+dnl
+dnl GCC_STACK_PROTECT_CXX
+dnl checks -fstack-protector with the C++ compiler, if it exists then updates
+dnl CXXFLAGS and defines ENABLE_SSP_CXX
+dnl
+dnl GCC_STACK_PROTECT_LIB
+dnl adds -lssp to LIBS if it is available
+dnl ssp is usually provided as part of libc, but was previously a separate lib
+dnl It does not hurt to add -lssp even if libc provides SSP - in that case
+dnl libssp will simply be ignored.
+dnl
+
+AC_DEFUN([GCC_STACK_PROTECT_LIB],[
+ AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib,
+ [ssp_old_libs="$LIBS"
+ LIBS="$LIBS -lssp"
+ AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no)
+ LIBS="$ssp_old_libs"
+ ])
+ if test $ssp_cv_lib = yes; then
+ LIBS="$LIBS -lssp"
+ fi
+])
+
+AC_DEFUN([GCC_STACK_PROTECT_CC],[
+ AC_LANG_ASSERT(C)
+ if test "X$CC" != "X"; then
+ AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector],
+ ssp_cv_cc,
+ [ssp_old_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS -fstack-protector"
+ AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
+ CFLAGS="$ssp_old_cflags"
+ ])
+ if test $ssp_cv_cc = yes; then
+ CFLAGS="$CFLAGS -fstack-protector"
+ AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
+ fi
+ fi
+])
+
+AC_DEFUN([GCC_STACK_PROTECT_CXX],[
+ AC_LANG_ASSERT(C++)
+ if test "X$CXX" != "X"; then
+ AC_CACHE_CHECK([whether ${CXX} accepts -fstack-protector],
+ ssp_cv_cxx,
+ [ssp_old_cxxflags="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -fstack-protector"
+ AC_TRY_COMPILE(,, ssp_cv_cxx=yes, ssp_cv_cxx=no)
+ CXXFLAGS="$ssp_old_cxxflags"
+ ])
+ if test $ssp_cv_cxx = yes; then
+ CXXFLAGS="$CXXFLAGS -fstack-protector"
+ AC_DEFINE([ENABLE_SSP_CXX], 1, [Define if SSP C++ support is enabled.])
+ fi
+ fi
+])
+
+AC_DEFUN([GCC_STACK_PROTECTOR],[
+ GCC_STACK_PROTECT_LIB
+
+ AC_LANG_PUSH([C])
+ GCC_STACK_PROTECT_CC
+ AC_LANG_POP([C])
+
+ AC_LANG_PUSH([C++])
+ GCC_STACK_PROTECT_CXX
+ AC_LANG_POP([C++])
+])
+
diff --git a/configure.ac b/configure.ac
index 6412acf..81954a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,19 +21,22 @@
# USA.
AC_PREREQ(2.57)
-AC_INIT([avahi],[0.6.10],[avahi (at) lists (dot) freedesktop (dot) org])
+AC_INIT([avahi],[0.6.18],[avahi (at) lists (dot) freedesktop (dot) org])
AC_CONFIG_SRCDIR([avahi-core/server.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign 1.9 -Wall])
AC_SUBST(PACKAGE_URL, [http://avahi.org/])
-AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [7:0:4])
-AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [4:2:0])
-AC_SUBST(LIBAVAHI_CLIENT_VERSION_INFO, [4:2:1])
-AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:0:0])
+AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [7:4:4])
+AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [5:1:0])
+AC_SUBST(LIBAVAHI_CLIENT_VERSION_INFO, [5:2:2])
+AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:1:0])
AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:1:0])
AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:1:0])
+AC_SUBST(LIBAVAHI_UI_VERSION_INFO, [0:0:0])
+
+# Do not touch these, since they we took this version-info from upstream HOWL/Bonjour
AC_SUBST(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO, [1:0:0])
AC_SUBST(LIBAVAHI_COMPAT_HOWL_VERSION_INFO, [0:0:0])
AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
@@ -53,9 +56,92 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_GCC_TRADITIONAL
+# -fstack-protector
+AC_ARG_ENABLE([stack-protector],
+ [AS_HELP_STRING([--disable-stack-protector],
+ [Disable GCC's/libc's stack-smashing protection])],
+ [case "${enableval}" in
+ yes) enable_ssp=yes ;;
+ no) enable_ssp=no ;;
+ *) AC_MSG_ERROR([invalid value ${enableval} for --disable-stack-protector]) ;;
+ esac],
+ [enable_ssp=yes])
+
+if test x"$enable_ssp" = x"yes" && test x"$GCC" != x"yes"; then
+ AC_MSG_NOTICE([Disabling stack-smashing protection because compiler is not GCC])
+ enable_ssp=no
+fi
+
+if test x"$enable_ssp" = x"yes"; then
+ # Check for broken ssp in libc: http://www.avahi.org/ticket/105
+ # libc's brokenness will get in the way regardless of whether -lssp is
+ # provided, but provide it anyway (otherwise non-libc ssp would wrongly
+ # break here)
+
+ # Get -lssp if it exists
+ GCC_STACK_PROTECT_LIB
+
+ AC_MSG_CHECKING([whether stack-smashing protection is available])
+ ssp_old_cflags="$CFLAGS"
+ ssp_old_ldflags="$LDFLAGS"
+ CFLAGS="$CFLAGS -fstack-protector-all -fPIC"
+ LDFLAGS="$LDFLAGS -Wl,-z,defs"
+ cat confdefs.h > conftest.c
+ cat >>conftest.c <<_ACEOF
+void test_broken_ssp(c)
+ const char *c;
+{
+ char arr[[123]], *p; /* beware of possible double-braces if copying this */
+ for (p = arr; *c; ++p) {
+ *p = *c;
+ ++c;
+ }
+}
+_ACEOF
+ rm -f conftest.o
+
+ if $CC -c $CFLAGS $CPPFLAGS -o conftest.o conftest.c >/dev/null 2>&1; then
+ AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([whether stack-smashing protection is buggy])
+ if $CC -o conftest.so $LDFLAGS -shared conftest.o $LIBS >/dev/null 2>&1; then
+ AC_MSG_RESULT([no])
+ else
+ AC_MSG_RESULT([yes])
+ enable_ssp=no
+ fi
+ else
+ AC_MSG_RESULT([no])
+ fi
+
+ rm -f conftest.c conftest.o conftest.so
+
+ CFLAGS="$ssp_old_cflags"
+ LDFLAGS="$ssp_old_ldflags"
+fi
+
+if test x"$enable_ssp" = x"yes"; then
+ # Do this the long way so we don't call GCC_STACK_PROTECT_LIB twice
+ GCC_STACK_PROTECT_CC
+
+ AC_LANG_PUSH([C++])
+ GCC_STACK_PROTECT_CXX
+ AC_LANG_POP([C++])
+ # XXX: Update the enable_ssp value now for output later?
+fi
+
# libtool stuff
AC_PROG_LIBTOOL
+AC_CACHE_CHECK([whether the C++ compiler works], [avahi_cv_sys_cxx_works], [
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([int main() { return 0; }], [avahi_cv_sys_cxx_works=yes],
+ [avahi_cv_sys_cxx_works=no])
+ AC_LANG_POP([C++])
+ ])
+[ if [ "x$avahi_cv_sys_cxx_works" = "xno" ]; then ]
+ AC_MSG_FAILURE([The C++ compiler does not work])
+[ fi ]
+
ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
#
@@ -104,11 +190,27 @@ AC_DEFINE([HAVE_SYS_SYSCTL_H],[],[Support for sys/sysctl.h])
, [], [
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/param.h>
])
AM_CONDITIONAL(HAVE_SYS_SYSCTL_H, [ test x"$HAVE_SYS_SYSCTL_H" = xyes ])
#
+# Check for lifconf struct; only present on Solaris
+#
+AC_MSG_CHECKING(for struct lifconf)
+AC_CACHE_VAL(avahi_cv_has_struct_lifconf,
+[AC_TRY_COMPILE(
+[#include <sys/socket.h>
+#include <net/if.h>
+],[sizeof (struct lifconf);],
+avahi_cv_has_struct_lifconf=yes,avahi_cv_has_struct_lifconf=no)])
+AC_MSG_RESULT($avahi_cv_has_struct_lifconf)
+if test $avahi_cv_has_struct_lifconf = yes; then
+ AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
+fi
+
+#
# Check for struct ip_mreqn
#
AC_MSG_CHECKING(for struct ip_mreqn)
@@ -164,7 +266,7 @@ case $with_distro in
AC_MSG_ERROR([Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO, set DISTRO to none if your distribution is not supported.])
;;
*)
- AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
+ AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and D-Bus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
;;
esac
@@ -190,7 +292,7 @@ test_gcc_flag() {
# If using GCC specify some additional parameters
if test "x$GCC" = "xyes" ; then
- DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline"
+ DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline -fPIC"
if test "x$HAVE_NETLINK" = "xyes" ; then
# Test whether rtnetlink.h can be included when compiled with -std=c99
@@ -267,6 +369,16 @@ if test "x$HAVE_DLOPEN" = "xyes" ; then
fi
AM_CONDITIONAL(HAVE_DLOPEN, test "x$HAVE_DLOPEN" = "xyes")
+have_inotify=no
+AC_CHECK_HEADERS([linux/inotify.h], [have_inotify=yes])
+AC_CHECK_HEADERS([sys/inotify.h], [have_inotify=yes])
+
+AM_CONDITIONAL(HAVE_INOTIFY, test "x$have_inotify" = "xyes")
+
+if test "x$have_inotify" = "xyes" ; then
+ AC_DEFINE([HAVE_INOTIFY], 1, [Enable Linux inotify() usage])
+fi
+
# Check for pkg-config manually first, as if its not installed the
# PKG_PROG_PKG_CONFIG macro won't be defined.
AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
@@ -372,10 +484,10 @@ fi
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
#
-# D-BUS
+# D-Bus
#
AC_ARG_ENABLE(dbus,
- AS_HELP_STRING([--disable-dbus],[Disable use of D-BUS]),
+ AS_HELP_STRING([--disable-dbus],[Disable use of D-Bus]),
[case "${enableval}" in
yes) HAVE_DBUS=yes ;;
no) HAVE_DBUS=no ;;
@@ -383,8 +495,8 @@ AC_ARG_ENABLE(dbus,
esac],
[HAVE_DBUS=yes])
-AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
-AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=<address>], [where the dbus system socket is, you probably want to put unix:path= at the start]))
+AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [Path to D-Bus system.d directory]))
+AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=<address>], [Path to the D-Bus system socket, you probably want to put unix:path= at the start. Only needed for very old D-Bus releases]))
DBUS_VERSION="Disabled"
DBUS_SYS_DIR="Disabled"
@@ -392,7 +504,7 @@ DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="Disabled"
if test "x$HAVE_DBUS" = "xyes" ; then
PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.34 ])
- AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not])
+ AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-Bus or not])
DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
DBUS_VERSION_MAJOR=`echo $DBUS_VERSION | awk -F. '{print $1}'`
@@ -409,16 +521,16 @@ if test "x$HAVE_DBUS" = "xyes" ; then
fi
if test "z$DBUS_VERSION_MAJOR" = "z0" -a "z$DBUS_VERSION_MINOR" = "z0" -a "z$DBUS_VERSION_MICRO" = "z0"; then
- echo "Error: Couldn't determine the version of your DBUS package."
+ echo "Error: Couldn't determine the version of your D-Bus package."
echo " This is probably an error in this script, please report it"
echo " along with the following information:"
- echo " Base DBUS version ='$DBUS_VERSION'"
+ echo " Base D-Buss version ='$DBUS_VERSION'"
echo " DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
echo " DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
echo " DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
exit 1
else
- echo "Your dbus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
+ echo "Your D-Bus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
@@ -438,11 +550,11 @@ if test "x$HAVE_DBUS" = "xyes" ; then
if ! test -z "$with_dbus_system_address" ; then
DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$with_dbus_system_address"
else
- # This is ugly, but D-BUS doesn't export this address for us
+ # This is ugly, but D-Bus doesn't export this address for us
# so we have to guess, pretty much all setups i've seen have
# it in /var/lib/dbus or /var/run/dbus, and its defaulted to
# /var/run upstream so we will try guess first then default
- # to /var/run/dbus
+ # to /var/run/dbus.
DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"
TRY_SOCKETS="/var/lib/dbus/system_bus_socket /var/run/dbus/system_bus_socket ${localstatedir}/run/dbus/system_bus_socket ${prefix}/var/run/dbus/system_bus_socket"
@@ -454,6 +566,10 @@ if test "x$HAVE_DBUS" = "xyes" ; then
fi
AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
+ SAVED_LIBS="$LIBS"
+ LIBS="$LIBS $DBUS_LIBS"
+ AC_CHECK_FUNCS([dbus_connection_close dbus_bus_get_private])
+ LIBS="$SAVED_LIBS"
fi
AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
@@ -481,24 +597,49 @@ AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
#
# GDBM
#
+#
+# Check for dbm
+#
+AC_ARG_ENABLE(dbm,
+ AS_HELP_STRING([--enable-dbm],[Enable use of DBM]),
+ [case "${enableval}" in
+ yes) HAVE_DBM=yes ;;
+ no) HAVE_DBM=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbm) ;;
+ esac],
+ [HAVE_DBM=no])
+
AC_ARG_ENABLE(gdbm,
AS_HELP_STRING([--disable-gdbm],[Disable use of GDBM]),
[case "${enableval}" in
yes) HAVE_GDBM=yes ;;
no) HAVE_GDBM=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbm) ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-gdbm) ;;
esac],
[HAVE_GDBM=yes])
if test "x$HAVE_GDBM" = "xyes" ; then
+ if test "x$HAVE_DBM" = "xyes" ; then
+ AC_MSG_ERROR([*** --enable-gdbm and --enable-dbm both specified ***])
+ fi
AC_CHECK_LIB(gdbm, gdbm_open, [ AC_CHECK_HEADERS(gdbm.h, have_gdbm=true, have_gdbm=false) ], have_gdbm=false)
if ! $have_gdbm ; then
AC_MSG_ERROR([*** libgdbm not found ***])
fi
AC_DEFINE([HAVE_GDBM],[],[Support for GDBM])
+else
+ if test "x$HAVE_DBM" = "xyes" ; then
+ AC_CHECK_HEADERS(ndbm.h, have_dbm=true, have_dbm=false)
+
+ if ! $have_dbm ; then
+ AC_MSG_ERROR([*** dbm not found ***])
+ fi
+ AC_DEFINE([HAVE_DBM],[],[Support for DBM])
+ fi
fi
AM_CONDITIONAL(HAVE_GDBM, test "x$HAVE_GDBM" = "xyes")
+AM_CONDITIONAL(HAVE_DBM, test "x$HAVE_DBM" = "xyes")
#
# libdaemon
@@ -552,7 +693,7 @@ if test "x$HAVE_PYTHON" = "xyes" ; then
if test "x$HAVE_DBUS" = "xyes" ; then
AC_ARG_ENABLE(python-dbus,
- AS_HELP_STRING([--disable-python-dbus],[Disable use of D-BUS in Python]),
+ AS_HELP_STRING([--disable-python-dbus],[Disable use of D-Bus in Python]),
[case "${enableval}" in
yes) HAVE_PYTHON_DBUS=yes ;;
no) HAVE_PYTHON_DBUS=no ;;
@@ -568,6 +709,9 @@ if test "x$HAVE_PYTHON" = "xyes" ; then
if test "x$HAVE_GDBM" = "xyes"; then
AM_CHECK_PYMOD(gdbm,,,[AC_MSG_ERROR(Could not find Python module gdbm)])
fi
+ if test "x$HAVE_DBM" = "xyes"; then
+ AM_CHECK_PYMOD(dbm,,,[AC_MSG_ERROR(Could not find Python module dbm)])
+ fi
fi
fi
AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
@@ -632,9 +776,23 @@ fi
AM_CONDITIONAL(HAVE_MONODOC, test "x$HAVE_MONODOC" = "xyes")
#
-# Defining Avahi User and Group.
+# Build autoipd?
+#
+AC_ARG_ENABLE(autoipd,
+ AS_HELP_STRING([--disable-autoipd],[Disable building of avahi-autoipd]),
+ [case "${enableval}" in
+ yes) ENABLE_AUTOIPD=yes ;;
+ no) ENABLE_AUTOIPD=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-autoipd) ;;
+ esac],
+ [ENABLE_AUTOIPD=yes])
+
+AM_CONDITIONAL(ENABLE_AUTOIPD, test "x$ENABLE_AUTOIPD" = "xyes")
+
+#
+# Defining users and groups
#
-AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
+AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running avahi-daemon (avahi)]))
if test -z "$with_avahi_user" ; then
AVAHI_USER=avahi
else
@@ -643,7 +801,7 @@ fi
AC_SUBST(AVAHI_USER)
AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
-AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
+AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for running avahi-daemon (avahi)]))
if test -z "$with_avahi_group" ; then
AVAHI_GROUP=avahi
else
@@ -652,6 +810,33 @@ fi
AC_SUBST(AVAHI_GROUP)
AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
+AC_ARG_WITH(avahi_priv_access_group,AS_HELP_STRING([--with-avahi-priv-access-group=<group>],[Priviliged access group for Avahi clients (netdev)]))
+if test -z "$with_avahi_priv_access_group" ; then
+ AVAHI_PRIV_ACCESS_GROUP=netdev
+else
+ AVAHI_PRIV_ACCESS_GROUP=$with_avahi_priv_access_group
+fi
+AC_SUBST(AVAHI_PRIV_ACCESS_GROUP)
+AC_DEFINE_UNQUOTED(AVAHI_PRIV_ACCESS_GROUP,"$AVAHI_PRIV_ACCESS_GROUP", [Privileged access group for Avahi clients])
+
+AC_ARG_WITH(autoipd_user, AS_HELP_STRING([--with-autoipd-user=<user>],[User for running the avahi-autoipd daemon (avahi-autoipd)]))
+if test -z "$with_autoipd_user" ; then
+ AVAHI_AUTOIPD_USER=avahi-autoipd
+else
+ AVAHI_AUTOIPD_USER=$with_autoipd_user
+fi
+AC_SUBST(AVAHI_AUTOIPD_USER)
+AC_DEFINE_UNQUOTED(AVAHI_AUTOIPD_USER,"$AVAHI_AUTOIPD_USER", [User for running the avahi-autoipd daemon])
+
+AC_ARG_WITH(autoipd_group,AS_HELP_STRING([--with-autoipd-group=<group>],[Group for running the avahi-autoipd daemon (avahi-autoipd)]))
+if test -z "$with_autoipd_group" ; then
+ AVAHI_AUTOIPD_GROUP=avahi-autoipd
+else
+ AVAHI_AUTOIPD_GROUP=$with_autoipd_group
+fi
+AC_SUBST(AVAHI_AUTOIPD_GROUP)
+AC_DEFINE_UNQUOTED(AVAHI_AUTOIPD_GROUP,"$AVAHI_AUTOIPD_GROUP", [Group for running the avahi-autoipd daemon])
+
#
# Avahi runtime dir
#
@@ -681,6 +866,16 @@ DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
+AC_ARG_ENABLE(core-docs,
+ AS_HELP_STRING([--enable-core-docs],[Enable building of documentation for avahi-core]),
+[case "${enableval}" in
+ yes) ENABLE_CORE_DOCS=yes ;;
+ no) ENABLE_CORE_DOCS=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-core-docs]) ;;
+esac],[ENABLE_CORE_DOCS=no])
+
+AM_CONDITIONAL([ENABLE_CORE_DOCS], [test "x$ENABLE_CORE_DOCS" = xyes])
+
#
# Build and Install man pages
#
@@ -797,6 +992,8 @@ avahi-sharp/Makefile
avahi-compat-libdns_sd/Makefile
avahi-compat-howl/Makefile
avahi-compat-howl/samples/Makefile
+avahi-autoipd/Makefile
+avahi-ui/Makefile
])
AC_OUTPUT
@@ -804,32 +1001,38 @@ AC_OUTPUT
echo "
---{ $PACKAGE_NAME $VERSION }---
- prefix: ${prefix}
- sysconfdir: ${sysconfdir}
- localstatedir: ${localstatedir}
- avahi socket: ${avahi_socket}
- dbus-1 system.d dir: ${DBUS_SYS_DIR}
- dbus-1 version: ${DBUS_VERSION}
- dbus-1 system socket ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
- compiler: ${CC}
- cflags: ${CFLAGS}
- Enable GLIB: ${HAVE_GLIB}
- Enable GTK: ${HAVE_GTK}
- Enable D-BUS: ${HAVE_DBUS}
- Enable Expat: ${HAVE_EXPAT}
- Enable GDBM: ${HAVE_GDBM}
- Enable libdaemon: ${HAVE_LIBDAEMON}
- Enable Python: ${HAVE_PYTHON}
- Enable pygtk: ${HAVE_PYGTK}
- Enable python-dbus: ${HAVE_PYTHON_DBUS}
- Enable QT3: ${HAVE_QT3}
- Enable QT4: ${HAVE_QT4}
- Enable Mono: ${HAVE_MONO}
- Enable Monodoc: ${HAVE_MONODOC}
- Distribution/OS: ${with_distro}
- User for Avahi: ${AVAHI_USER}
- Group for Avahi: ${AVAHI_GROUP}
- Enable chroot(): ${enable_chroot}
+ prefix: ${prefix}
+ sysconfdir: ${sysconfdir}
+ localstatedir: ${localstatedir}
+ avahi socket: ${avahi_socket}
+ dbus-1 system.d dir: ${DBUS_SYS_DIR}
+ dbus-1 version: ${DBUS_VERSION}
+ dbus-1 system socket: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
+ C Compiler: ${CC}
+ CFLAGS: ${CFLAGS}
+ Enable GLIB: ${HAVE_GLIB}
+ Enable GTK: ${HAVE_GTK}
+ Enable D-Bus: ${HAVE_DBUS}
+ Enable Expat: ${HAVE_EXPAT}
+ Enable GDBM: ${HAVE_GDBM}
+ Enable DBM: ${HAVE_DBM}
+ Enable libdaemon: ${HAVE_LIBDAEMON}
+ Enable Python: ${HAVE_PYTHON}
+ Enable pygtk: ${HAVE_PYGTK}
+ Enable python-dbus: ${HAVE_PYTHON_DBUS}
+ Enable QT3: ${HAVE_QT3}
+ Enable QT4: ${HAVE_QT4}
+ Enable Mono: ${HAVE_MONO}
+ Enable Monodoc: ${HAVE_MONODOC}
+ Distribution/OS: ${with_distro}
+ User for avahi-daemon: ${AVAHI_USER}
+ Group for avahi-daemon: ${AVAHI_GROUP}
+ Priviliged access group for Avahi clients: ${AVAHI_PRIV_ACCESS_GROUP}
+ User for avahi-autoipd: ${AVAHI_AUTOIPD_USER}
+ Group for avahi-autoipd: ${AVAHI_AUTOIPD_GROUP}
+ Enable chroot(): ${enable_chroot}
+ Enable Linux inotify: ${have_inotify}
+ Enable stack-smashing protection: ${enable_ssp}
"
BUILD_DAEMON="no (You need libdaemon and expat!)"
@@ -844,7 +1047,7 @@ if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" =
BUILD_PYTHON=yes
fi
-BUILD_CLIENT="no (You need avahi-daemon and dbus!)"
+BUILD_CLIENT="no (You need avahi-daemon and D-Bus!)"
if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" ; then
BUILD_CLIENT=yes
@@ -856,7 +1059,14 @@ fi
if test "x$ENABLE_COMPAT_HOWL" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
ENABLE_COMPAT_HOWL="no (You need libavahi-client!)"
fi
+if test "x$ENABLE_AUTOIPD" = "xyes" -a "x$HAVE_LIBDAEMON" != "xyes" ; then
+ ENABLE_AUTOIPD="no (You need libdaemon!)"
+fi
+BUILD_UI="no"
+if test "x$HAVE_GTK" = "xyes" -a "x$BUILD_CLIENT" = "xyes" ; then
+ BUILD_UI="yes"
+fi
echo "\
Building libavahi-core yes
@@ -873,4 +1083,7 @@ echo "\
Building avahi-compat-libdns_sd: ${ENABLE_COMPAT_LIBDNS_SD}
Building avahi-compat-howl: ${ENABLE_COMPAT_HOWL}
Building tests: ${ENABLE_TESTS}
+ Building avahi-core documentation: ${ENABLE_CORE_DOCS}
+ Building avahi-autoipd: ${ENABLE_AUTOIPD}
+ Building libavahi-ui: ${BUILD_UI}
"
diff --git a/docs/INSTALL b/docs/INSTALL
index 387235c..8feac51 100644
--- a/docs/INSTALL
+++ b/docs/INSTALL
@@ -49,4 +49,7 @@ To start the two daemons at boot time on Debian based distributions:
# update-rc.d avahi-daemon defaults 25 15
# update-rc.d avahi-dnsconfd defaults 26 14
+If you plan to use avahi-autoipd you have to create the user/group
+"avahi-autoipd" much the same way as "avahi".
+
$Id$
diff --git a/docs/NEWS b/docs/NEWS
index 5effdcc..55bff06 100644
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -1,3 +1,207 @@
+Avahi 0.6.18
+============
+
+This is a bugfix release, adds a few new features and includes a new
+component.
+
+ * Add a new library libavahi-ui which contains a standard Gtk dialog
+ for browsing for services, and a new tool "zssh" that makes use of
+ it, which allows browsing for SSH and VNC servers and starts ssh or
+ xvncviewer if one item is selected.
+ * avahi-autoipd has been ported to FreeBSD (original patch from Bruce M Simpson)
+ * Improve OpenBSD, Solaris, MacOS X compatibility
+ * Linux inotify support for monitoring /etc/avahi/services/ and
+ /etc/avahi/hosts for changes. (Original patch from "behanw")
+ * Add the ability to dump the service type database from avahi-browse
+ with the new option "-b".
+ * Enable GCC stack smashing protection if available and working (Patch from tedp)
+ * Improve compatibility with Bonjour's libdns_sd (patch from Chris Rivera)
+ * Various updates to the service type database (based on patches from uws)
+ * Fix a local DoS vulnerability (very low priority, all you can do is
+ make Avahi hit an assert()); problem identified by "jamesh"
+ * Fix a problem when constantly generating conflict events for an RR
+ * Fix registration of very large RRs (original patch from Sjoerd Simons)
+ * Various minor fixes
+
+This release is backwards compatible with Avahi 0.6.x with x < 18.
+
+Avahi 0.6.17
+============
+
+This is a bugfix release.
+
+ * Don't accept "localhost" as a local mDNS host name
+ * Allow running avahi-bookmarks as CGI script
+ * Improve libdns_sd compatibility
+ * Stability: libdns_sd mutex locking order fix
+ * Publish IPv6 addresses via IPv4 and vice versa
+ * IA64 fixes
+ * A lot of minor cleanups and fixes
+
+This release is backwards compatible with Avahi 0.6.x with x < 17.
+
+Avahi 0.6.16
+============
+
+This is a bugfix release, it fixes one DoS (100% CPU Usage) and a regression
+from the last release
+
+ * Revert previous patch to check nlmsg_pid as it is bogus and breaks in
+ many cases, notably when using NetworkManager (Closes: #72)
+ * Replace with new SO_PASSCRED-based check of the sending UID, which
+ seems to work better (Closes: #72)
+ * Handle some errors in libdns_sd more gracefully the way the real
+ libdns_sd does (Closes: #64)
+ * Apply fix for Linux 2.6.19+ where IFA_RTA / IFLA_RTA is no longer
+ defined (Closes: #86)
+ * Fix doxygen comments for avahi watch, thanks to tedp (Closes: #77)
+ * Make d-bus version detection work for >= 1.0 (Closes: #71)
+ * Dont dbus_connection_close on shared dbus connections (Closes: #68)
+ * Fix potential endless loop in dns label unpacking code (Closes: #84)
+ * Fix bogus assertion in client-publish-service.c example
+ * Mild fix to some doxygen docs for avahi-common/address.h
+ * Fix passing in custom priviledged group (previously ignored setting)
+ (Closes: #85)
+
+This release is backwards compatible with Avahi 0.6.x with x < 16.
+
+Avahi 0.6.15
+============
+
+This is a bugfix release, this bug is potentially security sensitive
+
+ * Check that netlink messages actually originate from the kernel
+ and not another process.
+ * Fix build on NetBSD (thanks to Daniel S. Haischt)
+ * Fix dbus_service_browser not setting AVAHI_LOOKUP_RESULT_OUR_OWN.
+
+This release is backwards compatible with Avahi 0.6.x with x < 15.
+
+Avahi 0.6.14
+============
+
+This release fixes some bugs and includes a new component.
+
+Changes:
+
+ * Add new daemon "avahi-autoipd" which is an implementation of
+ IPv4LL as defined in RFC3927, a technology for assigning link-local IP
+ addresses without DHCP server. The same functionality has been available on
+ Windows under the name APIPA. While it is not the first implemenatation of
+ this technology for Free operating systems it is clearly the most powerful
+ and hopefully even the most secure. (Because it chroot()s and drops
+ priviliges and suchlike) For more information, especially about packaging
+ this new tool for distributions, please make sure to read:
+ http://avahi.org/wiki/AvahiAutoipd
+ and of course the man page included in the tarball. For the rationale for
+ adding this program to the Avahi toolset please read this mailing list
+ thread:
+ http://lists.freedesktop.org/archives/avahi/2006-September/000863.html
+ * Fix a segfault in the code handling static host name registrations
+ * Add a few new entries to the service type database
+ * s/D-?BUS/D-Bus/g
+ * Documentation updates
+ * Fix service type database building on Solaris
+ * Make use of newer D-Bus APIs
+ * Fix random seed initialization
+ * Install SFTP static service file by default
+ * Other minor code cleanups
+
+This release is backwards compatible with Avahi 0.6.x with x < 14.
+
+Please note that this version doesn't compile on NetBSD, patches
+welcome.
+
+Please note that avahi-autoipd is available on Linux only for
+now. Patches welcome. It is recommended to pass --disable-autoipd to
+"configure" on non-Linux operating systems, otherwise the build will
+fail.
+
+Avahi 0.6.13
+============
+
+This release fixes some bugs and includes minor enhancements.
+
+Changes:
+ * Add a new D-Bus method for changing the mDNS host name during
+ runtime. This functionality is only available to members of the
+ UNIX group "netdev", which is the same access group that is
+ enforced by GNOME's NetworkManager daemon. Since NM will probably
+ be the most prominent user of this new method, we decided to limit
+ access to the same group. The access group can be set by passing
+ --with-avahi-priv-access-group= to "configure". If you need more
+ sophisticated access control you can freely edit
+ /etc/dbus/system.d/avahi-dbus.conf.
+ * Add a new utility "avahi-set-host-name" which is a command line
+ wrapper around the aforementioned SetHostName() method.
+ * Bonjour API compatibility library:
+ * Implement DNSServiceUpdateRecord()
+ * Allow passing NULL as callback function for
+ DNSServiceRegister()
+ * Implement subtype registration in DNSServiceRegister() in a
+ way that is compatible with Bonjour.
+ * Update to newer copy of dns_sd.h
+ * If the host name changes update names of static services wich
+ contain wildcards.
+ * Don't build documentation about embedding the Avahi mDNS stack into
+ other programs by default. This is a feature used only by embedded
+ developers. Pass --enable-core-docs to "configure" to enable
+ building these docs, like in Avahi <= 0.6.12.
+ * Build Qt documentation only when Qt support is enabled in
+ the configuration. Same for GLib.
+ * Change algorithm used to find a new host name on conflict. In
+ Avahi <= 0.6.12 a conflicting host name of "foobar" would be
+ changed to the new name "foobar2". With 0.6.13 "foobar-2" will be
+ picked instead. This follows Bonjour's behaviour and has the
+ advantage not confusing people with regular host names ending in
+ digits.
+ * Don't disable all static services when SIGHUP is recieved.
+ * Fix build when Avahi is configured without Gtk+ but with Python
+ support
+ * Fix build on MacOS X
+ * Support using Solaris DBM instead of gdbm for the service type
+ database. The latter is still recommended
+ * Minor other fixes and documentation updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 13.
+
+Avahi 0.6.12
+============
+
+This is a bugfix and general cleanups release.
+
+Changes:
+ * Compatibility with newer D-Bus releases (0.9x)
+ * Compatibility with DBUS builds with --disable-checks
+ * Fix an error in the DBUS event loop wrapping which
+ caused the avahi client libraries to dispatch some events
+ too late when used with D-BUS 0.62 and newer.
+ * avahi-daemon: fix a minor memory leak in the DBUS code.
+ * avahi-glib: some GLIB adapter cleanups
+ * avahi-dnsconfd: fix segfault when passing an invalid command
+ line option
+ * avahi-test: portability patches for Solaris
+ * avahi-browse: flush STDOUT after each line, making it useful
+ in shell scripts.
+ * update service type database
+
+This release is backwards compatible with Avahi 0.6.x with x < 12.
+
+Avahi 0.6.11
+============
+
+This is a bugfix and portability release.
+
+Changes:
+ * Ported to Solaris
+ * avahi-sharp: fix a fatal error in object disposal code
+ * add a few new entries to the servivce type database
+ * fix potential crash when the daemon shuts down
+ * compatibility with newer autoconf versions
+
+This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
+0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.9 and 0.6.10.
+
Avahi 0.6.10
============
diff --git a/docs/README b/docs/README
index 4815ba2..6c6a586 100644
--- a/docs/README
+++ b/docs/README
@@ -1,6 +1,6 @@
Avahi is a free, LGPL mDNS/DNS-SD implementation.
-Copyright 2004, 2005 by the Avahi developers.
+Copyright 2004-2006 by the Avahi developers.
http://avahi.org/
diff --git a/trunk/docs/avahi-favicon.png b/docs/avahi-favicon.png
index c39fb1b..c39fb1b 100644
--- a/trunk/docs/avahi-favicon.png
+++ b/docs/avahi-favicon.png
Binary files differ
diff --git a/trunk/docs/avahi-logo.png b/docs/avahi-logo.png
index fa17260..fa17260 100644
--- a/trunk/docs/avahi-logo.png
+++ b/docs/avahi-logo.png
Binary files differ
diff --git a/trunk/docs/avahi-trac.png b/docs/avahi-trac.png
index 1ff44c7..1ff44c7 100644
--- a/trunk/docs/avahi-trac.png
+++ b/docs/avahi-trac.png
Binary files differ
diff --git a/trunk/docs/mdns-paket.dia b/docs/mdns-paket.dia
index db3cf81..db3cf81 100644
--- a/trunk/docs/mdns-paket.dia
+++ b/docs/mdns-paket.dia
diff --git a/trunk/docs/multicast.dia b/docs/multicast.dia
index 7a1c5be..7a1c5be 100644
--- a/trunk/docs/multicast.dia
+++ b/docs/multicast.dia
diff --git a/docs/socket-auto-port.c b/docs/socket-auto-port.c
new file mode 100644
index 0000000..75dffaf
--- /dev/null
+++ b/docs/socket-auto-port.c
@@ -0,0 +1,49 @@
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <inttypes.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int main(int argc, char *argv[]) {
+ int s;
+ struct sockaddr_storage sa;
+ socklen_t salen;
+ uint16_t port;
+
+ if ((s = socket(PF_INET6, SOCK_STREAM, 0)) < 0) {
+ if (errno == EAFNOSUPPORT)
+ s = socket(PF_INET, SOCK_STREAM, 0);
+
+ if (s < 0) {
+ perror("socket()");
+ return 1;
+ }
+ }
+
+ if (listen(s, 2) < 0) {
+ perror("listen()");
+ return 2;
+ }
+
+ salen = sizeof(sa);
+ if (getsockname(s, (struct sockaddr*) &sa, &salen) < 0) {
+ perror("getsockname()");
+ return 3;
+ }
+
+ if (((struct sockaddr*) &sa)->sa_family == AF_INET)
+ port = ((struct sockaddr_in*) &sa)->sin_port;
+ else
+ port = ((struct sockaddr_in6*) &sa)->sin6_port;
+
+ printf("Selected port number %u\n", ntohs(port));
+
+ /* ... hic sunt leones ... */
+
+ sleep(60);
+
+ return 0;
+}
diff --git a/trunk/docs/utilities-avahi1.svg b/docs/utilities-avahi1.svg
index c39457a..c39457a 100644
--- a/trunk/docs/utilities-avahi1.svg
+++ b/docs/utilities-avahi1.svg
diff --git a/trunk/docs/utilities-avahi2.svg b/docs/utilities-avahi2.svg
index 4397ea5..4397ea5 100644
--- a/trunk/docs/utilities-avahi2.svg
+++ b/docs/utilities-avahi2.svg
diff --git a/trunk/docs/zeroconf-stack-de.dia b/docs/zeroconf-stack-de.dia
index 988c57c..988c57c 100644
--- a/trunk/docs/zeroconf-stack-de.dia
+++ b/docs/zeroconf-stack-de.dia
diff --git a/doxygen.cfg b/doxygen.cfg
index 39af374..5c03609 100644
--- a/doxygen.cfg
+++ b/doxygen.cfg
@@ -188,17 +188,17 @@ PERL_PATH = $(PERL_PATH)
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
+CLASS_DIAGRAMS = NO
+HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = $(HAVE_DOT)
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
+CLASS_GRAPH = NO
+COLLABORATION_GRAPH = NO
UML_LOOK = NO
TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
+INCLUDE_GRAPH = NO
+INCLUDED_BY_GRAPH = NO
CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
+GRAPHICAL_HIERARCHY = NO
DOT_IMAGE_FORMAT = png
DOT_PATH = $(DOT_PATH)
DOTFILE_DIRS =
diff --git a/examples/client-browse-services.c b/examples/client-browse-services.c
index 37550ef..de6a970 100644
--- a/examples/client-browse-services.c
+++ b/examples/client-browse-services.c
@@ -146,7 +146,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
/* Called whenever the client or server state changes */
if (state == AVAHI_CLIENT_FAILURE) {
- fprintf(stderr, "Server connection failre: %s\n", avahi_strerror(avahi_client_errno(c)));
+ fprintf(stderr, "Server connection failure: %s\n", avahi_strerror(avahi_client_errno(c)));
avahi_simple_poll_quit(simple_poll);
}
}
diff --git a/examples/client-publish-service.c b/examples/client-publish-service.c
index 96afaf3..94dcd1e 100644
--- a/examples/client-publish-service.c
+++ b/examples/client-publish-service.c
@@ -44,7 +44,7 @@ static char *name = NULL;
static void create_services(AvahiClient *c);
static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) {
- assert(g == group);
+ assert(g == group || group == NULL);
/* Called whenever the entry group state changes */
@@ -71,6 +71,8 @@ static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state,
case AVAHI_ENTRY_GROUP_FAILURE :
+ fprintf(stderr, "Entry group failure: %s\n", avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))));
+
/* Some kind of failure happened while we were registering our services */
avahi_simple_poll_quit(simple_poll);
break;
@@ -142,24 +144,32 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN
create_services(c);
break;
+ case AVAHI_CLIENT_FAILURE:
+
+ fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c)));
+ avahi_simple_poll_quit(simple_poll);
+
+ break;
+
case AVAHI_CLIENT_S_COLLISION:
/* Let's drop our registered services. When the server is back
* in AVAHI_SERVER_RUNNING state we will register them
* again with the new host name. */
- if (group)
- avahi_entry_group_reset(group);
- break;
- case AVAHI_CLIENT_FAILURE:
+ case AVAHI_CLIENT_S_REGISTERING:
+
+ /* The server records are now being established. This
+ * might be caused by a host name change. We need to wait
+ * for our own records to register until the host name is
+ * properly esatblished. */
- fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
+ if (group)
+ avahi_entry_group_reset(group);
break;
case AVAHI_CLIENT_CONNECTING:
- case AVAHI_CLIENT_S_REGISTERING:
;
}
}
diff --git a/examples/core-browse-services.c b/examples/core-browse-services.c
index a34281e..53b18ee 100644
--- a/examples/core-browse-services.c
+++ b/examples/core-browse-services.c
@@ -5,7 +5,7 @@
* the embeddable mDNS stack for embedded applications.
*
* End user applications should *not* use this API and should use
- * the DBUS or C APIs, please see
+ * the D-Bus or C APIs, please see
* client-browse-services.c and glib-integration.c
*
* I repeat, you probably do *not* want to use this example.
diff --git a/examples/core-publish-service.c b/examples/core-publish-service.c
index 65dfe5d..6370383 100644
--- a/examples/core-publish-service.c
+++ b/examples/core-publish-service.c
@@ -72,6 +72,8 @@ static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntry
case AVAHI_ENTRY_GROUP_FAILURE :
+ fprintf(stderr, "Entry group failure: %s\n", avahi_strerror(avahi_server_errno(s)));
+
/* Some kind of failure happened while we were registering our services */
avahi_simple_poll_quit(simple_poll);
break;
@@ -162,14 +164,19 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
return;
}
- /* Let's drop our registered services. When the server is back
+ }
+
+ /* Fall through */
+
+ case AVAHI_SERVER_REGISTERING:
+
+ /* Let's drop our registered services. When the server is back
* in AVAHI_SERVER_RUNNING state we will register them
* again with the new host name. */
if (group)
avahi_s_entry_group_reset(group);
break;
- }
case AVAHI_SERVER_FAILURE:
@@ -180,7 +187,6 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
break;
case AVAHI_SERVER_INVALID:
- case AVAHI_SERVER_REGISTERING:
;
}
}
diff --git a/initscript/debian/avahi-daemon.in b/initscript/debian/avahi-daemon.in
index 3a68781..30a2c2f 100755
--- a/initscript/debian/avahi-daemon.in
+++ b/initscript/debian/avahi-daemon.in
@@ -75,6 +75,16 @@ else
return $1
}
+ log_warning_msg () {
+ if log_use_fancy_output; then
+ YELLOW=`$TPUT setaf 3`
+ NORMAL=`$TPUT op`
+ echo "$YELLOW*$NORMAL $@"
+ else
+ echo "$@"
+ fi
+ }
+
fi
#set -e
@@ -83,10 +93,20 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="Avahi mDNS/DNS-SD Daemon"
NAME="avahi-daemon"
DAEMON="@sbindir@/$NAME"
+SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
+# don't start if /etc/default/avahi-daemon says so.
+AVAHI_DAEMON_START=1
+test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon
+
+if [ "$AVAHI_DAEMON_START" != "1" -a "$1" != "stop" ]; then
+ log_warning_msg "Not starting $DESC $NAME, disabled via /etc/default/$NAME"
+ exit 0
+fi
+
#
# Function that starts the daemon/service.
#
diff --git a/initscript/debian/avahi-dnsconfd.in b/initscript/debian/avahi-dnsconfd.in
index c7cbf05..ac34804 100755
--- a/initscript/debian/avahi-dnsconfd.in
+++ b/initscript/debian/avahi-dnsconfd.in
@@ -75,6 +75,16 @@ else
return $1
}
+ log_warning_msg () {
+ if log_use_fancy_output; then
+ YELLOW=`$TPUT setaf 3`
+ NORMAL=`$TPUT op`
+ echo "$YELLOW*$NORMAL $@"
+ else
+ echo "$@"
+ fi
+ }
+
fi
#set -e
@@ -83,10 +93,20 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="Avahi Unicast DNS Configuration Daemon"
NAME="avahi-dnsconfd"
DAEMON="@sbindir@/$NAME"
+SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
+# don't start if /etc/default/avahi-dnsconfd says so.
+AVAHI_DNSCONFD_START=1
+test -f /etc/default/avahi-dnsconfd && . /etc/default/avahi-dnsconfd
+
+if [ "$AVAHI_DNSCONFD_START" != "1" -a "$1" != "stop" ]; then
+ log_warning_msg "Not starting $DESC $NAME, disabled via /etc/default/$NAME"
+ exit 0
+fi
+
#
# Function that starts the daemon/service.
#
diff --git a/initscript/fedora/avahi-daemon.in b/initscript/fedora/avahi-daemon.in
index aead1be..662684f 100644
--- a/initscript/fedora/avahi-daemon.in
+++ b/initscript/fedora/avahi-daemon.in
@@ -80,7 +80,8 @@ case "$1" in
;;
status)
$AVAHI_BIN -c
- [ $? = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
+ RETVAL=$?
+ [ $RETVAL = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
;;
restart)
restart
@@ -98,5 +99,5 @@ case "$1" in
exit 1
esac
-exit $?
+exit $RETVAL
diff --git a/initscript/fedora/avahi-dnsconfd.in b/initscript/fedora/avahi-dnsconfd.in
index deb81fb..bdf9370 100644
--- a/initscript/fedora/avahi-dnsconfd.in
+++ b/initscript/fedora/avahi-dnsconfd.in
@@ -76,7 +76,8 @@ case "$1" in
;;
status)
$AVAHI_BIN -c
- [ $? = 0 ] && echo "Avahi DNS daemon is running" || echo "Avahi DNS daemon is not running"
+ RETVAL=$?
+ [ $RETVAL = 0 ] && echo "Avahi DNS daemon is running" || echo "Avahi DNS daemon is not running"
;;
restart)
restart
@@ -95,5 +96,5 @@ case "$1" in
;;
esac
-exit $?
+exit $RETVAL
diff --git a/man/Makefile.am b/man/Makefile.am
index 3b90835..756d481 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -34,6 +34,7 @@ noinst_DATA = \
avahi-browse.1.xml \
avahi-publish.1.xml \
avahi-resolve.1.xml \
+ avahi-set-host-name.1.xml \
avahi-daemon.8.xml \
avahi-discover.1.xml \
avahi-bookmarks.1.xml \
@@ -41,7 +42,9 @@ noinst_DATA = \
avahi-daemon.conf.5.xml \
avahi-dnsconfd.action.8.xml \
avahi.service.5.xml \
- avahi.hosts.5.xml
+ avahi.hosts.5.xml \
+ avahi-autoipd.8.xml \
+ avahi-autoipd.action.8.xml
CLEANFILES = \
$(noinst_DATA)
@@ -51,7 +54,8 @@ if HAVE_DBUS
man_MANS += \
avahi-browse.1 \
avahi-resolve.1 \
- avahi-publish.1
+ avahi-publish.1 \
+ avahi-set-host-name.1
if HAVE_PYTHON
man_MANS += \
@@ -60,6 +64,16 @@ man_MANS += \
endif
endif
+if ENABLE_AUTOIPD
+if HAVE_LIBDAEMON
+
+man_MANS += \
+ avahi-autoipd.8 \
+ avahi-autoipd.action.8
+
+endif
+endif
+
avahi-browse.1.xml: avahi-browse.1.xml.in Makefile
sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
-e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
@@ -72,6 +86,10 @@ avahi-resolve.1.xml: avahi-resolve.1.xml.in Makefile
sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
-e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
+avahi-set-host-name.1.xml: avahi-set-host-name.1.xml.in Makefile
+ sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
+ -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
+
avahi-daemon.8.xml: avahi-daemon.8.xml.in Makefile
sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
-e 's,@servicedir\@,$(servicedir),g' \
@@ -112,6 +130,17 @@ avahi.hosts.5.xml: avahi.hosts.5.xml.in Makefile
-e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
-e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
+avahi-autoipd.action.8.xml: avahi-autoipd.action.8.xml.in Makefile
+ sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
+ -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
+ -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
+
+avahi-autoipd.8.xml: avahi-autoipd.8.xml.in Makefile
+ sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
+ -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
+ -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
+
+
if USE_XMLTOMAN
CLEANFILES += $(man_MANS)
@@ -125,6 +154,9 @@ avahi-publish.1: avahi-publish.1.xml Makefile
avahi-resolve.1: avahi-resolve.1.xml Makefile
xmltoman $< > $@
+avahi-set-host-name.1: avahi-set-host-name.1.xml Makefile
+ xmltoman $< > $@
+
avahi-daemon.8: avahi-daemon.8.xml Makefile
xmltoman $< > $@
@@ -149,6 +181,12 @@ avahi.service.5: avahi.service.5.xml Makefile
avahi.hosts.5: avahi.hosts.5.xml Makefile
xmltoman $< > $@
+avahi-autoipd.action.8: avahi-autoipd.action.8.xml Makefile
+ xmltoman $< > $@
+
+avahi-autoipd.8: avahi-autoipd.8.xml Makefile
+ xmltoman $< > $@
+
xmllint: $(noinst_DATA)
for f in $(noinst_DATA) ; do \
xmllint --noout --valid "$$f" || exit 1 ; \
@@ -163,6 +201,7 @@ EXTRA_DIST = \
avahi-browse.1.xml.in \
avahi-publish.1.xml.in \
avahi-resolve.1.xml.in \
+ avahi-set-host-name.1.xml.in \
avahi-daemon.8.xml.in \
avahi-discover.1.xml.in \
avahi-bookmarks.1.xml.in \
@@ -171,6 +210,8 @@ EXTRA_DIST = \
avahi-dnsconfd.action.8.xml.in \
avahi.service.5.xml.in \
avahi.hosts.5.xml.in \
+ avahi-autoipd.action.8.xml.in \
+ avahi-autoipd.8.xml.in \
xmltoman.css \
xmltoman.xsl \
xmltoman.dtd
diff --git a/trunk/man/avahi-autoipd.8.xml.in b/man/avahi-autoipd.8.xml.in
index 5bc6fad..4655765 100644
--- a/trunk/man/avahi-autoipd.8.xml.in
+++ b/man/avahi-autoipd.8.xml.in
@@ -154,6 +154,8 @@
<p>
<manref name="autoipd.action" section="8"/>, <manref name="dhclient" section="8"/>
</p>
+
+ <p>http://avahi.org/wiki/AvahiAutoipd documents how avahi-autoipd is best packaged and integrated into distributions.</p>
</section>
<section name="Comments">
diff --git a/trunk/man/avahi-autoipd.action.8.xml.in b/man/avahi-autoipd.action.8.xml.in
index 1eb6750..1eb6750 100644
--- a/trunk/man/avahi-autoipd.action.8.xml.in
+++ b/man/avahi-autoipd.action.8.xml.in
diff --git a/man/avahi-bookmarks.1.xml.in b/man/avahi-bookmarks.1.xml.in
index 25661f6..9bebd76 100644
--- a/man/avahi-bookmarks.1.xml.in
+++ b/man/avahi-bookmarks.1.xml.in
@@ -83,7 +83,7 @@
</options>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/man/avahi-browse.1.xml.in b/man/avahi-browse.1.xml.in
index 306152d..15856d2 100644
--- a/man/avahi-browse.1.xml.in
+++ b/man/avahi-browse.1.xml.in
@@ -29,6 +29,7 @@
<cmd>avahi-browse [<arg>options</arg>] <arg>service-type</arg></cmd>
<cmd>avahi-browse [<arg>options</arg>] <opt>--all</opt></cmd>
<cmd>avahi-browse [<arg>options</arg>] <opt>--browse-domains</opt></cmd>
+ <cmd>avahi-browse [<arg>options</arg>] <opt>--dump-db</opt></cmd>
<cmd>avahi-browse-domains [<arg>options</arg>]</cmd>
</synopsis>
@@ -96,6 +97,11 @@
</option>
<option>
+ <p><opt>-b | --dump-db</opt></p>
+ <optdesc><p>Dump the service type database (may be combined with -k)</p></optdesc>
+ </option>
+
+ <option>
<p><opt>-h | --help</opt></p>
<optdesc><p>Show help.</p></optdesc>
</option>
@@ -108,7 +114,7 @@
</options>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/man/avahi-daemon.8.xml.in b/man/avahi-daemon.8.xml.in
index 7d01a4b..fdbf8c0 100644
--- a/man/avahi-daemon.8.xml.in
+++ b/man/avahi-daemon.8.xml.in
@@ -42,8 +42,8 @@
exclusively by avahi-dnsconfd (a daemon which configures unicast
DNS servers using server info published via mDNS) and nss-mdns
(a libc NSS plugin, providing name resolution via mDNS). Finally
- there is the DBUS interface which provides a rich object
- oriented interface to DBUS enabled applications.</p>
+ there is the D-Bus interface which provides a rich object
+ oriented interface to D-Bus enabled applications.</p>
<p>Upon startup avahi-daemon interprets its configuration file
<file>@pkgsysconfdir@/avahi-daemon.conf</file> and reads XML
@@ -63,17 +63,17 @@
<option>
<p><opt>-D | --daemonize</opt></p>
- <optdesc><p>Daemonize after startup. Implies <opt>--syslog</opt></p></optdesc>
+ <optdesc><p>Daemonize after startup. Implies <opt>--syslog</opt>.</p></optdesc>
</option>
<option>
<p><opt>-s | --syslog</opt></p>
- <optdesc><p>Log to syslog instead of STDERR. Implied by <opt>--daemonize</opt></p></optdesc>
+ <optdesc><p>Log to syslog instead of STDERR. Implied by <opt>--daemonize</opt>.</p></optdesc>
</option>
<option>
<p><opt>--debug</opt></p>
- <optdesc><p>Increase verbosity to debug level</p></optdesc>
+ <optdesc><p>Increase verbosity to debug level.</p></optdesc>
</option>
<option>
@@ -92,10 +92,10 @@
</option>
<option>
- <p><opt>--no-proctitle</opt></p>
+ <p><opt>--no-proc-title</opt></p>
<optdesc><p>Don't change the process name while
- running. Unless this option is specified avahi will reflect
- it's current state and selected host name in the process
+ running. Unless this option is specified avahi-daemon will reflect
+ it's current state and the selected host name in the process
title.</p></optdesc>
</option>
@@ -144,22 +144,24 @@
</section>
<section name="Signals">
- <p><arg>SIGINT, SIGTERM, SIGQUIT</arg>: avahi-daemon will shutdown. This is issued by passing --kill to avahi-daemon.</p>
+ <p><arg>SIGINT, SIGTERM, SIGQUIT</arg>: avahi-daemon will shutdown. (Same as <opt>--kill</opt>).</p>
<p><arg>SIGHUP</arg>: avahi-daemon will reload unicast DNS
server data from <file>/etc/resolv.conf</file> and static
- service definitions from <file>@servicedir@/</file>.</p>
+ service definitions from <file>@servicedir@/</file>. (Same as <opt>--reload</opt>)</p>
<p><arg>SIGUSR1</arg>: avahi-daemon will dump local and remote cached resource record data to syslog.</p>
</section>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
<section name="See also">
<p>
- <manref name="avahi-daemon.conf" section="5"/>, <manref name="avahi.hosts" section="5"/>, <manref name="avahi.service" section="5"/>, <manref name="avahi-dnsconfd" section="8"/>
+ <manref name="avahi-daemon.conf" section="5"/>, <manref name="avahi.hosts" section="5"/>, <manref name="avahi.service" section="5"/>, <manref name="avahi-dnsconfd" section="8"/>, <manref name="avahi-set-host-name" section="1"/>
</p>
+
+ <p>http://avahi.org/wiki/AvahiAndUnicastDotLocal documents the problems when using Avahi in a unicast DNS zone .local.</p>
</section>
<section name="Comments">
diff --git a/man/avahi-daemon.conf.5.xml.in b/man/avahi-daemon.conf.5.xml.in
index 7dff097..efd1a41 100644
--- a/man/avahi-daemon.conf.5.xml.in
+++ b/man/avahi-daemon.conf.5.xml.in
@@ -96,12 +96,12 @@
<option>
<p><opt>enable-dbus=</opt> Takes either "yes", "no" or
- "warn". If set to "yes" avahi-daemon connects to D-BUS,
+ "warn". If set to "yes" avahi-daemon connects to D-Bus,
offering an object oriented client API. It is only available
if Avahi has been compiled with <opt>--enable-dbus</opt> in
which case it defaults to "yes". "warn" behaves like "yes",
but the daemon starts up even when it fails to connect to a
- D-BUS daemon. In addition, if the connection to the D-BUS
+ D-Bus daemon. In addition, if the connection to the D-Bus
daemon is terminated we try to reconnect. (Unless we are in a
chroot() environment where this definitely will fail.) </p>
</option>
@@ -223,6 +223,22 @@
SIGHUP to have it reload this file. Defaults to "no".</p>
</option>
+ <option>
+ <p><opt>publish-aaaa-on-ipv4=</opt> Takes a boolean value
+ ("yes" or "no"). If set to "yes" avahi-daemon will publish an
+ IPv6 AAAA record via IPv4, i.e. the local IPv6 addresses can be
+ resolved using an IPv4 transport. Only useful when IPv4 is
+ enabled with <opt>use-ipv4=true</opt>. Defaults to "yes".</p>
+ </option>
+
+ <option>
+ <p><opt>publish-a-on-ipv6=</opt> Takes a boolean value
+ ("yes" or "no"). If set to "yes" avahi-daemon will publish an
+ IPv4 A record via IPv6, i.e. the local IPv4 addresses can be
+ resolved using an IPv6 transport. Only useful when IPv6 is
+ enabled with <opt>use-ipv6=true</opt>. Defaults to "no".</p>
+ </option>
+
</section>
<section name="Section [reflector]">
@@ -281,13 +297,13 @@
</option>
<option>
- <p><opt>rlimit-nproc=</opt> Value for RLIMIT_NPROC (number of process of user). Since only a single avahi-daemon process is usually running you can set this safely to 1.</p>
+ <p><opt>rlimit-nproc=</opt> Value for RLIMIT_NPROC (number of process of user). avahi-daemon forks of a helper process on systems where <manref name="chroot" section="2"/> is available. Therefore this value should not be set below 2.</p>
</option>
</section>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/man/avahi-discover.1.xml.in b/man/avahi-discover.1.xml.in
index 43574f6..5d4f878 100644
--- a/man/avahi-discover.1.xml.in
+++ b/man/avahi-discover.1.xml.in
@@ -43,7 +43,7 @@
</options>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/man/avahi-dnsconfd.8.xml.in b/man/avahi-dnsconfd.8.xml.in
index 14a9f4a..c74e1ba 100644
--- a/man/avahi-dnsconfd.8.xml.in
+++ b/man/avahi-dnsconfd.8.xml.in
@@ -76,7 +76,7 @@
<section name="Files">
- <p><file>@pkgsysconfdir@/dnsconfd.action</file>: the script to run when a DNS server is found or removed.</p>
+ <p><file>@pkgsysconfdir@/avahi-dnsconfd.action</file>: the script to run when a DNS server is found or removed.</p>
</section>
@@ -86,13 +86,13 @@
</section>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
<section name="See also">
<p>
- <manref name="avahi-daemon" section="8"/>, <manref name="dnsconfd.action" section="8"/>
+ <manref name="avahi-daemon" section="8"/>, <manref name="avahi-dnsconfd.action" section="8"/>
</p>
</section>
diff --git a/man/avahi-dnsconfd.action.8.xml.in b/man/avahi-dnsconfd.action.8.xml.in
index da8b265..6811422 100644
--- a/man/avahi-dnsconfd.action.8.xml.in
+++ b/man/avahi-dnsconfd.action.8.xml.in
@@ -74,7 +74,7 @@
</section>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/man/avahi-publish.1.xml.in b/man/avahi-publish.1.xml.in
index cab5828..c68f60d 100644
--- a/man/avahi-publish.1.xml.in
+++ b/man/avahi-publish.1.xml.in
@@ -104,7 +104,7 @@
</options>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/man/avahi-resolve.1.xml.in b/man/avahi-resolve.1.xml.in
index f3691b9..dbfccc0 100644
--- a/man/avahi-resolve.1.xml.in
+++ b/man/avahi-resolve.1.xml.in
@@ -87,7 +87,7 @@
</options>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/trunk/man/avahi-set-host-name.1.xml.in b/man/avahi-set-host-name.1.xml.in
index 983b81c..983b81c 100644
--- a/trunk/man/avahi-set-host-name.1.xml.in
+++ b/man/avahi-set-host-name.1.xml.in
diff --git a/man/avahi.hosts.5.xml.in b/man/avahi.hosts.5.xml.in
index 5fe2271..5a92547 100644
--- a/man/avahi.hosts.5.xml.in
+++ b/man/avahi.hosts.5.xml.in
@@ -43,7 +43,7 @@
</description>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/man/avahi.service.5.xml.in b/man/avahi.service.5.xml.in
index 2514f33..aeaeb05 100644
--- a/man/avahi.service.5.xml.in
+++ b/man/avahi.service.5.xml.in
@@ -105,7 +105,7 @@
</section>
<section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
+ <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
available from <url href="@PACKAGE_URL@"/></p>
</section>
diff --git a/release-0.6.9/LICENSE b/release-0.6.9/LICENSE
deleted file mode 100644
index 2d2d780..0000000
--- a/release-0.6.9/LICENSE
+++ /dev/null
@@ -1,510 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/release-0.6.9/Makefile.am b/release-0.6.9/Makefile.am
deleted file mode 100644
index 3c75e1e..0000000
--- a/release-0.6.9/Makefile.am
+++ /dev/null
@@ -1,215 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-ACLOCAL_AMFLAGS = -I common
-
-include $(srcdir)/common/doxygen.mk
-
-EXTRA_DIST = \
- autogen.sh \
- bootstrap.sh \
- LICENSE \
- $(DX_CONFIG) \
- docs/INSTALL \
- docs/TODO \
- docs/NEWS \
- docs/README \
- docs/DBUS-API \
- docs/AUTHORS \
- docs/HACKING \
- docs/API-CHANGES-0.6 \
- docs/COMPAT-LAYERS \
- docs/MALLOC \
- docs/overview.dia \
- docs/server-states.dia \
- docs/avahi-poll.dia \
- avahi-core.pc.in \
- avahi-client.pc.in \
- avahi-glib.pc.in \
- avahi-qt3.pc.in \
- avahi-qt4.pc.in \
- avahi-sharp.pc.in \
- avahi-compat-libdns_sd.pc.in \
- avahi-compat-howl.pc.in
-
-SUBDIRS = \
- common \
- avahi-common \
- avahi-glib \
- avahi-core \
- avahi-discover-standalone \
- avahi-qt \
- avahi-client \
- avahi-daemon \
- avahi-sharp \
- initscript \
- avahi-dnsconfd \
- avahi-utils \
- avahi-python \
- examples \
- man \
- tests \
- service-type-database \
- avahi-compat-libdns_sd \
- avahi-compat-howl
-
-
-DX_INPUT = \
- $(srcdir)/avahi-core/core.h \
- $(srcdir)/avahi-core/lookup.h \
- $(srcdir)/avahi-core/publish.h \
- $(srcdir)/avahi-common/address.h \
- $(srcdir)/avahi-core/rr.h \
- $(srcdir)/avahi-common/strlst.h \
- $(srcdir)/avahi-common/alternative.h \
- $(srcdir)/avahi-core/log.h \
- $(srcdir)/avahi-common/defs.h \
- $(srcdir)/avahi-client/client.h \
- $(srcdir)/avahi-client/lookup.h \
- $(srcdir)/avahi-client/publish.h \
- $(srcdir)/avahi-common/error.h \
- $(srcdir)/avahi-common/malloc.h \
- $(srcdir)/avahi-common/domain.h \
- $(srcdir)/avahi-common/watch.h \
- $(srcdir)/avahi-common/simple-watch.h \
- $(srcdir)/avahi-common/thread-watch.h \
- $(srcdir)/avahi-glib/glib-watch.h \
- $(srcdir)/avahi-glib/glib-malloc.h \
- $(srcdir)/avahi-common/timeval.h \
- $(srcdir)/avahi-qt/qt-watch.h
-
-DX_EXAMPLE_PATH = $(srcdir)/examples
-
-DX_EXAMPLE_PATTERNS = *.c
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = avahi-core.pc
-
-avahi-core.pc: avahi-core.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES = avahi-core.pc
-
-if HAVE_DBUS
-
-pkgconfig_DATA += avahi-client.pc
-
-avahi-client.pc: avahi-client.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-client.pc
-
-if ENABLE_COMPAT_HOWL
-
-pkgconfig_DATA += avahi-compat-howl.pc
-
-avahi-compat-howl.pc: avahi-compat-howl.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@HOWL_COMPAT_VERSION\@,$(HOWL_COMPAT_VERSION),g' $< > $@
-
-CLEANFILES += avahi-compat-howl.pc
-
-endif
-
-if ENABLE_COMPAT_LIBDNS_SD
-
-pkgconfig_DATA += avahi-compat-libdns_sd.pc
-
-avahi-compat-libdns_sd.pc: avahi-compat-libdns_sd.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-compat-libdns_sd.pc
-
-endif
-
-if HAVE_MONO
-
-pkgconfig_DATA += avahi-sharp.pc
-
-avahi-sharp.pc: avahi-sharp.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
- -e 's,@libdir\@,$(libdir),g' $< > $@
-
-CLEANFILES += avahi-sharp.pc
-
-endif
-
-endif
-
-if HAVE_GLIB
-
-pkgconfig_DATA += avahi-glib.pc
-
-avahi-glib.pc: avahi-glib.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-glib.pc
-
-endif
-
-if HAVE_QT3
-
-pkgconfig_DATA += avahi-qt3.pc
-
-avahi-qt3.pc: avahi-qt3.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-qt3.pc
-
-endif
-
-if HAVE_QT4
-
-pkgconfig_DATA += avahi-qt4.pc
-
-avahi-qt4.pc: avahi-qt4.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-qt4.pc
-
-endif
-
-MOSTLYCLEANFILES = $(DX_CLEANFILES)
-
-DISTCHECK_CONFIGURE_FLAGS = \
- --disable-monodoc
-
-homepage:
- $(MAKE) -C man
- scp avahi-daemon/*.introspect avahi-daemon/introspect.dtd avahi-daemon/introspect.xsl\
- man/*.xml man/xmltoman.dtd man/xmltoman.xsl \
- tango:www/avahi.org/tree/download/
- rm -rf doxygen
- $(MAKE) doxygen-run
- ssh tango rm -rf www/avahi.org/tree/download/doxygen
- scp -r doxygen/html tango:www/avahi.org/tree/download/doxygen
diff --git a/release-0.6.9/acinclude.m4 b/release-0.6.9/acinclude.m4
deleted file mode 100644
index 4d07999..0000000
--- a/release-0.6.9/acinclude.m4
+++ /dev/null
@@ -1 +0,0 @@
-sinclude(common/doxygen.m4) \ No newline at end of file
diff --git a/release-0.6.9/autogen.sh b/release-0.6.9/autogen.sh
deleted file mode 100755
index f75ad60..0000000
--- a/release-0.6.9/autogen.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-VERSION=1.9
-
-run_versioned() {
- local P
- local V
-
- V=$(echo "$2" | sed -e 's,\.,,g')
-
- if [ -e "`which $1$V`" ] ; then
- P="$1$V"
- else
- if [ -e "`which $1-$2`" ] ; then
- P="$1-$2"
- else
- P="$1"
- fi
- fi
-
- shift 2
- "$P" "$@"
-}
-
-set -ex
-
-if [ "x$1" = "xam" ] ; then
- run_versioned automake "$VERSION" -a -c --foreign
- ./config.status
-else
- rm -rf autom4te.cache
- rm -f config.cache
-
- test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize
-
- "$LIBTOOLIZE" -c --force
- run_versioned aclocal "$VERSION" -I common
- run_versioned autoconf 2.59 -Wall
- run_versioned autoheader 2.59
- run_versioned automake "$VERSION" -a -c --foreign
-
- if test "x$NOCONFIGURE" = "x"; then
- ./configure "$@"
- make clean
- fi
-fi
diff --git a/release-0.6.9/avahi-client.pc.in b/release-0.6.9/avahi-client.pc.in
deleted file mode 100644
index 65ee8d8..0000000
--- a/release-0.6.9/avahi-client.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-client
-Description: Avahi Multicast DNS Responder (Client Support)
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lavahi-common -lavahi-client
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/release-0.6.9/avahi-client/Makefile.am b/release-0.6.9/avahi-client/Makefile.am
deleted file mode 100644
index f45f58d..0000000
--- a/release-0.6.9/avahi-client/Makefile.am
+++ /dev/null
@@ -1,85 +0,0 @@
-# $Id: Makefile.am 90 2005-05-23 16:15:12Z lennart $
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-
-avahi_clientincludedir=$(includedir)/avahi-client
-avahi_clientinclude_HEADERS = client.h lookup.h publish.h
-
-noinst_HEADERS = internal.h
-
-if ENABLE_TESTS
-
-noinst_PROGRAMS = \
- client-test \
- srv-test \
- xdg-config-test \
- rr-test \
- check-nss-test
-
-endif
-
-lib_LTLIBRARIES = libavahi-client.la
-
-libavahi_client_la_SOURCES = \
- client.c client.h \
- entrygroup.c \
- browser.c \
- resolver.c \
- publish.h lookup.h \
- xdg-config.c xdg-config.h \
- check-nss.c \
- ../avahi-common/dbus.c ../avahi-common/dbus.h \
- ../avahi-common/dbus-watch-glue.c ../avahi-common/dbus-watch-glue.h
-
-libavahi_client_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) -DDBUS_SYSTEM_BUS_DEFAULT_ADDRESS=\"$(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)\"
-libavahi_client_la_LIBADD = $(AM_LDADD) $(DBUS_LIBS) ../avahi-common/libavahi-common.la
-libavahi_client_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_CLIENT_VERSION_INFO)
-
-client_test_SOURCES = client-test.c
-client_test_CFLAGS = $(AM_CFLAGS)
-client_test_LDADD = $(AM_LDADD) libavahi-client.la ../avahi-common/libavahi-common.la
-
-srv_test_SOURCES = srv-test.c
-srv_test_CFLAGS = $(AM_CFLAGS)
-srv_test_LDADD = $(AM_LDADD) libavahi-client.la ../avahi-common/libavahi-common.la
-
-rr_test_SOURCES = rr-test.c
-rr_test_CFLAGS = $(AM_CFLAGS)
-rr_test_LDADD = $(AM_LDADD) libavahi-client.la ../avahi-common/libavahi-common.la
-
-xdg_config_test_SOURCES = xdg-config-test.c xdg-config.c xdg-config.h
-xdg_config_test_CFLAGS = $(AM_CFLAGS)
-xdg_config_test_LDADD = $(AM_LDADD)
-
-check_nss_test_SOURCES = check-nss.c check-nss-test.c client.h
-check_nss_test_CFLAGS = $(AM_CFLAGS)
-check_nss_test_LDADD = $(AM_LDADD)
-
-if HAVE_DLOPEN
-check_nss_test_LDADD += -ldl
-libavahi_client_la_LIBADD += -ldl
-endif
-
-endif
diff --git a/release-0.6.9/avahi-client/browser.c b/release-0.6.9/avahi-client/browser.c
deleted file mode 100644
index 24393b8..0000000
--- a/release-0.6.9/avahi-client/browser.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-
-#include "client.h"
-#include "internal.h"
-#include "xdg-config.h"
-
-static void parse_environment(AvahiDomainBrowser *b) {
- char buf[AVAHI_DOMAIN_NAME_MAX*3], *e, *t, *p;
-
- assert(b);
-
- if (!(e = getenv("AVAHI_BROWSE_DOMAINS")))
- return;
-
- snprintf(buf, sizeof(buf), "%s", e);
-
- for (t = strtok_r(buf, ":", &p); t; t = strtok_r(NULL, ":", &p)) {
- char domain[AVAHI_DOMAIN_NAME_MAX];
- if (avahi_normalize_name(t, domain, sizeof(domain)))
- b->static_browse_domains = avahi_string_list_add(b->static_browse_domains, domain);
- }
-}
-
-static void parse_domain_file(AvahiDomainBrowser *b) {
- FILE *f;
- char buf[AVAHI_DOMAIN_NAME_MAX];
-
- assert(b);
-
- if (!(f = avahi_xdg_config_open("avahi/browse-domains")))
- return;
-
-
- while (fgets(buf, sizeof(buf)-1, f)) {
- char domain[AVAHI_DOMAIN_NAME_MAX];
- buf[strcspn(buf, "\n\r")] = 0;
-
- if (avahi_normalize_name(buf, domain, sizeof(domain)))
- b->static_browse_domains = avahi_string_list_add(b->static_browse_domains, domain);
- }
-}
-
-static void domain_browser_ref(AvahiDomainBrowser *db) {
- assert(db);
- assert(db->ref >= 1);
- db->ref++;
-}
-
-static void defer_timeout_callback(AvahiTimeout *t, void *userdata) {
- AvahiDomainBrowser *db = userdata;
- AvahiStringList *l;
- assert(t);
-
- db->client->poll_api->timeout_free(db->defer_timeout);
- db->defer_timeout = NULL;
-
- domain_browser_ref(db);
-
- for (l = db->static_browse_domains; l; l = l->next) {
-
- if (db->ref <= 1)
- break;
-
- db->callback(db, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_NEW, (char*) l->text, AVAHI_LOOKUP_RESULT_STATIC, db->userdata);
- }
-
- avahi_domain_browser_free(db);
-}
-
-AvahiDomainBrowser* avahi_domain_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType btype,
- AvahiLookupFlags flags,
- AvahiDomainBrowserCallback callback,
- void *userdata) {
-
- AvahiDomainBrowser *db = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_interface, i_protocol, bt;
- uint32_t u_flags;
-
- assert(client);
- assert(callback);
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!domain)
- domain = "";
-
- if (!(db = avahi_new (AvahiDomainBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- db->ref = 1;
- db->client = client;
- db->callback = callback;
- db->userdata = userdata;
- db->path = NULL;
- db->interface = interface;
- db->protocol = protocol;
- db->static_browse_domains = NULL;
- db->defer_timeout = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiDomainBrowser, domain_browsers, client->domain_browsers, db);
-
- if (!(client->flags & AVAHI_CLIENT_IGNORE_USER_CONFIG)) {
- parse_environment(db);
- parse_domain_file(db);
- }
-
- db->static_browse_domains = avahi_string_list_reverse(db->static_browse_domains);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "DomainBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
- bt = btype;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &bt,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(db->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (db->static_browse_domains && btype == AVAHI_DOMAIN_BROWSER_BROWSE) {
- struct timeval tv = { 0, 0 };
-
- if (!(db->defer_timeout = client->poll_api->timeout_new(client->poll_api, &tv, defer_timeout_callback, db))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return db;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (db)
- avahi_domain_browser_free(db);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_domain_browser_free (AvahiDomainBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- assert(b->ref >= 1);
-
- if (--(b->ref) >= 1)
- return AVAHI_OK;
-
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiDomainBrowser, domain_browsers, client->domain_browsers, b);
-
- if (b->defer_timeout)
- b->client->poll_api->timeout_free(b->defer_timeout);
-
- avahi_string_list_free(b->static_browse_domains);
- avahi_free(b->path);
- avahi_free(b);
-
- return r;
-}
-
-DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiDomainBrowser *db = NULL;
- DBusError error;
- const char *path;
- char *domain = NULL;
- int32_t interface, protocol;
- uint32_t flags = 0;
- AvahiStringList *l;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (db = client->domain_browsers; db; db = db->domain_browsers_next)
- if (strcmp (db->path, path) == 0)
- break;
-
- if (!db)
- goto fail;
-
- interface = db->interface;
- protocol = db->protocol;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(db->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- if (domain)
- for (l = db->static_browse_domains; l; l = l->next)
- if (avahi_domain_equal((char*) l->text, domain)) {
- /* We had this entry already in the static entries */
- return DBUS_HANDLER_RESULT_HANDLED;
- }
-
- db->callback(db, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, domain, (AvahiLookupResultFlags) flags, db->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-/* AvahiServiceTypeBrowser */
-
-AvahiServiceTypeBrowser* avahi_service_type_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceTypeBrowserCallback callback,
- void *userdata) {
-
- AvahiServiceTypeBrowser *b = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(client);
- assert(callback);
-
- dbus_error_init(&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!domain)
- domain = "";
-
- if (!(b = avahi_new(AvahiServiceTypeBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- b->client = client;
- b->callback = callback;
- b->userdata = userdata;
- b->path = NULL;
- b->domain = NULL;
- b->interface = interface;
- b->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiServiceTypeBrowser, service_type_browsers, client->service_type_browsers, b);
-
- if (domain[0])
- if (!(b->domain = avahi_strdup(domain))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceTypeBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID)) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(b->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return b;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (b)
- avahi_service_type_browser_free(b);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_service_type_browser_free (AvahiServiceTypeBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiServiceTypeBrowser, service_type_browsers, b->client->service_type_browsers, b);
-
- avahi_free(b->path);
- avahi_free(b->domain);
- avahi_free(b);
- return r;
-}
-
-DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiServiceTypeBrowser *b = NULL;
- DBusError error;
- const char *path;
- char *domain, *type = NULL;
- int32_t interface, protocol;
- uint32_t flags = 0;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (b = client->service_type_browsers; b; b = b->service_type_browsers_next)
- if (strcmp (b->path, path) == 0)
- break;
-
- if (!b)
- goto fail;
-
- domain = b->domain;
- interface = b->interface;
- protocol = b->protocol;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, type, domain, (AvahiLookupResultFlags) flags, b->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-/* AvahiServiceBrowser */
-
-AvahiServiceBrowser* avahi_service_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *type,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceBrowserCallback callback,
- void *userdata) {
-
- AvahiServiceBrowser *b = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_protocol, i_interface;
- uint32_t u_flags;
-
- assert(client);
- assert(type);
- assert(callback);
-
- dbus_error_init(&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!domain)
- domain = "";
-
- if (!(b = avahi_new(AvahiServiceBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- b->client = client;
- b->callback = callback;
- b->userdata = userdata;
- b->path = NULL;
- b->type = b->domain = NULL;
- b->interface = interface;
- b->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiServiceBrowser, service_browsers, client->service_browsers, b);
-
- if (!(b->type = avahi_strdup(type))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (domain && domain[0])
- if (!(b->domain = avahi_strdup(domain))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID)) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(b->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return b;
-
-fail:
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (b)
- avahi_service_browser_free(b);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_service_browser_free (AvahiServiceBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiServiceBrowser, service_browsers, b->client->service_browsers, b);
-
- avahi_free(b->path);
- avahi_free(b->type);
- avahi_free(b->domain);
- avahi_free(b);
- return r;
-}
-
-DBusHandlerResult avahi_service_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiServiceBrowser *b = NULL;
- DBusError error;
- const char *path;
- char *name = NULL, *type, *domain;
- int32_t interface, protocol;
- uint32_t flags = 0;
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (b = client->service_browsers; b; b = b->service_browsers_next)
- if (strcmp (b->path, path) == 0)
- break;
-
- if (!b)
- goto fail;
-
- type = b->type;
- domain = b->domain;
- interface = b->interface;
- protocol = b->protocol;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
-
- if (!dbus_message_get_args (
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, name, type, domain, (AvahiLookupResultFlags) flags, b->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-/* AvahiRecordBrowser */
-
-AvahiRecordBrowser* avahi_record_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- AvahiLookupFlags flags,
- AvahiRecordBrowserCallback callback,
- void *userdata) {
-
- AvahiRecordBrowser *b = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_protocol, i_interface;
- uint32_t u_flags;
-
- assert(client);
- assert(name);
- assert(callback);
-
- dbus_error_init(&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(b = avahi_new(AvahiRecordBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- b->client = client;
- b->callback = callback;
- b->userdata = userdata;
- b->path = NULL;
- b->name = NULL;
- b->clazz = clazz;
- b->type = type;
- b->interface = interface;
- b->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiRecordBrowser, record_browsers, client->record_browsers, b);
-
- if (!(b->name = avahi_strdup(name))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "RecordBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID)) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(b->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return b;
-
-fail:
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (b)
- avahi_record_browser_free(b);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_record_browser_get_client (AvahiRecordBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_record_browser_free (AvahiRecordBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiRecordBrowser, record_browsers, b->client->record_browsers, b);
-
- avahi_free(b->path);
- avahi_free(b->name);
- avahi_free(b);
- return r;
-}
-
-DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiRecordBrowser *b = NULL;
- DBusError error;
- const char *path;
- char *name;
- int32_t interface, protocol;
- uint32_t flags = 0;
- uint16_t clazz, type;
- void *rdata = NULL;
- int rdata_size = 0;
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (b = client->record_browsers; b; b = b->record_browsers_next)
- if (strcmp (b->path, path) == 0)
- break;
-
- if (!b)
- goto fail;
-
- interface = b->interface;
- protocol = b->protocol;
- clazz = b->clazz;
- type = b->type;
- name = b->name;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE: {
- DBusMessageIter iter, sub;
- int j;
-
- if (!dbus_message_get_args (
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
-
- dbus_message_iter_init(message, &iter);
-
- for (j = 0; j < 5; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE)
- goto fail;
-
- dbus_message_iter_recurse(&iter, &sub);
- dbus_message_iter_get_fixed_array(&sub, &rdata, &rdata_size);
-
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
- goto fail;
-
- dbus_message_iter_get_basic(&iter, &flags);
-
- break;
- }
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, name, clazz, type, rdata, (size_t) rdata_size, (AvahiLookupResultFlags) flags, b->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
diff --git a/release-0.6.9/avahi-client/check-nss-test.c b/release-0.6.9/avahi-client/check-nss-test.c
deleted file mode 100644
index 172b4fa..0000000
--- a/release-0.6.9/avahi-client/check-nss-test.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include <avahi-client/client.h>
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- printf("NSS Support available: %s\n", avahi_nss_support() ? "yes" : "no");
-}
diff --git a/release-0.6.9/avahi-client/check-nss.c b/release-0.6.9/avahi-client/check-nss.c
deleted file mode 100644
index 0a933fa..0000000
--- a/release-0.6.9/avahi-client/check-nss.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_DLOPEN
-#include <dlfcn.h>
-#endif
-#include <stdlib.h>
-
-#include "client.h"
-
-int avahi_nss_support(void) {
- int b = 0;
-
-#ifdef HAVE_DLOPEN
- static const char * const libs[] = {
- "libnss_mdns.so.2",
- "libnss_mdns4.so.2",
- "libnss_mdns6.so.2",
- NULL };
-
- const char * const *l;
-
- for (l = libs; *l; l++) {
- void *dl;
-
- if ((dl = dlopen(*l, RTLD_LAZY))) {
- b = 1;
- dlclose(dl);
- break;
- }
- }
-#endif
-
- return b;
-}
diff --git a/release-0.6.9/avahi-client/client-test.c b/release-0.6.9/avahi-client/client-test.c
deleted file mode 100644
index 6ca99d6..0000000
--- a/release-0.6.9/avahi-client/client-test.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-#include <avahi-client/publish.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/timeval.h>
-
-static const AvahiPoll *poll_api = NULL;
-static AvahiSimplePoll *simple_poll = NULL;
-
-static void avahi_client_callback (AvahiClient *c, AvahiClientState state, void *userdata) {
- printf ("CLIENT: Callback on %p, state -> %d, data -> %s\n", (void*) c, state, (char*)userdata);
-}
-
-static void avahi_entry_group_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- printf ("ENTRY-GROUP: Callback on %p, state -> %d, data -> %s\n", (void*) g, state, (char*)userdata);
-}
-
-static void avahi_entry_group2_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- printf ("ENTRY-GROUP2: Callback on %p, state -> %d, data -> %s\n", (void*) g, state, (char*)userdata);
-}
-
-
-static void avahi_domain_browser_callback(
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- printf ("DOMAIN-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, domain, (char*)userdata);
-}
-
-static void avahi_service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- char addr[64];
- char *txtr;
- if (event == AVAHI_RESOLVER_FAILURE) {
- printf ("SERVICE-RESOLVER: ServiceResolver %p timed out (%s %s)\n", (void*) r, name, type);
- return;
- }
- avahi_address_snprint (addr, sizeof (addr), a);
- txtr = avahi_string_list_to_string (txt);
- printf ("SERVICE-RESOLVER: Callback on ServiceResolver, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), host_name (%s), address (%s), port (%d), txtdata (%s), data(%s)\n", interface, protocol, event, name, type, domain, host_name, addr, port, txtr, (char*)userdata);
- avahi_free(txtr);
-}
-
-static void avahi_service_browser_callback (
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- AvahiServiceResolver *sr;
-
- printf ("SERVICE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, name, type, domain, (char*)userdata);
-
- if (b && name)
- {
- sr = avahi_service_resolver_new (avahi_service_browser_get_client (b), interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, avahi_service_resolver_callback, "xxXXxx");
- printf("New service resolver %p\n", (void*) sr);
- }
-}
-
-static void avahi_service_type_browser_callback (
- AvahiServiceTypeBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- printf ("SERVICE-TYPE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, type, domain, (char*)userdata);
-}
-
-static void avahi_address_resolver_callback (
- AVAHI_GCC_UNUSED AvahiAddressResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *address,
- const char *name,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- char addr[64];
- if (event == AVAHI_RESOLVER_FAILURE) {
- printf ("ADDRESS-RESOLVER: Callback on AddressResolver, timed out.\n");
- return;
- }
- avahi_address_snprint (addr, sizeof (addr), address);
- printf ("ADDRESS-RESOLVER: Callback on AddressResolver, interface (%d), protocol (%d), even (%d), address (%s), name (%s), data(%s)\n", interface, protocol, event, addr, name, (char*) userdata);
-}
-
-static void avahi_host_name_resolver_callback (
- AvahiHostNameResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- AvahiClient *client;
- AvahiAddressResolver *ar;
- char addr[64];
-
- if (event == AVAHI_RESOLVER_FAILURE) {
- printf ("HOST-NAME-RESOLVER: Callback on HostNameResolver, timed out.\n");
- return;
- }
- client = avahi_host_name_resolver_get_client (r);
- ar = avahi_address_resolver_new(client, interface, protocol, a, 0, avahi_address_resolver_callback, "omghai6u");
- if (ar)
- {
- printf ("Succesfully created address resolver object\n");
- } else {
- printf ("Failed to create AddressResolver\n");
- }
- avahi_address_snprint (addr, sizeof (addr), a);
- printf ("HOST-NAME-RESOLVER: Callback on HostNameResolver, interface (%d), protocol (%d), event (%d), name (%s), address (%s), data (%s)\n", interface, protocol, event, name, addr, (char*)userdata);
-}
-static void test_free_domain_browser(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata)
-{
- AvahiServiceBrowser *b = userdata;
- printf ("Freeing domain browser\n");
- avahi_service_browser_free (b);
-}
-
-static void test_free_entry_group (AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata)
-{
- AvahiEntryGroup *g = userdata;
- printf ("Freeing entry group\n");
- avahi_entry_group_free (g);
-}
-
-static void test_entry_group_reset (AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata)
-{
- AvahiEntryGroup *g = userdata;
-
- printf ("Resetting entry group\n");
- avahi_entry_group_reset (g);
-
- avahi_entry_group_add_service (g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar2", NULL);
-
- avahi_entry_group_commit (g);
-}
-
-static void test_entry_group_update(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata) {
- AvahiEntryGroup *g = userdata;
-
- printf ("Updating entry group\n");
-
- avahi_entry_group_update_service_txt(g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, "foo=bar3", NULL);
-}
-
-static void terminate(AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
-
- avahi_simple_poll_quit(simple_poll);
-}
-
-int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiClient *avahi;
- AvahiEntryGroup *group, *group2;
- AvahiDomainBrowser *domain;
- AvahiServiceBrowser *sb;
- AvahiServiceTypeBrowser *st;
- AvahiHostNameResolver *hnr;
- AvahiAddress *aar;
- const char *ret;
- int error;
- uint32_t cookie;
- struct timeval tv;
-
- simple_poll = avahi_simple_poll_new();
- poll_api = avahi_simple_poll_get(simple_poll);
-
- if (!(avahi = avahi_client_new(poll_api, 0, avahi_client_callback, "omghai2u", &error))) {
- fprintf(stderr, "Client failed: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- printf("State: %i\n", avahi_client_get_state(avahi));
-
- ret = avahi_client_get_version_string (avahi);
- printf("Avahi Server Version: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- ret = avahi_client_get_host_name (avahi);
- printf("Host Name: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- ret = avahi_client_get_domain_name (avahi);
- printf("Domain Name: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- ret = avahi_client_get_host_name_fqdn (avahi);
- printf("FQDN: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- cookie = avahi_client_get_local_service_cookie(avahi);
- printf("Local service cookie: %u (Error Return: %s)\n", cookie, cookie != AVAHI_SERVICE_COOKIE_INVALID ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- group = avahi_entry_group_new(avahi, avahi_entry_group_callback, "omghai");
- printf("Creating entry group: %s\n", group ? "OK" : avahi_strerror(avahi_client_errno (avahi)));
-
- assert(group);
-
- printf("Sucessfully created entry group %p\n", (void*) group);
-
- printf("%s\n", avahi_strerror(avahi_entry_group_add_service (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar", NULL)));
- printf("add_record: %d\n", avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", 0x01, 0x10, 120, "\5booya", 6));
-
- avahi_entry_group_commit (group);
-
- domain = avahi_domain_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, avahi_domain_browser_callback, "omghai3u");
-
- if (domain == NULL)
- printf ("Failed to create domain browser object\n");
- else
- printf ("Sucessfully created domain browser %p\n", (void*) domain);
-
- st = avahi_service_type_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, 0, avahi_service_type_browser_callback, "omghai3u");
- if (st == NULL)
- printf ("Failed to create service type browser object\n");
- else
- printf ("Sucessfully created service type browser %p\n", (void*) st);
-
- sb = avahi_service_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, avahi_service_browser_callback, "omghai3u");
- if (sb == NULL)
- printf ("Failed to create service browser object\n");
- else
- printf ("Sucessfully created service browser %p\n", (void*) sb);
-
- hnr = avahi_host_name_resolver_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "ecstasy.local", AVAHI_PROTO_UNSPEC, 0, avahi_host_name_resolver_callback, "omghai4u");
- if (hnr == NULL)
- printf ("Failed to create hostname resolver object\n");
- else
- printf ("Successfully created hostname resolver object\n");
-
- aar = avahi_address_parse ("224.0.0.251", AVAHI_PROTO_UNSPEC, aar);
- if (aar == NULL) {
- printf ("failed to create address object\n");
- } else {
- group2 = avahi_entry_group_new (avahi, avahi_entry_group2_callback, "omghai222");
- if ((error = avahi_entry_group_add_address (group2, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "test-mdns.local.", aar)) < 0)
- {
- printf ("*** failed to add address to entry group: %s\n", avahi_strerror (error));
- avahi_entry_group_free (group2);
- } else {
- printf ("*** success, added address\n");
- avahi_entry_group_commit (group2);
- }
- }
-
- avahi_elapse_time(&tv, 8000, 0);
- poll_api->timeout_new(poll_api, &tv, test_entry_group_reset, group);
- avahi_elapse_time(&tv, 15000, 0);
- poll_api->timeout_new(poll_api, &tv, test_entry_group_update, group);
- avahi_elapse_time(&tv, 20000, 0);
- poll_api->timeout_new(poll_api, &tv, test_free_entry_group, group);
- avahi_elapse_time(&tv, 25000, 0);
- poll_api->timeout_new(poll_api, &tv, test_free_domain_browser, sb);
-
- avahi_elapse_time(&tv, 30000, 0);
- poll_api->timeout_new(poll_api, &tv, terminate, NULL);
-
- avahi_simple_poll_loop(simple_poll);
-
- printf("terminating...\n");
-
-fail:
-
- if (avahi)
- avahi_client_free (avahi);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-client/client.c b/release-0.6.9/avahi-client/client.c
deleted file mode 100644
index 4ee8e41..0000000
--- a/release-0.6.9/avahi-client/client.c
+++ /dev/null
@@ -1,868 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus-watch-glue.h>
-
-#include "client.h"
-#include "internal.h"
-
-#define AVAHI_CLIENT_DBUS_API_SUPPORTED ((uint32_t) 0x0201)
-
-static int init_server(AvahiClient *client, int *ret_error);
-
-int avahi_client_set_errno (AvahiClient *client, int error) {
- assert(client);
-
- return client->error = error;
-}
-
-int avahi_client_set_dbus_error(AvahiClient *client, DBusError *error) {
- assert(client);
- assert(error);
-
- return avahi_client_set_errno(client, avahi_error_dbus_to_number(error->name));
-}
-
-static void client_set_state (AvahiClient *client, AvahiServerState state) {
- assert(client);
-
- if (client->state == state)
- return;
-
- client->state = state;
-
- switch (client->state) {
- case AVAHI_CLIENT_FAILURE:
- if (client->bus) {
- dbus_connection_disconnect(client->bus);
- dbus_connection_unref(client->bus);
- client->bus = NULL;
- }
-
- /* Fall through */
-
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_S_REGISTERING:
-
- /* Clear cached strings */
- avahi_free(client->host_name);
- avahi_free(client->host_name_fqdn);
- avahi_free(client->domain_name);
-
- client->host_name = NULL;
- client->host_name_fqdn = NULL;
- client->domain_name = NULL;
- break;
-
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_CONNECTING:
- break;
-
- }
-
- if (client->callback)
- client->callback (client, state, client->userdata);
-}
-
-static DBusHandlerResult filter_func(DBusConnection *bus, DBusMessage *message, void *userdata) {
- AvahiClient *client = userdata;
- DBusError error;
-
- assert(bus);
- assert(message);
-
- dbus_error_init(&error);
-
-/* fprintf(stderr, "dbus: interface=%s, path=%s, member=%s\n", */
-/* dbus_message_get_interface (message), */
-/* dbus_message_get_path (message), */
-/* dbus_message_get_member (message)); */
-
- if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
-
- /* The DBUS server died or kicked us */
- avahi_client_set_errno(client, AVAHI_ERR_DISCONNECTED);
- goto fail;
-
- } else if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameAcquired")) {
-
- /* Ignore this message */
-
- } else if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
- char *name, *old, *new;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &old,
- DBUS_TYPE_STRING, &new,
- DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
-
- fprintf(stderr, "WARNING: Failed to parse NameOwnerChanged signal: %s\n", error.message);
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (strcmp(name, AVAHI_DBUS_NAME) == 0) {
-
- if (avahi_client_is_connected(client)) {
-
- /* Regardless if the server lost or acquired its name or
- * if the name was transfered: our services are no longer
- * available, so we disconnect ourselves */
- avahi_client_set_errno(client, AVAHI_ERR_DISCONNECTED);
- goto fail;
-
- } else if (client->state == AVAHI_CLIENT_CONNECTING && (!old || *old == 0)) {
- int ret;
-
- /* Server appeared */
-
- if ((ret = init_server(client, NULL)) < 0) {
- avahi_client_set_errno(client, ret);
- goto fail;
- }
- }
- }
-
- } else if (!avahi_client_is_connected(client)) {
-
- /* Ignore messages we get in unconnected state */
-
- } else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_SERVER, "StateChanged")) {
- int32_t state;
- char *e = NULL;
- int c;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &state,
- DBUS_TYPE_STRING, &e,
- DBUS_TYPE_INVALID) || dbus_error_is_set (&error)) {
-
- fprintf(stderr, "WARNING: Failed to parse Server.StateChanged signal: %s\n", error.message);
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if ((c = avahi_error_dbus_to_number(e)) != AVAHI_OK)
- avahi_client_set_errno(client, c);
-
- client_set_state(client, (AvahiClientState) state);
-
- } else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "StateChanged")) {
- const char *path;
- AvahiEntryGroup *g;
- path = dbus_message_get_path(message);
-
- for (g = client->groups; g; g = g->groups_next)
- if (strcmp(g->path, path) == 0)
- break;
-
- if (g) {
- int32_t state;
- char *e;
- int c;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &state,
- DBUS_TYPE_STRING, &e,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
-
- fprintf(stderr, "WARNING: Failed to parse EntryGroup.StateChanged signal: %s\n", error.message);
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if ((c = avahi_error_dbus_to_number(e)) != AVAHI_OK)
- avahi_client_set_errno(client, c);
-
- avahi_entry_group_set_state(g, state);
- }
-
- } else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "ItemNew"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "ItemRemove"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "CacheExhausted"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "AllForNow"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Failure"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "ItemNew"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "ItemRemove"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "CacheExhausted"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "AllForNow"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Failure"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "ItemNew"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "ItemRemove"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "CacheExhausted"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "AllForNow"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Failure"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Found"))
- return avahi_service_resolver_event (client, AVAHI_RESOLVER_FOUND, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Failure"))
- return avahi_service_resolver_event (client, AVAHI_RESOLVER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Found"))
- return avahi_host_name_resolver_event (client, AVAHI_RESOLVER_FOUND, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Failure"))
- return avahi_host_name_resolver_event (client, AVAHI_RESOLVER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Found"))
- return avahi_address_resolver_event (client, AVAHI_RESOLVER_FOUND, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Failure"))
- return avahi_address_resolver_event (client, AVAHI_RESOLVER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "ItemNew"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "ItemRemove"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "CacheExhausted"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "AllForNow"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Failure"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_FAILURE, message);
-
- else {
-
- fprintf(stderr, "WARNING: Unhandled message: interface=%s, path=%s, member=%s\n",
- dbus_message_get_interface(message),
- dbus_message_get_path(message),
- dbus_message_get_member(message));
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, avahi_error_dbus_to_number(error.name));
- dbus_error_free(&error);
- }
-
- client_set_state(client, AVAHI_CLIENT_FAILURE);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static int get_server_state(AvahiClient *client, int *ret_error) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int32_t state;
- int e = AVAHI_ERR_NO_MEMORY;
-
- assert(client);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetState")))
- goto fail;
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- client_set_state(client, (AvahiServerState) state);
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- e = avahi_error_dbus_to_number (error.name);
- dbus_error_free(&error);
- }
-
- if (ret_error)
- *ret_error = e;
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- return e;
-}
-
-static int check_version(AvahiClient *client, int *ret_error) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- uint32_t version;
- int e = AVAHI_ERR_NO_MEMORY;
-
- assert(client);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetAPIVersion")))
- goto fail;
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error)) {
- char *version_str;
-
- if (!dbus_error_is_set(&error) || strcmp(error.name, DBUS_ERROR_UNKNOWN_METHOD))
- goto fail;
-
- /* If the method GetAPIVersion is not known, we look if
- * GetVersionString matches "avahi 0.6" which is the only
- * version we support which doesn't have GetAPIVersion() .*/
-
- dbus_message_unref(message);
- if (reply) dbus_message_unref(reply);
- dbus_error_free(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetVersionString")))
- goto fail;
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &version_str, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- version = strcmp(version_str, "avahi 0.6") == 0 ? 0x0201 : 0x0000;
-
- } else {
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &version, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error))
- goto fail;
- }
-
- /*fprintf(stderr, "API Version 0x%04x\n", version);*/
-
- if ((version & 0xFF00) != (AVAHI_CLIENT_DBUS_API_SUPPORTED & 0xFF00) ||
- (version & 0x00FF) < (AVAHI_CLIENT_DBUS_API_SUPPORTED & 0x00FF)) {
- e = AVAHI_ERR_VERSION_MISMATCH;
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- e = avahi_error_dbus_to_number (error.name);
- dbus_error_free(&error);
- }
-
- if (ret_error)
- *ret_error = e;
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- return e;
-}
-
-static int init_server(AvahiClient *client, int *ret_error) {
- int r;
-
- if ((r = check_version(client, ret_error)) < 0)
- return r;
-
- if ((r = get_server_state(client, ret_error)) < 0)
- return r;
-
- return AVAHI_OK;
-}
-
-/* This function acts like dbus_bus_get but creates a private
- * connection instead. Eventually this should be replaced by a DBUS
- * provided version. */
-static DBusConnection* avahi_dbus_bus_get(DBusError *error) {
- DBusConnection *c;
- const char *a;
-
- if (!(a = getenv("DBUS_SYSTEM_BUS_ADDRESS")) || !*a)
- a = DBUS_SYSTEM_BUS_DEFAULT_ADDRESS;
-
- if (!(c = dbus_connection_open_private(a, error)))
- return NULL;
-
- dbus_connection_set_exit_on_disconnect(c, FALSE);
-
- if (!dbus_bus_register(c, error)) {
- dbus_connection_close(c);
- dbus_connection_unref(c);
- return NULL;
- }
-
- return c;
-}
-
-AvahiClient *avahi_client_new(const AvahiPoll *poll_api, AvahiClientFlags flags, AvahiClientCallback callback, void *userdata, int *ret_error) {
- AvahiClient *client = NULL;
- DBusError error;
-
- dbus_error_init(&error);
-
- if (!(client = avahi_new(AvahiClient, 1))) {
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_MEMORY;
- goto fail;
- }
-
- client->poll_api = poll_api;
- client->error = AVAHI_OK;
- client->callback = callback;
- client->userdata = userdata;
- client->state = (AvahiClientState) -1;
- client->flags = flags;
-
- client->host_name = NULL;
- client->host_name_fqdn = NULL;
- client->domain_name = NULL;
- client->version_string = NULL;
- client->local_service_cookie_valid = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiEntryGroup, client->groups);
- AVAHI_LLIST_HEAD_INIT(AvahiDomainBrowser, client->domain_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiServiceBrowser, client->service_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiServiceTypeBrowser, client->service_type_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiServiceResolver, client->service_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiHostNameResolver, client->host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiAddressResolver, client->address_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiRecordBrowser, client->record_browsers);
-
- if (!(client->bus = avahi_dbus_bus_get(&error)) || dbus_error_is_set(&error)) {
- if (ret_error)
- *ret_error = AVAHI_ERR_DBUS_ERROR;
- goto fail;
- }
-
- if (avahi_dbus_connection_glue(client->bus, poll_api) < 0) {
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_MEMORY; /* Not optimal */
- goto fail;
- }
-
- if (!dbus_connection_add_filter (client->bus, filter_func, client, NULL)) {
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_MEMORY;
- goto fail;
- }
-
- dbus_bus_add_match(
- client->bus,
- "type='signal', "
- "interface='" AVAHI_DBUS_INTERFACE_SERVER "', "
- "sender='" AVAHI_DBUS_NAME "', "
- "path='" AVAHI_DBUS_PATH_SERVER "'",
- &error);
-
- if (dbus_error_is_set(&error))
- goto fail;
-
- dbus_bus_add_match (
- client->bus,
- "type='signal', "
- "interface='" DBUS_INTERFACE_DBUS "', "
- "sender='" DBUS_SERVICE_DBUS "', "
- "path='" DBUS_PATH_DBUS "'",
- &error);
-
- if (dbus_error_is_set(&error))
- goto fail;
-
- dbus_bus_add_match (
- client->bus,
- "type='signal', "
- "interface='" DBUS_INTERFACE_LOCAL "'",
- &error);
-
- if (dbus_error_is_set(&error))
- goto fail;
-
-
- if (!(dbus_bus_name_has_owner(client->bus, AVAHI_DBUS_NAME, &error)) ||
- dbus_error_is_set(&error)) {
-
- /* We free the error so its not set, that way the fail target
- * will return the NO_DAEMON error rather than a DBUS error */
- dbus_error_free(&error);
-
- if (!(flags & AVAHI_CLIENT_NO_FAIL)) {
-
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_DAEMON;
-
- goto fail;
- }
-
- /* The user doesn't want this call to fail if the daemon is not
- * available, so let's return succesfully */
- client_set_state(client, AVAHI_CLIENT_CONNECTING);
-
- } else {
-
- if (init_server(client, ret_error) < 0)
- goto fail;
- }
-
- return client;
-
-fail:
-
- if (client)
- avahi_client_free(client);
-
- if (dbus_error_is_set(&error)) {
-
- if (ret_error) {
- if (strcmp(error.name, DBUS_ERROR_FILE_NOT_FOUND) == 0)
- /* DBUS returns this error when the DBUS daemon is not running */
- *ret_error = AVAHI_ERR_NO_DAEMON;
- else
- *ret_error = avahi_error_dbus_to_number(error.name);
- }
-
- dbus_error_free(&error);
- }
-
- return NULL;
-}
-
-void avahi_client_free(AvahiClient *client) {
- assert(client);
-
- if (client->bus)
- /* Disconnect in advance, so that the free() functions won't
- * issue needless server calls */
- dbus_connection_disconnect(client->bus);
-
- while (client->groups)
- avahi_entry_group_free(client->groups);
-
- while (client->domain_browsers)
- avahi_domain_browser_free(client->domain_browsers);
-
- while (client->service_browsers)
- avahi_service_browser_free(client->service_browsers);
-
- while (client->service_type_browsers)
- avahi_service_type_browser_free(client->service_type_browsers);
-
- while (client->service_resolvers)
- avahi_service_resolver_free(client->service_resolvers);
-
- while (client->host_name_resolvers)
- avahi_host_name_resolver_free(client->host_name_resolvers);
-
- while (client->address_resolvers)
- avahi_address_resolver_free(client->address_resolvers);
-
- while (client->record_browsers)
- avahi_record_browser_free(client->record_browsers);
-
- if (client->bus)
- dbus_connection_unref(client->bus);
-
- avahi_free(client->version_string);
- avahi_free(client->host_name);
- avahi_free(client->host_name_fqdn);
- avahi_free(client->domain_name);
-
- avahi_free(client);
-}
-
-static char* avahi_client_get_string_reply_and_block (AvahiClient *client, const char *method, const char *param) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *ret, *n;
-
- assert(client);
- assert(method);
-
- dbus_error_init (&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, method))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (param) {
- if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &param, DBUS_TYPE_INVALID)) {
- avahi_client_set_errno (client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
- }
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &ret, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- if (!(n = avahi_strdup(ret))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return n;
-
-fail:
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- return NULL;
-}
-
-const char* avahi_client_get_version_string(AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->version_string)
- client->version_string = avahi_client_get_string_reply_and_block(client, "GetVersionString", NULL);
-
- return client->version_string;
-}
-
-const char* avahi_client_get_domain_name(AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->domain_name)
- client->domain_name = avahi_client_get_string_reply_and_block(client, "GetDomainName", NULL);
-
- return client->domain_name;
-}
-
-const char* avahi_client_get_host_name(AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->host_name)
- client->host_name = avahi_client_get_string_reply_and_block(client, "GetHostName", NULL);
-
- return client->host_name;
-}
-
-const char* avahi_client_get_host_name_fqdn (AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->host_name_fqdn)
- client->host_name_fqdn = avahi_client_get_string_reply_and_block(client, "GetHostNameFqdn", NULL);
-
- return client->host_name_fqdn;
-}
-
-AvahiClientState avahi_client_get_state(AvahiClient *client) {
- assert(client);
-
- return client->state;
-}
-
-int avahi_client_errno(AvahiClient *client) {
- assert(client);
-
- return client->error;
-}
-
-/* Just for internal use */
-int avahi_client_simple_method_call(AvahiClient *client, const char *path, const char *interface, const char *method) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
-
- dbus_error_init(&error);
-
- assert(client);
- assert(path);
- assert(interface);
- assert(method);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, path, interface, method))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-uint32_t avahi_client_get_local_service_cookie(AvahiClient *client) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return AVAHI_SERVICE_COOKIE_INVALID;
- }
-
- if (client->local_service_cookie_valid)
- return client->local_service_cookie;
-
- dbus_error_init (&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetLocalServiceCookie"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &client->local_service_cookie, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- client->local_service_cookie_valid = 1;
- return client->local_service_cookie;
-
-fail:
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- return AVAHI_SERVICE_COOKIE_INVALID;
-}
-
-int avahi_client_is_connected(AvahiClient *client) {
- assert(client);
-
- return
- dbus_connection_get_is_connected(client->bus) &&
- (client->state == AVAHI_CLIENT_S_RUNNING || client->state == AVAHI_CLIENT_S_REGISTERING || client->state == AVAHI_CLIENT_S_COLLISION);
-}
diff --git a/release-0.6.9/avahi-client/client.h b/release-0.6.9/avahi-client/client.h
deleted file mode 100644
index 16fde91..0000000
--- a/release-0.6.9/avahi-client/client.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef fooclienthfoo
-#define fooclienthfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/gccmacro.h>
-
-/** \file client.h Definitions and functions for the client API over D-Bus */
-
-/** \example glib-integration.c Example of how to integrate
- * avahi use with GLIB/GTK applications */
-
-AVAHI_C_DECL_BEGIN
-
-/** A connection context */
-typedef struct AvahiClient AvahiClient;
-
-/** States of a client object, a superset of AvahiServerState */
-typedef enum {
- AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING, /**< Server state: REGISTERING */
- AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING, /**< Server state: RUNNING */
- AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION, /**< Server state: COLLISION */
- AVAHI_CLIENT_FAILURE = 100, /**< Some kind of error happened on the client side */
- AVAHI_CLIENT_CONNECTING = 101 /**< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available. */
-} AvahiClientState;
-
-typedef enum {
- AVAHI_CLIENT_IGNORE_USER_CONFIG = 1, /**< Don't read user configuration */
- AVAHI_CLIENT_NO_FAIL = 2 /**< Don't fail if the daemon is not available when avahi_client_new() is called, instead enter AVAHI_CLIENT_CONNECTING state and wait for the daemon to appear */
-} AvahiClientFlags;
-
-/** The function prototype for the callback of an AvahiClient */
-typedef void (*AvahiClientCallback) (
- AvahiClient *s,
- AvahiClientState state /**< The new state of the client */,
- void* userdata /**< The user data that was passed to avahi_client_new() */);
-
-/** Creates a new client instance */
-AvahiClient* avahi_client_new (
- const AvahiPoll *poll_api /**< The abstract event loop API to use */,
- AvahiClientFlags flags /**< Some flags to modify the behaviour of the client library */,
- AvahiClientCallback callback /**< A callback that is called whenever the state of the client changes. This may be NULL */,
- void *userdata /**< Some arbitrary user data pointer that will be passed to the callback function */,
- int *error /**< If creation of the client fails, this integer will contain the error cause. May be NULL if you aren't interested in the reason why avahi_client_new() failed. */);
-
-/** Free a client instance. This will automatically free all
- * associated browser, resolve and entry group objects. All pointers
- * to such objects become invalid! */
-void avahi_client_free(AvahiClient *client);
-
-/** Get the version of the server */
-const char* avahi_client_get_version_string (AvahiClient*);
-
-/** Get host name */
-const char* avahi_client_get_host_name (AvahiClient*);
-
-/** Get domain name */
-const char* avahi_client_get_domain_name (AvahiClient*);
-
-/** Get FQDN domain name */
-const char* avahi_client_get_host_name_fqdn (AvahiClient*);
-
-/** Get state */
-AvahiClientState avahi_client_get_state(AvahiClient *client);
-
-/** Get the last error number */
-int avahi_client_errno (AvahiClient*);
-
-/** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
-uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
-
-/** Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise. \since 0.6.5 */
-int avahi_nss_support(void);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-client/entrygroup.c b/release-0.6.9/avahi-client/entrygroup.c
deleted file mode 100644
index e43a44f..0000000
--- a/release-0.6.9/avahi-client/entrygroup.c
+++ /dev/null
@@ -1,875 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-
-#include "client.h"
-#include "internal.h"
-
-void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state) {
- assert(group);
-
- if (group->state == state)
- return;
-
- group->state = state;
-
- if (group->callback)
- group->callback(group, state, group->userdata);
-}
-
-static int retrieve_state(AvahiEntryGroup *group) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
- int32_t state;
- AvahiClient *client;
-
- dbus_error_init(&error);
-
- assert(group);
- client = group->client;
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "GetState"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- avahi_entry_group_set_state(group, (AvahiEntryGroupState) state);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCallback callback, void *userdata) {
- AvahiEntryGroup *group = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
-
- assert(client);
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(group = avahi_new(AvahiEntryGroup, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- group->client = client;
- group->callback = callback;
- group->userdata = userdata;
- group->state = AVAHI_ENTRY_GROUP_UNCOMMITED;
- group->path = NULL;
- AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, client->groups, group);
-
- if (!(message = dbus_message_new_method_call(
- AVAHI_DBUS_NAME,
- AVAHI_DBUS_PATH_SERVER,
- AVAHI_DBUS_INTERFACE_SERVER,
- "EntryGroupNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- avahi_client_set_errno (client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- avahi_client_set_errno (client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(group->path = avahi_strdup (path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (retrieve_state(group) < 0)
- goto fail;
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return group;
-
-fail:
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (group)
- avahi_entry_group_free(group);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-static int entry_group_simple_method_call(AvahiEntryGroup *group, const char *method) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
- AvahiClient *client;
-
- dbus_error_init(&error);
-
- assert(group);
- client = group->client;
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, method))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-int avahi_entry_group_free(AvahiEntryGroup *group) {
- AvahiClient *client = group->client;
- int r = AVAHI_OK;
-
- assert(group);
-
- if (group->path && avahi_client_is_connected(client))
- r = entry_group_simple_method_call(group, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, client->groups, group);
-
- avahi_free(group->path);
- avahi_free(group);
-
- return r;
-}
-
-int avahi_entry_group_commit(AvahiEntryGroup *group) {
- assert(group);
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- return entry_group_simple_method_call(group, "Commit");
-}
-
-int avahi_entry_group_reset(AvahiEntryGroup *group) {
- assert(group);
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- return entry_group_simple_method_call(group, "Reset");
-}
-
-int avahi_entry_group_get_state (AvahiEntryGroup *group) {
- assert (group);
-
- return group->state;
-}
-
-AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup *group) {
- assert(group);
-
- return group->client;
-}
-
-int avahi_entry_group_is_empty (AvahiEntryGroup *group) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
- int b;
- AvahiClient *client;
-
- assert(group);
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "IsEmpty"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_BOOLEAN, &b, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return !!b;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-static int append_rdata(DBusMessage *message, const void *rdata, size_t size) {
- DBusMessageIter iter, sub;
-
- assert(message);
-
- dbus_message_iter_init_append(message, &iter);
-
- if (!(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &sub)) ||
- !(dbus_message_iter_append_fixed_array(&sub, DBUS_TYPE_BYTE, &rdata, size)) ||
- !(dbus_message_iter_close_container(&iter, &sub)))
- return -1;
-
- return 0;
-}
-
-static int append_string_list(DBusMessage *message, AvahiStringList *txt) {
- DBusMessageIter iter, sub;
- int r = -1;
- AvahiStringList *p;
-
- assert(message);
-
- dbus_message_iter_init_append(message, &iter);
-
- /* Reverse the string list, so that we can pass it in-order to the server */
- txt = avahi_string_list_reverse(txt);
-
- if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "ay", &sub))
- goto fail;
-
- /* Assemble the AvahiStringList into an Array of Array of Bytes to send over dbus */
- for (p = txt; p != NULL; p = p->next) {
- DBusMessageIter sub2;
- const uint8_t *data = p->text;
-
- if (!(dbus_message_iter_open_container(&sub, DBUS_TYPE_ARRAY, "y", &sub2)) ||
- !(dbus_message_iter_append_fixed_array(&sub2, DBUS_TYPE_BYTE, &data, p->size)) ||
- !(dbus_message_iter_close_container(&sub, &sub2)))
- goto fail;
- }
-
- if (!dbus_message_iter_close_container(&iter, &sub))
- goto fail;
-
- r = 0;
-
-fail:
-
- /* Reverse the string list to the original state */
- txt = avahi_string_list_reverse(txt);
-
- return r;
-}
-
-int avahi_entry_group_add_service_strlst(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *txt) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(group);
- assert(name);
- assert(type);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if (!domain)
- domain = "";
-
- if (!host)
- host = "";
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddService"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID) ||
- append_string_list(message, txt) < 0) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-int avahi_entry_group_add_service(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- ...) {
-
- va_list va;
- int r;
- AvahiStringList *txt;
-
- assert(group);
-
- va_start(va, port);
- txt = avahi_string_list_new_va(va);
- r = avahi_entry_group_add_service_strlst(group, interface, protocol, flags, name, type, domain, host, port, txt);
- avahi_string_list_free(txt);
- va_end(va);
- return r;
-}
-
-int avahi_entry_group_add_service_subtype(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *subtype) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(group);
- assert(name);
- assert(type);
- assert(subtype);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if (!domain)
- domain = "";
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddServiceSubtype"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &subtype,
- DBUS_TYPE_INVALID)) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-
-}
-
-int avahi_entry_group_update_service_txt(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- ...) {
-
- va_list va;
- int r;
- AvahiStringList *txt;
-
- va_start(va, domain);
- txt = avahi_string_list_new_va(va);
- r = avahi_entry_group_update_service_txt_strlst(group, interface, protocol, flags, name, type, domain, txt);
- avahi_string_list_free(txt);
- va_end(va);
- return r;
-}
-
-int avahi_entry_group_update_service_txt_strlst(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *txt) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(group);
- assert(name);
- assert(type);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if (!domain)
- domain = "";
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "UpdateServiceTxt"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INVALID) ||
- append_string_list(message, txt) < 0) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-/** Add a host/address pair */
-int avahi_entry_group_add_address(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const AvahiAddress *a) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
- char s_address[AVAHI_ADDRESS_STR_MAX];
- char *p_address = s_address;
-
- assert(name);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddAddress"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!avahi_address_snprint (s_address, sizeof (s_address), a))
- {
- r = avahi_client_set_errno(client, AVAHI_ERR_INVALID_ADDRESS);
- goto fail;
- }
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &p_address,
- DBUS_TYPE_INVALID)) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-/** Add an arbitrary record */
-int avahi_entry_group_add_record(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- uint32_t ttl,
- const void *rdata,
- size_t size) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(name);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddRecord"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &ttl,
- DBUS_TYPE_INVALID) || append_rdata(message, rdata, size) < 0) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
diff --git a/release-0.6.9/avahi-client/internal.h b/release-0.6.9/avahi-client/internal.h
deleted file mode 100644
index 7a79dd7..0000000
--- a/release-0.6.9/avahi-client/internal.h
+++ /dev/null
@@ -1,173 +0,0 @@
-#ifndef foointernalhfoo
-#define foointernalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <dbus/dbus.h>
-
-#include "client.h"
-#include "lookup.h"
-#include "publish.h"
-
-struct AvahiClient {
- const AvahiPoll *poll_api;
- DBusConnection *bus;
- int error;
- AvahiClientState state;
- AvahiClientFlags flags;
-
- /* Cache for some seldom changing server data */
- char *version_string, *host_name, *host_name_fqdn, *domain_name;
- uint32_t local_service_cookie;
- int local_service_cookie_valid;
-
- AvahiClientCallback callback;
- void *userdata;
-
- AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
- AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers);
- AVAHI_LLIST_HEAD(AvahiServiceBrowser, service_browsers);
- AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers);
- AVAHI_LLIST_HEAD(AvahiServiceResolver, service_resolvers);
- AVAHI_LLIST_HEAD(AvahiHostNameResolver, host_name_resolvers);
- AVAHI_LLIST_HEAD(AvahiAddressResolver, address_resolvers);
- AVAHI_LLIST_HEAD(AvahiRecordBrowser, record_browsers);
-};
-
-struct AvahiEntryGroup {
- char *path;
- AvahiEntryGroupState state;
- AvahiClient *client;
- AvahiEntryGroupCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
-};
-
-struct AvahiDomainBrowser {
- int ref;
-
- char *path;
- AvahiClient *client;
- AvahiDomainBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiDomainBrowser, domain_browsers);
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- AvahiTimeout *defer_timeout;
-
- AvahiStringList *static_browse_domains;
-};
-
-struct AvahiServiceBrowser {
- char *path;
- AvahiClient *client;
- AvahiServiceBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiServiceBrowser, service_browsers);
-
- char *type, *domain;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiServiceTypeBrowser {
- char *path;
- AvahiClient *client;
- AvahiServiceTypeBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, service_type_browsers);
-
- char *domain;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiServiceResolver {
- char *path;
- AvahiClient *client;
- AvahiServiceResolverCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiServiceResolver, service_resolvers);
-
- char *name, *type, *domain;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiHostNameResolver {
- char *path;
- AvahiClient *client;
- AvahiHostNameResolverCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiHostNameResolver, host_name_resolvers);
-
- char *host_name;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiAddressResolver {
- char *path;
- AvahiClient *client;
- AvahiAddressResolverCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiAddressResolver, address_resolvers);
-
- AvahiAddress address;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiRecordBrowser {
- char *path;
- AvahiClient *client;
- AvahiRecordBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiRecordBrowser, record_browsers);
-
- char *name;
- uint16_t clazz, type;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-int avahi_client_set_errno (AvahiClient *client, int error);
-int avahi_client_set_dbus_error(AvahiClient *client, DBusError *error);
-
-void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state);
-
-DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-DBusHandlerResult avahi_service_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-
-DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
-DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
-DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
-
-int avahi_client_simple_method_call(AvahiClient *client, const char *path, const char *interface, const char *method);
-
-int avahi_client_is_connected(AvahiClient *client);
-
-#endif
diff --git a/release-0.6.9/avahi-client/lookup.h b/release-0.6.9/avahi-client/lookup.h
deleted file mode 100644
index 89d1fb2..0000000
--- a/release-0.6.9/avahi-client/lookup.h
+++ /dev/null
@@ -1,271 +0,0 @@
-#ifndef fooclientlookuphfoo
-#define fooclientlookuphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/gccmacro.h>
-
-#include <avahi-client/client.h>
-
-/** \file avahi-client/lookup.h Lookup Client API */
-
-/** \example client-browse-services.c Example how to browse for DNS-SD
- * services using the client interface to avahi-daemon. */
-
-AVAHI_C_DECL_BEGIN
-
-/** A domain browser object */
-typedef struct AvahiDomainBrowser AvahiDomainBrowser;
-
-/** A service browser object */
-typedef struct AvahiServiceBrowser AvahiServiceBrowser;
-
-/** A service type browser object */
-typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
-
-/** A service resolver object */
-typedef struct AvahiServiceResolver AvahiServiceResolver;
-
-/** A service resolver object */
-typedef struct AvahiHostNameResolver AvahiHostNameResolver;
-
-/** An address resolver object */
-typedef struct AvahiAddressResolver AvahiAddressResolver;
-
-/** A record browser object */
-typedef struct AvahiRecordBrowser AvahiRecordBrowser;
-
-/** The function prototype for the callback of an AvahiDomainBrowser */
-typedef void (*AvahiDomainBrowserCallback) (
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiServiceBrowser */
-typedef void (*AvahiServiceBrowserCallback) (
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiServiceTypeBrowser */
-typedef void (*AvahiServiceTypeBrowserCallback) (
- AvahiServiceTypeBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiServiceResolver */
-typedef void (*AvahiServiceResolverCallback) (
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiHostNameResolver */
-typedef void (*AvahiHostNameResolverCallback) (
- AvahiHostNameResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const AvahiAddress *a,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiAddressResolver */
-typedef void (*AvahiAddressResolverCallback) (
- AvahiAddressResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *name,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiRecordBrowser */
-typedef void (*AvahiRecordBrowserCallback) (
- AvahiRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- const void *rdata,
- size_t size,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** Browse for domains on the local network */
-AvahiDomainBrowser* avahi_domain_browser_new (
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType btype,
- AvahiLookupFlags flags,
- AvahiDomainBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiDomainBrowser object */
-AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *);
-
-/** Cleans up and frees an AvahiDomainBrowser object */
-int avahi_domain_browser_free (AvahiDomainBrowser *);
-
-/** Browse for service types on the local network */
-AvahiServiceTypeBrowser* avahi_service_type_browser_new (
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceTypeBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiServiceTypeBrowser object */
-AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *);
-
-/** Cleans up and frees an AvahiServiceTypeBrowser object */
-int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
-
-/** Browse for services of a type on the local network */
-AvahiServiceBrowser* avahi_service_browser_new (
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *type,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiServiceBrowser object */
-AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *);
-
-/** Cleans up and frees an AvahiServiceBrowser object */
-int avahi_service_browser_free (AvahiServiceBrowser *);
-
-/** Create a new service resolver object */
-AvahiServiceResolver * avahi_service_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiServiceResolverCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiServiceResolver object */
-AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *);
-
-/** Free a service resolver object */
-int avahi_service_resolver_free(AvahiServiceResolver *r);
-
-/** Create a new hostname resolver object */
-AvahiHostNameResolver * avahi_host_name_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiHostNameResolverCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiHostNameResolver object */
-AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *);
-
-/** Free a hostname resolver object */
-int avahi_host_name_resolver_free(AvahiHostNameResolver *r);
-
-/** Create a new address resolver object from an AvahiAddress object */
-AvahiAddressResolver* avahi_address_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *a,
- AvahiLookupFlags flags,
- AvahiAddressResolverCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiAddressResolver object */
-AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *);
-
-/** Free a AvahiAddressResolver resolver object */
-int avahi_address_resolver_free(AvahiAddressResolver *r);
-
-/** Browse for records of a type on the local network */
-AvahiRecordBrowser* avahi_record_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- AvahiLookupFlags flags,
- AvahiRecordBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiRecordBrowser object */
-AvahiClient* avahi_record_browser_get_client(AvahiRecordBrowser *);
-
-/** Cleans up and frees an AvahiRecordBrowser object */
-int avahi_record_browser_free(AvahiRecordBrowser *);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-client/publish.h b/release-0.6.9/avahi-client/publish.h
deleted file mode 100644
index 053ea88..0000000
--- a/release-0.6.9/avahi-client/publish.h
+++ /dev/null
@@ -1,160 +0,0 @@
-#ifndef fooclientpublishhfoo
-#define fooclientpublishhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/gccmacro.h>
-
-#include <avahi-client/client.h>
-
-/** \file avahi-client/publish.h Publishing Client API */
-
-/** \example client-publish-service.c Example how to register a DNS-SD
- * service using the client interface to avahi-daemon. It behaves like a network
- * printer registering both an IPP and a BSD LPR service. */
-
-AVAHI_C_DECL_BEGIN
-
-/** An entry group object */
-typedef struct AvahiEntryGroup AvahiEntryGroup;
-
-/** The function prototype for the callback of an AvahiEntryGroup */
-typedef void (*AvahiEntryGroupCallback) (
- AvahiEntryGroup *g,
- AvahiEntryGroupState state /**< The new state of the entry group */,
- void* userdata /* The arbitrary user data pointer originally passed to avahi_entry_group_new()*/);
-
-/** Create a new AvahiEntryGroup object */
-AvahiEntryGroup* avahi_entry_group_new(
- AvahiClient* c,
- AvahiEntryGroupCallback callback /**< This callback is called whenever the state of this entry group changes. May not be NULL. */,
- void *userdata /**< This arbitrary user data pointer will be passed to the callback functon */);
-
-/** Clean up and free an AvahiEntryGroup object */
-int avahi_entry_group_free (AvahiEntryGroup *);
-
-/** Commit an AvahiEntryGroup. The entries in the entry group are now registered on the network. Commiting empty entry groups is considered an error. */
-int avahi_entry_group_commit (AvahiEntryGroup*);
-
-/** Reset an AvahiEntryGroup. This takes effect immediately. */
-int avahi_entry_group_reset (AvahiEntryGroup*);
-
-/** Get an AvahiEntryGroup's state */
-int avahi_entry_group_get_state (AvahiEntryGroup*);
-
-/** Check if an AvahiEntryGroup is empty */
-int avahi_entry_group_is_empty (AvahiEntryGroup*);
-
-/** Get an AvahiEntryGroup's owning client instance */
-AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
-
-/** Add a service. Takes a variable NULL terminated list of TXT record strings as last arguments. Please note that this service is not announced on the network before avahi_entry_group_commit() is called. */
-int avahi_entry_group_add_service(
- AvahiEntryGroup *group,
- AvahiIfIndex interface /**< The interface this service shall be announced on. We recommend to pass AVAHI_IF_UNSPEC here, to announce on all interfaces. */,
- AvahiProtocol protocol /**< The protocol this service shall be announced with, i.e. MDNS over IPV4 or MDNS over IPV6. We recommend to pass AVAHI_PROTO_UNSPEC here, to announce this service on all protocols the daemon supports. */,
- AvahiPublishFlags flags /**< Usually 0, unless you know what you do */,
- const char *name /**< The name for the new service. May not be NULL. */,
- const char *type /**< The service type for the new service, such as _http._tcp. May not be NULL. */,
- const char *domain /**< The domain to register this domain in. We recommend to pass NULL here, to let the daemon decide */,
- const char *host /**< The host this services is residing on. We recommend to pass NULL here, the daemon will than automatically insert the local host name in that case */,
- uint16_t port /**< The IP port number of this service */,
- ...) AVAHI_GCC_SENTINEL;
-
-/** Add a service, takes an AvahiStringList for TXT records. Arguments have the same meaning as for avahi_entry_group_add_service(). */
-int avahi_entry_group_add_service_strlst(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *txt /**< The TXT data for this service. You may free this object after calling this function, it is not referenced any further */);
-
-/** Add a subtype for a service. The service should already be existent in the entry group. You may add as many subtypes for a service as you wish. */
-int avahi_entry_group_add_service_subtype(
- AvahiEntryGroup *group,
- AvahiIfIndex interface /**< The interface this subtype shall be announced on. This should match the value passed for the original avahi_entry_group_add_service() call. */,
- AvahiProtocol protocol /**< The protocol this subtype shall be announced with. This should match the value passed for the original avahi_entry_group_add_service() call. */,
- AvahiPublishFlags flags /**< Only != 0 if you really know what you do */,
- const char *name /**< The name of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *type /**< The type of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *domain /**< The domain this service resides is, as passed to avahi_entry_group_add_service(). May be NULL. */,
- const char *subtype /**< The new subtype to register for the specified service. May not be NULL. */);
-
-/** Update a TXT record for an existing service. The service should already be existent in the entry group. */
-int avahi_entry_group_update_service_txt(
- AvahiEntryGroup *g,
- AvahiIfIndex interface /**< The interface this service is announced on. This should match the value passed to the original avahi_entry_group_add_service() call. */,
- AvahiProtocol protocol /**< The protocol this service is announced with. This should match the value passed to the original avahi_entry_group_add_service() call. */,
- AvahiPublishFlags flags /**< Only != 0 if you really know what you do */,
- const char *name /**< The name of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *type /**< The type of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *domain /**< The domain this service resides is, as passed to avahi_entry_group_add_service(). May be NULL. */,
- ...) AVAHI_GCC_SENTINEL;
-
-/** Update a TXT record for an existing service. Similar to avahi_entry_group_update_service_txt() but takes an AvahiStringList for the TXT strings, instead of a NULL terminated list of arguments. */
-int avahi_entry_group_update_service_txt_strlst(
- AvahiEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst);
-
-/** Add a host/address pair */
-int avahi_entry_group_add_address(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name /**< The FDQN of the new hostname to register */,
- const AvahiAddress *a /**< The address this host name shall map to */);
-
-/** Add an arbitrary record. I hope you know what you do. */
-int avahi_entry_group_add_record(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- uint32_t ttl,
- const void *rdata,
- size_t size);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-client/resolver.c b/release-0.6.9/avahi-client/resolver.c
deleted file mode 100644
index 2d9f808..0000000
--- a/release-0.6.9/avahi-client/resolver.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-
-#include "client.h"
-#include "internal.h"
-
-/* AvahiServiceResolver implementation */
-
-DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message) {
- AvahiServiceResolver *r = NULL;
- DBusError error;
- const char *path;
- AvahiStringList *strlst = NULL;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (r = client->service_resolvers; r; r = r->service_resolvers_next)
- if (strcmp (r->path, path) == 0)
- break;
-
- if (!r)
- goto fail;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- int j;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *type, *domain, *host, *address;
- uint16_t port;
- DBusMessageIter iter, sub;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
-
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- dbus_message_iter_init(message, &iter);
-
- for (j = 0; j < 9; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_ARRAY) {
- fprintf(stderr, "Error parsing service resolving message\n");
- goto fail;
- }
-
- strlst = NULL;
- dbus_message_iter_recurse(&iter, &sub);
-
- for (;;) {
- DBusMessageIter sub2;
- int at;
-
- if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
- break;
-
- assert(at == DBUS_TYPE_ARRAY);
-
- if (dbus_message_iter_get_element_type(&sub) != DBUS_TYPE_BYTE) {
- fprintf(stderr, "Error parsing service resolving message\n");
- goto fail;
- }
-
- dbus_message_iter_recurse(&sub, &sub2);
-
- if (dbus_message_iter_get_array_len(&sub2) > 0) {
- uint8_t *k;
- int n;
-
- dbus_message_iter_get_fixed_array(&sub2, &k, &n);
- strlst = avahi_string_list_add_arbitrary(strlst, k, n);
- }
-
- dbus_message_iter_next(&sub);
- }
-
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- dbus_message_iter_get_basic(&iter, &flags);
-
- assert(address);
-
- if (address[0] == 0)
- address = NULL;
- else
- avahi_address_parse(address, (AvahiProtocol) aprotocol, &a);
-
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, name, type, domain, host, address ? &a : NULL, port, strlst, (AvahiLookupResultFlags) flags, r->userdata);
-
- avahi_string_list_free(strlst);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(r->client, avahi_error_dbus_to_number(etxt));
- r->callback(r, r->interface, r->protocol, event, r->name, r->type, r->domain, NULL, NULL, 0, NULL, 0, r->userdata);
- break;
- }
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-
-fail:
- dbus_error_free (&error);
- avahi_string_list_free(strlst);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-AvahiServiceResolver * avahi_service_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiServiceResolverCallback callback,
- void *userdata) {
-
- DBusError error;
- AvahiServiceResolver *r = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- char *path;
-
- assert(client);
- assert(type);
-
- if (!domain)
- domain = "";
-
- if (!name)
- name = "";
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(r = avahi_new(AvahiServiceResolver, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->client = client;
- r->callback = callback;
- r->userdata = userdata;
- r->path = NULL;
- r->name = r->type = r->domain = NULL;
- r->interface = interface;
- r->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiServiceResolver, service_resolvers, client->service_resolvers, r);
-
- if (name && name[0])
- if (!(r->name = avahi_strdup(name))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(r->type = avahi_strdup(type))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (domain && domain[0])
- if (!(r->domain = avahi_strdup(domain))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceResolverNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) aprotocol;
- u_flags = (uint32_t) flags;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(r->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return r;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (r)
- avahi_service_resolver_free(r);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-
-}
-
-AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *r) {
- assert (r);
-
- return r->client;
-}
-
-int avahi_service_resolver_free(AvahiServiceResolver *r) {
- AvahiClient *client;
- int ret = AVAHI_OK;
-
- assert(r);
- client = r->client;
-
- if (r->path && avahi_client_is_connected(client))
- ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiServiceResolver, service_resolvers, client->service_resolvers, r);
-
- avahi_free(r->path);
- avahi_free(r->name);
- avahi_free(r->type);
- avahi_free(r->domain);
- avahi_free(r);
-
- return ret;
-}
-
-/* AvahiHostNameResolver implementation */
-
-DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message) {
- AvahiHostNameResolver *r = NULL;
- DBusError error;
- const char *path;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (r = client->host_name_resolvers; r; r = r->host_name_resolvers_next)
- if (strcmp (r->path, path) == 0)
- break;
-
- if (!r)
- goto fail;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *address;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- assert(address);
- if (!avahi_address_parse(address, (AvahiProtocol) aprotocol, &a)) {
- fprintf(stderr, "Failed to parse address\n");
- goto fail;
- }
-
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, name, &a, (AvahiLookupResultFlags) flags, r->userdata);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(r->client, avahi_error_dbus_to_number(etxt));
- r->callback(r, r->interface, r->protocol, event, r->host_name, NULL, 0, r->userdata);
- break;
- }
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-AvahiHostNameResolver * avahi_host_name_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiHostNameResolverCallback callback,
- void *userdata) {
-
- DBusError error;
- AvahiHostNameResolver *r = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- char *path;
-
- assert(client);
- assert(name);
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(r = avahi_new(AvahiHostNameResolver, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->client = client;
- r->callback = callback;
- r->userdata = userdata;
- r->path = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->host_name = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiHostNameResolver, host_name_resolvers, client->host_name_resolvers, r);
-
- if (!(r->host_name = avahi_strdup(name))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "HostNameResolverNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) aprotocol;
- u_flags = (uint32_t) flags;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(r->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return r;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (r)
- avahi_host_name_resolver_free(r);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-
-}
-
-int avahi_host_name_resolver_free(AvahiHostNameResolver *r) {
- int ret = AVAHI_OK;
- AvahiClient *client;
-
- assert(r);
- client = r->client;
-
- if (r->path && avahi_client_is_connected(client))
- ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiHostNameResolver, host_name_resolvers, client->host_name_resolvers, r);
-
- avahi_free(r->path);
- avahi_free(r->host_name);
- avahi_free(r);
-
- return ret;
-}
-
-AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *r) {
- assert (r);
-
- return r->client;
-}
-
-/* AvahiAddressResolver implementation */
-
-DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message) {
- AvahiAddressResolver *r = NULL;
- DBusError error;
- const char *path;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (r = client->address_resolvers; r; r = r->address_resolvers_next)
- if (strcmp (r->path, path) == 0)
- break;
-
- if (!r)
- goto fail;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *address;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- assert(address);
- if (!avahi_address_parse(address, (AvahiProtocol) aprotocol, &a)) {
- fprintf(stderr, "Failed to parse address\n");
- goto fail;
- }
-
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, &a, name, (AvahiLookupResultFlags) flags, r->userdata);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(r->client, avahi_error_dbus_to_number(etxt));
- r->callback(r, r->interface, r->protocol, event, &r->address, NULL, 0, r->userdata);
- break;
- }
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-AvahiAddressResolver * avahi_address_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *a,
- AvahiLookupFlags flags,
- AvahiAddressResolverCallback callback,
- void *userdata) {
-
- DBusError error;
- AvahiAddressResolver *r = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
- char *path;
- char addr[AVAHI_ADDRESS_STR_MAX], *address = addr;
-
- assert(client);
- assert(a);
-
- dbus_error_init (&error);
-
- if (!avahi_address_snprint (addr, sizeof(addr), a)) {
- avahi_client_set_errno(client, AVAHI_ERR_INVALID_ADDRESS);
- return NULL;
- }
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(r = avahi_new(AvahiAddressResolver, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->client = client;
- r->callback = callback;
- r->userdata = userdata;
- r->path = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->address = *a;
-
- AVAHI_LLIST_PREPEND(AvahiAddressResolver, address_resolvers, client->address_resolvers, r);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "AddressResolverNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(r->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return r;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (r)
- avahi_address_resolver_free(r);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-
-}
-
-AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *r) {
- assert (r);
-
- return r->client;
-}
-
-int avahi_address_resolver_free(AvahiAddressResolver *r) {
- AvahiClient *client;
- int ret = AVAHI_OK;
-
- assert(r);
- client = r->client;
-
- if (r->path && avahi_client_is_connected(client))
- ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiAddressResolver, address_resolvers, client->address_resolvers, r);
-
- avahi_free(r->path);
- avahi_free(r);
-
- return ret;
-}
-
diff --git a/release-0.6.9/avahi-client/rr-test.c b/release-0.6.9/avahi-client/rr-test.c
deleted file mode 100644
index 9fffa5d..0000000
--- a/release-0.6.9/avahi-client/rr-test.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-#include <avahi-common/error.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-
-static void hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-static void callback(
- AVAHI_GCC_UNUSED AvahiRecordBrowser *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- const void *rdata,
- size_t rdata_size,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- fprintf(stderr, "%i name=%s class=%u type=%u\n", event, name, clazz, type);
-
- if (rdata)
- hexdump(rdata, rdata_size);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- AvahiSimplePoll *simple_poll;
- const AvahiPoll *poll_api;
- AvahiClient *client;
- AvahiRecordBrowser *r;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- client = avahi_client_new(poll_api, 0, NULL, NULL, NULL);
- assert(client);
-
- r = avahi_record_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "ecstasy.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, 0, callback, simple_poll);
- assert(r);
-
- avahi_simple_poll_loop(simple_poll);
-
- avahi_client_free(client);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-client/srv-test.c b/release-0.6.9/avahi-client/srv-test.c
deleted file mode 100644
index 5242947..0000000
--- a/release-0.6.9/avahi-client/srv-test.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-#include <avahi-common/error.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-
-static void callback(
- AVAHI_GCC_UNUSED AvahiServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- AVAHI_GCC_UNUSED const AvahiAddress *a,
- AVAHI_GCC_UNUSED uint16_t port,
- AVAHI_GCC_UNUSED AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- fprintf(stderr, "%i name=%s type=%s domain=%s host=%s\n", event, name, type, domain, host_name);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- AvahiSimplePoll *simple_poll;
- const AvahiPoll *poll_api;
- AvahiClient *client;
- AvahiServiceResolver *r;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- client = avahi_client_new(poll_api, 0, NULL, NULL, NULL);
- assert(client);
-
- r = avahi_service_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, "_domain._udp", "0pointer.de", AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_NO_TXT, callback, simple_poll);
- assert(r);
-
- avahi_simple_poll_loop(simple_poll);
-
- avahi_client_free(client);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-client/xdg-config-test.c b/release-0.6.9/avahi-client/xdg-config-test.c
deleted file mode 100644
index fe267f2..0000000
--- a/release-0.6.9/avahi-client/xdg-config-test.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/gccmacro.h>
-
-#include "xdg-config.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- FILE *f;
-
- f = avahi_xdg_config_open("foo");
-
- if (f)
- fclose(f);
-}
diff --git a/release-0.6.9/avahi-client/xdg-config.c b/release-0.6.9/avahi-client/xdg-config.c
deleted file mode 100644
index ea4bb98..0000000
--- a/release-0.6.9/avahi-client/xdg-config.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-
-#include "xdg-config.h"
-
-FILE *avahi_xdg_config_open(const char *filename) {
- FILE *f;
- const char *e, *d;
- char fn[PATH_MAX], *p = NULL, buf[2048], *s = NULL;
-
- assert(filename);
-
- if ((e = getenv("XDG_CONFIG_HOME")) && *e)
- snprintf(p = fn, sizeof(fn), "%s/%s", e, filename);
- else if ((e = getenv("HOME")) && *e)
- snprintf(p = fn, sizeof(fn), "%s/.config/%s", e, filename);
-
- if (p) {
- if ((f = fopen(p, "r")))
- return f;
- else if (errno != ENOENT)
- return NULL;
- }
-
- if (!(d = getenv("XDG_CONFIG_DIRS")) || !*d)
- d = "/etc/xdg";
-
- snprintf(buf, sizeof(buf), "%s", d);
-
- for (e = strtok_r(buf, ":", &s); e; e = strtok_r(NULL, ":", &s)) {
- snprintf(fn, sizeof(fn), "%s/%s", e, filename);
-
- if ((f = fopen(fn, "r")))
- return f;
- }
-
- return NULL;
-}
diff --git a/release-0.6.9/avahi-client/xdg-config.h b/release-0.6.9/avahi-client/xdg-config.h
deleted file mode 100644
index 88f66a8..0000000
--- a/release-0.6.9/avahi-client/xdg-config.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef fooxdgconfighfoo
-#define fooxdgconfighfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-
-FILE *avahi_xdg_config_open(const char *filename);
-
-#endif
diff --git a/release-0.6.9/avahi-common/Makefile.am b/release-0.6.9/avahi-common/Makefile.am
deleted file mode 100644
index c786954..0000000
--- a/release-0.6.9/avahi-common/Makefile.am
+++ /dev/null
@@ -1,121 +0,0 @@
-# $Id: Makefile.am 90 2005-05-23 16:15:12Z lennart $
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-avahi_commonincludedir=$(includedir)/avahi-common
-
-avahi_commoninclude_HEADERS = \
- strlst.h \
- address.h \
- alternative.h \
- domain.h \
- cdecl.h \
- defs.h \
- malloc.h \
- watch.h \
- timeval.h \
- simple-watch.h \
- thread-watch.h \
- gccmacro.h \
- error.h \
- llist.h \
- rlist.h
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- strlst-test \
- domain-test \
- alternative-test \
- timeval-test \
- watch-test \
- watch-test-thread
-endif
-
-lib_LTLIBRARIES = \
- libavahi-common.la
-
-libavahi_common_la_SOURCES = \
- malloc.c malloc.h \
- address.c address.h \
- alternative.c alternative.h \
- error.c error.h \
- strlst.c strlst.h \
- domain.c domain.h \
- timeval.c timeval.h \
- simple-watch.c simple-watch.h \
- thread-watch.c thread-watch.h \
- watch.h gccmacro.h \
- rlist.h rlist.c
-
-libavahi_common_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-libavahi_common_la_LIBADD = $(AM_LDADD) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
-libavahi_common_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_COMMON_VERSION_INFO)
-
-strlst_test_SOURCES = \
- strlst.c strlst.h \
- malloc.c malloc.h \
- strlst-test.c
-strlst_test_CFLAGS = $(AM_CFLAGS)
-
-alternative_test_SOURCES = \
- alternative.c alternative.h \
- malloc.c malloc.h \
- domain.c domain.h \
- address.c address.h \
- alternative-test.c
-alternative_test_CFLAGS = $(AM_CFLAGS)
-
-domain_test_SOURCES = \
- domain.c domain.h \
- malloc.c malloc.h \
- address.c address.h \
- domain-test.c
-domain_test_CFLAGS = $(AM_CFLAGS)
-
-watch_test_SOURCES = \
- timeval.c timeval.h \
- simple-watch.c simple-watch.h \
- watch.h \
- malloc.c malloc.h \
- watch-test.c
-watch_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-watch_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS)
-
-watch_test_thread_SOURCES = $(watch_test_SOURCES) thread-watch.c thread-watch.h
-watch_test_thread_CFLAGS = $(watch_test_CFLAGS) -DUSE_THREAD
-watch_test_thread_LDADD = $(watch_test_LDADD)
-
-timeval_test_SOURCES = \
- timeval.c timeval.h \
- timeval-test.c
-timeval_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-timeval_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS)
-
-if HAVE_DBUS
-
-noinst_HEADERS = \
- dbus.h \
- dbus-watch-glue.h
-
-endif
-
diff --git a/release-0.6.9/avahi-common/address.c b/release-0.6.9/avahi-common/address.c
deleted file mode 100644
index c8ddf7f..0000000
--- a/release-0.6.9/avahi-common/address.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include "address.h"
-#include "malloc.h"
-
-static size_t address_get_size(const AvahiAddress *a) {
- assert(a);
-
- if (a->proto == AVAHI_PROTO_INET)
- return 4;
- else if (a->proto == AVAHI_PROTO_INET6)
- return 16;
-
- return 0;
-}
-
-int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b) {
- assert(a);
- assert(b);
-
- if (a->proto != b->proto)
- return -1;
-
- return memcmp(a->data.data, b->data.data, address_get_size(a));
-}
-
-char *avahi_address_snprint(char *s, size_t length, const AvahiAddress *a) {
- assert(s);
- assert(length);
- assert(a);
-
- if (!(inet_ntop(avahi_proto_to_af(a->proto), a->data.data, s, length)))
- return NULL;
-
- return s;
-}
-
-char* avahi_reverse_lookup_name(const AvahiAddress *a, char *ret_s, size_t length) {
- assert(ret_s);
- assert(length > 0);
- assert(a);
-
- if (a->proto == AVAHI_PROTO_INET) {
- uint32_t n = ntohl(a->data.ipv4.address);
- snprintf(
- ret_s, length,
- "%u.%u.%u.%u.in-addr.arpa",
- n & 0xFF, (n >> 8) & 0xFF, (n >> 16) & 0xFF, n >> 24);
- } else {
- assert(a->proto == AVAHI_PROTO_INET6);
-
- snprintf(
- ret_s, length,
- "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
- a->data.ipv6.address[15] & 0xF, a->data.ipv6.address[15] >> 4,
- a->data.ipv6.address[14] & 0xF, a->data.ipv6.address[14] >> 4,
- a->data.ipv6.address[13] & 0xF, a->data.ipv6.address[13] >> 4,
- a->data.ipv6.address[12] & 0xF, a->data.ipv6.address[12] >> 4,
- a->data.ipv6.address[11] & 0xF, a->data.ipv6.address[11] >> 4,
- a->data.ipv6.address[10] & 0xF, a->data.ipv6.address[10] >> 4,
- a->data.ipv6.address[ 9] & 0xF, a->data.ipv6.address[ 9] >> 4,
- a->data.ipv6.address[ 8] & 0xF, a->data.ipv6.address[ 8] >> 4,
- a->data.ipv6.address[ 7] & 0xF, a->data.ipv6.address[ 7] >> 4,
- a->data.ipv6.address[ 6] & 0xF, a->data.ipv6.address[ 6] >> 4,
- a->data.ipv6.address[ 5] & 0xF, a->data.ipv6.address[ 5] >> 4,
- a->data.ipv6.address[ 4] & 0xF, a->data.ipv6.address[ 4] >> 4,
- a->data.ipv6.address[ 3] & 0xF, a->data.ipv6.address[ 3] >> 4,
- a->data.ipv6.address[ 2] & 0xF, a->data.ipv6.address[ 2] >> 4,
- a->data.ipv6.address[ 1] & 0xF, a->data.ipv6.address[ 1] >> 4,
- a->data.ipv6.address[ 0] & 0xF, a->data.ipv6.address[ 0] >> 4);
- }
-
- return ret_s;
-}
-
-AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol proto, AvahiAddress *ret_addr) {
- assert(ret_addr);
- assert(s);
-
- if (proto == AVAHI_PROTO_UNSPEC) {
- if (inet_pton(AF_INET, s, ret_addr->data.data) <= 0) {
- if (inet_pton(AF_INET6, s, ret_addr->data.data) <= 0)
- return NULL;
- else
- ret_addr->proto = AVAHI_PROTO_INET6;
- } else
- ret_addr->proto = AVAHI_PROTO_INET;
- } else {
- if (inet_pton(avahi_proto_to_af(proto), s, ret_addr->data.data) <= 0)
- return NULL;
-
- ret_addr->proto = proto;
- }
-
- return ret_addr;
-}
-
-int avahi_proto_to_af(AvahiProtocol proto) {
- if (proto == AVAHI_PROTO_INET)
- return AF_INET;
- if (proto == AVAHI_PROTO_INET6)
- return AF_INET6;
-
- assert(proto == AVAHI_PROTO_UNSPEC);
- return AF_UNSPEC;
-}
-
-AvahiProtocol avahi_af_to_proto(int af) {
- if (af == AF_INET)
- return AVAHI_PROTO_INET;
- if (af == AF_INET6)
- return AVAHI_PROTO_INET6;
-
- assert(af == AF_UNSPEC);
- return AVAHI_PROTO_UNSPEC;
-}
-
-const char* avahi_proto_to_string(AvahiProtocol proto) {
- if (proto == AVAHI_PROTO_INET)
- return "IPv4";
- if (proto == AVAHI_PROTO_INET6)
- return "IPv6";
-
- assert(proto == AVAHI_PROTO_UNSPEC);
- return "UNSPEC";
-}
diff --git a/release-0.6.9/avahi-common/address.h b/release-0.6.9/avahi-common/address.h
deleted file mode 100644
index 6315d31..0000000
--- a/release-0.6.9/avahi-common/address.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifndef fooaddresshfoo
-#define fooaddresshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file address.h Definitions and functions to manipulate IP addresses. */
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC */
-typedef int AvahiProtocol;
-
-/** Numeric network interface index. Takes OS dependent values and the special constant AVAHI_IF_UNSPEC */
-typedef int AvahiIfIndex;
-
-/** Values for AvahiProtocol */
-enum {
- AVAHI_PROTO_INET = 0, /**< IPv4 */
- AVAHI_PROTO_INET6 = 1, /**< IPv6 */
- AVAHI_PROTO_UNSPEC = -1 /**< Unspecified/all protocol(s) */
-};
-
-/** Special values for AvahiIfIndex */
-enum {
- AVAHI_IF_UNSPEC = -1 /**< Unspecified/all interface(s) */
-};
-
-/** Maximum size of an address in string form */
-#define AVAHI_ADDRESS_STR_MAX 40 /* IPv6 Max = 4*8 + 7 + 1 for NUL */
-
-/** Return TRUE if the specified interface index is valid */
-#define AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_PROTO_UNSPEC))
-
-/** Return TRUE if the specified protocol is valid */
-#define AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC))
-
-/** An IPv4 address */
-typedef struct AvahiIPv4Address {
- uint32_t address; /**< Address data in network byte order. */
-} AvahiIPv4Address;
-
-/** An IPv6 address */
-typedef struct AvahiIPv6Address {
- uint8_t address[16]; /**< Address data */
-} AvahiIPv6Address;
-
-/** Protocol (address family) independent address structure */
-typedef struct AvahiAddress {
- AvahiProtocol proto; /**< Address family */
-
- union {
- AvahiIPv6Address ipv6; /** Address when IPv6 */
- AvahiIPv4Address ipv4; /** Address when IPv4 */
- uint8_t data[1]; /** Type independant data field */
- } data;
-} AvahiAddress;
-
-/** Compare two addresses. Returns 0 when equal, a negative value when a < b, a positive value when a > b. */
-int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b);
-
-/** Convert the specified address *a to a human readable character string, use AVAHI_ADDRESS_STR_MAX to allocate an array of the right size */
-char *avahi_address_snprint(char *ret_s, size_t length, const AvahiAddress *a);
-
-/** Convert the specifeid human readable character string to an
- * address structure. Set af to AVAHI_UNSPEC for automatic address
- * family detection. */
-AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol af, AvahiAddress *ret_addr);
-
-/** Generate the DNS reverse lookup name for an IPv4 or IPv6 address. */
-char* avahi_reverse_lookup_name(const AvahiAddress *a, char *ret_s, size_t length);
-
-/** Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants */
-int avahi_proto_to_af(AvahiProtocol proto);
-
-/** Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants */
-AvahiProtocol avahi_af_to_proto(int af);
-
-/** Return a textual representation of the specified protocol number. i.e. "IPv4", "IPv6" or "UNSPEC" */
-const char* avahi_proto_to_string(AvahiProtocol proto);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/alternative-test.c b/release-0.6.9/avahi-common/alternative-test.c
deleted file mode 100644
index 010478c..0000000
--- a/release-0.6.9/avahi-common/alternative-test.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include "alternative.h"
-#include "malloc.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- char *r = NULL;
- int i, k;
-
- for (k = 0; k < 2; k++) {
-
- for (i = 0; i < 20; i++) {
- char *n;
-
- n = i == 0 ? avahi_strdup("gurke") : (k ? avahi_alternative_service_name(r) : avahi_alternative_host_name(r));
- avahi_free(r);
- r = n;
-
- printf("%s\n", r);
- }
- }
-
- avahi_free(r);
- return 0;
-}
diff --git a/release-0.6.9/avahi-common/alternative.c b/release-0.6.9/avahi-common/alternative.c
deleted file mode 100644
index 436a0d4..0000000
--- a/release-0.6.9/avahi-common/alternative.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "alternative.h"
-#include "malloc.h"
-
-char * avahi_alternative_host_name(const char *s) {
- const char *p, *e;
- char *r;
-
- assert(s);
-
- e = s;
-
- for (p = s; *p; p++)
- if (!isdigit(*p))
- e = p+1;
-
- if (*e) {
- char *c;
-
- if (!(c = avahi_strndup(s, e-s)))
- return NULL;
-
- r = avahi_strdup_printf("%s%i", c, atoi(e)+1);
- avahi_free(c);
-
- } else
- r = avahi_strdup_printf("%s2", s);
-
- return r;
-}
-
-char *avahi_alternative_service_name(const char *s) {
- const char *e;
- char *r;
-
- assert(s);
-
- if ((e = strstr(s, " #"))) {
- const char *n, *p;
- e += 2;
-
- while ((n = strstr(e, " #")))
- e = n + 2;
-
- for (p = e; *p; p++)
- if (!isdigit(*p)) {
- e = NULL;
- break;
- }
- }
-
- if (e) {
- char *c;
-
- if (!(c = avahi_strndup(s, e-s)))
- return NULL;
-
- r = avahi_strdup_printf("%s%i", c, atoi(e)+1);
- avahi_free(c);
- } else
- r = avahi_strdup_printf("%s #2", s);
-
- return r;
-}
diff --git a/release-0.6.9/avahi-common/alternative.h b/release-0.6.9/avahi-common/alternative.h
deleted file mode 100644
index d171540..0000000
--- a/release-0.6.9/avahi-common/alternative.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef fooalternativehfoo
-#define fooalternativehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file alternative.h Functions to find alternative names for hosts and services in the case of name collision */
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Find an alternative for the specified host name. If called with an
- * original host name, "2" is appended, Afterwards the number is
- * increased on each call. (i.e. "foo" becomes "foo2" becomes "foo3"
- * and so on.) avahi_free() the result. */
-char *avahi_alternative_host_name(const char *s);
-
-/** Find an alternative for the specified service name. If called with
- * an original service name, " #2" is appended. Afterwards the number
- * is increased on each call (i.e. "foo" becomes "foo #2" becomes "foo
- * #3" and so on.) avahi_free() the result. */
-char *avahi_alternative_service_name(const char *s);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/cdecl.h b/release-0.6.9/avahi-common/cdecl.h
deleted file mode 100644
index b08e2a0..0000000
--- a/release-0.6.9/avahi-common/cdecl.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef foocdeclhfoo
-#define foocdeclhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file cdecl.h C++ compatibility */
-#ifdef __cplusplus
-/** If using C++ this macro enables C mode, otherwise does nothing */
-#define AVAHI_C_DECL_BEGIN extern "C" {
-/** If using C++ this macros switches back to C++ mode, otherwise does nothing */
-#define AVAHI_C_DECL_END }
-
-#else
-/** If using C++ this macro enables C mode, otherwise does nothing */
-#define AVAHI_C_DECL_BEGIN
-/** If using C++ this macros switches back to C++ mode, otherwise does nothing */
-#define AVAHI_C_DECL_END
-
-#endif
-
-#endif
diff --git a/release-0.6.9/avahi-common/dbus-watch-glue.c b/release-0.6.9/avahi-common/dbus-watch-glue.c
deleted file mode 100644
index b2b4bb2..0000000
--- a/release-0.6.9/avahi-common/dbus-watch-glue.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "malloc.h"
-#include "timeval.h"
-#include "dbus-watch-glue.h"
-
-static AvahiWatchEvent translate_dbus_to_avahi(unsigned int f) {
- AvahiWatchEvent e = 0;
-
- if (f & DBUS_WATCH_READABLE)
- e |= AVAHI_WATCH_IN;
- if (f & DBUS_WATCH_WRITABLE)
- e |= AVAHI_WATCH_OUT;
- if (f & DBUS_WATCH_ERROR)
- e |= AVAHI_WATCH_ERR;
- if (f & DBUS_WATCH_HANGUP)
- e |= AVAHI_WATCH_HUP;
-
- return e;
-}
-
-static unsigned int translate_avahi_to_dbus(AvahiWatchEvent e) {
- unsigned int f = 0;
-
- if (e & AVAHI_WATCH_IN)
- f |= DBUS_WATCH_READABLE;
- if (e & AVAHI_WATCH_OUT)
- f |= DBUS_WATCH_WRITABLE;
- if (e & AVAHI_WATCH_ERR)
- f |= DBUS_WATCH_ERROR;
- if (e & AVAHI_WATCH_HUP)
- f |= DBUS_WATCH_HANGUP;
-
- return f;
-}
-
-typedef struct {
- DBusConnection *connection;
- const AvahiPoll *poll_api;
- AvahiTimeout *dispatch_timeout;
- int ref;
-} ConnectionData;
-
-static ConnectionData *connection_data_ref(ConnectionData *d) {
- assert(d);
- assert(d->ref >= 1);
-
- d->ref++;
- return d;
-}
-
-static void connection_data_unref(ConnectionData *d) {
- assert(d);
- assert(d->ref >= 1);
-
- if (--d->ref <= 0) {
- d->poll_api->timeout_free(d->dispatch_timeout);
- avahi_free(d);
- }
-}
-
-static void request_dispatch(ConnectionData *d) {
- static const struct timeval tv = { 0, 0 };
- assert(d);
-
- assert(dbus_connection_get_dispatch_status(d->connection) == DBUS_DISPATCH_DATA_REMAINS);
-
- d->poll_api->timeout_update(d->dispatch_timeout, &tv);
-}
-
-static void dispatch_timeout_callback(AvahiTimeout *t, void *userdata) {
- ConnectionData *d = userdata;
- assert(t);
- assert(d);
-
- connection_data_ref(d);
- dbus_connection_ref(d->connection);
-
- if (dbus_connection_dispatch(d->connection) == DBUS_DISPATCH_DATA_REMAINS)
- /* If there's still data, request that this handler is called again */
- request_dispatch(d);
-
- dbus_connection_unref(d->connection);
- connection_data_unref(d);
-}
-
-static void watch_callback(AvahiWatch *avahi_watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEvent events, void *userdata) {
- DBusWatch *dbus_watch = userdata;
-
- assert(avahi_watch);
- assert(dbus_watch);
-
- dbus_watch_handle(dbus_watch, translate_avahi_to_dbus(events));
- /* Ignore the return value */
-}
-
-static dbus_bool_t update_watch(const AvahiPoll *poll_api, DBusWatch *dbus_watch) {
- AvahiWatch *avahi_watch;
- dbus_bool_t b;
-
- assert(dbus_watch);
-
- avahi_watch = dbus_watch_get_data(dbus_watch);
-
- b = dbus_watch_get_enabled(dbus_watch);
-
- if (b && !avahi_watch) {
-
- if (!(avahi_watch = poll_api->watch_new(
- poll_api,
- dbus_watch_get_fd(dbus_watch),
- translate_dbus_to_avahi(dbus_watch_get_flags(dbus_watch)),
- watch_callback,
- dbus_watch)))
- return FALSE;
-
- dbus_watch_set_data(dbus_watch, avahi_watch, NULL);
-
- } else if (!b && avahi_watch) {
-
- poll_api->watch_free(avahi_watch);
- dbus_watch_set_data(dbus_watch, NULL, NULL);
-
- } else if (avahi_watch) {
-
- /* Update flags */
- poll_api->watch_update(avahi_watch, dbus_watch_get_flags(dbus_watch));
- }
-
- return TRUE;
-}
-
-static dbus_bool_t add_watch(DBusWatch *dbus_watch, void *userdata) {
- ConnectionData *d = userdata;
-
- assert(dbus_watch);
- assert(d);
-
- return update_watch(d->poll_api, dbus_watch);
-}
-
-static void remove_watch(DBusWatch *dbus_watch, void *userdata) {
- ConnectionData *d = userdata;
- AvahiWatch *avahi_watch;
-
- assert(dbus_watch);
- assert(d);
-
- if ((avahi_watch = dbus_watch_get_data(dbus_watch))) {
- d->poll_api->watch_free(avahi_watch);
- dbus_watch_set_data(dbus_watch, NULL, NULL);
- }
-}
-
-static void watch_toggled(DBusWatch *dbus_watch, void *userdata) {
- ConnectionData *d = userdata;
-
- assert(dbus_watch);
- assert(d);
-
- update_watch(d->poll_api, dbus_watch);
-}
-
-typedef struct TimeoutData {
- const AvahiPoll *poll_api;
- AvahiTimeout *avahi_timeout;
- DBusTimeout *dbus_timeout;
- int ref;
-} TimeoutData;
-
-static TimeoutData* timeout_data_ref(TimeoutData *t) {
- assert(t);
- assert(t->ref >= 1);
-
- t->ref++;
- return t;
-}
-
-static void timeout_data_unref(TimeoutData *t) {
- assert(t);
- assert(t->ref >= 1);
-
- if (--t->ref <= 0) {
- if (t->avahi_timeout)
- t->poll_api->timeout_free(t->avahi_timeout);
-
- avahi_free(t);
- }
-}
-
-static void update_timeout(TimeoutData *timeout) {
- assert(timeout);
- assert(timeout->ref >= 1);
-
- if (dbus_timeout_get_enabled(timeout->dbus_timeout)) {
- struct timeval tv;
- avahi_elapse_time(&tv, dbus_timeout_get_interval(timeout->dbus_timeout), 0);
- timeout->poll_api->timeout_update(timeout->
- avahi_timeout, &tv);
- } else
- timeout->poll_api->timeout_update(timeout->avahi_timeout, NULL);
-
-}
-
-static void timeout_callback(AvahiTimeout *avahi_timeout, void *userdata) {
- TimeoutData *timeout = userdata;
-
- assert(avahi_timeout);
- assert(timeout);
-
- timeout_data_ref(timeout);
-
- dbus_timeout_handle(timeout->dbus_timeout);
- /* Ignore the return value */
-
- if (timeout->avahi_timeout)
- update_timeout(timeout);
-
- timeout_data_unref(timeout);
-}
-
-static dbus_bool_t add_timeout(DBusTimeout *dbus_timeout, void *userdata) {
- TimeoutData *timeout;
- ConnectionData *d = userdata;
- struct timeval tv;
- dbus_bool_t b;
-
- assert(dbus_timeout);
- assert(d);
-
- if (!(timeout = avahi_new(TimeoutData, 1)))
- return FALSE;
-
- timeout->dbus_timeout = dbus_timeout;
- timeout->poll_api = d->poll_api;
- timeout->ref = 1;
-
- if ((b = dbus_timeout_get_enabled(dbus_timeout)))
- avahi_elapse_time(&tv, dbus_timeout_get_interval(dbus_timeout), 0);
-
- if (!(timeout->avahi_timeout = d->poll_api->timeout_new(
- d->poll_api,
- b ? &tv : NULL,
- timeout_callback,
- timeout))) {
- avahi_free(timeout);
- return FALSE;
- }
-
- dbus_timeout_set_data(dbus_timeout, timeout, (DBusFreeFunction) timeout_data_unref);
- return TRUE;
-}
-
-static void remove_timeout(DBusTimeout *dbus_timeout, void *userdata) {
- ConnectionData *d = userdata;
- TimeoutData *timeout;
-
- assert(dbus_timeout);
- assert(d);
-
- timeout = dbus_timeout_get_data(dbus_timeout);
- assert(timeout);
-
- d->poll_api->timeout_free(timeout->avahi_timeout);
- timeout->avahi_timeout = NULL;
-}
-
-static void timeout_toggled(DBusTimeout *dbus_timeout, AVAHI_GCC_UNUSED void *userdata) {
- TimeoutData *timeout;
-
- assert(dbus_timeout);
- timeout = dbus_timeout_get_data(dbus_timeout);
- assert(timeout);
-
- update_timeout(timeout);
-}
-
-static void dispatch_status(AVAHI_GCC_UNUSED DBusConnection *connection, DBusDispatchStatus new_status, void *userdata) {
- ConnectionData *d = userdata;
-
- if (new_status == DBUS_DISPATCH_DATA_REMAINS)
- request_dispatch(d);
- }
-
-int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
- ConnectionData *d = NULL;
-
- assert(c);
- assert(poll_api);
-
- if (!(d = avahi_new(ConnectionData, 1)))
- goto fail;;
-
- d->poll_api = poll_api;
- d->connection = c;
- d->ref = 1;
-
- if (!(d->dispatch_timeout = poll_api->timeout_new(poll_api, NULL, dispatch_timeout_callback, d)))
- goto fail;
-
- if (!(dbus_connection_set_watch_functions(c, add_watch, remove_watch, watch_toggled, connection_data_ref(d), (DBusFreeFunction)connection_data_unref)))
- goto fail;
-
- if (!(dbus_connection_set_timeout_functions(c, add_timeout, remove_timeout, timeout_toggled, connection_data_ref(d), (DBusFreeFunction)connection_data_unref)))
- goto fail;
-
- dbus_connection_set_dispatch_status_function(c, dispatch_status, connection_data_ref(d), (DBusFreeFunction)connection_data_unref);
-
- if (dbus_connection_get_dispatch_status(c) == DBUS_DISPATCH_DATA_REMAINS)
- request_dispatch(d);
-
- connection_data_unref(d);
-
- return 0;
-
-fail:
-
- if (d) {
- d->poll_api->timeout_free(d->dispatch_timeout);
-
- avahi_free(d);
- }
-
- return -1;
-}
diff --git a/release-0.6.9/avahi-common/dbus-watch-glue.h b/release-0.6.9/avahi-common/dbus-watch-glue.h
deleted file mode 100644
index 101fa3f..0000000
--- a/release-0.6.9/avahi-common/dbus-watch-glue.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef foodbuswatchgluehfoo
-#define foodbuswatchgluehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/dbus.c b/release-0.6.9/avahi-common/dbus.c
deleted file mode 100644
index e044b53..0000000
--- a/release-0.6.9/avahi-common/dbus.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/dbus.h>
-
-static const char * const table[- AVAHI_ERR_MAX] = {
- AVAHI_DBUS_ERR_OK,
- AVAHI_DBUS_ERR_FAILURE,
- AVAHI_DBUS_ERR_BAD_STATE,
- AVAHI_DBUS_ERR_INVALID_HOST_NAME,
- AVAHI_DBUS_ERR_INVALID_DOMAIN_NAME,
- AVAHI_DBUS_ERR_NO_NETWORK,
- AVAHI_DBUS_ERR_INVALID_TTL,
- AVAHI_DBUS_ERR_IS_PATTERN,
- AVAHI_DBUS_ERR_COLLISION,
- AVAHI_DBUS_ERR_INVALID_RECORD,
-
- AVAHI_DBUS_ERR_INVALID_SERVICE_NAME,
- AVAHI_DBUS_ERR_INVALID_SERVICE_TYPE,
- AVAHI_DBUS_ERR_INVALID_PORT,
- AVAHI_DBUS_ERR_INVALID_KEY,
- AVAHI_DBUS_ERR_INVALID_ADDRESS,
- AVAHI_DBUS_ERR_TIMEOUT,
- AVAHI_DBUS_ERR_TOO_MANY_CLIENTS,
- AVAHI_DBUS_ERR_TOO_MANY_OBJECTS,
- AVAHI_DBUS_ERR_TOO_MANY_ENTRIES,
- AVAHI_DBUS_ERR_OS,
-
- AVAHI_DBUS_ERR_ACCESS_DENIED,
- AVAHI_DBUS_ERR_INVALID_OPERATION,
- AVAHI_DBUS_ERR_DBUS_ERROR,
- AVAHI_DBUS_ERR_DISCONNECTED,
- AVAHI_DBUS_ERR_NO_MEMORY,
- AVAHI_DBUS_ERR_INVALID_OBJECT,
- AVAHI_DBUS_ERR_NO_DAEMON,
- AVAHI_DBUS_ERR_INVALID_INTERFACE,
- AVAHI_DBUS_ERR_INVALID_PROTOCOL,
- AVAHI_DBUS_ERR_INVALID_FLAGS,
-
- AVAHI_DBUS_ERR_NOT_FOUND,
- AVAHI_DBUS_ERR_INVALID_CONFIG,
- AVAHI_DBUS_ERR_VERSION_MISMATCH,
- AVAHI_DBUS_ERR_INVALID_SERVICE_SUBTYPE,
- AVAHI_DBUS_ERR_INVALID_PACKET,
- AVAHI_DBUS_ERR_INVALID_DNS_ERROR,
- AVAHI_DBUS_ERR_DNS_FORMERR,
- AVAHI_DBUS_ERR_DNS_SERVFAIL,
- AVAHI_DBUS_ERR_DNS_NXDOMAIN,
- AVAHI_DBUS_ERR_DNS_NOTIMP,
-
- AVAHI_DBUS_ERR_DNS_REFUSED,
- AVAHI_DBUS_ERR_DNS_YXDOMAIN,
- AVAHI_DBUS_ERR_DNS_YXRRSET,
- AVAHI_DBUS_ERR_DNS_NXRRSET,
- AVAHI_DBUS_ERR_DNS_NOTAUTH,
- AVAHI_DBUS_ERR_DNS_NOTZONE,
- AVAHI_DBUS_ERR_INVALID_RDATA,
- AVAHI_DBUS_ERR_INVALID_DNS_CLASS,
- AVAHI_DBUS_ERR_INVALID_DNS_TYPE,
- AVAHI_DBUS_ERR_NOT_SUPPORTED,
-
- AVAHI_DBUS_ERR_NOT_PERMITTED,
- AVAHI_DBUS_ERR_INVALID_ARGUMENT,
- AVAHI_DBUS_ERR_IS_EMPTY
-};
-
-struct error_map {
- const char *dbus_error;
- int avahi_error;
-};
-
-static struct error_map error_map[] = {
- { DBUS_ERROR_FAILED, AVAHI_ERR_FAILURE },
- { DBUS_ERROR_NO_MEMORY, AVAHI_ERR_NO_MEMORY },
- { DBUS_ERROR_SERVICE_UNKNOWN, AVAHI_ERR_NO_DAEMON },
- { DBUS_ERROR_BAD_ADDRESS, AVAHI_ERR_NO_DAEMON },
- { DBUS_ERROR_NOT_SUPPORTED, AVAHI_ERR_NOT_SUPPORTED },
- { DBUS_ERROR_LIMITS_EXCEEDED, AVAHI_ERR_TOO_MANY_OBJECTS },
- { DBUS_ERROR_ACCESS_DENIED, AVAHI_ERR_ACCESS_DENIED },
- { DBUS_ERROR_AUTH_FAILED, AVAHI_ERR_ACCESS_DENIED },
- { DBUS_ERROR_NO_SERVER, AVAHI_ERR_NO_DAEMON },
- { DBUS_ERROR_TIMEOUT, AVAHI_ERR_TIMEOUT },
- { DBUS_ERROR_NO_NETWORK, AVAHI_ERR_NO_NETWORK },
- { DBUS_ERROR_DISCONNECTED, AVAHI_ERR_DISCONNECTED },
- { DBUS_ERROR_INVALID_ARGS, AVAHI_ERR_INVALID_ARGUMENT },
- { DBUS_ERROR_TIMED_OUT, AVAHI_ERR_TIMEOUT },
- { NULL, 0 }
-};
-
-int avahi_error_dbus_to_number(const char *s) {
- int e;
- const struct error_map *m;
-
- assert(s);
-
- for (e = -1; e > AVAHI_ERR_MAX; e--)
- if (strcmp(s, table[-e]) == 0)
- return e;
-
- for (m = error_map; m->dbus_error; m++)
- if (strcmp(m->dbus_error, s) == 0)
- return m->avahi_error;
-
- return AVAHI_ERR_DBUS_ERROR;
-}
-
-const char *avahi_error_number_to_dbus(int error) {
- assert(error > AVAHI_ERR_MAX);
- assert(error < 1);
-
- return table[-error];
-}
diff --git a/release-0.6.9/avahi-common/dbus.h b/release-0.6.9/avahi-common/dbus.h
deleted file mode 100644
index 39718d1..0000000
--- a/release-0.6.9/avahi-common/dbus.h
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifndef foodbushfoo
-#define foodbushfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file dbus.h Some definitions for the DBUS interface */
-
-#include <avahi-common/cdecl.h>
-#include <dbus/dbus.h>
-
-AVAHI_C_DECL_BEGIN
-
-#define AVAHI_DBUS_NAME "org.freedesktop.Avahi"
-#define AVAHI_DBUS_INTERFACE_SERVER AVAHI_DBUS_NAME".Server"
-#define AVAHI_DBUS_PATH_SERVER "/"
-#define AVAHI_DBUS_INTERFACE_ENTRY_GROUP AVAHI_DBUS_NAME".EntryGroup"
-#define AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER AVAHI_DBUS_NAME".DomainBrowser"
-#define AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER AVAHI_DBUS_NAME".ServiceTypeBrowser"
-#define AVAHI_DBUS_INTERFACE_SERVICE_BROWSER AVAHI_DBUS_NAME".ServiceBrowser"
-#define AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER AVAHI_DBUS_NAME".AddressResolver"
-#define AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER AVAHI_DBUS_NAME".HostNameResolver"
-#define AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER AVAHI_DBUS_NAME".ServiceResolver"
-#define AVAHI_DBUS_INTERFACE_RECORD_BROWSER AVAHI_DBUS_NAME".RecordBrowser"
-
-/** The DBUS API version identifier. The first byte specifies the API
-release, the second byte specifies the revision. If the revision
-number is increased the API has been extended but is downwards
-compatible. If the release changes compatibility is lost.
-
-Avahi 0.6 implements API version 0x0201;
-Avahi 0.6.1 implements API version 0x0202 */
-#define AVAHI_DBUS_API_VERSION ((uint32_t) 0x0202)
-
-#define AVAHI_DBUS_ERR_OK "org.freedesktop.Avahi.Success"
-#define AVAHI_DBUS_ERR_FAILURE "org.freedesktop.Avahi.Failure"
-#define AVAHI_DBUS_ERR_BAD_STATE "org.freedesktop.Avahi.BadStateError"
-#define AVAHI_DBUS_ERR_INVALID_HOST_NAME "org.freedesktop.Avahi.InvalidHostNameError"
-#define AVAHI_DBUS_ERR_INVALID_DOMAIN_NAME "org.freedesktop.Avahi.InvalidDomainNameError"
-#define AVAHI_DBUS_ERR_NO_NETWORK "org.freedesktop.Avahi.NoNetworkError"
-#define AVAHI_DBUS_ERR_INVALID_TTL "org.freedesktop.Avahi.InvalidTTLError"
-#define AVAHI_DBUS_ERR_IS_PATTERN "org.freedesktop.Avahi.IsPatternError"
-#define AVAHI_DBUS_ERR_COLLISION "org.freedesktop.Avahi.CollisionError"
-#define AVAHI_DBUS_ERR_INVALID_RECORD "org.freedesktop.Avahi.InvalidRecordError"
-
-#define AVAHI_DBUS_ERR_INVALID_SERVICE_NAME "org.freedesktop.Avahi.InvalidServiceNameError"
-#define AVAHI_DBUS_ERR_INVALID_SERVICE_TYPE "org.freedesktop.Avahi.InvalidServiceTypeError"
-#define AVAHI_DBUS_ERR_INVALID_PORT "org.freedesktop.Avahi.InvalidPortError"
-#define AVAHI_DBUS_ERR_INVALID_KEY "org.freedesktop.Avahi.InvalidKeyError"
-#define AVAHI_DBUS_ERR_INVALID_ADDRESS "org.freedesktop.Avahi.InvalidAddressError"
-#define AVAHI_DBUS_ERR_TIMEOUT "org.freedesktop.Avahi.TimeoutError"
-#define AVAHI_DBUS_ERR_TOO_MANY_CLIENTS "org.freedesktop.Avahi.TooManyClientsError"
-#define AVAHI_DBUS_ERR_TOO_MANY_OBJECTS "org.freedesktop.Avahi.TooManyObjectsError"
-#define AVAHI_DBUS_ERR_TOO_MANY_ENTRIES "org.freedesktop.Avahi.TooManyEntriesError"
-#define AVAHI_DBUS_ERR_OS "org.freedesktop.Avahi.OSError"
-
-#define AVAHI_DBUS_ERR_ACCESS_DENIED DBUS_ERROR_ACCESS_DENIED
-#define AVAHI_DBUS_ERR_INVALID_OPERATION "org.freedesktop.Avahi.InvalidOperationError"
-#define AVAHI_DBUS_ERR_DBUS_ERROR "org.freedesktop.Avahi.DBusError"
-#define AVAHI_DBUS_ERR_DISCONNECTED "org.freedesktop.Avahi.DisconnectedError"
-#define AVAHI_DBUS_ERR_NO_MEMORY "org.freedesktop.Avahi.NoMemoryError"
-#define AVAHI_DBUS_ERR_INVALID_OBJECT "org.freedesktop.Avahi.InvalidObjectError"
-#define AVAHI_DBUS_ERR_NO_DAEMON "org.freedesktop.Avahi.NoDaemonError"
-#define AVAHI_DBUS_ERR_INVALID_INTERFACE "org.freedesktop.Avahi.InvalidInterfaceError"
-#define AVAHI_DBUS_ERR_INVALID_PROTOCOL "org.freedesktop.Avahi.InvalidInterfaceProtocolError"
-#define AVAHI_DBUS_ERR_INVALID_FLAGS "org.freedesktop.Avahi.InvalidFlagsError"
-
-#define AVAHI_DBUS_ERR_NOT_FOUND "org.freedesktop.Avahi.NotFoundError"
-#define AVAHI_DBUS_ERR_INVALID_CONFIG "org.freedesktop.Avahi.InvalidConfigurationError"
-#define AVAHI_DBUS_ERR_VERSION_MISMATCH "org.freedesktop.Avahi.VersionMismatchError"
-#define AVAHI_DBUS_ERR_INVALID_SERVICE_SUBTYPE "org.freedesktop.Avahi.InvalidServiceSubtypeError"
-#define AVAHI_DBUS_ERR_INVALID_PACKET "org.freedesktop.Avahi.InvalidPacketError"
-#define AVAHI_DBUS_ERR_INVALID_DNS_ERROR "org.freedesktop.Avahi.InvalidDNSErrorError"
-#define AVAHI_DBUS_ERR_DNS_FORMERR "org.freedesktop.Avahi.DNSFORMERR"
-#define AVAHI_DBUS_ERR_DNS_SERVFAIL "org.freedesktop.Avahi.DNSSERVFAIL"
-#define AVAHI_DBUS_ERR_DNS_NXDOMAIN "org.freedesktop.Avahi.DNSNXDOMAIN"
-#define AVAHI_DBUS_ERR_DNS_NOTIMP "org.freedesktop.Avahi.DNSNOTIMP"
-
-#define AVAHI_DBUS_ERR_DNS_REFUSED "org.freedesktop.Avahi.DNSREFUSED"
-#define AVAHI_DBUS_ERR_DNS_YXDOMAIN "org.freedesktop.Avahi.DNSYXDOMAIN"
-#define AVAHI_DBUS_ERR_DNS_YXRRSET "org.freedesktop.Avahi.DNSYXRRSET"
-#define AVAHI_DBUS_ERR_DNS_NXRRSET "org.freedesktop.Avahi.DNSNXRRSET"
-#define AVAHI_DBUS_ERR_DNS_NOTAUTH "org.freedesktop.Avahi.DNSNOTAUTH"
-#define AVAHI_DBUS_ERR_DNS_NOTZONE "org.freedesktop.Avahi.DNSNOTZONE"
-#define AVAHI_DBUS_ERR_INVALID_RDATA "org.freedesktop.Avahi.InvalidRDataError"
-#define AVAHI_DBUS_ERR_INVALID_DNS_CLASS "org.freedesktop.Avahi.InvalidDNSClassError"
-#define AVAHI_DBUS_ERR_INVALID_DNS_TYPE "org.freedesktop.Avahi.InvalidDNSTypeError"
-#define AVAHI_DBUS_ERR_NOT_SUPPORTED "org.freedesktop.Avahi.NotSupportedError"
-
-#define AVAHI_DBUS_ERR_NOT_PERMITTED "org.freedesktop.Avahi.NotPermittedError"
-#define AVAHI_DBUS_ERR_INVALID_ARGUMENT "org.freedesktop.Avahi.InvalidArgumentError"
-#define AVAHI_DBUS_ERR_IS_EMPTY "org.freedesktop.Avahi.IsEmptyError"
-
-/** Convert a DBus error string into an Avahi error number */
-int avahi_error_dbus_to_number(const char *s);
-
-/** Convert an Avahi error number into a DBus error string. Result should not be freed */
-const char * avahi_error_number_to_dbus(int error);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/defs.h b/release-0.6.9/avahi-common/defs.h
deleted file mode 100644
index 100c9f5..0000000
--- a/release-0.6.9/avahi-common/defs.h
+++ /dev/null
@@ -1,310 +0,0 @@
-#ifndef foodefshfoo
-#define foodefshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file defs.h Some common definitions */
-
-#include <avahi-common/cdecl.h>
-
-/** \mainpage
- *
- * \section choose_api Choosing an API
- *
- * Avahi provides three programming APIs for integration of
- * mDNS/DNS-SD features into your progams:
- *
- * \li avahi-core: an API for embedding a complete mDNS/DNS-SD stack
- * into your software. This is intended for developers of embedded
- * ampliances only. We dissuade from using this API in normal desktop
- * applications since it is not a good idea to run multiple mDNS
- * stacks simultaneously on the same host.
- * \li The DBUS API: an extensive DBUS interface for browsing and
- * registering mDNS/DNS-SD services using avahi-daemon. We recommend
- * to use this API for software written in any language but
- * C. (i.e. python)
- * \li avahi-client: a simplifying C wrapper around the DBUS API. We
- * recommend to use this API in C or C++ progams. The DBUS internals
- * are hidden completely.
- *
- * All three APIs are very similar, however avahi-core is the most powerful.
- *
- * In addition to the three APIs described above Avahi supports two
- * compatibility libraries:
- *
- * \li avahi-compat-libdns_sd: the original Bonjour API as documented
- * in the header file "dns_sd.h" by Apple Computer, Inc.
- *
- * \li avahi-compat-howl: the HOWL API as released with HOWL 0.9.8 by
- * Porchdog Software.
- *
- * Please note that these compatibility layers are incomplete and
- * generally a waste of resources. We strongly encourage everyone to
- * use our native APIs for newly written programs and to port older
- * programs to one of them!
- *
- * \section error_reporting Error Reporting
- *
- * Some notes on the Avahi error handling:
- *
- * - Error codes are negative integers and defined as AVAHI_ERR_xx
- * - If a function returns some kind of non-negative integer value
- * on success, a failure is indicated by returning the error code
- * directly.
- * - If a function returns a pointer of some kind on success, a
- * failure is indicated by returning NULL
- * - The last error number may be retrieved by calling
- * avahi_server_errno() (for the server API) or avahi_client_errno()
- * (for the client API)
- * - Just like the libc errno variable the Avahi errno is NOT reset
- * to AVAHI_OK if a function call succeeds.
- * - You may convert a numeric error code into a human readable
- * string using avahi_strerror()
- * - The constructor functions avahi_server_new() and
- * avahi_client_new() return the error code in a call-by-reference
- * argument
- *
- * \section event_loop Event Loop Abstraction
- *
- * Avahi uses for both avahi-client and avahi-core a simple event loop
- * abstraction layer.A table AvahiPoll which contains function
- * pointers for user defined timeout and I/O condition event source
- * implementations, needs to be passed to avahi_server_new() and
- * avahi_client_new(). An adapter for this abstraction layer is
- * available for the GLib main loop in the object AvahiGLibPoll. A
- * simple stand-alone implementation is available under the name
- * AvahiSimplePoll.
- *
- * \section good_publish How to Register Services
- *
- * - Subscribe to server state changes. Pass a callback function
- * pointer to avahi_client_new()/avahi_server_new(). It will be called
- * whenever the server state changes.
- * - Only register your services when the server is in state
- * AVAHI_SERVER_RUNNING. If you register your services in other server
- * states they might not be accessible since the local host name is
- * not established.
- * - Remove your services when the server enters
- * AVAHI_SERVER_COLLISION state. Your services may no be reachable
- * anymore since the local host name is no longer established.
- * - When registering services, use the following algorithm:
- * - Create a new entry group (i.e. avahi_entry_group_new())
- * - Add your service(s)/additional host names (i.e. avahi_entry_group_add_service())
- * - Commit the entry group (i.e. avahi_entry_group_commit())
- * - Subscribe to entry group state changes.
- * - If the entry group enters AVAHI_ENTRY_GROUP_COLLISION state the
- * services of the entry group are automatically removed from the
- * server. You may immediately add your services back to the entry
- * group (but with new names, perhaps using
- * avahi_alternative_service_name()) and commit again. Please do not
- * free the entry group and create a new one. This would inhibit some
- * traffic limiting algorithms in mDNS.
- * - When you need to modify your services (i.e. change the TXT data
- * or the port number), use the AVAHI_PUBLISH_UPDATE flag. Please do
- * not free the entry group and create a new one. This would inhibit
- * some traffic limiting algorithms in mDNS. When changing just the
- * TXT data avahi_entry_group_update_txt() is a shortcut for
- * AVAHI_PUBLISH_UPDATE. Please note that you cannot use
- * AVAHI_PUBLISH_UPDATE when changing the service name! Renaming a
- * DNS-SD service is identical to deleting and creating a new one, and
- * that's exactly what you should do in that case. First call
- * avahi_entry_group_reset() to remove it and than readd it normally.
- *
- * The linked functions belong to avahi-client. They all have counterparts in the DBUS API and avahi-core.
- *
- * \section good_browse How to Browse for Services
- *
- * - For normal applications you need to call avahi_service_browser_new()
- * for the service type you want to browse for. Use
- * avahi_client_resolve_service() to acquire service data for a a service
- * name.
- * - You can use avahi_domain_browser_new() to get a list of announced
- * browsing domains. Please note that not all domains whith services
- * on the LAN are mandatorily announced.
- * - Network monitor software may use avahi_service_type_browser_new()
- * to browse for the list of available service types on the LAN. This
- * API should NOT be used in normal software since it increases
- * traffic heavily.
- * - There is no need to subscribe to server state changes.
- *
- * The linked functions belong to avahi-client. They all have
- * counterparts in the DBUS API and avahi-core.
- *
- * \section daemon_dies How to Write a Client That Can Deal with Daemon Restarts
- *
- * With Avahi it is possible to write client applications that can
- * deal with Avahi daemon restarts. To accomplish that make sure to
- * pass AVAHI_CLIENT_NO_FAIL to avahi_client_new()'s flags
- * parameter. That way avahi_client_new() will succeed even when the
- * daemon is not running. In that case the object will enter
- * AVAHI_CLIENT_CONNECTING state. As soon as the daemon becomes
- * available the object will enter one of the AVAHI_CLIENT_S_xxx
- * states. Make sure to not create browsers or entry groups before the
- * client object has entered one of those states. As usual you will be
- * informed about state changes with the callback function supplied to
- * avahi_client_new(). If the client is forced to disconnect from the
- * server it will enter AVAHI_CLIENT_FAILURE state with
- * avahi_client_errno() == AVAHI_ERR_DISCONNECTED. Free the
- * AvahiClient object in that case and reconnect to the server anew -
- * again with passing AVAHI_CLIENT_NO_FAIL to avahi_client_new().
- *
- * We encourage to implement this in all software where service
- * discovery is not an integral part of application. e.g. use it in
- * all kinds of background daemons, but not in software like iChat
- * compatible IM software.
- *
- * For now AVAHI_CLIENT_NO_FAIL cannot deal with DBUS daemon restarts.
- *
- * \section domains How to Deal Properly with Browsing Domains
- *
- * Due to the introduction of wide-area DNS-SD the correct handling of
- * domains becomes more important for Avahi enabled applications. All
- * applications that offer the user a list of services discovered with
- * Avahi should offer some kind of editable drop down box where the
- * user can either enter his own domain or select one of those offered
- * by AvahiDomainBrowser. The default domain to browse should be the
- * one returned by avahi_client_get_domain_name(). The list of domains
- * returned by AvahiDomainBrowser is assembled by the browsing domains
- * configured in the daemon's configuration file, the domains
- * announced inside the default domain, the domains set with the
- * environment variable $AVAHI_BROWSE_DOMAINS (colon-seperated) on the
- * client side and the domains set in the XDG configuration file
- * ~/.config/avahi/browse-domains on the client side (seperated by
- * newlines). File managers offering some kind of "Network
- * Neighborhood" folder should show the entries of the default domain
- * right inside that and offer subfolders for the browsing domains
- * returned by AvahiDomainBrowser.
- */
-
-AVAHI_C_DECL_BEGIN
-
-/** States of an entry group object */
-typedef enum {
- AVAHI_ENTRY_GROUP_UNCOMMITED, /**< The group has not yet been commited, the user must still call avahi_entry_group_commit() */
- AVAHI_ENTRY_GROUP_REGISTERING, /**< The entries of the group are currently being registered */
- AVAHI_ENTRY_GROUP_ESTABLISHED, /**< The entries have successfully been established */
- AVAHI_ENTRY_GROUP_COLLISION, /**< A name collision for one of the entries in the group has been detected, the entries have been withdrawn */
- AVAHI_ENTRY_GROUP_FAILURE /**< Some kind of failure happened, the entries have been withdrawn */
-} AvahiEntryGroupState;
-
-/** The type of domain to browse for */
-typedef enum {
- AVAHI_DOMAIN_BROWSER_BROWSE, /**< Browse for a list of available browsing domains */
- AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT, /**< Browse for the default browsing domain */
- AVAHI_DOMAIN_BROWSER_REGISTER, /**< Browse for a list of available registering domains */
- AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT, /**< Browse for the default registering domain */
- AVAHI_DOMAIN_BROWSER_BROWSE_LEGACY, /**< Legacy browse domain - see DNS-SD spec for more information */
- AVAHI_DOMAIN_BROWSER_MAX
-} AvahiDomainBrowserType;
-
-/** Some flags for publishing functions */
-typedef enum {
- AVAHI_PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */
- AVAHI_PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
- AVAHI_PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */
- AVAHI_PUBLISH_ALLOW_MULTIPLE = 8, /**< For raw records: Allow multiple local records of this type, even if they are intended to be unique */
- AVAHI_PUBLISH_NO_REVERSE = 16, /**< For address records: don't create a reverse (PTR) entry */
- AVAHI_PUBLISH_NO_COOKIE = 32, /**< For service records: do not implicitly add the local service cookie to TXT data */
- AVAHI_PUBLISH_UPDATE = 64, /**< Update existing records instead of adding new ones */
- AVAHI_PUBLISH_USE_WIDE_AREA = 128, /**< Register the record using wide area DNS (i.e. unicast DNS update) */
- AVAHI_PUBLISH_USE_MULTICAST = 256 /**< Register the record using multicast DNS */
-} AvahiPublishFlags;
-
-/** Some flags for lookup functions */
-typedef enum {
- AVAHI_LOOKUP_USE_WIDE_AREA = 1, /**< Force lookup via wide area DNS */
- AVAHI_LOOKUP_USE_MULTICAST = 2, /**< Force lookup via multicast DNS */
- AVAHI_LOOKUP_NO_TXT = 4, /**< When doing service resolving, don't lookup TXT record */
- AVAHI_LOOKUP_NO_ADDRESS = 8 /**< When doing service resolving, don't lookup A/AAAA record */
-} AvahiLookupFlags;
-
-/** Some flags for lookup callback functions */
-typedef enum {
- AVAHI_LOOKUP_RESULT_CACHED = 1, /**< This response originates from the cache */
- AVAHI_LOOKUP_RESULT_WIDE_AREA = 2, /**< This response originates from wide area DNS */
- AVAHI_LOOKUP_RESULT_MULTICAST = 4, /**< This response originates from multicast DNS */
- AVAHI_LOOKUP_RESULT_LOCAL = 8, /**< This record/service resides on and was announced by the local host. Only available in service and record browsers and only on AVAHI_BROWSER_NEW. */
- AVAHI_LOOKUP_RESULT_OUR_OWN = 16, /**< This service belongs to the same local client as the browser object. Only available in avahi-client, and only for service browsers and only on AVAHI_BROWSER_NEW. */
- AVAHI_LOOKUP_RESULT_STATIC = 32 /**< The returned data has been defined statically by some configuration option */
-} AvahiLookupResultFlags;
-
-/** Type of callback event when browsing */
-typedef enum {
- AVAHI_BROWSER_NEW, /**< The object is new on the network */
- AVAHI_BROWSER_REMOVE, /**< The object has been removed from the network */
- AVAHI_BROWSER_CACHE_EXHAUSTED, /**< One-time event, to notify the user that all entries from the caches have been send */
- AVAHI_BROWSER_ALL_FOR_NOW, /**< One-time event, to notify the user that more records will probably not show up in the near future, i.e. all cache entries have been read and all static servers been queried */
- AVAHI_BROWSER_FAILURE /**< Browsing failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
-} AvahiBrowserEvent;
-
-/** Type of callback event when resolving */
-typedef enum {
- AVAHI_RESOLVER_FOUND, /**< RR found, resolving successful */
- AVAHI_RESOLVER_FAILURE /**< Resolving failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
-} AvahiResolverEvent;
-
-/** States of a server object */
-typedef enum {
- AVAHI_SERVER_INVALID, /**< Invalid state (initial) */
- AVAHI_SERVER_REGISTERING, /**< Host RRs are being registered */
- AVAHI_SERVER_RUNNING, /**< All host RRs have been established */
- AVAHI_SERVER_COLLISION, /**< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name() */
- AVAHI_SERVER_FAILURE /**< Some fatal failure happened, the server is unable to proceed */
-} AvahiServerState;
-
-/** For every service a special TXT item is implicitly added, which
- * contains a random cookie which is private to the local daemon. This
- * can be used by clients to determine if two services on two
- * different subnets are effectively the same. */
-#define AVAHI_SERVICE_COOKIE "org.freedesktop.Avahi.cookie"
-
-/** In invalid cookie as special value */
-#define AVAHI_SERVICE_COOKIE_INVALID (0)
-
-/** DNS record types, see RFC 1035 */
-enum {
- AVAHI_DNS_TYPE_A = 0x01,
- AVAHI_DNS_TYPE_NS = 0x02,
- AVAHI_DNS_TYPE_CNAME = 0x05,
- AVAHI_DNS_TYPE_SOA = 0x06,
- AVAHI_DNS_TYPE_PTR = 0x0C,
- AVAHI_DNS_TYPE_HINFO = 0x0D,
- AVAHI_DNS_TYPE_MX = 0x0F,
- AVAHI_DNS_TYPE_TXT = 0x10,
- AVAHI_DNS_TYPE_AAAA = 0x1C,
- AVAHI_DNS_TYPE_SRV = 0x21,
-};
-
-/** DNS record classes, see RFC 1035 */
-enum {
- AVAHI_DNS_CLASS_IN = 0x01, /**< Probably the only class we will ever use */
-};
-
-/** The default TTL for RRs which contain a host name of some kind. */
-#define AVAHI_DEFAULT_TTL_HOST_NAME (120)
-
-/** The default TTL for all other records. */
-#define AVAHI_DEFAULT_TTL (75*60)
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/domain-test.c b/release-0.6.9/avahi-common/domain-test.c
deleted file mode 100644
index 0f7d851..0000000
--- a/release-0.6.9/avahi-common/domain-test.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#include "domain.h"
-#include "malloc.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- char *s;
- char t[256], r[256];
- const char *p;
- size_t size;
- char name[64], type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
-
- printf("%s\n", s = avahi_normalize_name_strdup("foo.foo\\046."));
- avahi_free(s);
-
- printf("%s\n", s = avahi_normalize_name_strdup("foo.foo\\.foo."));
- avahi_free(s);
-
-
- printf("%s\n", s = avahi_normalize_name_strdup("fo\\\\o\\..f oo."));
- avahi_free(s);
-
- printf("%i\n", avahi_domain_equal("\\065aa bbb\\.\\046cc.cc\\\\.dee.fff.", "Aaa BBB\\.\\.cc.cc\\\\.dee.fff"));
- printf("%i\n", avahi_domain_equal("A", "a"));
-
- printf("%i\n", avahi_domain_equal("a", "aaa"));
-
- printf("%u = %u\n", avahi_domain_hash("ccc\\065aa.aa\\.b\\\\."), avahi_domain_hash("cccAaa.aa\\.b\\\\"));
-
-
- avahi_service_name_join(t, sizeof(t), "foo.foo.foo \\.", "_http._tcp", "test.local");
- printf("<%s>\n", t);
-
- avahi_service_name_split(t, name, sizeof(name), type, sizeof(type), domain, sizeof(domain));
- printf("name: <%s>; type: <%s>; domain <%s>\n", name, type, domain);
-
- avahi_service_name_join(t, sizeof(t), NULL, "_http._tcp", "one.two\\. .local");
- printf("<%s>\n", t);
-
- avahi_service_name_split(t, NULL, 0, type, sizeof(type), domain, sizeof(domain));
- printf("name: <>; type: <%s>; domain <%s>\n", type, domain);
-
-
- p = "--:---\\\\\\123\\065_äöü\\064\\.\\\\sjöödfhh.sdfjhskjdf";
- printf("unescaped: <%s>, rest: %s\n", avahi_unescape_label(&p, t, sizeof(t)), p);
-
- size = sizeof(r);
- s = r;
-
- printf("escaped: <%s>\n", avahi_escape_label(t, strlen(t), &s, &size));
-
- p = r;
- printf("unescaped: <%s>\n", avahi_unescape_label(&p, t, sizeof(t)));
-
- assert(avahi_is_valid_service_type_generic("_foo._bar._waldo"));
- assert(!avahi_is_valid_service_type_strict("_foo._bar._waldo"));
- assert(!avahi_is_valid_service_subtype("_foo._bar._waldo"));
-
- assert(avahi_is_valid_service_type_generic("_foo._tcp"));
- assert(avahi_is_valid_service_type_strict("_foo._tcp"));
- assert(!avahi_is_valid_service_subtype("_foo._tcp"));
-
- assert(!avahi_is_valid_service_type_generic("_foo._bar.waldo"));
- assert(!avahi_is_valid_service_type_strict("_foo._bar.waldo"));
- assert(!avahi_is_valid_service_subtype("_foo._bar.waldo"));
-
- assert(!avahi_is_valid_service_type_generic(""));
- assert(!avahi_is_valid_service_type_strict(""));
- assert(!avahi_is_valid_service_subtype(""));
-
- assert(avahi_is_valid_service_type_generic("_foo._sub._bar._tcp"));
- assert(!avahi_is_valid_service_type_strict("_foo._sub._bar._tcp"));
- assert(avahi_is_valid_service_subtype("_foo._sub._bar._tcp"));
-
- printf("%s\n", avahi_get_type_from_subtype("_foo._sub._bar._tcp"));
-
- assert(!avahi_is_valid_host_name("sf.ooo."));
- assert(avahi_is_valid_host_name("sfooo."));
- assert(avahi_is_valid_host_name("sfooo"));
-
- assert(avahi_is_valid_domain_name("."));
- assert(avahi_is_valid_domain_name(""));
-
- assert(avahi_normalize_name(".", t, sizeof(t)));
- assert(avahi_normalize_name("", t, sizeof(t)));
-
- assert(!avahi_is_valid_fqdn("."));
- assert(!avahi_is_valid_fqdn(""));
- assert(!avahi_is_valid_fqdn("foo"));
- assert(avahi_is_valid_fqdn("foo.bar"));
- assert(avahi_is_valid_fqdn("foo.bar."));
- assert(avahi_is_valid_fqdn("gnurz.foo.bar."));
- assert(!avahi_is_valid_fqdn("192.168.50.1"));
- assert(!avahi_is_valid_fqdn("::1"));
- assert(!avahi_is_valid_fqdn(".192.168.50.1."));
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-common/domain.c b/release-0.6.9/avahi-common/domain.c
deleted file mode 100644
index 1ac8577..0000000
--- a/release-0.6.9/avahi-common/domain.c
+++ /dev/null
@@ -1,607 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "domain.h"
-#include "malloc.h"
-#include "error.h"
-#include "address.h"
-
-/* Read the first label from string *name, unescape "\" and write it to dest */
-char *avahi_unescape_label(const char **name, char *dest, size_t size) {
- unsigned i = 0;
- char *d;
-
- assert(dest);
- assert(size > 0);
- assert(name);
-
- d = dest;
-
- for (;;) {
- if (i >= size)
- return NULL;
-
- if (**name == '.') {
- (*name)++;
- break;
- }
-
- if (**name == 0)
- break;
-
- if (**name == '\\') {
- /* Escaped character */
-
- (*name) ++;
-
- if (**name == 0)
- /* Ending NUL */
- return NULL;
-
- else if (**name == '\\' || **name == '.') {
- /* Escaped backslash or dot */
- *(d++) = *((*name) ++);
- i++;
- } else if (isdigit(**name)) {
- int n;
-
- /* Escaped literal ASCII character */
-
- if (!isdigit(*(*name+1)) || !isdigit(*(*name+2)))
- return NULL;
-
- n = ((uint8_t) (**name - '0') * 100) + ((uint8_t) (*(*name+1) - '0') * 10) + ((uint8_t) (*(*name +2) - '0'));
-
- if (n > 255 || n == 0)
- return NULL;
-
- *(d++) = (char) n;
- i++;
-
- (*name) += 3;
- } else
- return NULL;
-
- } else {
-
- /* Normal character */
-
- *(d++) = *((*name) ++);
- i++;
- }
- }
-
- assert(i < size);
-
- *d = 0;
-
- return dest;
-}
-
-/* Escape "\" and ".", append \0 */
-char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, size_t *ret_size) {
- char *r;
-
- assert(src);
- assert(ret_name);
- assert(*ret_name);
- assert(ret_size);
- assert(*ret_size > 0);
-
- r = *ret_name;
-
- while (src_length > 0) {
- if (*src == '.' || *src == '\\') {
-
- /* Dot or backslash */
-
- if (*ret_size < 3)
- return NULL;
-
- *((*ret_name) ++) = '\\';
- *((*ret_name) ++) = *src;
- (*ret_size) -= 2;
-
- } else if (
- *src == '_' ||
- *src == '-' ||
- (*src >= '0' && *src <= '9') ||
- (*src >= 'a' && *src <= 'z') ||
- (*src >= 'A' && *src <= 'Z')) {
-
- /* Proper character */
-
- if (*ret_size < 2)
- return NULL;
-
- *((*ret_name)++) = *src;
- (*ret_size) --;
-
- } else {
-
- /* Everything else */
-
- if (*ret_size < 5)
- return NULL;
-
- *((*ret_name) ++) = '\\';
- *((*ret_name) ++) = '0' + (char) ((uint8_t) *src / 100);
- *((*ret_name) ++) = '0' + (char) (((uint8_t) *src / 10) % 10);
- *((*ret_name) ++) = '0' + (char) ((uint8_t) *src % 10);
-
- (*ret_size) -= 4;
- }
-
- src_length --;
- src++;
- }
-
- **ret_name = 0;
-
- return r;
-}
-
-char *avahi_normalize_name(const char *s, char *ret_s, size_t size) {
- int empty = 1;
- char *r;
-
- assert(s);
- assert(ret_s);
- assert(size > 0);
-
- r = ret_s;
- *ret_s = 0;
-
- while (*s) {
- char label[AVAHI_LABEL_MAX];
-
- if (!(avahi_unescape_label(&s, label, sizeof(label))))
- return NULL;
-
- if (label[0] == 0) {
-
- if (*s == 0 && empty)
- return ret_s;
-
- return NULL;
- }
-
- if (!empty) {
- if (size < 1)
- return NULL;
-
- *(r++) = '.';
- size--;
-
- } else
- empty = 0;
-
- avahi_escape_label(label, strlen(label), &r, &size);
- }
-
- return ret_s;
-}
-
-char *avahi_normalize_name_strdup(const char *s) {
- char t[AVAHI_DOMAIN_NAME_MAX];
- assert(s);
-
- if (!(avahi_normalize_name(s, t, sizeof(t))))
- return NULL;
-
- return avahi_strdup(t);
-}
-
-int avahi_domain_equal(const char *a, const char *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 1;
-
- for (;;) {
- char ca[AVAHI_LABEL_MAX], cb[AVAHI_LABEL_MAX], *r;
-
- r = avahi_unescape_label(&a, ca, sizeof(ca));
- assert(r);
- r = avahi_unescape_label(&b, cb, sizeof(cb));
- assert(r);
-
- if (strcasecmp(ca, cb))
- return 0;
-
- if (!*a && !*b)
- return 1;
- }
-
- return 1;
-}
-
-int avahi_is_valid_service_type_generic(const char *t) {
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return 0;
-
- do {
- char label[AVAHI_LABEL_MAX];
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return 0;
-
- } while (*t);
-
- return 1;
-}
-
-int avahi_is_valid_service_type_strict(const char *t) {
- char label[AVAHI_LABEL_MAX];
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return 0;
-
- /* Application name */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return 0;
-
- if (!*t)
- return 0;
-
- /* _tcp or _udp boilerplate */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strcasecmp(label, "_tcp") && strcasecmp(label, "_udp"))
- return 0;
-
- if (*t)
- return 0;
-
- return 1;
-}
-
-const char *avahi_get_type_from_subtype(const char *t) {
- char label[AVAHI_LABEL_MAX];
- const char *ret;
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return NULL;
-
- /* Subtype name */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return NULL;
-
- if (!*t)
- return NULL;
-
- /* String "_sub" */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strcasecmp(label, "_sub"))
- return NULL;
-
- if (!*t)
- return NULL;
-
- ret = t;
-
- /* Application name */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return NULL;
-
- if (!*t)
- return NULL;
-
- /* _tcp or _udp boilerplate */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strcasecmp(label, "_tcp") && strcasecmp(label, "_udp"))
- return NULL;
-
- if (*t)
- return NULL;
-
- return ret;
-}
-
-int avahi_is_valid_service_subtype(const char *t) {
- assert(t);
-
- return !!avahi_get_type_from_subtype(t);
-}
-
-int avahi_is_valid_domain_name(const char *t) {
- int is_first = 1;
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX)
- return 0;
-
- do {
- char label[AVAHI_LABEL_MAX];
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- /* Explicitly allow the root domain name */
- if (is_first && label[0] == 0 && *t == 0)
- return 1;
-
- is_first = 0;
-
- if (label[0] == 0)
- return 0;
-
- } while (*t);
-
- return 1;
-}
-
-int avahi_is_valid_service_name(const char *t) {
- assert(t);
-
- if (strlen(t) >= AVAHI_LABEL_MAX || !*t)
- return 0;
-
- return 1;
-}
-
-int avahi_is_valid_host_name(const char *t) {
- char label[AVAHI_LABEL_MAX];
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return 0;
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strlen(label) < 1)
- return 0;
-
- if (*t)
- return 0;
-
- return 1;
-}
-
-unsigned avahi_domain_hash(const char *s) {
- unsigned hash = 0;
-
- while (*s) {
- char c[AVAHI_LABEL_MAX], *p, *r;
-
- r = avahi_unescape_label(&s, c, sizeof(c));
- assert(r);
-
- for (p = c; *p; p++)
- hash = 31 * hash + tolower(*p);
- }
-
- return hash;
-}
-
-int avahi_service_name_join(char *p, size_t size, const char *name, const char *type, const char *domain) {
- char escaped_name[AVAHI_LABEL_MAX*4];
- char normalized_type[AVAHI_DOMAIN_NAME_MAX];
- char normalized_domain[AVAHI_DOMAIN_NAME_MAX];
-
- assert(p);
-
- /* Validity checks */
-
- if ((name && !avahi_is_valid_service_name(name)))
- return AVAHI_ERR_INVALID_SERVICE_NAME;
-
- if (!avahi_is_valid_service_type_generic(type))
- return AVAHI_ERR_INVALID_SERVICE_TYPE;
-
- if (!avahi_is_valid_domain_name(domain))
- return AVAHI_ERR_INVALID_DOMAIN_NAME;
-
- /* Preparation */
-
- if (name) {
- size_t l = sizeof(escaped_name);
- char *e = escaped_name, *r;
- r = avahi_escape_label(name, strlen(name), &e, &l);
- assert(r);
- }
-
- if (!(avahi_normalize_name(type, normalized_type, sizeof(normalized_type))))
- return AVAHI_ERR_INVALID_SERVICE_TYPE;
-
- if (!(avahi_normalize_name(domain, normalized_domain, sizeof(normalized_domain))))
- return AVAHI_ERR_INVALID_DOMAIN_NAME;
-
- /* Concatenation */
-
- snprintf(p, size, "%s%s%s.%s", name ? escaped_name : "", name ? "." : "", normalized_type, normalized_domain);
-
- return AVAHI_OK;
-}
-
-#ifndef HAVE_STRLCPY
-
-static size_t strlcpy(char *dest, const char *src, size_t n) {
- assert(dest);
- assert(src);
-
- if (n > 0) {
- strncpy(dest, src, n-1);
- dest[n-1] = 0;
- }
-
- return strlen(src);
-}
-
-#endif
-
-int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size) {
- enum {
- NAME,
- TYPE,
- DOMAIN
- } state;
- int type_empty = 1, domain_empty = 1;
-
- assert(p);
- assert(type);
- assert(type_size > 0);
- assert(domain);
- assert(domain_size > 0);
-
- if (name) {
- assert(name_size > 0);
- *name = 0;
- state = NAME;
- } else
- state = TYPE;
-
- *type = *domain = 0;
-
- while (*p) {
- char buf[64];
-
- if (!(avahi_unescape_label(&p, buf, sizeof(buf))))
- return -1;
-
- switch (state) {
- case NAME:
- strlcpy(name, buf, name_size);
- state = TYPE;
- break;
-
- case TYPE:
-
- if (buf[0] == '_') {
-
- if (!type_empty) {
- if (!type_size)
- return AVAHI_ERR_NO_MEMORY;
-
- *(type++) = '.';
- type_size --;
-
- } else
- type_empty = 0;
-
- if (!(avahi_escape_label(buf, strlen(buf), &type, &type_size)))
- return AVAHI_ERR_NO_MEMORY;
-
- break;
- }
-
- state = DOMAIN;
- /* fall through */
-
- case DOMAIN:
-
- if (!domain_empty) {
- if (!domain_size)
- return AVAHI_ERR_NO_MEMORY;
-
- *(domain++) = '.';
- domain_size --;
- } else
- domain_empty = 0;
-
- if (!(avahi_escape_label(buf, strlen(buf), &domain, &domain_size)))
- return AVAHI_ERR_NO_MEMORY;
-
- break;
- }
- }
-
- return 0;
-}
-
-int avahi_is_valid_fqdn(const char *t) {
- char label[AVAHI_LABEL_MAX];
- char normalized[AVAHI_DOMAIN_NAME_MAX];
- const char *k = t;
- AvahiAddress a;
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX)
- return 0;
-
- if (!avahi_is_valid_domain_name(t))
- return 0;
-
- /* Check if there are at least two labels*/
- if (!(avahi_unescape_label(&k, label, sizeof(label))))
- return 0;
-
- if (label[0] == 0 || !k)
- return 0;
-
- if (!(avahi_unescape_label(&k, label, sizeof(label))))
- return 0;
-
- if (label[0] == 0 || !k)
- return 0;
-
- /* Make sure that the name is not an IP address */
- if (!(avahi_normalize_name(t, normalized, sizeof(normalized))))
- return 0;
-
- if (avahi_address_parse(normalized, AVAHI_PROTO_UNSPEC, &a))
- return 0;
-
- return 1;
-}
diff --git a/release-0.6.9/avahi-common/domain.h b/release-0.6.9/avahi-common/domain.h
deleted file mode 100644
index 7073e1c..0000000
--- a/release-0.6.9/avahi-common/domain.h
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef foodomainhfoo
-#define foodomainhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file domain.h Domain name handling functions */
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** The maximum length of a a fully escaped domain name C string. This
- * is calculated like this: RFC1034 mandates maximum length of FQDNs
- * is 255. The maximum label length is 63. To minimize the number of
- * (non-escaped) dots, we comprise our maximum-length domain name of
- * four labels á 63 characters plus three inner dots. Escaping the
- * four labels quadruples their length at maximum. An escaped domain
- * name has the therefore the maximum length of 63*4*4+3=1011. A
- * trailing NUL and perhaps two unnecessary dots leading and trailing
- * the string brings us to 1014. */
-#define AVAHI_DOMAIN_NAME_MAX 1014
-
-/** Maximum size of an unescaped label */
-#define AVAHI_LABEL_MAX 64
-
-/** Normalize a domain name into canonical form. This drops trailing
- * dots and removes useless backslash escapes. */
-char *avahi_normalize_name(const char *s, char *ret_s, size_t size);
-
-/** Normalize a domain name into canonical form. This drops trailing
- * dots and removes useless backslash escapes. avahi_free() the
- * result! */
-char *avahi_normalize_name_strdup(const char *s);
-
-/** Return 1 when the specified domain names are equal, 0 otherwise */
-int avahi_domain_equal(const char *a, const char *b);
-
-/** Read the first label from the textual domain name *name, unescape
- * it and write it to dest, *name is changed to point to the next label*/
-char *avahi_unescape_label(const char **name, char *dest, size_t size);
-
-/** Escape the domain name in *src and write it to *ret_name */
-char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, size_t *ret_size);
-
-/** Return a pointer to the type section of a subtype i.e. _foo._sub._bar._tcp => _bar._tcp */
-const char *avahi_get_type_from_subtype(const char *t);
-
-/** Return 1 when the specified string contains a valid generic
- * service type (i.e. a series of words starting with "_"), 0
- * otherwise */
-int avahi_is_valid_service_type_generic(const char *t);
-
-/** Return 1 when the specified string contains a valid strict service
- * type (i.e. consisting of only two words, the latter being either
- * _udp or _tcp), 0 otherwise */
-int avahi_is_valid_service_type_strict(const char *t);
-
-/** Return 1 when the specified string contains a valid service subtype, 0 otherwise */
-int avahi_is_valid_service_subtype(const char *t);
-
-/** Return 1 when the specified string contains a valid domain name, 0 otherwise */
-int avahi_is_valid_domain_name(const char *t);
-
-/** Return 1 when the specified string contains a valid service name, 0 otherwise */
-int avahi_is_valid_service_name(const char *t);
-
-/** Return 1 when the specified string contains a valid non-FQDN host name (i.e. without dots), 0 otherwise */
-int avahi_is_valid_host_name(const char *t);
-
-/** Return 1 when the specified string contains a valid FQDN host name (i.e. with more than one label and non-numerical), 0 otherwise. \since 0.6.9 */
-int avahi_is_valid_fqdn(const char *t);
-
-/** Return some kind of hash value for the domain, useful for using domains as hash table keys. */
-unsigned avahi_domain_hash(const char *name);
-
-/** Construct a valid complete service name from a name, a type and a domain */
-int avahi_service_name_join(char *p, size_t size, const char *name, const char *type, const char *domain);
-
-/** Split a full service name into name, type and domain */
-int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/error.c b/release-0.6.9/avahi-common/error.c
deleted file mode 100644
index f6f561a..0000000
--- a/release-0.6.9/avahi-common/error.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
- ***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-
-const char *avahi_strerror(int error) {
-
- const char * const msg[- AVAHI_ERR_MAX] = {
- "OK",
- "Operation failed",
- "Bad state",
- "Invalid host name",
- "Invalid domain name",
- "No suitable network protocol available",
- "Invalid DNS TTL",
- "Resource record key is pattern",
- "Local name collision",
- "Invalid record",
-
- "Invalid service name",
- "Invalid service type",
- "Invalid port number",
- "Invalid record key",
- "Invalid address",
- "Timeout reached",
- "Too many clients",
- "Too many objects",
- "Too many entries",
- "OS Error",
-
- "Access denied",
- "Invalid operation",
- "An unexpected DBUS error occured",
- "Daemon connection failed",
- "Memory exhausted",
- "The object passed in was not valid",
- "Daemon not running",
- "Invalid interface index",
- "Invalid protocol specification",
- "Invalid flags",
-
- "Not found",
- "Invalid configuration",
- "Version mismatch",
- "Invalid service subtype",
- "Invalid packet",
- "Invalid DNS return code",
- "DNS failure: FORMERR",
- "DNS failure: SERVFAIL",
- "DNS failure: NXDOMAIN",
- "DNS failure: NOTIMP",
-
- "DNS failure: REFUSED",
- "DNS failure: YXDOMAIN",
- "DNS failure: YXRRSET",
- "DNS failure: NXRRSET",
- "DNS failure: NOTAUTH",
- "DNS failure: NOTZONE",
- "Invalid RDATA",
- "Invalid DNS type",
- "Invalid DNS class",
- "Not supported",
-
- "Not permitted",
- "Invalid argument",
- "Is empty"
- };
-
- if (-error < 0 || -error >= -AVAHI_ERR_MAX)
- return "Invalid Error Code";
-
- return msg[-error];
-}
diff --git a/release-0.6.9/avahi-common/error.h b/release-0.6.9/avahi-common/error.h
deleted file mode 100644
index 2cf3bc2..0000000
--- a/release-0.6.9/avahi-common/error.h
+++ /dev/null
@@ -1,108 +0,0 @@
-#ifndef fooerrorhfoo
-#define fooerrorhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file error.h Error codes and auxiliary functions */
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Error codes used by avahi */
-enum {
- AVAHI_OK = 0, /**< OK */
- AVAHI_ERR_FAILURE = -1, /**< Generic error code */
- AVAHI_ERR_BAD_STATE = -2, /**< Object was in a bad state */
- AVAHI_ERR_INVALID_HOST_NAME = -3, /**< Invalid host name */
- AVAHI_ERR_INVALID_DOMAIN_NAME = -4, /**< Invalid domain name */
- AVAHI_ERR_NO_NETWORK = -5, /**< No suitable network protocol available */
- AVAHI_ERR_INVALID_TTL = -6, /**< Invalid DNS TTL */
- AVAHI_ERR_IS_PATTERN = -7, /**< RR key is pattern */
- AVAHI_ERR_COLLISION = -8, /**< Name collision */
- AVAHI_ERR_INVALID_RECORD = -9, /**< Invalid RR */
-
- AVAHI_ERR_INVALID_SERVICE_NAME = -10, /**< Invalid service name */
- AVAHI_ERR_INVALID_SERVICE_TYPE = -11, /**< Invalid service type */
- AVAHI_ERR_INVALID_PORT = -12, /**< Invalid port number */
- AVAHI_ERR_INVALID_KEY = -13, /**< Invalid key */
- AVAHI_ERR_INVALID_ADDRESS = -14, /**< Invalid address */
- AVAHI_ERR_TIMEOUT = -15, /**< Timeout reached */
- AVAHI_ERR_TOO_MANY_CLIENTS = -16, /**< Too many clients */
- AVAHI_ERR_TOO_MANY_OBJECTS = -17, /**< Too many objects */
- AVAHI_ERR_TOO_MANY_ENTRIES = -18, /**< Too many entries */
- AVAHI_ERR_OS = -19, /**< OS error */
-
- AVAHI_ERR_ACCESS_DENIED = -20, /**< Access denied */
- AVAHI_ERR_INVALID_OPERATION = -21, /**< Invalid operation */
- AVAHI_ERR_DBUS_ERROR = -22, /**< An unexpected DBUS error occured */
- AVAHI_ERR_DISCONNECTED = -23, /**< Daemon connection failed */
- AVAHI_ERR_NO_MEMORY = -24, /**< Memory exhausted */
- AVAHI_ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */
- AVAHI_ERR_NO_DAEMON = -26, /**< Daemon not running */
- AVAHI_ERR_INVALID_INTERFACE = -27, /**< Invalid interface */
- AVAHI_ERR_INVALID_PROTOCOL = -28, /**< Invalid protocol */
- AVAHI_ERR_INVALID_FLAGS = -29, /**< Invalid flags */
-
- AVAHI_ERR_NOT_FOUND = -30, /**< Not found */
- AVAHI_ERR_INVALID_CONFIG = -31, /**< Configuration error */
- AVAHI_ERR_VERSION_MISMATCH = -32, /**< Verson mismatch */
- AVAHI_ERR_INVALID_SERVICE_SUBTYPE = -33, /**< Invalid service subtype */
- AVAHI_ERR_INVALID_PACKET = -34, /**< Invalid packet */
- AVAHI_ERR_INVALID_DNS_ERROR = -35, /**< Invlaid DNS return code */
- AVAHI_ERR_DNS_FORMERR = -36, /**< DNS Error: Form error */
- AVAHI_ERR_DNS_SERVFAIL = -37, /**< DNS Error: Server Failure */
- AVAHI_ERR_DNS_NXDOMAIN = -38, /**< DNS Error: No such domain */
- AVAHI_ERR_DNS_NOTIMP = -39, /**< DNS Error: Not implemented */
-
- AVAHI_ERR_DNS_REFUSED = -40, /**< DNS Error: Operation refused */
- AVAHI_ERR_DNS_YXDOMAIN = -41,
- AVAHI_ERR_DNS_YXRRSET = -42,
- AVAHI_ERR_DNS_NXRRSET = -43,
- AVAHI_ERR_DNS_NOTAUTH = -44, /**< DNS Error: Not authorized */
- AVAHI_ERR_DNS_NOTZONE = -45,
- AVAHI_ERR_INVALID_RDATA = -46, /**< Invalid RDATA */
- AVAHI_ERR_INVALID_DNS_CLASS = -47, /**< Invalid DNS class */
- AVAHI_ERR_INVALID_DNS_TYPE = -48, /**< Invalid DNS type */
- AVAHI_ERR_NOT_SUPPORTED = -49, /**< Not supported */
-
- AVAHI_ERR_NOT_PERMITTED = -50, /**< Operation not permitted */
- AVAHI_ERR_INVALID_ARGUMENT = -51, /**< Invalid argument */
- AVAHI_ERR_IS_EMPTY = -52, /**< Is empty */
-
- /****
- **** IF YOU ADD A NEW ERROR CODE HERE, PLEASE DON'T FORGET TO ADD
- **** IT TO THE STRING ARRAY IN avahi_strerror() IN error.c AND
- **** TO THE ARRAY IN dbus.c AND FINALLY TO dbus.h!
- ****
- **** Also remember to update the MAX value below.
- ****/
-
- AVAHI_ERR_MAX = -53
-};
-
-/** Return a human readable error string for the specified error code */
-const char *avahi_strerror(int error);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/gccmacro.h b/release-0.6.9/avahi-common/gccmacro.h
deleted file mode 100644
index 78a09a7..0000000
--- a/release-0.6.9/avahi-common/gccmacro.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef foogccmacrohfoo
-#define foogccmacrohfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file gccmacro.h Defines some macros for GCC extensions */
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-#if defined(__GNUC__) && (__GNUC__ >= 4)
-#define AVAHI_GCC_SENTINEL __attribute__ ((sentinel))
-#else
-/** Macro for usage of GCC's sentinel compilation warnings */
-#define AVAHI_GCC_SENTINEL
-#endif
-
-#ifdef __GNUC__
-#define AVAHI_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
-#else
-/** Macro for usage of GCC's printf compilation warnings */
-#define AVAHI_GCC_PRINTF_ATTR(a,b)
-#endif
-
-/** Same as AVAHI_GCC_PRINTF_ATTR but hard coded to arguments 1 and 2 */
-#define AVAHI_GCC_PRINTF_ATTR12 AVAHI_GCC_PRINTF_ATTR(1,2)
-
-/** Same as AVAHI_GCC_PRINTF_ATTR but hard coded to arguments 2 and 3 */
-#define AVAHI_GCC_PRINTF_ATTR23 AVAHI_GCC_PRINTF_ATTR(2,3)
-
-#ifdef __GNUC__
-#define AVAHI_GCC_NORETURN __attribute__((noreturn))
-#else
-/** Macro for no-return functions */
-#define AVAHI_GCC_NORETURN
-#endif
-
-#ifdef __GNUC__
-#define AVAHI_GCC_UNUSED __attribute__ ((unused))
-#else
-/** Macro for not used parameter */
-#define AVAHI_GCC_UNUSED
-#endif
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/llist.h b/release-0.6.9/avahi-common/llist.h
deleted file mode 100644
index 37474e1..0000000
--- a/release-0.6.9/avahi-common/llist.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef foollistfoo
-#define foollistfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file llist.h A simple macro based linked list implementation */
-
-#include <assert.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** The head of the linked list. Use this in the structure that shall
- * contain the head of the linked list */
-#define AVAHI_LLIST_HEAD(t,name) t *name
-
-/** The pointers in the linked list's items. Use this in the item structure */
-#define AVAHI_LLIST_FIELDS(t,name) t *name##_next, *name##_prev
-
-/** Initialize the list's head */
-#define AVAHI_LLIST_HEAD_INIT(t,head) do { (head) = NULL; } while(0)
-
-/** Initialize a list item */
-#define AVAHI_LLIST_INIT(t,name,item) do { \
- t *_item = (item); \
- assert(_item); \
- _item->name##_prev = _item->name##_next = NULL; \
- } while(0)
-
-/** Prepend an item to the list */
-#define AVAHI_LLIST_PREPEND(t,name,head,item) do { \
- t **_head = &(head), *_item = (item); \
- assert(_item); \
- if ((_item->name##_next = *_head)) \
- _item->name##_next->name##_prev = _item; \
- _item->name##_prev = NULL; \
- *_head = _item; \
- } while (0)
-
-/** Remove an item from the list */
-#define AVAHI_LLIST_REMOVE(t,name,head,item) do { \
- t **_head = &(head), *_item = (item); \
- assert(_item); \
- if (_item->name##_next) \
- _item->name##_next->name##_prev = _item->name##_prev; \
- if (_item->name##_prev) \
- _item->name##_prev->name##_next = _item->name##_next; \
- else {\
- assert(*_head == _item); \
- *_head = _item->name##_next; \
- } \
- _item->name##_next = _item->name##_prev = NULL; \
- } while(0)
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/malloc.c b/release-0.6.9/avahi-common/malloc.c
deleted file mode 100644
index 51b8ff6..0000000
--- a/release-0.6.9/avahi-common/malloc.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "malloc.h"
-
-#ifndef va_copy
-#ifdef __va_copy
-#define va_copy(DEST,SRC) __va_copy((DEST),(SRC))
-#else
-#define va_copy(DEST,SRC) memcpy(&(DEST), &(SRC), sizeof(va_list))
-#endif
-#endif
-
-static const AvahiAllocator *allocator = NULL;
-
-static void oom(void) AVAHI_GCC_NORETURN;
-
-static void oom(void) {
-
- static const char msg[] = "Out of memory, aborting ...\n";
- const char *n = msg;
-
- while (strlen(n) > 0) {
- ssize_t r;
-
- if ((r = write(2, n, strlen(n))) < 0)
- break;
-
- n += r;
- }
-
- abort();
-}
-
-/* Default implementation for avahi_malloc() */
-static void* xmalloc(size_t size) {
- void *p;
-
- if (size == 0)
- return NULL;
-
- if (!(p = malloc(size)))
- oom();
-
- return p;
-}
-
-/* Default implementation for avahi_realloc() */
-static void *xrealloc(void *p, size_t size) {
-
- if (size == 0) {
- free(p);
- return NULL;
- }
-
- if (!(p = realloc(p, size)))
- oom();
-
- return p;
-}
-
-/* Default implementation for avahi_calloc() */
-static void *xcalloc(size_t nmemb, size_t size) {
- void *p;
-
- if (size == 0 || nmemb == 0)
- return NULL;
-
- if (!(p = calloc(nmemb, size)))
- oom();
-
- return p;
-}
-
-void *avahi_malloc(size_t size) {
-
- if (size <= 0)
- return NULL;
-
- if (!allocator)
- return xmalloc(size);
-
- assert(allocator->malloc);
- return allocator->malloc(size);
-}
-
-void *avahi_malloc0(size_t size) {
- void *p;
-
- if (size <= 0)
- return NULL;
-
- if (!allocator)
- return xcalloc(1, size);
-
- if (allocator->calloc)
- return allocator->calloc(1, size);
-
- assert(allocator->malloc);
- if ((p = allocator->malloc(size)))
- memset(p, 0, size);
-
- return p;
-}
-
-void avahi_free(void *p) {
-
- if (!p)
- return;
-
- if (!allocator) {
- free(p);
- return;
- }
-
- assert(allocator->free);
- allocator->free(p);
-}
-
-void *avahi_realloc(void *p, size_t size) {
-
- if (size == 0) {
- avahi_free(p);
- return NULL;
- }
-
- if (!allocator)
- return xrealloc(p, size);
-
- assert(allocator->realloc);
- return allocator->realloc(p, size);
-}
-
-char *avahi_strdup(const char *s) {
- char *r;
- size_t size;
-
- if (!s)
- return NULL;
-
- size = strlen(s);
- if (!(r = avahi_malloc(size+1)))
- return NULL;
-
- memcpy(r, s, size+1);
- return r;
-}
-
-char *avahi_strndup(const char *s, size_t max) {
- char *r;
- size_t size;
- const char *p;
-
- if (!s)
- return NULL;
-
- for (p = s, size = 0;
- size < max && *p;
- p++, size++);
-
- if (!(r = avahi_new(char, size+1)))
- return NULL;
-
- memcpy(r, s, size);
- r[size] = 0;
- return r;
-}
-
-/* Change the allocator */
-void avahi_set_allocator(const AvahiAllocator *a) {
- allocator = a;
-}
-
-char *avahi_strdup_vprintf(const char *fmt, va_list ap) {
- size_t len = 80;
- char *buf;
-
- assert(fmt);
-
- if (!(buf = avahi_malloc(len)))
- return NULL;
-
- for (;;) {
- int n;
- char *nbuf;
- va_list ap2;
-
- va_copy (ap2, ap);
- n = vsnprintf(buf, len, fmt, ap2);
- va_end (ap2);
-
- if (n >= 0 && n < (int) len)
- return buf;
-
- if (n >= 0)
- len = n+1;
- else
- len *= 2;
-
- if (!(nbuf = avahi_realloc(buf, len))) {
- avahi_free(buf);
- return NULL;
- }
-
- buf = nbuf;
- }
-}
-
-char *avahi_strdup_printf(const char *fmt, ... ) {
- char *s;
- va_list ap;
-
- assert(fmt);
-
- va_start(ap, fmt);
- s = avahi_strdup_vprintf(fmt, ap);
- va_end(ap);
-
- return s;
-}
-
-void *avahi_memdup(const void *s, size_t l) {
- void *p;
- assert(s);
-
- if (!(p = avahi_malloc(l)))
- return NULL;
-
- memcpy(p, s, l);
- return p;
-}
diff --git a/release-0.6.9/avahi-common/malloc.h b/release-0.6.9/avahi-common/malloc.h
deleted file mode 100644
index 40b6272..0000000
--- a/release-0.6.9/avahi-common/malloc.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef foomallochfoo
-#define foomallochfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file malloc.h Memory allocation */
-
-#include <sys/types.h>
-#include <stdarg.h>
-#include <limits.h>
-#include <assert.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/gccmacro.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Allocate some memory, just like the libc malloc() */
-void *avahi_malloc(size_t size);
-
-/** Similar to avahi_malloc() but set the memory to zero */
-void *avahi_malloc0(size_t size);
-
-/** Free some memory */
-void avahi_free(void *p);
-
-/** Similar to libc's realloc() */
-void *avahi_realloc(void *p, size_t size);
-
-/** Internal helper for avahi_new() */
-static inline void* avahi_new_internal(unsigned n, size_t k) {
- assert(n < INT_MAX/k);
- return avahi_malloc(n*k);
-}
-
-/** Allocate n new structures of the specified type. */
-#define avahi_new(type, n) ((type*) avahi_new_internal((n), sizeof(type)))
-
-/** Internal helper for avahi_new0() */
-static inline void* avahi_new0_internal(unsigned n, size_t k) {
- assert(n < INT_MAX/k);
- return avahi_malloc0(n*k);
-}
-
-/** Same as avahi_new() but set the memory to zero */
-#define avahi_new0(type, n) ((type*) avahi_new0_internal((n), sizeof(type)))
-
-/** Just like libc's strdup() */
-char *avahi_strdup(const char *s);
-
-/** Just like libc's strndup() */
-char *avahi_strndup(const char *s, size_t l);
-
-/** Duplicate the given memory block into a new one allocated with avahi_malloc() */
-void *avahi_memdup(const void *s, size_t l);
-
-/** Wraps allocator functions */
-typedef struct AvahiAllocator {
- void* (*malloc)(size_t size);
- void (*free)(void *p);
- void* (*realloc)(void *p, size_t size);
- void* (*calloc)(size_t nmemb, size_t size); /**< May be NULL */
-} AvahiAllocator;
-
-/** Change the allocator. May be NULL to return to default (libc)
- * allocators. The structure is not copied! */
-void avahi_set_allocator(const AvahiAllocator *a);
-
-/** Like sprintf() but store the result in a freshly allocated buffer. Free this with avahi_free() */
-char *avahi_strdup_printf(const char *fmt, ... ) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Same as avahi_strdup_printf() but take a va_list instead of varargs */
-char *avahi_strdup_vprintf(const char *fmt, va_list ap);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/rlist.c b/release-0.6.9/avahi-common/rlist.c
deleted file mode 100644
index f24ab03..0000000
--- a/release-0.6.9/avahi-common/rlist.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "rlist.h"
-#include "malloc.h"
-
-AvahiRList* avahi_rlist_prepend(AvahiRList *r, void *data) {
- AvahiRList *n;
-
- if (!(n = avahi_new(AvahiRList, 1)))
- return NULL;
-
- n->data = data;
-
- AVAHI_LLIST_PREPEND(AvahiRList, rlist, r, n);
- return r;
-}
-
-AvahiRList* avahi_rlist_remove(AvahiRList *r, void *data) {
- AvahiRList *n;
-
- for (n = r; n; n = n->rlist_next)
-
- if (n->data == data) {
- AVAHI_LLIST_REMOVE(AvahiRList, rlist, r, n);
- avahi_free(n);
- break;
- }
-
- return r;
-}
-
-AvahiRList* avahi_rlist_remove_by_link(AvahiRList *r, AvahiRList *n) {
- assert(n);
-
- AVAHI_LLIST_REMOVE(AvahiRList, rlist, r, n);
- avahi_free(n);
-
- return r;
-}
diff --git a/release-0.6.9/avahi-common/rlist.h b/release-0.6.9/avahi-common/rlist.h
deleted file mode 100644
index 0b88955..0000000
--- a/release-0.6.9/avahi-common/rlist.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef foorlistfoo
-#define foorlistfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file rlist.h A simple linked list implementation */
-
-#include "llist.h"
-
-AVAHI_C_DECL_BEGIN
-
-/** A doubly linked list type */
-typedef struct AvahiRList AvahiRList;
-
-/** A doubly linked list type */
-struct AvahiRList {
- AVAHI_LLIST_FIELDS(AvahiRList, rlist);
- void *data;
-};
-
-/** Prepend a new item to the beginning of the list and return the new beginning */
-AvahiRList* avahi_rlist_prepend(AvahiRList *r, void *data);
-
-/** Remove the first occurence of the specified item from the list and return the new beginning */
-AvahiRList* avahi_rlist_remove(AvahiRList *r, void *data);
-
-/** Remove the specified item from the list and return the new beginning */
-AvahiRList* avahi_rlist_remove_by_link(AvahiRList *r, AvahiRList *n);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/simple-watch.c b/release-0.6.9/avahi-common/simple-watch.c
deleted file mode 100644
index 65d9d18..0000000
--- a/release-0.6.9/avahi-common/simple-watch.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/poll.h>
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#include "llist.h"
-#include "malloc.h"
-#include "timeval.h"
-#include "simple-watch.h"
-
-struct AvahiWatch {
- AvahiSimplePoll *simple_poll;
- int dead;
-
- int idx;
- struct pollfd pollfd;
-
- AvahiWatchCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiWatch, watches);
-};
-
-struct AvahiTimeout {
- AvahiSimplePoll *simple_poll;
- int dead;
-
- int enabled;
- struct timeval expiry;
-
- AvahiTimeoutCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiTimeout, timeouts);
-};
-
-struct AvahiSimplePoll {
- AvahiPoll api;
- AvahiPollFunc poll_func;
- void *poll_func_userdata;
-
- struct pollfd* pollfds;
- int n_pollfds, max_pollfds, rebuild_pollfds;
-
- int watch_req_cleanup, timeout_req_cleanup;
- int quit;
- int events_valid;
-
- int n_watches;
- AVAHI_LLIST_HEAD(AvahiWatch, watches);
- AVAHI_LLIST_HEAD(AvahiTimeout, timeouts);
-
- int wakeup_pipe[2];
- int wakeup_issued;
-
- int prepared_timeout;
-
- enum {
- STATE_INIT,
- STATE_PREPARING,
- STATE_PREPARED,
- STATE_RUNNING,
- STATE_RAN,
- STATE_DISPATCHING,
- STATE_DISPATCHED,
- STATE_QUIT,
- STATE_FAILURE
- } state;
-};
-
-void avahi_simple_poll_wakeup(AvahiSimplePoll *s) {
- char c = 'W';
- assert(s);
-
- write(s->wakeup_pipe[1], &c, sizeof(c));
- s->wakeup_issued = 1;
-}
-
-static void clear_wakeup(AvahiSimplePoll *s) {
- char c[10]; /* Read ten at a time */
-
- if (!s->wakeup_issued)
- return;
-
- s->wakeup_issued = 0;
-
- for(;;)
- if (read(s->wakeup_pipe[0], &c, sizeof(c)) != sizeof(c))
- break;
-}
-
-static int set_nonblock(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFL)) < 0)
- return -1;
-
- if (n & O_NONBLOCK)
- return 0;
-
- return fcntl(fd, F_SETFL, n|O_NONBLOCK);
-}
-
-static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata) {
- AvahiWatch *w;
- AvahiSimplePoll *s;
-
- assert(api);
- assert(fd >= 0);
- assert(callback);
-
- s = api->userdata;
- assert(s);
-
- if (!(w = avahi_new(AvahiWatch, 1)))
- return NULL;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-
- w->simple_poll = s;
- w->dead = 0;
-
- w->pollfd.fd = fd;
- w->pollfd.events = event;
- w->pollfd.revents = 0;
-
- w->callback = callback;
- w->userdata = userdata;
-
- w->idx = -1;
- s->rebuild_pollfds = 1;
-
- AVAHI_LLIST_PREPEND(AvahiWatch, watches, s->watches, w);
- s->n_watches++;
-
- return w;
-}
-
-static void watch_update(AvahiWatch *w, AvahiWatchEvent events) {
- assert(w);
- assert(!w->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(w->simple_poll);
-
- w->pollfd.events = events;
-
- if (w->idx != -1) {
- assert(w->simple_poll);
- w->simple_poll->pollfds[w->idx] = w->pollfd;
- } else
- w->simple_poll->rebuild_pollfds = 1;
-}
-
-static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
- assert(w);
- assert(!w->dead);
-
- if (w->idx != -1 && w->simple_poll->events_valid)
- return w->simple_poll->pollfds[w->idx].revents;
-
- return 0;
-}
-
-static void remove_pollfd(AvahiWatch *w) {
- assert(w);
-
- if (w->idx == -1)
- return;
-
- w->simple_poll->rebuild_pollfds = 1;
-}
-
-static void watch_free(AvahiWatch *w) {
- assert(w);
-
- assert(!w->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(w->simple_poll);
-
- remove_pollfd(w);
-
- w->dead = 1;
- w->simple_poll->n_watches --;
- w->simple_poll->watch_req_cleanup = 1;
-}
-
-static void destroy_watch(AvahiWatch *w) {
- assert(w);
-
- remove_pollfd(w);
- AVAHI_LLIST_REMOVE(AvahiWatch, watches, w->simple_poll->watches, w);
-
- if (!w->dead)
- w->simple_poll->n_watches --;
-
- avahi_free(w);
-}
-
-static void cleanup_watches(AvahiSimplePoll *s, int all) {
- AvahiWatch *w, *next;
- assert(s);
-
- for (w = s->watches; w; w = next) {
- next = w->watches_next;
-
- if (all || w->dead)
- destroy_watch(w);
- }
-
- s->timeout_req_cleanup = 0;
-}
-
-static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
- AvahiTimeout *t;
- AvahiSimplePoll *s;
-
- assert(api);
- assert(callback);
-
- s = api->userdata;
- assert(s);
-
- if (!(t = avahi_new(AvahiTimeout, 1)))
- return NULL;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-
- t->simple_poll = s;
- t->dead = 0;
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-
- t->callback = callback;
- t->userdata = userdata;
-
- AVAHI_LLIST_PREPEND(AvahiTimeout, timeouts, s->timeouts, t);
- return t;
-}
-
-static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
- assert(t);
- assert(!t->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(t->simple_poll);
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-}
-
-static void timeout_free(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(t->simple_poll);
-
- t->dead = 1;
- t->simple_poll->timeout_req_cleanup = 1;
-}
-
-
-static void destroy_timeout(AvahiTimeout *t) {
- assert(t);
-
- AVAHI_LLIST_REMOVE(AvahiTimeout, timeouts, t->simple_poll->timeouts, t);
-
- avahi_free(t);
-}
-
-static void cleanup_timeouts(AvahiSimplePoll *s, int all) {
- AvahiTimeout *t, *next;
- assert(s);
-
- for (t = s->timeouts; t; t = next) {
- next = t->timeouts_next;
-
- if (all || t->dead)
- destroy_timeout(t);
- }
-
- s->timeout_req_cleanup = 0;
-}
-
-AvahiSimplePoll *avahi_simple_poll_new(void) {
- AvahiSimplePoll *s;
-
- if (!(s = avahi_new(AvahiSimplePoll, 1)))
- return NULL;
-
- if (pipe(s->wakeup_pipe) < 0) {
- avahi_free(s);
- return NULL;
- }
-
- set_nonblock(s->wakeup_pipe[0]);
- set_nonblock(s->wakeup_pipe[1]);
-
- s->api.userdata = s;
-
- s->api.watch_new = watch_new;
- s->api.watch_free = watch_free;
- s->api.watch_update = watch_update;
- s->api.watch_get_events = watch_get_events;
-
- s->api.timeout_new = timeout_new;
- s->api.timeout_free = timeout_free;
- s->api.timeout_update = timeout_update;
-
- s->pollfds = NULL;
- s->max_pollfds = s->n_pollfds = 0;
- s->rebuild_pollfds = 1;
- s->quit = 0;
- s->n_watches = 0;
- s->events_valid = 0;
-
- s->watch_req_cleanup = 0;
- s->timeout_req_cleanup = 0;
-
- s->prepared_timeout = 0;
-
- s->state = STATE_INIT;
-
- s->wakeup_issued = 0;
-
- avahi_simple_poll_set_func(s, NULL, NULL);
-
- AVAHI_LLIST_HEAD_INIT(AvahiWatch, s->watches);
- AVAHI_LLIST_HEAD_INIT(AvahiTimeout, s->timeouts);
-
- return s;
-}
-
-void avahi_simple_poll_free(AvahiSimplePoll *s) {
- assert(s);
-
- cleanup_timeouts(s, 1);
- cleanup_watches(s, 1);
- assert(s->n_watches == 0);
-
- avahi_free(s->pollfds);
-
- if (s->wakeup_pipe[0] >= 0)
- close(s->wakeup_pipe[0]);
-
- if (s->wakeup_pipe[1] >= 0)
- close(s->wakeup_pipe[1]);
-
- avahi_free(s);
-}
-
-static int rebuild(AvahiSimplePoll *s) {
- AvahiWatch *w;
- int idx;
-
- assert(s);
-
- if (s->n_watches+1 > s->max_pollfds) {
- struct pollfd *n;
-
- s->max_pollfds = s->n_watches + 10;
-
- if (!(n = avahi_realloc(s->pollfds, sizeof(struct pollfd) * s->max_pollfds)))
- return -1;
-
- s->pollfds = n;
- }
-
-
- s->pollfds[0].fd = s->wakeup_pipe[0];
- s->pollfds[0].events = POLLIN;
- s->pollfds[0].revents = 0;
-
- idx = 1;
-
- for (w = s->watches; w; w = w->watches_next) {
-
- if(w->dead)
- continue;
-
- assert(w->idx < s->max_pollfds);
- s->pollfds[w->idx = idx++] = w->pollfd;
- }
-
- s->n_pollfds = idx;
- s->events_valid = 0;
- s->rebuild_pollfds = 0;
-
- return 0;
-}
-
-static AvahiTimeout* find_next_timeout(AvahiSimplePoll *s) {
- AvahiTimeout *t, *n = NULL;
- assert(s);
-
- for (t = s->timeouts; t; t = t->timeouts_next) {
-
- if (t->dead || !t->enabled)
- continue;
-
- if (!n || avahi_timeval_compare(&t->expiry, &n->expiry) < 0)
- n = t;
- }
-
- return n;
-}
-
-static void timeout_callback(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
- assert(t->enabled);
-
- t->enabled = 0;
- t->callback(t, t->userdata);
-}
-
-int avahi_simple_poll_prepare(AvahiSimplePoll *s, int timeout) {
- AvahiTimeout *next_timeout;
-
- assert(s);
- assert(s->state == STATE_INIT || s->state == STATE_DISPATCHED || s->state == STATE_FAILURE);
- s->state = STATE_PREPARING;
-
- /* Clear pending wakeup requests */
- clear_wakeup(s);
-
- /* Cleanup things first */
- if (s->watch_req_cleanup)
- cleanup_watches(s, 0);
-
- if (s->timeout_req_cleanup)
- cleanup_timeouts(s, 0);
-
- /* Check whether a quit was requested */
- if (s->quit) {
- s->state = STATE_QUIT;
- return 1;
- }
-
- /* Do we need to rebuild our array of pollfds? */
- if (s->rebuild_pollfds)
- if (rebuild(s) < 0) {
- s->state = STATE_FAILURE;
- return -1;
- }
-
- /* Calculate the wakeup time */
- if ((next_timeout = find_next_timeout(s))) {
- struct timeval now;
- int t;
- AvahiUsec usec;
-
- if (next_timeout->expiry.tv_sec == 0 &&
- next_timeout->expiry.tv_usec == 0) {
-
- /* Just a shortcut so that we don't need to call gettimeofday() */
- timeout = 0;
- goto finish;
- }
-
- gettimeofday(&now, NULL);
- usec = avahi_timeval_diff(&next_timeout->expiry, &now);
-
- if (usec <= 0) {
- /* Timeout elapsed */
-
- timeout = 0;
- goto finish;
- }
-
- /* Calculate sleep time. We add 1ms because otherwise we'd
- * wake up too early most of the time */
- t = (int) (usec / 1000) + 1;
-
- if (timeout < 0 || timeout > t)
- timeout = t;
- }
-
-finish:
- s->prepared_timeout = timeout;
- s->state = STATE_PREPARED;
- return 0;
-}
-
-int avahi_simple_poll_run(AvahiSimplePoll *s) {
- assert(s);
- assert(s->state == STATE_PREPARED || s->state == STATE_FAILURE);
-
- s->state = STATE_RUNNING;
-
- if (s->prepared_timeout != 0) {
-
- if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) {
- s->state = STATE_FAILURE;
- return -1;
- }
-
- /* The poll events are now valid again */
- s->events_valid = 1;
- } else
- s->events_valid = 0;
-
- /* Update state */
- s->state = STATE_RAN;
- return 0;
-}
-
-int avahi_simple_poll_dispatch(AvahiSimplePoll *s) {
- AvahiTimeout *next_timeout;
- AvahiWatch *w;
-
- assert(s);
- assert(s->state == STATE_RAN);
- s->state = STATE_DISPATCHING;
-
- /* We execute only on callback in every iteration */
-
- /* Check whether the wakeup time has been reached now */
- if ((next_timeout = find_next_timeout(s))) {
-
- if (next_timeout->expiry.tv_sec == 0 && next_timeout->expiry.tv_usec == 0) {
-
- /* Just a shortcut so that we don't need to call gettimeofday() */
- timeout_callback(next_timeout);
- goto finish;
- }
-
- if (avahi_age(&next_timeout->expiry) >= 0) {
-
- /* Timeout elapsed */
- timeout_callback(next_timeout);
- goto finish;
- }
- }
-
- /* Look for some kind of I/O event */
- for (w = s->watches; w; w = w->watches_next) {
-
- if (w->dead)
- continue;
-
- assert(w->idx >= 0);
- assert(w->idx < s->n_pollfds);
-
- if (s->pollfds[w->idx].revents != 0) {
- w->callback(w, w->pollfd.fd, s->pollfds[w->idx].revents, w->userdata);
- goto finish;
- }
- }
-
-finish:
-
- s->state = STATE_DISPATCHED;
- return 0;
-}
-
-int avahi_simple_poll_iterate(AvahiSimplePoll *s, int timeout) {
- int r;
-
- if ((r = avahi_simple_poll_prepare(s, timeout)) != 0)
- return r;
-
- if ((r = avahi_simple_poll_run(s)) != 0)
- return r;
-
- if ((r = avahi_simple_poll_dispatch(s)) != 0)
- return r;
-
- return 0;
-}
-
-void avahi_simple_poll_quit(AvahiSimplePoll *s) {
- assert(s);
-
- s->quit = 1;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-}
-
-const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s) {
- assert(s);
-
- return &s->api;
-}
-
-static int system_poll(struct pollfd *ufds, unsigned int nfds, int timeout, AVAHI_GCC_UNUSED void *userdata) {
- return poll(ufds, nfds, timeout);
-}
-
-void avahi_simple_poll_set_func(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata) {
- assert(s);
-
- s->poll_func = func ? func : system_poll;
- s->poll_func_userdata = func ? userdata : NULL;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-}
-
-int avahi_simple_poll_loop(AvahiSimplePoll *s) {
- int r;
-
- assert(s);
-
- for (;;)
- if ((r = avahi_simple_poll_iterate(s, -1)) != 0)
- if (r >= 0 || errno != EINTR)
- return r;
-}
diff --git a/release-0.6.9/avahi-common/simple-watch.h b/release-0.6.9/avahi-common/simple-watch.h
deleted file mode 100644
index 7c83db3..0000000
--- a/release-0.6.9/avahi-common/simple-watch.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef foosimplewatchhfoo
-#define foosimplewatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file simple-watch.h Simple poll() based main loop implementation */
-
-#include <sys/poll.h>
-#include <avahi-common/cdecl.h>
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** A main loop object. Main loops of this type aren't very flexible
- * since they only support a single wakeup type. Nevertheless it
- * should suffice for small test and example applications. */
-typedef struct AvahiSimplePoll AvahiSimplePoll;
-
-/** Create a new main loop object */
-AvahiSimplePoll *avahi_simple_poll_new(void);
-
-/** Free a main loop object */
-void avahi_simple_poll_free(AvahiSimplePoll *s);
-
-/** Return the abstracted poll API object for this main loop
- * object. The is will return the same pointer each time it is
- * called. */
-const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s);
-
-/** Run a single main loop iteration of this main loop. If sleep_time
-is < 0 this will block until any of the registered events happens,
-then it will execute the attached callback function. If sleep_time is
-0 the routine just checks if any event is pending. If yes the attached
-callback function is called, otherwise the function returns
-immediately. If sleep_time > 0 the function will block for at most the
-specified time in msecs. Returns -1 on error, 0 on success and 1 if a
-quit request has been scheduled. Usually this function should be called
-in a loop until it returns a non-zero value*/
-int avahi_simple_poll_iterate(AvahiSimplePoll *s, int sleep_time);
-
-/** Request that the main loop quits. If this is called the next
- call to avahi_simple_poll_iterate() will return 1 */
-void avahi_simple_poll_quit(AvahiSimplePoll *s);
-
-/** Prototype for a poll() type function */
-typedef int (*AvahiPollFunc)(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata);
-
-/** Replace the internally used poll() function. By default the system's poll() will be used */
-void avahi_simple_poll_set_func(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata);
-
-/** The first stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
-int avahi_simple_poll_prepare(AvahiSimplePoll *s, int timeout);
-
-/** The second stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
-int avahi_simple_poll_run(AvahiSimplePoll *s);
-
-/** The third and final stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
-int avahi_simple_poll_dispatch(AvahiSimplePoll *s);
-
-/** Call avahi_simple_poll_iterate() in a loop and return if it returns non-zero */
-int avahi_simple_poll_loop(AvahiSimplePoll *s);
-
-/** Wakeup the main loop. (for threaded environments) */
-void avahi_simple_poll_wakeup(AvahiSimplePoll *s);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/strlst-test.c b/release-0.6.9/avahi-common/strlst-test.c
deleted file mode 100644
index 71f748d..0000000
--- a/release-0.6.9/avahi-common/strlst-test.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include "strlst.h"
-#include "malloc.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- char *t, *v;
- uint8_t data[1024];
- AvahiStringList *a = NULL, *b, *p;
- size_t size, n;
- int r;
-
- a = avahi_string_list_new("prefix", "a", "b", NULL);
-
- a = avahi_string_list_add(a, "start");
- a = avahi_string_list_add(a, "foo=99");
- a = avahi_string_list_add(a, "bar");
- a = avahi_string_list_add(a, "");
- a = avahi_string_list_add(a, "");
- a = avahi_string_list_add(a, "quux");
- a = avahi_string_list_add(a, "");
- a = avahi_string_list_add_arbitrary(a, (const uint8_t*) "null\0null", 9);
- a = avahi_string_list_add_printf(a, "seven=%i %c", 7, 'x');
- a = avahi_string_list_add_pair(a, "blubb", "blaa");
- a = avahi_string_list_add_pair(a, "uxknurz", NULL);
- a = avahi_string_list_add_pair_arbitrary(a, "uxknurz2", (const uint8_t*) "blafasel\0oerks", 14);
-
- a = avahi_string_list_add(a, "end");
-
- t = avahi_string_list_to_string(a);
- printf("--%s--\n", t);
- avahi_free(t);
-
- n = avahi_string_list_serialize(a, NULL, 0);
- size = avahi_string_list_serialize(a, data, sizeof(data));
- assert(size == n);
-
- printf("%u\n", size);
-
- for (t = (char*) data, n = 0; n < size; n++, t++) {
- if (*t <= 32)
- printf("(%u)", *t);
- else
- printf("%c", *t);
- }
-
- printf("\n");
-
- assert(avahi_string_list_parse(data, size, &b) == 0);
-
- printf("equal: %i\n", avahi_string_list_equal(a, b));
-
- t = avahi_string_list_to_string(b);
- printf("--%s--\n", t);
- avahi_free(t);
-
- avahi_string_list_free(b);
-
- b = avahi_string_list_copy(a);
-
- assert(avahi_string_list_equal(a, b));
-
- t = avahi_string_list_to_string(b);
- printf("--%s--\n", t);
- avahi_free(t);
-
- p = avahi_string_list_find(a, "seven");
- assert(p);
-
- r = avahi_string_list_get_pair(p, &t, &v, NULL);
- assert(r >= 0);
- assert(t);
- assert(v);
-
- printf("<%s>=<%s>\n", t, v);
- avahi_free(t);
- avahi_free(v);
-
- p = avahi_string_list_find(a, "quux");
- assert(p);
-
- r = avahi_string_list_get_pair(p, &t, &v, NULL);
- assert(r >= 0);
- assert(t);
- assert(!v);
-
- printf("<%s>=<%s>\n", t, v);
- avahi_free(t);
- avahi_free(v);
-
- avahi_string_list_free(a);
- avahi_string_list_free(b);
-
- n = avahi_string_list_serialize(NULL, NULL, 0);
- size = avahi_string_list_serialize(NULL, data, sizeof(data));
- assert(size == 1);
- assert(size == n);
-
- assert(avahi_string_list_parse(data, size, &a) == 0);
- assert(!a);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-common/strlst.c b/release-0.6.9/avahi-common/strlst.c
deleted file mode 100644
index c6ceb0f..0000000
--- a/release-0.6.9/avahi-common/strlst.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "strlst.h"
-#include "malloc.h"
-#include "defs.h"
-
-AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size) {
- AvahiStringList *n;
-
- if (!(n = avahi_malloc(sizeof(AvahiStringList) + size)))
- return NULL;
-
- n->next = l;
- n->size = size;
-
- /* NUL terminate strings, just to make sure */
- n->text[size] = 0;
-
- return n;
-}
-
-AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t*text, size_t size) {
- AvahiStringList *n;
-
- assert(text);
-
- if (!(n = avahi_string_list_add_anonymous(l, size)))
- return NULL;
-
- if (size > 0)
- memcpy(n->text, text, size);
-
- return n;
-}
-
-AvahiStringList *avahi_string_list_add(AvahiStringList *l, const char *text) {
- assert(text);
-
- return avahi_string_list_add_arbitrary(l, (const uint8_t*) text, strlen(text));
-}
-
-int avahi_string_list_parse(const void* data, size_t size, AvahiStringList **ret) {
- const uint8_t *c;
- AvahiStringList *r = NULL;
-
- assert(data);
- assert(ret);
-
- c = data;
- while (size > 0) {
- size_t k;
-
- k = *(c++);
- size--;
-
- if (k > size)
- goto fail; /* Overflow */
-
- if (k > 0) { /* Ignore empty strings */
- AvahiStringList *n;
-
- if (!(n = avahi_string_list_add_arbitrary(r, c, k)))
- goto fail; /* OOM */
-
- r = n;
- }
-
- c += k;
- size -= k;
- }
-
- *ret = r;
-
- return 0;
-
-fail:
- avahi_string_list_free(r);
- return -1;
-}
-
-void avahi_string_list_free(AvahiStringList *l) {
- AvahiStringList *n;
-
- while (l) {
- n = l->next;
- avahi_free(l);
- l = n;
- }
-}
-
-AvahiStringList* avahi_string_list_reverse(AvahiStringList *l) {
- AvahiStringList *r = NULL, *n;
-
- while (l) {
- n = l->next;
- l->next = r;
- r = l;
- l = n;
- }
-
- return r;
-}
-
-char* avahi_string_list_to_string(AvahiStringList *l) {
- AvahiStringList *n;
- size_t s = 0;
- char *t, *e;
-
- for (n = l; n; n = n->next) {
- if (n != l)
- s ++;
-
- s += n->size+2;
- }
-
- if (!(t = e = avahi_new(char, s+1)))
- return NULL;
-
- l = avahi_string_list_reverse(l);
-
- for (n = l; n; n = n->next) {
- if (n != l)
- *(e++) = ' ';
-
- *(e++) = '"';
- strncpy(e, (char*) n->text, n->size);
- e[n->size] = 0;
- e = strchr(e, 0);
- *(e++) = '"';
-
- assert(e);
- }
-
- l = avahi_string_list_reverse(l);
-
- *e = 0;
-
- return t;
-}
-
-size_t avahi_string_list_serialize(AvahiStringList *l, void *data, size_t size) {
- size_t used = 0;
-
- if (data) {
- AvahiStringList *n;
- uint8_t *c;
-
- l = avahi_string_list_reverse(l);
- c = data;
-
- for (n = l; size > 1 && n; n = n->next) {
- size_t k;
-
- if ((k = n->size) == 0)
- /* Skip empty strings */
- continue;
-
- if (k > 255)
- /* Truncate strings at 255 characters */
- k = 255;
-
- if (k > size-1)
- /* Make sure this string fits in */
- k = size-1;
-
- *(c++) = (uint8_t) k;
- memcpy(c, n->text, k);
- c += k;
-
- used += 1 + k;
- size -= 1 + k;
- }
-
- l = avahi_string_list_reverse(l);
-
- if (used == 0 && size > 0) {
-
- /* Empty lists are treated specially. To comply with
- * section 6.1 of the DNS-SD spec, we return a single
- * empty string (i.e. a NUL byte)*/
-
- *(uint8_t*) data = 0;
- used = 1;
- }
-
- } else {
- AvahiStringList *n;
-
- for (n = l; n; n = n->next) {
- size_t k;
-
- if ((k = n->size) == 0)
- continue;
-
- if (k > 255)
- k = 255;
-
- used += 1+k;
- }
-
- if (used == 0)
- used = 1;
- }
-
- return used;
-}
-
-int avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList *b) {
-
- for (;;) {
- if (!a && !b)
- return 1;
-
- if (!a || !b)
- return 0;
-
- if (a->size != b->size)
- return 0;
-
- if (a->size != 0 && memcmp(a->text, b->text, a->size) != 0)
- return 0;
-
- a = a->next;
- b = b->next;
- }
-}
-
-AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...) {
- va_list va;
-
- va_start(va, r);
- r = avahi_string_list_add_many_va(r, va);
- va_end(va);
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_add_many_va(AvahiStringList *r, va_list va) {
- const char *txt;
-
- while ((txt = va_arg(va, const char*)))
- r = avahi_string_list_add(r, txt);
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_new(const char *txt, ...) {
- va_list va;
- AvahiStringList *r = NULL;
-
- if (txt) {
- r = avahi_string_list_add(r, txt);
-
- va_start(va, txt);
- r = avahi_string_list_add_many_va(r, va);
- va_end(va);
- }
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_new_va(va_list va) {
- return avahi_string_list_add_many_va(NULL, va);
-}
-
-AvahiStringList *avahi_string_list_copy(const AvahiStringList *l) {
- AvahiStringList *r = NULL;
-
- for (; l; l = l->next)
- if (!(r = avahi_string_list_add_arbitrary(r, l->text, l->size))) {
- avahi_string_list_free(r);
- return NULL;
- }
-
- return avahi_string_list_reverse(r);
-}
-
-AvahiStringList *avahi_string_list_new_from_array(const char *array[], int length) {
- AvahiStringList *r = NULL;
- int i;
-
- assert(array);
-
- for (i = 0; length >= 0 ? i < length : !!array[i]; i++)
- r = avahi_string_list_add(r, array[i]);
-
- return r;
-}
-
-unsigned avahi_string_list_length(const AvahiStringList *l) {
- unsigned n = 0;
-
- for (; l; l = l->next)
- n++;
-
- return n;
-}
-
-AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *format, va_list va) {
- size_t len = 80;
- AvahiStringList *r;
-
- assert(format);
-
- if (!(r = avahi_malloc(sizeof(AvahiStringList) + len)))
- return NULL;
-
- for (;;) {
- int n;
- AvahiStringList *nr;
-
- n = vsnprintf((char*) r->text, len+1, format, va);
-
- if (n >= 0 && n < (int) len)
- break;
-
- if (n >= 0)
- len = n+1;
- else
- len *= 2;
-
- if (!(nr = avahi_realloc(r, sizeof(AvahiStringList) + len))) {
- avahi_free(r);
- return NULL;
- }
-
- r = nr;
- }
-
-
- r->next = l;
- r->size = strlen((char*) r->text);
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_add_printf(AvahiStringList *l, const char *format, ...) {
- va_list va;
-
- assert(format);
-
- va_start(va, format);
- l = avahi_string_list_add_vprintf(l, format, va);
- va_end(va);
-
- return l;
-}
-
-AvahiStringList *avahi_string_list_find(AvahiStringList *l, const char *key) {
- size_t n;
-
- assert(key);
- n = strlen(key);
-
- for (; l; l = l->next) {
- if (strcasecmp((char*) l->text, key) == 0)
- return l;
-
- if (strncasecmp((char*) l->text, key, n) == 0 && l->text[n] == '=')
- return l;
- }
-
- return NULL;
-}
-
-AvahiStringList *avahi_string_list_add_pair(AvahiStringList *l, const char *key, const char *value) {
- assert(key);
-
- if (value)
- return avahi_string_list_add_printf(l, "%s=%s", key, value);
- else
- return avahi_string_list_add(l, key);
-}
-
-AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const char *key, const uint8_t *value, size_t size) {
- size_t n;
- assert(key);
-
- if (!value)
- return avahi_string_list_add(l, key);
-
- n = strlen(key);
-
- if (!(l = avahi_string_list_add_anonymous(l, n + 1 + size)))
- return NULL;
-
- memcpy(l->text, key, n);
- l->text[n] = '=';
- memcpy(l->text + n + 1, value, size);
-
- return l;
-}
-
-int avahi_string_list_get_pair(AvahiStringList *l, char **key, char **value, size_t *size) {
- char *e;
-
- assert(l);
-
- if (!(e = memchr(l->text, '=', l->size))) {
-
- if (key)
- if (!(*key = avahi_strdup((char*) l->text)))
- return -1;
-
- if (value)
- *value = NULL;
-
- if (size)
- *size = 0;
-
- } else {
- size_t n;
-
- if (key)
- if (!(*key = avahi_strndup((char*) l->text, e - (char *) l->text)))
- return -1;
-
- e++; /* Advance after '=' */
-
- n = l->size - (e - (char*) l->text);
-
- if (value) {
-
- if (!(*value = avahi_memdup(e, n+1))) {
- if (key)
- avahi_free(*key);
- return -1;
- }
-
- (*value)[n] = 0;
- }
-
- if (size)
- *size = n;
- }
-
- return 0;
-}
-
-AvahiStringList *avahi_string_list_get_next(AvahiStringList *l) {
- assert(l);
- return l->next;
-}
-
-uint8_t *avahi_string_list_get_text(AvahiStringList *l) {
- assert(l);
- return l->text;
-}
-
-size_t avahi_string_list_get_size(AvahiStringList *l) {
- assert(l);
- return l->size;
-}
-
-uint32_t avahi_string_list_get_service_cookie(AvahiStringList *l) {
- AvahiStringList *f;
- char *value = NULL, *end = NULL;
- uint32_t ret;
-
- if (!(f = avahi_string_list_find(l, AVAHI_SERVICE_COOKIE)))
- return AVAHI_SERVICE_COOKIE_INVALID;
-
- if (avahi_string_list_get_pair(f, NULL, &value, NULL) < 0 || !value)
- return AVAHI_SERVICE_COOKIE_INVALID;
-
- ret = (uint32_t) strtoll(value, &end, 0);
-
- if (*value && end && *end != 0) {
- avahi_free(value);
- return AVAHI_SERVICE_COOKIE_INVALID;
- }
-
- avahi_free(value);
-
- return ret;
-}
diff --git a/release-0.6.9/avahi-common/strlst.h b/release-0.6.9/avahi-common/strlst.h
deleted file mode 100644
index 26708a5..0000000
--- a/release-0.6.9/avahi-common/strlst.h
+++ /dev/null
@@ -1,152 +0,0 @@
-#ifndef footxtlisthfoo
-#define footxtlisthfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file strlst.h Implementation of a data type to store lists of strings */
-
-#include <sys/types.h>
-#include <inttypes.h>
-#include <stdarg.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/gccmacro.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Linked list of strings that can contain any number of binary
- * characters, including NUL bytes. An empty list is created by
- * assigning a NULL to a pointer to AvahiStringList. The string list
- * is stored in reverse order, so that appending to the string list is
- * effectively a prepending to the linked list. This object is used
- * primarily for storing DNS TXT record data. */
-typedef struct AvahiStringList {
- struct AvahiStringList *next; /**< Pointer to the next linked list element */
- size_t size; /**< Size of text[] */
- uint8_t text[1]; /**< Character data */
-} AvahiStringList;
-
-/** Create a new string list by taking a variable list of NUL
- * terminated strings. The strings are copied using g_strdup(). The
- * argument list must be terminated by a NULL pointer. */
-AvahiStringList *avahi_string_list_new(const char *txt, ...) AVAHI_GCC_SENTINEL;
-
-/** Same as avahi_string_list_new() but pass a va_list structure */
-AvahiStringList *avahi_string_list_new_va(va_list va);
-
-/** Create a new string list from a string array. The strings are
- * copied using g_strdup(). length should contain the length of the
- * array, or -1 if the array is NULL terminated*/
-AvahiStringList *avahi_string_list_new_from_array(const char **array, int length);
-
-/** Free a string list */
-void avahi_string_list_free(AvahiStringList *l);
-
-/** Append a NUL terminated string to the specified string list. The
- * passed string is copied using g_strdup(). Returns the new list
- * start. */
-AvahiStringList *avahi_string_list_add(AvahiStringList *l, const char *text);
-
-/** Append a new NUL terminated formatted string to the specified string list */
-AvahiStringList *avahi_string_list_add_printf(AvahiStringList *l, const char *format, ...) AVAHI_GCC_PRINTF_ATTR23;
-
-/** Append a new NUL terminated formatted string to the specified string list */
-AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *format, va_list va);
-
-/** Append an arbitrary length byte string to the list. Returns the
- * new list start. */
-AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t *text, size_t size);
-
-/** Append a new entry to the string list. The string is not filled
-with data. The caller should fill in string data afterwards by writing
-it to l->text, where l is the pointer returned by this function. This
-function exists solely to optimize a few operations where otherwise
-superfluous string copying would be necessary. */
-AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size);
-
-/** Same as avahi_string_list_add(), but takes a variable number of
- * NUL terminated strings. The argument list must be terminated by a
- * NULL pointer. Returns the new list start. */
-AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...) AVAHI_GCC_SENTINEL;
-
-/** Same as avahi_string_list_add_many(), but use a va_list
- * structure. Returns the new list start. */
-AvahiStringList *avahi_string_list_add_many_va(AvahiStringList *r, va_list va);
-
-/** Convert the string list object to a single character string,
- * seperated by spaces and enclosed in "". avahi_free() the result! This
- * function doesn't work well with string that contain NUL bytes. */
-char* avahi_string_list_to_string(AvahiStringList *l);
-
-/** Serialize the string list object in a way that is compatible with
- * the storing of DNS TXT records. Strings longer than 255 bytes are truncated. */
-size_t avahi_string_list_serialize(AvahiStringList *l, void * data, size_t size);
-
-/** Inverse of avahi_string_list_serialize() */
-int avahi_string_list_parse(const void *data, size_t size, AvahiStringList **ret);
-
-/** Compare to string lists */
-int avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList *b);
-
-/** Copy a string list */
-AvahiStringList *avahi_string_list_copy(const AvahiStringList *l);
-
-/** Reverse the string list. */
-AvahiStringList* avahi_string_list_reverse(AvahiStringList *l);
-
-/** Return the number of elements in the string list */
-unsigned avahi_string_list_length(const AvahiStringList *l);
-
-/** Find the string list entry for the given DNS-SD TXT key */
-AvahiStringList *avahi_string_list_find(AvahiStringList *l, const char *key);
-
-/** Return the DNS-SD TXT key and value for the specified string list
- * item. If size is not NULL it will be filled with the length of
- * value. (for strings containing NUL bytes). If the entry doesn't
- * contain a value *value will be set to NULL. You need to
- * avahi_free() the strings returned in *key and *value. */
-int avahi_string_list_get_pair(AvahiStringList *l, char **key, char **value, size_t *size);
-
-/** Add a new DNS-SD TXT key value pair to the string list. value may
- * be NULL in case you want to specify a key without a value */
-AvahiStringList *avahi_string_list_add_pair(AvahiStringList *l, const char *key, const char *value);
-
-/** Same as avahi_string_list_add_pair() but allow strings containing NUL bytes in *value. */
-AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const char *key, const uint8_t *value, size_t size);
-
-/** Returns the next item in the string list */
-AvahiStringList *avahi_string_list_get_next(AvahiStringList *l);
-
-/** Returns the text for the current item */
-uint8_t *avahi_string_list_get_text(AvahiStringList *l);
-
-/** Returns the size of the current text */
-size_t avahi_string_list_get_size(AvahiStringList *l);
-
-/** Try to find a magic service cookie in the specified DNS-SD string
- * list. Or return AVAHI_SERVICE_COOKIE_INVALID if none is found. */
-uint32_t avahi_string_list_get_service_cookie(AvahiStringList *l);
-
-AVAHI_C_DECL_END
-
-#endif
-
diff --git a/release-0.6.9/avahi-common/thread-watch.c b/release-0.6.9/avahi-common/thread-watch.c
deleted file mode 100644
index 27a0835..0000000
--- a/release-0.6.9/avahi-common/thread-watch.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/poll.h>
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <pthread.h>
-#include <signal.h>
-
-#include "llist.h"
-#include "malloc.h"
-#include "timeval.h"
-#include "simple-watch.h"
-#include "thread-watch.h"
-
-struct AvahiThreadedPoll {
- AvahiSimplePoll *simple_poll;
- pthread_t thread_id;
- pthread_mutex_t mutex;
- int thread_running;
- int retval;
-};
-
-static int poll_func(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
- pthread_mutex_t *mutex = userdata;
- int r;
-
- /* Before entering poll() we unlock the mutex, so that
- * avahi_simple_poll_quit() can succeed from another thread. */
-
- pthread_mutex_unlock(mutex);
- r = poll(ufds, nfds, timeout);
- pthread_mutex_lock(mutex);
-
- return r;
-}
-
-static void* thread(void *userdata){
- AvahiThreadedPoll *p = userdata;
- sigset_t mask;
-
- /* Make sure that signals are delivered to the main thread */
- sigfillset(&mask);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
- pthread_mutex_lock(&p->mutex);
- p->retval = avahi_simple_poll_loop(p->simple_poll);
- pthread_mutex_unlock(&p->mutex);
-
- return NULL;
-}
-
-AvahiThreadedPoll *avahi_threaded_poll_new(void) {
- AvahiThreadedPoll *p;
-
- if (!(p = avahi_new(AvahiThreadedPoll, 1)))
- goto fail; /* OOM */
-
- if (!(p->simple_poll = avahi_simple_poll_new()))
- goto fail;
-
- pthread_mutex_init(&p->mutex, NULL);
-
- avahi_simple_poll_set_func(p->simple_poll, poll_func, &p->mutex);
-
- p->thread_running = 0;
-
- return p;
-
-fail:
- if (p) {
- if (p->simple_poll) {
- avahi_simple_poll_free(p->simple_poll);
- pthread_mutex_destroy(&p->mutex);
- }
-
- avahi_free(p);
- }
-
- return NULL;
-}
-
-void avahi_threaded_poll_free(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is not called from the helper thread */
- assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
-
- if (p->thread_running)
- avahi_threaded_poll_quit(p);
-
- if (p->simple_poll)
- avahi_simple_poll_free(p->simple_poll);
-
- pthread_mutex_destroy(&p->mutex);
- avahi_free(p);
-}
-
-const AvahiPoll* avahi_threaded_poll_get(AvahiThreadedPoll *p) {
- assert(p);
-
- return avahi_simple_poll_get(p->simple_poll);
-}
-
-int avahi_threaded_poll_start(AvahiThreadedPoll *p) {
- assert(p);
-
- assert(!p->thread_running);
-
- if (pthread_create(&p->thread_id, NULL, thread, p) < 0)
- return -1;
-
- return 0;
-}
-
-int avahi_threaded_poll_stop(AvahiThreadedPoll *p) {
- assert(p);
-
- if (!p->thread_running)
- return -1;
-
- /* Make sure that this function is not called from the helper thread */
- assert(!pthread_equal(pthread_self(), p->thread_id));
-
- pthread_mutex_lock(&p->mutex);
- avahi_simple_poll_quit(p->simple_poll);
- pthread_mutex_unlock(&p->mutex);
-
- pthread_join(p->thread_id, NULL);
- p->thread_running = 0;
-
- return p->retval;
-}
-
-void avahi_threaded_poll_quit(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is called from the helper thread */
- assert(pthread_equal(pthread_self(), p->thread_id));
-
- avahi_simple_poll_quit(p->simple_poll);
-}
-
-void avahi_threaded_poll_lock(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is not called from the helper thread */
- assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
-
- pthread_mutex_lock(&p->mutex);
-}
-
-void avahi_threaded_poll_unlock(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is not called from the helper thread */
- assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
-
- pthread_mutex_unlock(&p->mutex);
-}
diff --git a/release-0.6.9/avahi-common/thread-watch.h b/release-0.6.9/avahi-common/thread-watch.h
deleted file mode 100644
index 469ffe5..0000000
--- a/release-0.6.9/avahi-common/thread-watch.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef foothreadedwatchhfoo
-#define foothreadedwatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file thread-watch.h Threaded poll() based main loop implementation */
-
-#include <sys/poll.h>
-#include <avahi-common/cdecl.h>
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** A main loop object that runs an AvahiSimplePoll in its own thread. \since 0.6.4 */
-typedef struct AvahiThreadedPoll AvahiThreadedPoll;
-
-/** Create a new event loop object. This will allocate the internal
- * AvahiSimplePoll, but will not start the helper thread. \since 0.6.4 */
-AvahiThreadedPoll *avahi_threaded_poll_new(void);
-
-/** Free an event loop object. Ths will stop the associated evet loop
- * thread (if it is running). \since 0.6.4 */
-void avahi_threaded_poll_free(AvahiThreadedPoll *p);
-
-/** Return the abstracted poll API object for this event loop
- * object. The will return the same pointer each time it is
- * called. \since 0.6.4 */
-const AvahiPoll* avahi_threaded_poll_get(AvahiThreadedPoll *p);
-
-/** Start the event loop helper thread. After the thread has startet
- * you must make sure to access the event loop object
- * (AvahiThreadedPoll, AvahiPoll and all its associated objects)
- * synchronized, i.e. with proper locking. You may want to use
- * avahi_threaded_poll_lock()/avahi_threaded_poll_unlock() for this,
- * which will lock the the entire event loop. Please note that event
- * loop callback functions are called from the event loop helper thread
- * with that lock held, i.e. avahi_threaded_poll_lock() calls are not
- * required from event callbacks. \since 0.6.4 */
-int avahi_threaded_poll_start(AvahiThreadedPoll *p);
-
-/** Request that the event loop quits and the associated thread
- stops. Call this from outside the helper thread if you want to shut
- it down. \since 0.6.4 */
-int avahi_threaded_poll_stop(AvahiThreadedPoll *p);
-
-/** Request that the event loop quits and the associated thread
- stops. Call this from inside the helper thread if you want to shut it
- down. \since 0.6.4 */
-void avahi_threaded_poll_quit(AvahiThreadedPoll *p);
-
-/** Lock the main loop object. Use this if you want to access the event
- * loop objects (such as creating a new event source) from anything
- * else but the event loop helper thread, i.e. from anything else but event
- * loop callbacks \since 0.6.4 */
-void avahi_threaded_poll_lock(AvahiThreadedPoll *p);
-
-/** Unlock the event loop object, use this as counterpart to
- * avahi_threaded_poll_lock() \since 0.6.4 */
-void avahi_threaded_poll_unlock(AvahiThreadedPoll *p);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/timeval-test.c b/release-0.6.9/avahi-common/timeval-test.c
deleted file mode 100644
index 92fcab2..0000000
--- a/release-0.6.9/avahi-common/timeval-test.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include "gccmacro.h"
-#include "timeval.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- struct timeval a = { 5, 5 }, b;
-
- b = a;
-
- printf("%li.%li\n", a.tv_sec, a.tv_usec);
- avahi_timeval_add(&a, -50);
-
- printf("%li.%li\n", a.tv_sec, a.tv_usec);
-
- printf("%lli\n", avahi_timeval_diff(&a, &b));
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-common/timeval.c b/release-0.6.9/avahi-common/timeval.c
deleted file mode 100644
index 2d0d693..0000000
--- a/release-0.6.9/avahi-common/timeval.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "timeval.h"
-
-int avahi_timeval_compare(const struct timeval *a, const struct timeval *b) {
- assert(a);
- assert(b);
-
- if (a->tv_sec < b->tv_sec)
- return -1;
-
- if (a->tv_sec > b->tv_sec)
- return 1;
-
- if (a->tv_usec < b->tv_usec)
- return -1;
-
- if (a->tv_usec > b->tv_usec)
- return 1;
-
- return 0;
-}
-
-AvahiUsec avahi_timeval_diff(const struct timeval *a, const struct timeval *b) {
- assert(a);
- assert(b);
-
- if (avahi_timeval_compare(a, b) < 0)
- return - avahi_timeval_diff(b, a);
-
- return ((AvahiUsec) a->tv_sec - b->tv_sec)*1000000 + a->tv_usec - b->tv_usec;
-}
-
-struct timeval* avahi_timeval_add(struct timeval *a, AvahiUsec usec) {
- AvahiUsec u;
- assert(a);
-
- u = usec + a->tv_usec;
-
- if (u < 0) {
- a->tv_usec = (long) (1000000 + (u % 1000000));
- a->tv_sec += (long) (-1 + (u / 1000000));
- } else {
- a->tv_usec = (long) (u % 1000000);
- a->tv_sec += (long) (u / 1000000);
- }
-
- return a;
-}
-
-AvahiUsec avahi_age(const struct timeval *a) {
- struct timeval now;
-
- assert(a);
-
- gettimeofday(&now, NULL);
-
- return avahi_timeval_diff(&now, a);
-}
-
-struct timeval *avahi_elapse_time(struct timeval *tv, unsigned msec, unsigned jitter) {
- assert(tv);
-
- gettimeofday(tv, NULL);
-
- if (msec)
- avahi_timeval_add(tv, (AvahiUsec) msec*1000);
-
- if (jitter) {
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- static int last_rand;
- static time_t timestamp = 0;
-
- time_t now;
- int r;
-
- now = time(NULL);
-
- pthread_mutex_lock(&mutex);
- if (now >= timestamp + 10) {
- timestamp = now;
- last_rand = rand();
- }
-
- r = last_rand;
-
- pthread_mutex_unlock(&mutex);
-
- /* We use the same jitter for 10 seconds. That way our
- * time events elapse in bursts which has the advantage that
- * packet data can be aggegrated better */
-
- avahi_timeval_add(tv, (AvahiUsec) (jitter*1000.0*r/(RAND_MAX+1.0)));
- }
-
- return tv;
-}
-
diff --git a/release-0.6.9/avahi-common/timeval.h b/release-0.6.9/avahi-common/timeval.h
deleted file mode 100644
index 8bdb073..0000000
--- a/release-0.6.9/avahi-common/timeval.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef footimevalhfoo
-#define footimevalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file timeval.h Functions to facilitate timeval handling */
-
-#include <inttypes.h>
-#include <sys/time.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** A numeric data type for storing microsecond values. (signed 64bit integer) */
-typedef int64_t AvahiUsec;
-
-/** Compare two timeval structures and return a ngeative value when a < b, 0 when a == b and a positive value otherwise */
-int avahi_timeval_compare(const struct timeval *a, const struct timeval *b);
-
-/** Calculate the difference between to timeval structures as microsecond value */
-AvahiUsec avahi_timeval_diff(const struct timeval *a, const struct timeval *b);
-
-/** Add a number of microseconds to the specified timeval structure and return it. *a is modified. */
-struct timeval* avahi_timeval_add(struct timeval *a, AvahiUsec usec);
-
-/** Return the difference between the current time and *a. Positive if *a was earlier */
-AvahiUsec avahi_age(const struct timeval *a);
-
-/** Fill *tv with the current time plus "ms" milliseconds plus an
- * extra jitter of "j" milliseconds. Pass 0 for j if you don't want
- * the jitter */
-struct timeval *avahi_elapse_time(struct timeval *tv, unsigned ms, unsigned j);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-common/watch-test.c b/release-0.6.9/avahi-common/watch-test.c
deleted file mode 100644
index 870045d..0000000
--- a/release-0.6.9/avahi-common/watch-test.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-
-#include "watch.h"
-#include "timeval.h"
-#include "gccmacro.h"
-
-static const AvahiPoll *api = NULL;
-
-#ifndef USE_THREAD
-#include "simple-watch.h"
-static AvahiSimplePoll *simple_poll = NULL;
-#else
-#include "thread-watch.h"
-static AvahiThreadedPoll *threaded_poll = NULL;
-#endif
-
-static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
-
- if (event & AVAHI_WATCH_IN) {
- ssize_t r;
- char c;
-
- if ((r = read(fd, &c, 1)) <= 0) {
- fprintf(stderr, "read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- api->watch_free(w);
- return;
- }
-
- printf("Read: %c\n", c >= 32 && c < 127 ? c : '.');
- }
-}
-
-static void wakeup(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) {
- static int i = 0;
- struct timeval tv;
-
- printf("Wakeup #%i\n", i++);
-
- if (i > 10) {
-#ifndef USE_THREAD
- avahi_simple_poll_quit(simple_poll);
-#else
- avahi_threaded_poll_quit(threaded_poll);
-#endif
- } else {
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_update(t, &tv);
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- struct timeval tv;
-
-#ifndef USE_THREAD
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
- api = avahi_simple_poll_get(simple_poll);
- assert(api);
-#else
- threaded_poll = avahi_threaded_poll_new();
- assert(threaded_poll);
- api = avahi_threaded_poll_get(threaded_poll);
- assert(api);
-#endif
-
- api->watch_new(api, 0, AVAHI_WATCH_IN, callback, NULL);
-
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_new(api, &tv, wakeup, NULL);
-
-#ifndef USE_THREAD
- /* Our main loop */
- avahi_simple_poll_loop(simple_poll);
- avahi_simple_poll_free(simple_poll);
-
-#else
- avahi_threaded_poll_start(threaded_poll);
-
- fprintf(stderr, "Now doing some stupid stuff ...\n");
- sleep(20);
- fprintf(stderr, "... stupid stuff is done.\n");
-
- avahi_threaded_poll_free(threaded_poll);
-
-#endif
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-common/watch.h b/release-0.6.9/avahi-common/watch.h
deleted file mode 100644
index 6d1a36e..0000000
--- a/release-0.6.9/avahi-common/watch.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef foowatchhfoo
-#define foowatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file watch.h Simplistic main loop abstraction */
-
-#include <sys/poll.h>
-#include <sys/time.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** An I/O watch object */
-typedef struct AvahiWatch AvahiWatch;
-
-/** A timeout watch object */
-typedef struct AvahiTimeout AvahiTimeout;
-
-/** An event polling abstraction object */
-typedef struct AvahiPoll AvahiPoll;
-
-/** Type of watch events */
-typedef enum {
- AVAHI_WATCH_IN = POLLIN, /** Input event */
- AVAHI_WATCH_OUT = POLLOUT, /** Output event */
- AVAHI_WATCH_ERR = POLLERR, /** Error event */
- AVAHI_WATCH_HUP = POLLHUP /** Hangup event */
-} AvahiWatchEvent;
-
-/** Called whenever an I/O event happens on an I/O watch */
-typedef void (*AvahiWatchCallback)(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdata);
-
-/** Called when the timeout is reached */
-typedef void (*AvahiTimeoutCallback)(AvahiTimeout *t, void *userdata);
-
-/** Defines an abstracted event polling API. This may be used to
- connect Avahi to other main loops. This is losely based on Unix
- poll(2). A consumer will call watch_new() for all file descriptors it
- wants to listen for events on. In addition he can call timeout_new()
- to define time based events .*/
-struct AvahiPoll {
-
- /** Some abstract user data usable by the provider of the API */
- void* userdata;
-
- /** Create a new watch for the specified file descriptor and for
- * the specified events. The API will call the callback function
- * whenever any of the events happens. */
- AvahiWatch* (*watch_new)(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata);
-
- /** Update the events to wait for. It is safe to call this function from an AvahiWatchCallback */
- void (*watch_update)(AvahiWatch *w, AvahiWatchEvent event);
-
- /** Return the events that happened. It is safe to call this function from an AvahiWatchCallback */
- AvahiWatchEvent (*watch_get_events)(AvahiWatch *w);
-
- /** Free a watch. It is safe to call this function from an AvahiWatchCallback */
- void (*watch_free)(AvahiWatch *w);
-
- /** Set a wakeup time for the polling loop. The API will call the
- callback function when the absolute time *tv is reached. If tv is
- NULL, the timeout is disabled. After the timeout expired the
- callback function will be called and the timeout is disabled. You
- can reenable it by calling timeout_update() */
- AvahiTimeout* (*timeout_new)(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata);
-
- /** Update the absolute expiration time for a timeout, If tv is
- * null, the timeout is disabled. It is safe to call this function from an AvahiTimeoutCallback */
- void (*timeout_update)(AvahiTimeout *, const struct timeval *tv);
-
- /** Free a timeout. It is safe to call this function from an AvahiTimeoutCallback */
- void (*timeout_free)(AvahiTimeout *t);
-};
-
-AVAHI_C_DECL_END
-
-#endif
-
diff --git a/release-0.6.9/avahi-compat-howl.pc.in b/release-0.6.9/avahi-compat-howl.pc.in
deleted file mode 100644
index b3cd02a..0000000
--- a/release-0.6.9/avahi-compat-howl.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include/avahi-compat-howl/
-
-Name: avahi-compat-howl
-Description: Avahi Multicast DNS Responder (HOWL Compatibility)
-Version: @HOWL_COMPAT_VERSION@
-Libs: -L${libdir} -lhowl
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/release-0.6.9/avahi-compat-howl/Makefile.am b/release-0.6.9/avahi-compat-howl/Makefile.am
deleted file mode 100644
index 961be64..0000000
--- a/release-0.6.9/avahi-compat-howl/Makefile.am
+++ /dev/null
@@ -1,111 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-SUBDIRS = . samples
-
-if HAVE_DBUS
-if ENABLE_COMPAT_HOWL
-
-avahi_compat_howldir=$(includedir)/avahi-compat-howl
-avahi_compat_howl_rendezvousdir=$(avahi_compat_howldir)/rendezvous
-avahi_compat_howl_corbydir=$(avahi_compat_howldir)/corby
-avahi_compat_howl_discoverydir=$(avahi_compat_howldir)/discovery
-avahi_compat_howl_saltdir=$(avahi_compat_howldir)/salt
-
-avahi_compat_howl_HEADERS = \
- include/howl.h
-
-avahi_compat_howl_rendezvous_HEADERS = \
- include/rendezvous/rendezvous.h \
- include/rendezvous/text_record.h
-
-avahi_compat_howl_corby_HEADERS = \
- include/corby/message.h \
- include/corby/object.h \
- include/corby/orb.h \
- include/corby/corby.h \
- include/corby/channel.h \
- include/corby/buffer.h
-
-avahi_compat_howl_discovery_HEADERS = \
- include/discovery/discovery.h \
- include/discovery/text_record.h
-
-avahi_compat_howl_salt_HEADERS = \
- include/salt/socket.h \
- include/salt/address.h \
- include/salt/platform.h \
- include/salt/signal.h \
- include/salt/interface.h \
- include/salt/salt.h \
- include/salt/time.h \
- include/salt/debug.h
-
-HOWLHEADERS = \
- $(avahi_compat_howl_HEADERS) \
- $(avahi_compat_howl_rendezvous_HEADERS) \
- $(avahi_compat_howl_corby_HEADERS) \
- $(avahi_compat_howl_discovery_HEADERS) \
- $(avahi_compat_howl_salt_HEADERS)
-
-lib_LTLIBRARIES = libhowl.la
-
-if ENABLE_TESTS
-noinst_PROGRAMS = address-test text-test browse-domain-test
-endif
-
-libhowl_la_SOURCES = \
- $(HOWLHEADERS) \
- warn.c warn.h \
- unsupported.c \
- address.c \
- text.c \
- compat.c
-libhowl_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-libhowl_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_COMPAT_HOWL_VERSION_INFO) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la
-
-address_test_SOURCES = \
- $(HOWLHEADERS) \
- address.c \
- address-test.c \
- warn.c warn.h
-address_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-address_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la
-
-text_test_SOURCES = \
- $(HOWLHEADERS) \
- text.c \
- text-test.c \
- warn.c warn.h
-text_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-text_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la
-
-browse_domain_test_SOURCES = \
- $(HOWLHEADERS) \
- browse-domain-test.c
-browse_domain_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-browse_domain_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) libhowl.la
-
-endif
-endif
diff --git a/release-0.6.9/avahi-compat-howl/address-test.c b/release-0.6.9/avahi-compat-howl/address-test.c
deleted file mode 100644
index 05276aa..0000000
--- a/release-0.6.9/avahi-compat-howl/address-test.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-
-#include "howl.h"
-
-#define ASSERT_SW_OKAY(t) { sw_result r; r = (t); assert(r == SW_OKAY); }
-#define ASSERT_NOT_NULL(t) { const void* r; r = (t); assert(r); }
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- sw_ipv4_address a;
- char t[256];
- uint8_t a1, a2, a3, a4;
-
- ASSERT_SW_OKAY(sw_ipv4_address_init_from_name(&a, "heise.de"));
- ASSERT_NOT_NULL(sw_ipv4_address_name(a, t, sizeof(t)));
- printf("%s\n", t);
-
- ASSERT_SW_OKAY(sw_ipv4_address_init_from_this_host(&a));
- ASSERT_NOT_NULL(sw_ipv4_address_name(a, t, sizeof(t)));
- printf("%s\n", t);
-
- ASSERT_SW_OKAY(sw_ipv4_address_decompose(a, &a1, &a2, &a3, &a4));
- printf("%i.%i.%i.%i\n", a1, a2, a3, a4);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-compat-howl/address.c b/release-0.6.9/avahi-compat-howl/address.c
deleted file mode 100644
index 1d9fbbe..0000000
--- a/release-0.6.9/avahi-compat-howl/address.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-
-#include <avahi-common/gccmacro.h>
-
-#include "howl.h"
-#include "warn.h"
-
-sw_ipv4_address sw_ipv4_address_any(void) {
- sw_ipv4_address a;
-
- AVAHI_WARN_LINKAGE;
-
- a.m_addr = htonl(INADDR_ANY);
- return a;
-}
-
-sw_ipv4_address sw_ipv4_address_loopback(void) {
- sw_ipv4_address a;
-
- AVAHI_WARN_LINKAGE;
-
- a.m_addr = htonl(INADDR_LOOPBACK);
- return a;
-}
-
-sw_result sw_ipv4_address_init(sw_ipv4_address * self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- self->m_addr = htonl(INADDR_ANY);
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_saddr(
- sw_ipv4_address *self,
- sw_saddr addr) {
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- self->m_addr = addr;
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_name(
- sw_ipv4_address *self,
- sw_const_string name) {
-
- struct hostent *he;
-
- assert(self);
- assert(name);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(he = gethostbyname(name)))
- return SW_E_UNKNOWN;
-
- self->m_addr = *(uint32_t*) he->h_addr;
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_address(
- sw_ipv4_address *self,
- sw_ipv4_address addr) {
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- self->m_addr = addr.m_addr;
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_this_host(sw_ipv4_address *self) {
- struct sockaddr_in sa;
- int fd;
- socklen_t l = sizeof(sa);
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- /* This is so fucked up ... */
-
- memset(&sa, 0, sizeof(sa));
- sa.sin_family = AF_INET;
- sa.sin_addr.s_addr = inet_addr("192.168.1.1"); /* Ouch */
- sa.sin_port = htons(5555);
-
- if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0 ||
- connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0 ||
- getsockname(fd, (struct sockaddr*) &sa, &l) < 0) {
- if (fd >= 0)
- close(fd);
-
- perror("fuck");
- return SW_E_UNKNOWN;
- }
-
- assert(l == sizeof(sa));
- close(fd);
-
- self->m_addr = sa.sin_addr.s_addr;
-
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_fina(AVAHI_GCC_UNUSED sw_ipv4_address self) {
-
- AVAHI_WARN_LINKAGE;
-
- /* This is ridiculous ... */
-
- return SW_OKAY;
-}
-
-sw_bool sw_ipv4_address_is_any(sw_ipv4_address self) {
- AVAHI_WARN_LINKAGE;
- return self.m_addr == htonl(INADDR_ANY);
-}
-
-sw_saddr sw_ipv4_address_saddr(sw_ipv4_address self) {
- AVAHI_WARN_LINKAGE;
- return self.m_addr;
-}
-
-sw_string sw_ipv4_address_name(
- sw_ipv4_address self,
- sw_string name,
- sw_uint32 len) {
-
- assert(name);
- assert(len > 0);
-
- AVAHI_WARN_LINKAGE;
-
- if (len < INET_ADDRSTRLEN)
- return NULL;
-
- if (!(inet_ntop(AF_INET, &self.m_addr, name, len)))
- return NULL;
-
- return name;
-}
-
-sw_result sw_ipv4_address_decompose(
- sw_ipv4_address self,
- sw_uint8 * a1,
- sw_uint8 * a2,
- sw_uint8 * a3,
- sw_uint8 * a4) {
-
- uint32_t a;
-
- AVAHI_WARN_LINKAGE;
-
- a = ntohl(self.m_addr);
-
- assert(a1);
- assert(a2);
- assert(a3);
- assert(a4);
-
- *a1 = (uint8_t) (a >> 24);
- *a2 = (uint8_t) (a >> 16);
- *a3 = (uint8_t) (a >> 8);
- *a4 = (uint8_t) (a);
-
- return SW_OKAY;
-}
-
-sw_bool sw_ipv4_address_equals(
- sw_ipv4_address self,
- sw_ipv4_address addr) {
-
- AVAHI_WARN_LINKAGE;
-
- return self.m_addr == addr.m_addr;
-}
-
diff --git a/release-0.6.9/avahi-compat-howl/browse-domain-test.c b/release-0.6.9/avahi-compat-howl/browse-domain-test.c
deleted file mode 100644
index be99d92..0000000
--- a/release-0.6.9/avahi-compat-howl/browse-domain-test.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include "howl.h"
-
-#define ASSERT_SW_OKAY(t) { sw_result _r; _r = (t); assert(_r == SW_OKAY); }
-#define ASSERT_NOT_NULL(t) { const void* _r; r = (t); assert(_r); }
-
-static sw_result reply(
- AVAHI_GCC_UNUSED sw_discovery discovery,
- AVAHI_GCC_UNUSED sw_discovery_oid oid,
- sw_discovery_browse_status status,
- AVAHI_GCC_UNUSED sw_uint32 interface_index,
- AVAHI_GCC_UNUSED sw_const_string name,
- AVAHI_GCC_UNUSED sw_const_string type,
- sw_const_string domain,
- AVAHI_GCC_UNUSED sw_opaque extra) {
-
- switch (status) {
- case SW_DISCOVERY_BROWSE_ADD_DOMAIN:
- fprintf(stderr, "new domain %s\n", domain);
- break;
-
- case SW_DISCOVERY_BROWSE_REMOVE_DOMAIN:
- fprintf(stderr, "removed domain %s\n", domain);
- break;
-
- case SW_DISCOVERY_BROWSE_INVALID:
- fprintf(stderr, "some kind of failure happened: %s\n", domain);
- break;
-
- default:
- abort();
- }
-
- return SW_OKAY;
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- sw_discovery discovery;
- sw_discovery_oid oid;
-
- ASSERT_SW_OKAY(sw_discovery_init(&discovery));
-
- ASSERT_SW_OKAY(sw_discovery_browse_domains(discovery, 0, reply, NULL, &oid));
-
- ASSERT_SW_OKAY(sw_discovery_run(discovery));
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-compat-howl/compat.c b/release-0.6.9/avahi-compat-howl/compat.c
deleted file mode 100644
index a7e2809..0000000
--- a/release-0.6.9/avahi-compat-howl/compat.c
+++ /dev/null
@@ -1,1184 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-
-#include <pthread.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/llist.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-#include <avahi-client/lookup.h>
-
-#include "howl.h"
-#include "warn.h"
-
-#define OID_MAX 50
-
-enum {
- COMMAND_POLL = 'p',
- COMMAND_QUIT = 'q',
- COMMAND_POLL_DONE = 'P',
- COMMAND_POLL_FAILED = 'F'
-};
-
-typedef enum {
- OID_UNUSED = 0,
- OID_SERVICE_BROWSER,
- OID_SERVICE_RESOLVER,
- OID_DOMAIN_BROWSER,
- OID_ENTRY_GROUP
-} oid_type;
-
-typedef struct service_data service_data;
-
-typedef struct oid_data {
- oid_type type;
- sw_opaque extra;
- sw_discovery discovery;
- void *object;
- sw_result (*reply)(void);
- service_data *service_data;
-} oid_data;
-
-
-struct service_data {
- char *name, *regtype, *domain, *host;
- uint16_t port;
- AvahiIfIndex interface;
- AvahiStringList *txt;
- AVAHI_LLIST_FIELDS(service_data, services);
-};
-
-struct _sw_discovery {
- int n_ref;
- AvahiSimplePoll *simple_poll;
- AvahiClient *client;
-
- oid_data oid_table[OID_MAX];
- sw_discovery_oid oid_index;
-
- int thread_fd, main_fd;
-
- pthread_t thread;
- int thread_running;
-
- pthread_mutex_t mutex, salt_mutex;
-
- AVAHI_LLIST_HEAD(service_data, services);
-};
-
-#define ASSERT_SUCCESS(r) { int __ret = (r); assert(__ret == 0); }
-
-#define OID_GET_INDEX(data) ((sw_discovery_oid) (((data) - ((data)->discovery->oid_table))))
-
-static sw_discovery discovery_ref(sw_discovery self);
-static void discovery_unref(sw_discovery self);
-
-static const char *add_trailing_dot(const char *s, char *buf, size_t buf_len) {
- if (!s)
- return NULL;
-
- if (*s == 0)
- return s;
-
- if (s[strlen(s)-1] == '.')
- return s;
-
- snprintf(buf, buf_len, "%s.", s);
- return buf;
-}
-
-static sw_result map_error(int error) {
- switch (error) {
- case AVAHI_OK:
- return SW_OKAY;
-
- case AVAHI_ERR_NO_MEMORY:
- return SW_E_MEM;
- }
-
- return SW_E_UNKNOWN;
-}
-
-static int read_command(int fd) {
- ssize_t r;
- char command;
-
- assert(fd >= 0);
-
- if ((r = read(fd, &command, 1)) != 1) {
- fprintf(stderr, __FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- return -1;
- }
-
- return command;
-}
-
-static int write_command(int fd, char reply) {
- assert(fd >= 0);
-
- if (write(fd, &reply, 1) != 1) {
- fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int poll_func(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
- sw_discovery self = userdata;
- int ret;
-
- assert(self);
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
- ret = poll(ufds, nfds, timeout);
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- return ret;
-}
-
-static void * thread_func(void *data) {
- sw_discovery self = data;
- sigset_t mask;
-
- sigfillset(&mask);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
- self->thread = pthread_self();
- self->thread_running = 1;
-
- for (;;) {
- char command;
-
- if ((command = read_command(self->thread_fd)) < 0)
- break;
-
-/* fprintf(stderr, "Command: %c\n", command); */
-
- switch (command) {
-
- case COMMAND_POLL: {
- int ret;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- for (;;) {
- errno = 0;
-
- if ((ret = avahi_simple_poll_run(self->simple_poll)) < 0) {
-
- if (errno == EINTR)
- continue;
-
- fprintf(stderr, __FILE__": avahi_simple_poll_run() failed: %s\n", strerror(errno));
- }
-
- break;
- }
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (write_command(self->thread_fd, ret < 0 ? COMMAND_POLL_FAILED : COMMAND_POLL_DONE) < 0)
- break;
-
- break;
- }
-
- case COMMAND_QUIT:
- return NULL;
- }
-
- }
-
- return NULL;
-}
-
-static int oid_alloc(sw_discovery self, oid_type type) {
- sw_discovery_oid i;
- assert(self);
-
- for (i = 0; i < OID_MAX; i++) {
-
- while (self->oid_index >= OID_MAX)
- self->oid_index -= OID_MAX;
-
- if (self->oid_table[self->oid_index].type == OID_UNUSED) {
- self->oid_table[self->oid_index].type = type;
- self->oid_table[self->oid_index].discovery = self;
-
- assert(OID_GET_INDEX(&self->oid_table[self->oid_index]) == self->oid_index);
-
- return self->oid_index ++;
- }
-
- self->oid_index ++;
- }
-
- /* No free entry found */
-
- return (sw_discovery_oid) -1;
-}
-
-static void oid_release(sw_discovery self, sw_discovery_oid oid) {
- assert(self);
- assert(oid < OID_MAX);
-
- assert(self->oid_table[oid].type != OID_UNUSED);
-
- self->oid_table[oid].type = OID_UNUSED;
- self->oid_table[oid].discovery = NULL;
- self->oid_table[oid].reply = NULL;
- self->oid_table[oid].object = NULL;
- self->oid_table[oid].extra = NULL;
- self->oid_table[oid].service_data = NULL;
-}
-
-static oid_data* oid_get(sw_discovery self, sw_discovery_oid oid) {
- assert(self);
-
- if (oid >= OID_MAX)
- return NULL;
-
- if (self->oid_table[oid].type == OID_UNUSED)
- return NULL;
-
- return &self->oid_table[oid];
-}
-
-static service_data* service_data_new(sw_discovery self) {
- service_data *sdata;
-
- assert(self);
-
- if (!(sdata = avahi_new0(service_data, 1)))
- return NULL;
-
- AVAHI_LLIST_PREPEND(service_data, services, self->services, sdata);
-
- return sdata;
-
-}
-
-static void service_data_free(sw_discovery self, service_data* sdata) {
- assert(self);
- assert(sdata);
-
- AVAHI_LLIST_REMOVE(service_data, services, self->services, sdata);
-
- avahi_free(sdata->name);
- avahi_free(sdata->regtype);
- avahi_free(sdata->domain);
- avahi_free(sdata->host);
- avahi_string_list_free(sdata->txt);
- avahi_free(sdata);
-}
-
-static void reg_client_callback(oid_data *data, AvahiClientState state);
-
-static void client_callback(AvahiClient *s, AvahiClientState state, void* userdata) {
- sw_discovery self = userdata;
- sw_discovery_oid oid;
-
- assert(s);
- assert(self);
-
- discovery_ref(self);
-
- for (oid = 0; oid < OID_MAX; oid++) {
-
- switch (self->oid_table[oid].type) {
-
- case OID_ENTRY_GROUP:
- reg_client_callback(&self->oid_table[oid], state);
- break;
-
- case OID_DOMAIN_BROWSER:
- case OID_SERVICE_BROWSER:
- ((sw_discovery_browse_reply) self->oid_table[oid].reply)(self, oid, SW_DISCOVERY_BROWSE_INVALID, 0, NULL, NULL, NULL, self->oid_table[oid].extra);
- break;
-
- case OID_SERVICE_RESOLVER:
- case OID_UNUSED:
- ;
- }
- }
-
- discovery_unref(self);
-}
-
-sw_result sw_discovery_init(sw_discovery * self) {
- int fd[2] = { -1, -1};
- sw_result result = SW_E_UNKNOWN;
- pthread_mutexattr_t mutex_attr;
- int error;
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- *self = NULL;
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0)
- goto fail;
-
- if (!(*self = avahi_new(struct _sw_discovery, 1))) {
- result = SW_E_MEM;
- goto fail;
- }
-
- (*self)->n_ref = 1;
- (*self)->thread_fd = fd[0];
- (*self)->main_fd = fd[1];
-
- (*self)->client = NULL;
- (*self)->simple_poll = NULL;
-
- memset((*self)->oid_table, 0, sizeof((*self)->oid_table));
- (*self)->oid_index = 0;
-
- (*self)->thread_running = 0;
-
- AVAHI_LLIST_HEAD_INIT(service_info, (*self)->services);
-
- ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
- pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
- ASSERT_SUCCESS(pthread_mutex_init(&(*self)->mutex, &mutex_attr));
- ASSERT_SUCCESS(pthread_mutex_init(&(*self)->salt_mutex, &mutex_attr));
-
- if (!((*self)->simple_poll = avahi_simple_poll_new()))
- goto fail;
-
- avahi_simple_poll_set_func((*self)->simple_poll, poll_func, *self);
-
- if (!((*self)->client = avahi_client_new(avahi_simple_poll_get((*self)->simple_poll), 0, client_callback, *self, &error))) {
- result = map_error(error);
- goto fail;
- }
-
- /* Start simple poll */
- if (avahi_simple_poll_prepare((*self)->simple_poll, -1) < 0)
- goto fail;
-
- /* Queue an initial POLL command for the thread */
- if (write_command((*self)->main_fd, COMMAND_POLL) < 0)
- goto fail;
-
- if (pthread_create(&(*self)->thread, NULL, thread_func, *self) != 0)
- goto fail;
-
- (*self)->thread_running = 1;
-
- return SW_OKAY;
-
-fail:
-
- if (*self)
- sw_discovery_fina(*self);
-
- return result;
-}
-
-static int stop_thread(sw_discovery self) {
- assert(self);
-
- if (!self->thread_running)
- return 0;
-
- if (write_command(self->main_fd, COMMAND_QUIT) < 0)
- return -1;
-
- avahi_simple_poll_wakeup(self->simple_poll);
-
- ASSERT_SUCCESS(pthread_join(self->thread, NULL));
- self->thread_running = 0;
- return 0;
-}
-
-static sw_discovery discovery_ref(sw_discovery self) {
- assert(self);
- assert(self->n_ref >= 1);
-
- self->n_ref++;
-
- return self;
-}
-
-static void discovery_unref(sw_discovery self) {
- assert(self);
- assert(self->n_ref >= 1);
-
- if (--self->n_ref > 0)
- return;
-
- stop_thread(self);
-
- if (self->client)
- avahi_client_free(self->client);
-
- if (self->simple_poll)
- avahi_simple_poll_free(self->simple_poll);
-
- if (self->thread_fd >= 0)
- close(self->thread_fd);
-
- if (self->main_fd >= 0)
- close(self->main_fd);
-
- ASSERT_SUCCESS(pthread_mutex_destroy(&self->mutex));
- ASSERT_SUCCESS(pthread_mutex_destroy(&self->salt_mutex));
-
- while (self->services)
- service_data_free(self, self->services);
-
- avahi_free(self);
-}
-
-sw_result sw_discovery_fina(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- stop_thread(self);
- discovery_unref(self);
-
- return SW_OKAY;
-}
-
-sw_result sw_discovery_run(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- return sw_salt_run((sw_salt) self);
-}
-
-sw_result sw_discovery_stop_run(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- return sw_salt_stop_run((sw_salt) self);
-}
-
-int sw_discovery_socket(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- return self->main_fd;
-}
-
-sw_result sw_discovery_read_socket(sw_discovery self) {
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
-
- discovery_ref(self);
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- /* Cleanup notification socket */
- if (read_command(self->main_fd) != COMMAND_POLL_DONE)
- goto finish;
-
- if (avahi_simple_poll_dispatch(self->simple_poll) < 0)
- goto finish;
-
- if (self->n_ref > 1) /* Perhaps we should die */
-
- /* Dispatch events */
- if (avahi_simple_poll_prepare(self->simple_poll, -1) < 0)
- goto finish;
-
- if (self->n_ref > 1)
-
- /* Request the poll */
- if (write_command(self->main_fd, COMMAND_POLL) < 0)
- goto finish;
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- discovery_unref(self);
-
- return result;
-}
-
-sw_result sw_discovery_salt(sw_discovery self, sw_salt *salt) {
- assert(self);
- assert(salt);
-
- AVAHI_WARN_LINKAGE;
-
- *salt = (sw_salt) self;
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_step(sw_salt self, sw_uint32 * msec) {
- struct pollfd p;
- int r;
- sw_result result;
-
- AVAHI_WARN_LINKAGE;
-
- if (!((sw_discovery) self)->thread_running)
- return SW_E_UNKNOWN;
-
- memset(&p, 0, sizeof(p));
- p.fd = ((sw_discovery) self)->main_fd;
- p.events = POLLIN;
-
- if ((r = poll(&p, 1, msec ? (int) *msec : -1)) < 0) {
-
- /* Don't treat EINTR as error */
- if (errno == EINTR)
- return SW_OKAY;
-
- return SW_E_UNKNOWN;
-
- } else if (r == 0) {
-
- /* Timeoout */
- return SW_OKAY;
-
- } else {
- /* Success */
-
- if (p.revents != POLLIN)
- return SW_E_UNKNOWN;
-
- if ((result = sw_discovery_read_socket((sw_discovery) self)) != SW_OKAY)
- return result;
- }
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_run(sw_salt self) {
- sw_result ret;
-
- AVAHI_WARN_LINKAGE;
-
- assert(self);
-
- for (;;)
- if ((ret = sw_salt_step(self, NULL)) != SW_OKAY)
- return ret;
-}
-
-sw_result sw_salt_stop_run(sw_salt self) {
- AVAHI_WARN_LINKAGE;
-
- assert(self);
-
- if (stop_thread((sw_discovery) self) < 0)
- return SW_E_UNKNOWN;
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_lock(sw_salt self) {
- AVAHI_WARN_LINKAGE;
-
- assert(self);
- ASSERT_SUCCESS(pthread_mutex_lock(&((sw_discovery) self)->salt_mutex));
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_unlock(sw_salt self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&((sw_discovery) self)->salt_mutex));
-
- return SW_OKAY;
-}
-
-static void reg_report_status(oid_data *data, sw_discovery_publish_status status) {
- sw_discovery_publish_reply reply;
-
- assert(data);
-
- reply = (sw_discovery_publish_reply) data->reply;
-
- reply(data->discovery,
- OID_GET_INDEX(data),
- status,
- data->extra);
-}
-
-static int reg_create_service(oid_data *data) {
- int ret;
- const char *real_type;
-
- assert(data);
-
- real_type = avahi_get_type_from_subtype(data->service_data->regtype);
-
- if ((ret = avahi_entry_group_add_service_strlst(
- data->object,
- data->service_data->interface,
- AVAHI_PROTO_INET,
- 0,
- data->service_data->name,
- real_type ? real_type : data->service_data->regtype,
- data->service_data->domain,
- data->service_data->host,
- data->service_data->port,
- data->service_data->txt)) < 0)
- return ret;
-
- if (real_type) {
- /* Create a subtype entry */
-
- if (avahi_entry_group_add_service_subtype(
- data->object,
- data->service_data->interface,
- AVAHI_PROTO_INET,
- 0,
- data->service_data->name,
- real_type,
- data->service_data->domain,
- data->service_data->regtype) < 0)
- return ret;
-
- }
-
- if ((ret = avahi_entry_group_commit(data->object)) < 0)
- return ret;
-
- return 0;
-}
-
-static void reg_client_callback(oid_data *data, AvahiClientState state) {
- assert(data);
-
- /* We've not been setup completely */
- if (!data->object)
- return;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
- reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
- break;
-
- case AVAHI_CLIENT_S_RUNNING: {
- int ret;
-
- /* Register the service */
- if ((ret = reg_create_service(data)) < 0) {
- reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
- return;
- }
-
- break;
- }
-
- case AVAHI_CLIENT_S_COLLISION:
-
- /* Remove our entry */
- avahi_entry_group_reset(data->object);
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- case AVAHI_CLIENT_S_REGISTERING:
- /* Ignore */
- break;
- }
-
-}
-
-static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- oid_data *data = userdata;
-
- assert(g);
- assert(data);
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
-
- reg_report_status(data, SW_DISCOVERY_PUBLISH_STARTED);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION:
-
- reg_report_status(data, SW_DISCOVERY_PUBLISH_NAME_COLLISION);
- break;
-
- case AVAHI_ENTRY_GROUP_REGISTERING:
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- /* Ignore */
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
- break;
-
- }
-}
-
-sw_result sw_discovery_publish(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_const_string host,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_discovery_publish_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- sw_result result = SW_E_UNKNOWN;
- service_data *sdata;
- AvahiStringList *txt = NULL;
-
- assert(self);
- assert(name);
- assert(type);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if (text_record && text_record_len > 0)
- if (avahi_string_list_parse(text_record, text_record_len, &txt) < 0)
- return SW_E_UNKNOWN;
-
- if ((*oid = oid_alloc(self, OID_ENTRY_GROUP)) == (sw_discovery_oid) -1) {
- avahi_string_list_free(txt);
- return SW_E_UNKNOWN;
- }
-
- if (!(sdata = service_data_new(self))) {
- avahi_string_list_free(txt);
- oid_release(self, *oid);
- return SW_E_MEM;
- }
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
- data->service_data = sdata;
-
- sdata->interface = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
- sdata->name = avahi_strdup(name);
- sdata->regtype = type ? avahi_normalize_name_strdup(type) : NULL;
- sdata->domain = domain ? avahi_normalize_name_strdup(domain) : NULL;
- sdata->host = host ? avahi_normalize_name_strdup(host) : NULL;
- sdata->port = port;
- sdata->txt = txt;
-
- /* Some OOM checking would be cool here */
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_entry_group_new(self->client, reg_entry_group_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- if (avahi_client_get_state(self->client) == AVAHI_CLIENT_S_RUNNING) {
- int error;
-
- if ((error = reg_create_service(data)) < 0) {
- result = map_error(error);
- goto finish;
- }
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-static void domain_browser_callback(
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- oid_data* data = userdata;
- sw_discovery_browse_reply reply;
- static char domain_fixed[AVAHI_DOMAIN_NAME_MAX];
-
- assert(b);
- assert(data);
-
- reply = (sw_discovery_browse_reply) data->reply;
-
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_ADD_DOMAIN, interface, NULL, NULL, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_REMOVE_DOMAIN, interface, NULL, NULL, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_INVALID, interface, NULL, NULL, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-sw_result sw_discovery_browse_domains(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- AvahiIfIndex ifindex;
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if ((*oid = oid_alloc(self, OID_DOMAIN_BROWSER)) == (sw_discovery_oid) -1)
- return SW_E_UNKNOWN;
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
-
- ifindex = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_domain_browser_new(self->client, ifindex, AVAHI_PROTO_INET, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, domain_browser_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-static void service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- oid_data* data = userdata;
- sw_discovery_resolve_reply reply;
-
- assert(r);
- assert(data);
-
- reply = (sw_discovery_resolve_reply) data->reply;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
-
- char host_name_fixed[AVAHI_DOMAIN_NAME_MAX];
- uint8_t *p = NULL;
- size_t l = 0;
- sw_ipv4_address addr;
-
- sw_ipv4_address_init_from_saddr(&addr, a->data.ipv4.address);
-
- host_name = add_trailing_dot(host_name, host_name_fixed, sizeof(host_name_fixed));
-
- if ((p = avahi_new0(uint8_t, (l = avahi_string_list_serialize(txt, NULL, 0))+1)))
- avahi_string_list_serialize(txt, p, l);
-
- reply(data->discovery, OID_GET_INDEX(data), interface, name, type, domain, addr, port, p, l, data->extra);
-
- avahi_free(p);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- /* Apparently there is no way in HOWL to inform about failed resolvings ... */
-
- avahi_warn("A service failed to resolve in the HOWL compatiblity layer of Avahi which is used by '%s'. "
- "Since the HOWL API doesn't offer any means to inform the application about this, we have to ignore the failure. "
- "Please fix your application to use the native API of Avahi!",
- avahi_exe_name());
-
- break;
- }
-}
-
-sw_result sw_discovery_resolve(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_resolve_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- AvahiIfIndex ifindex;
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
- assert(name);
- assert(type);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if ((*oid = oid_alloc(self, OID_SERVICE_RESOLVER)) == (sw_discovery_oid) -1)
- return SW_E_UNKNOWN;
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
-
- ifindex = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_service_resolver_new(self->client, ifindex, AVAHI_PROTO_INET, name, type, domain, AVAHI_PROTO_INET, 0, service_resolver_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-static void service_browser_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- oid_data* data = userdata;
- char type_fixed[AVAHI_DOMAIN_NAME_MAX], domain_fixed[AVAHI_DOMAIN_NAME_MAX];
- sw_discovery_browse_reply reply;
-
- assert(b);
- assert(data);
-
- reply = (sw_discovery_browse_reply) data->reply;
-
- type = add_trailing_dot(type, type_fixed, sizeof(type_fixed));
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_ADD_SERVICE, interface, name, type, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_REMOVE_SERVICE, interface, name, type, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_INVALID, interface, name, type, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-sw_result sw_discovery_browse(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- AvahiIfIndex ifindex;
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
- assert(type);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if ((*oid = oid_alloc(self, OID_SERVICE_BROWSER)) == (sw_discovery_oid) -1)
- return SW_E_UNKNOWN;
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
-
- ifindex = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_service_browser_new(self->client, ifindex, AVAHI_PROTO_INET, type, domain, 0, service_browser_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-sw_result sw_discovery_cancel(sw_discovery self, sw_discovery_oid oid) {
- oid_data *data;
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(data = oid_get(self, oid)))
- return SW_E_UNKNOWN;
-
- if (data->object) {
- switch (data->type) {
- case OID_SERVICE_BROWSER:
- avahi_service_browser_free(data->object);
- break;
-
- case OID_SERVICE_RESOLVER:
- avahi_service_resolver_free(data->object);
- break;
-
- case OID_DOMAIN_BROWSER:
- avahi_domain_browser_free(data->object);
- break;
-
- case OID_ENTRY_GROUP:
- avahi_entry_group_free(data->object);
- break;
-
- case OID_UNUSED:
- ;
- }
- }
-
- if (data->service_data) {
- assert(data->type == OID_ENTRY_GROUP);
- service_data_free(self, data->service_data);
- }
-
- oid_release(self, oid);
-
- return SW_OKAY;
-}
-
-sw_result sw_discovery_init_with_flags(
- sw_discovery * self,
- sw_discovery_init_flags flags) {
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (flags != SW_DISCOVERY_USE_SHARED_SERVICE)
- return SW_E_NO_IMPL;
-
- return sw_discovery_init(self);
-}
diff --git a/release-0.6.9/avahi-compat-howl/funcs.txt b/release-0.6.9/avahi-compat-howl/funcs.txt
deleted file mode 100644
index 42fbb71..0000000
--- a/release-0.6.9/avahi-compat-howl/funcs.txt
+++ /dev/null
@@ -1,184 +0,0 @@
--- Supported --
-
-sw_discovery_init
-sw_discovery_init_with_flags
-sw_discovery_fina
-sw_discovery_publish
-sw_discovery_browse_domains
-sw_discovery_browse
-sw_discovery_resolve
-sw_discovery_cancel
-sw_discovery_run
-sw_discovery_stop_run
-sw_discovery_socket
-sw_discovery_read_socket
-sw_discovery_salt
-
-sw_text_record_init
-sw_text_record_fina
-sw_text_record_add_string
-sw_text_record_add_key_and_string_value
-sw_text_record_add_key_and_binary_value
-sw_text_record_bytes
-sw_text_record_len
-sw_text_record_iterator_init
-sw_text_record_iterator_fina
-sw_text_record_iterator_next
-
-sw_ipv4_address_any
-sw_ipv4_address_loopback
-sw_ipv4_address_init
-sw_ipv4_address_init_from_saddr
-sw_ipv4_address_init_from_name
-sw_ipv4_address_init_from_address
-sw_ipv4_address_init_from_this_host
-sw_ipv4_address_fina
-sw_ipv4_address_is_any
-sw_ipv4_address_saddr
-sw_ipv4_address_name
-sw_ipv4_address_decompose
-sw_ipv4_address_equals
-
-sw_salt_step
-sw_salt_lock
-sw_salt_unlock
-sw_salt_run
-sw_salt_stop_run
-
--- Unsupported but Relevant --
-
-sw_discovery_publish_update
-sw_discovery_publish_host
-sw_discovery_query_record
-
--- Unsupported and Irrelevant --
-
-sw_strdup
-sw_strerror
-sw_timer_init
-sw_timer_fina
-sw_time_init
-sw_time_init_now
-sw_time_fina
-sw_time_add
-sw_time_sub
-sw_time_cmp
-sw_salt_init
-sw_salt_fina
-sw_salt_register_socket
-sw_salt_unregister_socket
-sw_salt_register_timer
-sw_salt_unregister_timer
-sw_salt_register_network_interface
-sw_salt_unregister_network_interface_handler
-sw_salt_register_signal
-sw_salt_unregister_signal
-sw_print_assert
-sw_print_debug
-sw_tcp_socket_init
-sw_tcp_socket_init_with_desc
-sw_udp_socket_init
-sw_multicast_socket_init
-sw_socket_fina
-sw_socket_bind
-sw_socket_join_multicast_group
-sw_socket_leave_multicast_group
-sw_socket_listen
-sw_socket_connect
-sw_socket_accept
-sw_socket_send
-sw_socket_sendto
-sw_socket_recv
-sw_socket_recvfrom
-sw_socket_set_blocking_mode
-sw_socket_set_options
-sw_socket_ipv4_address
-sw_socket_port
-sw_socket_desc
-sw_socket_close
-sw_socket_options_init
-sw_socket_options_fina
-sw_socket_options_set_debug
-sw_socket_options_set_nodelay
-sw_socket_options_set_dontroute
-sw_socket_options_set_keepalive
-sw_socket_options_set_linger
-sw_socket_options_set_reuseaddr
-sw_socket_options_set_rcvbuf
-sw_socket_options_set_sndbuf
-sw_socket_error_code
-sw_corby_orb_init
-sw_corby_orb_fina
-sw_corby_orb_register_servant
-sw_corby_orb_unregister_servant
-sw_corby_orb_register_bidirectional_object
-sw_corby_orb_register_channel
-sw_corby_orb_get_delegate
-sw_corby_orb_set_delegate
-sw_corby_orb_set_observer
-sw_corby_orb_protocol_to_address
-sw_corby_orb_protocol_to_url
-sw_corby_orb_read_channel
-sw_corby_orb_dispatch_message
-sw_corby_message_init
-sw_corby_message_fina
-sw_corby_buffer_init
-sw_corby_buffer_init_with_size
-sw_corby_buffer_init_with_delegate
-sw_corby_buffer_init_with_size_and_delegate
-sw_corby_buffer_fina
-sw_corby_buffer_reset
-sw_corby_buffer_set_octets
-sw_corby_buffer_octets
-sw_corby_buffer_bytes_used
-sw_corby_buffer_size
-sw_corby_buffer_put_int8
-sw_corby_buffer_put_uint8
-sw_corby_buffer_put_int16
-sw_corby_buffer_put_uint16
-sw_corby_buffer_put_int32
-sw_corby_buffer_put_uint32
-sw_corby_buffer_put_octets
-sw_corby_buffer_put_sized_octets
-sw_corby_buffer_put_cstring
-sw_corby_buffer_put_object
-sw_corby_buffer_put_pad
-sw_corby_buffer_get_int8
-sw_corby_buffer_get_uint8
-sw_corby_buffer_get_int16
-sw_corby_buffer_get_uint16
-sw_corby_buffer_get_int32
-sw_corby_buffer_get_uint32
-sw_corby_buffer_get_octets
-sw_corby_buffer_allocate_and_get_sized_octets
-sw_corby_buffer_get_zerocopy_sized_octets
-sw_corby_buffer_get_sized_octets
-sw_corby_buffer_allocate_and_get_cstring
-sw_corby_buffer_get_zerocopy_cstring
-sw_corby_buffer_get_cstring
-sw_corby_buffer_get_object
-sw_corby_channel_start_request
-sw_corby_channel_start_reply
-sw_corby_channel_send
-sw_corby_channel_recv
-sw_corby_channel_last_recv_from
-sw_corby_channel_ff
-sw_corby_channel_socket
-sw_corby_channel_retain
-sw_corby_channel_set_delegate
-sw_corby_channel_get_delegate
-sw_corby_channel_set_app_data
-sw_corby_channel_get_app_data
-sw_corby_channel_fina
-sw_corby_object_init_from_url
-sw_corby_object_fina
-sw_corby_object_start_request
-sw_corby_object_send
-sw_corby_object_recv
-sw_corby_object_channel
-sw_corby_object_set_channel
-sw_text_record_string_iterator_init
-sw_text_record_string_iterator_fina
-sw_text_record_string_iterator_next
-
-$Id$
diff --git a/release-0.6.9/avahi-compat-howl/include/corby/buffer.h b/release-0.6.9/avahi-compat-howl/include/corby/buffer.h
deleted file mode 100644
index 017ad5d..0000000
--- a/release-0.6.9/avahi-compat-howl/include/corby/buffer.h
+++ /dev/null
@@ -1,330 +0,0 @@
-#ifndef _sw_corby_buffer_h
-#define _sw_corby_buffer_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <corby/corby.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_corby_buffer;
-typedef struct _sw_corby_buffer * sw_corby_buffer;
-struct _sw_corby_object;
-typedef sw_opaque sw_corby_buffer_delegate;
-typedef sw_opaque sw_corby_buffer_observer;
-
-
-typedef enum _sw_corby_buffer_pad
-{
- SW_CORBY_BUFFER_PAD_NONE,
- SW_CORBY_BUFFER_PAD_ALIGN_2,
- SW_CORBY_BUFFER_PAD_ALIGN_4,
- SW_CORBY_BUFFER_PAD_ALIGN_8,
- SW_CORBY_BUFFER_PAD_ALIGN_16,
- SW_CORBY_BUFFER_PAD_ALIGN_32
-} sw_corby_buffer_pad;
-
-
-typedef sw_result
-(HOWL_API* sw_corby_buffer_written_func)(
- sw_corby_buffer_observer observer,
- sw_corby_buffer buffer,
- sw_result result,
- sw_size_t bytesWritten,
- sw_opaque_t extra);
-
-
-typedef sw_result
-(HOWL_API* sw_corby_buffer_overflow_func)(
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer buffer,
- sw_uint8 octet,
- sw_uint8 ** base,
- sw_uint8 ** bptr,
- sw_uint8 ** eptr,
- sw_uint8 ** end,
- sw_opaque_t extra);
-
-
-typedef sw_result
-(HOWL_API* sw_corby_buffer_underflow_func)(
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer buffer,
- sw_uint8 * octet,
- sw_uint8 ** base,
- sw_uint8 ** bptr,
- sw_uint8 ** eptr,
- sw_uint8 ** end,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init(
- sw_corby_buffer * self);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init_with_size(
- sw_corby_buffer * self,
- sw_size_t size);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init_with_delegate(
- sw_corby_buffer * self,
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer_overflow_func overflow,
- sw_corby_buffer_underflow_func underflow,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init_with_size_and_delegate(
- sw_corby_buffer * self,
- sw_size_t size,
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer_overflow_func overflow,
- sw_corby_buffer_underflow_func underflow,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_buffer_fina(
- sw_corby_buffer self);
-
-
-void HOWL_API
-sw_corby_buffer_reset(
- sw_corby_buffer self);
-
-
-sw_result HOWL_API
-sw_corby_buffer_set_octets(
- sw_corby_buffer self,
- sw_octets octets,
- sw_size_t size);
-
-
-sw_octets HOWL_API
-sw_corby_buffer_octets(
- sw_corby_buffer self);
-
-
-sw_size_t HOWL_API
-sw_corby_buffer_bytes_used(
- sw_corby_buffer self);
-
-
-sw_size_t HOWL_API
-sw_corby_buffer_size(
- sw_corby_buffer self);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_int8(
- sw_corby_buffer self,
- sw_int8 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_uint8(
- sw_corby_buffer self,
- sw_uint8 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_int16(
- sw_corby_buffer self,
- sw_int16 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_uint16(
- sw_corby_buffer self,
- sw_uint16 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_int32(
- sw_corby_buffer self,
- sw_int32 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_uint32(
- sw_corby_buffer self,
- sw_uint32 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_octets(
- sw_corby_buffer self,
- sw_const_octets val,
- sw_size_t size);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_sized_octets(
- sw_corby_buffer self,
- sw_const_octets val,
- sw_uint32 len);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_cstring(
- sw_corby_buffer self,
- sw_const_string val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_object(
- sw_corby_buffer self,
- const struct _sw_corby_object * object);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_pad(
- sw_corby_buffer self,
- sw_corby_buffer_pad pad);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_int8(
- sw_corby_buffer self,
- sw_int8 * val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_uint8(
- sw_corby_buffer self,
- sw_uint8 * val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_int16(
- sw_corby_buffer self,
- sw_int16 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_uint16(
- sw_corby_buffer self,
- sw_uint16 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_int32(
- sw_corby_buffer self,
- sw_int32 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_uint32(
- sw_corby_buffer self,
- sw_uint32 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_octets(
- sw_corby_buffer self,
- sw_octets octets,
- sw_size_t size);
-
-
-sw_result HOWL_API
-sw_corby_buffer_allocate_and_get_sized_octets(
- sw_corby_buffer self,
- sw_octets * val,
- sw_uint32 * size,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_zerocopy_sized_octets(
- sw_corby_buffer self,
- sw_octets * val,
- sw_uint32 * size,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_sized_octets(
- sw_corby_buffer self,
- sw_octets val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_allocate_and_get_cstring(
- sw_corby_buffer self,
- sw_string * val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_zerocopy_cstring(
- sw_corby_buffer self,
- sw_string * val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_cstring(
- sw_corby_buffer self,
- sw_string val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_object(
- sw_corby_buffer self,
- struct _sw_corby_object ** object,
- sw_uint8 endian);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/corby/channel.h b/release-0.6.9/avahi-compat-howl/include/corby/channel.h
deleted file mode 100644
index 823e027..0000000
--- a/release-0.6.9/avahi-compat-howl/include/corby/channel.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef _sw_corby_channel_h
-#define _sw_corby_channel_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/socket.h>
-#include <corby/corby.h>
-#include <corby/buffer.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-struct _sw_corby_channel;
-typedef struct _sw_corby_channel * sw_corby_channel;
-struct _sw_corby_message;
-struct _sw_corby_profile;
-typedef struct _sw_corby_profile * sw_corby_profile;
-typedef struct _sw_corby_profile const * sw_const_corby_profile;
-
-
-typedef enum _sw_corby_reply_status
-{
- SW_CORBY_NO_EXCEPTION = 0,
- SW_CORBY_SYSTEM_EXCEPTION = 1,
- SW_CORBY_USER_EXCEPTION = 2,
- SW_CORBY_LOCATION_FORWARD = 3
-} sw_corby_reply_status;
-
-
-typedef sw_result
-(HOWL_API *sw_corby_channel_will_send_func)(
- sw_corby_channel channel,
- sw_octets bytes,
- sw_size_t len,
- sw_opaque_t extra);
-
-
-typedef sw_result
-(HOWL_API *sw_corby_channel_did_read_func)(
- sw_corby_channel channel,
- sw_octets bytes,
- sw_size_t len,
- sw_opaque_t extra);
-
-
-typedef void
-(HOWL_API *sw_corby_channel_cleanup_func)(
- sw_corby_channel channel);
-
-
-typedef struct _sw_corby_channel_delegate
-{
- sw_opaque_t m_delegate;
- sw_corby_channel_will_send_func m_will_send_func;
- sw_corby_channel_did_read_func m_did_read_func;
- sw_corby_channel_cleanup_func m_cleanup_func;
- sw_opaque_t m_extra;
-} * sw_corby_channel_delegate;
-
-
-sw_result HOWL_API
-sw_corby_channel_start_request(
- sw_corby_channel self,
- sw_const_corby_profile profile,
- struct _sw_corby_buffer ** buffer,
- sw_const_string op,
- sw_uint32 oplen,
- sw_bool reply_expected);
-
-
-sw_result HOWL_API
-sw_corby_channel_start_reply(
- sw_corby_channel self,
- struct _sw_corby_buffer ** buffer,
- sw_uint32 request_id,
- sw_corby_reply_status status);
-
-
-sw_result HOWL_API
-sw_corby_channel_send(
- sw_corby_channel self,
- struct _sw_corby_buffer * buffer,
- sw_corby_buffer_observer observer,
- sw_corby_buffer_written_func func,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_channel_recv(
- sw_corby_channel self,
- sw_salt * salt,
- struct _sw_corby_message ** message,
- sw_uint32 * request_id,
- sw_string * op,
- sw_uint32 * op_len,
- struct _sw_corby_buffer ** buffer,
- sw_uint8 * endian,
- sw_bool block);
-
-
-sw_result HOWL_API
-sw_corby_channel_last_recv_from(
- sw_corby_channel self,
- sw_ipv4_address * from,
- sw_port * from_port);
-
-
-sw_result HOWL_API
-sw_corby_channel_ff(
- sw_corby_channel self,
- struct _sw_corby_buffer * buffer);
-
-
-sw_socket HOWL_API
-sw_corby_channel_socket(
- sw_corby_channel self);
-
-
-sw_result HOWL_API
-sw_corby_channel_retain(
- sw_corby_channel self);
-
-
-sw_result HOWL_API
-sw_corby_channel_set_delegate(
- sw_corby_channel self,
- sw_corby_channel_delegate delegate);
-
-
-sw_corby_channel_delegate HOWL_API
-sw_corby_channel_get_delegate(
- sw_corby_channel self);
-
-
-void HOWL_API
-sw_corby_channel_set_app_data(
- sw_corby_channel self,
- sw_opaque app_data);
-
-
-sw_opaque HOWL_API
-sw_corby_channel_get_app_data(
- sw_corby_channel self);
-
-
-sw_result HOWL_API
-sw_corby_channel_fina(
- sw_corby_channel self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/corby/corby.h b/release-0.6.9/avahi-compat-howl/include/corby/corby.h
deleted file mode 100644
index 7d68138..0000000
--- a/release-0.6.9/avahi-compat-howl/include/corby/corby.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef _corby_corby_h
-#define _corby_corby_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-
-/*
- * corby limits
- */
-#define SW_CORBY_OID_LEN 32
-
-
-/*
- * protocol tags. the only standard one is TAG_INTERNET_IIOP.
- * the others are proprietary pandora corby protocols.
- */
-#define SW_TAG_INTERNET_IOP 0
-#define SW_TAG_UIOP 250
-#define SW_TAG_MIOP 251
-#define SW_MIOP_ADDR "231.255.255.250"
-typedef sw_uint32 sw_corby_protocol_tag;
-
-
-/*
- * error codes
- */
-#define SW_E_CORBY_BASE 0x80000500
-#define SW_E_CORBY_UNKNOWN (SW_E_CORBY_BASE + 0)
-#define SW_E_CORBY_BAD_CONFIG (SW_E_CORBY_BASE + 1)
-#define SW_E_CORBY_NO_INTERFACE (SW_E_CORBY_BASE + 2)
-#define SW_E_CORBY_BAD_URL (SW_E_CORBY_BASE + 3)
-#define SW_E_CORBY_BAD_NAME (SW_E_CORBY_BASE + 4)
-#define SW_E_CORBY_BAD_MESSAGE (SW_E_CORBY_BASE + 5)
-#define SW_E_CORBY_BAD_VERSION (SW_E_CORBY_BASE + 6)
-#define SW_E_CORBY_BAD_OID (SW_E_CORBY_BASE + 7)
-#define SW_E_CORBY_BAD_OPERATION (SW_E_CORBY_BASE + 8)
-#define SW_E_CORBY_MARSHAL (SW_E_CORBY_BASE + 10)
-#define SW_E_CORBY_OBJECT_NOT_EXIST (SW_E_CORBY_BASE + 11)
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/corby/message.h b/release-0.6.9/avahi-compat-howl/include/corby/message.h
deleted file mode 100644
index 406b9b9..0000000
--- a/release-0.6.9/avahi-compat-howl/include/corby/message.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef _sw_corby_message_h
-#define _sw_corby_message_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <corby/corby.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_corby_message;
-typedef struct _sw_corby_message * sw_corby_message;
-
-
-sw_result HOWL_API
-sw_corby_message_init(
- sw_corby_message * self);
-
-
-sw_result HOWL_API
-sw_corby_message_fina(
- sw_corby_message self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/corby/object.h b/release-0.6.9/avahi-compat-howl/include/corby/object.h
deleted file mode 100644
index 1bc7407..0000000
--- a/release-0.6.9/avahi-compat-howl/include/corby/object.h
+++ /dev/null
@@ -1,113 +0,0 @@
-#ifndef _corby_object_h
-#define _corby_object_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <corby/message.h>
-#include <corby/channel.h>
-#include <corby/buffer.h>
-#include <corby/corby.h>
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-struct _sw_corby_orb;
-struct _sw_corby_object;
-typedef struct _sw_corby_object * sw_corby_object;
-typedef sw_opaque sw_corby_object_send_completion_handler;
-typedef void
-(HOWL_API *sw_corby_object_send_completion_func)(
- sw_corby_object object,
- sw_corby_buffer buffer,
- sw_result result);
-
-
-
-sw_result HOWL_API
-sw_corby_object_init_from_url(
- sw_corby_object * self,
- struct _sw_corby_orb * orb,
- sw_const_string url,
- sw_socket_options options,
- sw_uint32 bufsize);
-
-
-sw_result HOWL_API
-sw_corby_object_fina(
- sw_corby_object self);
-
-
-sw_result HOWL_API
-sw_corby_object_start_request(
- sw_corby_object self,
- sw_const_string op,
- sw_uint32 op_len,
- sw_bool reply_expected,
- sw_corby_buffer * buffer);
-
-
-sw_result HOWL_API
-sw_corby_object_send(
- sw_corby_object self,
- sw_corby_buffer buffer,
- sw_corby_buffer_observer observer,
- sw_corby_buffer_written_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_corby_object_recv(
- sw_corby_object self,
- sw_corby_message * message,
- sw_corby_buffer * buffer,
- sw_uint8 * endian,
- sw_bool block);
-
-
-sw_result HOWL_API
-sw_corby_object_channel(
- sw_corby_object self,
- sw_corby_channel * channel);
-
-
-sw_result HOWL_API
-sw_corby_object_set_channel(
- sw_corby_object self,
- sw_corby_channel channel);
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/corby/orb.h b/release-0.6.9/avahi-compat-howl/include/corby/orb.h
deleted file mode 100644
index a674082..0000000
--- a/release-0.6.9/avahi-compat-howl/include/corby/orb.h
+++ /dev/null
@@ -1,199 +0,0 @@
-#ifndef _corby_orb_h
-#define _corby_orb_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/address.h>
-#include <salt/socket.h>
-#include <corby/corby.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_corby_orb;
-typedef struct _sw_corby_orb * sw_corby_orb;
-typedef sw_opaque sw_corby_orb_observer;
-typedef sw_opaque sw_corby_servant;
-struct _sw_corby_object;
-struct _sw_corby_channel;
-struct _sw_corby_message;
-struct _sw_corby_buffer;
-
-typedef sw_result
-(HOWL_API *sw_corby_orb_accept_channel_func)(
- sw_corby_orb orb,
- struct _sw_corby_channel * channel);
-
-
-typedef struct _sw_corby_orb_delegate
-{
- sw_opaque m_delegate;
- sw_corby_orb_accept_channel_func m_accept_channel_func;
- sw_opaque m_extra;
-} * sw_corby_orb_delegate;
-
-
-typedef struct _sw_corby_orb_config
-{
- sw_string m_name;
- sw_uint32 m_tag;
- sw_string m_host;
- sw_port m_port;
- sw_string m_options;
-} sw_corby_orb_config;
-
-
-typedef sw_result
-(HOWL_API *sw_corby_servant_cb)(
- sw_corby_servant servant,
- sw_salt salt,
- sw_corby_orb orb,
- struct _sw_corby_channel * channel,
- struct _sw_corby_message * message,
- struct _sw_corby_buffer * buffer,
- sw_const_string op,
- sw_uint32 op_len,
- sw_uint32 request_id,
- sw_uint8 endian);
-
-
-typedef sw_result
-(HOWL_API *sw_corby_orb_observer_func)(
- sw_corby_orb_observer handler,
- sw_salt salt,
- sw_corby_orb orb,
- struct _sw_corby_channel * channel,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_orb_init(
- sw_corby_orb * self,
- sw_salt salt,
- const sw_corby_orb_config * config,
- sw_corby_orb_observer observer,
- sw_corby_orb_observer_func func,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_orb_fina(
- sw_corby_orb self);
-
-
-sw_result HOWL_API
-sw_corby_orb_register_servant(
- sw_corby_orb self,
- sw_corby_servant servant,
- sw_corby_servant_cb cb,
- sw_const_string oid,
- struct _sw_corby_object ** object,
- sw_const_string protocol_name);
-
-
-sw_result HOWL_API
-sw_corby_orb_unregister_servant(
- sw_corby_orb self,
- sw_const_string oid);
-
-
-sw_result HOWL_API
-sw_corby_orb_register_bidirectional_object(
- sw_corby_orb self,
- struct _sw_corby_object * object);
-
-
-sw_result HOWL_API
-sw_corby_orb_register_channel(
- sw_corby_orb self,
- struct _sw_corby_channel * channel);
-
-
-sw_corby_orb_delegate HOWL_API
-sw_corby_orb_get_delegate(
- sw_corby_orb self);
-
-
-sw_result HOWL_API
-sw_corby_orb_set_delegate(
- sw_corby_orb self,
- sw_corby_orb_delegate delegate);
-
-
-sw_result HOWL_API
-sw_corby_orb_set_observer(
- sw_corby_orb self,
- sw_corby_orb_observer observer,
- sw_corby_orb_observer_func func,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_orb_protocol_to_address(
- sw_corby_orb self,
- sw_const_string tag,
- sw_string addr,
- sw_port * port);
-
-
-sw_result HOWL_API
-sw_corby_orb_protocol_to_url(
- sw_corby_orb self,
- sw_const_string tag,
- sw_const_string name,
- sw_string url,
- sw_size_t url_len);
-
-
-sw_result HOWL_API
-sw_corby_orb_read_channel(
- sw_corby_orb self,
- struct _sw_corby_channel * channel);
-
-
-sw_result HOWL_API
-sw_corby_orb_dispatch_message(
- sw_corby_orb self,
- struct _sw_corby_channel * channel,
- struct _sw_corby_message * message,
- struct _sw_corby_buffer * buffer,
- sw_uint8 endian);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/discovery/discovery.h b/release-0.6.9/avahi-compat-howl/include/discovery/discovery.h
deleted file mode 100644
index 1e8a7d5..0000000
--- a/release-0.6.9/avahi-compat-howl/include/discovery/discovery.h
+++ /dev/null
@@ -1,327 +0,0 @@
-#ifndef _discovery_discovery_h
-#define _discovery_discovery_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/socket.h>
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-
-struct _sw_discovery;
-typedef struct _sw_discovery * sw_discovery;
-
-
-/*
- * keeps track of different discovery operations
- */
-typedef sw_uint32 sw_discovery_oid;
-
-
-/*
- * For backwards compatibility
- */
-#define sw_discovery_publish_host_id sw_discovery_oid
-#define sw_discovery_publish_id sw_discovery_oid
-#define sw_discovery_browse_id sw_discovery_oid
-#define sw_discovery_resolve_id sw_discovery_oid
-
-
-/*
- * how to connect to server
- */
-typedef enum _sw_discovery_init_flags
-{
- SW_DISCOVERY_USE_SHARED_SERVICE = 0x1,
- SW_DISCOVERY_USE_PRIVATE_SERVICE = 0x2,
- SW_DISCOVERY_SKIP_VERSION_CHECK = 0x4
-} sw_discovery_init_flags;
-
-
-/*
- * status for asynchronous registration call
- */
-typedef enum _sw_discovery_publish_status
-{
- SW_DISCOVERY_PUBLISH_STARTED,
- SW_DISCOVERY_PUBLISH_STOPPED,
- SW_DISCOVERY_PUBLISH_NAME_COLLISION,
- SW_DISCOVERY_PUBLISH_INVALID
-} sw_discovery_publish_status;
-
-
-typedef enum _sw_discovery_browse_status
-{
- SW_DISCOVERY_BROWSE_INVALID,
- SW_DISCOVERY_BROWSE_RELEASE,
- SW_DISCOVERY_BROWSE_ADD_DOMAIN,
- SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN,
- SW_DISCOVERY_BROWSE_REMOVE_DOMAIN,
- SW_DISCOVERY_BROWSE_ADD_SERVICE,
- SW_DISCOVERY_BROWSE_REMOVE_SERVICE,
- SW_DISCOVERY_BROWSE_RESOLVED
-} sw_discovery_browse_status;
-
-
-typedef enum _sw_discovery_query_record_status
-{
- SW_DISCOVERY_QUERY_RECORD_ADD = 0x1
-} sw_discovery_query_record_status;
-
-
-typedef sw_result
-(HOWL_API *sw_discovery_publish_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_publish_status status,
- sw_opaque extra);
-
-typedef sw_result
-(HOWL_API *sw_discovery_browse_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_browse_status status,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_opaque extra);
-
-typedef sw_result
-(HOWL_API *sw_discovery_resolve_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_opaque extra);
-
-
-typedef sw_result
-(HOWL_API *sw_discovery_query_record_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_query_record_status status,
- sw_uint32 interface_index,
- sw_const_string fullname,
- sw_uint16 rrtype,
- sw_uint16 rrclass,
- sw_uint16 rrdatalen,
- sw_const_octets rrdata,
- sw_uint32 ttl,
- sw_opaque extra);
-
-
-/*
- * API for publishing/browsing/resolving services
- */
-sw_result HOWL_API
-sw_discovery_init(
- sw_discovery * self);
-
-
-sw_result HOWL_API
-sw_discovery_init_with_flags(
- sw_discovery * self,
- sw_discovery_init_flags flags);
-
-
-sw_result HOWL_API
-sw_discovery_fina(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_publish_host(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_discovery_publish_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_publish(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_const_string host,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_discovery_publish_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_publish_update(
- sw_discovery self,
- sw_discovery_oid oid,
- sw_octets text_record,
- sw_uint32 text_record_len);
-
-
-
-/*
- * API for browsing domains
- */
-sw_result HOWL_API
-sw_discovery_browse_domains(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-
-/*
- * API for browsing services
- */
-sw_result HOWL_API
-sw_discovery_browse(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-/*
- * API for resolving services
- */
-sw_result HOWL_API
-sw_discovery_resolve(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_resolve_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_query_record(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_uint32 flags,
- sw_const_string fullname,
- sw_uint16 rrtype,
- sw_uint16 rrclass,
- sw_discovery_query_record_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_cancel(
- sw_discovery self,
- sw_discovery_oid oid);
-
-
-
-/* ----------------------------------------------------------
- *
- * Event Processing APIs
- *
- * ----------------------------------------------------------
- */
-
-
-sw_result HOWL_API
-sw_discovery_run(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_stop_run(
- sw_discovery self);
-
-
-int HOWL_API
-sw_discovery_socket(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_read_socket(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_salt(
- sw_discovery self,
- sw_salt * salt);
-
-
-/*
- * Error codes
- */
-#define SW_DISCOVERY_E_BASE 900
-#define SW_DISCOVERY_E_UNKNOWN (SW_DISCOVERY_E_BASE + 2)
-#define SW_DISCOVERY_E_NO_SUCH_NAME (SW_DISCOVERY_E_BASE + 3)
-#define SW_DISCOVERY_E_NO_MEM (SW_DISCOVERY_E_BASE + 4)
-#define SW_DISCOVERY_E_BAD_PARAM (SW_DISCOVERY_E_BASE + 5)
-#define SW_DISCOVERY_E_BAD_REFERENCE (SW_DISCOVERY_E_BASE + 6)
-#define SW_DISCOVERY_E_BAD_STATE (SW_DISCOVERY_E_BASE + 7)
-#define SW_DISCOVERY_E_BAD_FLAGS (SW_DISCOVERY_E_BASE + 8)
-#define SW_DISCOVERY_E_NOT_SUPPORTED (SW_DISCOVERY_E_BASE + 9)
-#define SW_DISCOVERY_E_NOT_INITIALIZED (SW_DISCOVERY_E_BASE + 10)
-#define SW_DISCOVERY_E_NO_CACHE (SW_DISCOVERY_E_BASE + 11)
-#define SW_DISCOVERY_E_ALREADY_REGISTERED (SW_DISCOVERY_E_BASE + 12)
-#define SW_DISCOVERY_E_NAME_CONFLICT (SW_DISCOVERY_E_BASE + 13)
-#define SW_DISCOVERY_E_INVALID (SW_DISCOVERY_E_BASE + 14)
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/discovery/text_record.h b/release-0.6.9/avahi-compat-howl/include/discovery/text_record.h
deleted file mode 100644
index 91f16d7..0000000
--- a/release-0.6.9/avahi-compat-howl/include/discovery/text_record.h
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifndef _discovery_text_record_h
-#define _discovery_text_record_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-#define SW_TEXT_RECORD_MAX_LEN 255
-
-
-struct _sw_text_record;
-typedef struct _sw_text_record * sw_text_record;
-struct _sw_text_record_iterator;
-typedef struct _sw_text_record_iterator * sw_text_record_iterator;
-struct _sw_text_record_string_iterator;
-typedef struct _sw_text_record_string_iterator * sw_text_record_string_iterator;
-
-
-/*
- * Text record APIs
- */
-sw_result HOWL_API
-sw_text_record_init(
- sw_text_record * self);
-
-
-sw_result HOWL_API
-sw_text_record_fina(
- sw_text_record self);
-
-
-sw_result HOWL_API
-sw_text_record_add_string(
- sw_text_record self,
- sw_const_string string);
-
-
-sw_result HOWL_API
-sw_text_record_add_key_and_string_value(
- sw_text_record self,
- sw_const_string key,
- sw_const_string val);
-
-
-sw_result HOWL_API
-sw_text_record_add_key_and_binary_value(
- sw_text_record self,
- sw_const_string key,
- sw_octets val,
- sw_uint32 len);
-
-
-sw_octets HOWL_API
-sw_text_record_bytes(
- sw_text_record self);
-
-
-sw_uint32 HOWL_API
-sw_text_record_len(
- sw_text_record self);
-
-
-/*
- * APIs for iterating through raw text records
- */
-sw_result HOWL_API
-sw_text_record_iterator_init(
- sw_text_record_iterator * self,
- sw_octets text_record,
- sw_uint32 text_record_len);
-
-
-sw_result HOWL_API
-sw_text_record_iterator_fina(
- sw_text_record_iterator self);
-
-
-sw_result HOWL_API
-sw_text_record_iterator_next(
- sw_text_record_iterator self,
- char key[SW_TEXT_RECORD_MAX_LEN],
- sw_uint8 val[SW_TEXT_RECORD_MAX_LEN],
- sw_uint32 * val_len);
-
-
-/*
- * APIs for iterating through stringified text records
- */
-sw_result HOWL_API
-sw_text_record_string_iterator_init(
- sw_text_record_string_iterator * self,
- sw_const_string text_record_string);
-
-
-sw_result HOWL_API
-sw_text_record_string_iterator_fina(
- sw_text_record_string_iterator self);
-
-
-sw_result HOWL_API
-sw_text_record_string_iterator_next(
- sw_text_record_string_iterator self,
- char key[SW_TEXT_RECORD_MAX_LEN],
- char val[SW_TEXT_RECORD_MAX_LEN]);
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/howl.h b/release-0.6.9/avahi-compat-howl/include/howl.h
deleted file mode 100644
index 80a1775..0000000
--- a/release-0.6.9/avahi-compat-howl/include/howl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _sw_howl_h
-#define _sw_howl_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/time.h>
-#include <salt/debug.h>
-#include <corby/orb.h>
-#include <corby/message.h>
-#include <corby/object.h>
-#include <corby/channel.h>
-#include <corby/buffer.h>
-#include <discovery/discovery.h>
-#include <discovery/text_record.h>
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/rendezvous/rendezvous.h b/release-0.6.9/avahi-compat-howl/include/rendezvous/rendezvous.h
deleted file mode 100644
index 1d26b4a..0000000
--- a/release-0.6.9/avahi-compat-howl/include/rendezvous/rendezvous.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef _rendezvous_rendezvous_h
-#define _rendezvous_rendezvous_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <discovery/discovery.h>
-
-#define _sw_rendezvous _sw_discovery
-#define sw_rendezvous sw_discovery
-#define sw_rendezvous_publish_domain_id sw_discovery_publish_domain_id
-#define sw_rendezvous_publish_host_id sw_discovery_publish_host_id
-#define sw_rendezvous_publish_id sw_discovery_publish_id
-#define sw_rendezvous_browse_id sw_discovery_browse_id
-#define sw_rendezvous_resolve_id sw_discovery_resolve_id
-#define sw_rendezvous_publish_status sw_discovery_publish_status
-#define SW_RENDEZVOUS_PUBLISH_STARTED SW_DISCOVERY_PUBLISH_STARTED
-#define SW_RENDEZVOUS_PUBLISH_STOPPED SW_DISCOVERY_PUBLISH_STOPPED
-#define SW_RENDEZVOUS_PUBLISH_NAME_COLLISION SW_DISCOVERY_PUBLISH_NAME_COLLISION
-#define SW_RENDEZVOUS_PUBLISH_INVALID SW_DISCOVERY_PUBLISH_INVALID
-#define sw_rendezvous_browse_status sw_discovery_browse_status
-#define SW_RENDEZVOUS_BROWSE_INVALID SW_DISCOVERY_BROWSE_INVALID
-#define SW_RENDEZVOUS_BROWSE_RELEASE SW_DISCOVERY_BROWSE_RELEASE
-#define SW_RENDEZVOUS_BROWSE_ADD_DOMAIN SW_DISCOVERY_BROWSE_ADD_DOMAIN
-#define SW_RENDEZVOUS_BROWSE_ADD_DEFAULT_DOMAIN SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN
-#define SW_RENDEZVOUS_BROWSE_REMOVE_DOMAIN SW_DISCOVERY_BROWSE_REMOVE_DOMAIN
-#define SW_RENDEZVOUS_BROWSE_ADD_SERVICE SW_DISCOVERY_BROWSE_ADD_SERVICE
-#define SW_RENDEZVOUS_BROWSE_REMOVE_SERVICE SW_DISCOVERY_BROWSE_REMOVE_SERVICE
-#define SW_RENDEZVOUS_BROWSE_RESOLVED SW_DISCOVERY_BROWSE_RESOLVED
-#define sw_rendezvous_publish_domain_handler sw_discovery_publish_domain_handler
-#define sw_rendezvous_publish_domain_reply sw_discovery_publish_domain_reply
-#define sw_rendezvous_publish_host_handler sw_discovery_publish_host_handler
-#define sw_rendezvous_publish_host_reply sw_discovery_publish_host_reply
-#define sw_rendezvous_publish_handler sw_discovery_publish_handler
-#define sw_rendezvous_publish_reply sw_discovery_publish_reply
-#define sw_rendezvous_browse_handler sw_discovery_browse_handler
-#define sw_rendezvous_browse_reply sw_discovery_browse_reply
-#define sw_rendezvous_resolve_handler sw_discovery_resolve_handler
-#define sw_rendezvous_resolve_reply sw_discovery_resolve_reply
-#define sw_rendezvous_init sw_discovery_init
-#define sw_rendezvous_fina sw_discovery_fina
-#define sw_rendezvous_publish_domain sw_discovery_publish_domain
-#define sw_rendezvous_stop_publish_domain sw_discovery_stop_publish_domain
-#define sw_rendezvous_publish_host sw_discovery_publish_host
-#define sw_rendezvous_stop_publish_host sw_discovery_stop_publish_host
-#define sw_rendezvous_publish sw_discovery_publish
-#define sw_rendezvous_publish_update sw_discovery_publish_update
-#define sw_rendezvous_stop_publish sw_discovery_stop_publish
-#define sw_rendezvous_browse_domains sw_discovery_browse_domains
-#define sw_rendezvous_stop_browse_domains sw_discovery_stop_browse_domains
-#define sw_rendezvous_browse_services sw_discovery_browse
-#define sw_rendezvous_stop_browse_services sw_discovery_stop_browse
-#define sw_rendezvous_resolve sw_discovery_resolve
-#define sw_rendezvous_stop_resolve sw_discovery_stop_resolve
-#define sw_rendezvous_run sw_discovery_run
-#define sw_rendezvous_stop_run sw_discovery_stop_run
-#define sw_rendezvous_socket sw_discovery_socket
-#define sw_rendezvous_read_socket sw_discovery_read_socket
-#define sw_rendezvous_salt sw_discovery_salt
-#define SW_RENDEZVOUS_E_BASE SW_DISCOVERY_E_BASE
-#define SW_RENDEZVOUS_E_UNKNOWN SW_DISCOVERY_E_UNKNOWN
-#define SW_RENDEZVOUS_E_NO_SUCH_NAME SW_DISCOVERY_E_NO_SUCH_NAME
-#define SW_RENDEZVOUS_E_NO_MEM SW_DISCOVERY_E_NO_MEM
-#define SW_RENDEZVOUS_E_BAD_PARAM SW_DISCOVERY_E_BAD_PARAM
-#define SW_RENDEZVOUS_E_BAD_REFERENCE SW_DISCOVERY_E_BAD_REFERENCE
-#define SW_RENDEZVOUS_E_BAD_STATE SW_DISCOVERY_E_BAD_STATE
-#define SW_RENDEZVOUS_E_BAD_FLAGS SW_DISCOVERY_E_BAD_FLAGS
-#define SW_RENDEZVOUS_E_NOT_SUPPORTED SW_DISCOVERY_E_NOT_SUPPORTED
-#define SW_RENDEZVOUS_E_NOT_INITIALIZED SW_DISCOVERY_E_NOT_INITIALIZED
-#define SW_RENDEZVOUS_E_NO_CACHE SW_DISCOVERY_E_NO_CACHE
-#define SW_RENDEZVOUS_E_ALREADY_REGISTERED SW_DISCOVERY_E_ALREADY_REGISTERED
-#define SW_RENDEZVOUS_E_NAME_CONFLICT SW_DISCOVERY_E_NAME_CONFLICT
-#define SW_RENDEZVOUS_E_INVALID SW_DISCOVERY_E_INVALID
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/rendezvous/text_record.h b/release-0.6.9/avahi-compat-howl/include/rendezvous/text_record.h
deleted file mode 100644
index cf8b845..0000000
--- a/release-0.6.9/avahi-compat-howl/include/rendezvous/text_record.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _rendezvous_text_record_h
-#define _rendezvous_text_record_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-
-#include <discovery/text_record.h>
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/address.h b/release-0.6.9/avahi-compat-howl/include/salt/address.h
deleted file mode 100644
index b18a4af..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/address.h
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef _salt_address_h
-#define _salt_address_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-
-#include <salt/salt.h>
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-
-typedef struct _sw_ipv4_address
-{
- sw_uint32 m_addr;
-} sw_ipv4_address;
-
-typedef sw_uint32 sw_saddr;
-
-
-sw_ipv4_address HOWL_API
-sw_ipv4_address_any(void);
-
-
-sw_ipv4_address HOWL_API
-sw_ipv4_address_loopback(void);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init(
- sw_ipv4_address * self);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_saddr(
- sw_ipv4_address * self,
- sw_saddr saddr);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_name(
- sw_ipv4_address * self,
- sw_const_string name);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_address(
- sw_ipv4_address * self,
- sw_ipv4_address addr);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_this_host(
- sw_ipv4_address * self);
-
-
-sw_result HOWL_API
-sw_ipv4_address_fina(
- sw_ipv4_address self);
-
-
-sw_bool HOWL_API
-sw_ipv4_address_is_any(
- sw_ipv4_address self);
-
-
-sw_saddr HOWL_API
-sw_ipv4_address_saddr(
- sw_ipv4_address self);
-
-
-sw_string HOWL_API
-sw_ipv4_address_name(
- sw_ipv4_address self,
- sw_string name,
- sw_uint32 len);
-
-
-sw_result HOWL_API
-sw_ipv4_address_decompose(
- sw_ipv4_address self,
- sw_uint8 * a1,
- sw_uint8 * a2,
- sw_uint8 * a3,
- sw_uint8 * a4);
-
-
-sw_bool HOWL_API
-sw_ipv4_address_equals(
- sw_ipv4_address self,
- sw_ipv4_address addr);
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/debug.h b/release-0.6.9/avahi-compat-howl/include/salt/debug.h
deleted file mode 100644
index 03bd453..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/debug.h
+++ /dev/null
@@ -1,230 +0,0 @@
-#ifndef _salt_debug_h
-#define _salt_debug_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-#include <stdarg.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#define SW_LOG_WARNING 1 << 0
-#define SW_LOG_ERROR 1 << 1
-#define SW_LOG_NOTICE 1 << 2
-#define SW_LOG_VERBOSE 1 << 3
-#define SW_LOG_OFF 0x0
-
-
-#if (defined( __GNUC__))
-
-# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
-
-# define __C99_VA_ARGS__ 1
-
-# define __GNU_VA_ARGS__ 0
-
-# else
-
-# define __C99_VA_ARGS__ 0
-
-# define __GNU_VA_ARGS__ 1
-
-# endif
-
-#else
-
-# define __C99_VA_ARGS__ 0
-
-# define __GNU_VA_ARGS__ 0
-
-#endif
-
-
-# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9)))
-
-# define __SW_FUNCTION__ __func__
-
-#elif (defined( __GNUC__))
-
-# define __SW_FUNCTION__ __PRETTY_FUNCTION__
-
-#elif( defined(_MSC_VER ) && !defined(_WIN32_WCE))
-
-# define __SW_FUNCTION__ __FUNCTION__
-
-#else
-
-# define __SW_FUNCTION__ ""
-
-#endif
-
-
-#define sw_check(expr, label, action) \
-do \
-{ \
- if (!(expr)) \
- { \
- { \
- action; \
- } \
- goto label; \
- } \
-} while (0)
-
-
-#define sw_check_log(expr, label, action) \
-do \
-{ \
- if (!(expr)) \
- { \
- sw_print_assert(0, NULL, __FILE__, __SW_FUNCTION__, __LINE__); \
- { \
- action; \
- } \
- goto label; \
- } \
-} while (0)
-
-
-#define sw_check_okay(code, label) \
-do \
-{ \
- if ((int) code != 0) \
- { \
- goto label; \
- } \
-} while (0)
-
-
-#define sw_check_okay_log(code, label) \
-do \
-{ \
- if ((int) code != 0) \
- { \
- sw_print_assert((int) code, NULL, __FILE__, __SW_FUNCTION__, __LINE__); \
- goto label; \
- } \
-} while ( 0 )
-
-
-#define sw_translate_error(expr, errno) ((expr) ? 0 : (errno))
-
-
-#if defined(WIN32)
-
-# define sw_socket_errno() (int) WSAGetLastError()
-# define sw_set_socket_errno(X) WSASetLastError(X)
-# define sw_system_errno() (int) GetLastError()
-# define sw_set_system_errno(X) SetLastError(X)
-
-#else
-
-# define sw_socket_errno() errno
-# define sw_set_socket_errno(X) errno = X
-# define sw_system_errno() errno
-# define sw_set_system_errno(X) errno = X
-
-#endif
-
-
-#if !defined(NDEBUG)
-
-# define sw_assert(X) \
- \
- do \
- { \
- if (!(X)) \
- { \
- sw_print_assert( 0, #X, __FILE__, __SW_FUNCTION__, __LINE__); \
- } \
- } while( 0 )
-
-#else
-
-# define sw_assert(X)
-
-#endif
-
-
-void HOWL_API
-sw_print_assert(
- int code,
- sw_const_string assert_string,
- sw_const_string file,
- sw_const_string func,
- int line);
-
-
-#if !defined(NDEBUG)
-
-void HOWL_API
-sw_print_debug(
- int level,
- sw_const_string format,
- ...);
-
-# if (__C99_VA_ARGS__)
-
-# define sw_debug(...) sw_print_debug(__VA_ARGS__)
-
-# else
-
-# define sw_debug sw_print_debug
-
-# endif
-
-#else
-
-# if (__C99_VA_ARGS__)
-
-# define sw_debug(...)
-
-# else
-
-# define sw_debug while( 0 )
-
-# endif
-
-#endif
-
-
-#define SW_UNUSED_PARAM(X) (void) (X)
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/interface.h b/release-0.6.9/avahi-compat-howl/include/salt/interface.h
deleted file mode 100644
index 5356398..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/interface.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef _sw_interface_h
-#define _sw_interface_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/address.h>
-
-struct _sw_network_interface;
-typedef struct _sw_network_interface * sw_network_interface;
-
-
-typedef enum _sw_network_interface_state
-{
- SW_NETWORK_INTERFACE_RUNNING = 0x1,
-} sw_network_interface_state;
-
-
-typedef struct _sw_mac_address
-{
- sw_uint8 m_id[6];
-} sw_mac_address;
-
-
-sw_result HOWL_API
-sw_network_interfaces(
- sw_uint32 * count,
- sw_network_interface ** netifs);
-
-
-sw_result HOWL_API
-sw_network_interfaces_fina(
- sw_uint32 count,
- sw_network_interface * netifs);
-
-
-sw_result HOWL_API
-sw_network_interface_fina(
- sw_network_interface netif);
-
-
-sw_result HOWL_API
-sw_network_interface_by_name(
- sw_string name,
- sw_network_interface * netif);
-
-
-sw_result HOWL_API
-sw_network_interface_name(
- sw_network_interface netif,
- sw_string name,
- sw_uint32 len);
-
-
-sw_result HOWL_API
-sw_network_interface_mac_address(
- sw_network_interface netif,
- sw_mac_address * addr);
-
-
-sw_result HOWL_API
-sw_network_interface_ipv4_address(
- sw_network_interface netif,
- sw_ipv4_address * addr);
-
-
-sw_result HOWL_API
-sw_network_interface_set_ipv4_address(
- sw_network_interface netif,
- sw_ipv4_address addr);
-
-
-sw_result HOWL_API
-sw_network_interface_index(
- sw_network_interface netif,
- sw_uint32 * index);
-
-
-sw_result HOWL_API
-sw_network_interface_linked(
- sw_network_interface netif,
- sw_bool * linked);
-
-
-sw_result HOWL_API
-sw_network_interface_up(
- sw_network_interface netif);
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/platform.h b/release-0.6.9/avahi-compat-howl/include/salt/platform.h
deleted file mode 100644
index d0553e7..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/platform.h
+++ /dev/null
@@ -1,438 +0,0 @@
-#ifndef _sw_platform_h
-#define _sw_platform_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software, Inc.
- */
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#if defined(__VXWORKS__)
-
-# define HOWL_API
-# include <vxworks.h>
-# include <sysLib.h>
-
-# define sw_snooze(SECS) taskDelay(sysClkRateGet() * SECS)
-
-#elif defined(WIN32)
-
-# define WIN32_LEAN_AND_MEAN
-# define HOWL_API __stdcall
-# pragma warning(disable:4127)
-# include <windows.h>
-# include <stdlib.h>
-
-typedef signed char int8_t;
-typedef unsigned char u_int8_t;
-typedef signed short int16_t;
-typedef unsigned short u_int16_t;
-typedef signed long int32_t;
-typedef unsigned long u_int32_t;
-typedef _int64 int64_t;
-typedef _int64 u_int64_t;
-
-# define sw_snooze(SECS) Sleep(SECS * 1000)
-
-#else
-
-# define HOWL_API
-# if defined(HOWL_KERNEL)
-# include <howl_config.h>
-# endif
-# include <sys/types.h>
-# include <stdlib.h>
-# include <unistd.h>
-
-# define sw_snooze(SECS) sleep(SECS)
-
-#endif
-
-#if defined(__sun)
-
-# define u_int8_t uint8_t
-# define u_int16_t uint16_t
-# define u_int32_t uint32_t
-# define u_int64_t uint64_t
-
-#endif
-
-typedef void * sw_opaque;
-typedef void * sw_opaque_t;
-typedef int8_t sw_int8;
-typedef u_int8_t sw_uint8;
-typedef u_int8_t sw_bool;
-typedef int16_t sw_int16;
-typedef u_int16_t sw_uint16;
-typedef int32_t sw_int32;
-typedef u_int32_t sw_uint32;
-typedef int64_t sw_int64;
-typedef u_int64_t sw_uint64;
-typedef char * sw_string;
-typedef sw_uint8 * sw_octets;
-#if !defined(__VXWORKS__) || defined(__cplusplus)
-typedef const char * sw_const_string;
-typedef const u_int8_t * sw_const_octets;
-#else
-typedef char * sw_const_string;
-typedef u_int8_t * sw_const_octets;
-#endif
-typedef size_t sw_size_t;
-typedef int sw_result;
-
-
-
-/* --------------------------------------------------------
- *
- * Endian-osity
- *
- * SW_ENDIAN is 0 for big endian platforms, 1
- * for little endian platforms.
- *
- * The macro WORDS_BIGENDIAN will be defined
- * by autoconf. If you are using Howl on
- * a platform that doesn't have autoconf, define
- * SW_ENDIAN directly
- * --------------------------------------------------------
- */
-
-#if !defined(SW_ENDIAN)
-
-# if WORDS_BIGENDIAN == 1
-
-# define SW_ENDIAN 0
-
-# else
-
-# define SW_ENDIAN 1
-
-# endif
-
-#endif
-
-
-/* --------------------------------------------------------
- *
- * Strings
- *
- * These macros supports cross platform string functions
- * for the following OSes
- *
- * Win32
- * *NIX
- * PalmOS
- * VxWorks
- *
- * --------------------------------------------------------
- */
-
-#if defined(WIN32)
-
-# include <string.h>
-
-# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3)
-# define sw_memcpy(ARG1, ARG2, ARG3) memmove((char*) ARG1, (char*) ARG2, ARG3)
-# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3)
-# define sw_strcasecmp(ARG1, ARG2) stricmp(ARG1, ARG2)
-# define sw_strncasecmp(ARG1, ARG2) strnicmp(ARG1, ARG2)
-# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) (ARG2) ? strcpy(ARG1, ARG2) : strcpy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) (ARG2) ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) strlen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3)
-
-#elif defined(__VXWORKS__)
-
-# include <string.h>
-
-extern sw_int32
-sw_strcasecmp(
- sw_const_string arg1,
- sw_const_string arg2);
-
-extern sw_int32
-sw_strncasecmp(
- sw_const_string arg1,
- sw_const_string arg2,
- sw_len n);
-
-extern sw_string
-sw_strtok_r(
- sw_string arg1,
- sw_const_string arg2,
- sw_string * lasts);
-
-# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3)
-# define sw_memcpy(ARG1, ARG2, ARG3) memcpy((char*) ARG1, (char*) ARG2, ARG3)
-# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3)
-# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) ARG2 ? strcpy(ARG1, ARG2) : strcpy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) ARG2 ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) strlen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-
-#elif defined(__PALMOS__)
-
-# include <StringMgr.h>
-
-# define sw_strcasecmp(ARG1, ARG2) strcasecmp(ARG1, ARG2)
-# define sw_strncasecmp(ARG1, ARG2) strncasecmp(ARG1, ARG2)
-# define sw_strcat(ARG1, ARG2) StrCat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) StrNCat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) StrChr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) StrCampare(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) StrNCompare(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) ARG2 ? StrCopy(ARG1, ARG2) : StrCopy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) ARG2 ? StrNCopy(ARG1, ARG2, N) : StrCopy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) StrLen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3)
-
-#else
-
-# include <string.h>
-
-# if defined(__Lynx__)
- char * strchr(char*, int);
-# endif
-
-# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3)
-# define sw_memcpy(ARG1, ARG2, ARG3) memcpy((char*) ARG1, (char*) ARG2, ARG3)
-# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3)
-# define sw_strcasecmp(ARG1, ARG2) strcasecmp(ARG1, ARG2)
-# define sw_strncasecmp(ARG1, ARG2) strncasecmp(ARG1, ARG2)
-# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) ARG2 ? strcpy(ARG1, ARG2) : strcpy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) ARG2 ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) strlen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3)
-
-#endif
-
-
-sw_string
-sw_strdup(
- sw_const_string str);
-
-
-/* --------------------------------------------------------
- *
- * Memory
- *
- * These macros support cross platform heap functions.
- * When compiling with DEBUG, some extra checking is
- * done which can aid in tracking down heap corruption
- * problems
- *
- * --------------------------------------------------------
- */
-
-#if defined(NDEBUG)
-
-# define sw_malloc(SIZE) malloc(SIZE)
-# define sw_realloc(MEM,SIZE) realloc(MEM, SIZE)
-# define sw_free(MEM) if (MEM) free(MEM)
-
-#else
-
-# define sw_malloc(SIZE) _sw_debug_malloc(SIZE, __SW_FUNCTION__, __FILE__, __LINE__)
-# define sw_realloc(MEM,SIZE) _sw_debug_realloc(MEM, SIZE, __SW_FUNCTION__, __FILE__, __LINE__)
-# define sw_free(MEM) if (MEM) _sw_debug_free(MEM, __SW_FUNCTION__, __FILE__, __LINE__)
-
-#endif
-
-
-sw_opaque HOWL_API
-_sw_debug_malloc(
- sw_size_t size,
- sw_const_string function,
- sw_const_string file,
- sw_uint32 line);
-
-
-sw_opaque HOWL_API
-_sw_debug_realloc(
- sw_opaque_t mem,
- sw_size_t size,
- sw_const_string function,
- sw_const_string file,
- sw_uint32 line);
-
-
-void HOWL_API
-_sw_debug_free(
- sw_opaque_t mem,
- sw_const_string function,
- sw_const_string file,
- sw_uint32 line);
-
-
-
-/* --------------------------------------------------------
- *
- * Sockets
- *
- * These macros and APIs support cross platform socket
- * calls. I am relying on BSD APIs, but even with those
- * there are subtle and not so subtle platform differences
- *
- * --------------------------------------------------------
- */
-
-#if defined(__VXWORKS__)
-
-# include <vxworks.h>
-# include <hostLib.h>
-# include <sockLib.h>
-# include <ioLib.h>
-# include <inetLib.h>
-
-typedef int sw_sockdesc_t;
-typedef socklen_t sw_socklen_t;
-
-#elif defined(WIN32)
-
-# include <winsock2.h>
-
-typedef SOCKET sw_sockdesc_t;
-typedef int sw_socklen_t;
-
-# define SW_E_WOULDBLOCK WSAEWOULDBLOCK
-# define SW_INVALID_SOCKET INVALID_SOCKET
-# define SW_SOCKET_ERROR SOCKET_ERROR
-
-# define sw_close_socket(X) closesocket(X)
-
-#else
-
-# if defined(sun)
-
-# include <unistd.h>
-
-# endif
-
-# include <sys/types.h>
-# include <signal.h>
-
-# if defined(__Lynx__)
-
-# include <socket.h>
-
-# else
-
-# include <sys/socket.h>
-
-# endif
-
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-# include <netdb.h>
-# include <arpa/inet.h>
-# include <stdlib.h>
-# include <unistd.h>
-# include <sys/ioctl.h>
-# include <stdio.h>
-# include <errno.h>
-
-typedef sw_int32 sw_sockdesc_t;
-typedef socklen_t sw_socklen_t;
-
-# define SW_E_WOULDBLOCK EWOULDBLOCK
-# define SW_INVALID_SOCKET -1
-# define SW_SOCKET_ERROR -1
-
-# define sw_close_socket(X) close(X)
-
-#endif
-
-
-/* --------------------------------------------------------
- *
- * strerror()
- *
- * This function will print a string rep of a system error
- * code
- *
- * --------------------------------------------------------
- */
-
-sw_const_string
-sw_strerror();
-
-
-/*
- * Obsolete types and macros.
- *
- * These are here for backwards compatibility, but will
- * be removed in the future
- */
-#define sw_char sw_int8
-#define sw_uchar sw_uint8
-#define sw_octet sw_uint8
-#define sw_short sw_int16
-#define sw_ushort sw_uint16
-#define sw_long sw_int32
-#define sw_ulong sw_uint32
-
-
-#define SW_TRY(EXPR) { sw_result result; if ((result = EXPR) != SW_OKAY) return result; } ((void) 0)
-#define SW_TRY_GOTO(EXPR) { if ((result = EXPR) != SW_OKAY) goto exit; } ((void) 0)
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/salt.h b/release-0.6.9/avahi-compat-howl/include/salt/salt.h
deleted file mode 100644
index 88ac0d9..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/salt.h
+++ /dev/null
@@ -1,215 +0,0 @@
-#ifndef _sw_salt_h
-#define _sw_salt_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software, Inc.
- */
-
-#include <salt/platform.h>
-#include <salt/time.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-typedef enum _sw_socket_event
-{
- SW_SOCKET_READ = (1 << 0),
- SW_SOCKET_WRITE = (1 << 1),
- SW_SOCKET_OOB = (1 << 2)
-} sw_socket_event;
-
-
-struct _sw_salt;
-typedef struct _sw_salt * sw_salt;
-struct _sw_socket;
-struct _sw_timer;
-struct _sw_network_interface;
-struct _sw_signal;
-
-typedef sw_opaque sw_socket_handler;
-typedef sw_result
-(HOWL_API *sw_socket_handler_func)(
- sw_socket_handler handler,
- sw_salt salt,
- struct _sw_socket * socket,
- sw_socket_event events,
- sw_opaque extra);
-
-
-typedef sw_opaque sw_timer_handler;
-typedef sw_result
-(HOWL_API *sw_timer_handler_func)(
- sw_timer_handler handler,
- sw_salt salt,
- struct _sw_timer * timer,
- sw_time timeout,
- sw_opaque extra);
-
-typedef sw_opaque sw_network_interface_handler;
-typedef sw_result
-(HOWL_API *sw_network_interface_handler_func)(
- sw_network_interface_handler handler,
- sw_salt salt,
- struct _sw_network_interface * netif,
- sw_opaque extra);
-
-typedef sw_opaque sw_signal_handler;
-typedef sw_result
-(HOWL_API *sw_signal_handler_func)(
- sw_signal_handler handler,
- sw_salt salt,
- struct _sw_signal * signal,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_init(
- sw_salt * self,
- int argc,
- char ** argv);
-
-
-sw_result HOWL_API
-sw_salt_fina(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_register_socket(
- sw_salt self,
- struct _sw_socket * socket,
- sw_socket_event events,
- sw_socket_handler handler,
- sw_socket_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_socket(
- sw_salt self,
- struct _sw_socket * socket);
-
-
-sw_result HOWL_API
-sw_salt_register_timer(
- sw_salt self,
- struct _sw_timer * timer,
- sw_time timeout,
- sw_timer_handler handler,
- sw_timer_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_timer(
- sw_salt self,
- struct _sw_timer * timer);
-
-
-sw_result HOWL_API
-sw_salt_register_network_interface(
- sw_salt self,
- struct _sw_network_interface * netif,
- sw_network_interface_handler handler,
- sw_network_interface_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_network_interface_handler(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_register_signal(
- sw_salt self,
- struct _sw_signal * signal,
- sw_signal_handler handler,
- sw_signal_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_signal(
- sw_salt self,
- struct _sw_signal * signal);
-
-
-sw_result HOWL_API
-sw_salt_lock(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_unlock(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_step(
- sw_salt self,
- sw_uint32 * msec);
-
-
-sw_result HOWL_API
-sw_salt_run(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_stop_run(
- sw_salt self);
-
-
-#define SW_FALSE 0
-#define SW_TRUE 1
-#define SW_OKAY 0
-
-
-/*
- * error codes
- */
-#define SW_E_CORE_BASE 0x80000000
-#define SW_E_UNKNOWN (SW_E_CORE_BASE) + 1
-#define SW_E_INIT (SW_E_CORE_BASE) + 2
-#define SW_E_MEM (SW_E_CORE_BASE) + 3
-#define SW_E_EOF (SW_E_CORE_BASE) + 4
-#define SW_E_NO_IMPL (SW_E_CORE_BASE) + 5
-#define SW_E_FILE_LOCKED (SW_E_CORE_BASE) + 6
-#define SW_E_PROTOCOL_NOT_FOUND (SW_E_CORE_BASE) + 7
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/signal.h b/release-0.6.9/avahi-compat-howl/include/salt/signal.h
deleted file mode 100644
index 2ae5bb3..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/signal.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef _salt_signal_h
-#define _salt_signal_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_signal;
-typedef struct _sw_signal * sw_signal;
-
-
-sw_result HOWL_API
-sw_signal_init(
- sw_signal * self,
- int signal);
-
-
-sw_result HOWL_API
-sw_signal_fina(
- sw_signal self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/socket.h b/release-0.6.9/avahi-compat-howl/include/salt/socket.h
deleted file mode 100644
index 88773e4..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/socket.h
+++ /dev/null
@@ -1,263 +0,0 @@
-#ifndef _sw_socket_h
-#define _sw_socket_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-#include <salt/address.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_socket;
-typedef struct _sw_socket * sw_socket;
-struct _sw_socket_options;
-typedef struct _sw_socket_options * sw_socket_options;
-typedef sw_uint16 sw_port;
-
-
-
-sw_result HOWL_API
-sw_tcp_socket_init(
- sw_socket * self);
-
-
-sw_result HOWL_API
-sw_tcp_socket_init_with_desc(
- sw_socket * self,
- sw_sockdesc_t desc);
-
-
-sw_result HOWL_API
-sw_udp_socket_init(
- sw_socket * self);
-
-
-sw_result HOWL_API
-sw_multicast_socket_init(
- sw_socket * self);
-
-
-sw_result HOWL_API
-sw_socket_fina(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_bind(
- sw_socket self,
- sw_ipv4_address address,
- sw_port port);
-
-
-sw_result HOWL_API
-sw_socket_join_multicast_group(
- sw_socket self,
- sw_ipv4_address local_address,
- sw_ipv4_address multicast_address,
- sw_uint32 ttl);
-
-
-sw_result HOWL_API
-sw_socket_leave_multicast_group(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_listen(
- sw_socket self,
- int qsize);
-
-
-sw_result HOWL_API
-sw_socket_connect(
- sw_socket self,
- sw_ipv4_address address,
- sw_port port);
-
-
-sw_result HOWL_API
-sw_socket_accept(
- sw_socket self,
- sw_socket * socket);
-
-
-sw_result HOWL_API
-sw_socket_send(
- sw_socket self,
- sw_octets buffer,
- sw_size_t len,
- sw_size_t * bytesWritten);
-
-
-sw_result HOWL_API
-sw_socket_sendto(
- sw_socket self,
- sw_octets buffer,
- sw_size_t len,
- sw_size_t * bytesWritten,
- sw_ipv4_address to,
- sw_port port);
-
-
-sw_result HOWL_API
-sw_socket_recv(
- sw_socket self,
- sw_octets buffer,
- sw_size_t max,
- sw_size_t * len);
-
-
-sw_result HOWL_API
-sw_socket_recvfrom(
- sw_socket self,
- sw_octets buffer,
- sw_size_t max,
- sw_size_t * len,
- sw_ipv4_address * from,
- sw_port * port,
- sw_ipv4_address * dest,
- sw_uint32 * interface_index);
-
-
-sw_result HOWL_API
-sw_socket_set_blocking_mode(
- sw_socket self,
- sw_bool blocking_mode);
-
-
-sw_result HOWL_API
-sw_socket_set_options(
- sw_socket self,
- sw_socket_options options);
-
-
-sw_ipv4_address HOWL_API
-sw_socket_ipv4_address(
- sw_socket self);
-
-
-sw_port HOWL_API
-sw_socket_port(
- sw_socket self);
-
-
-sw_sockdesc_t HOWL_API
-sw_socket_desc(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_close(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_options_init(
- sw_socket_options * self);
-
-
-sw_result HOWL_API
-sw_socket_options_fina(
- sw_socket_options self);
-
-
-sw_result HOWL_API
-sw_socket_options_set_debug(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_nodelay(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_dontroute(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_keepalive(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_linger(
- sw_socket_options self,
- sw_bool onoff,
- sw_uint32 linger);
-
-
-sw_result HOWL_API
-sw_socket_options_set_reuseaddr(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_rcvbuf(
- sw_socket_options self,
- sw_uint32 val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_sndbuf(
- sw_socket_options self,
- sw_uint32 val);
-
-
-int
-sw_socket_error_code(void);
-
-
-#define SW_E_SOCKET_BASE 0x80000200
-#define SW_E_SOCKET (SW_E_SOCKET_BASE) + 1
-#define SW_E_BIND (SW_E_SOCKET_BASE) + 2
-#define SW_E_GETSOCKNAME (SW_E_SOCKET_BASE) + 3
-#define SW_E_ADD_MEMBERSHIP (SW_E_SOCKET_BASE) + 4
-#define SW_E_MULTICAST_TTL (SW_E_SOCKET_BASE) + 5
-#define SW_E_NOCONNECTION (SW_E_SOCKET_BASE) + 6
-#define SW_E_INPROGRESS (SW_E_SOCKET_BASE) + 7
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/include/salt/time.h b/release-0.6.9/avahi-compat-howl/include/salt/time.h
deleted file mode 100644
index b3ec226..0000000
--- a/release-0.6.9/avahi-compat-howl/include/salt/time.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef _salt_time_h
-#define _salt_time_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_timer;
-typedef struct _sw_timer * sw_timer;
-
-
-sw_result HOWL_API
-sw_timer_init(
- sw_timer * self);
-
-
-sw_result HOWL_API
-sw_timer_fina(
- sw_timer self);
-
-
-typedef struct _sw_time
-{
- sw_uint32 m_secs;
- sw_uint32 m_usecs;
-} sw_time;
-
-
-sw_result HOWL_API
-sw_time_init(
- sw_time * self);
-
-
-sw_result HOWL_API
-sw_time_init_now(
- sw_time * self);
-
-
-sw_result HOWL_API
-sw_time_fina(
- sw_time self);
-
-
-sw_time HOWL_API
-sw_time_add(
- sw_time self,
- sw_time y);
-
-
-sw_time HOWL_API
-sw_time_sub(
- sw_time self,
- sw_time y);
-
-
-sw_int32 HOWL_API
-sw_time_cmp(
- sw_time self,
- sw_time y);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/release-0.6.9/avahi-compat-howl/samples/Makefile.am b/release-0.6.9/avahi-compat-howl/samples/Makefile.am
deleted file mode 100644
index bda07b1..0000000
--- a/release-0.6.9/avahi-compat-howl/samples/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir) -I$(top_srcdir)/avahi-compat-howl/include
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-if ENABLE_COMPAT_HOWL
-
-if ENABLE_TESTS
-noinst_PROGRAMS = browse resolve publish query
-endif
-
-browse_SOURCES = \
- browse.c
-browse_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-browse_LDADD = $(AM_LDADD) ../libhowl.la
-
-resolve_SOURCES = \
- resolve.c
-resolve_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-resolve_LDADD = $(AM_LDADD) ../libhowl.la
-
-publish_SOURCES = \
- publish.c
-publish_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-publish_LDADD = $(AM_LDADD) ../libhowl.la
-
-query_SOURCES = \
- query.c
-query_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-query_LDADD = $(AM_LDADD) ../libhowl.la
-
-endif
-endif
diff --git a/release-0.6.9/avahi-compat-howl/samples/browse.c b/release-0.6.9/avahi-compat-howl/samples/browse.c
deleted file mode 100644
index b4a8cf3..0000000
--- a/release-0.6.9/avahi-compat-howl/samples/browse.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <salt/debug.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-my_resolver(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_opaque_t extra)
-{
- sw_text_record_iterator it;
- sw_int8 name_buf[16];
- sw_int8 key[SW_TEXT_RECORD_MAX_LEN];
- sw_int8 sval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint8 oval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint32 oval_len;
- sw_result err = SW_OKAY;
-
- sw_discovery_cancel(discovery, oid);
-
- fprintf(stderr, "resolve reply: 0x%x %s %s %s %s %d\n", interface_index, name, type, domain, sw_ipv4_address_name(address, name_buf, 16), port);
-
- if ((text_record_len > 0) && (text_record) && (*text_record != '\0'))
- {
- err = sw_text_record_iterator_init(&it, text_record, text_record_len);
- sw_check_okay(err, exit);
-
- while (sw_text_record_iterator_next(it, key, oval, &oval_len) == SW_OKAY)
- {
- fprintf(stderr, "Txt: [%s]=[%s] - (%d bytes)\n", key, oval, oval_len);
- }
-
- err = sw_text_record_iterator_fina(it);
- sw_check_okay(err, exit);
- }
-
-exit:
-
- return err;
-}
-
-
-static sw_result HOWL_API
-my_browser(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_discovery_browse_status status,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_opaque_t extra)
-{
- sw_discovery_resolve_id rid;
-
- switch (status)
- {
- case SW_DISCOVERY_BROWSE_INVALID:
- {
- fprintf(stderr, "browse reply: Invalid\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_RELEASE:
- {
- fprintf(stderr, "browse reply: Release\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_ADD_DOMAIN:
- {
- fprintf(stderr, "browse reply: Add Domain\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN:
- {
- fprintf(stderr, "browse reply: Add Default Domain\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_REMOVE_DOMAIN:
- {
- fprintf(stderr, "browse reply: Remove Domain\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_ADD_SERVICE:
- {
- fprintf(stderr, "browse reply: Add Service 0x%x %s %s %s\n", interface_index, name, type, domain);
- if (sw_discovery_resolve(discovery, interface_index, name, type, domain, my_resolver, NULL, &rid) != SW_OKAY)
- {
- fprintf(stderr, "resolve failed\n");
- }
- }
- break;
-
- case SW_DISCOVERY_BROWSE_REMOVE_SERVICE:
- {
- fprintf(stderr, "browse reply: Remove Service\n");
- fprintf(stderr, "remove service: 0x%x %s %s %s\n", interface_index, name, type, domain);
- }
- break;
-
- case SW_DISCOVERY_BROWSE_RESOLVED:
- {
- fprintf(stderr, "browse reply: Resolved\n");
- }
- break;
- }
-
- return SW_OKAY;
-}
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_discovery_oid oid;
- sw_result err;
-
- err = sw_discovery_init(&discovery);
- sw_check_okay(err, exit);
-
- if (argc != 2)
- {
- fprintf(stderr, "usage: mDNSBrowse <type>\n");
- return -1;
- }
-
- err = sw_discovery_browse(discovery, 0, argv[1], NULL, my_browser, NULL, &oid);
- sw_check_okay(err, exit);
-
- err = sw_discovery_run(discovery);
- sw_check_okay(err, exit);
-
-exit:
-
- return err;
-}
diff --git a/release-0.6.9/avahi-compat-howl/samples/publish.c b/release-0.6.9/avahi-compat-howl/samples/publish.c
deleted file mode 100644
index cca6040..0000000
--- a/release-0.6.9/avahi-compat-howl/samples/publish.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-my_service_reply(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_discovery_publish_status status,
- sw_opaque extra)
-{
- static sw_string
- status_text[] =
- {
- "Started",
- "Stopped",
- "Name Collision",
- "Invalid"
- };
-
- fprintf(stderr, "publish reply: %s\n", status_text[status]);
- return SW_OKAY;
-}
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_text_record text_record;
- sw_result result;
- sw_discovery_publish_id id;
- int i;
-
- if (sw_discovery_init(&discovery) != SW_OKAY)
- {
- fprintf(stderr, "sw_discovery_init() failed\n");
- return -1;
- }
-
- if (argc < 4)
- {
- fprintf(stderr, "usage: mDNSPublish <name> <type> <port> [service text 1]...[service text n]\n");
- return -1;
- }
-
- if (sw_text_record_init(&text_record) != SW_OKAY)
- {
- fprintf(stderr, "sw_text_record_init() failed\n");
- return -1;
- }
-
- for (i = 4; i < argc; i++)
- {
- if (sw_text_record_add_string(text_record, argv[i]) != SW_OKAY)
- {
- fprintf(stderr, "unable to add service text: %s\n", argv[i]);
- return -1;
- }
- }
-
- printf("%s %s %d\n", argv[1], argv[2], atoi(argv[3]));
-
- if ((result = sw_discovery_publish(discovery, 0, argv[1], argv[2], NULL, NULL, atoi(argv[3]), sw_text_record_bytes(text_record), sw_text_record_len(text_record), my_service_reply, NULL, &id)) != SW_OKAY)
- {
- fprintf(stderr, "publish failed: %d\n", result);
- sw_text_record_fina(text_record);
- return -1;
- }
-
- sw_text_record_fina(text_record);
-
- sw_discovery_run(discovery);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-compat-howl/samples/query.c b/release-0.6.9/avahi-compat-howl/samples/query.c
deleted file mode 100644
index a74a81c..0000000
--- a/release-0.6.9/avahi-compat-howl/samples/query.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <salt/debug.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-query_record_reply(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_query_record_status status,
- sw_uint32 interface_index,
- sw_const_string fullname,
- sw_uint16 rrtype,
- sw_uint16 rrclass,
- sw_uint16 rrdatalen,
- sw_const_octets rrdata,
- sw_uint32 ttl,
- sw_opaque extra)
-{
- sw_ipv4_address address;
-
- fprintf(stderr, "interface index = 0x%x, fullname is %s\n", interface_index, fullname);
-
- if ((rrtype == 1) && (rrclass == 1))
- {
- sw_ipv4_address address;
- sw_char name[16];
-
- sw_ipv4_address_init_from_saddr(&address, *(sw_saddr*) rrdata);
-
- fprintf(stderr, "address is %s\n", sw_ipv4_address_name(address, name, sizeof(name)));
- }
-
- return SW_OKAY;
-}
-
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_discovery_oid oid;
- sw_result err;
-
- err = sw_discovery_init(&discovery);
- sw_check_okay(err, exit);
-
- if (argc != 4)
- {
- fprintf(stderr, "usage: mDNSBrowse <name> <rrtype> <rrclass>\n");
- return -1;
- }
-
- err = sw_discovery_query_record(discovery, 0, 0, argv[1], atoi(argv[2]), atoi(argv[3]), query_record_reply, NULL, &oid);
- sw_check_okay(err, exit);
-
- err = sw_discovery_run(discovery);
- sw_check_okay(err, exit);
-
-exit:
-
- return err;
-}
diff --git a/release-0.6.9/avahi-compat-howl/samples/resolve.c b/release-0.6.9/avahi-compat-howl/samples/resolve.c
deleted file mode 100644
index b921c27..0000000
--- a/release-0.6.9/avahi-compat-howl/samples/resolve.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <salt/debug.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-my_resolver(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_opaque_t extra)
-{
- sw_text_record_iterator it;
- sw_int8 name_buf[16];
- sw_int8 key[SW_TEXT_RECORD_MAX_LEN];
- sw_int8 sval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint8 oval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint32 oval_len;
- sw_result err = SW_OKAY;
-
- sw_discovery_cancel(discovery, oid);
-
- fprintf(stderr, "resolve reply: 0x%x %s %s %s %s %d\n", interface_index, name, type, domain, sw_ipv4_address_name(address, name_buf, 16), port);
-
- if ((text_record_len > 0) && (text_record) && (*text_record != '\0'))
- {
- err = sw_text_record_iterator_init(&it, text_record, text_record_len);
- sw_check_okay(err, exit);
-
- while (sw_text_record_iterator_next(it, key, oval, &oval_len) == SW_OKAY)
- {
- fprintf(stderr, "key = %s, data is %d bytes\n", key, oval_len);
- }
-
- err = sw_text_record_iterator_fina(it);
- sw_check_okay(err, exit);
- }
-
-exit:
-
- return err;
-}
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_discovery_oid oid;
- sw_result err;
-
- err = sw_discovery_init(&discovery);
- sw_check_okay(err, exit);
-
- if (argc != 3)
- {
- fprintf(stderr, "usage: mDNSResolve <name> <type>\n");
- return -1;
- }
-
- err = sw_discovery_resolve(discovery, 0, argv[1], argv[2], "local.", my_resolver, NULL, &oid);
- sw_check_okay(err, exit);
-
- err = sw_discovery_run(discovery);
- sw_check_okay(err, exit);
-
-exit:
-
- return err;
-}
diff --git a/release-0.6.9/avahi-compat-howl/text-test.c b/release-0.6.9/avahi-compat-howl/text-test.c
deleted file mode 100644
index fea653c..0000000
--- a/release-0.6.9/avahi-compat-howl/text-test.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include "howl.h"
-
-#define ASSERT_SW_OKAY(t) { sw_result _r; _r = (t); assert(_r == SW_OKAY); }
-#define ASSERT_NOT_NULL(t) { const void* _r; r = (t); assert(_r); }
-
-static void hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %u bytes from %p:\n", size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- sw_text_record r;
- sw_text_record_iterator it;
- char key[255];
- uint8_t val[255];
- sw_ulong val_len;
-
- ASSERT_SW_OKAY(sw_text_record_init(&r));
- ASSERT_SW_OKAY(sw_text_record_add_string(r, "foo=bar"));
- ASSERT_SW_OKAY(sw_text_record_add_string(r, "waldo=baz"));
- ASSERT_SW_OKAY(sw_text_record_add_key_and_string_value(r, "quux", "nimpf"));
- ASSERT_SW_OKAY(sw_text_record_add_key_and_binary_value(r, "quux", "\0\0\0\0", 4));
-
- hexdump(sw_text_record_bytes(r), sw_text_record_len(r));
-
- ASSERT_SW_OKAY(sw_text_record_iterator_init(&it, sw_text_record_bytes(r), sw_text_record_len(r)));
-
- while (sw_text_record_iterator_next(it, key, val, &val_len) == SW_OKAY) {
- printf("key=%s\n", key);
- hexdump(val, val_len);
- }
-
- ASSERT_SW_OKAY(sw_text_record_iterator_fina(it));
-
-
-
-
- ASSERT_SW_OKAY(sw_text_record_fina(r));
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-compat-howl/text.c b/release-0.6.9/avahi-compat-howl/text.c
deleted file mode 100644
index 3b717be..0000000
--- a/release-0.6.9/avahi-compat-howl/text.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-
-#include "howl.h"
-#include "warn.h"
-
-struct _sw_text_record {
- AvahiStringList *strlst;
- uint8_t *buffer;
- size_t buffer_size;
- int buffer_valid;
-};
-
-#ifndef HAVE_STRLCPY
-
-static size_t strlcpy(char *dest, const char *src, size_t n) {
- assert(dest);
- assert(src);
-
- if (n > 0) {
- strncpy(dest, src, n-1);
- dest[n-1] = 0;
- }
-
- return strlen(src);
-}
-
-#endif
-
-sw_result sw_text_record_init(sw_text_record *self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(*self = avahi_new(struct _sw_text_record, 1))) {
- *self = NULL;
- return SW_E_UNKNOWN;
- }
-
- (*self)->strlst = NULL;
- (*self)->buffer = NULL;
- (*self)->buffer_size = 0;
- (*self)->buffer_valid = 0;
-
- return SW_OKAY;
-}
-
-sw_result sw_text_record_fina(sw_text_record self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- avahi_string_list_free(self->strlst);
- avahi_free(self->buffer);
- avahi_free(self);
- return SW_OKAY;
-}
-
-sw_result sw_text_record_add_string(
- sw_text_record self,
- sw_const_string string) {
-
- AvahiStringList *n;
-
- assert(self);
- assert(string);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(n = avahi_string_list_add(self->strlst, string)))
- return SW_E_UNKNOWN;
-
- self->strlst = n;
- self->buffer_valid = 0;
- return SW_OKAY;
-}
-
-sw_result sw_text_record_add_key_and_string_value(
- sw_text_record self,
- sw_const_string key,
- sw_const_string val) {
-
- AvahiStringList *n;
-
- assert(self);
- assert(key);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(n = avahi_string_list_add_pair(self->strlst, key, val)))
- return SW_E_UNKNOWN;
-
- self->strlst = n;
- self->buffer_valid = 0;
- return SW_OKAY;
-}
-
-sw_result sw_text_record_add_key_and_binary_value(
- sw_text_record self,
- sw_const_string key,
- sw_octets val,
- sw_uint32 len) {
-
- AvahiStringList *n;
-
- assert(self);
- assert(key);
- assert(len || !val);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(n = avahi_string_list_add_pair_arbitrary(self->strlst, key, val, len)))
- return SW_E_UNKNOWN;
-
- self->strlst = n;
- self->buffer_valid = 0;
- return SW_OKAY;
-}
-
-static int rebuild(sw_text_record self) {
- assert(self);
-
- if (self->buffer_valid)
- return 0;
-
- self->buffer_size = avahi_string_list_serialize(self->strlst, NULL, 0);
-
- if (!(self->buffer = avahi_realloc(self->buffer, self->buffer_size + 1)))
- return -1;
-
- avahi_string_list_serialize(self->strlst, self->buffer, self->buffer_size);
- self->buffer_valid = 1;
-
- return 0;
-}
-
-sw_octets sw_text_record_bytes(sw_text_record self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (rebuild(self) < 0)
- return NULL;
-
- return self->buffer;
-}
-
-sw_uint32 sw_text_record_len(sw_text_record self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (rebuild(self) < 0)
- return (uint32_t) -1;
-
- return self->buffer_size;
-}
-
-struct _sw_text_record_iterator {
- AvahiStringList *strlst, *index;
-
-};
-
-sw_result sw_text_record_iterator_init(
- sw_text_record_iterator * self,
- sw_octets text_record,
- sw_uint32 text_record_len) {
-
- AvahiStringList *txt;
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(*self = avahi_new(struct _sw_text_record_iterator, 1))) {
- *self = NULL;
- return SW_E_UNKNOWN;
- }
-
- if (avahi_string_list_parse(text_record, text_record_len, &txt) < 0) {
- avahi_free(*self);
- *self = NULL;
- return SW_E_UNKNOWN;
- }
-
- (*self)->index = (*self)->strlst = avahi_string_list_reverse(txt);
-
- return SW_OKAY;
-}
-
-sw_result sw_text_record_iterator_fina(sw_text_record_iterator self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- avahi_string_list_free(self->strlst);
- avahi_free(self);
-
- return SW_OKAY;
-}
-
-sw_result sw_text_record_iterator_next(
- sw_text_record_iterator self,
- char key[SW_TEXT_RECORD_MAX_LEN],
- sw_uint8 val[SW_TEXT_RECORD_MAX_LEN],
- sw_uint32 * val_len) {
-
- char *mkey = NULL, *mvalue = NULL;
- size_t msize = 0;
-
- assert(self);
- assert(key);
-
- AVAHI_WARN_LINKAGE;
-
- if (!self->index)
- return SW_E_UNKNOWN;
-
- if (avahi_string_list_get_pair(self->index, &mkey, &mvalue, &msize) < 0)
- return SW_E_UNKNOWN;
-
- strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN);
- memset(val, 0, SW_TEXT_RECORD_MAX_LEN);
- memcpy(val, mvalue, msize);
- *val_len = msize;
-
- avahi_free(mkey);
- avahi_free(mvalue);
-
- self->index = self->index->next;
-
- return SW_OKAY;
-}
-
diff --git a/release-0.6.9/avahi-compat-howl/unsupported.c b/release-0.6.9/avahi-compat-howl/unsupported.c
deleted file mode 100644
index 800b3c3..0000000
--- a/release-0.6.9/avahi-compat-howl/unsupported.c
+++ /dev/null
@@ -1,1021 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/gccmacro.h>
-
-#include "howl.h"
-#include "warn.h"
-
-AVAHI_GCC_NORETURN
-sw_string sw_strdup(AVAHI_GCC_UNUSED sw_const_string str) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_opaque _sw_debug_malloc(
- AVAHI_GCC_UNUSED sw_size_t size,
- AVAHI_GCC_UNUSED sw_const_string function,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_uint32 line) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_opaque _sw_debug_realloc(
- AVAHI_GCC_UNUSED sw_opaque_t mem,
- AVAHI_GCC_UNUSED sw_size_t size,
- AVAHI_GCC_UNUSED sw_const_string function,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_uint32 line) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-void _sw_debug_free(
- AVAHI_GCC_UNUSED sw_opaque_t mem,
- AVAHI_GCC_UNUSED sw_const_string function,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_uint32 line) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-AVAHI_GCC_NORETURN
-sw_const_string sw_strerror(/* howl sucks */) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_timer_init(AVAHI_GCC_UNUSED sw_timer * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_timer_fina(AVAHI_GCC_UNUSED sw_timer self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_time_init(AVAHI_GCC_UNUSED sw_time * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_time_init_now(AVAHI_GCC_UNUSED sw_time * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_time_fina(AVAHI_GCC_UNUSED sw_time self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_time sw_time_add(
- AVAHI_GCC_UNUSED sw_time self,
- AVAHI_GCC_UNUSED sw_time y) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_time sw_time_sub(
- AVAHI_GCC_UNUSED sw_time self,
- AVAHI_GCC_UNUSED sw_time y) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_int32 sw_time_cmp(
- AVAHI_GCC_UNUSED sw_time self,
- AVAHI_GCC_UNUSED sw_time y) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_salt_init(
- AVAHI_GCC_UNUSED sw_salt * self,
- AVAHI_GCC_UNUSED int argc,
- AVAHI_GCC_UNUSED char ** argv) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_fina(AVAHI_GCC_UNUSED sw_salt self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_register_socket(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_socket * _socket,
- AVAHI_GCC_UNUSED sw_socket_event events,
- AVAHI_GCC_UNUSED sw_socket_handler handler,
- AVAHI_GCC_UNUSED sw_socket_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_socket(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_socket * _socket) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-
-sw_result sw_salt_register_timer(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_timer * timer,
- AVAHI_GCC_UNUSED sw_time timeout,
- AVAHI_GCC_UNUSED sw_timer_handler handler,
- AVAHI_GCC_UNUSED sw_timer_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_timer(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_timer * timer) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_register_network_interface(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_network_interface * netif,
- AVAHI_GCC_UNUSED sw_network_interface_handler handler,
- AVAHI_GCC_UNUSED sw_network_interface_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_network_interface_handler(AVAHI_GCC_UNUSED sw_salt self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_register_signal(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_signal * _signal,
- AVAHI_GCC_UNUSED sw_signal_handler handler,
- AVAHI_GCC_UNUSED sw_signal_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
-
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_signal(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_signal * _signal) {
-
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-void sw_print_assert(
- AVAHI_GCC_UNUSED int code,
- AVAHI_GCC_UNUSED sw_const_string assert_string,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_const_string func,
- AVAHI_GCC_UNUSED int line) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-void sw_print_debug(
- AVAHI_GCC_UNUSED int level,
- AVAHI_GCC_UNUSED sw_const_string format,
- ...) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-sw_result sw_tcp_socket_init(AVAHI_GCC_UNUSED sw_socket * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_tcp_socket_init_with_desc(
- AVAHI_GCC_UNUSED sw_socket * self,
- AVAHI_GCC_UNUSED sw_sockdesc_t desc) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_udp_socket_init(AVAHI_GCC_UNUSED sw_socket * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_multicast_socket_init(AVAHI_GCC_UNUSED sw_socket * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_fina(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_bind(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_ipv4_address address,
- AVAHI_GCC_UNUSED sw_port port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_join_multicast_group(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_ipv4_address local_address,
- AVAHI_GCC_UNUSED sw_ipv4_address multicast_address,
- AVAHI_GCC_UNUSED sw_uint32 ttl) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_leave_multicast_group(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_listen(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED int qsize) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_connect(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_ipv4_address address,
- AVAHI_GCC_UNUSED sw_port port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_accept(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_socket * _socket) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_send(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t len,
- AVAHI_GCC_UNUSED sw_size_t * bytesWritten) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_sendto(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t len,
- AVAHI_GCC_UNUSED sw_size_t * bytesWritten,
- AVAHI_GCC_UNUSED sw_ipv4_address to,
- AVAHI_GCC_UNUSED sw_port port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_recv(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t max,
- AVAHI_GCC_UNUSED sw_size_t * len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_recvfrom(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t max,
- AVAHI_GCC_UNUSED sw_size_t * len,
- AVAHI_GCC_UNUSED sw_ipv4_address * from,
- AVAHI_GCC_UNUSED sw_port * port,
- AVAHI_GCC_UNUSED sw_ipv4_address * dest,
- AVAHI_GCC_UNUSED sw_uint32 * interface_index) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_set_blocking_mode(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_bool blocking_mode) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_set_options(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_socket_options options) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_ipv4_address sw_socket_ipv4_address(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_port sw_socket_port(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_sockdesc_t sw_socket_desc(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_socket_close(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_init(AVAHI_GCC_UNUSED sw_socket_options * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_fina(AVAHI_GCC_UNUSED sw_socket_options self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_debug(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_nodelay(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_dontroute(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_keepalive(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_linger(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool onoff,
- AVAHI_GCC_UNUSED sw_uint32 linger) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_reuseaddr(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_rcvbuf(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_uint32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_sndbuf(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_uint32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-int sw_socket_error_code(void) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_orb_init(
- AVAHI_GCC_UNUSED sw_corby_orb * self,
- AVAHI_GCC_UNUSED sw_salt salt,
- AVAHI_GCC_UNUSED const sw_corby_orb_config * config,
- AVAHI_GCC_UNUSED sw_corby_orb_observer observer,
- AVAHI_GCC_UNUSED sw_corby_orb_observer_func func,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_fina(AVAHI_GCC_UNUSED sw_corby_orb self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_register_servant(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_corby_servant servant,
- AVAHI_GCC_UNUSED sw_corby_servant_cb cb,
- AVAHI_GCC_UNUSED sw_const_string oid,
- AVAHI_GCC_UNUSED struct _sw_corby_object ** object,
- AVAHI_GCC_UNUSED sw_const_string protocol_name) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_unregister_servant(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_const_string oid) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_register_bidirectional_object(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_object * object) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_register_channel(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_channel * channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_corby_orb_delegate sw_corby_orb_get_delegate(AVAHI_GCC_UNUSED sw_corby_orb self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_orb_set_delegate(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_corby_orb_delegate delegate) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_set_observer(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_corby_orb_observer observer,
- AVAHI_GCC_UNUSED sw_corby_orb_observer_func func,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_protocol_to_address(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_const_string tag,
- AVAHI_GCC_UNUSED sw_string addr,
- AVAHI_GCC_UNUSED sw_port * port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_protocol_to_url(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_const_string tag,
- AVAHI_GCC_UNUSED sw_const_string name,
- AVAHI_GCC_UNUSED sw_string url,
- AVAHI_GCC_UNUSED sw_size_t url_len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_read_channel(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_channel * channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_dispatch_message(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_channel * channel,
- AVAHI_GCC_UNUSED struct _sw_corby_message * message,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer * buffer,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_message_init(AVAHI_GCC_UNUSED sw_corby_message * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_message_fina(AVAHI_GCC_UNUSED sw_corby_message self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init(AVAHI_GCC_UNUSED sw_corby_buffer * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init_with_size(
- AVAHI_GCC_UNUSED sw_corby_buffer * self,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init_with_delegate(
- AVAHI_GCC_UNUSED sw_corby_buffer * self,
- AVAHI_GCC_UNUSED sw_corby_buffer_delegate delegate,
- AVAHI_GCC_UNUSED sw_corby_buffer_overflow_func overflow,
- AVAHI_GCC_UNUSED sw_corby_buffer_underflow_func underflow,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init_with_size_and_delegate(
- AVAHI_GCC_UNUSED sw_corby_buffer * self,
- AVAHI_GCC_UNUSED sw_size_t size,
- AVAHI_GCC_UNUSED sw_corby_buffer_delegate delegate,
- AVAHI_GCC_UNUSED sw_corby_buffer_overflow_func overflow,
- AVAHI_GCC_UNUSED sw_corby_buffer_underflow_func underflow,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_fina(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-void sw_corby_buffer_reset(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-sw_result sw_corby_buffer_set_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets octets,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_octets sw_corby_buffer_octets(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return NULL;
-}
-
-sw_size_t sw_corby_buffer_bytes_used(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return 0;
-}
-
-sw_size_t sw_corby_buffer_size(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return 0;
-}
-
-sw_result sw_corby_buffer_put_int8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int8 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_uint8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint8 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_int16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int16 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_uint16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint16 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_int32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_uint32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_const_octets val,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_const_octets val,
- AVAHI_GCC_UNUSED sw_uint32 len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_const_string val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_object(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED const struct _sw_corby_object * object) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_pad(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_corby_buffer_pad pad) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_int8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int8 * val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_uint8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint8 * val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_int16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int16 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_uint16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint16 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_int32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int32 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_uint32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint32 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets octets,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_allocate_and_get_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets * val,
- AVAHI_GCC_UNUSED sw_uint32 * size,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_zerocopy_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets * val,
- AVAHI_GCC_UNUSED sw_uint32 * size,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_allocate_and_get_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_string * val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_zerocopy_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_string * val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_string val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_object(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED struct _sw_corby_object ** object,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_start_request(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_const_corby_profile profile,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer ** buffer,
- AVAHI_GCC_UNUSED sw_const_string op,
- AVAHI_GCC_UNUSED sw_uint32 oplen,
- AVAHI_GCC_UNUSED sw_bool reply_expected) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_start_reply(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer ** buffer,
- AVAHI_GCC_UNUSED sw_uint32 request_id,
- AVAHI_GCC_UNUSED sw_corby_reply_status status) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_send(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer * buffer,
- AVAHI_GCC_UNUSED sw_corby_buffer_observer observer,
- AVAHI_GCC_UNUSED sw_corby_buffer_written_func func,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_recv(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_salt * salt,
- AVAHI_GCC_UNUSED struct _sw_corby_message ** message,
- AVAHI_GCC_UNUSED sw_uint32 * request_id,
- AVAHI_GCC_UNUSED sw_string * op,
- AVAHI_GCC_UNUSED sw_uint32 * op_len,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer ** buffer,
- AVAHI_GCC_UNUSED sw_uint8 * endian,
- AVAHI_GCC_UNUSED sw_bool block) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_last_recv_from(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_ipv4_address * from,
- AVAHI_GCC_UNUSED sw_port * from_port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_ff(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer * buffer) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_socket sw_corby_channel_socket(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_channel_retain(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_set_delegate(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_corby_channel_delegate delegate) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_corby_channel_delegate sw_corby_channel_get_delegate(
- AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-void sw_corby_channel_set_app_data(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_opaque app_data) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-AVAHI_GCC_NORETURN
-sw_opaque sw_corby_channel_get_app_data(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_channel_fina(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_init_from_url(
- AVAHI_GCC_UNUSED sw_corby_object * self,
- AVAHI_GCC_UNUSED struct _sw_corby_orb * orb,
- AVAHI_GCC_UNUSED sw_const_string url,
- AVAHI_GCC_UNUSED sw_socket_options options,
- AVAHI_GCC_UNUSED sw_uint32 bufsize) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_fina(
- AVAHI_GCC_UNUSED sw_corby_object self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_start_request(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_const_string op,
- AVAHI_GCC_UNUSED sw_uint32 op_len,
- AVAHI_GCC_UNUSED sw_bool reply_expected,
- AVAHI_GCC_UNUSED sw_corby_buffer * buffer) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_send(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_buffer buffer,
- AVAHI_GCC_UNUSED sw_corby_buffer_observer observer,
- AVAHI_GCC_UNUSED sw_corby_buffer_written_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_recv(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_message * message,
- AVAHI_GCC_UNUSED sw_corby_buffer * buffer,
- AVAHI_GCC_UNUSED sw_uint8 * endian,
- AVAHI_GCC_UNUSED sw_bool block) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_channel(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_channel * channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_set_channel(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_channel channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_publish_host(
- AVAHI_GCC_UNUSED sw_discovery self,
- AVAHI_GCC_UNUSED sw_uint32 interface_index,
- AVAHI_GCC_UNUSED sw_const_string name,
- AVAHI_GCC_UNUSED sw_const_string domain,
- AVAHI_GCC_UNUSED sw_ipv4_address address,
- AVAHI_GCC_UNUSED sw_discovery_publish_reply reply,
- AVAHI_GCC_UNUSED sw_opaque extra,
- AVAHI_GCC_UNUSED sw_discovery_oid * oid) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_publish_update(
- AVAHI_GCC_UNUSED sw_discovery self,
- AVAHI_GCC_UNUSED sw_discovery_oid oid,
- AVAHI_GCC_UNUSED sw_octets text_record,
- AVAHI_GCC_UNUSED sw_uint32 text_record_len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_query_record(
- AVAHI_GCC_UNUSED sw_discovery self,
- AVAHI_GCC_UNUSED sw_uint32 interface_index,
- AVAHI_GCC_UNUSED sw_uint32 flags,
- AVAHI_GCC_UNUSED sw_const_string fullname,
- AVAHI_GCC_UNUSED sw_uint16 rrtype,
- AVAHI_GCC_UNUSED sw_uint16 rrclass,
- AVAHI_GCC_UNUSED sw_discovery_query_record_reply reply,
- AVAHI_GCC_UNUSED sw_opaque extra,
- AVAHI_GCC_UNUSED sw_discovery_oid * oid) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_text_record_string_iterator_init(
- AVAHI_GCC_UNUSED sw_text_record_string_iterator * self,
- AVAHI_GCC_UNUSED sw_const_string text_record_string) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_text_record_string_iterator_fina(
- AVAHI_GCC_UNUSED sw_text_record_string_iterator self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_text_record_string_iterator_next(
- AVAHI_GCC_UNUSED sw_text_record_string_iterator self,
- AVAHI_GCC_UNUSED char key[255],
- AVAHI_GCC_UNUSED char val[255]) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
diff --git a/release-0.6.9/avahi-compat-howl/warn.c b/release-0.6.9/avahi-compat-howl/warn.c
deleted file mode 100644
index 4bff7ee..0000000
--- a/release-0.6.9/avahi-compat-howl/warn.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "warn.h"
-
-#define COMPAT_LAYER "HOWL"
-#define CGI_SUBSYSTEM "howl"
-
-#include "../avahi-compat-libdns_sd/warn.c"
diff --git a/release-0.6.9/avahi-compat-howl/warn.h b/release-0.6.9/avahi-compat-howl/warn.h
deleted file mode 100644
index 785dba4..0000000
--- a/release-0.6.9/avahi-compat-howl/warn.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef foowarnhhowlfoo
-#define foowarnhhowlfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/* To avoid symbol name clashes when a process links to both our
- * compatiblity layers, we move the symbols out of the way here */
-
-#define avahi_warn_unsupported avahi_warn_unsupported_HOWL
-#define avahi_warn_linkage avahi_warn_linkage_HOWL
-#define avahi_warn avahi_warn_HOWL
-#define avahi_exe_name avahi_exe_name_HOWL
-
-#include "../avahi-compat-libdns_sd/warn.h"
-
-#endif
diff --git a/release-0.6.9/avahi-compat-libdns_sd.pc.in b/release-0.6.9/avahi-compat-libdns_sd.pc.in
deleted file mode 100644
index d619632..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include/avahi-compat-libdns_sd/
-
-Name: avahi-compat-libdns_sd
-Description: Avahi Multicast DNS Responder (libdns_sd Compatibility)
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -ldns_sd
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/release-0.6.9/avahi-compat-libdns_sd/Makefile.am b/release-0.6.9/avahi-compat-libdns_sd/Makefile.am
deleted file mode 100644
index fc1421b..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/Makefile.am
+++ /dev/null
@@ -1,67 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-if ENABLE_COMPAT_LIBDNS_SD
-
-avahi_compat_libdns_sddir=$(includedir)/avahi-compat-libdns_sd
-
-avahi_compat_libdns_sd_HEADERS = dns_sd.h
-
-lib_LTLIBRARIES = libdns_sd.la
-
-if ENABLE_TESTS
-noinst_PROGRAMS = txt-test
-endif
-
-libdns_sd_la_SOURCES = \
- dns_sd.h \
- compat.c \
- txt.c \
- unsupported.c \
- warn.c warn.h
-libdns_sd_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-libdns_sd_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la
-
-txt_test_SOURCES = \
- dns_sd.h \
- txt.c \
- txt-test.c \
- warn.c warn.h
-txt_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-txt_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la
-
-# You can test the compatibility layer by sticking in mDNSResponder's
-# dns-sd.c source here, naming it "libdns_sd-test.c" and running "make
-# libdns_sd-test" manually. We do not distribute that file due to
-# licensing restrictions.
-
-libdns_sd-test: libdns_sd-test.c libdns_sd.la
- $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test.o -c libdns_sd-test.c
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test libdns_sd-test.o $(PTHREAD_LIBS) ../avahi-common/libavahi-common.la libdns_sd.la
-
-CLEANFILES = libdns_sd-test.o libdns_sd-test
-
-endif
-endif
diff --git a/release-0.6.9/avahi-compat-libdns_sd/compat.c b/release-0.6.9/avahi-compat-libdns_sd/compat.c
deleted file mode 100644
index 052c8b2..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/compat.c
+++ /dev/null
@@ -1,1078 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <assert.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include <fcntl.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/alternative.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-#include <avahi-client/lookup.h>
-
-#include "warn.h"
-#include "dns_sd.h"
-
-enum {
- COMMAND_POLL = 'p',
- COMMAND_QUIT = 'q',
- COMMAND_POLL_DONE = 'P',
- COMMAND_POLL_FAILED = 'F'
-};
-
-struct _DNSServiceRef_t {
- int n_ref;
-
- AvahiSimplePoll *simple_poll;
-
- int thread_fd, main_fd;
-
- pthread_t thread;
- int thread_running;
-
- pthread_mutex_t mutex;
-
- void *context;
- DNSServiceBrowseReply service_browser_callback;
- DNSServiceResolveReply service_resolver_callback;
- DNSServiceDomainEnumReply domain_browser_callback;
- DNSServiceRegisterReply service_register_callback;
-
- AvahiClient *client;
- AvahiServiceBrowser *service_browser;
- AvahiServiceResolver *service_resolver;
- AvahiDomainBrowser *domain_browser;
-
- char *service_name, *service_name_chosen, *service_regtype, *service_domain, *service_host;
- uint16_t service_port;
- AvahiIfIndex service_interface;
- AvahiStringList *service_txt;
-
- AvahiEntryGroup *entry_group;
-};
-
-#define ASSERT_SUCCESS(r) { int __ret = (r); assert(__ret == 0); }
-
-static DNSServiceErrorType map_error(int error) {
- switch (error) {
- case AVAHI_OK :
- return kDNSServiceErr_NoError;
-
- case AVAHI_ERR_BAD_STATE :
- return kDNSServiceErr_BadState;
-
- case AVAHI_ERR_INVALID_HOST_NAME:
- case AVAHI_ERR_INVALID_DOMAIN_NAME:
- case AVAHI_ERR_INVALID_TTL:
- case AVAHI_ERR_IS_PATTERN:
- case AVAHI_ERR_INVALID_RECORD:
- case AVAHI_ERR_INVALID_SERVICE_NAME:
- case AVAHI_ERR_INVALID_SERVICE_TYPE:
- case AVAHI_ERR_INVALID_PORT:
- case AVAHI_ERR_INVALID_KEY:
- case AVAHI_ERR_INVALID_ADDRESS:
- case AVAHI_ERR_INVALID_SERVICE_SUBTYPE:
- return kDNSServiceErr_BadParam;
-
-
- case AVAHI_ERR_COLLISION:
- return kDNSServiceErr_NameConflict;
-
- case AVAHI_ERR_TOO_MANY_CLIENTS:
- case AVAHI_ERR_TOO_MANY_OBJECTS:
- case AVAHI_ERR_TOO_MANY_ENTRIES:
- case AVAHI_ERR_ACCESS_DENIED:
- return kDNSServiceErr_Refused;
-
- case AVAHI_ERR_INVALID_OPERATION:
- case AVAHI_ERR_INVALID_OBJECT:
- return kDNSServiceErr_Invalid;
-
- case AVAHI_ERR_NO_MEMORY:
- return kDNSServiceErr_NoMemory;
-
- case AVAHI_ERR_INVALID_INTERFACE:
- case AVAHI_ERR_INVALID_PROTOCOL:
- return kDNSServiceErr_BadInterfaceIndex;
-
- case AVAHI_ERR_INVALID_FLAGS:
- return kDNSServiceErr_BadFlags;
-
- case AVAHI_ERR_NOT_FOUND:
- return kDNSServiceErr_NoSuchName;
-
- case AVAHI_ERR_VERSION_MISMATCH:
- return kDNSServiceErr_Incompatible;
-
- case AVAHI_ERR_NO_NETWORK:
- case AVAHI_ERR_OS:
- case AVAHI_ERR_INVALID_CONFIG:
- case AVAHI_ERR_TIMEOUT:
- case AVAHI_ERR_DBUS_ERROR:
- case AVAHI_ERR_DISCONNECTED:
- case AVAHI_ERR_NO_DAEMON:
- break;
-
- }
-
- return kDNSServiceErr_Unknown;
-}
-
-static const char *add_trailing_dot(const char *s, char *buf, size_t buf_len) {
- if (!s)
- return NULL;
-
- if (*s == 0)
- return s;
-
- if (s[strlen(s)-1] == '.')
- return s;
-
- snprintf(buf, buf_len, "%s.", s);
- return buf;
-}
-
-static int read_command(int fd) {
- ssize_t r;
- char command;
-
- assert(fd >= 0);
-
- if ((r = read(fd, &command, 1)) != 1) {
- fprintf(stderr, __FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- return -1;
- }
-
- return command;
-}
-
-static int write_command(int fd, char reply) {
- assert(fd >= 0);
-
- if (write(fd, &reply, 1) != 1) {
- fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int poll_func(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
- DNSServiceRef sdref = userdata;
- int ret;
-
- assert(sdref);
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
-/* fprintf(stderr, "pre-syscall\n"); */
- ret = poll(ufds, nfds, timeout);
-/* fprintf(stderr, "post-syscall\n"); */
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- return ret;
-}
-
-static void * thread_func(void *data) {
- DNSServiceRef sdref = data;
- sigset_t mask;
-
- sigfillset(&mask);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
- sdref->thread = pthread_self();
- sdref->thread_running = 1;
-
- for (;;) {
- char command;
-
- if ((command = read_command(sdref->thread_fd)) < 0)
- break;
-
-/* fprintf(stderr, "Command: %c\n", command); */
-
- switch (command) {
-
- case COMMAND_POLL: {
- int ret;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- for (;;) {
- errno = 0;
-
- if ((ret = avahi_simple_poll_run(sdref->simple_poll)) < 0) {
-
- if (errno == EINTR)
- continue;
-
- fprintf(stderr, __FILE__": avahi_simple_poll_run() failed: %s\n", strerror(errno));
- }
-
- break;
- }
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (write_command(sdref->thread_fd, ret < 0 ? COMMAND_POLL_FAILED : COMMAND_POLL_DONE) < 0)
- break;
-
- break;
- }
-
- case COMMAND_QUIT:
- return NULL;
- }
-
- }
-
- return NULL;
-}
-
-static DNSServiceRef sdref_new(void) {
- int fd[2] = { -1, -1 };
- DNSServiceRef sdref = NULL;
- pthread_mutexattr_t mutex_attr;
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0)
- goto fail;
-
- if (!(sdref = avahi_new(struct _DNSServiceRef_t, 1)))
- goto fail;
-
- sdref->n_ref = 1;
- sdref->thread_fd = fd[0];
- sdref->main_fd = fd[1];
-
- sdref->client = NULL;
- sdref->service_browser = NULL;
- sdref->service_resolver = NULL;
- sdref->domain_browser = NULL;
- sdref->entry_group = NULL;
-
- sdref->service_name = sdref->service_name_chosen = sdref->service_regtype = sdref->service_domain = sdref->service_host = NULL;
- sdref->service_txt = NULL;
-
- ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
- pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
- ASSERT_SUCCESS(pthread_mutex_init(&sdref->mutex, &mutex_attr));
-
- sdref->thread_running = 0;
-
- if (!(sdref->simple_poll = avahi_simple_poll_new()))
- goto fail;
-
- avahi_simple_poll_set_func(sdref->simple_poll, poll_func, sdref);
-
- /* Start simple poll */
- if (avahi_simple_poll_prepare(sdref->simple_poll, -1) < 0)
- goto fail;
-
- /* Queue an initial POLL command for the thread */
- if (write_command(sdref->main_fd, COMMAND_POLL) < 0)
- goto fail;
-
- if (pthread_create(&sdref->thread, NULL, thread_func, sdref) != 0)
- goto fail;
-
- sdref->thread_running = 1;
-
- return sdref;
-
-fail:
-
- if (sdref)
- DNSServiceRefDeallocate(sdref);
-
- return NULL;
-}
-
-static void sdref_free(DNSServiceRef sdref) {
- assert(sdref);
-
- if (sdref->thread_running) {
- ASSERT_SUCCESS(write_command(sdref->main_fd, COMMAND_QUIT));
- avahi_simple_poll_wakeup(sdref->simple_poll);
- ASSERT_SUCCESS(pthread_join(sdref->thread, NULL));
- }
-
- if (sdref->client)
- avahi_client_free(sdref->client);
-
- if (sdref->simple_poll)
- avahi_simple_poll_free(sdref->simple_poll);
-
- if (sdref->thread_fd >= 0)
- close(sdref->thread_fd);
-
- if (sdref->main_fd >= 0)
- close(sdref->main_fd);
-
- ASSERT_SUCCESS(pthread_mutex_destroy(&sdref->mutex));
-
- avahi_free(sdref->service_name);
- avahi_free(sdref->service_name_chosen);
- avahi_free(sdref->service_regtype);
- avahi_free(sdref->service_domain);
- avahi_free(sdref->service_host);
-
- avahi_string_list_free(sdref->service_txt);
-
- avahi_free(sdref);
-}
-
-static void sdref_ref(DNSServiceRef sdref) {
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- sdref->n_ref++;
-}
-
-static void sdref_unref(DNSServiceRef sdref) {
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- if (--(sdref->n_ref) <= 0)
- sdref_free(sdref);
-}
-
-int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdref) {
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- AVAHI_WARN_LINKAGE;
-
- return sdref->main_fd;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) {
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
-
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- AVAHI_WARN_LINKAGE;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- sdref_ref(sdref);
-
- /* Cleanup notification socket */
- if (read_command(sdref->main_fd) != COMMAND_POLL_DONE)
- goto finish;
-
- if (avahi_simple_poll_dispatch(sdref->simple_poll) < 0)
- goto finish;
-
- if (sdref->n_ref > 1) /* Perhaps we should die */
-
- /* Dispatch events */
- if (avahi_simple_poll_prepare(sdref->simple_poll, -1) < 0)
- goto finish;
-
- if (sdref->n_ref > 1)
-
- /* Request the poll */
- if (write_command(sdref->main_fd, COMMAND_POLL) < 0)
- goto finish;
-
- ret = kDNSServiceErr_NoError;
-
-finish:
-
- sdref_unref(sdref);
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- return ret;
-}
-
-void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdref) {
- AVAHI_WARN_LINKAGE;
-
- if (sdref)
- sdref_unref(sdref);
-}
-
-static void service_browser_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- DNSServiceRef sdref = userdata;
- char type_fixed[AVAHI_DOMAIN_NAME_MAX], domain_fixed[AVAHI_DOMAIN_NAME_MAX];
- assert(b);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- type = add_trailing_dot(type, type_fixed, sizeof(type_fixed));
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- sdref->service_browser_callback(sdref, kDNSServiceFlagsAdd, interface, kDNSServiceErr_NoError, name, type, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- sdref->service_browser_callback(sdref, 0, interface, kDNSServiceErr_NoError, name, type, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- sdref->service_browser_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), NULL, NULL, NULL, sdref->context);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-static void generic_client_callback(AvahiClient *s, AvahiClientState state, void* userdata) {
- DNSServiceRef sdref = userdata;
- int error = kDNSServiceErr_Unknown;
-
- assert(s);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- switch (state) {
-
- case AVAHI_CLIENT_FAILURE:
-
- if (sdref->service_browser_callback)
- sdref->service_browser_callback(sdref, 0, 0, error, NULL, NULL, NULL, sdref->context);
- else if (sdref->service_resolver_callback)
- sdref->service_resolver_callback(sdref, 0, 0, error, NULL, NULL, 0, 0, NULL, sdref->context);
- else if (sdref->domain_browser_callback)
- sdref->domain_browser_callback(sdref, 0, 0, error, NULL, sdref->context);
-
- break;
-
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_S_REGISTERING:
- case AVAHI_CLIENT_CONNECTING:
- break;
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceBrowse(
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *regtype,
- const char *domain,
- DNSServiceBrowseReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiIfIndex ifindex;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(regtype);
- assert(callback);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (!(sdref = sdref_new()))
- return kDNSServiceErr_Unknown;
-
- sdref->context = context;
- sdref->service_browser_callback = callback;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- ifindex = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
-
- if (!(sdref->service_browser = avahi_service_browser_new(sdref->client, ifindex, AVAHI_PROTO_UNSPEC, regtype, domain, 0, service_browser_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- return ret;
-}
-
-static void service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- AVAHI_GCC_UNUSED const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- DNSServiceRef sdref = userdata;
-
- assert(r);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
-
- char host_name_fixed[AVAHI_DOMAIN_NAME_MAX];
- char full_name[AVAHI_DOMAIN_NAME_MAX];
- int ret;
- char *p = NULL;
- size_t l = 0;
-
- host_name = add_trailing_dot(host_name, host_name_fixed, sizeof(host_name_fixed));
-
- if ((p = avahi_new0(char, (l = avahi_string_list_serialize(txt, NULL, 0))+1)))
- avahi_string_list_serialize(txt, p, l);
-
- ret = avahi_service_name_join(full_name, sizeof(full_name), name, type, domain);
- assert(ret == AVAHI_OK);
-
- strcat(full_name, ".");
-
- sdref->service_resolver_callback(sdref, 0, interface, kDNSServiceErr_NoError, full_name, host_name, htons(port), l, p, sdref->context);
-
- avahi_free(p);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
- sdref->service_resolver_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), NULL, NULL, 0, 0, NULL, sdref->context);
- break;
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceResolve(
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *name,
- const char *regtype,
- const char *domain,
- DNSServiceResolveReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiIfIndex ifindex;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(name);
- assert(regtype);
- assert(domain);
- assert(callback);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (!(sdref = sdref_new()))
- return kDNSServiceErr_Unknown;
-
- sdref->context = context;
- sdref->service_resolver_callback = callback;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- ifindex = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
-
- if (!(sdref->service_resolver = avahi_service_resolver_new(sdref->client, ifindex, AVAHI_PROTO_UNSPEC, name, regtype, domain, AVAHI_PROTO_UNSPEC, 0, service_resolver_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- return ret;
-}
-
-int DNSSD_API DNSServiceConstructFullName (
- char *fullName,
- const char *service,
- const char *regtype,
- const char *domain) {
-
- AVAHI_WARN_LINKAGE;
-
- assert(fullName);
- assert(regtype);
- assert(domain);
-
- if (avahi_service_name_join(fullName, kDNSServiceMaxDomainName, service, regtype, domain) < 0)
- return -1;
-
- return 0;
-}
-
-static void domain_browser_callback(
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- DNSServiceRef sdref = userdata;
- static char domain_fixed[AVAHI_DOMAIN_NAME_MAX];
-
- assert(b);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- sdref->domain_browser_callback(sdref, kDNSServiceFlagsAdd, interface, kDNSServiceErr_NoError, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- sdref->domain_browser_callback(sdref, 0, interface, kDNSServiceErr_NoError, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- sdref->domain_browser_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains(
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- DNSServiceDomainEnumReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiIfIndex ifindex;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(callback);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly ||
- (flags != kDNSServiceFlagsBrowseDomains && flags != kDNSServiceFlagsRegistrationDomains)) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (!(sdref = sdref_new()))
- return kDNSServiceErr_Unknown;
-
- sdref->context = context;
- sdref->domain_browser_callback = callback;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- ifindex = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
-
- if (!(sdref->domain_browser = avahi_domain_browser_new(sdref->client, ifindex, AVAHI_PROTO_UNSPEC, "local",
- flags == kDNSServiceFlagsRegistrationDomains ? AVAHI_DOMAIN_BROWSER_REGISTER : AVAHI_DOMAIN_BROWSER_BROWSE,
- 0, domain_browser_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- return ret;
-}
-
-static void reg_report_error(DNSServiceRef sdref, DNSServiceErrorType error) {
- char regtype_fixed[AVAHI_DOMAIN_NAME_MAX], domain_fixed[AVAHI_DOMAIN_NAME_MAX];
- const char *regtype, *domain;
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- assert(sdref->service_register_callback);
-
- regtype = add_trailing_dot(sdref->service_regtype, regtype_fixed, sizeof(regtype_fixed));
- domain = add_trailing_dot(sdref->service_domain, domain_fixed, sizeof(domain_fixed));
-
- sdref->service_register_callback(
- sdref, 0, error,
- sdref->service_name_chosen ? sdref->service_name_chosen : sdref->service_name,
- regtype,
- domain,
- sdref->context);
-}
-
-static int reg_create_service(DNSServiceRef sdref) {
- int ret;
- const char *real_type;
-
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- real_type = avahi_get_type_from_subtype(sdref->service_regtype);
-
- if ((ret = avahi_entry_group_add_service_strlst(
- sdref->entry_group,
- sdref->service_interface,
- AVAHI_PROTO_UNSPEC,
- 0,
- sdref->service_name_chosen,
- real_type ? real_type : sdref->service_regtype,
- sdref->service_domain,
- sdref->service_host,
- sdref->service_port,
- sdref->service_txt)) < 0)
- return ret;
-
-
- if (real_type) {
- /* Create a subtype entry */
-
- if (avahi_entry_group_add_service_subtype(
- sdref->entry_group,
- sdref->service_interface,
- AVAHI_PROTO_UNSPEC,
- 0,
- sdref->service_name_chosen,
- real_type,
- sdref->service_domain,
- sdref->service_regtype) < 0)
- return ret;
-
- }
-
- if ((ret = avahi_entry_group_commit(sdref->entry_group)) < 0)
- return ret;
-
- return 0;
-}
-
-static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* userdata) {
- DNSServiceRef sdref = userdata;
-
- assert(s);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- /* We've not been setup completely */
- if (!sdref->entry_group)
- return;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
- reg_report_error(sdref, kDNSServiceErr_Unknown);
- break;
-
- case AVAHI_CLIENT_S_RUNNING: {
- int ret;
-
- if (!sdref->service_name) {
- const char *n;
- /* If the service name is taken from the host name, copy that */
-
- avahi_free(sdref->service_name_chosen);
- sdref->service_name_chosen = NULL;
-
- if (!(n = avahi_client_get_host_name(sdref->client))) {
- reg_report_error(sdref, map_error(avahi_client_errno(sdref->client)));
- return;
- }
-
- if (!(sdref->service_name_chosen = avahi_strdup(n))) {
- reg_report_error(sdref, kDNSServiceErr_NoMemory);
- return;
- }
- }
-
- /* Register the service */
-
- if ((ret = reg_create_service(sdref)) < 0) {
- reg_report_error(sdref, map_error(ret));
- return;
- }
-
- break;
- }
-
- case AVAHI_CLIENT_S_COLLISION:
-
- /* Remove our entry */
- avahi_entry_group_reset(sdref->entry_group);
-
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- case AVAHI_CLIENT_S_REGISTERING:
- /* Ignore */
- break;
- }
-
-}
-
-static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- DNSServiceRef sdref = userdata;
-
- assert(g);
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
- /* Inform the user */
- reg_report_error(sdref, kDNSServiceErr_NoError);
-
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
- int ret;
-
- /* Remove our entry */
- avahi_entry_group_reset(sdref->entry_group);
-
- assert(sdref->service_name_chosen);
-
- /* Pick a new name */
- if (!(n = avahi_alternative_service_name(sdref->service_name_chosen))) {
- reg_report_error(sdref, kDNSServiceErr_NoMemory);
- return;
- }
- avahi_free(sdref->service_name_chosen);
- sdref->service_name_chosen = n;
-
- /* Register the service with that new name */
- if ((ret = reg_create_service(sdref)) < 0) {
- reg_report_error(sdref, map_error(ret));
- return;
- }
-
- break;
- }
-
- case AVAHI_ENTRY_GROUP_REGISTERING:
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- /* Ignore */
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- /* Inform the user */
- reg_report_error(sdref, map_error(avahi_client_errno(sdref->client)));
- break;
-
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceRegister (
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *name,
- const char *regtype,
- const char *domain,
- const char *host,
- uint16_t port,
- uint16_t txtLen,
- const void *txtRecord,
- DNSServiceRegisterReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiStringList *txt = NULL;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(callback);
- assert(regtype);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly || flags) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (txtRecord && txtLen > 0)
- if (avahi_string_list_parse(txtRecord, txtLen, &txt) < 0)
- return kDNSServiceErr_Invalid;
-
- if (!(sdref = sdref_new())) {
- avahi_string_list_free(txt);
- return kDNSServiceErr_Unknown;
- }
-
- sdref->context = context;
- sdref->service_register_callback = callback;
-
- sdref->service_name = avahi_strdup(name);
- sdref->service_regtype = regtype ? avahi_normalize_name_strdup(regtype) : NULL;
- sdref->service_domain = domain ? avahi_normalize_name_strdup(domain) : NULL;
- sdref->service_host = host ? avahi_normalize_name_strdup(host) : NULL;
- sdref->service_interface = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
- sdref->service_port = ntohs(port);
- sdref->service_txt = txt;
-
- /* Some OOM checking would be cool here */
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, reg_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- if (!sdref->service_domain) {
- const char *d;
-
- if (!(d = avahi_client_get_domain_name(sdref->client))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- if (!(sdref->service_domain = avahi_strdup(d))) {
- ret = kDNSServiceErr_NoMemory;
- goto finish;
- }
- }
-
- if (!(sdref->entry_group = avahi_entry_group_new(sdref->client, reg_entry_group_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- if (avahi_client_get_state(sdref->client) == AVAHI_CLIENT_S_RUNNING) {
- const char *n;
-
- if (sdref->service_name)
- n = sdref->service_name;
- else {
- if (!(n = avahi_client_get_host_name(sdref->client))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
- }
-
- if (!(sdref->service_name_chosen = avahi_strdup(n))) {
- ret = kDNSServiceErr_NoMemory;
- goto finish;
- }
-
-
- if ((error = reg_create_service(sdref)) < 0) {
- ret = map_error(error);
- goto finish;
- }
- }
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- return ret;
-}
-
diff --git a/release-0.6.9/avahi-compat-libdns_sd/dns_sd.h b/release-0.6.9/avahi-compat-libdns_sd/dns_sd.h
deleted file mode 100644
index 0d8a583..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/dns_sd.h
+++ /dev/null
@@ -1,1670 +0,0 @@
-/*
- * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _DNS_SD_H
-#define _DNS_SD_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* standard calling convention under Win32 is __stdcall */
-#if defined(_WIN32)
-#define DNSSD_API __stdcall
-#else
-#define DNSSD_API
-#endif
-
-#if defined(__FreeBSD_version) && (__FreeBSD_version < 500000) || defined(__OpenBSD__)
-/* stdint.h does not exist on FreeBSD 4.x; its types are defined in sys/types.h instead */
-#include <sys/types.h>
-#elif defined(__sun__)
-#include <sys/types.h>
-#elif defined(_WIN32)
-#include <windows.h>
-#define _UNUSED
-#define bzero(a, b) memset(a, 0, b)
-#ifndef _MSL_STDINT_H
-typedef UINT8 uint8_t;
-typedef INT8 int8_t;
-typedef UINT16 uint16_t;
-typedef INT16 int16_t;
-typedef UINT32 uint32_t;
-typedef INT32 int32_t;
-#endif
-#else
-#include <stdint.h>
-#endif
-
-/* DNSServiceRef, DNSRecordRef
- *
- * Opaque internal data types.
- * Note: client is responsible for serializing access to these structures if
- * they are shared between concurrent threads.
- */
-
-typedef struct _DNSServiceRef_t *DNSServiceRef;
-typedef struct _DNSRecordRef_t *DNSRecordRef;
-
-/* General flags used in functions defined below */
-enum
- {
- kDNSServiceFlagsMoreComing = 0x1,
- /* MoreComing indicates to a callback that at least one more result is
- * queued and will be delivered following immediately after this one.
- * Applications should not update their UI to display browse
- * results when the MoreComing flag is set, because this would
- * result in a great deal of ugly flickering on the screen.
- * Applications should instead wait until until MoreComing is not set,
- * and then update their UI.
- * When MoreComing is not set, that doesn't mean there will be no more
- * answers EVER, just that there are no more answers immediately
- * available right now at this instant. If more answers become available
- * in the future they will be delivered as usual.
- */
-
- kDNSServiceFlagsAdd = 0x2,
- kDNSServiceFlagsDefault = 0x4,
- /* Flags for domain enumeration and browse/query reply callbacks.
- * "Default" applies only to enumeration and is only valid in
- * conjuction with "Add". An enumeration callback with the "Add"
- * flag NOT set indicates a "Remove", i.e. the domain is no longer
- * valid.
- */
-
- kDNSServiceFlagsNoAutoRename = 0x8,
- /* Flag for specifying renaming behavior on name conflict when registering
- * non-shared records. By default, name conflicts are automatically handled
- * by renaming the service. NoAutoRename overrides this behavior - with this
- * flag set, name conflicts will result in a callback. The NoAutorename flag
- * is only valid if a name is explicitly specified when registering a service
- * (i.e. the default name is not used.)
- */
-
- kDNSServiceFlagsShared = 0x10,
- kDNSServiceFlagsUnique = 0x20,
- /* Flag for registering individual records on a connected
- * DNSServiceRef. Shared indicates that there may be multiple records
- * with this name on the network (e.g. PTR records). Unique indicates that the
- * record's name is to be unique on the network (e.g. SRV records).
- */
-
- kDNSServiceFlagsBrowseDomains = 0x40,
- kDNSServiceFlagsRegistrationDomains = 0x80,
- /* Flags for specifying domain enumeration type in DNSServiceEnumerateDomains.
- * BrowseDomains enumerates domains recommended for browsing, RegistrationDomains
- * enumerates domains recommended for registration.
- */
-
- kDNSServiceFlagsLongLivedQuery = 0x100,
- /* Flag for creating a long-lived unicast query for the DNSServiceQueryRecord call. */
-
- kDNSServiceFlagsAllowRemoteQuery = 0x200,
- /* Flag for creating a record for which we will answer remote queries
- * (queries from hosts more than one hop away; hosts not directly connected to the local link).
- */
-
- kDNSServiceFlagsForceMulticast = 0x400
- /* Flag for signifying that a query or registration should be performed exclusively via multicast DNS,
- * even for a name in a domain (e.g. foo.apple.com.) that would normally imply unicast DNS.
- */
- };
-
-/*
- * The values for DNS Classes and Types are listed in RFC 1035, and are available
- * on every OS in its DNS header file. Unfortunately every OS does not have the
- * same header file containing DNS Class and Type constants, and the names of
- * the constants are not consistent. For example, BIND 8 uses "T_A",
- * BIND 9 uses "ns_t_a", Windows uses "DNS_TYPE_A", etc.
- * For this reason, these constants are also listed here, so that code using
- * the DNS-SD programming APIs can use these constants, so that the same code
- * can compile on all our supported platforms.
- */
-
-enum
- {
- kDNSServiceClass_IN = 1 /* Internet */
- };
-
-enum
- {
- kDNSServiceType_A = 1, /* Host address. */
- kDNSServiceType_NS = 2, /* Authoritative server. */
- kDNSServiceType_MD = 3, /* Mail destination. */
- kDNSServiceType_MF = 4, /* Mail forwarder. */
- kDNSServiceType_CNAME = 5, /* Canonical name. */
- kDNSServiceType_SOA = 6, /* Start of authority zone. */
- kDNSServiceType_MB = 7, /* Mailbox domain name. */
- kDNSServiceType_MG = 8, /* Mail group member. */
- kDNSServiceType_MR = 9, /* Mail rename name. */
- kDNSServiceType_NULL = 10, /* Null resource record. */
- kDNSServiceType_WKS = 11, /* Well known service. */
- kDNSServiceType_PTR = 12, /* Domain name pointer. */
- kDNSServiceType_HINFO = 13, /* Host information. */
- kDNSServiceType_MINFO = 14, /* Mailbox information. */
- kDNSServiceType_MX = 15, /* Mail routing information. */
- kDNSServiceType_TXT = 16, /* One or more text strings. */
- kDNSServiceType_RP = 17, /* Responsible person. */
- kDNSServiceType_AFSDB = 18, /* AFS cell database. */
- kDNSServiceType_X25 = 19, /* X_25 calling address. */
- kDNSServiceType_ISDN = 20, /* ISDN calling address. */
- kDNSServiceType_RT = 21, /* Router. */
- kDNSServiceType_NSAP = 22, /* NSAP address. */
- kDNSServiceType_NSAP_PTR = 23, /* Reverse NSAP lookup (deprecated). */
- kDNSServiceType_SIG = 24, /* Security signature. */
- kDNSServiceType_KEY = 25, /* Security key. */
- kDNSServiceType_PX = 26, /* X.400 mail mapping. */
- kDNSServiceType_GPOS = 27, /* Geographical position (withdrawn). */
- kDNSServiceType_AAAA = 28, /* Ip6 Address. */
- kDNSServiceType_LOC = 29, /* Location Information. */
- kDNSServiceType_NXT = 30, /* Next domain (security). */
- kDNSServiceType_EID = 31, /* Endpoint identifier. */
- kDNSServiceType_NIMLOC = 32, /* Nimrod Locator. */
- kDNSServiceType_SRV = 33, /* Server Selection. */
- kDNSServiceType_ATMA = 34, /* ATM Address */
- kDNSServiceType_NAPTR = 35, /* Naming Authority PoinTeR */
- kDNSServiceType_KX = 36, /* Key Exchange */
- kDNSServiceType_CERT = 37, /* Certification record */
- kDNSServiceType_A6 = 38, /* IPv6 address (deprecates AAAA) */
- kDNSServiceType_DNAME = 39, /* Non-terminal DNAME (for IPv6) */
- kDNSServiceType_SINK = 40, /* Kitchen sink (experimentatl) */
- kDNSServiceType_OPT = 41, /* EDNS0 option (meta-RR) */
- kDNSServiceType_TKEY = 249, /* Transaction key */
- kDNSServiceType_TSIG = 250, /* Transaction signature. */
- kDNSServiceType_IXFR = 251, /* Incremental zone transfer. */
- kDNSServiceType_AXFR = 252, /* Transfer zone of authority. */
- kDNSServiceType_MAILB = 253, /* Transfer mailbox records. */
- kDNSServiceType_MAILA = 254, /* Transfer mail agent records. */
- kDNSServiceType_ANY = 255 /* Wildcard match. */
- };
-
-
-/* possible error code values */
-enum
- {
- kDNSServiceErr_NoError = 0,
- kDNSServiceErr_Unknown = -65537, /* 0xFFFE FFFF */
- kDNSServiceErr_NoSuchName = -65538,
- kDNSServiceErr_NoMemory = -65539,
- kDNSServiceErr_BadParam = -65540,
- kDNSServiceErr_BadReference = -65541,
- kDNSServiceErr_BadState = -65542,
- kDNSServiceErr_BadFlags = -65543,
- kDNSServiceErr_Unsupported = -65544,
- kDNSServiceErr_NotInitialized = -65545,
- kDNSServiceErr_AlreadyRegistered = -65547,
- kDNSServiceErr_NameConflict = -65548,
- kDNSServiceErr_Invalid = -65549,
- kDNSServiceErr_Firewall = -65550,
- kDNSServiceErr_Incompatible = -65551, /* client library incompatible with daemon */
- kDNSServiceErr_BadInterfaceIndex = -65552,
- kDNSServiceErr_Refused = -65553,
- kDNSServiceErr_NoSuchRecord = -65554,
- kDNSServiceErr_NoAuth = -65555,
- kDNSServiceErr_NoSuchKey = -65556,
- kDNSServiceErr_NATTraversal = -65557,
- kDNSServiceErr_DoubleNAT = -65558,
- kDNSServiceErr_BadTime = -65559
- /* mDNS Error codes are in the range
- * FFFE FF00 (-65792) to FFFE FFFF (-65537) */
- };
-
-
-/* Maximum length, in bytes, of a service name represented as a */
-/* literal C-String, including the terminating NULL at the end. */
-
-#define kDNSServiceMaxServiceName 64
-
-/* Maximum length, in bytes, of a domain name represented as an *escaped* C-String */
-/* including the final trailing dot, and the C-String terminating NULL at the end. */
-
-#define kDNSServiceMaxDomainName 1005
-
-/*
- * Notes on DNS Name Escaping
- * -- or --
- * "Why is kDNSServiceMaxDomainName 1005, when the maximum legal domain name is 255 bytes?"
- *
- * All strings used in DNS-SD are UTF-8 strings.
- * With few exceptions, most are also escaped using standard DNS escaping rules:
- *
- * '\\' represents a single literal '\' in the name
- * '\.' represents a single literal '.' in the name
- * '\ddd', where ddd is a three-digit decimal value from 000 to 255,
- * represents a single literal byte with that value.
- * A bare unescaped '.' is a label separator, marking a boundary between domain and subdomain.
- *
- * The exceptions, that do not use escaping, are the routines where the full
- * DNS name of a resource is broken, for convenience, into servicename/regtype/domain.
- * In these routines, the "servicename" is NOT escaped. It does not need to be, since
- * it is, by definition, just a single literal string. Any characters in that string
- * represent exactly what they are. The "regtype" portion is, technically speaking,
- * escaped, but since legal regtypes are only allowed to contain letters, digits,
- * and hyphens, there is nothing to escape, so the issue is moot. The "domain"
- * portion is also escaped, though most domains in use on the public Internet
- * today, like regtypes, don't contain any characters that need to be escaped.
- * As DNS-SD becomes more popular, rich-text domains for service discovery will
- * become common, so software should be written to cope with domains with escaping.
- *
- * The servicename may be up to 63 bytes of UTF-8 text (not counting the C-String
- * terminating NULL at the end). The regtype is of the form _service._tcp or
- * _service._udp, where the "service" part is 1-14 characters, which may be
- * letters, digits, or hyphens. The domain part of the three-part name may be
- * any legal domain, providing that the resulting servicename+regtype+domain
- * name does not exceed 255 bytes.
- *
- * For most software, these issues are transparent. When browsing, the discovered
- * servicenames should simply be displayed as-is. When resolving, the discovered
- * servicename/regtype/domain are simply passed unchanged to DNSServiceResolve().
- * When a DNSServiceResolve() succeeds, the returned fullname is already in
- * the correct format to pass to standard system DNS APIs such as res_query().
- * For converting from servicename/regtype/domain to a single properly-escaped
- * full DNS name, the helper function DNSServiceConstructFullName() is provided.
- *
- * The following (highly contrived) example illustrates the escaping process.
- * Suppose you have an service called "Dr. Smith\Dr. Johnson", of type "_ftp._tcp"
- * in subdomain "4th. Floor" of subdomain "Building 2" of domain "apple.com."
- * The full (escaped) DNS name of this service's SRV record would be:
- * Dr\.\032Smith\\Dr\.\032Johnson._ftp._tcp.4th\.\032Floor.Building\0322.apple.com.
- */
-
-
-/*
- * Constants for specifying an interface index
- *
- * Specific interface indexes are identified via a 32-bit unsigned integer returned
- * by the if_nametoindex() family of calls.
- *
- * If the client passes 0 for interface index, that means "do the right thing",
- * which (at present) means, "if the name is in an mDNS local multicast domain
- * (e.g. 'local.', '254.169.in-addr.arpa.', '0.8.E.F.ip6.arpa.') then multicast
- * on all applicable interfaces, otherwise send via unicast to the appropriate
- * DNS server." Normally, most clients will use 0 for interface index to
- * automatically get the default sensible behaviour.
- *
- * If the client passes a positive interface index, then for multicast names that
- * indicates to do the operation only on that one interface. For unicast names the
- * interface index is ignored unless kDNSServiceFlagsForceMulticast is also set.
- *
- * If the client passes kDNSServiceInterfaceIndexLocalOnly when registering
- * a service, then that service will be found *only* by other local clients
- * on the same machine that are browsing using kDNSServiceInterfaceIndexLocalOnly
- * or kDNSServiceInterfaceIndexAny.
- * If a client has a 'private' service, accessible only to other processes
- * running on the same machine, this allows the client to advertise that service
- * in a way such that it does not inadvertently appear in service lists on
- * all the other machines on the network.
- *
- * If the client passes kDNSServiceInterfaceIndexLocalOnly when browsing
- * then it will find *all* records registered on that same local machine.
- * Clients explicitly wishing to discover *only* LocalOnly services can
- * accomplish this by inspecting the interfaceIndex of each service reported
- * to their DNSServiceBrowseReply() callback function, and discarding those
- * where the interface index is not kDNSServiceInterfaceIndexLocalOnly.
- */
-
-#define kDNSServiceInterfaceIndexAny 0
-#define kDNSServiceInterfaceIndexLocalOnly ( (uint32_t) -1 )
-
-
-typedef uint32_t DNSServiceFlags;
-typedef int32_t DNSServiceErrorType;
-
-
-/*********************************************************************************************
- *
- * Unix Domain Socket access, DNSServiceRef deallocation, and data processing functions
- *
- *********************************************************************************************/
-
-
-/* DNSServiceRefSockFD()
- *
- * Access underlying Unix domain socket for an initialized DNSServiceRef.
- * The DNS Service Discovery implmementation uses this socket to communicate between
- * the client and the mDNSResponder daemon. The application MUST NOT directly read from
- * or write to this socket. Access to the socket is provided so that it can be used as a
- * run loop source, or in a select() loop: when data is available for reading on the socket,
- * DNSServiceProcessResult() should be called, which will extract the daemon's reply from
- * the socket, and pass it to the appropriate application callback. By using a run loop or
- * select(), results from the daemon can be processed asynchronously. Without using these
- * constructs, DNSServiceProcessResult() will block until the response from the daemon arrives.
- * The client is responsible for ensuring that the data on the socket is processed in a timely
- * fashion - the daemon may terminate its connection with a client that does not clear its
- * socket buffer.
- *
- * sdRef: A DNSServiceRef initialized by any of the DNSService calls.
- *
- * return value: The DNSServiceRef's underlying socket descriptor, or -1 on
- * error.
- */
-
-int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef);
-
-
-/* DNSServiceProcessResult()
- *
- * Read a reply from the daemon, calling the appropriate application callback. This call will
- * block until the daemon's response is received. Use DNSServiceRefSockFD() in
- * conjunction with a run loop or select() to determine the presence of a response from the
- * server before calling this function to process the reply without blocking. Call this function
- * at any point if it is acceptable to block until the daemon's response arrives. Note that the
- * client is responsible for ensuring that DNSServiceProcessResult() is called whenever there is
- * a reply from the daemon - the daemon may terminate its connection with a client that does not
- * process the daemon's responses.
- *
- * sdRef: A DNSServiceRef initialized by any of the DNSService calls
- * that take a callback parameter.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns
- * an error code indicating the specific failure that occurred.
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef);
-
-
-/* DNSServiceRefDeallocate()
- *
- * Terminate a connection with the daemon and free memory associated with the DNSServiceRef.
- * Any services or records registered with this DNSServiceRef will be deregistered. Any
- * Browse, Resolve, or Query operations called with this reference will be terminated.
- *
- * Note: If the reference's underlying socket is used in a run loop or select() call, it should
- * be removed BEFORE DNSServiceRefDeallocate() is called, as this function closes the reference's
- * socket.
- *
- * Note: If the reference was initialized with DNSServiceCreateConnection(), any DNSRecordRefs
- * created via this reference will be invalidated by this call - the resource records are
- * deregistered, and their DNSRecordRefs may not be used in subsequent functions. Similarly,
- * if the reference was initialized with DNSServiceRegister, and an extra resource record was
- * added to the service via DNSServiceAddRecord(), the DNSRecordRef created by the Add() call
- * is invalidated when this function is called - the DNSRecordRef may not be used in subsequent
- * functions.
- *
- * Note: This call is to be used only with the DNSServiceRef defined by this API. It is
- * not compatible with dns_service_discovery_ref objects defined in the legacy Mach-based
- * DNSServiceDiscovery.h API.
- *
- * sdRef: A DNSServiceRef initialized by any of the DNSService calls.
- *
- */
-
-void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdRef);
-
-
-/*********************************************************************************************
- *
- * Domain Enumeration
- *
- *********************************************************************************************/
-
-/* DNSServiceEnumerateDomains()
- *
- * Asynchronously enumerate domains available for browsing and registration.
- *
- * The enumeration MUST be cancelled via DNSServiceRefDeallocate() when no more domains
- * are to be found.
- *
- * Note that the names returned are (like all of DNS-SD) UTF-8 strings,
- * and are escaped using standard DNS escaping rules.
- * (See "Notes on DNS Name Escaping" earlier in this file for more details.)
- * A graphical browser displaying a hierarchical tree-structured view should cut
- * the names at the bare dots to yield individual labels, then de-escape each
- * label according to the escaping rules, and then display the resulting UTF-8 text.
- *
- * DNSServiceDomainEnumReply Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceEnumerateDomains().
- *
- * flags: Possible values are:
- * kDNSServiceFlagsMoreComing
- * kDNSServiceFlagsAdd
- * kDNSServiceFlagsDefault
- *
- * interfaceIndex: Specifies the interface on which the domain exists. (The index for a given
- * interface is determined via the if_nametoindex() family of calls.)
- *
- * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise indicates
- * the failure that occurred (other parameters are undefined if errorCode is nonzero).
- *
- * replyDomain: The name of the domain.
- *
- * context: The context pointer passed to DNSServiceEnumerateDomains.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceDomainEnumReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *replyDomain,
- void *context
- );
-
-
-/* DNSServiceEnumerateDomains() Parameters:
- *
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the enumeration operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Possible values are:
- * kDNSServiceFlagsBrowseDomains to enumerate domains recommended for browsing.
- * kDNSServiceFlagsRegistrationDomains to enumerate domains recommended
- * for registration.
- *
- * interfaceIndex: If non-zero, specifies the interface on which to look for domains.
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Most applications will pass 0 to enumerate domains on
- * all interfaces. See "Constants for specifying an interface index" for more details.
- *
- * callBack: The function to be called when a domain is found or the call asynchronously
- * fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is not invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceDomainEnumReply callBack,
- void *context /* may be NULL */
- );
-
-
-/*********************************************************************************************
- *
- * Service Registration
- *
- *********************************************************************************************/
-
-/* Register a service that is discovered via Browse() and Resolve() calls.
- *
- *
- * DNSServiceRegisterReply() Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceRegister().
- *
- * flags: Currently unused, reserved for future use.
- *
- * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will
- * indicate the failure that occurred (including name conflicts,
- * if the kDNSServiceFlagsNoAutoRename flag was used when registering.)
- * Other parameters are undefined if errorCode is nonzero.
- *
- * name: The service name registered (if the application did not specify a name in
- * DNSServiceRegister(), this indicates what name was automatically chosen).
- *
- * regtype: The type of service registered, as it was passed to the callout.
- *
- * domain: The domain on which the service was registered (if the application did not
- * specify a domain in DNSServiceRegister(), this indicates the default domain
- * on which the service was registered).
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceRegisterReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- DNSServiceErrorType errorCode,
- const char *name,
- const char *regtype,
- const char *domain,
- void *context
- );
-
-
-/* DNSServiceRegister() Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the registration will remain active indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * interfaceIndex: If non-zero, specifies the interface on which to register the service
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Most applications will pass 0 to register on all
- * available interfaces. See "Constants for specifying an interface index" for more details.
- *
- * flags: Indicates the renaming behavior on name conflict (most applications
- * will pass 0). See flag definitions above for details.
- *
- * name: If non-NULL, specifies the service name to be registered.
- * Most applications will not specify a name, in which case the computer
- * name is used (this name is communicated to the client via the callback).
- * If a name is specified, it must be 1-63 bytes of UTF-8 text.
- * If the name is longer than 63 bytes it will be automatically truncated
- * to a legal length, unless the NoAutoRename flag is set,
- * in which case kDNSServiceErr_BadParam will be returned.
- *
- * regtype: The service type followed by the protocol, separated by a dot
- * (e.g. "_ftp._tcp"). The service type must be an underscore, followed
- * by 1-14 characters, which may be letters, digits, or hyphens.
- * The transport protocol must be "_tcp" or "_udp". New service types
- * should be registered at <http://www.dns-sd.org/ServiceTypes.html>.
- *
- * domain: If non-NULL, specifies the domain on which to advertise the service.
- * Most applications will not specify a domain, instead automatically
- * registering in the default domain(s).
- *
- * host: If non-NULL, specifies the SRV target host name. Most applications
- * will not specify a host, instead automatically using the machine's
- * default host name(s). Note that specifying a non-NULL host does NOT
- * create an address record for that host - the application is responsible
- * for ensuring that the appropriate address record exists, or creating it
- * via DNSServiceRegisterRecord().
- *
- * port: The port, in network byte order, on which the service accepts connections.
- * Pass 0 for a "placeholder" service (i.e. a service that will not be discovered
- * by browsing, but will cause a name conflict if another client tries to
- * register that same name). Most clients will not use placeholder services.
- *
- * txtLen: The length of the txtRecord, in bytes. Must be zero if the txtRecord is NULL.
- *
- * txtRecord: The TXT record rdata. A non-NULL txtRecord MUST be a properly formatted DNS
- * TXT record, i.e. <length byte> <data> <length byte> <data> ...
- * Passing NULL for the txtRecord is allowed as a synonym for txtLen=1, txtRecord="",
- * i.e. it creates a TXT record of length one containing a single empty string.
- * RFC 1035 doesn't allow a TXT record to contain *zero* strings, so a single empty
- * string is the smallest legal DNS TXT record.
- *
- * callBack: The function to be called when the registration completes or asynchronously
- * fails. The client MAY pass NULL for the callback - The client will NOT be notified
- * of the default values picked on its behalf, and the client will NOT be notified of any
- * asynchronous errors (e.g. out of memory errors, etc.) that may prevent the registration
- * of the service. The client may NOT pass the NoAutoRename flag if the callback is NULL.
- * The client may still deregister the service at any time via DNSServiceRefDeallocate().
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSServiceRef
- * is not initialized.)
- *
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceRegister
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *name, /* may be NULL */
- const char *regtype,
- const char *domain, /* may be NULL */
- const char *host, /* may be NULL */
- uint16_t port,
- uint16_t txtLen,
- const void *txtRecord, /* may be NULL */
- DNSServiceRegisterReply callBack, /* may be NULL */
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceAddRecord()
- *
- * Add a record to a registered service. The name of the record will be the same as the
- * registered service's name.
- * The record can later be updated or deregistered by passing the RecordRef initialized
- * by this function to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
- *
- *
- * Parameters;
- *
- * sdRef: A DNSServiceRef initialized by DNSServiceRegister().
- *
- * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this
- * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
- * If the above DNSServiceRef is passed to DNSServiceRefDeallocate(), RecordRef is also
- * invalidated and may not be used further.
- *
- * flags: Currently ignored, reserved for future use.
- *
- * rrtype: The type of the record (e.g. kDNSServiceType_TXT, kDNSServiceType_SRV, etc)
- *
- * rdlen: The length, in bytes, of the rdata.
- *
- * rdata: The raw rdata to be contained in the added resource record.
- *
- * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an
- * error code indicating the error that occurred (the RecordRef is not initialized).
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceAddRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef *RecordRef,
- DNSServiceFlags flags,
- uint16_t rrtype,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl
- );
-
-
-/* DNSServiceUpdateRecord
- *
- * Update a registered resource record. The record must either be:
- * - The primary txt record of a service registered via DNSServiceRegister()
- * - A record added to a registered service via DNSServiceAddRecord()
- * - An individual record registered by DNSServiceRegisterRecord()
- *
- *
- * Parameters:
- *
- * sdRef: A DNSServiceRef that was initialized by DNSServiceRegister()
- * or DNSServiceCreateConnection().
- *
- * RecordRef: A DNSRecordRef initialized by DNSServiceAddRecord, or NULL to update the
- * service's primary txt record.
- *
- * flags: Currently ignored, reserved for future use.
- *
- * rdlen: The length, in bytes, of the new rdata.
- *
- * rdata: The new rdata to be contained in the updated resource record.
- *
- * ttl: The time to live of the updated resource record, in seconds.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an
- * error code indicating the error that occurred.
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef RecordRef, /* may be NULL */
- DNSServiceFlags flags,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl
- );
-
-
-/* DNSServiceRemoveRecord
- *
- * Remove a record previously added to a service record set via DNSServiceAddRecord(), or deregister
- * an record registered individually via DNSServiceRegisterRecord().
- *
- * Parameters:
- *
- * sdRef: A DNSServiceRef initialized by DNSServiceRegister() (if the
- * record being removed was registered via DNSServiceAddRecord()) or by
- * DNSServiceCreateConnection() (if the record being removed was registered via
- * DNSServiceRegisterRecord()).
- *
- * recordRef: A DNSRecordRef initialized by a successful call to DNSServiceAddRecord()
- * or DNSServiceRegisterRecord().
- *
- * flags: Currently ignored, reserved for future use.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an
- * error code indicating the error that occurred.
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef RecordRef,
- DNSServiceFlags flags
- );
-
-
-/*********************************************************************************************
- *
- * Service Discovery
- *
- *********************************************************************************************/
-
-/* Browse for instances of a service.
- *
- *
- * DNSServiceBrowseReply() Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceBrowse().
- *
- * flags: Possible values are kDNSServiceFlagsMoreComing and kDNSServiceFlagsAdd.
- * See flag definitions for details.
- *
- * interfaceIndex: The interface on which the service is advertised. This index should
- * be passed to DNSServiceResolve() when resolving the service.
- *
- * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will
- * indicate the failure that occurred. Other parameters are undefined if
- * the errorCode is nonzero.
- *
- * serviceName: The discovered service name. This name should be displayed to the user,
- * and stored for subsequent use in the DNSServiceResolve() call.
- *
- * regtype: The service type, which is usually (but not always) the same as was passed
- * to DNSServiceBrowse(). One case where the discovered service type may
- * not be the same as the requested service type is when using subtypes:
- * The client may want to browse for only those ftp servers that allow
- * anonymous connections. The client will pass the string "_ftp._tcp,_anon"
- * to DNSServiceBrowse(), but the type of the service that's discovered
- * is simply "_ftp._tcp". The regtype for each discovered service instance
- * should be stored along with the name, so that it can be passed to
- * DNSServiceResolve() when the service is later resolved.
- *
- * domain: The domain of the discovered service instance. This may or may not be the
- * same as the domain that was passed to DNSServiceBrowse(). The domain for each
- * discovered service instance should be stored along with the name, so that
- * it can be passed to DNSServiceResolve() when the service is later resolved.
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceBrowseReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *serviceName,
- const char *regtype,
- const char *replyDomain,
- void *context
- );
-
-
-/* DNSServiceBrowse() Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the browse operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Currently ignored, reserved for future use.
- *
- * interfaceIndex: If non-zero, specifies the interface on which to browse for services
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Most applications will pass 0 to browse on all available
- * interfaces. See "Constants for specifying an interface index" for more details.
- *
- * regtype: The service type being browsed for followed by the protocol, separated by a
- * dot (e.g. "_ftp._tcp"). The transport protocol must be "_tcp" or "_udp".
- *
- * domain: If non-NULL, specifies the domain on which to browse for services.
- * Most applications will not specify a domain, instead browsing on the
- * default domain(s).
- *
- * callBack: The function to be called when an instance of the service being browsed for
- * is found, or if the call asynchronously fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is not invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceBrowse
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *regtype,
- const char *domain, /* may be NULL */
- DNSServiceBrowseReply callBack,
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceResolve()
- *
- * Resolve a service name discovered via DNSServiceBrowse() to a target host name, port number, and
- * txt record.
- *
- * Note: Applications should NOT use DNSServiceResolve() solely for txt record monitoring - use
- * DNSServiceQueryRecord() instead, as it is more efficient for this task.
- *
- * Note: When the desired results have been returned, the client MUST terminate the resolve by calling
- * DNSServiceRefDeallocate().
- *
- * Note: DNSServiceResolve() behaves correctly for typical services that have a single SRV record
- * and a single TXT record. To resolve non-standard services with multiple SRV or TXT records,
- * DNSServiceQueryRecord() should be used.
- *
- * DNSServiceResolveReply Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceResolve().
- *
- * flags: Currently unused, reserved for future use.
- *
- * interfaceIndex: The interface on which the service was resolved.
- *
- * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will
- * indicate the failure that occurred. Other parameters are undefined if
- * the errorCode is nonzero.
- *
- * fullname: The full service domain name, in the form <servicename>.<protocol>.<domain>.
- * (This name is escaped following standard DNS rules, making it suitable for
- * passing to standard system DNS APIs such as res_query(), or to the
- * special-purpose functions included in this API that take fullname parameters.
- * See "Notes on DNS Name Escaping" earlier in this file for more details.)
- *
- * hosttarget: The target hostname of the machine providing the service. This name can
- * be passed to functions like gethostbyname() to identify the host's IP address.
- *
- * port: The port, in network byte order, on which connections are accepted for this service.
- *
- * txtLen: The length of the txt record, in bytes.
- *
- * txtRecord: The service's primary txt record, in standard txt record format.
- *
-
- * context: The context pointer that was passed to the callout.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceResolveReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *fullname,
- const char *hosttarget,
- uint16_t port,
- uint16_t txtLen,
- const char *txtRecord,
- void *context
- );
-
-
-/* DNSServiceResolve() Parameters
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the resolve operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Currently ignored, reserved for future use.
- *
- * interfaceIndex: The interface on which to resolve the service. If this resolve call is
- * as a result of a currently active DNSServiceBrowse() operation, then the
- * interfaceIndex should be the index reported in the DNSServiceBrowseReply
- * callback. If this resolve call is using information previously saved
- * (e.g. in a preference file) for later use, then use interfaceIndex 0, because
- * the desired service may now be reachable via a different physical interface.
- * See "Constants for specifying an interface index" for more details.
- *
- * name: The name of the service instance to be resolved, as reported to the
- * DNSServiceBrowseReply() callback.
- *
- * regtype: The type of the service instance to be resolved, as reported to the
- * DNSServiceBrowseReply() callback.
- *
- * domain: The domain of the service instance to be resolved, as reported to the
- * DNSServiceBrowseReply() callback.
- *
- * callBack: The function to be called when a result is found, or if the call
- * asynchronously fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceResolve
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *name,
- const char *regtype,
- const char *domain,
- DNSServiceResolveReply callBack,
- void *context /* may be NULL */
- );
-
-
-/*********************************************************************************************
- *
- * Special Purpose Calls (most applications will not use these)
- *
- *********************************************************************************************/
-
-/* DNSServiceCreateConnection()
- *
- * Create a connection to the daemon allowing efficient registration of
- * multiple individual records.
- *
- *
- * Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. Deallocating
- * the reference (via DNSServiceRefDeallocate()) severs the
- * connection and deregisters all records registered on this connection.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns
- * an error code indicating the specific failure that occurred (in which
- * case the DNSServiceRef is not initialized).
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef);
-
-
-/* DNSServiceRegisterRecord
- *
- * Register an individual resource record on a connected DNSServiceRef.
- *
- * Note that name conflicts occurring for records registered via this call must be handled
- * by the client in the callback.
- *
- *
- * DNSServiceRegisterRecordReply() parameters:
- *
- * sdRef: The connected DNSServiceRef initialized by
- * DNSServiceDiscoveryConnect().
- *
- * RecordRef: The DNSRecordRef initialized by DNSServiceRegisterRecord(). If the above
- * DNSServiceRef is passed to DNSServiceRefDeallocate(), this DNSRecordRef is
- * invalidated, and may not be used further.
- *
- * flags: Currently unused, reserved for future use.
- *
- * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will
- * indicate the failure that occurred (including name conflicts.)
- * Other parameters are undefined if errorCode is nonzero.
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
- typedef void (DNSSD_API *DNSServiceRegisterRecordReply)
- (
- DNSServiceRef sdRef,
- DNSRecordRef RecordRef,
- DNSServiceFlags flags,
- DNSServiceErrorType errorCode,
- void *context
- );
-
-
-/* DNSServiceRegisterRecord() Parameters:
- *
- * sdRef: A DNSServiceRef initialized by DNSServiceCreateConnection().
- *
- * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this
- * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
- * (To deregister ALL records registered on a single connected DNSServiceRef
- * and deallocate each of their corresponding DNSServiceRecordRefs, call
- * DNSServiceRefDealloocate()).
- *
- * flags: Possible values are kDNSServiceFlagsShared or kDNSServiceFlagsUnique
- * (see flag type definitions for details).
- *
- * interfaceIndex: If non-zero, specifies the interface on which to register the record
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Passing 0 causes the record to be registered on all interfaces.
- * See "Constants for specifying an interface index" for more details.
- *
- * fullname: The full domain name of the resource record.
- *
- * rrtype: The numerical type of the resource record (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN)
- *
- * rdlen: Length, in bytes, of the rdata.
- *
- * rdata: A pointer to the raw rdata, as it is to appear in the DNS record.
- *
- * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value.
- *
- * callBack: The function to be called when a result is found, or if the call
- * asynchronously fails (e.g. because of a name conflict.)
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSRecordRef is
- * not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef *RecordRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl,
- DNSServiceRegisterRecordReply callBack,
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceQueryRecord
- *
- * Query for an arbitrary DNS record.
- *
- *
- * DNSServiceQueryRecordReply() Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceQueryRecord().
- *
- * flags: Possible values are kDNSServiceFlagsMoreComing and
- * kDNSServiceFlagsAdd. The Add flag is NOT set for PTR records
- * with a ttl of 0, i.e. "Remove" events.
- *
- * interfaceIndex: The interface on which the query was resolved (the index for a given
- * interface is determined via the if_nametoindex() family of calls).
- * See "Constants for specifying an interface index" for more details.
- *
- * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will
- * indicate the failure that occurred. Other parameters are undefined if
- * errorCode is nonzero.
- *
- * fullname: The resource record's full domain name.
- *
- * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN).
- *
- * rdlen: The length, in bytes, of the resource record rdata.
- *
- * rdata: The raw rdata of the resource record.
- *
- * ttl: The resource record's time to live, in seconds.
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceQueryRecordReply)
- (
- DNSServiceRef DNSServiceRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl,
- void *context
- );
-
-
-/* DNSServiceQueryRecord() Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the query operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Pass kDNSServiceFlagsLongLivedQuery to create a "long-lived" unicast
- * query in a non-local domain. Without setting this flag, unicast queries
- * will be one-shot - that is, only answers available at the time of the call
- * will be returned. By setting this flag, answers (including Add and Remove
- * events) that become available after the initial call is made will generate
- * callbacks. This flag has no effect on link-local multicast queries.
- *
- * interfaceIndex: If non-zero, specifies the interface on which to issue the query
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Passing 0 causes the name to be queried for on all
- * interfaces. See "Constants for specifying an interface index" for more details.
- *
- * fullname: The full domain name of the resource record to be queried for.
- *
- * rrtype: The numerical type of the resource record to be queried for
- * (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN).
- *
- * callBack: The function to be called when a result is found, or if the call
- * asynchronously fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceQueryRecord
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- DNSServiceQueryRecordReply callBack,
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceReconfirmRecord
- *
- * Instruct the daemon to verify the validity of a resource record that appears to
- * be out of date (e.g. because tcp connection to a service's target failed.)
- * Causes the record to be flushed from the daemon's cache (as well as all other
- * daemons' caches on the network) if the record is determined to be invalid.
- *
- * Parameters:
- *
- * flags: Currently unused, reserved for future use.
- *
- * interfaceIndex: If non-zero, specifies the interface of the record in question.
- * Passing 0 causes all instances of this record to be reconfirmed.
- *
- * fullname: The resource record's full domain name.
- *
- * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN).
- *
- * rdlen: The length, in bytes, of the resource record rdata.
- *
- * rdata: The raw rdata of the resource record.
- *
- */
-
-void DNSSD_API DNSServiceReconfirmRecord
- (
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- uint16_t rdlen,
- const void *rdata
- );
-
-
-/*********************************************************************************************
- *
- * General Utility Functions
- *
- *********************************************************************************************/
-
-/* DNSServiceConstructFullName()
- *
- * Concatenate a three-part domain name (as returned by the above callbacks) into a
- * properly-escaped full domain name. Note that callbacks in the above functions ALREADY ESCAPE
- * strings where necessary.
- *
- * Parameters:
- *
- * fullName: A pointer to a buffer that where the resulting full domain name is to be written.
- * The buffer must be kDNSServiceMaxDomainName (1005) bytes in length to
- * accommodate the longest legal domain name without buffer overrun.
- *
- * service: The service name - any dots or backslashes must NOT be escaped.
- * May be NULL (to construct a PTR record name, e.g.
- * "_ftp._tcp.apple.com.").
- *
- * regtype: The service type followed by the protocol, separated by a dot
- * (e.g. "_ftp._tcp").
- *
- * domain: The domain name, e.g. "apple.com.". Literal dots or backslashes,
- * if any, must be escaped, e.g. "1st\. Floor.apple.com."
- *
- * return value: Returns 0 on success, -1 on error.
- *
- */
-
-int DNSSD_API DNSServiceConstructFullName
- (
- char *fullName,
- const char *service, /* may be NULL */
- const char *regtype,
- const char *domain
- );
-
-
-/*********************************************************************************************
- *
- * TXT Record Construction Functions
- *
- *********************************************************************************************/
-
-/*
- * A typical calling sequence for TXT record construction is something like:
- *
- * Client allocates storage for TXTRecord data (e.g. declare buffer on the stack)
- * TXTRecordCreate();
- * TXTRecordSetValue();
- * TXTRecordSetValue();
- * TXTRecordSetValue();
- * ...
- * DNSServiceRegister( ... TXTRecordGetLength(), TXTRecordGetBytesPtr() ... );
- * TXTRecordDeallocate();
- * Explicitly deallocate storage for TXTRecord data (if not allocated on the stack)
- */
-
-
-/* TXTRecordRef
- *
- * Opaque internal data type.
- * Note: Represents a DNS-SD TXT record.
- */
-
-typedef struct _TXTRecordRef_t { char privatedata[16]; } TXTRecordRef;
-
-
-/* TXTRecordCreate()
- *
- * Creates a new empty TXTRecordRef referencing the specified storage.
- *
- * If the buffer parameter is NULL, or the specified storage size is not
- * large enough to hold a key subsequently added using TXTRecordSetValue(),
- * then additional memory will be added as needed using malloc().
- *
- * On some platforms, when memory is low, malloc() may fail. In this
- * case, TXTRecordSetValue() will return kDNSServiceErr_NoMemory, and this
- * error condition will need to be handled as appropriate by the caller.
- *
- * You can avoid the need to handle this error condition if you ensure
- * that the storage you initially provide is large enough to hold all
- * the key/value pairs that are to be added to the record.
- * The caller can precompute the exact length required for all of the
- * key/value pairs to be added, or simply provide a fixed-sized buffer
- * known in advance to be large enough.
- * A no-value (key-only) key requires (1 + key length) bytes.
- * A key with empty value requires (1 + key length + 1) bytes.
- * A key with non-empty value requires (1 + key length + 1 + value length).
- * For most applications, DNS-SD TXT records are generally
- * less than 100 bytes, so in most cases a simple fixed-sized
- * 256-byte buffer will be more than sufficient.
- * Recommended size limits for DNS-SD TXT Records are discussed in
- * <http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt>
- *
- * Note: When passing parameters to and from these TXT record APIs,
- * the key name does not include the '=' character. The '=' character
- * is the separator between the key and value in the on-the-wire
- * packet format; it is not part of either the key or the value.
- *
- * txtRecord: A pointer to an uninitialized TXTRecordRef.
- *
- * bufferLen: The size of the storage provided in the "buffer" parameter.
- *
- * buffer: Optional caller-supplied storage used to hold the TXTRecord data.
- * This storage must remain valid for as long as
- * the TXTRecordRef.
- */
-
-void DNSSD_API TXTRecordCreate
- (
- TXTRecordRef *txtRecord,
- uint16_t bufferLen,
- void *buffer
- );
-
-
-/* TXTRecordDeallocate()
- *
- * Releases any resources allocated in the course of preparing a TXT Record
- * using TXTRecordCreate()/TXTRecordSetValue()/TXTRecordRemoveValue().
- * Ownership of the buffer provided in TXTRecordCreate() returns to the client.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- */
-
-void DNSSD_API TXTRecordDeallocate
- (
- TXTRecordRef *txtRecord
- );
-
-
-/* TXTRecordSetValue()
- *
- * Adds a key (optionally with value) to a TXTRecordRef. If the "key" already
- * exists in the TXTRecordRef, then the current value will be replaced with
- * the new value.
- * Keys may exist in four states with respect to a given TXT record:
- * - Absent (key does not appear at all)
- * - Present with no value ("key" appears alone)
- * - Present with empty value ("key=" appears in TXT record)
- * - Present with non-empty value ("key=value" appears in TXT record)
- * For more details refer to "Data Syntax for DNS-SD TXT Records" in
- * <http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt>
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * key: A null-terminated string which only contains printable ASCII
- * values (0x20-0x7E), excluding '=' (0x3D). Keys should be
- * 8 characters or less (not counting the terminating null).
- *
- * valueSize: The size of the value.
- *
- * value: Any binary value. For values that represent
- * textual data, UTF-8 is STRONGLY recommended.
- * For values that represent textual data, valueSize
- * should NOT include the terminating null (if any)
- * at the end of the string.
- * If NULL, then "key" will be added with no value.
- * If non-NULL but valueSize is zero, then "key=" will be
- * added with empty value.
- *
- * return value: Returns kDNSServiceErr_NoError on success.
- * Returns kDNSServiceErr_Invalid if the "key" string contains
- * illegal characters.
- * Returns kDNSServiceErr_NoMemory if adding this key would
- * exceed the available storage.
- */
-
-DNSServiceErrorType DNSSD_API TXTRecordSetValue
- (
- TXTRecordRef *txtRecord,
- const char *key,
- uint8_t valueSize, /* may be zero */
- const void *value /* may be NULL */
- );
-
-
-/* TXTRecordRemoveValue()
- *
- * Removes a key from a TXTRecordRef. The "key" must be an
- * ASCII string which exists in the TXTRecordRef.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * key: A key name which exists in the TXTRecordRef.
- *
- * return value: Returns kDNSServiceErr_NoError on success.
- * Returns kDNSServiceErr_NoSuchKey if the "key" does not
- * exist in the TXTRecordRef.
- *
- */
-
-DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
- (
- TXTRecordRef *txtRecord,
- const char *key
- );
-
-
-/* TXTRecordGetLength()
- *
- * Allows you to determine the length of the raw bytes within a TXTRecordRef.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * return value: Returns the size of the raw bytes inside a TXTRecordRef
- * which you can pass directly to DNSServiceRegister() or
- * to DNSServiceUpdateRecord().
- * Returns 0 if the TXTRecordRef is empty.
- *
- */
-
-uint16_t DNSSD_API TXTRecordGetLength
- (
- const TXTRecordRef *txtRecord
- );
-
-
-/* TXTRecordGetBytesPtr()
- *
- * Allows you to retrieve a pointer to the raw bytes within a TXTRecordRef.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * return value: Returns a pointer to the raw bytes inside the TXTRecordRef
- * which you can pass directly to DNSServiceRegister() or
- * to DNSServiceUpdateRecord().
- *
- */
-
-const void * DNSSD_API TXTRecordGetBytesPtr
- (
- const TXTRecordRef *txtRecord
- );
-
-
-/*********************************************************************************************
- *
- * TXT Record Parsing Functions
- *
- *********************************************************************************************/
-
-/*
- * A typical calling sequence for TXT record parsing is something like:
- *
- * Receive TXT record data in DNSServiceResolve() callback
- * if (TXTRecordContainsKey(txtLen, txtRecord, "key")) then do something
- * val1ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key1", &len1);
- * val2ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key2", &len2);
- * ...
- * bcopy(val1ptr, myval1, len1);
- * bcopy(val2ptr, myval2, len2);
- * ...
- * return;
- *
- * If you wish to retain the values after return from the DNSServiceResolve()
- * callback, then you need to copy the data to your own storage using bcopy()
- * or similar, as shown in the example above.
- *
- * If for some reason you need to parse a TXT record you built yourself
- * using the TXT record construction functions above, then you can do
- * that using TXTRecordGetLength and TXTRecordGetBytesPtr calls:
- * TXTRecordGetValue(TXTRecordGetLength(x), TXTRecordGetBytesPtr(x), key, &len);
- *
- * Most applications only fetch keys they know about from a TXT record and
- * ignore the rest.
- * However, some debugging tools wish to fetch and display all keys.
- * To do that, use the TXTRecordGetCount() and TXTRecordGetItemAtIndex() calls.
- */
-
-/* TXTRecordContainsKey()
- *
- * Allows you to determine if a given TXT Record contains a specified key.
- *
- * txtLen: The size of the received TXT Record.
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * key: A null-terminated ASCII string containing the key name.
- *
- * return value: Returns 1 if the TXT Record contains the specified key.
- * Otherwise, it returns 0.
- *
- */
-
-int DNSSD_API TXTRecordContainsKey
- (
- uint16_t txtLen,
- const void *txtRecord,
- const char *key
- );
-
-
-/* TXTRecordGetValuePtr()
- *
- * Allows you to retrieve the value for a given key from a TXT Record.
- *
- * txtLen: The size of the received TXT Record
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * key: A null-terminated ASCII string containing the key name.
- *
- * valueLen: On output, will be set to the size of the "value" data.
- *
- * return value: Returns NULL if the key does not exist in this TXT record,
- * or exists with no value (to differentiate between
- * these two cases use TXTRecordContainsKey()).
- * Returns pointer to location within TXT Record bytes
- * if the key exists with empty or non-empty value.
- * For empty value, valueLen will be zero.
- * For non-empty value, valueLen will be length of value data.
- */
-
-const void * DNSSD_API TXTRecordGetValuePtr
- (
- uint16_t txtLen,
- const void *txtRecord,
- const char *key,
- uint8_t *valueLen
- );
-
-
-/* TXTRecordGetCount()
- *
- * Returns the number of keys stored in the TXT Record. The count
- * can be used with TXTRecordGetItemAtIndex() to iterate through the keys.
- *
- * txtLen: The size of the received TXT Record.
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * return value: Returns the total number of keys in the TXT Record.
- *
- */
-
-uint16_t DNSSD_API TXTRecordGetCount
- (
- uint16_t txtLen,
- const void *txtRecord
- );
-
-
-/* TXTRecordGetItemAtIndex()
- *
- * Allows you to retrieve a key name and value pointer, given an index into
- * a TXT Record. Legal index values range from zero to TXTRecordGetCount()-1.
- * It's also possible to iterate through keys in a TXT record by simply
- * calling TXTRecordGetItemAtIndex() repeatedly, beginning with index zero
- * and increasing until TXTRecordGetItemAtIndex() returns kDNSServiceErr_Invalid.
- *
- * On return:
- * For keys with no value, *value is set to NULL and *valueLen is zero.
- * For keys with empty value, *value is non-NULL and *valueLen is zero.
- * For keys with non-empty value, *value is non-NULL and *valueLen is non-zero.
- *
- * txtLen: The size of the received TXT Record.
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * index: An index into the TXT Record.
- *
- * keyBufLen: The size of the string buffer being supplied.
- *
- * key: A string buffer used to store the key name.
- * On return, the buffer contains a null-terminated C string
- * giving the key name. DNS-SD TXT keys are usually
- * 8 characters or less. To hold the maximum possible
- * key name, the buffer should be 256 bytes long.
- *
- * valueLen: On output, will be set to the size of the "value" data.
- *
- * value: On output, *value is set to point to location within TXT
- * Record bytes that holds the value data.
- *
- * return value: Returns kDNSServiceErr_NoError on success.
- * Returns kDNSServiceErr_NoMemory if keyBufLen is too short.
- * Returns kDNSServiceErr_Invalid if index is greater than
- * TXTRecordGetCount()-1.
- */
-
-DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex
- (
- uint16_t txtLen,
- const void *txtRecord,
- uint16_t index,
- uint16_t keyBufLen,
- char *key,
- uint8_t *valueLen,
- const void **value
- );
-
-#ifdef __APPLE_API_PRIVATE
-
-/*
- * Mac OS X specific functionality
- * 3rd party clients of this API should not depend on future support or availability of this routine
- */
-
-/* DNSServiceSetDefaultDomainForUser()
- *
- * Set the default domain for the caller's UID. Future browse and registration
- * calls by this user that do not specify an explicit domain will browse and
- * register in this wide-area domain in addition to .local. In addition, this
- * domain will be returned as a Browse domain via domain enumeration calls.
- *
- *
- * Parameters:
- *
- * flags: Pass kDNSServiceFlagsAdd to add a domain for a user. Call without
- * this flag set to clear a previously added domain.
- *
- * domain: The domain to be used for the caller's UID.
- *
- * return value: Returns kDNSServiceErr_NoError on succeses, otherwise returns
- * an error code indicating the error that occurred
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser
- (
- DNSServiceFlags flags,
- const char *domain
- );
-
-#endif //__APPLE_API_PRIVATE
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _DNS_SD_H */
diff --git a/release-0.6.9/avahi-compat-libdns_sd/funcs.txt b/release-0.6.9/avahi-compat-libdns_sd/funcs.txt
deleted file mode 100644
index a584b4e..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/funcs.txt
+++ /dev/null
@@ -1,37 +0,0 @@
--- Supported --
-
-DNSServiceRefSockFD
-DNSServiceProcessResult
-DNSServiceRefDeallocate
-DNSServiceEnumerateDomains
-DNSServiceRegister
-DNSServiceBrowse
-DNSServiceResolve
-DNSServiceConstructFullName
-
-TXTRecordCreate
-TXTRecordDeallocate
-TXTRecordSetValue
-TXTRecordRemoveValue
-TXTRecordGetLength
-TXTRecordGetBytesPtr
-TXTRecordContainsKey
-TXTRecordGetValuePtr
-TXTRecordGetCount
-TXTRecordGetItemAtIndex
-
--- Unsupported but Relevant --
-
-DNSServiceRegisterRecord
-DNSServiceQueryRecord
-DNSServiceReconfirmRecord
-DNSServiceCreateConnection
-DNSServiceAddRecord
-DNSServiceUpdateRecord
-DNSServiceRemoveRecord
-
--- Unsupported and Irrelevant --
-
-DNSServiceSetDefaultDomainForUser
-
-$Id$
diff --git a/release-0.6.9/avahi-compat-libdns_sd/txt-test.c b/release-0.6.9/avahi-compat-libdns_sd/txt-test.c
deleted file mode 100644
index 5999dd4..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/txt-test.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include "dns_sd.h"
-
-static void hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %u bytes from %p:\n", size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- const char *r;
- TXTRecordRef ref;
- uint8_t l;
- const void *p;
- char k[256];
-
- TXTRecordCreate(&ref, 0, NULL);
-
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "foo", 7, "lennart");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "waldo", 5, "rocks");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "quux", 9, "the_house");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "yeah", 0, NULL);
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "waldo", 6, "rocked");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordRemoveValue(&ref, "foo");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordRemoveValue(&ref, "waldo");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "kawumm", 6, "bloerb");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "one", 1, "1");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "two", 1, "2");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "three", 1, "3");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- assert(TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "two"));
- assert(!TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "four"));
-
- r = TXTRecordGetValuePtr(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "kawumm", &l);
-
- hexdump(r, l);
-
- assert(TXTRecordGetCount(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref)) == 6);
-
- TXTRecordGetItemAtIndex(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), 2, sizeof(k), k, &l, &p);
-
- fprintf(stderr, "key=<%s>\n", k);
-
- hexdump(p, l);
-
- assert(TXTRecordGetItemAtIndex(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), 20, sizeof(k), k, &l, &p) == kDNSServiceErr_Invalid);
-
- TXTRecordDeallocate(&ref);
-}
diff --git a/release-0.6.9/avahi-compat-libdns_sd/txt.c b/release-0.6.9/avahi-compat-libdns_sd/txt.c
deleted file mode 100644
index c85837a..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/txt.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-
-#include "dns_sd.h"
-#include "warn.h"
-
-typedef struct TXTRecordInternal {
- uint8_t *buffer, *malloc_buffer;
- size_t size, max_size;
-} TXTRecordInternal;
-
-#define INTERNAL_PTR(txtref) (* (TXTRecordInternal**) (txtref))
-#define INTERNAL_PTR_CONST(txtref) (* (const TXTRecordInternal* const *) (txtref))
-
-void DNSSD_API TXTRecordCreate(
- TXTRecordRef *txtref,
- uint16_t length,
- void *buffer) {
-
- TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
-
- /* Apple's API design is flawed in so many ways, including the
- * fact that it isn't compatible with 64 bit processors. To work
- * around this we need some magic here which involves allocating
- * our own memory. Please, Apple, do your homework next time
- * before designing an API! */
-
- if ((t = avahi_new(TXTRecordInternal, 1))) {
- t->buffer = buffer;
- t->max_size = length;
- t->size = 0;
- t->malloc_buffer = NULL;
- }
-
- /* If we were unable to allocate memory, we store a NULL pointer
- * and return a NoMemory error later, is somewhat unclean, but
- * should work. */
- INTERNAL_PTR(txtref) = t;
-}
-
-void DNSSD_API TXTRecordDeallocate(TXTRecordRef *txtref) {
- TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
- t = INTERNAL_PTR(txtref);
- if (!t)
- return;
-
- avahi_free(t->malloc_buffer);
- avahi_free(t);
-
- /* Just in case ... */
- INTERNAL_PTR(txtref) = NULL;
-}
-
-static int make_sure_fits_in(TXTRecordInternal *t, size_t size) {
- uint8_t *n;
- size_t nsize;
-
- assert(t);
-
- if (t->size + size <= t->max_size)
- return 0;
-
- nsize = t->size + size + 100;
-
- if (nsize > 0xFFFF)
- return -1;
-
- if (!(n = avahi_realloc(t->malloc_buffer, nsize)))
- return -1;
-
- if (!t->malloc_buffer && t->size)
- memcpy(n, t->buffer, t->size);
-
- t->buffer = t->malloc_buffer = n;
- t->max_size = nsize;
-
- return 0;
-}
-
-static int remove_key(TXTRecordInternal *t, const char *key) {
- size_t i;
- uint8_t *p;
- size_t key_len;
- int found = 0;
-
- key_len = strlen(key);
- assert(key_len <= 0xFF);
-
- p = t->buffer;
- i = 0;
-
- while (i < t->size) {
-
- /* Does the item fit in? */
- assert(*p <= t->size - i - 1);
-
- /* Key longer than buffer */
- if (key_len > t->size - i - 1)
- break;
-
- if (key_len <= *p &&
- strncmp(key, (char*) p+1, key_len) == 0 &&
- (key_len == *p || p[1+key_len] == '=')) {
-
- uint8_t s;
-
- /* Key matches, so let's remove it */
-
- s = *p;
- memmove(p, p + 1 + *p, t->size - i - *p -1);
- t->size -= s + 1;
-
- found = 1;
- } else {
- /* Skip to next */
-
- i += *p +1;
- p += *p +1;
- }
- }
-
- return found;
-}
-
-DNSServiceErrorType DNSSD_API TXTRecordSetValue(
- TXTRecordRef *txtref,
- const char *key,
- uint8_t length,
- const void *value) {
-
- TXTRecordInternal *t;
- uint8_t *p;
- size_t l, n;
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
- assert(txtref);
-
- l = strlen(key);
-
- if (*key == 0 || strchr(key, '=') || l > 0xFF) /* Empty or invalid key */
- return kDNSServiceErr_Invalid;
-
- if (!(t = INTERNAL_PTR(txtref)))
- return kDNSServiceErr_NoMemory;
-
- n = l + (value ? length + 1 : 0);
-
- if (n > 0xFF)
- return kDNSServiceErr_Invalid;
-
- if (make_sure_fits_in(t, 1 + n) < 0)
- return kDNSServiceErr_NoMemory;
-
- remove_key(t, key);
-
- p = t->buffer + t->size;
-
- *(p++) = (uint8_t) n;
- t->size ++;
-
- memcpy(p, key, l);
- p += l;
- t->size += l;
-
- if (value) {
- *(p++) = '=';
- memcpy(p, value, length);
- t->size += length + 1;
- }
-
- assert(t->size <= t->max_size);
-
- return kDNSServiceErr_NoError;
-}
-
-DNSServiceErrorType DNSSD_API TXTRecordRemoveValue(TXTRecordRef *txtref, const char *key) {
- TXTRecordInternal *t;
- int found;
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
- assert(txtref);
-
- if (*key == 0 || strchr(key, '=') || strlen(key) > 0xFF) /* Empty or invalid key */
- return kDNSServiceErr_Invalid;
-
- if (!(t = INTERNAL_PTR(txtref)))
- return kDNSServiceErr_NoError;
-
- found = remove_key(t, key);
-
- return found ? kDNSServiceErr_NoError : kDNSServiceErr_NoSuchKey;
-}
-
-uint16_t DNSSD_API TXTRecordGetLength(const TXTRecordRef *txtref) {
- const TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
-
- if (!(t = INTERNAL_PTR_CONST(txtref)))
- return 0;
-
- assert(t->size <= 0xFFFF);
- return (uint16_t) t->size;
-}
-
-const void * DNSSD_API TXTRecordGetBytesPtr(const TXTRecordRef *txtref) {
- const TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
-
- if (!(t = INTERNAL_PTR_CONST(txtref)) || !t->buffer)
- return "";
-
- return t->buffer;
-}
-
-static const uint8_t *find_key(const uint8_t *buffer, size_t size, const char *key) {
- size_t i;
- const uint8_t *p;
- size_t key_len;
-
- key_len = strlen(key);
-
- assert(key_len <= 0xFF);
-
- p = buffer;
- i = 0;
-
- while (i < size) {
-
- /* Does the item fit in? */
- if (*p > size - i - 1)
- return NULL;
-
- /* Key longer than buffer */
- if (key_len > size - i - 1)
- return NULL;
-
- if (key_len <= *p &&
- strncmp(key, (const char*) p+1, key_len) == 0 &&
- (key_len == *p || p[1+key_len] == '=')) {
-
- /* Key matches, so let's return it */
-
- return p;
- }
-
- /* Skip to next */
- i += *p +1;
- p += *p +1;
- }
-
- return NULL;
-}
-
-int DNSSD_API TXTRecordContainsKey (
- uint16_t size,
- const void *buffer,
- const char *key) {
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
-
- if (!size)
- return 0;
-
- assert(buffer);
-
- if (!(find_key(buffer, size, key)))
- return 0;
-
- return 1;
-}
-
-const void * DNSSD_API TXTRecordGetValuePtr(
- uint16_t size,
- const void *buffer,
- const char *key,
- uint8_t *value_len) {
-
- const uint8_t *p;
- size_t n, l;
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
-
- if (!size)
- goto fail;
-
- if (*key == 0 || strchr(key, '=') || strlen(key) > 0xFF) /* Empty or invalid key */
- return NULL;
-
- assert(buffer);
-
- if (!(p = find_key(buffer, size, key)))
- goto fail;
-
- n = *p;
- l = strlen(key);
-
- assert(n >= l);
- p += 1 + l;
- n -= l;
-
- if (n <= 0)
- goto fail;
-
- assert(*p == '=');
- p++;
- n--;
-
- if (value_len)
- *value_len = n;
-
- return p;
-
-fail:
- if (value_len)
- *value_len = 0;
-
- return NULL;
-}
-
-
-uint16_t DNSSD_API TXTRecordGetCount(
- uint16_t size,
- const void *buffer) {
-
- const uint8_t *p;
- unsigned n = 0;
- size_t i;
-
- AVAHI_WARN_LINKAGE;
-
- if (!size)
- return 0;
-
- assert(buffer);
-
- p = buffer;
- i = 0;
-
- while (i < size) {
-
- /* Does the item fit in? */
- if (*p > size - i - 1)
- break;
-
- n++;
-
- /* Skip to next */
- i += *p +1;
- p += *p +1;
- }
-
- assert(n <= 0xFFFF);
-
- return (uint16_t) n;
-}
-
-DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex(
- uint16_t size,
- const void *buffer,
- uint16_t idx,
- uint16_t key_len,
- char *key,
- uint8_t *value_len,
- const void **value) {
-
- const uint8_t *p;
- size_t i;
- unsigned n = 0;
- DNSServiceErrorType ret = kDNSServiceErr_Invalid;
-
- AVAHI_WARN_LINKAGE;
-
- if (!size)
- goto fail;
-
- assert(buffer);
-
- p = buffer;
- i = 0;
-
- while (i < size) {
-
- /* Does the item fit in? */
- if (*p > size - i - 1)
- goto fail;
-
- if (n >= idx) {
- size_t l;
- const uint8_t *d;
-
- d = memchr(p+1, '=', *p);
-
- /* Length of key */
- l = d ? d - p - 1 : *p;
-
- if (key_len < l+1) {
- ret = kDNSServiceErr_NoMemory;
- goto fail;
- }
-
- strncpy(key, (const char*) p + 1, l);
- key[l] = 0;
-
- if (d) {
- if (value_len)
- *value_len = *p - l - 1;
-
- if (value)
- *value = d + 1;
- } else {
-
- if (value_len)
- *value_len = 0;
-
- if (value)
- *value = NULL;
- }
-
- return kDNSServiceErr_NoError;
- }
-
- n++;
-
- /* Skip to next */
- i += *p +1;
- p += *p +1;
- }
-
-
-fail:
-
- if (value)
- *value = NULL;
-
- if (value_len)
- *value_len = 0;
-
- return ret;
-
-}
diff --git a/release-0.6.9/avahi-compat-libdns_sd/unsupported.c b/release-0.6.9/avahi-compat-libdns_sd/unsupported.c
deleted file mode 100644
index 0e08ad6..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/unsupported.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/gccmacro.h>
-
-#include "dns_sd.h"
-#include "warn.h"
-
-DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord (
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef *RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint32_t interfaceIndex,
- AVAHI_GCC_UNUSED const char *fullname,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rrclass,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata,
- AVAHI_GCC_UNUSED uint32_t ttl,
- AVAHI_GCC_UNUSED DNSServiceRegisterRecordReply callBack,
- AVAHI_GCC_UNUSED void *context) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceQueryRecord (
- AVAHI_GCC_UNUSED DNSServiceRef *sdRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint32_t interfaceIndex,
- AVAHI_GCC_UNUSED const char *fullname,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rrclass,
- AVAHI_GCC_UNUSED DNSServiceQueryRecordReply callBack,
- AVAHI_GCC_UNUSED void *context) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-void DNSSD_API DNSServiceReconfirmRecord (
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint32_t interfaceIndex,
- AVAHI_GCC_UNUSED const char *fullname,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rrclass,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(AVAHI_GCC_UNUSED DNSServiceRef *sdRef) {
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceAddRecord(
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef *RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata,
- AVAHI_GCC_UNUSED uint32_t ttl) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata,
- AVAHI_GCC_UNUSED uint32_t ttl) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord(
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-
diff --git a/release-0.6.9/avahi-compat-libdns_sd/warn.c b/release-0.6.9/avahi-compat-libdns_sd/warn.c
deleted file mode 100644
index 13586ef..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/warn.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <unistd.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <syslog.h>
-
-#include "warn.h"
-
-#ifndef COMPAT_LAYER
-#define COMPAT_LAYER "Apple Bonjour"
-#endif
-
-#ifndef CGI_SUBSYSTEM
-#define CGI_SUBSYSTEM "libdns_sd"
-#endif
-
-static pthread_mutex_t linkage_mutex = PTHREAD_MUTEX_INITIALIZER;
-static int linkage_warning = 0;
-
-const char *avahi_exe_name(void) {
-#ifdef HAVE_GETPROGNAME
- return getprogname();
-#elif defined(__linux__)
- static char exe_name[1024] = "";
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
- /* Yes, I know, this is not portable. But who cares? It's for
- * cosmetics only, anyway. */
-
- pthread_mutex_lock(&mutex);
-
- if (exe_name[0] == 0) {
- int k;
-
- if ((k = readlink("/proc/self/exe", exe_name, sizeof(exe_name)-1)) < 0)
- snprintf(exe_name, sizeof(exe_name), "(unknown)");
- else {
- char *slash;
-
- assert((size_t) k <= sizeof(exe_name)-1);
- exe_name[k] = 0;
-
- if ((slash = strrchr(exe_name, '/')))
- memmove(exe_name, slash+1, strlen(slash)+1);
- }
- }
-
- pthread_mutex_unlock(&mutex);
-
- return exe_name;
-#else
-#ifdef __GNUC__
-#warning "avahi_exe_name() needs to be implemented for your operating system"
-#endif
- return "(unknown)";
-#endif
-}
-
-void avahi_warn(const char *fmt, ...) {
- char msg[512] = "*** WARNING *** ";
- va_list ap;
- size_t n;
-
- assert(fmt);
-
- va_start(ap, fmt);
- n = strlen(msg);
- vsnprintf(msg + n, sizeof(msg) - n, fmt, ap);
- va_end(ap);
-
- fprintf(stderr, "%s\n", msg);
-
- openlog(avahi_exe_name(), LOG_PID, LOG_USER);
- syslog(LOG_WARNING, "%s", msg);
- closelog();
-}
-
-void avahi_warn_linkage(void) {
- int w;
-
- pthread_mutex_lock(&linkage_mutex);
- w = linkage_warning;
- linkage_warning = 1;
- pthread_mutex_unlock(&linkage_mutex);
-
- if (!w && !getenv("AVAHI_COMPAT_NOWARN")) {
- avahi_warn("The programme '%s' uses the "COMPAT_LAYER" compatiblity layer of Avahi.", avahi_exe_name());
- avahi_warn("Please fix your application to use the native API of Avahi!");
- avahi_warn("For more information see <http://0pointer.de/avahi-compat?s="CGI_SUBSYSTEM"&e=%s>", avahi_exe_name());
- }
-}
-
-void avahi_warn_unsupported(const char *function) {
- avahi_warn("The programme '%s' called '%s()' which is not supported (or only supported partially) in the "COMPAT_LAYER" compatiblity layer of Avahi.", avahi_exe_name(), function);
- avahi_warn("Please fix your application to use the native API of Avahi!");
- avahi_warn("For more information see <http://0pointer.de/avahi-compat?s="CGI_SUBSYSTEM"&e=%s&f=%s>", avahi_exe_name(), function);
-}
diff --git a/release-0.6.9/avahi-compat-libdns_sd/warn.h b/release-0.6.9/avahi-compat-libdns_sd/warn.h
deleted file mode 100644
index da64fab..0000000
--- a/release-0.6.9/avahi-compat-libdns_sd/warn.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef foowarnhfoo
-#define foowarnhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/* This routine works on Linux only, so don't rely on it */
-const char *avahi_exe_name(void);
-
-void avahi_warn_unsupported(const char *function);
-
-void avahi_warn_linkage(void);
-
-void avahi_warn(const char *fmt, ...);
-
-#define AVAHI_WARN_LINKAGE do { avahi_warn_linkage(); } while(0)
-#define AVAHI_WARN_UNSUPPORTED do { avahi_warn_linkage(); avahi_warn_unsupported(__FUNCTION__); } while(0)
-#define AVAHI_WARN_UNSUPPORTED_ABORT do { AVAHI_WARN_UNSUPPORTED; abort(); } while(0)
-
-#endif
diff --git a/release-0.6.9/avahi-core.pc.in b/release-0.6.9/avahi-core.pc.in
deleted file mode 100644
index 52491b4..0000000
--- a/release-0.6.9/avahi-core.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-core
-Description: Avahi Multicast DNS Responder (Embeddable Stack)
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lavahi-common -lavahi-core
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/release-0.6.9/avahi-core/Makefile.am b/release-0.6.9/avahi-core/Makefile.am
deleted file mode 100644
index cb2d8f9..0000000
--- a/release-0.6.9/avahi-core/Makefile.am
+++ /dev/null
@@ -1,160 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-avahiincludedir=$(includedir)/avahi-core
-
-avahiinclude_HEADERS = \
- core.h \
- log.h \
- rr.h \
- publish.h \
- lookup.h
-
-lib_LTLIBRARIES = \
- libavahi-core.la
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- prioq-test \
- avahi-test \
- conformance-test \
- avahi-reflector \
- dns-test \
- timeeventq-test \
- hashmap-test \
- querier-test \
- update-test
-endif
-
-libavahi_core_la_SOURCES = \
- timeeventq.c timeeventq.h\
- iface.c iface.h \
- server.c internal.h entry.c \
- prioq.c prioq.h \
- cache.c cache.h \
- socket.c socket.h \
- response-sched.c response-sched.h \
- query-sched.c query-sched.h \
- probe-sched.c probe-sched.h \
- announce.c announce.h \
- browse.c browse.h \
- rrlist.c rrlist.h \
- resolve-host-name.c \
- resolve-address.c \
- browse-domain.c \
- browse-service-type.c \
- browse-service.c \
- resolve-service.c \
- dns.c dns.h \
- rr.c rr.h rr-util.h \
- core.h lookup.h publish.h \
- log.c log.h \
- browse-dns-server.c \
- fdutil.h fdutil.c \
- util.c util.h \
- hashmap.c hashmap.h \
- wide-area.c wide-area.h \
- multicast-lookup.c multicast-lookup.h \
- querier.c querier.h \
- addr-util.h addr-util.c \
- domain-util.h domain-util.c \
- dns-srv-rr.h
-
-if HAVE_NETLINK
-libavahi_core_la_SOURCES += \
- iface-linux.c iface-linux.h \
- netlink.c netlink.h
-else
-if HAVE_PF_ROUTE
-libavahi_core_la_SOURCES += \
- iface-pfroute.c iface-pfroute.h
-endif
-endif
-
-libavahi_core_la_CFLAGS = $(AM_CFLAGS)
-libavahi_core_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-libavahi_core_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_CORE_VERSION_INFO)
-
-prioq_test_SOURCES = \
- prioq-test.c \
- prioq.c prioq.h
-prioq_test_CFLAGS = $(AM_CFLAGS)
-prioq_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-avahi_test_SOURCES = \
- avahi-test.c
-avahi_test_CFLAGS = $(AM_CFLAGS)
-avahi_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-update_test_SOURCES = \
- update-test.c
-update_test_CFLAGS = $(AM_CFLAGS)
-update_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-querier_test_SOURCES = \
- querier-test.c
-querier_test_CFLAGS = $(AM_CFLAGS)
-querier_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-conformance_test_SOURCES = \
- conformance-test.c
-conformance_test_CFLAGS = $(AM_CFLAGS)
-conformance_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-avahi_reflector_SOURCES = \
- avahi-reflector.c
-avahi_reflector_CFLAGS = $(AM_CFLAGS)
-avahi_reflector_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-dns_test_SOURCES = \
- dns.c dns.h \
- dns-test.c \
- log.c log.h \
- util.c util.h \
- rr.c rr.h \
- hashmap.c hashmap.h \
- domain-util.c domain-util.h
-dns_test_CFLAGS = $(AM_CFLAGS)
-dns_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-timeeventq_test_SOURCES = \
- timeeventq-test.c \
- timeeventq.h timeeventq.c \
- prioq.h prioq.c \
- log.c log.h
-timeeventq_test_CFLAGS = $(AM_CFLAGS)
-timeeventq_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-hashmap_test_SOURCES = \
- hashmap-test.c \
- hashmap.h hashmap.c \
- util.h util.c
-hashmap_test_CFLAGS = $(AM_CFLAGS)
-hashmap_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-valgrind: avahi-test
- libtool --mode=execute valgrind ./avahi-test
-
-gdb: avahi-test
- libtool --mode=execute gdb ./avahi-test
diff --git a/release-0.6.9/avahi-core/addr-util.c b/release-0.6.9/avahi-core/addr-util.c
deleted file mode 100644
index 9e2d1e9..0000000
--- a/release-0.6.9/avahi-core/addr-util.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <assert.h>
-
-#include "addr-util.h"
-
-AvahiAddress *avahi_address_from_sockaddr(const struct sockaddr* sa, AvahiAddress *ret_addr) {
- assert(sa);
- assert(ret_addr);
-
- assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6);
-
- ret_addr->proto = avahi_af_to_proto(sa->sa_family);
-
- if (sa->sa_family == AF_INET)
- memcpy(&ret_addr->data.ipv4, &((const struct sockaddr_in*) sa)->sin_addr, sizeof(ret_addr->data.ipv4));
- else
- memcpy(&ret_addr->data.ipv6, &((const struct sockaddr_in6*) sa)->sin6_addr, sizeof(ret_addr->data.ipv6));
-
- return ret_addr;
-}
-
-uint16_t avahi_port_from_sockaddr(const struct sockaddr* sa) {
- assert(sa);
-
- assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6);
-
- if (sa->sa_family == AF_INET)
- return ntohs(((const struct sockaddr_in*) sa)->sin_port);
- else
- return ntohs(((const struct sockaddr_in6*) sa)->sin6_port);
-}
-
-int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a) {
-
- static const uint8_t ipv4_in_ipv6[] = {
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF
- };
-
- assert(a);
-
- if (a->proto != AVAHI_PROTO_INET6)
- return 0;
-
- return memcmp(a->data.ipv6.address, ipv4_in_ipv6, sizeof(ipv4_in_ipv6)) == 0;
-}
-
-
-
diff --git a/release-0.6.9/avahi-core/addr-util.h b/release-0.6.9/avahi-core/addr-util.h
deleted file mode 100644
index 4134de1..0000000
--- a/release-0.6.9/avahi-core/addr-util.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef fooaddrutilhfoo
-#define fooaddrutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-#include <sys/socket.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Make an address structture of a sockaddr structure */
-AvahiAddress *avahi_address_from_sockaddr(const struct sockaddr* sa, AvahiAddress *ret_addr);
-
-/** Return the port number of a sockaddr structure (either IPv4 or IPv6) */
-uint16_t avahi_port_from_sockaddr(const struct sockaddr* sa);
-
-/** Check whether the specified IPv6 address is in fact an
- * encapsulated IPv4 address, returns 1 if yes, 0 otherwise */
-int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/announce.c b/release-0.6.9/avahi-core/announce.c
deleted file mode 100644
index 4a87e1d..0000000
--- a/release-0.6.9/avahi-core/announce.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "announce.h"
-#include "log.h"
-#include "rr-util.h"
-
-#define AVAHI_ANNOUNCEMENT_JITTER_MSEC 250
-#define AVAHI_PROBE_JITTER_MSEC 250
-#define AVAHI_PROBE_INTERVAL_MSEC 250
-
-static void remove_announcer(AvahiServer *s, AvahiAnnouncer *a) {
- assert(s);
- assert(a);
-
- if (a->time_event)
- avahi_time_event_free(a->time_event);
-
- AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_interface, a->interface->announcers, a);
- AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_entry, a->entry->announcers, a);
-
- avahi_free(a);
-}
-
-static void elapse_announce(AvahiTimeEvent *e, void *userdata);
-
-static void set_timeout(AvahiAnnouncer *a, const struct timeval *tv) {
- assert(a);
-
- if (!tv) {
- if (a->time_event) {
- avahi_time_event_free(a->time_event);
- a->time_event = NULL;
- }
- } else {
-
- if (a->time_event)
- avahi_time_event_update(a->time_event, tv);
- else
- a->time_event = avahi_time_event_new(a->server->time_event_queue, tv, elapse_announce, a);
- }
-}
-
-static void next_state(AvahiAnnouncer *a);
-
-void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) {
- AvahiEntry *e;
- assert(g);
- assert(!g->dead);
-
- /* Check whether all group members have been probed */
-
- if (g->state != AVAHI_ENTRY_GROUP_REGISTERING || g->n_probing > 0)
- return;
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_ESTABLISHED);
-
- if (g->dead)
- return;
-
- for (e = g->entries; e; e = e->by_group_next) {
- AvahiAnnouncer *a;
-
- for (a = e->announcers; a; a = a->by_entry_next) {
-
- if (a->state != AVAHI_WAITING)
- continue;
-
- a->state = AVAHI_ANNOUNCING;
-
- if (immediately) {
- /* Shortcut */
-
- a->n_iteration = 1;
- next_state(a);
- } else {
- struct timeval tv;
- a->n_iteration = 0;
- avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC);
- set_timeout(a, &tv);
- }
- }
- }
-}
-
-static void next_state(AvahiAnnouncer *a) {
- assert(a);
-
- if (a->state == AVAHI_WAITING) {
-
- assert(a->entry->group);
-
- avahi_s_entry_group_check_probed(a->entry->group, 1);
-
- } else if (a->state == AVAHI_PROBING) {
-
- if (a->n_iteration >= 4) {
- /* Probing done */
-
- if (a->entry->group) {
- assert(a->entry->group->n_probing);
- a->entry->group->n_probing--;
- }
-
- if (a->entry->group && a->entry->group->state == AVAHI_ENTRY_GROUP_REGISTERING)
- a->state = AVAHI_WAITING;
- else {
- a->state = AVAHI_ANNOUNCING;
- a->n_iteration = 1;
- }
-
- set_timeout(a, NULL);
- next_state(a);
- } else {
- struct timeval tv;
-
- avahi_interface_post_probe(a->interface, a->entry->record, 0);
-
- avahi_elapse_time(&tv, AVAHI_PROBE_INTERVAL_MSEC, 0);
- set_timeout(a, &tv);
-
- a->n_iteration++;
- }
-
- } else if (a->state == AVAHI_ANNOUNCING) {
-
- if (a->entry->flags & AVAHI_PUBLISH_UNIQUE)
- /* Send the whole rrset at once */
- avahi_server_prepare_matching_responses(a->server, a->interface, a->entry->record->key, 0);
- else
- avahi_server_prepare_response(a->server, a->interface, a->entry, 0, 0);
-
- avahi_server_generate_response(a->server, a->interface, NULL, NULL, 0, 0, 0);
-
- if (++a->n_iteration >= 4) {
- /* Announcing done */
-
- a->state = AVAHI_ESTABLISHED;
-
- set_timeout(a, NULL);
- } else {
- struct timeval tv;
- avahi_elapse_time(&tv, a->sec_delay*1000, AVAHI_ANNOUNCEMENT_JITTER_MSEC);
-
- if (a->n_iteration < 10)
- a->sec_delay *= 2;
-
- set_timeout(a, &tv);
- }
- }
-}
-
-static void elapse_announce(AvahiTimeEvent *e, void *userdata) {
- assert(e);
-
- next_state(userdata);
-}
-
-static AvahiAnnouncer *get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
-
- for (a = e->announcers; a; a = a->by_entry_next)
- if (a->interface == i)
- return a;
-
- return NULL;
-}
-
-static void go_to_initial_state(AvahiAnnouncer *a) {
- AvahiEntry *e;
- struct timeval tv;
-
- assert(a);
- e = a->entry;
-
- if ((e->flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_NO_PROBE))
- a->state = AVAHI_PROBING;
- else if (!(e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)) {
-
- if (!e->group || e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED)
- a->state = AVAHI_ANNOUNCING;
- else
- a->state = AVAHI_WAITING;
-
- } else
- a->state = AVAHI_ESTABLISHED;
-
- a->n_iteration = 1;
- a->sec_delay = 1;
-
- if (a->state == AVAHI_PROBING && e->group)
- e->group->n_probing++;
-
- if (a->state == AVAHI_PROBING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_PROBE_JITTER_MSEC));
- else if (a->state == AVAHI_ANNOUNCING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
- else
- set_timeout(a, NULL);
-}
-
-static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- if (!avahi_interface_match(i, e->interface, e->protocol) || !i->announcing || !avahi_entry_is_commited(e))
- return;
-
- /* We don't want duplicate announcers */
- if (get_announcer(s, e, i))
- return;
-
- if ((!(a = avahi_new(AvahiAnnouncer, 1)))) {
- avahi_log_error(__FILE__": Out of memory.");
- return;
- }
-
- a->server = s;
- a->interface = i;
- a->entry = e;
- a->time_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_interface, i->announcers, a);
- AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_entry, e->announcers, a);
-
- go_to_initial_state(a);
-}
-
-void avahi_announce_interface(AvahiServer *s, AvahiInterface *i) {
- AvahiEntry *e;
-
- assert(s);
- assert(i);
-
- if (!i->announcing)
- return;
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead)
- new_announcer(s, i, e);
-}
-
-static void announce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- AvahiEntry *e = userdata;
-
- assert(m);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- new_announcer(m->server, i, e);
-}
-
-void avahi_announce_entry(AvahiServer *s, AvahiEntry *e) {
- assert(s);
- assert(e);
- assert(!e->dead);
-
- avahi_interface_monitor_walk(s->monitor, e->interface, e->protocol, announce_walk_callback, e);
-}
-
-void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g) {
- AvahiEntry *e;
-
- assert(s);
- assert(g);
-
- for (e = g->entries; e; e = e->by_group_next)
- if (!e->dead)
- avahi_announce_entry(s, e);
-}
-
-int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
- assert(!e->dead);
-
- if (!(a = get_announcer(s, e, i)))
- return 0;
-
- return
- a->state == AVAHI_ANNOUNCING ||
- a->state == AVAHI_ESTABLISHED ||
- (a->state == AVAHI_WAITING && !(e->flags & AVAHI_PUBLISH_UNIQUE));
-}
-
-int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
- assert(!e->dead);
-
- if (!(a = get_announcer(s, e, i)))
- return 0;
-
- return
- a->state == AVAHI_PROBING ||
- (a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE));
-}
-
-void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
-
- if (!(a = get_announcer(s, e, i)))
- return;
-
- if (a->state == AVAHI_PROBING && a->entry->group)
- a->entry->group->n_probing--;
-
- go_to_initial_state(a);
-}
-
-static AvahiRecord *make_goodbye_record(AvahiRecord *r) {
- AvahiRecord *g;
-
- assert(r);
-
- if (!(g = avahi_record_copy(r)))
- return NULL; /* OOM */
-
- assert(g->ref == 1);
- g->ttl = 0;
-
- return g;
-}
-
-static int is_duplicate_entry(AvahiServer *s, AvahiEntry *e) {
- AvahiEntry *i;
-
- assert(s);
- assert(e);
-
- for (i = avahi_hashmap_lookup(s->entries_by_key, e->record->key); i; i = i->by_key_next) {
-
- if (i == e)
- continue;
-
- if (!avahi_record_equal_no_ttl(i->record, e->record))
- continue;
-
- return 1;
- }
-
- return 0;
-}
-
-static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- AvahiEntry *e = userdata;
- AvahiRecord *g;
-
- assert(m);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- if (!avahi_interface_match(i, e->interface, e->protocol))
- return;
-
- if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)
- return;
-
- if (!avahi_entry_is_registered(m->server, e, i))
- return;
-
- if (is_duplicate_entry(m->server, e))
- return;
-
- if (!(g = make_goodbye_record(e->record)))
- return; /* OOM */
-
- avahi_interface_post_response(i, g, e->flags & AVAHI_PUBLISH_UNIQUE, NULL, 1);
- avahi_record_unref(g);
-}
-
-static void reannounce(AvahiAnnouncer *a) {
- AvahiEntry *e;
- struct timeval tv;
-
- assert(a);
- e = a->entry;
-
- /* If the group this entry belongs to is not even commited, there's nothing to reannounce */
- if (e->group && (e->group->state == AVAHI_ENTRY_GROUP_UNCOMMITED || e->group->state == AVAHI_ENTRY_GROUP_COLLISION))
- return;
-
- /* Because we might change state we decrease the probing counter first */
- if (a->state == AVAHI_PROBING && a->entry->group)
- a->entry->group->n_probing--;
-
- if (a->state == AVAHI_PROBING ||
- (a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_NO_PROBE)))
-
- /* We were probing or waiting after probe, so we restart probing from the beginning here */
-
- a->state = AVAHI_PROBING;
- else if (a->state == AVAHI_WAITING)
-
- /* We were waiting, but were not probing before, so we continue waiting */
- a->state = AVAHI_WAITING;
-
- else if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)
-
- /* No announcer needed */
- a->state = AVAHI_ESTABLISHED;
-
- else {
-
- /* Ok, let's restart announcing */
- a->state = AVAHI_ANNOUNCING;
- }
-
- /* Now let's increase the probing counter again */
- if (a->state == AVAHI_PROBING && e->group)
- e->group->n_probing++;
-
- a->n_iteration = 1;
- a->sec_delay = 1;
-
- if (a->state == AVAHI_PROBING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_PROBE_JITTER_MSEC));
- else if (a->state == AVAHI_ANNOUNCING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
- else
- set_timeout(a, NULL);
-}
-
-
-static void reannounce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- AvahiEntry *e = userdata;
- AvahiAnnouncer *a;
-
- assert(m);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- if (!(a = get_announcer(m->server, e, i)))
- return;
-
- reannounce(a);
-}
-
-void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e) {
-
- assert(s);
- assert(e);
- assert(!e->dead);
-
- avahi_interface_monitor_walk(s->monitor, e->interface, e->protocol, reannounce_walk_callback, e);
-}
-
-void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye, int remove) {
- assert(s);
- assert(i);
-
- if (send_goodbye)
- if (avahi_interface_is_relevant(i)) {
- AvahiEntry *e;
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead)
- send_goodbye_callback(s->monitor, i, e);
- }
-
- if (remove)
- while (i->announcers)
- remove_announcer(s, i->announcers);
-}
-
-void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int remove) {
- assert(s);
- assert(e);
-
- if (send_goodbye)
- if (!e->dead)
- avahi_interface_monitor_walk(s->monitor, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, send_goodbye_callback, e);
-
- if (remove)
- while (e->announcers)
- remove_announcer(s, e->announcers);
-}
-
diff --git a/release-0.6.9/avahi-core/announce.h b/release-0.6.9/avahi-core/announce.h
deleted file mode 100644
index 3a8bcf3..0000000
--- a/release-0.6.9/avahi-core/announce.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef fooannouncehfoo
-#define fooannouncehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiAnnouncer AvahiAnnouncer;
-
-#include <avahi-common/llist.h>
-#include "iface.h"
-#include "internal.h"
-#include "timeeventq.h"
-#include "publish.h"
-
-typedef enum {
- AVAHI_PROBING, /* probing phase */
- AVAHI_WAITING, /* wait for other records in group */
- AVAHI_ANNOUNCING, /* announcing phase */
- AVAHI_ESTABLISHED /* we'e established */
-} AvahiAnnouncerState;
-
-struct AvahiAnnouncer {
- AvahiServer *server;
- AvahiInterface *interface;
- AvahiEntry *entry;
-
- AvahiTimeEvent *time_event;
-
- AvahiAnnouncerState state;
- unsigned n_iteration;
- unsigned sec_delay;
-
- AVAHI_LLIST_FIELDS(AvahiAnnouncer, by_interface);
- AVAHI_LLIST_FIELDS(AvahiAnnouncer, by_entry);
-};
-
-void avahi_announce_interface(AvahiServer *s, AvahiInterface *i);
-void avahi_announce_entry(AvahiServer *s, AvahiEntry *e);
-void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g);
-
-void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
-
-void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately);
-
-int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
-int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
-
-void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye, int rem);
-void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int rem);
-
-void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e);
-
-#endif
diff --git a/release-0.6.9/avahi-core/avahi-reflector.c b/release-0.6.9/avahi-core/avahi-reflector.c
deleted file mode 100644
index df5539f..0000000
--- a/release-0.6.9/avahi-core/avahi-reflector.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-core/core.h>
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiServer *server;
- AvahiServerConfig config;
- int error;
- AvahiSimplePoll *simple_poll;
-
- simple_poll = avahi_simple_poll_new();
-
- avahi_server_config_init(&config);
- config.publish_hinfo = 0;
- config.publish_addresses = 0;
- config.publish_workstation = 0;
- config.publish_domain = 0;
- config.use_ipv6 = 0;
- config.enable_reflector = 1;
-
- server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, NULL, NULL, &error);
- avahi_server_config_free(&config);
-
- for (;;)
- if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
- break;
-
- avahi_server_free(server);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/avahi-test.c b/release-0.6.9/avahi-core/avahi-test.c
deleted file mode 100644
index f540cf4..0000000
--- a/release-0.6.9/avahi-core/avahi-test.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/dns-srv-rr.h>
-
-static AvahiSEntryGroup *group = NULL;
-static AvahiServer *server = NULL;
-static char *service_name = NULL;
-
-static const AvahiPoll *poll_api;
-
-static void quit_timeout_callback(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata) {
- AvahiSimplePoll *simple_poll = userdata;
-
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
- printf("%s\n", text);
-}
-
-static void dump_timeout_callback(AvahiTimeout *timeout, void* userdata) {
- struct timeval tv;
-
- AvahiServer *avahi = userdata;
- avahi_server_dump(avahi, dump_line, NULL);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_update(timeout, &tv);
-}
-
-static const char *browser_event_to_string(AvahiBrowserEvent event) {
- switch (event) {
- case AVAHI_BROWSER_NEW : return "NEW";
- case AVAHI_BROWSER_REMOVE : return "REMOVE";
- case AVAHI_BROWSER_CACHE_EXHAUSTED : return "CACHE_EXHAUSTED";
- case AVAHI_BROWSER_ALL_FOR_NOW : return "ALL_FOR_NOW";
- case AVAHI_BROWSER_FAILURE : return "FAILURE";
- }
-
- abort();
-}
-
-static const char *resolver_event_to_string(AvahiResolverEvent event) {
- switch (event) {
- case AVAHI_RESOLVER_FOUND: return "FOUND";
- case AVAHI_RESOLVER_FAILURE: return "FAILURE";
- }
- abort();
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- char *t;
-
- assert(r);
-
- if (record) {
- avahi_log_debug("RB: record [%s] on %i.%i is %s", t = avahi_record_to_string(record), interface, protocol, browser_event_to_string(event));
- avahi_free(t);
- } else
- avahi_log_debug("RB: [%s]", browser_event_to_string(event));
-
-}
-
-static void remove_entries(void);
-static void create_entries(int new_name);
-
-static void entry_group_callback(AVAHI_GCC_UNUSED AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("entry group state: %i", state);
-
- if (state == AVAHI_ENTRY_GROUP_COLLISION) {
- remove_entries();
- create_entries(1);
- avahi_log_debug("Service name conflict, retrying with <%s>", service_name);
- } else if (state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
- avahi_log_debug("Service established under name <%s>", service_name);
- }
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
-
- server = s;
- avahi_log_debug("server state: %i", state);
-
- if (state == AVAHI_SERVER_RUNNING) {
- avahi_log_debug("Server startup complete. Host name is <%s>. Service cookie is %u", avahi_server_get_host_name_fqdn(s), avahi_server_get_local_service_cookie(s));
- create_entries(0);
- } else if (state == AVAHI_SERVER_COLLISION) {
- char *n;
- remove_entries();
-
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
-
- avahi_log_debug("Host name conflict, retrying with <%s>", n);
- avahi_server_set_host_name(s, n);
- avahi_free(n);
- }
-}
-
-static void remove_entries(void) {
- if (group)
- avahi_s_entry_group_reset(group);
-}
-
-static void create_entries(int new_name) {
- AvahiAddress a;
- AvahiRecord *r;
-
- remove_entries();
-
- if (!group)
- group = avahi_s_entry_group_new(server, entry_group_callback, NULL);
-
- assert(avahi_s_entry_group_is_empty(group));
-
- if (!service_name)
- service_name = avahi_strdup("Test Service");
- else if (new_name) {
- char *n = avahi_alternative_service_name(service_name);
- avahi_free(service_name);
- service_name = n;
- }
-
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, service_name, "_http._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
- avahi_log_error("Failed to add HTTP service");
- goto fail;
- }
-
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, service_name, "_ftp._tcp", NULL, NULL, 21, "foo", NULL) < 0) {
- avahi_log_error("Failed to add FTP service");
- goto fail;
- }
-
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0,service_name, "_webdav._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
- avahi_log_error("Failed to add WEBDAV service");
- goto fail;
- }
-
- if (avahi_server_add_dns_server_address(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, NULL, AVAHI_DNS_SERVER_RESOLVE, avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &a), 53) < 0) {
- avahi_log_error("Failed to add new DNS Server address");
- goto fail;
- }
-
- r = avahi_record_new_full("cname.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_CNAME, AVAHI_DEFAULT_TTL);
- r->data.cname.name = avahi_strdup("cocaine.local");
-
- if (avahi_server_add(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, r) < 0) {
- avahi_log_error("Failed to add CNAME record");
- goto fail;
- }
-
- avahi_s_entry_group_commit(group);
- return;
-
-fail:
- if (group)
- avahi_s_entry_group_free(group);
-
- group = NULL;
-}
-
-static void hnr_callback(
- AVAHI_GCC_UNUSED AvahiSHostNameResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *hostname,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- char t[AVAHI_ADDRESS_STR_MAX];
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
-
- avahi_log_debug("HNR: (%i.%i) <%s> -> %s [%s]", iface, protocol, hostname, a ? t : "n/a", resolver_event_to_string(event));
-}
-
-static void ar_callback(
- AVAHI_GCC_UNUSED AvahiSAddressResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *hostname,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- char t[AVAHI_ADDRESS_STR_MAX];
-
- avahi_address_snprint(t, sizeof(t), a);
-
- avahi_log_debug("AR: (%i.%i) %s -> <%s> [%s]", iface, protocol, t, hostname ? hostname : "n/a", resolver_event_to_string(event));
-}
-
-static void db_callback(
- AVAHI_GCC_UNUSED AvahiSDomainBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain, browser_event_to_string(event));
-}
-
-static void stb_callback(
- AVAHI_GCC_UNUSED AvahiSServiceTypeBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *service_type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type, domain, browser_event_to_string(event));
-}
-
-static void sb_callback(
- AVAHI_GCC_UNUSED AvahiSServiceBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *service_type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain, browser_event_to_string(event));
-}
-
-static void sr_callback(
- AVAHI_GCC_UNUSED AvahiSServiceResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char*service_type,
- const char*domain_name,
- const char*hostname,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- if (event != AVAHI_RESOLVER_FOUND)
- avahi_log_debug("SR: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain_name, resolver_event_to_string(event));
- else {
- char t[AVAHI_ADDRESS_STR_MAX], *s;
-
- avahi_address_snprint(t, sizeof(t), a);
-
- s = avahi_string_list_to_string(txt);
- avahi_log_debug("SR: (%i.%i) <%s> as %s in <%s>: %s/%s:%i (%s) [%s]", iface, protocol, name, service_type, domain_name, hostname, t, port, s, resolver_event_to_string(event));
- avahi_free(s);
- }
-}
-
-static void dsb_callback(
- AVAHI_GCC_UNUSED AvahiSDNSServerBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char*hostname,
- const AvahiAddress *a,
- uint16_t port,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- char t[AVAHI_ADDRESS_STR_MAX] = "n/a";
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
-
- avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname, t, port, browser_event_to_string(event));
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiSRecordBrowser *r;
- AvahiSHostNameResolver *hnr;
- AvahiSAddressResolver *ar;
- AvahiKey *k;
- AvahiServerConfig config;
- AvahiAddress a;
- AvahiSDomainBrowser *db;
- AvahiSServiceTypeBrowser *stb;
- AvahiSServiceBrowser *sb;
- AvahiSServiceResolver *sr;
- AvahiSDNSServerBrowser *dsb;
- AvahiSimplePoll *simple_poll;
- int error;
- struct timeval tv;
-
- simple_poll = avahi_simple_poll_new();
- poll_api = avahi_simple_poll_get(simple_poll);
-
- avahi_server_config_init(&config);
-
- avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
- config.n_wide_area_servers = 1;
- config.enable_wide_area = 1;
-
- server = avahi_server_new(poll_api, &config, server_callback, NULL, &error);
- avahi_server_config_free(&config);
-
- k = avahi_key_new("_http._tcp.0pointer.de", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR);
- r = avahi_s_record_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, k, 0, record_browser_callback, NULL);
- avahi_key_unref(k);
-
- hnr = avahi_s_host_name_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "cname.local", AVAHI_PROTO_UNSPEC, 0, hnr_callback, NULL);
-
- ar = avahi_s_address_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, avahi_address_parse("192.168.50.1", AVAHI_PROTO_INET, &a), 0, ar_callback, NULL);
-
- db = avahi_s_domain_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, db_callback, NULL);
-
- stb = avahi_s_service_type_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, 0, stb_callback, NULL);
-
- sb = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, sb_callback, NULL);
-
- sr = avahi_s_service_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "Ecstasy HTTP", "_http._tcp", "local", AVAHI_PROTO_UNSPEC, 0, sr_callback, NULL);
-
- dsb = avahi_s_dns_server_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "local", AVAHI_DNS_SERVER_RESOLVE, AVAHI_PROTO_UNSPEC, 0, dsb_callback, NULL);
-
- avahi_elapse_time(&tv, 1000*5, 0);
- poll_api->timeout_new(poll_api, &tv, dump_timeout_callback, server);
-
- avahi_elapse_time(&tv, 1000*60, 0);
- poll_api->timeout_new(poll_api, &tv, quit_timeout_callback, simple_poll);
-
- avahi_simple_poll_loop(simple_poll);
-
- avahi_s_record_browser_free(r);
- avahi_s_host_name_resolver_free(hnr);
- avahi_s_address_resolver_free(ar);
- avahi_s_service_type_browser_free(stb);
- avahi_s_service_browser_free(sb);
- avahi_s_service_resolver_free(sr);
- avahi_s_dns_server_browser_free(dsb);
-
- if (group)
- avahi_s_entry_group_free(group);
-
- if (server)
- avahi_server_free(server);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(service_name);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/browse-dns-server.c b/release-0.6.9/avahi-core/browse-dns-server.c
deleted file mode 100644
index 48d23ad..0000000
--- a/release-0.6.9/avahi-core/browse-dns-server.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-#include "rr.h"
-
-typedef struct AvahiDNSServerInfo AvahiDNSServerInfo;
-
-struct AvahiDNSServerInfo {
- AvahiSDNSServerBrowser *browser;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiRecord *srv_record;
- AvahiSHostNameResolver *host_name_resolver;
- AvahiAddress address;
- AvahiLookupResultFlags flags;
-
- AVAHI_LLIST_FIELDS(AvahiDNSServerInfo, info);
-};
-
-struct AvahiSDNSServerBrowser {
- AvahiServer *server;
-
- AvahiSRecordBrowser *record_browser;
- AvahiSDNSServerBrowserCallback callback;
- void* userdata;
- AvahiProtocol aprotocol;
- AvahiLookupFlags user_flags;
-
- unsigned n_info;
-
- AVAHI_LLIST_FIELDS(AvahiSDNSServerBrowser, browser);
- AVAHI_LLIST_HEAD(AvahiDNSServerInfo, info);
-};
-
-static AvahiDNSServerInfo* get_server_info(AvahiSDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r) {
- AvahiDNSServerInfo *i;
-
- assert(b);
- assert(r);
-
- for (i = b->info; i; i = i->info_next)
- if (i->interface == interface &&
- i->protocol == protocol &&
- avahi_record_equal_no_ttl(r, i->srv_record))
- return i;
-
- return NULL;
-}
-
-static void server_info_free(AvahiSDNSServerBrowser *b, AvahiDNSServerInfo *i) {
- assert(b);
- assert(i);
-
- avahi_record_unref(i->srv_record);
- if (i->host_name_resolver)
- avahi_s_host_name_resolver_free(i->host_name_resolver);
-
- AVAHI_LLIST_REMOVE(AvahiDNSServerInfo, info, b->info, i);
-
- assert(b->n_info >= 1);
- b->n_info--;
-
- avahi_free(i);
-}
-
-static void host_name_resolver_callback(
- AvahiSHostNameResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *host_name,
- const AvahiAddress *a,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiDNSServerInfo *i = userdata;
-
- assert(r);
- assert(host_name);
- assert(i);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- i->address = *a;
-
- i->browser->callback(
- i->browser,
- i->interface,
- i->protocol,
- AVAHI_BROWSER_NEW,
- i->srv_record->data.srv.name,
- &i->address,
- i->srv_record->data.srv.port,
- i->flags | flags,
- i->browser->userdata);
-
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
- /* Ignore */
- break;
- }
-
- avahi_s_host_name_resolver_free(i->host_name_resolver);
- i->host_name_resolver = NULL;
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSDNSServerBrowser *b = userdata;
-
- assert(rr);
- assert(b);
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- switch (event) {
- case AVAHI_BROWSER_NEW: {
- AvahiDNSServerInfo *i;
-
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_SRV);
-
- if (get_server_info(b, interface, protocol, record))
- return;
-
- if (b->n_info >= 10)
- return;
-
- if (!(i = avahi_new(AvahiDNSServerInfo, 1)))
- return; /* OOM */
-
- i->browser = b;
- i->interface = interface;
- i->protocol = protocol;
- i->srv_record = avahi_record_ref(record);
- i->host_name_resolver = avahi_s_host_name_resolver_new(
- b->server,
- interface, protocol,
- record->data.srv.name,
- b->aprotocol,
- b->user_flags,
- host_name_resolver_callback, i);
- i->flags = flags;
-
- AVAHI_LLIST_PREPEND(AvahiDNSServerInfo, info, b->info, i);
-
- b->n_info++;
- break;
- }
-
- case AVAHI_BROWSER_REMOVE: {
- AvahiDNSServerInfo *i;
-
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_SRV);
-
- if (!(i = get_server_info(b, interface, protocol, record)))
- return;
-
- if (!i->host_name_resolver)
- b->callback(
- b,
- interface,
- protocol,
- event,
- i->srv_record->data.srv.name,
- &i->address,
- i->srv_record->data.srv.port,
- i->flags | flags,
- b->userdata);
-
- server_info_free(b, i);
- break;
- }
-
- case AVAHI_BROWSER_FAILURE:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
-
- b->callback(
- b,
- interface,
- protocol,
- event,
- NULL,
- NULL,
- 0,
- flags,
- b->userdata);
-
- break;
- }
-}
-
-AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDNSServerType type,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiSDNSServerBrowserCallback callback,
- void* userdata) {
-
- static const char * const type_table[AVAHI_DNS_SERVER_MAX] = {
- "_domain._udp",
- "_dns-update._udp"
- };
-
- AvahiSDNSServerBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(aprotocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, type < AVAHI_DNS_SERVER_MAX, AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), NULL, type_table[type], domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSDNSServerBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->server = server;
- b->callback = callback;
- b->userdata = userdata;
- b->aprotocol = aprotocol;
- b->n_info = 0;
- b->user_flags = flags;
-
- AVAHI_LLIST_HEAD_INIT(AvahiDNSServerInfo, b->info);
- AVAHI_LLIST_PREPEND(AvahiSDNSServerBrowser, browser, server->dns_server_browsers, b);
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- return b;
-
-fail:
-
- if (k)
- avahi_key_unref(k);
-
- avahi_s_dns_server_browser_free(b);
- return NULL;
-}
-
-void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b) {
- assert(b);
-
- while (b->info)
- server_info_free(b, b->info);
-
- AVAHI_LLIST_REMOVE(AvahiSDNSServerBrowser, browser, b->server->dns_server_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- avahi_free(b);
-}
-
diff --git a/release-0.6.9/avahi-core/browse-domain.c b/release-0.6.9/avahi-core/browse-domain.c
deleted file mode 100644
index 0043806..0000000
--- a/release-0.6.9/avahi-core/browse-domain.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-struct AvahiSDomainBrowser {
- int ref;
-
- AvahiServer *server;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiDomainBrowserType type;
- AvahiSDomainBrowserCallback callback;
- void* userdata;
-
- AvahiTimeEvent *defer_event;
-
- int all_for_now_scheduled;
-
- AVAHI_LLIST_FIELDS(AvahiSDomainBrowser, browser);
-};
-
-static void inc_ref(AvahiSDomainBrowser *b) {
- assert(b);
- assert(b->ref >= 1);
-
- b->ref++;
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSDomainBrowser *b = userdata;
- char *n = NULL;
-
- assert(rr);
- assert(b);
-
- if (event == AVAHI_BROWSER_ALL_FOR_NOW &&
- b->defer_event) {
-
- b->all_for_now_scheduled = 1;
- return;
- }
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- if (record) {
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
- n = record->data.ptr.name;
-
- if (b->type == AVAHI_DOMAIN_BROWSER_BROWSE) {
- AvahiStringList *l;
-
- /* Filter out entries defined statically */
-
- for (l = b->server->config.browse_domains; l; l = l->next)
- if (avahi_domain_equal((char*) l->text, n))
- return;
- }
-
- }
-
- b->callback(b, interface, protocol, event, n, flags, b->userdata);
-}
-
-static void defer_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSDomainBrowser *b = userdata;
- AvahiStringList *l;
-
- assert(e);
- assert(b);
-
- assert(b->type == AVAHI_DOMAIN_BROWSER_BROWSE);
-
- avahi_time_event_free(b->defer_event);
- b->defer_event = NULL;
-
- /* Increase ref counter */
- inc_ref(b);
-
- for (l = b->server->config.browse_domains; l; l = l->next) {
-
- /* Check whether this object still exists outside our own
- * stack frame */
- if (b->ref <= 1)
- break;
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_NEW, (char*) l->text, AVAHI_LOOKUP_RESULT_STATIC, b->userdata);
- }
-
- if (b->ref > 1) {
- /* If the ALL_FOR_NOW event has already been scheduled, execute it now */
-
- if (b->all_for_now_scheduled)
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_ALL_FOR_NOW, NULL, 0, b->userdata);
- }
-
- /* Decrease ref counter */
- avahi_s_domain_browser_free(b);
-}
-
-AvahiSDomainBrowser *avahi_s_domain_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType type,
- AvahiLookupFlags flags,
- AvahiSDomainBrowserCallback callback,
- void* userdata) {
-
- static const char * const type_table[AVAHI_DOMAIN_BROWSER_MAX] = {
- "b",
- "db",
- "r",
- "dr",
- "lb"
- };
-
- AvahiSDomainBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, type < AVAHI_DOMAIN_BROWSER_MAX, AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), type_table[type], "_dns-sd._udp", domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSDomainBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->ref = 1;
- b->server = server;
- b->callback = callback;
- b->userdata = userdata;
- b->record_browser = NULL;
- b->type = type;
- b->all_for_now_scheduled = 0;
- b->defer_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSDomainBrowser, browser, server->domain_browsers, b);
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- if (type == AVAHI_DOMAIN_BROWSER_BROWSE && b->server->config.browse_domains)
- b->defer_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
-
- return b;
-
-fail:
-
- if (k)
- avahi_key_unref(k);
-
- avahi_s_domain_browser_free(b);
-
- return NULL;
-}
-
-void avahi_s_domain_browser_free(AvahiSDomainBrowser *b) {
- assert(b);
-
- assert(b->ref >= 1);
- if (--b->ref > 0)
- return;
-
- AVAHI_LLIST_REMOVE(AvahiSDomainBrowser, browser, b->server->domain_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- if (b->defer_event)
- avahi_time_event_free(b->defer_event);
-
- avahi_free(b);
-}
diff --git a/release-0.6.9/avahi-core/browse-service-type.c b/release-0.6.9/avahi-core/browse-service-type.c
deleted file mode 100644
index 252e3cb..0000000
--- a/release-0.6.9/avahi-core/browse-service-type.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-struct AvahiSServiceTypeBrowser {
- AvahiServer *server;
- char *domain_name;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiSServiceTypeBrowserCallback callback;
- void* userdata;
-
- AVAHI_LLIST_FIELDS(AvahiSServiceTypeBrowser, browser);
-};
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSServiceTypeBrowser *b = userdata;
-
- assert(rr);
- assert(b);
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- if (record) {
- char type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
-
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (avahi_service_name_split(record->data.ptr.name, NULL, 0, type, sizeof(type), domain, sizeof(domain)) < 0) {
- avahi_log_warn("Invalid service type '%s'", record->key->name);
- return;
- }
-
- b->callback(b, interface, protocol, event, type, domain, flags, b->userdata);
- } else
- b->callback(b, interface, protocol, event, NULL, b->domain_name, flags, b->userdata);
-}
-
-AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiSServiceTypeBrowserCallback callback,
- void* userdata) {
-
- AvahiSServiceTypeBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), NULL, "_services._dns-sd._udp", domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSServiceTypeBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->server = server;
- b->callback = callback;
- b->userdata = userdata;
- b->record_browser = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSServiceTypeBrowser, browser, server->service_type_browsers, b);
-
- if (!(b->domain_name = avahi_normalize_name_strdup(domain))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- return b;
-
-fail:
- if (k)
- avahi_key_unref(k);
-
- avahi_s_service_type_browser_free(b);
-
- return NULL;
-}
-
-void avahi_s_service_type_browser_free(AvahiSServiceTypeBrowser *b) {
- assert(b);
-
- AVAHI_LLIST_REMOVE(AvahiSServiceTypeBrowser, browser, b->server->service_type_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- avahi_free(b->domain_name);
- avahi_free(b);
-}
-
-
diff --git a/release-0.6.9/avahi-core/browse-service.c b/release-0.6.9/avahi-core/browse-service.c
deleted file mode 100644
index 43778dd..0000000
--- a/release-0.6.9/avahi-core/browse-service.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-struct AvahiSServiceBrowser {
- AvahiServer *server;
- char *domain_name;
- char *service_type;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiSServiceBrowserCallback callback;
- void* userdata;
-
- AVAHI_LLIST_FIELDS(AvahiSServiceBrowser, browser);
-};
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSServiceBrowser *b = userdata;
-
- assert(rr);
- assert(b);
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- if (record) {
- char service[AVAHI_LABEL_MAX], type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
-
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (event == AVAHI_BROWSER_NEW && avahi_server_is_service_local(b->server, interface, protocol, record->data.ptr.name))
- flags |= AVAHI_LOOKUP_RESULT_LOCAL;
-
- if (avahi_service_name_split(record->data.ptr.name, service, sizeof(service), type, sizeof(type), domain, sizeof(domain)) < 0) {
- avahi_log_warn("Failed to split '%s'", record->key->name);
- return;
- }
-
- b->callback(b, interface, protocol, event, service, type, domain, flags, b->userdata);
-
- } else
- b->callback(b, interface, protocol, event, NULL, b->service_type, b->domain_name, flags, b->userdata);
-
-}
-
-AvahiSServiceBrowser *avahi_s_service_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *service_type,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiSServiceBrowserCallback callback,
- void* userdata) {
-
- AvahiSServiceBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
- assert(service_type);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_is_valid_service_type_generic(service_type), AVAHI_ERR_INVALID_SERVICE_TYPE);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), NULL, service_type, domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSServiceBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->server = server;
- b->domain_name = b->service_type = NULL;
- b->callback = callback;
- b->userdata = userdata;
- b->record_browser = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSServiceBrowser, browser, server->service_browsers, b);
-
- if (!(b->domain_name = avahi_normalize_name_strdup(domain)) ||
- !(b->service_type = avahi_normalize_name_strdup(service_type))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- return b;
-
-fail:
-
- if (k)
- avahi_key_unref(k);
-
- avahi_s_service_browser_free(b);
- return NULL;
-}
-
-void avahi_s_service_browser_free(AvahiSServiceBrowser *b) {
- assert(b);
-
- AVAHI_LLIST_REMOVE(AvahiSServiceBrowser, browser, b->server->service_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- avahi_free(b->domain_name);
- avahi_free(b->service_type);
- avahi_free(b);
-}
diff --git a/release-0.6.9/avahi-core/browse.c b/release-0.6.9/avahi-core/browse.c
deleted file mode 100644
index dd4fe3c..0000000
--- a/release-0.6.9/avahi-core/browse.c
+++ /dev/null
@@ -1,614 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/rlist.h>
-#include <avahi-common/address.h>
-
-#include "browse.h"
-#include "log.h"
-#include "querier.h"
-#include "domain-util.h"
-#include "rr-util.h"
-
-#define AVAHI_LOOKUPS_PER_BROWSER_MAX 15
-
-struct AvahiSRBLookup {
- AvahiSRecordBrowser *record_browser;
-
- unsigned ref;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupFlags flags;
-
- AvahiKey *key;
-
- AvahiWideAreaLookup *wide_area;
- AvahiMulticastLookup *multicast;
-
- AvahiRList *cname_lookups;
-
- AVAHI_LLIST_FIELDS(AvahiSRBLookup, lookups);
-};
-
-static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r);
-static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r);
-
-static void transport_flags_from_domain(AvahiServer *s, AvahiLookupFlags *flags, const char *domain) {
- assert(flags);
- assert(domain);
-
- assert(!((*flags & AVAHI_LOOKUP_USE_MULTICAST) && (*flags & AVAHI_LOOKUP_USE_WIDE_AREA)));
-
- if (*flags & (AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_USE_WIDE_AREA))
- return;
-
- if (!s->wide_area_lookup_engine ||
- !avahi_wide_area_has_servers(s->wide_area_lookup_engine) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_LOCAL) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV4) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV6))
- *flags |= AVAHI_LOOKUP_USE_MULTICAST;
- else
- *flags |= AVAHI_LOOKUP_USE_WIDE_AREA;
-}
-
-static AvahiSRBLookup* lookup_new(
- AvahiSRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiLookupFlags flags,
- AvahiKey *key) {
-
- AvahiSRBLookup *l;
-
- assert(b);
- assert(AVAHI_IF_VALID(interface));
- assert(AVAHI_PROTO_VALID(protocol));
-
- if (b->n_lookups >= AVAHI_LOOKUPS_PER_BROWSER_MAX)
- /* We don't like cyclic CNAMEs */
- return NULL;
-
- if (!(l = avahi_new(AvahiSRBLookup, 1)))
- return NULL;
-
- l->ref = 1;
- l->record_browser = b;
- l->interface = interface;
- l->protocol = protocol;
- l->key = avahi_key_ref(key);
- l->wide_area = NULL;
- l->multicast = NULL;
- l->cname_lookups = NULL;
- l->flags = flags;
-
- transport_flags_from_domain(b->server, &l->flags, key->name);
-
- AVAHI_LLIST_PREPEND(AvahiSRBLookup, lookups, b->lookups, l);
-
- b->n_lookups ++;
-
- return l;
-}
-
-static void lookup_unref(AvahiSRBLookup *l) {
- assert(l);
- assert(l->ref >= 1);
-
- if (--l->ref >= 1)
- return;
-
- AVAHI_LLIST_REMOVE(AvahiSRBLookup, lookups, l->record_browser->lookups, l);
- l->record_browser->n_lookups --;
-
- if (l->wide_area) {
- avahi_wide_area_lookup_free(l->wide_area);
- l->wide_area = NULL;
- }
-
- if (l->multicast) {
- avahi_multicast_lookup_free(l->multicast);
- l->multicast = NULL;
- }
-
- while (l->cname_lookups) {
- lookup_unref(l->cname_lookups->data);
- l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, l->cname_lookups);
- }
-
- avahi_key_unref(l->key);
- avahi_free(l);
-}
-
-static AvahiSRBLookup* lookup_ref(AvahiSRBLookup *l) {
- assert(l);
- assert(l->ref >= 1);
-
- l->ref++;
- return l;
-}
-
-static AvahiSRBLookup *lookup_find(
- AvahiSRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiLookupFlags flags,
- AvahiKey *key) {
-
- AvahiSRBLookup *l;
-
- assert(b);
-
- for (l = b->lookups; l; l = l->lookups_next) {
-
- if ((l->interface == AVAHI_IF_UNSPEC || l->interface == interface) &&
- (l->interface == AVAHI_PROTO_UNSPEC || l->protocol == protocol) &&
- l->flags == flags &&
- avahi_key_equal(l->key, key))
-
- return l;
- }
-
- return NULL;
-}
-
-static void browser_cancel(AvahiSRecordBrowser *b) {
- assert(b);
-
- if (b->root_lookup) {
- lookup_unref(b->root_lookup);
- b->root_lookup = NULL;
- }
-
- if (b->defer_time_event) {
- avahi_time_event_free(b->defer_time_event);
- b->defer_time_event = NULL;
- }
-}
-
-
-static void lookup_wide_area_callback(
- AvahiWideAreaLookupEngine *e,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata) {
-
- AvahiSRBLookup *l = userdata;
- AvahiSRecordBrowser *b;
-
- assert(e);
- assert(l);
-
- b = l->record_browser;
-
- if (b->dead)
- return;
-
- lookup_ref(l);
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(r);
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
- r->key->type == AVAHI_DNS_TYPE_CNAME)
- /* It's a CNAME record, so let's follow it. We only follow it on wide area DNS! */
- lookup_handle_cname(l, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_USE_WIDE_AREA, r);
- else {
- /* It's a normal record, so let's call the user callback */
- assert(avahi_key_equal(r->key, l->key));
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, event, r, flags, b->userdata);
- }
- break;
-
- case AVAHI_BROWSER_REMOVE:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- /* Not defined for wide area DNS */
- abort();
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_FAILURE:
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, event, NULL, flags, b->userdata);
- break;
- }
-
- lookup_unref(l);
-
-}
-
-static void lookup_multicast_callback(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata) {
-
- AvahiSRBLookup *l = userdata;
- AvahiSRecordBrowser *b;
-
- assert(e);
- assert(l);
-
- b = l->record_browser;
-
- if (b->dead)
- return;
-
- lookup_ref(l);
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(r);
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
- r->key->type == AVAHI_DNS_TYPE_CNAME)
- /* It's a CNAME record, so let's follow it. We allow browsing on both multicast and wide area. */
- lookup_handle_cname(l, interface, protocol, b->flags, r);
- else {
- /* It's a normal record, so let's call the user callback */
-
- if (avahi_server_is_record_local(b->server, interface, protocol, r))
- flags |= AVAHI_LOOKUP_RESULT_LOCAL;
-
- b->callback(b, interface, protocol, event, r, flags, b->userdata);
- }
- break;
-
- case AVAHI_BROWSER_REMOVE:
- assert(r);
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
- r->key->type == AVAHI_DNS_TYPE_CNAME)
- /* It's a CNAME record, so let's drop that query! */
- lookup_drop_cname(l, interface, protocol, 0, r);
- else {
- /* It's a normal record, so let's call the user callback */
- assert(avahi_key_equal(b->key, l->key));
-
- b->callback(b, interface, protocol, event, r, flags, b->userdata);
- }
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, event, NULL, flags, b->userdata);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_FAILURE:
- /* Not defined for multicast DNS */
- abort();
-
- }
-
- lookup_unref(l);
-}
-
-static int lookup_start(AvahiSRBLookup *l) {
- assert(l);
-
- assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST));
- assert(!l->wide_area && !l->multicast);
-
- if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {
-
- if (!(l->wide_area = avahi_wide_area_lookup_new(l->record_browser->server->wide_area_lookup_engine, l->key, lookup_wide_area_callback, l)))
- return -1;
-
- } else {
- assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST);
-
- if (!(l->multicast = avahi_multicast_lookup_new(l->record_browser->server->multicast_lookup_engine, l->interface, l->protocol, l->key, lookup_multicast_callback, l)))
- return -1;
- }
-
- return 0;
-}
-
-static int lookup_scan_cache(AvahiSRBLookup *l) {
- int n = 0;
-
- assert(l);
-
- assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST));
-
-
- if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {
- n = (int) avahi_wide_area_scan_cache(l->record_browser->server->wide_area_lookup_engine, l->key, lookup_wide_area_callback, l);
-
- } else {
- assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST);
- n = (int) avahi_multicast_lookup_engine_scan_cache(l->record_browser->server->multicast_lookup_engine, l->interface, l->protocol, l->key, lookup_multicast_callback, l);
- }
-
- return n;
-}
-
-static AvahiSRBLookup* lookup_add(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiKey *key) {
- AvahiSRBLookup *l;
-
- assert(b);
- assert(!b->dead);
-
- if ((l = lookup_find(b, interface, protocol, flags, key)))
- return lookup_ref(l);
-
- if (!(l = lookup_new(b, interface, protocol, flags, key)))
- return NULL;
-
- return l;
-}
-
-static int lookup_go(AvahiSRBLookup *l) {
- int n = 0;
- assert(l);
-
- if (l->record_browser->dead)
- return 0;
-
- lookup_ref(l);
-
- /* Browse the cache for the root request */
- n = lookup_scan_cache(l);
-
- /* Start the lookup */
- if (!l->record_browser->dead && l->ref > 1) {
-
- if ((l->flags & AVAHI_LOOKUP_USE_MULTICAST) || n == 0)
- /* We do no start a query if the cache contained entries and we're on wide area */
-
- if (lookup_start(l) < 0)
- n = -1;
- }
-
- lookup_unref(l);
-
- return n;
-}
-
-static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
- AvahiKey *k;
- AvahiSRBLookup *n;
-
- assert(l);
- assert(r);
-
- assert(r->key->clazz == AVAHI_DNS_CLASS_IN);
- assert(r->key->type == AVAHI_DNS_TYPE_CNAME);
-
- k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type);
- n = lookup_add(l->record_browser, interface, protocol, flags, k);
- avahi_key_unref(k);
-
- if (!n) {
- avahi_log_debug(__FILE__": Failed to create SRBLookup.");
- return;
- }
-
- l->cname_lookups = avahi_rlist_prepend(l->cname_lookups, lookup_ref(n));
-
- lookup_go(n);
-}
-
-static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
- AvahiKey *k;
- AvahiSRBLookup *n = NULL;
- AvahiRList *rl;
-
- assert(r->key->clazz == AVAHI_DNS_CLASS_IN);
- assert(r->key->type == AVAHI_DNS_TYPE_CNAME);
-
- k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type);
-
- for (rl = l->cname_lookups; rl; rl = rl->rlist_next) {
- n = rl->data;
-
- assert(n);
-
- if ((n->interface == AVAHI_IF_UNSPEC || n->interface == interface) &&
- (n->interface == AVAHI_PROTO_UNSPEC || n->protocol == protocol) &&
- n->flags == flags &&
- avahi_key_equal(n->key, k))
- break;
- }
-
- avahi_key_unref(k);
-
- if (rl) {
- l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, rl);
- lookup_unref(n);
- }
-}
-
-static void defer_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
- AvahiSRecordBrowser *b = userdata;
- int n;
-
- assert(b);
- assert(!b->dead);
-
- /* Remove the defer timeout */
- if (b->defer_time_event) {
- avahi_time_event_free(b->defer_time_event);
- b->defer_time_event = NULL;
- }
-
- /* Create initial query */
- assert(!b->root_lookup);
- b->root_lookup = lookup_add(b, b->interface, b->protocol, b->flags, b->key);
- assert(b->root_lookup);
-
- n = lookup_go(b->root_lookup);
-
- if (b->dead)
- return;
-
- if (n < 0) {
- /* sending of the initial query failed */
-
- avahi_server_set_errno(b->server, AVAHI_ERR_FAILURE);
-
- b->callback(
- b, b->interface, b->protocol, AVAHI_BROWSER_FAILURE, NULL,
- b->flags & AVAHI_LOOKUP_USE_WIDE_AREA ? AVAHI_LOOKUP_RESULT_WIDE_AREA : AVAHI_LOOKUP_RESULT_MULTICAST,
- b->userdata);
-
- browser_cancel(b);
- return;
- }
-
- /* Tell the client that we're done with the cache */
- b->callback(
- b, b->interface, b->protocol, AVAHI_BROWSER_CACHE_EXHAUSTED, NULL,
- b->flags & AVAHI_LOOKUP_USE_WIDE_AREA ? AVAHI_LOOKUP_RESULT_WIDE_AREA : AVAHI_LOOKUP_RESULT_MULTICAST,
- b->userdata);
-
- if (!b->dead && b->root_lookup && b->root_lookup->flags & AVAHI_LOOKUP_USE_WIDE_AREA && n > 0) {
-
- /* If we do wide area lookups and the the cache contained
- * entries, we assume that it is complete, and tell the user
- * so by firing ALL_FOR_NOW. */
-
- b->callback(b, b->interface, b->protocol, AVAHI_BROWSER_ALL_FOR_NOW, NULL, AVAHI_LOOKUP_RESULT_WIDE_AREA, b->userdata);
- }
-}
-
-void avahi_s_record_browser_restart(AvahiSRecordBrowser *b) {
- assert(b);
- assert(!b->dead);
-
- browser_cancel(b);
-
- /* Request a new iteration of the cache scanning */
- if (!b->defer_time_event) {
- b->defer_time_event = avahi_time_event_new(b->server->time_event_queue, NULL, defer_callback, b);
- assert(b->defer_time_event);
- }
-}
-
-AvahiSRecordBrowser *avahi_s_record_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiKey *key,
- AvahiLookupFlags flags,
- AvahiSRecordBrowserCallback callback,
- void* userdata) {
-
- AvahiSRecordBrowser *b;
-
- assert(server);
- assert(key);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !avahi_key_is_pattern(key), AVAHI_ERR_IS_PATTERN);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_key_is_valid(key), AVAHI_ERR_INVALID_KEY);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !(flags & AVAHI_LOOKUP_USE_WIDE_AREA) || !(flags & AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!(b = avahi_new(AvahiSRecordBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->dead = 0;
- b->server = server;
- b->interface = interface;
- b->protocol = protocol;
- b->key = avahi_key_ref(key);
- b->flags = flags;
- b->callback = callback;
- b->userdata = userdata;
- b->n_lookups = 0;
- AVAHI_LLIST_HEAD_INIT(AvahiSRBLookup, b->lookups);
- b->root_lookup = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSRecordBrowser, browser, server->record_browsers, b);
-
- /* The currently cached entries are scanned a bit later, and than we will start querying, too */
- b->defer_time_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
- assert(b->defer_time_event);
-
- return b;
-}
-
-void avahi_s_record_browser_free(AvahiSRecordBrowser *b) {
- assert(b);
- assert(!b->dead);
-
- b->dead = 1;
- b->server->need_browser_cleanup = 1;
-
- browser_cancel(b);
-}
-
-void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b) {
- assert(b);
-
- browser_cancel(b);
-
- AVAHI_LLIST_REMOVE(AvahiSRecordBrowser, browser, b->server->record_browsers, b);
-
- avahi_key_unref(b->key);
-
- avahi_free(b);
-}
-
-void avahi_browser_cleanup(AvahiServer *server) {
- AvahiSRecordBrowser *b;
- AvahiSRecordBrowser *n;
-
- assert(server);
-
- while (server->need_browser_cleanup) {
- server->need_browser_cleanup = 0;
-
- for (b = server->record_browsers; b; b = n) {
- n = b->browser_next;
-
- if (b->dead)
- avahi_s_record_browser_destroy(b);
- }
- }
-
- if (server->wide_area_lookup_engine)
- avahi_wide_area_cleanup(server->wide_area_lookup_engine);
- avahi_multicast_lookup_engine_cleanup(server->multicast_lookup_engine);
-}
-
diff --git a/release-0.6.9/avahi-core/browse.h b/release-0.6.9/avahi-core/browse.h
deleted file mode 100644
index 36d4e2e..0000000
--- a/release-0.6.9/avahi-core/browse.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef foobrowsehfoo
-#define foobrowsehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/llist.h>
-
-#include "core.h"
-#include "timeeventq.h"
-#include "internal.h"
-#include "dns.h"
-#include "lookup.h"
-
-typedef struct AvahiSRBLookup AvahiSRBLookup;
-
-struct AvahiSRecordBrowser {
- AVAHI_LLIST_FIELDS(AvahiSRecordBrowser, browser);
- int dead;
- AvahiServer *server;
-
- AvahiKey *key;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupFlags flags;
-
- AvahiTimeEvent *defer_time_event;
-
- AvahiSRecordBrowserCallback callback;
- void* userdata;
-
- /* Lookup data */
- AVAHI_LLIST_HEAD(AvahiSRBLookup, lookups);
- unsigned n_lookups;
-
- AvahiSRBLookup *root_lookup;
-};
-
-void avahi_browser_cleanup(AvahiServer *server);
-
-void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b);
-void avahi_s_record_browser_restart(AvahiSRecordBrowser *b);
-
-#endif
diff --git a/release-0.6.9/avahi-core/cache.c b/release-0.6.9/avahi-core/cache.c
deleted file mode 100644
index 3a8f849..0000000
--- a/release-0.6.9/avahi-core/cache.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "cache.h"
-#include "log.h"
-#include "rr-util.h"
-
-#define AVAHI_CACHE_ENTRIES_MAX 500
-
-static void remove_entry(AvahiCache *c, AvahiCacheEntry *e) {
- AvahiCacheEntry *t;
-
- assert(c);
- assert(e);
-
-/* avahi_log_debug("removing from cache: %p %p", c, e); */
-
- /* Remove from hash table */
- t = avahi_hashmap_lookup(c->hashmap, e->record->key);
- AVAHI_LLIST_REMOVE(AvahiCacheEntry, by_key, t, e);
- if (t)
- avahi_hashmap_replace(c->hashmap, t->record->key, t);
- else
- avahi_hashmap_remove(c->hashmap, e->record->key);
-
- /* Remove from linked list */
- AVAHI_LLIST_REMOVE(AvahiCacheEntry, entry, c->entries, e);
-
- if (e->time_event)
- avahi_time_event_free(e->time_event);
-
- avahi_multicast_lookup_engine_notify(c->server->multicast_lookup_engine, c->interface, e->record, AVAHI_BROWSER_REMOVE);
-
- avahi_record_unref(e->record);
-
- avahi_free(e);
-
- assert(c->n_entries-- >= 1);
-}
-
-AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *iface) {
- AvahiCache *c;
- assert(server);
-
- if (!(c = avahi_new(AvahiCache, 1))) {
- avahi_log_error(__FILE__": Out of memory.");
- return NULL; /* OOM */
- }
-
- c->server = server;
- c->interface = iface;
-
- if (!(c->hashmap = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL))) {
- avahi_log_error(__FILE__": Out of memory.");
- avahi_free(c);
- return NULL; /* OOM */
- }
-
- AVAHI_LLIST_HEAD_INIT(AvahiCacheEntry, c->entries);
- c->n_entries = 0;
-
- c->last_rand_timestamp = 0;
-
- return c;
-}
-
-void avahi_cache_free(AvahiCache *c) {
- assert(c);
-
- while (c->entries)
- remove_entry(c, c->entries);
- assert(c->n_entries == 0);
-
- avahi_hashmap_free(c->hashmap);
-
- avahi_free(c);
-}
-
-static AvahiCacheEntry *lookup_key(AvahiCache *c, AvahiKey *k) {
- assert(c);
- assert(k);
-
- assert(!avahi_key_is_pattern(k));
-
- return avahi_hashmap_lookup(c->hashmap, k);
-}
-
-void* avahi_cache_walk(AvahiCache *c, AvahiKey *pattern, AvahiCacheWalkCallback cb, void* userdata) {
- void* ret;
-
- assert(c);
- assert(pattern);
- assert(cb);
-
- if (avahi_key_is_pattern(pattern)) {
- AvahiCacheEntry *e, *n;
-
- for (e = c->entries; e; e = n) {
- n = e->entry_next;
-
- if (avahi_key_pattern_match(pattern, e->record->key))
- if ((ret = cb(c, pattern, e, userdata)))
- return ret;
- }
-
- } else {
- AvahiCacheEntry *e, *n;
-
- for (e = lookup_key(c, pattern); e; e = n) {
- n = e->by_key_next;
-
- if ((ret = cb(c, pattern, e, userdata)))
- return ret;
- }
- }
-
- return NULL;
-}
-
-static void* lookup_record_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void *userdata) {
- assert(c);
- assert(pattern);
- assert(e);
-
- if (avahi_record_equal_no_ttl(e->record, userdata))
- return e;
-
- return NULL;
-}
-
-static AvahiCacheEntry *lookup_record(AvahiCache *c, AvahiRecord *r) {
- assert(c);
- assert(r);
-
- return avahi_cache_walk(c, r->key, lookup_record_callback, r);
-}
-
-static void next_expiry(AvahiCache *c, AvahiCacheEntry *e, unsigned percent);
-
-static void elapse_func(AvahiTimeEvent *t, void *userdata) {
- AvahiCacheEntry *e = userdata;
-/* char *txt; */
- unsigned percent = 0;
-
- assert(t);
- assert(e);
-
-/* txt = avahi_record_to_string(e->record); */
-
- switch (e->state) {
-
- case AVAHI_CACHE_EXPIRY_FINAL:
- case AVAHI_CACHE_POOF_FINAL:
- case AVAHI_CACHE_GOODBYE_FINAL:
- case AVAHI_CACHE_REPLACE_FINAL:
-
- remove_entry(e->cache, e);
-
- e = NULL;
-/* avahi_log_debug("Removing entry from cache due to expiration (%s)", txt); */
- break;
-
- case AVAHI_CACHE_VALID:
- case AVAHI_CACHE_POOF:
- e->state = AVAHI_CACHE_EXPIRY1;
- percent = 85;
- break;
-
- case AVAHI_CACHE_EXPIRY1:
- e->state = AVAHI_CACHE_EXPIRY2;
- percent = 90;
- break;
- case AVAHI_CACHE_EXPIRY2:
- e->state = AVAHI_CACHE_EXPIRY3;
- percent = 95;
- break;
-
- case AVAHI_CACHE_EXPIRY3:
- e->state = AVAHI_CACHE_EXPIRY_FINAL;
- percent = 100;
- break;
- }
-
- if (e) {
-
- assert(percent > 0);
-
- /* Request a cache update if we are subscribed to this entry */
- if (avahi_querier_shall_refresh_cache(e->cache->interface, e->record->key))
- avahi_interface_post_query(e->cache->interface, e->record->key, 0, NULL);
-
- /* Check again later */
- next_expiry(e->cache, e, percent);
-
- }
-
-/* avahi_free(txt); */
-}
-
-static void update_time_event(AvahiCache *c, AvahiCacheEntry *e) {
- assert(c);
- assert(e);
-
- if (e->time_event)
- avahi_time_event_update(e->time_event, &e->expiry);
- else
- e->time_event = avahi_time_event_new(c->server->time_event_queue, &e->expiry, elapse_func, e);
-}
-
-static void next_expiry(AvahiCache *c, AvahiCacheEntry *e, unsigned percent) {
- AvahiUsec usec, left, right;
- time_t now;
-
- assert(c);
- assert(e);
- assert(percent > 0 && percent <= 100);
-
- usec = (AvahiUsec) e->record->ttl * 10000;
-
- left = usec * percent;
- right = usec * (percent+2); /* 2% jitter */
-
- now = time(NULL);
-
- if (now >= c->last_rand_timestamp + 10) {
- c->last_rand = rand();
- c->last_rand_timestamp = now;
- }
-
- usec = left + (AvahiUsec) ((double) (right-left) * c->last_rand / (RAND_MAX+1.0));
-
- e->expiry = e->timestamp;
- avahi_timeval_add(&e->expiry, usec);
-
-/* g_message("wake up in +%lu seconds", e->expiry.tv_sec - e->timestamp.tv_sec); */
-
- update_time_event(c, e);
-}
-
-static void expire_in_one_second(AvahiCache *c, AvahiCacheEntry *e, AvahiCacheEntryState state) {
- assert(c);
- assert(e);
-
- e->state = state;
- gettimeofday(&e->expiry, NULL);
- avahi_timeval_add(&e->expiry, 1000000); /* 1s */
- update_time_event(c, e);
-}
-
-void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const AvahiAddress *a) {
-/* char *txt; */
-
- assert(c);
- assert(r && r->ref >= 1);
-
-/* txt = avahi_record_to_string(r); */
-
- if (r->ttl == 0) {
- /* This is a goodbye request */
-
- AvahiCacheEntry *e;
-
- if ((e = lookup_record(c, r)))
- expire_in_one_second(c, e, AVAHI_CACHE_GOODBYE_FINAL);
-
- } else {
- AvahiCacheEntry *e = NULL, *first;
- struct timeval now;
-
- gettimeofday(&now, NULL);
-
- /* This is an update request */
-
- if ((first = lookup_key(c, r->key))) {
-
- if (cache_flush) {
-
- /* For unique entries drop all entries older than one second */
- for (e = first; e; e = e->by_key_next) {
- AvahiUsec t;
-
- t = avahi_timeval_diff(&now, &e->timestamp);
-
- if (t > 1000000)
- expire_in_one_second(c, e, AVAHI_CACHE_REPLACE_FINAL);
- }
- }
-
- /* Look for exactly the same entry */
- for (e = first; e; e = e->by_key_next)
- if (avahi_record_equal_no_ttl(e->record, r))
- break;
- }
-
- if (e) {
-
-/* avahi_log_debug("found matching cache entry"); */
-
- /* We need to update the hash table key if we replace the
- * record */
- if (e->by_key_prev == NULL)
- avahi_hashmap_replace(c->hashmap, r->key, e);
-
- /* Update the record */
- avahi_record_unref(e->record);
- e->record = avahi_record_ref(r);
-
-/* avahi_log_debug("cache: updating %s", txt); */
-
- } else {
- /* No entry found, therefore we create a new one */
-
-/* avahi_log_debug("cache: couldn't find matching cache entry for %s", txt); */
-
- if (c->n_entries >= AVAHI_CACHE_ENTRIES_MAX)
- return;
-
- if (!(e = avahi_new(AvahiCacheEntry, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return;
- }
-
- e->cache = c;
- e->time_event = NULL;
- e->record = avahi_record_ref(r);
-
- /* Append to hash table */
- AVAHI_LLIST_PREPEND(AvahiCacheEntry, by_key, first, e);
- avahi_hashmap_replace(c->hashmap, e->record->key, first);
-
- /* Append to linked list */
- AVAHI_LLIST_PREPEND(AvahiCacheEntry, entry, c->entries, e);
-
- c->n_entries++;
-
- /* Notify subscribers */
- avahi_multicast_lookup_engine_notify(c->server->multicast_lookup_engine, c->interface, e->record, AVAHI_BROWSER_NEW);
- }
-
- e->origin = *a;
- e->timestamp = now;
- next_expiry(c, e, 80);
- e->state = AVAHI_CACHE_VALID;
- e->cache_flush = cache_flush;
- }
-
-/* avahi_free(txt); */
-}
-
-struct dump_data {
- AvahiDumpCallback callback;
- void* userdata;
-};
-
-static void dump_callback(void* key, void* data, void* userdata) {
- AvahiCacheEntry *e = data;
- AvahiKey *k = key;
- struct dump_data *dump_data = userdata;
-
- assert(k);
- assert(e);
- assert(data);
-
- for (; e; e = e->by_key_next) {
- char *t;
-
- if (!(t = avahi_record_to_string(e->record)))
- continue; /* OOM */
-
- dump_data->callback(t, dump_data->userdata);
- avahi_free(t);
- }
-}
-
-int avahi_cache_dump(AvahiCache *c, AvahiDumpCallback callback, void* userdata) {
- struct dump_data data;
-
- assert(c);
- assert(callback);
-
- callback(";;; CACHE DUMP FOLLOWS ;;;", userdata);
-
- data.callback = callback;
- data.userdata = userdata;
-
- avahi_hashmap_foreach(c->hashmap, dump_callback, &data);
-
- return 0;
-}
-
-int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e) {
- struct timeval now;
- unsigned age;
-
- assert(c);
- assert(e);
-
- gettimeofday(&now, NULL);
-
- age = (unsigned) (avahi_timeval_diff(&now, &e->timestamp)/1000000);
-
-/* avahi_log_debug("age: %lli, ttl/2: %u", age, e->record->ttl); */
-
- return age >= e->record->ttl/2;
-}
-
-void avahi_cache_flush(AvahiCache *c) {
- assert(c);
-
- while (c->entries)
- remove_entry(c, c->entries);
-}
-
-/*** Passive observation of failure ***/
-
-static void* start_poof_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void *userdata) {
- AvahiAddress *a = userdata;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(a);
-
- switch (e->state) {
- case AVAHI_CACHE_VALID:
-
- /* The entry was perfectly valid till, now, so let's enter
- * POOF mode */
-
- e->state = AVAHI_CACHE_POOF;
- e->poof_address = *a;
-
- break;
-
- case AVAHI_CACHE_POOF:
-
- /* This is the second time we got no response, so let's
- * fucking remove this entry. */
-
- expire_in_one_second(c, e, AVAHI_CACHE_POOF_FINAL);
- break;
-
- default:
- ;
- }
-
- return NULL;
-}
-
-void avahi_cache_start_poof(AvahiCache *c, AvahiKey *key, const AvahiAddress *a) {
- assert(c);
- assert(key);
-
- avahi_cache_walk(c, key, start_poof_callback, a);
-}
-
-void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddress *a) {
- AvahiCacheEntry *e;
-
- assert(c);
- assert(record);
- assert(a);
-
- if (!(e = lookup_record(c, record)))
- return;
-
- /* This function is called for each response suppression
- record. If the matching cache entry is in POOF state and the
- query address is the same, we put it back into valid mode */
-
- if (e->state == AVAHI_CACHE_POOF || e->state == AVAHI_CACHE_POOF_FINAL)
- if (avahi_address_cmp(a, &e->poof_address) == 0) {
- e->state = AVAHI_CACHE_VALID;
- next_expiry(c, e, 80);
- }
-}
-
-
-
diff --git a/release-0.6.9/avahi-core/cache.h b/release-0.6.9/avahi-core/cache.h
deleted file mode 100644
index edf9fa5..0000000
--- a/release-0.6.9/avahi-core/cache.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef foocachehfoo
-#define foocachehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiCache AvahiCache;
-
-#include <avahi-common/llist.h>
-#include "prioq.h"
-#include "internal.h"
-#include "timeeventq.h"
-#include "hashmap.h"
-
-typedef enum {
- AVAHI_CACHE_VALID,
- AVAHI_CACHE_EXPIRY1,
- AVAHI_CACHE_EXPIRY2,
- AVAHI_CACHE_EXPIRY3,
- AVAHI_CACHE_EXPIRY_FINAL,
- AVAHI_CACHE_POOF, /* Passive observation of failure */
- AVAHI_CACHE_POOF_FINAL,
- AVAHI_CACHE_GOODBYE_FINAL,
- AVAHI_CACHE_REPLACE_FINAL
-} AvahiCacheEntryState;
-
-typedef struct AvahiCacheEntry AvahiCacheEntry;
-
-struct AvahiCacheEntry {
- AvahiCache *cache;
- AvahiRecord *record;
- struct timeval timestamp;
- struct timeval expiry;
- int cache_flush;
-
- AvahiAddress origin;
-
- AvahiCacheEntryState state;
- AvahiTimeEvent *time_event;
-
- AvahiAddress poof_address;
-
- AVAHI_LLIST_FIELDS(AvahiCacheEntry, by_key);
- AVAHI_LLIST_FIELDS(AvahiCacheEntry, entry);
-};
-
-struct AvahiCache {
- AvahiServer *server;
-
- AvahiInterface *interface;
-
- AvahiHashmap *hashmap;
-
- AVAHI_LLIST_HEAD(AvahiCacheEntry, entries);
-
- unsigned n_entries;
-
- int last_rand;
- time_t last_rand_timestamp;
-};
-
-AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *interface);
-void avahi_cache_free(AvahiCache *c);
-
-void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const AvahiAddress *a);
-
-int avahi_cache_dump(AvahiCache *c, AvahiDumpCallback callback, void* userdata);
-
-typedef void* AvahiCacheWalkCallback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata);
-void* avahi_cache_walk(AvahiCache *c, AvahiKey *pattern, AvahiCacheWalkCallback cb, void* userdata);
-
-int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e);
-
-/** Start the "Passive observation of Failure" algorithm for all
- * records of the specified key. The specified address is */
-void avahi_cache_start_poof(AvahiCache *c, AvahiKey *key, const AvahiAddress *a);
-
-/* Stop a previously started POOF algorithm for a record. (Used for response suppresions records */
-void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddress *a);
-
-void avahi_cache_flush(AvahiCache *c);
-
-#endif
diff --git a/release-0.6.9/avahi-core/conformance-test.c b/release-0.6.9/avahi-core/conformance-test.c
deleted file mode 100644
index dc3c864..0000000
--- a/release-0.6.9/avahi-core/conformance-test.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/alternative.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/publish.h>
-
-static char *name = NULL;
-static AvahiSEntryGroup *group = NULL;
-static int try = 0;
-static AvahiServer *avahi = NULL;
-static const AvahiPoll *poll_api;
-
-static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
- printf("%s\n", text);
-}
-
-static void dump_timeout_callback(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void* userdata) {
- struct timeval tv;
-
- avahi_server_dump(avahi, dump_line, NULL);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_update(timeout, &tv);
-}
-
-static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
-
-static void create_service(const char *t) {
- char *n;
-
- assert(t || name);
-
- n = t ? avahi_strdup(t) : avahi_alternative_service_name(name);
- avahi_free(name);
- name = n;
-
- if (group)
- avahi_s_entry_group_reset(group);
- else
- group = avahi_s_entry_group_new(avahi, entry_group_callback, NULL);
-
- avahi_server_add_service(avahi, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_http._tcp", NULL, NULL, 80, "foo", NULL);
- avahi_s_entry_group_commit(group);
-
- try++;
-}
-
-static void rename_timeout_callback(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
- struct timeval tv;
-
- if (access("flag", F_OK) == 0) {
- create_service("New - Bonjour Service Name");
- return;
- }
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_update(timeout, &tv);
-}
-
-static void entry_group_callback(AVAHI_GCC_UNUSED AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void* userdata) {
- if (state == AVAHI_ENTRY_GROUP_COLLISION)
- create_service(NULL);
- else if (state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
- avahi_log_debug("ESTABLISHED !!!!");
- try = 0;
- }
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("server state: %i", state);
-
- if (state == AVAHI_SERVER_RUNNING) {
- avahi_server_dump(avahi, dump_line, NULL);
- } else if (state == AVAHI_SERVER_COLLISION) {
- char *n;
-
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
- avahi_log_warn("Host name conflict, retrying with <%s>", n);
- avahi_server_set_host_name(s, n);
- avahi_free(n);
-
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- int error;
- AvahiSimplePoll *simple_poll;
- struct timeval tv;
- struct AvahiServerConfig config;
-
- simple_poll = avahi_simple_poll_new();
- poll_api = avahi_simple_poll_get(simple_poll);
-
- avahi_server_config_init(&config);
- config.publish_workstation = 0;
- config.use_ipv6 = 0;
- config.publish_domain = 0;
- config.publish_hinfo = 0;
- avahi = avahi_server_new(poll_api, &config, server_callback, NULL, &error);
- avahi_server_config_free(&config);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_new(poll_api, &tv, dump_timeout_callback, avahi);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_new(poll_api, &tv, rename_timeout_callback, avahi);
-
- /* Evil, but the conformace test requires that*/
- create_service("gurke");
-
-
- avahi_simple_poll_loop(simple_poll);
-
- if (group)
- avahi_s_entry_group_free(group);
- avahi_server_free(avahi);
-
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/core.h b/release-0.6.9/avahi-core/core.h
deleted file mode 100644
index e73abd2..0000000
--- a/release-0.6.9/avahi-core/core.h
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef foocorehfoo
-#define foocorehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file core.h The Avahi Multicast DNS and DNS Service Discovery implementation. */
-
-/** An mDNS responder object */
-typedef struct AvahiServer AvahiServer;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-core/rr.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Maximum number of defined DNS servers for wide area DNS */
-#define AVAHI_WIDE_AREA_SERVERS_MAX 4
-
-/** Prototype for callback functions which are called whenever the state of an AvahiServer object changes */
-typedef void (*AvahiServerCallback) (AvahiServer *s, AvahiServerState state, void* userdata);
-
-/** Stores configuration options for a server instance */
-typedef struct AvahiServerConfig {
- char *host_name; /**< Default host name. If left empty defaults to the result of gethostname(2) of the libc */
- char *domain_name; /**< Default domain name. If left empty defaults to .local */
- int use_ipv4; /**< Enable IPv4 support */
- int use_ipv6; /**< Enable IPv6 support */
- int publish_hinfo; /**< Register a HINFO record for the host containing the local OS and CPU type */
- int publish_addresses; /**< Register A, AAAA and PTR records for all local IP addresses */
- int publish_workstation; /**< Register a _workstation._tcp service */
- int publish_domain; /**< Announce the local domain for browsing */
- int check_response_ttl; /**< If enabled the server ignores all incoming responses with IP TTL != 255. Newer versions of the RFC do no longer contain this check, so it is disabled by default. */
- int use_iff_running; /**< Require IFF_RUNNING on local network interfaces. This is the official way to check for link beat. Unfortunately this doesn't work with all drivers. So bettere leave this off. */
- int enable_reflector; /**< Reflect incoming mDNS traffic to all local networks. This allows mDNS based network browsing beyond ethernet borders */
- int reflect_ipv; /**< if enable_reflector is 1, enable/disable reflecting between IPv4 and IPv6 */
- int add_service_cookie; /**< Add magic service cookie to all locally generated records implicitly */
- int enable_wide_area; /**< Enable wide area support */
- AvahiAddress wide_area_servers[AVAHI_WIDE_AREA_SERVERS_MAX]; /** Unicast DNS server to use for wide area lookup */
- unsigned n_wide_area_servers; /**< Number of servers in wide_area_servers[] */
- int disallow_other_stacks; /**< Make sure that only one mDNS responder is run at the same time on the local machine. If this is enable Avahi will not set SO_REUSADDR on its sockets, effectively preventing other stacks from running on the local machine */
- AvahiStringList *browse_domains; /**< Additional browsing domains */
- int disable_publishing; /**< Disable publishing of any record */
- int allow_point_to_point; /**< Enable publishing on POINTOPOINT interfaces */
-} AvahiServerConfig;
-
-/** Allocate a new mDNS responder object. */
-AvahiServer *avahi_server_new(
- const AvahiPoll *api, /**< The main loop adapter */
- const AvahiServerConfig *sc, /**< If non-NULL a pointer to a configuration structure for the server. The server makes an internal deep copy of this structure, so you may free it using avahi_server_config_done() immediately after calling this function. */
- AvahiServerCallback callback, /**< A callback which is called whenever the state of the server changes */
- void* userdata, /**< An opaque pointer which is passed to the callback function */
- int *error);
-
-/** Free an mDNS responder object */
-void avahi_server_free(AvahiServer* s);
-
-/** Fill in default values for a server configuration structure. If you
- * make use of an AvahiServerConfig structure be sure to initialize
- * it with this function for the sake of upwards library
- * compatibility. This call may allocate strings on the heap. To
- * release this memory make sure to call
- * avahi_server_config_done(). If you want to replace any strings in
- * the structure be sure to free the strings filled in by this
- * function with avahi_free() first and allocate the replacements with
- * g_malloc() (or g_strdup()).*/
-AvahiServerConfig* avahi_server_config_init(
- AvahiServerConfig *c /**< A structure which shall be filled in */ );
-
-/** Make a deep copy of the configuration structure *c to *ret. */
-AvahiServerConfig* avahi_server_config_copy(
- AvahiServerConfig *ret /**< destination */,
- const AvahiServerConfig *c /**< source */);
-
-/** Free the data in a server configuration structure. */
-void avahi_server_config_free(AvahiServerConfig *c);
-
-/** Return the currently chosen domain name of the server object. The
- * return value points to an internally allocated string. Be sure to
- * make a copy of the string before calling any other library
- * functions. */
-const char* avahi_server_get_domain_name(AvahiServer *s);
-
-/** Return the currently chosen host name. The return value points to a internally allocated string. */
-const char* avahi_server_get_host_name(AvahiServer *s);
-
-/** Return the currently chosen host name as a FQDN ("fully qualified
- * domain name", i.e. the concatenation of the host and domain
- * name). The return value points to a internally allocated string. */
-const char* avahi_server_get_host_name_fqdn(AvahiServer *s);
-
-/** Change the host name of a running mDNS responder. This will drop
-all automicatilly generated RRs and readd them with the new
-name. Since the responder has to probe for the new RRs this function
-takes some time to take effect altough it returns immediately. This
-function is intended to be called when a host name conflict is
-reported using AvahiServerCallback. The caller should readd all user
-defined RRs too since they otherwise continue to point to the outdated
-host name..*/
-int avahi_server_set_host_name(AvahiServer *s, const char *host_name);
-
-/** Change the domain name of a running mDNS responder. The same rules
- * as with avahi_server_set_host_name() apply. */
-int avahi_server_set_domain_name(AvahiServer *s, const char *domain_name);
-
-/** Return the opaque user data pointer attached to a server object */
-void* avahi_server_get_data(AvahiServer *s);
-
-/** Change the opaque user data pointer attached to a server object */
-void avahi_server_set_data(AvahiServer *s, void* userdata);
-
-/** Return the current state of the server object */
-AvahiServerState avahi_server_get_state(AvahiServer *s);
-
-/** Callback prototype for avahi_server_dump() */
-typedef void (*AvahiDumpCallback)(const char *text, void* userdata);
-
-/** Dump the current server status by calling "callback" for each line. */
-int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata);
-
-/** Return the last error code */
-int avahi_server_errno(AvahiServer *s);
-
-/** Return the local service cookie */
-uint32_t avahi_server_get_local_service_cookie(AvahiServer *s);
-
-/** Set the wide area DNS servers */
-int avahi_server_set_wide_area_servers(AvahiServer *s, const AvahiAddress *a, unsigned n);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/dns-srv-rr.h b/release-0.6.9/avahi-core/dns-srv-rr.h
deleted file mode 100644
index 1a7f95f..0000000
--- a/release-0.6.9/avahi-core/dns-srv-rr.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef foodnssrvhfoo
-#define foodnssrvhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file avahi-core/dns-srv-rr.h Functions for announcing and browsing for unicast DNS servers via mDNS */
-
-/** A domain service browser object. Use this to browse for
- * conventional unicast DNS servers which may be used to resolve
- * conventional domain names */
-typedef struct AvahiSDNSServerBrowser AvahiSDNSServerBrowser;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/defs.h>
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** The type of DNS server */
-typedef enum {
- AVAHI_DNS_SERVER_RESOLVE, /**< Unicast DNS servers for normal resolves (_domain._udp)*/
- AVAHI_DNS_SERVER_UPDATE, /**< Unicast DNS servers for updates (_dns-update._udp)*/
- AVAHI_DNS_SERVER_MAX
-} AvahiDNSServerType;
-
-/** Publish the specified unicast DNS server address via mDNS. You may
- * browse for records create this way wit
- * avahi_s_dns_server_browser_new(). */
-int avahi_server_add_dns_server_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *domain,
- AvahiDNSServerType type,
- const AvahiAddress *address,
- uint16_t port /** should be 53 */);
-
-/** Callback prototype for AvahiSDNSServerBrowser events */
-typedef void (*AvahiSDNSServerBrowserCallback)(
- AvahiSDNSServerBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *host_name, /**< Host name of the DNS server, probably useless */
- const AvahiAddress *a, /**< Address of the DNS server */
- uint16_t port, /**< Port number of the DNS servers, probably 53 */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSDNSServerBrowser object */
-AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDNSServerType type,
- AvahiProtocol aprotocol, /**< Address protocol for the DNS server */
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSDNSServerBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSDNSServerBrowser object */
-void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/dns-test.c b/release-0.6.9/avahi-core/dns-test.c
deleted file mode 100644
index ae2343d..0000000
--- a/release-0.6.9/avahi-core/dns-test.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/malloc.h>
-
-#include "dns.h"
-#include "log.h"
-#include "util.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- char t[AVAHI_DOMAIN_NAME_MAX], *m;
- const char *a, *b, *c, *d;
- AvahiDnsPacket *p;
- AvahiRecord *r, *r2;
- uint8_t rdata[AVAHI_DNS_RDATA_MAX];
- size_t l;
-
- p = avahi_dns_packet_new(0);
-
- assert(avahi_dns_packet_append_name(p, a = "Ahello.hello.hello.de."));
- assert(avahi_dns_packet_append_name(p, b = "Bthis is a test.hello.de."));
- assert(avahi_dns_packet_append_name(p, c = "Cthis\\.is\\.a\\.test\\.with\\.dots.hello.de."));
- assert(avahi_dns_packet_append_name(p, d = "Dthis\\\\is another test.hello.de."));
-
- avahi_hexdump(AVAHI_DNS_PACKET_DATA(p), p->size);
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(a, t));
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(b, t));
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(c, t));
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(d, t));
-
- avahi_dns_packet_free(p);
-
- /* RDATA PARSING AND SERIALIZATION */
-
- /* Create an AvahiRecord with some usful data */
- r = avahi_record_new_full("foobar.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, AVAHI_DEFAULT_TTL);
- assert(r);
- r->data.hinfo.cpu = avahi_strdup("FOO");
- r->data.hinfo.os = avahi_strdup("BAR");
-
- /* Serialize it into a blob */
- assert((l = avahi_rdata_serialize(r, rdata, sizeof(rdata))) != (size_t) -1);
-
- /* Print it */
- avahi_hexdump(rdata, l);
-
- /* Create a new record and fill in the data from the blob */
- r2 = avahi_record_new(r->key, AVAHI_DEFAULT_TTL);
- assert(r2);
- assert(avahi_rdata_parse(r2, rdata, l) >= 0);
-
- /* Compare both versions */
- assert(avahi_record_equal_no_ttl(r, r2));
-
- /* Free the records */
- avahi_record_unref(r);
- avahi_record_unref(r2);
-
- r = avahi_record_new_full("foobar", 77, 77, AVAHI_DEFAULT_TTL);
- assert(r);
-
- assert(r->data.generic.data = avahi_memdup("HALLO", r->data.generic.size = 5));
-
- m = avahi_record_to_string(r);
- assert(m);
-
- avahi_log_debug(">%s<", m);
-
- avahi_free(m);
- avahi_record_unref(r);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/dns.c b/release-0.6.9/avahi-core/dns.c
deleted file mode 100644
index 66b0bdf..0000000
--- a/release-0.6.9/avahi-core/dns.c
+++ /dev/null
@@ -1,838 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <netinet/in.h>
-
-#include <avahi-common/defs.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-
-#include "dns.h"
-#include "log.h"
-
-AvahiDnsPacket* avahi_dns_packet_new(unsigned mtu) {
- AvahiDnsPacket *p;
- size_t max_size;
-
- if (mtu <= 0)
- max_size = AVAHI_DNS_PACKET_SIZE_MAX;
- else if (mtu >= AVAHI_DNS_PACKET_EXTRA_SIZE)
- max_size = mtu - AVAHI_DNS_PACKET_EXTRA_SIZE;
- else
- max_size = 0;
-
- if (max_size < AVAHI_DNS_PACKET_HEADER_SIZE)
- max_size = AVAHI_DNS_PACKET_HEADER_SIZE;
-
- if (!(p = avahi_malloc(sizeof(AvahiDnsPacket) + max_size)))
- return p;
-
- p->size = p->rindex = AVAHI_DNS_PACKET_HEADER_SIZE;
- p->max_size = max_size;
- p->name_table = NULL;
- p->data = NULL;
-
- memset(AVAHI_DNS_PACKET_DATA(p), 0, p->size);
- return p;
-}
-
-AvahiDnsPacket* avahi_dns_packet_new_query(unsigned mtu) {
- AvahiDnsPacket *p;
-
- if (!(p = avahi_dns_packet_new(mtu)))
- return NULL;
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
- return p;
-}
-
-AvahiDnsPacket* avahi_dns_packet_new_response(unsigned mtu, int aa) {
- AvahiDnsPacket *p;
-
- if (!(p = avahi_dns_packet_new(mtu)))
- return NULL;
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(1, 0, aa, 0, 0, 0, 0, 0, 0, 0));
- return p;
-}
-
-AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int copy_queries, int aa) {
- AvahiDnsPacket *r;
- assert(p);
-
- if (!(r = avahi_dns_packet_new_response(mtu, aa)))
- return NULL;
-
- if (copy_queries) {
- unsigned saved_rindex;
- uint32_t n;
-
- saved_rindex = p->rindex;
- p->rindex = AVAHI_DNS_PACKET_HEADER_SIZE;
-
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); n > 0; n--) {
- AvahiKey *k;
- int unicast_response;
-
- if ((k = avahi_dns_packet_consume_key(p, &unicast_response))) {
- avahi_dns_packet_append_key(r, k, unicast_response);
- avahi_key_unref(k);
- }
- }
-
- p->rindex = saved_rindex;
-
- avahi_dns_packet_set_field(r, AVAHI_DNS_FIELD_QDCOUNT, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT));
- }
-
- avahi_dns_packet_set_field(r, AVAHI_DNS_FIELD_ID, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID));
-
- avahi_dns_packet_set_field(r, AVAHI_DNS_FIELD_FLAGS,
- (avahi_dns_packet_get_field(r, AVAHI_DNS_FIELD_FLAGS) & ~AVAHI_DNS_FLAG_OPCODE) |
- (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_OPCODE));
-
- return r;
-}
-
-
-void avahi_dns_packet_free(AvahiDnsPacket *p) {
- assert(p);
-
- if (p->name_table)
- avahi_hashmap_free(p->name_table);
-
- avahi_free(p);
-}
-
-void avahi_dns_packet_set_field(AvahiDnsPacket *p, unsigned idx, uint16_t v) {
- assert(p);
- assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
-
- ((uint16_t*) AVAHI_DNS_PACKET_DATA(p))[idx] = htons(v);
-}
-
-uint16_t avahi_dns_packet_get_field(AvahiDnsPacket *p, unsigned idx) {
- assert(p);
- assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
-
- return ntohs(((uint16_t*) AVAHI_DNS_PACKET_DATA(p))[idx]);
-}
-
-void avahi_dns_packet_inc_field(AvahiDnsPacket *p, unsigned idx) {
- assert(p);
- assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
-
- avahi_dns_packet_set_field(p, idx, avahi_dns_packet_get_field(p, idx) + 1);
-}
-
-uint8_t* avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name) {
- uint8_t *d, *saved_ptr = NULL;
- size_t saved_size;
-
- assert(p);
- assert(name);
-
- saved_size = p->size;
- saved_ptr = avahi_dns_packet_extend(p, 0);
-
- while (*name) {
- uint8_t* prev;
- const char *pname;
- char label[64], *u;
-
- /* Check whether we can compress this name. */
-
- if (p->name_table && (prev = avahi_hashmap_lookup(p->name_table, name))) {
- unsigned idx;
-
- assert(prev >= AVAHI_DNS_PACKET_DATA(p));
- idx = (unsigned) (prev - AVAHI_DNS_PACKET_DATA(p));
-
- assert(idx < p->size);
-
- if (idx < 0x4000) {
- uint8_t *t;
- if (!(t = (uint8_t*) avahi_dns_packet_extend(p, sizeof(uint16_t))))
- return NULL;
-
- t[0] = (uint8_t) ((0xC000 | idx) >> 8);
- t[1] = (uint8_t) idx;
- return saved_ptr;
- }
- }
-
- pname = name;
-
- if (!(avahi_unescape_label(&name, label, sizeof(label))))
- goto fail;
-
- if (!(d = avahi_dns_packet_append_string(p, label)))
- goto fail;
-
- if (!p->name_table)
- /* This works only for normalized domain names */
- p->name_table = avahi_hashmap_new(avahi_string_hash, avahi_string_equal, avahi_free, NULL);
-
- if (!(u = avahi_strdup(pname)))
- avahi_log_error("avahi_strdup() failed.");
- else
- avahi_hashmap_insert(p->name_table, u, d);
- }
-
- if (!(d = avahi_dns_packet_extend(p, 1)))
- goto fail;
-
- *d = 0;
-
- return saved_ptr;
-
-fail:
- p->size = saved_size;
- return NULL;
-}
-
-uint8_t* avahi_dns_packet_append_uint16(AvahiDnsPacket *p, uint16_t v) {
- uint8_t *d;
- assert(p);
-
- if (!(d = avahi_dns_packet_extend(p, sizeof(uint16_t))))
- return NULL;
-
- d[0] = (uint8_t) (v >> 8);
- d[1] = (uint8_t) v;
- return d;
-}
-
-uint8_t *avahi_dns_packet_append_uint32(AvahiDnsPacket *p, uint32_t v) {
- uint8_t *d;
- assert(p);
-
- if (!(d = avahi_dns_packet_extend(p, sizeof(uint32_t))))
- return NULL;
-
- d[0] = (uint8_t) (v >> 24);
- d[1] = (uint8_t) (v >> 16);
- d[2] = (uint8_t) (v >> 8);
- d[3] = (uint8_t) v;
-
- return d;
-}
-
-uint8_t *avahi_dns_packet_append_bytes(AvahiDnsPacket *p, const void *b, size_t l) {
- uint8_t* d;
-
- assert(p);
- assert(b);
- assert(l);
-
- if (!(d = avahi_dns_packet_extend(p, l)))
- return NULL;
-
- memcpy(d, b, l);
- return d;
-}
-
-uint8_t* avahi_dns_packet_append_string(AvahiDnsPacket *p, const char *s) {
- uint8_t* d;
- size_t k;
-
- assert(p);
- assert(s);
-
- if ((k = strlen(s)) >= 255)
- k = 255;
-
- if (!(d = avahi_dns_packet_extend(p, k+1)))
- return NULL;
-
- *d = (uint8_t) k;
- memcpy(d+1, s, k);
-
- return d;
-}
-
-uint8_t *avahi_dns_packet_extend(AvahiDnsPacket *p, size_t l) {
- uint8_t *d;
-
- assert(p);
-
- if (p->size+l > p->max_size)
- return NULL;
-
- d = AVAHI_DNS_PACKET_DATA(p) + p->size;
- p->size += l;
-
- return d;
-}
-
-int avahi_dns_packet_check_valid(AvahiDnsPacket *p) {
- uint16_t flags;
- assert(p);
-
- if (p->size < AVAHI_DNS_PACKET_HEADER_SIZE)
- return -1;
-
- flags = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS);
-
- if (flags & AVAHI_DNS_FLAG_OPCODE)
- return -1;
-
- return 0;
-}
-
-int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *p) {
- uint16_t flags;
- assert(p);
-
- if (avahi_dns_packet_check_valid(p) < 0)
- return -1;
-
- flags = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS);
-
- if (flags & AVAHI_DNS_FLAG_RCODE)
- return -1;
-
- return 0;
-}
-
-
-int avahi_dns_packet_is_query(AvahiDnsPacket *p) {
- assert(p);
-
- return !(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_QR);
-}
-
-static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_t l) {
- int ret = 0;
- int compressed = 0;
- int first_label = 1;
- assert(p && ret_name && l);
-
- for (;;) {
- uint8_t n;
-
- if (idx+1 > p->size)
- return -1;
-
- n = AVAHI_DNS_PACKET_DATA(p)[idx];
-
- if (!n) {
- idx++;
- if (!compressed)
- ret++;
-
- if (l < 1)
- return -1;
- *ret_name = 0;
-
- return ret;
-
- } else if (n <= 63) {
- /* Uncompressed label */
- idx++;
- if (!compressed)
- ret++;
-
- if (idx + n > p->size)
- return -1;
-
- if ((size_t) n + 1 > l)
- return -1;
-
- if (!first_label) {
- *(ret_name++) = '.';
- l--;
- } else
- first_label = 0;
-
- if (!(avahi_escape_label((char*) AVAHI_DNS_PACKET_DATA(p) + idx, n, &ret_name, &l)))
- return -1;
-
- idx += n;
-
- if (!compressed)
- ret += n;
- } else if ((n & 0xC0) == 0xC0) {
- /* Compressed label */
-
- if (idx+2 > p->size)
- return -1;
-
- idx = ((unsigned) (AVAHI_DNS_PACKET_DATA(p)[idx] & ~0xC0)) << 8 | AVAHI_DNS_PACKET_DATA(p)[idx+1];
-
- if (!compressed)
- ret += 2;
-
- compressed = 1;
- } else
- return -1;
- }
-}
-
-int avahi_dns_packet_consume_name(AvahiDnsPacket *p, char *ret_name, size_t l) {
- int r;
-
- if ((r = consume_labels(p, p->rindex, ret_name, l)) < 0)
- return -1;
-
- p->rindex += r;
- return 0;
-}
-
-int avahi_dns_packet_consume_uint16(AvahiDnsPacket *p, uint16_t *ret_v) {
- uint8_t *d;
-
- assert(p);
- assert(ret_v);
-
- if (p->rindex + sizeof(uint16_t) > p->size)
- return -1;
-
- d = (uint8_t*) (AVAHI_DNS_PACKET_DATA(p) + p->rindex);
- *ret_v = (d[0] << 8) | d[1];
- p->rindex += sizeof(uint16_t);
-
- return 0;
-}
-
-int avahi_dns_packet_consume_uint32(AvahiDnsPacket *p, uint32_t *ret_v) {
- uint8_t* d;
-
- assert(p);
- assert(ret_v);
-
- if (p->rindex + sizeof(uint32_t) > p->size)
- return -1;
-
- d = (uint8_t*) (AVAHI_DNS_PACKET_DATA(p) + p->rindex);
- *ret_v = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
- p->rindex += sizeof(uint32_t);
-
- return 0;
-}
-
-int avahi_dns_packet_consume_bytes(AvahiDnsPacket *p, void * ret_data, size_t l) {
- assert(p);
- assert(ret_data);
- assert(l > 0);
-
- if (p->rindex + l > p->size)
- return -1;
-
- memcpy(ret_data, AVAHI_DNS_PACKET_DATA(p) + p->rindex, l);
- p->rindex += l;
-
- return 0;
-}
-
-int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t l) {
- size_t k;
-
- assert(p);
- assert(ret_string);
- assert(l > 0);
-
- if (p->rindex >= p->size)
- return -1;
-
- k = AVAHI_DNS_PACKET_DATA(p)[p->rindex];
-
- if (p->rindex+1+k > p->size)
- return -1;
-
- if (l > k+1)
- l = k+1;
-
- memcpy(ret_string, AVAHI_DNS_PACKET_DATA(p)+p->rindex+1, l-1);
- ret_string[l-1] = 0;
-
- p->rindex += 1+k;
-
- return 0;
-}
-
-const void* avahi_dns_packet_get_rptr(AvahiDnsPacket *p) {
- assert(p);
-
- if (p->rindex > p->size)
- return NULL;
-
- return AVAHI_DNS_PACKET_DATA(p) + p->rindex;
-}
-
-int avahi_dns_packet_skip(AvahiDnsPacket *p, size_t length) {
- assert(p);
-
- if (p->rindex + length > p->size)
- return -1;
-
- p->rindex += length;
- return 0;
-}
-
-static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
- char buf[AVAHI_DOMAIN_NAME_MAX];
- const void* start;
-
- assert(p);
- assert(r);
-
- start = avahi_dns_packet_get_rptr(p);
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
-
- if (avahi_dns_packet_consume_name(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.ptr.name = avahi_strdup(buf);
- break;
-
-
- case AVAHI_DNS_TYPE_SRV:
-
- if (avahi_dns_packet_consume_uint16(p, &r->data.srv.priority) < 0 ||
- avahi_dns_packet_consume_uint16(p, &r->data.srv.weight) < 0 ||
- avahi_dns_packet_consume_uint16(p, &r->data.srv.port) < 0 ||
- avahi_dns_packet_consume_name(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.srv.name = avahi_strdup(buf);
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
-
- if (avahi_dns_packet_consume_string(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.hinfo.cpu = avahi_strdup(buf);
-
- if (avahi_dns_packet_consume_string(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.hinfo.os = avahi_strdup(buf);
- break;
-
- case AVAHI_DNS_TYPE_TXT:
-
- if (rdlength > 0) {
- if (avahi_string_list_parse(avahi_dns_packet_get_rptr(p), rdlength, &r->data.txt.string_list) < 0)
- return -1;
-
- if (avahi_dns_packet_skip(p, rdlength) < 0)
- return -1;
- } else
- r->data.txt.string_list = NULL;
-
- break;
-
- case AVAHI_DNS_TYPE_A:
-
-/* avahi_log_debug("A"); */
-
- if (avahi_dns_packet_consume_bytes(p, &r->data.a.address, sizeof(AvahiIPv4Address)) < 0)
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
-
-/* avahi_log_debug("aaaa"); */
-
- if (avahi_dns_packet_consume_bytes(p, &r->data.aaaa.address, sizeof(AvahiIPv6Address)) < 0)
- return -1;
-
- break;
-
- default:
-
-/* avahi_log_debug("generic"); */
-
- if (rdlength > 0) {
-
- r->data.generic.data = avahi_memdup(avahi_dns_packet_get_rptr(p), rdlength);
-
- if (avahi_dns_packet_skip(p, rdlength) < 0)
- return -1;
- }
-
- break;
- }
-
- /* Check if we read enough data */
- if ((const uint8_t*) avahi_dns_packet_get_rptr(p) - (const uint8_t*) start != rdlength)
- return -1;
-
- return 0;
-}
-
-AvahiRecord* avahi_dns_packet_consume_record(AvahiDnsPacket *p, int *ret_cache_flush) {
- char name[AVAHI_DOMAIN_NAME_MAX];
- uint16_t type, class;
- uint32_t ttl;
- uint16_t rdlength;
- AvahiRecord *r = NULL;
-
- assert(p);
-
- if (avahi_dns_packet_consume_name(p, name, sizeof(name)) < 0 ||
- avahi_dns_packet_consume_uint16(p, &type) < 0 ||
- avahi_dns_packet_consume_uint16(p, &class) < 0 ||
- avahi_dns_packet_consume_uint32(p, &ttl) < 0 ||
- avahi_dns_packet_consume_uint16(p, &rdlength) < 0 ||
- p->rindex + rdlength > p->size)
- goto fail;
-
- if (ret_cache_flush)
- *ret_cache_flush = !!(class & AVAHI_DNS_CACHE_FLUSH);
- class &= ~AVAHI_DNS_CACHE_FLUSH;
-
- if (!(r = avahi_record_new_full(name, class, type, ttl)))
- goto fail;
-
- if (parse_rdata(p, r, rdlength) < 0)
- goto fail;
-
- return r;
-
-fail:
- if (r)
- avahi_record_unref(r);
-
- return NULL;
-}
-
-AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_response) {
- char name[256];
- uint16_t type, class;
-
- assert(p);
-
- if (avahi_dns_packet_consume_name(p, name, sizeof(name)) < 0 ||
- avahi_dns_packet_consume_uint16(p, &type) < 0 ||
- avahi_dns_packet_consume_uint16(p, &class) < 0)
- return NULL;
-
- if (ret_unicast_response)
- *ret_unicast_response = !!(class & AVAHI_DNS_UNICAST_RESPONSE);
-
- class &= ~AVAHI_DNS_UNICAST_RESPONSE;
-
- return avahi_key_new(name, class, type);
-}
-
-uint8_t* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, int unicast_response) {
- uint8_t *t;
- size_t size;
-
- assert(p);
- assert(k);
-
- size = p->size;
-
- if (!(t = avahi_dns_packet_append_name(p, k->name)) ||
- !avahi_dns_packet_append_uint16(p, k->type) ||
- !avahi_dns_packet_append_uint16(p, k->clazz | (unicast_response ? AVAHI_DNS_UNICAST_RESPONSE : 0))) {
- p->size = size;
- return NULL;
- }
-
- return t;
-}
-
-static int append_rdata(AvahiDnsPacket *p, AvahiRecord *r) {
- assert(p);
- assert(r);
-
- switch (r->key->type) {
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
-
- if (!(avahi_dns_packet_append_name(p, r->data.ptr.name)))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_SRV:
-
- if (!avahi_dns_packet_append_uint16(p, r->data.srv.priority) ||
- !avahi_dns_packet_append_uint16(p, r->data.srv.weight) ||
- !avahi_dns_packet_append_uint16(p, r->data.srv.port) ||
- !avahi_dns_packet_append_name(p, r->data.srv.name))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- if (!avahi_dns_packet_append_string(p, r->data.hinfo.cpu) ||
- !avahi_dns_packet_append_string(p, r->data.hinfo.os))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_TXT: {
-
- uint8_t *data;
- size_t n;
-
- n = avahi_string_list_serialize(r->data.txt.string_list, NULL, 0);
-
- if (!(data = avahi_dns_packet_extend(p, n)))
- return -1;
-
- avahi_string_list_serialize(r->data.txt.string_list, data, n);
- break;
- }
-
-
- case AVAHI_DNS_TYPE_A:
-
- if (!avahi_dns_packet_append_bytes(p, &r->data.a.address, sizeof(r->data.a.address)))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
-
- if (!avahi_dns_packet_append_bytes(p, &r->data.aaaa.address, sizeof(r->data.aaaa.address)))
- return -1;
-
- break;
-
- default:
-
- if (r->data.generic.size)
- if (avahi_dns_packet_append_bytes(p, r->data.generic.data, r->data.generic.size))
- return -1;
-
- break;
- }
-
- return 0;
-}
-
-
-uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int cache_flush, unsigned max_ttl) {
- uint8_t *t, *l, *start;
- size_t size;
-
- assert(p);
- assert(r);
-
- size = p->size;
-
- if (!(t = avahi_dns_packet_append_name(p, r->key->name)) ||
- !avahi_dns_packet_append_uint16(p, r->key->type) ||
- !avahi_dns_packet_append_uint16(p, cache_flush ? (r->key->clazz | AVAHI_DNS_CACHE_FLUSH) : (r->key->clazz &~ AVAHI_DNS_CACHE_FLUSH)) ||
- !avahi_dns_packet_append_uint32(p, (max_ttl && r->ttl > max_ttl) ? max_ttl : r->ttl) ||
- !(l = avahi_dns_packet_append_uint16(p, 0)))
- goto fail;
-
- start = avahi_dns_packet_extend(p, 0);
-
- if (append_rdata(p, r) < 0)
- goto fail;
-
- size = avahi_dns_packet_extend(p, 0) - start;
- assert(size <= 0xFFFF);
-
-/* avahi_log_debug("appended %u", size); */
-
- l[0] = (uint8_t) ((uint16_t) size >> 8);
- l[1] = (uint8_t) ((uint16_t) size);
-
- return t;
-
-
-fail:
- p->size = size;
- return NULL;
-}
-
-int avahi_dns_packet_is_empty(AvahiDnsPacket *p) {
- assert(p);
-
- return p->size <= AVAHI_DNS_PACKET_HEADER_SIZE;
-}
-
-size_t avahi_dns_packet_space(AvahiDnsPacket *p) {
- assert(p);
-
- assert(p->size <= p->max_size);
-
- return p->max_size - p->size;
-}
-
-int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size) {
- int ret;
- AvahiDnsPacket p;
-
- assert(record);
- assert(rdata);
-
- p.data = (void*) rdata;
- p.max_size = p.size = size;
- p.rindex = 0;
- p.name_table = NULL;
-
- ret = parse_rdata(&p, record, size);
-
- assert(!p.name_table);
-
- return ret;
-}
-
-size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size) {
- int ret;
- AvahiDnsPacket p;
-
- assert(record);
- assert(rdata);
- assert(max_size > 0);
-
- p.data = (void*) rdata;
- p.max_size = max_size;
- p.size = p.rindex = 0;
- p.name_table = NULL;
-
- ret = append_rdata(&p, record);
-
- if (p.name_table)
- avahi_hashmap_free(p.name_table);
-
- if (ret < 0)
- return (size_t) -1;
-
- return p.size;
-}
diff --git a/release-0.6.9/avahi-core/dns.h b/release-0.6.9/avahi-core/dns.h
deleted file mode 100644
index 4696e00..0000000
--- a/release-0.6.9/avahi-core/dns.h
+++ /dev/null
@@ -1,111 +0,0 @@
-#ifndef foodnshfoo
-#define foodnshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "rr.h"
-#include "hashmap.h"
-
-#define AVAHI_DNS_PACKET_SIZE_MAX 9000
-#define AVAHI_DNS_PACKET_HEADER_SIZE 12
-#define AVAHI_DNS_PACKET_EXTRA_SIZE 48
-
-typedef struct AvahiDnsPacket {
- size_t size, rindex, max_size;
- AvahiHashmap *name_table; /* for name compression */
- uint8_t *data;
-} AvahiDnsPacket;
-
-#define AVAHI_DNS_PACKET_DATA(p) ((p)->data ? (p)->data : ((uint8_t*) p) + sizeof(AvahiDnsPacket))
-
-AvahiDnsPacket* avahi_dns_packet_new(unsigned mtu);
-AvahiDnsPacket* avahi_dns_packet_new_query(unsigned mtu);
-AvahiDnsPacket* avahi_dns_packet_new_response(unsigned mtu, int aa);
-
-AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int copy_queries, int aa);
-
-void avahi_dns_packet_free(AvahiDnsPacket *p);
-void avahi_dns_packet_set_field(AvahiDnsPacket *p, unsigned idx, uint16_t v);
-uint16_t avahi_dns_packet_get_field(AvahiDnsPacket *p, unsigned idx);
-void avahi_dns_packet_inc_field(AvahiDnsPacket *p, unsigned idx);
-
-uint8_t *avahi_dns_packet_extend(AvahiDnsPacket *p, size_t l);
-
-uint8_t *avahi_dns_packet_append_uint16(AvahiDnsPacket *p, uint16_t v);
-uint8_t *avahi_dns_packet_append_uint32(AvahiDnsPacket *p, uint32_t v);
-uint8_t *avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name);
-uint8_t *avahi_dns_packet_append_bytes(AvahiDnsPacket *p, const void *d, size_t l);
-uint8_t* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, int unicast_response);
-uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int cache_flush, unsigned max_ttl);
-uint8_t* avahi_dns_packet_append_string(AvahiDnsPacket *p, const char *s);
-
-int avahi_dns_packet_is_query(AvahiDnsPacket *p);
-int avahi_dns_packet_check_valid(AvahiDnsPacket *p);
-int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *p);
-
-int avahi_dns_packet_consume_uint16(AvahiDnsPacket *p, uint16_t *ret_v);
-int avahi_dns_packet_consume_uint32(AvahiDnsPacket *p, uint32_t *ret_v);
-int avahi_dns_packet_consume_name(AvahiDnsPacket *p, char *ret_name, size_t l);
-int avahi_dns_packet_consume_bytes(AvahiDnsPacket *p, void* ret_data, size_t l);
-AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_response);
-AvahiRecord* avahi_dns_packet_consume_record(AvahiDnsPacket *p, int *ret_cache_flush);
-int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t l);
-
-const void* avahi_dns_packet_get_rptr(AvahiDnsPacket *p);
-
-int avahi_dns_packet_skip(AvahiDnsPacket *p, size_t length);
-
-int avahi_dns_packet_is_empty(AvahiDnsPacket *p);
-size_t avahi_dns_packet_space(AvahiDnsPacket *p);
-
-#define AVAHI_DNS_FIELD_ID 0
-#define AVAHI_DNS_FIELD_FLAGS 1
-#define AVAHI_DNS_FIELD_QDCOUNT 2
-#define AVAHI_DNS_FIELD_ANCOUNT 3
-#define AVAHI_DNS_FIELD_NSCOUNT 4
-#define AVAHI_DNS_FIELD_ARCOUNT 5
-
-#define AVAHI_DNS_FLAG_QR (1 << 15)
-#define AVAHI_DNS_FLAG_OPCODE (15 << 11)
-#define AVAHI_DNS_FLAG_RCODE (15)
-#define AVAHI_DNS_FLAG_TC (1 << 9)
-#define AVAHI_DNS_FLAG_AA (1 << 10)
-
-#define AVAHI_DNS_FLAGS(qr, opcode, aa, tc, rd, ra, z, ad, cd, rcode) \
- (((uint16_t) !!qr << 15) | \
- ((uint16_t) (opcode & 15) << 11) | \
- ((uint16_t) !!aa << 10) | \
- ((uint16_t) !!tc << 9) | \
- ((uint16_t) !!rd << 8) | \
- ((uint16_t) !!ra << 7) | \
- ((uint16_t) !!ad << 5) | \
- ((uint16_t) !!cd << 4) | \
- ((uint16_t) (rcode & 15)))
-
-#define AVAHI_MDNS_SUFFIX_LOCAL "local"
-#define AVAHI_MDNS_SUFFIX_ADDR_IPV4 "254.169.in-addr.arpa"
-#define AVAHI_MDNS_SUFFIX_ADDR_IPV6 "0.8.e.f.ip6.arpa"
-
-#define AVAHI_DNS_RDATA_MAX 65535
-
-#endif
-
diff --git a/release-0.6.9/avahi-core/domain-util.c b/release-0.6.9/avahi-core/domain-util.c
deleted file mode 100644
index ab1ec8d..0000000
--- a/release-0.6.9/avahi-core/domain-util.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/utsname.h>
-#include <stdio.h>
-
-#include <avahi-common/malloc.h>
-
-#include "domain-util.h"
-#include "util.h"
-
-static void strip_bad_chars(char *s) {
- char *p, *d;
-
- s[strcspn(s, ".")] = 0;
-
- for (p = s, d = s; *p; p++)
- if (isalnum(*p) || *p == '-')
- *(d++) = *p;
-
- *d = 0;
-}
-
-char *avahi_get_host_name(char *ret_s, size_t size) {
- assert(ret_s);
- assert(size > 0);
-
- if (gethostname(ret_s, size) >= 0) {
- ret_s[size-1] = 0;
- strip_bad_chars(ret_s);
- } else
- *ret_s = 0;
-
- if (*ret_s == 0) {
- struct utsname utsname;
-
- /* No hostname was set, so let's take the OS name */
-
- if (uname(&utsname) >= 0) {
- snprintf(ret_s, size, "%s", utsname.sysname);
- strip_bad_chars(ret_s);
- avahi_strdown(ret_s);
- }
-
- if (*ret_s == 0)
- snprintf(ret_s, size, "unnamed");
- }
-
- if (size >= AVAHI_LABEL_MAX)
- ret_s[AVAHI_LABEL_MAX-1] = 0;
-
- return ret_s;
-}
-
-char *avahi_get_host_name_strdup(void) {
- char t[AVAHI_DOMAIN_NAME_MAX];
-
- if (!(avahi_get_host_name(t, sizeof(t))))
- return NULL;
-
- return avahi_strdup(t);
-}
-
-int avahi_binary_domain_cmp(const char *a, const char *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 0;
-
- for (;;) {
- char ca[AVAHI_LABEL_MAX], cb[AVAHI_LABEL_MAX], *p;
- int r;
-
- p = avahi_unescape_label(&a, ca, sizeof(ca));
- assert(p);
- p = avahi_unescape_label(&b, cb, sizeof(cb));
- assert(p);
-
- if ((r = strcmp(ca, cb)))
- return r;
-
- if (!*a && !*b)
- return 0;
- }
-}
-
-int avahi_domain_ends_with(const char *domain, const char *suffix) {
- assert(domain);
- assert(suffix);
-
- for (;;) {
- char dummy[AVAHI_LABEL_MAX], *r;
-
- if (*domain == 0)
- return 0;
-
- if (avahi_domain_equal(domain, suffix))
- return 1;
-
- r = avahi_unescape_label(&domain, dummy, sizeof(dummy));
- assert(r);
- }
-}
-
diff --git a/release-0.6.9/avahi-core/domain-util.h b/release-0.6.9/avahi-core/domain-util.h
deleted file mode 100644
index 01233d8..0000000
--- a/release-0.6.9/avahi-core/domain-util.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef foodomainutilhfoo
-#define foodomainutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/domain.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Return the local host name. */
-char *avahi_get_host_name(char *ret_s, size_t size);
-
-/** Return the local host name. avahi_free() the result! */
-char *avahi_get_host_name_strdup(void);
-
-/** Do a binary comparison of to specified domain names, return -1, 0, or 1, depending on the order. */
-int avahi_binary_domain_cmp(const char *a, const char *b);
-
-/** Returns 1 if the the end labels of domain are eqal to suffix */
-int avahi_domain_ends_with(const char *domain, const char *suffix);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/entry.c b/release-0.6.9/avahi-core/entry.c
deleted file mode 100644
index 9e9c0dd..0000000
--- a/release-0.6.9/avahi-core/entry.c
+++ /dev/null
@@ -1,1206 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include <arpa/inet.h>
-
-#include <sys/utsname.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-
-#include "internal.h"
-#include "iface.h"
-#include "socket.h"
-#include "browse.h"
-#include "log.h"
-#include "util.h"
-#include "dns-srv-rr.h"
-#include "rr-util.h"
-#include "domain-util.h"
-
-static void transport_flags_from_domain(AvahiServer *s, AvahiPublishFlags *flags, const char *domain) {
- assert(flags);
- assert(domain);
-
- assert(!((*flags & AVAHI_PUBLISH_USE_MULTICAST) && (*flags & AVAHI_PUBLISH_USE_WIDE_AREA)));
-
- if (*flags & (AVAHI_PUBLISH_USE_MULTICAST|AVAHI_PUBLISH_USE_WIDE_AREA))
- return;
-
- if (!s->wide_area_lookup_engine ||
- !avahi_wide_area_has_servers(s->wide_area_lookup_engine) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_LOCAL) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV4) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV6))
- *flags |= AVAHI_PUBLISH_USE_MULTICAST;
- else
- *flags |= AVAHI_PUBLISH_USE_WIDE_AREA;
-}
-
-void avahi_entry_free(AvahiServer*s, AvahiEntry *e) {
- AvahiEntry *t;
-
- assert(s);
- assert(e);
-
- avahi_goodbye_entry(s, e, 1, 1);
-
- /* Remove from linked list */
- AVAHI_LLIST_REMOVE(AvahiEntry, entries, s->entries, e);
-
- /* Remove from hash table indexed by name */
- t = avahi_hashmap_lookup(s->entries_by_key, e->record->key);
- AVAHI_LLIST_REMOVE(AvahiEntry, by_key, t, e);
- if (t)
- avahi_hashmap_replace(s->entries_by_key, t->record->key, t);
- else
- avahi_hashmap_remove(s->entries_by_key, e->record->key);
-
- /* Remove from associated group */
- if (e->group)
- AVAHI_LLIST_REMOVE(AvahiEntry, by_group, e->group->entries, e);
-
- avahi_record_unref(e->record);
- avahi_free(e);
-}
-
-void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g) {
- assert(s);
- assert(g);
-
- while (g->entries)
- avahi_entry_free(s, g->entries);
-
- if (g->register_time_event)
- avahi_time_event_free(g->register_time_event);
-
- AVAHI_LLIST_REMOVE(AvahiSEntryGroup, groups, s->groups, g);
- avahi_free(g);
-}
-
-void avahi_cleanup_dead_entries(AvahiServer *s) {
- assert(s);
-
- if (s->need_group_cleanup) {
- AvahiSEntryGroup *g, *next;
-
- for (g = s->groups; g; g = next) {
- next = g->groups_next;
-
- if (g->dead)
- avahi_entry_group_free(s, g);
- }
-
- s->need_group_cleanup = 0;
- }
-
- if (s->need_entry_cleanup) {
- AvahiEntry *e, *next;
-
- for (e = s->entries; e; e = next) {
- next = e->entries_next;
-
- if (e->dead)
- avahi_entry_free(s, e);
- }
-
- s->need_entry_cleanup = 0;
- }
-
- if (s->need_browser_cleanup)
- avahi_browser_cleanup(s);
-}
-
-static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r, AvahiPublishFlags flags) {
- AvahiEntry *e;
-
- assert(s);
- assert(r);
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, r->key); e; e = e->by_key_next) {
- if (e->dead)
- continue;
-
- if (!(flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_UNIQUE))
- continue;
-
- if ((flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) && (e->flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) )
- continue;
-
- if ((interface <= 0 ||
- e->interface <= 0 ||
- e->interface == interface) &&
- (protocol == AVAHI_PROTO_UNSPEC ||
- e->protocol == AVAHI_PROTO_UNSPEC ||
- e->protocol == protocol))
-
- return -1;
- }
-
- return 0;
-}
-
-static AvahiEntry * server_add_internal(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- AvahiRecord *r) {
-
- AvahiEntry *e;
-
- assert(s);
- assert(r);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, s->state != AVAHI_SERVER_FAILURE && s->state != AVAHI_SERVER_INVALID, AVAHI_ERR_BAD_STATE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_FLAGS_VALID(
- flags,
- AVAHI_PUBLISH_NO_ANNOUNCE|
- AVAHI_PUBLISH_NO_PROBE|
- AVAHI_PUBLISH_UNIQUE|
- AVAHI_PUBLISH_ALLOW_MULTIPLE|
- AVAHI_PUBLISH_UPDATE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_is_valid_domain_name(r->key->name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, r->ttl != 0, AVAHI_ERR_INVALID_TTL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !avahi_key_is_pattern(r->key), AVAHI_ERR_IS_PATTERN);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_record_is_valid(r), AVAHI_ERR_INVALID_RECORD);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, r->key->clazz == AVAHI_DNS_CLASS_IN, AVAHI_ERR_INVALID_DNS_CLASS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s,
- (r->key->type != 0) &&
- (r->key->type != AVAHI_DNS_TYPE_ANY) &&
- (r->key->type != AVAHI_DNS_TYPE_OPT) &&
- (r->key->type != AVAHI_DNS_TYPE_TKEY) &&
- (r->key->type != AVAHI_DNS_TYPE_TSIG) &&
- (r->key->type != AVAHI_DNS_TYPE_IXFR) &&
- (r->key->type != AVAHI_DNS_TYPE_AXFR), AVAHI_ERR_INVALID_DNS_TYPE);
-
- transport_flags_from_domain(s, &flags, r->key->name);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !s->config.disable_publishing, AVAHI_ERR_NOT_PERMITTED);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s,
- !g ||
- (g->state != AVAHI_ENTRY_GROUP_ESTABLISHED && g->state != AVAHI_ENTRY_GROUP_REGISTERING) ||
- (flags & AVAHI_PUBLISH_UPDATE), AVAHI_ERR_BAD_STATE);
-
- if (flags & AVAHI_PUBLISH_UPDATE) {
- AvahiRecord *old_record;
- int is_first = 1;
-
- /* Update and existing record */
-
- /* Find the first matching entry */
- for (e = avahi_hashmap_lookup(s->entries_by_key, r->key); e; e = e->by_key_next) {
- if (!e->dead && e->group == g && e->interface == interface && e->protocol == protocol)
- break;
-
- is_first = 0;
- }
-
- /* Hmm, nothing found? */
- if (!e) {
- avahi_server_set_errno(s, AVAHI_ERR_NOT_FOUND);
- return NULL;
- }
-
- /* Update the entry */
- old_record = e->record;
- e->record = avahi_record_ref(r);
- e->flags = flags;
-
- /* Announce our changes when needed */
- if (!avahi_record_equal_no_ttl(old_record, r) && (!g || g->state != AVAHI_ENTRY_GROUP_UNCOMMITED)) {
-
- /* Remove the old entry from all caches, if needed */
- if (!(e->flags & AVAHI_PUBLISH_UNIQUE))
- avahi_goodbye_entry(s, e, 1, 0);
-
- /* Reannounce our updated entry */
- avahi_reannounce_entry(s, e);
- }
-
- /* If we were the first entry in the list, we need to update the key */
- if (is_first)
- avahi_hashmap_replace(s->entries_by_key, e->record->key, e);
-
- avahi_record_unref(old_record);
-
- } else {
- AvahiEntry *t;
-
- /* Add a new record */
-
- if (check_record_conflict(s, interface, protocol, r, flags) < 0) {
- avahi_server_set_errno(s, AVAHI_ERR_COLLISION);
- return NULL;
- }
-
- if (!(e = avahi_new(AvahiEntry, 1))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- e->server = s;
- e->record = avahi_record_ref(r);
- e->group = g;
- e->interface = interface;
- e->protocol = protocol;
- e->flags = flags;
- e->dead = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiAnnouncer, e->announcers);
-
- AVAHI_LLIST_PREPEND(AvahiEntry, entries, s->entries, e);
-
- /* Insert into hash table indexed by name */
- t = avahi_hashmap_lookup(s->entries_by_key, e->record->key);
- AVAHI_LLIST_PREPEND(AvahiEntry, by_key, t, e);
- avahi_hashmap_replace(s->entries_by_key, e->record->key, t);
-
- /* Insert into group list */
- if (g)
- AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
-
- avahi_announce_entry(s, e);
- }
-
- return e;
-}
-
-int avahi_server_add(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- AvahiRecord *r) {
-
- if (!server_add_internal(s, g, interface, protocol, flags, r))
- return avahi_server_errno(s);
-
- return AVAHI_OK;
-}
-
-const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, void **state) {
- AvahiEntry **e = (AvahiEntry**) state;
- assert(s);
- assert(e);
-
- if (!*e)
- *e = g ? g->entries : s->entries;
-
- while (*e && (*e)->dead)
- *e = g ? (*e)->by_group_next : (*e)->entries_next;
-
- if (!*e)
- return NULL;
-
- return avahi_record_ref((*e)->record);
-}
-
-int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata) {
- AvahiEntry *e;
-
- assert(s);
- assert(callback);
-
- callback(";;; ZONE DUMP FOLLOWS ;;;", userdata);
-
- for (e = s->entries; e; e = e->entries_next) {
- char *t;
- char ln[256];
-
- if (e->dead)
- continue;
-
- if (!(t = avahi_record_to_string(e->record)))
- return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
- snprintf(ln, sizeof(ln), "%s ; iface=%i proto=%i", t, e->interface, e->protocol);
- avahi_free(t);
-
- callback(ln, userdata);
- }
-
- avahi_dump_caches(s->monitor, callback, userdata);
-
- if (s->wide_area_lookup_engine)
- avahi_wide_area_cache_dump(s->wide_area_lookup_engine, callback, userdata);
- return AVAHI_OK;
-}
-
-static AvahiEntry *server_add_ptr_internal(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- const char *dest) {
-
- AvahiRecord *r;
- AvahiEntry *e;
-
- assert(s);
- assert(dest);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !name || avahi_is_valid_domain_name(name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_is_valid_domain_name(dest), AVAHI_ERR_INVALID_HOST_NAME);
-
- if (!name)
- name = s->host_name_fqdn;
-
- if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR, ttl))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->data.ptr.name = avahi_normalize_name_strdup(dest);
- e = server_add_internal(s, g, interface, protocol, flags, r);
- avahi_record_unref(r);
- return e;
-}
-
-int avahi_server_add_ptr(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- const char *dest) {
-
- AvahiEntry *e;
-
- assert(s);
-
- if (!(e = server_add_ptr_internal(s, g, interface, protocol, flags, ttl, name, dest)))
- return avahi_server_errno(s);
-
- return AVAHI_OK;
-}
-
-int avahi_server_add_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- AvahiAddress *a) {
-
- char n[AVAHI_DOMAIN_NAME_MAX];
- int ret = AVAHI_OK;
- AvahiEntry *entry = NULL, *reverse = NULL;
- AvahiRecord *r;
-
- assert(s);
- assert(a);
-
- AVAHI_CHECK_VALIDITY(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY(s, AVAHI_PROTO_VALID(protocol) && AVAHI_PROTO_VALID(a->proto), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY(s, AVAHI_FLAGS_VALID(flags,
- AVAHI_PUBLISH_NO_REVERSE|
- AVAHI_PUBLISH_NO_ANNOUNCE|
- AVAHI_PUBLISH_NO_PROBE|
- AVAHI_PUBLISH_UPDATE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY(s, !name || avahi_is_valid_fqdn(name), AVAHI_ERR_INVALID_HOST_NAME);
-
- /* Prepare the host naem */
-
- if (!name)
- name = s->host_name_fqdn;
- else {
- AVAHI_ASSERT_TRUE(avahi_normalize_name(name, n, sizeof(n)));
- name = n;
- }
-
- transport_flags_from_domain(s, &flags, name);
- AVAHI_CHECK_VALIDITY(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- /* Create the A/AAAA record */
-
- if (a->proto == AVAHI_PROTO_INET) {
-
- if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto finish;
- }
-
- r->data.a.address = a->data.ipv4;
-
- } else {
- assert(a->proto == AVAHI_PROTO_INET6);
-
- if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto finish;
- }
-
- r->data.aaaa.address = a->data.ipv6;
- }
-
- entry = server_add_internal(s, g, interface, protocol, (flags & ~ AVAHI_PUBLISH_NO_REVERSE) | AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
- avahi_record_unref(r);
-
- if (!entry) {
- ret = avahi_server_errno(s);
- goto finish;
- }
-
- /* Create the reverse lookup entry */
-
- if (!(flags & AVAHI_PUBLISH_NO_REVERSE)) {
- char reverse_n[AVAHI_DOMAIN_NAME_MAX];
- avahi_reverse_lookup_name(a, reverse_n, sizeof(reverse_n));
-
- if (!(reverse = server_add_ptr_internal(s, g, interface, protocol, flags | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse_n, name))) {
- ret = avahi_server_errno(s);
- goto finish;
- }
- }
-
-finish:
-
- if (ret != AVAHI_OK && !(flags & AVAHI_PUBLISH_UPDATE)) {
- if (entry)
- avahi_entry_free(s, entry);
- if (reverse)
- avahi_entry_free(s, reverse);
- }
-
- return ret;
-}
-
-static AvahiEntry *server_add_txt_strlst_nocopy(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- AvahiStringList *strlst) {
-
- AvahiRecord *r;
- AvahiEntry *e;
-
- assert(s);
-
- if (!(r = avahi_record_new_full(name ? name : s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT, ttl))) {
- avahi_string_list_free(strlst);
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->data.txt.string_list = strlst;
- e = server_add_internal(s, g, interface, protocol, flags, r);
- avahi_record_unref(r);
-
- return e;
-}
-
-static AvahiStringList *add_magic_cookie(
- AvahiServer *s,
- AvahiStringList *strlst) {
-
- assert(s);
-
- if (!s->config.add_service_cookie)
- return strlst;
-
- if (avahi_string_list_find(strlst, AVAHI_SERVICE_COOKIE))
- /* This string list already contains a magic cookie */
- return strlst;
-
- return avahi_string_list_add_printf(strlst, AVAHI_SERVICE_COOKIE"=%u", s->local_service_cookie);
-}
-
-static int server_add_service_strlst_nocopy(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *strlst) {
-
- char ptr_name[AVAHI_DOMAIN_NAME_MAX], svc_name[AVAHI_DOMAIN_NAME_MAX], enum_ptr[AVAHI_DOMAIN_NAME_MAX], *h = NULL;
- AvahiRecord *r = NULL;
- int ret = AVAHI_OK;
- AvahiEntry *srv_entry = NULL, *txt_entry = NULL, *ptr_entry = NULL, *enum_entry = NULL;
-
- assert(s);
- assert(type);
- assert(name);
-
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_FLAGS_VALID(flags,
- AVAHI_PUBLISH_NO_COOKIE|
- AVAHI_PUBLISH_UPDATE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !host || avahi_is_valid_fqdn(host), AVAHI_ERR_INVALID_HOST_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- if (!host)
- host = s->host_name_fqdn;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if (!(h = avahi_normalize_name_strdup(host))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if ((ret = avahi_service_name_join(svc_name, sizeof(svc_name), name, type, domain)) < 0 ||
- (ret = avahi_service_name_join(ptr_name, sizeof(ptr_name), NULL, type, domain)) < 0 ||
- (ret = avahi_service_name_join(enum_ptr, sizeof(enum_ptr), NULL, "_services._dns-sd._udp", domain)) < 0) {
- avahi_server_set_errno(s, ret);
- goto fail;
- }
-
- /* Add service enumeration PTR record */
-
- if (!(ptr_entry = server_add_ptr_internal(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, ptr_name, svc_name))) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
- /* Add SRV record */
-
- if (!(r = avahi_record_new_full(svc_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->data.srv.priority = 0;
- r->data.srv.weight = 0;
- r->data.srv.port = port;
- r->data.srv.name = h;
- h = NULL;
- srv_entry = server_add_internal(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, r);
- avahi_record_unref(r);
-
- if (!srv_entry) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
- /* Add TXT record */
-
- if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
- strlst = add_magic_cookie(s, strlst);
-
- txt_entry = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
- strlst = NULL;
-
- if (!txt_entry) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
- /* Add service type enumeration record */
-
- if (!(enum_entry = server_add_ptr_internal(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, enum_ptr, ptr_name))) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
-fail:
- if (ret != AVAHI_OK && !(flags & AVAHI_PUBLISH_UPDATE)) {
- if (srv_entry)
- avahi_entry_free(s, srv_entry);
- if (txt_entry)
- avahi_entry_free(s, txt_entry);
- if (ptr_entry)
- avahi_entry_free(s, ptr_entry);
- if (enum_entry)
- avahi_entry_free(s, enum_entry);
- }
-
- avahi_string_list_free(strlst);
- avahi_free(h);
-
- return ret;
-}
-
-int avahi_server_add_service_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *strlst) {
-
- assert(s);
- assert(type);
- assert(name);
-
- return server_add_service_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, host, port, avahi_string_list_copy(strlst));
-}
-
-int avahi_server_add_service(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- ... ){
-
- va_list va;
- int ret;
-
- va_start(va, port);
- ret = server_add_service_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, host, port, avahi_string_list_new_va(va));
- va_end(va);
-
- return ret;
-}
-
-static int server_update_service_txt_strlst_nocopy(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst) {
-
- char svc_name[AVAHI_DOMAIN_NAME_MAX];
- int ret = AVAHI_OK;
- AvahiEntry *e;
-
- assert(s);
- assert(type);
- assert(name);
-
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_FLAGS_VALID(flags,
- AVAHI_PUBLISH_NO_COOKIE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if ((ret = avahi_service_name_join(svc_name, sizeof(svc_name), name, type, domain)) < 0) {
- avahi_server_set_errno(s, ret);
- goto fail;
- }
-
- /* Add TXT record */
- if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
- strlst = add_magic_cookie(s, strlst);
-
- e = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_UPDATE, AVAHI_DEFAULT_TTL, svc_name, strlst);
- strlst = NULL;
-
- if (!e)
- ret = avahi_server_errno(s);
-
-fail:
-
- avahi_string_list_free(strlst);
-
- return ret;
-}
-
-int avahi_server_update_service_txt_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst) {
-
- return server_update_service_txt_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, avahi_string_list_copy(strlst));
-}
-
-/** Update the TXT record for a service with the NULL termonate list of strings */
-int avahi_server_update_service_txt(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- ...) {
-
- va_list va;
- int ret;
-
- va_start(va, domain);
- ret = server_update_service_txt_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, avahi_string_list_new_va(va));
- va_end(va);
-
- return ret;
-}
-
-int avahi_server_add_service_subtype(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *subtype) {
-
- int ret = AVAHI_OK;
- char svc_name[AVAHI_DOMAIN_NAME_MAX], ptr_name[AVAHI_DOMAIN_NAME_MAX];
-
- assert(name);
- assert(type);
- assert(subtype);
-
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_USE_MULTICAST|AVAHI_PUBLISH_USE_WIDE_AREA), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_subtype(subtype), AVAHI_ERR_INVALID_SERVICE_SUBTYPE);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if ((ret = avahi_service_name_join(svc_name, sizeof(svc_name), name, type, domain)) < 0 ||
- (ret = avahi_service_name_join(ptr_name, sizeof(ptr_name), NULL, subtype, domain)) < 0) {
- avahi_server_set_errno(s, ret);
- goto fail;
- }
-
- if ((ret = avahi_server_add_ptr(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, ptr_name, svc_name)) < 0)
- goto fail;
-
-fail:
-
- return ret;
-}
-
-static void hexstring(char *s, size_t sl, const void *p, size_t pl) {
- static const char hex[] = "0123456789abcdef";
- int b = 0;
- const uint8_t *k = p;
-
- while (sl > 1 && pl > 0) {
- *(s++) = hex[(b ? *k : *k >> 4) & 0xF];
-
- if (b) {
- k++;
- pl--;
- }
-
- b = !b;
-
- sl--;
- }
-
- if (sl > 0)
- *s = 0;
-}
-
-static AvahiEntry *server_add_dns_server_name(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *domain,
- AvahiDNSServerType type,
- const char *name,
- uint16_t port /** should be 53 */) {
-
- AvahiEntry *e;
- char t[AVAHI_DOMAIN_NAME_MAX], normalized_d[AVAHI_DOMAIN_NAME_MAX], *n;
-
- AvahiRecord *r;
-
- assert(s);
- assert(name);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_USE_WIDE_AREA|AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE, AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, port != 0, AVAHI_ERR_INVALID_PORT);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_is_valid_fqdn(name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if (!(n = avahi_normalize_name_strdup(name))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- AVAHI_ASSERT_TRUE(avahi_normalize_name(domain, normalized_d, sizeof(normalized_d)));
-
- snprintf(t, sizeof(t), "%s.%s", type == AVAHI_DNS_SERVER_RESOLVE ? "_domain._udp" : "_dns-update._udp", normalized_d);
-
- if (!(r = avahi_record_new_full(t, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- avahi_free(n);
- return NULL;
- }
-
- r->data.srv.priority = 0;
- r->data.srv.weight = 0;
- r->data.srv.port = port;
- r->data.srv.name = n;
- e = server_add_internal(s, g, interface, protocol, 0, r);
- avahi_record_unref(r);
-
- return e;
-}
-
-int avahi_server_add_dns_server_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *domain,
- AvahiDNSServerType type,
- const AvahiAddress *address,
- uint16_t port /** should be 53 */) {
-
- AvahiRecord *r;
- char n[64], h[64];
- AvahiEntry *a_entry, *s_entry;
-
- assert(s);
- assert(address);
-
- AVAHI_CHECK_VALIDITY(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY(s, AVAHI_PROTO_VALID(protocol) && AVAHI_PROTO_VALID(address->proto), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY(s, AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_USE_MULTICAST|AVAHI_PUBLISH_USE_WIDE_AREA), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY(s, type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE, AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY(s, port != 0, AVAHI_ERR_INVALID_PORT);
- AVAHI_CHECK_VALIDITY(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if (address->proto == AVAHI_PROTO_INET) {
- hexstring(h, sizeof(h), &address->data, sizeof(AvahiIPv4Address));
- snprintf(n, sizeof(n), "ip-%s.%s", h, domain);
- r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME);
- r->data.a.address = address->data.ipv4;
- } else {
- hexstring(h, sizeof(h), &address->data, sizeof(AvahiIPv6Address));
- snprintf(n, sizeof(n), "ip6-%s.%s", h, domain);
- r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME);
- r->data.aaaa.address = address->data.ipv6;
- }
-
- if (!r)
- return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
- a_entry = server_add_internal(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
- avahi_record_unref(r);
-
- if (!a_entry)
- return avahi_server_errno(s);
-
- if (!(s_entry = server_add_dns_server_name(s, g, interface, protocol, flags, domain, type, n, port))) {
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- avahi_entry_free(s, a_entry);
- return avahi_server_errno(s);
- }
-
- return AVAHI_OK;
-}
-
-void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state) {
- assert(g);
-
- if (g->state == state)
- return;
-
- assert(state <= AVAHI_ENTRY_GROUP_COLLISION);
-
- if (g->state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
-
- /* If the entry group was established for a time longer then
- * 5s, reset the establishment trial counter */
-
- if (avahi_age(&g->established_at) > 5000000)
- g->n_register_try = 0;
- }
-
- if (state == AVAHI_ENTRY_GROUP_ESTABLISHED)
-
- /* If the entry group is now established, remember the time
- * this happened */
-
- gettimeofday(&g->established_at, NULL);
-
- g->state = state;
-
- if (g->callback)
- g->callback(g->server, g, state, g->userdata);
-}
-
-AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallback callback, void* userdata) {
- AvahiSEntryGroup *g;
-
- assert(s);
-
- if (!(g = avahi_new(AvahiSEntryGroup, 1))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- g->server = s;
- g->callback = callback;
- g->userdata = userdata;
- g->dead = 0;
- g->state = AVAHI_ENTRY_GROUP_UNCOMMITED;
- g->n_probing = 0;
- g->n_register_try = 0;
- g->register_time_event = NULL;
- g->register_time.tv_sec = 0;
- g->register_time.tv_usec = 0;
- AVAHI_LLIST_HEAD_INIT(AvahiEntry, g->entries);
-
- AVAHI_LLIST_PREPEND(AvahiSEntryGroup, groups, s->groups, g);
- return g;
-}
-
-void avahi_s_entry_group_free(AvahiSEntryGroup *g) {
- AvahiEntry *e;
-
- assert(g);
- assert(g->server);
-
- for (e = g->entries; e; e = e->by_group_next) {
- if (!e->dead) {
- avahi_goodbye_entry(g->server, e, 1, 1);
- e->dead = 1;
- }
- }
-
- if (g->register_time_event) {
- avahi_time_event_free(g->register_time_event);
- g->register_time_event = NULL;
- }
-
- g->dead = 1;
-
- g->server->need_group_cleanup = 1;
- g->server->need_entry_cleanup = 1;
-}
-
-static void entry_group_commit_real(AvahiSEntryGroup *g) {
- assert(g);
-
- gettimeofday(&g->register_time, NULL);
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING);
-
- if (g->dead)
- return;
-
- avahi_announce_group(g->server, g);
- avahi_s_entry_group_check_probed(g, 0);
-}
-
-static void entry_group_register_time_event_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* userdata) {
- AvahiSEntryGroup *g = userdata;
- assert(g);
-
- avahi_time_event_free(g->register_time_event);
- g->register_time_event = NULL;
-
- /* Holdoff time passed, so let's start probing */
- entry_group_commit_real(g);
-}
-
-int avahi_s_entry_group_commit(AvahiSEntryGroup *g) {
- struct timeval now;
-
- assert(g);
- assert(!g->dead);
-
- if (g->state != AVAHI_ENTRY_GROUP_UNCOMMITED && g->state != AVAHI_ENTRY_GROUP_COLLISION)
- return avahi_server_set_errno(g->server, AVAHI_ERR_BAD_STATE);
-
- if (avahi_s_entry_group_is_empty(g))
- return avahi_server_set_errno(g->server, AVAHI_ERR_IS_EMPTY);
-
- g->n_register_try++;
-
- avahi_timeval_add(&g->register_time,
- 1000*(g->n_register_try >= AVAHI_RR_RATE_LIMIT_COUNT ?
- AVAHI_RR_HOLDOFF_MSEC_RATE_LIMIT :
- AVAHI_RR_HOLDOFF_MSEC));
-
- gettimeofday(&now, NULL);
-
- if (avahi_timeval_compare(&g->register_time, &now) <= 0) {
-
- /* Holdoff time passed, so let's start probing */
- entry_group_commit_real(g);
- } else {
-
- /* Holdoff time has not yet passed, so let's wait */
- assert(!g->register_time_event);
- g->register_time_event = avahi_time_event_new(g->server->time_event_queue, &g->register_time, entry_group_register_time_event_callback, g);
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING);
- }
-
- return AVAHI_OK;
-}
-
-void avahi_s_entry_group_reset(AvahiSEntryGroup *g) {
- AvahiEntry *e;
- assert(g);
-
- for (e = g->entries; e; e = e->by_group_next) {
- if (!e->dead) {
- avahi_goodbye_entry(g->server, e, 1, 1);
- e->dead = 1;
- }
- }
- g->server->need_entry_cleanup = 1;
-
- if (g->register_time_event) {
- avahi_time_event_free(g->register_time_event);
- g->register_time_event = NULL;
- }
-
- g->n_probing = 0;
-
- gettimeofday(&g->register_time, NULL);
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED);
-}
-
-int avahi_entry_is_commited(AvahiEntry *e) {
- assert(e);
- assert(!e->dead);
-
- return !e->group ||
- e->group->state == AVAHI_ENTRY_GROUP_REGISTERING ||
- e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED;
-}
-
-AvahiEntryGroupState avahi_s_entry_group_get_state(AvahiSEntryGroup *g) {
- assert(g);
- assert(!g->dead);
-
- return g->state;
-}
-
-void avahi_s_entry_group_set_data(AvahiSEntryGroup *g, void* userdata) {
- assert(g);
-
- g->userdata = userdata;
-}
-
-void* avahi_s_entry_group_get_data(AvahiSEntryGroup *g) {
- assert(g);
-
- return g->userdata;
-}
-
-int avahi_s_entry_group_is_empty(AvahiSEntryGroup *g) {
- AvahiEntry *e;
- assert(g);
-
- /* Look for an entry that is not dead */
- for (e = g->entries; e; e = e->by_group_next)
- if (!e->dead)
- return 0;
-
- return 1;
-}
diff --git a/release-0.6.9/avahi-core/fdutil.c b/release-0.6.9/avahi-core/fdutil.c
deleted file mode 100644
index de7b0cf..0000000
--- a/release-0.6.9/avahi-core/fdutil.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <assert.h>
-
-#include "fdutil.h"
-
-int avahi_set_cloexec(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFD)) < 0)
- return -1;
-
- if (n & FD_CLOEXEC)
- return 0;
-
- return fcntl(fd, F_SETFD, n|FD_CLOEXEC);
-}
-
-int avahi_set_nonblock(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFL)) < 0)
- return -1;
-
- if (n & O_NONBLOCK)
- return 0;
-
- return fcntl(fd, F_SETFL, n|O_NONBLOCK);
-}
-
-int avahi_wait_for_write(int fd) {
- fd_set fds;
- int r;
-
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
-
- if ((r = select(fd+1, NULL, &fds, NULL, NULL)) < 0)
- return -1;
-
- assert(r > 0);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/fdutil.h b/release-0.6.9/avahi-core/fdutil.h
deleted file mode 100644
index 047b9bb..0000000
--- a/release-0.6.9/avahi-core/fdutil.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef foofdutilhfoo
-#define foofdutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-int avahi_set_cloexec(int fd);
-int avahi_set_nonblock(int fd);
-int avahi_wait_for_write(int fd);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/hashmap-test.c b/release-0.6.9/avahi-core/hashmap-test.c
deleted file mode 100644
index 9826d53..0000000
--- a/release-0.6.9/avahi-core/hashmap-test.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-
-#include "hashmap.h"
-#include "util.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- unsigned n;
- AvahiHashmap *m;
- const char *t;
-
- m = avahi_hashmap_new(avahi_string_hash, avahi_string_equal, avahi_free, avahi_free);
-
- avahi_hashmap_insert(m, avahi_strdup("bla"), avahi_strdup("#1"));
- avahi_hashmap_insert(m, avahi_strdup("bla2"), avahi_strdup("asdf"));
- avahi_hashmap_insert(m, avahi_strdup("gurke"), avahi_strdup("ffsdf"));
- avahi_hashmap_insert(m, avahi_strdup("blubb"), avahi_strdup("sadfsd"));
- avahi_hashmap_insert(m, avahi_strdup("bla"), avahi_strdup("#2"));
-
- for (n = 0; n < 1000; n ++)
- avahi_hashmap_insert(m, avahi_strdup_printf("key %u", n), avahi_strdup_printf("value %u", n));
-
- printf("%s\n", (const char*) avahi_hashmap_lookup(m, "bla"));
-
- avahi_hashmap_replace(m, avahi_strdup("bla"), avahi_strdup("#3"));
-
- printf("%s\n", (const char*) avahi_hashmap_lookup(m, "bla"));
-
- avahi_hashmap_remove(m, "bla");
-
- t = (const char*) avahi_hashmap_lookup(m, "bla");
- printf("%s\n", t ? t : "(null)");
-
- avahi_hashmap_free(m);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/hashmap.c b/release-0.6.9/avahi-core/hashmap.c
deleted file mode 100644
index 07bd707..0000000
--- a/release-0.6.9/avahi-core/hashmap.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-
-#include "hashmap.h"
-#include "util.h"
-
-#define HASH_MAP_SIZE 123
-
-typedef struct Entry Entry;
-struct Entry {
- AvahiHashmap *hashmap;
- void *key;
- void *value;
-
- AVAHI_LLIST_FIELDS(Entry, bucket);
- AVAHI_LLIST_FIELDS(Entry, entries);
-};
-
-struct AvahiHashmap {
- AvahiHashFunc hash_func;
- AvahiEqualFunc equal_func;
- AvahiFreeFunc key_free_func, value_free_func;
-
- Entry *entries[HASH_MAP_SIZE];
- AVAHI_LLIST_HEAD(Entry, entries_list);
-};
-
-static Entry* entry_get(AvahiHashmap *m, const void *key) {
- unsigned idx;
- Entry *e;
-
- idx = m->hash_func(key) % HASH_MAP_SIZE;
-
- for (e = m->entries[idx]; e; e = e->bucket_next)
- if (m->equal_func(key, e->key))
- return e;
-
- return NULL;
-}
-
-static void entry_free(AvahiHashmap *m, Entry *e, int stolen) {
- unsigned idx;
- assert(m);
- assert(e);
-
- idx = m->hash_func(e->key) % HASH_MAP_SIZE;
-
- AVAHI_LLIST_REMOVE(Entry, bucket, m->entries[idx], e);
- AVAHI_LLIST_REMOVE(Entry, entries, m->entries_list, e);
-
- if (m->key_free_func)
- m->key_free_func(e->key);
- if (m->value_free_func && !stolen)
- m->value_free_func(e->value);
-
- avahi_free(e);
-}
-
-AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_func, AvahiFreeFunc key_free_func, AvahiFreeFunc value_free_func) {
- AvahiHashmap *m;
-
- assert(hash_func);
- assert(equal_func);
-
- if (!(m = avahi_new0(AvahiHashmap, 1)))
- return NULL;
-
- m->hash_func = hash_func;
- m->equal_func = equal_func;
- m->key_free_func = key_free_func;
- m->value_free_func = value_free_func;
-
- AVAHI_LLIST_HEAD_INIT(Entry, m->entries_list);
-
- return m;
-}
-
-void avahi_hashmap_free(AvahiHashmap *m) {
- assert(m);
-
- while (m->entries_list)
- entry_free(m, m->entries_list, 0);
-
- avahi_free(m);
-}
-
-void* avahi_hashmap_lookup(AvahiHashmap *m, const void *key) {
- Entry *e;
-
- assert(m);
-
- if (!(e = entry_get(m, key)))
- return NULL;
-
- return e->value;
-}
-
-int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value) {
- unsigned idx;
- Entry *e;
-
- assert(m);
-
- if ((e = entry_get(m, key))) {
- if (m->key_free_func)
- m->key_free_func(key);
- if (m->value_free_func)
- m->value_free_func(value);
-
- return 1;
- }
-
- if (!(e = avahi_new(Entry, 1)))
- return -1;
-
- e->hashmap = m;
- e->key = key;
- e->value = value;
-
- AVAHI_LLIST_PREPEND(Entry, entries, m->entries_list, e);
-
- idx = m->hash_func(key) % HASH_MAP_SIZE;
- AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
-
- return 0;
-}
-
-
-int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value) {
- unsigned idx;
- Entry *e;
-
- assert(m);
-
- if ((e = entry_get(m, key))) {
- if (m->key_free_func)
- m->key_free_func(e->key);
- if (m->value_free_func)
- m->value_free_func(e->value);
-
- e->key = key;
- e->value = value;
-
- return 1;
- }
-
- if (!(e = avahi_new(Entry, 1)))
- return -1;
-
- e->hashmap = m;
- e->key = key;
- e->value = value;
-
- AVAHI_LLIST_PREPEND(Entry, entries, m->entries_list, e);
-
- idx = m->hash_func(key) % HASH_MAP_SIZE;
- AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
-
- return 0;
-}
-
-void avahi_hashmap_remove(AvahiHashmap *m, const void *key) {
- Entry *e;
-
- assert(m);
-
- if (!(e = entry_get(m, key)))
- return;
-
- entry_free(m, e, 0);
-}
-
-void avahi_hashmap_foreach(AvahiHashmap *m, AvahiHashmapForeachCallback callback, void *userdata) {
- Entry *e, *next;
- assert(m);
- assert(callback);
-
- for (e = m->entries_list; e; e = next) {
- next = e->entries_next;
-
- callback(e->key, e->value, userdata);
- }
-}
-
-unsigned avahi_string_hash(const void *data) {
- const char *p = data;
- unsigned hash = 0;
-
- assert(p);
-
- for (; *p; p++)
- hash = 31 * hash + *p;
-
- return hash;
-}
-
-int avahi_string_equal(const void *a, const void *b) {
- const char *p = a, *q = b;
-
- assert(p);
- assert(q);
-
- return strcmp(p, q) == 0;
-}
-
-unsigned avahi_int_hash(const void *data) {
- const int *i = data;
-
- assert(i);
-
- return (unsigned) *i;
-}
-
-int avahi_int_equal(const void *a, const void *b) {
- const int *_a = a, *_b = b;
-
- assert(_a);
- assert(_b);
-
- return *_a == *_b;
-}
diff --git a/release-0.6.9/avahi-core/hashmap.h b/release-0.6.9/avahi-core/hashmap.h
deleted file mode 100644
index 120cf30..0000000
--- a/release-0.6.9/avahi-core/hashmap.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef foohashmaphfoo
-#define foohashmaphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-typedef struct AvahiHashmap AvahiHashmap;
-
-typedef unsigned (*AvahiHashFunc)(const void *data);
-typedef int (*AvahiEqualFunc)(const void *a, const void *b);
-typedef void (*AvahiFreeFunc)(void *p);
-
-AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_func, AvahiFreeFunc key_free_func, AvahiFreeFunc value_free_func);
-
-void avahi_hashmap_free(AvahiHashmap *m);
-void* avahi_hashmap_lookup(AvahiHashmap *m, const void *key);
-int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value);
-int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value);
-void avahi_hashmap_remove(AvahiHashmap *m, const void *key);
-
-typedef void (*AvahiHashmapForeachCallback)(void *key, void *value, void *userdata);
-
-void avahi_hashmap_foreach(AvahiHashmap *m, AvahiHashmapForeachCallback callback, void *userdata);
-
-unsigned avahi_string_hash(const void *data);
-int avahi_string_equal(const void *a, const void *b);
-
-unsigned avahi_int_hash(const void *data);
-int avahi_int_equal(const void *a, const void *b);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/iface-linux.c b/release-0.6.9/avahi-core/iface-linux.c
deleted file mode 100644
index 910000d..0000000
--- a/release-0.6.9/avahi-core/iface-linux.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <net/if.h>
-#include <errno.h>
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-
-#include "log.h"
-#include "iface.h"
-#include "iface-linux.h"
-
-static int netlink_list_items(AvahiNetlink *nl, uint16_t type, unsigned *ret_seq) {
- struct nlmsghdr *n;
- struct rtgenmsg *gen;
- uint8_t req[1024];
-
- /* Issue a wild dump NETLINK request */
-
- memset(&req, 0, sizeof(req));
- n = (struct nlmsghdr*) req;
- n->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
- n->nlmsg_type = type;
- n->nlmsg_flags = NLM_F_ROOT|NLM_F_REQUEST;
- n->nlmsg_pid = 0;
-
- gen = NLMSG_DATA(n);
- memset(gen, 0, sizeof(struct rtgenmsg));
- gen->rtgen_family = AF_UNSPEC;
-
- return avahi_netlink_send(nl, n, ret_seq);
-}
-
-static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdata) {
- AvahiInterfaceMonitor *m = userdata;
-
- /* This routine is called for every RTNETLINK response packet */
-
- assert(m);
- assert(n);
- assert(m->osdep.netlink == nl);
-
- if (n->nlmsg_type == RTM_NEWLINK) {
-
- /* A new interface appeared or an existing one has been modified */
-
- struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
- AvahiHwInterface *hw;
- struct rtattr *a = NULL;
- size_t l;
-
- /* A (superfluous?) sanity check */
- if (ifinfomsg->ifi_family != AF_UNSPEC)
- return;
-
- /* Check whether there already is an AvahiHwInterface object
- * for this link, so that we can update its data. Note that
- * Netlink sends us an RTM_NEWLINK not only when a new
- * interface appears, but when it changes, too */
-
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, ifinfomsg->ifi_index)))
-
- /* No object found, so let's create a new
- * one. avahi_hw_interface_new() will call
- * avahi_interface_new() internally twice for IPv4 and
- * IPv6, so there is no need for us to do that
- * ourselves */
- if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) ifinfomsg->ifi_index)))
- return; /* OOM */
-
- /* Check whether the flags of this interface are OK for us */
- hw->flags_ok =
- (ifinfomsg->ifi_flags & IFF_UP) &&
- (!m->server->config.use_iff_running || (ifinfomsg->ifi_flags & IFF_RUNNING)) &&
- !(ifinfomsg->ifi_flags & IFF_LOOPBACK) &&
- (ifinfomsg->ifi_flags & IFF_MULTICAST) &&
- (m->server->config.allow_point_to_point || !(ifinfomsg->ifi_flags & IFF_POINTOPOINT));
-
- /* Handle interface attributes */
- l = NLMSG_PAYLOAD(n, sizeof(struct ifinfomsg));
- a = IFLA_RTA(ifinfomsg);
-
- while (RTA_OK(a, l)) {
- switch(a->rta_type) {
- case IFLA_IFNAME:
-
- /* Fill in interface name */
- avahi_free(hw->name);
- hw->name = avahi_strndup(RTA_DATA(a), RTA_PAYLOAD(a));
- break;
-
- case IFLA_MTU:
-
- /* Fill in MTU */
- assert(RTA_PAYLOAD(a) == sizeof(unsigned int));
- hw->mtu = *((unsigned int*) RTA_DATA(a));
- break;
-
- case IFLA_ADDRESS:
-
- /* Fill in hardware (MAC) address */
- hw->mac_address_size = RTA_PAYLOAD(a);
- if (hw->mac_address_size > AVAHI_MAC_ADDRESS_MAX)
- hw->mac_address_size = AVAHI_MAC_ADDRESS_MAX;
-
- memcpy(hw->mac_address, RTA_DATA(a), hw->mac_address_size);
- break;
-
- default:
- ;
- }
-
- a = RTA_NEXT(a, l);
- }
-
- /* Check whether this interface is now "relevant" for us. If
- * it is Avahi will start to announce its records on this
- * interface and send out queries for subscribed records on
- * it */
- avahi_hw_interface_check_relevant(hw);
-
- /* Update any associated RRs of this interface. (i.e. the
- * _workstation._tcp record containing the MAC address) */
- avahi_hw_interface_update_rrs(hw, 0);
-
- } else if (n->nlmsg_type == RTM_DELLINK) {
-
- /* An interface has been removed */
-
- struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
- AvahiHwInterface *hw;
-
- /* A (superfluous?) sanity check */
- if (ifinfomsg->ifi_family != AF_UNSPEC)
- return;
-
- /* Get a reference to our AvahiHwInterface object of this interface */
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) ifinfomsg->ifi_index)))
- return;
-
- /* Free our object */
- avahi_hw_interface_free(hw, 0);
-
- } else if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
-
- /* An address has been added, modified or removed */
-
- struct ifaddrmsg *ifaddrmsg = NLMSG_DATA(n);
- AvahiInterface *i;
- struct rtattr *a = NULL;
- size_t l;
- AvahiAddress raddr;
- int raddr_valid = 0;
-
- /* We are only interested in IPv4 and IPv6 */
- if (ifaddrmsg->ifa_family != AF_INET && ifaddrmsg->ifa_family != AF_INET6)
- return;
-
- /* Try to get a reference to our AvahiInterface object for the
- * interface this address is assigned to. If ther is no object
- * for this interface, we ignore this address. */
- if (!(i = avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifaddrmsg->ifa_index, avahi_af_to_proto(ifaddrmsg->ifa_family))))
- return;
-
- /* Fill in address family for our new address */
- raddr.proto = avahi_af_to_proto(ifaddrmsg->ifa_family);
-
- l = NLMSG_PAYLOAD(n, sizeof(struct ifaddrmsg));
- a = IFA_RTA(ifaddrmsg);
-
- while (RTA_OK(a, l)) {
-
- switch(a->rta_type) {
- case IFA_ADDRESS:
- /* Fill in address data */
-
- if ((raddr.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
- (raddr.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
- return;
-
- memcpy(raddr.data.data, RTA_DATA(a), RTA_PAYLOAD(a));
- raddr_valid = 1;
-
- break;
-
- default:
- ;
- }
-
- a = RTA_NEXT(a, l);
- }
-
- /* If there was no adress attached to this message, let's quit. */
- if (!raddr_valid)
- return;
-
- if (n->nlmsg_type == RTM_NEWADDR) {
- AvahiInterfaceAddress *addr;
-
- /* This address is new or has been modified, so let's get an object for it */
- if (!(addr = avahi_interface_monitor_get_address(m, i, &raddr)))
-
- /* Mmm, no object existing yet, so let's create a new one */
- if (!(addr = avahi_interface_address_new(m, i, &raddr, ifaddrmsg->ifa_prefixlen)))
- return; /* OOM */
-
- /* Update the scope field for the address */
- addr->global_scope = ifaddrmsg->ifa_scope == RT_SCOPE_UNIVERSE || ifaddrmsg->ifa_scope == RT_SCOPE_SITE;
- } else {
- AvahiInterfaceAddress *addr;
- assert(n->nlmsg_type == RTM_DELADDR);
-
- /* Try to get a reference to our AvahiInterfaceAddress object for this address */
- if (!(addr = avahi_interface_monitor_get_address(m, i, &raddr)))
- return;
-
- /* And free it */
- avahi_interface_address_free(addr);
- }
-
- /* Avahi only considers interfaces with at least one address
- * attached relevant. Since we migh have added or removed an
- * address, let's have it check again whether the interface is
- * now relevant */
- avahi_interface_check_relevant(i);
-
- /* Update any associated RRs, like A or AAAA for our new/removed address */
- avahi_interface_update_rrs(i, 0);
-
- } else if (n->nlmsg_type == NLMSG_DONE) {
-
- /* This wild dump request ended, so let's see what we do next */
-
- if (m->osdep.list == LIST_IFACE) {
-
- /* Mmmm, interfaces have been wild dumped already, so
- * let's go on with wild dumping the addresses */
-
- if (netlink_list_items(m->osdep.netlink, RTM_GETADDR, &m->osdep.query_addr_seq) < 0) {
- avahi_log_warn("NETLINK: Failed to list addrs: %s", strerror(errno));
- m->osdep.list = LIST_DONE;
- } else
-
- /* Update state information */
- m->osdep.list = LIST_ADDR;
-
- } else
- /* We're done. Tell avahi_interface_monitor_sync() to finish. */
- m->osdep.list = LIST_DONE;
-
- if (m->osdep.list == LIST_DONE) {
-
- /* Only after this boolean variable has been set, Avahi
- * will start to announce or browse on all interfaces. It
- * is originaly set to 0, which means that relevancy
- * checks and RR updates are disabled during the wild
- * dumps. */
- m->list_complete = 1;
-
- /* So let's check if any interfaces are relevant now */
- avahi_interface_monitor_check_relevant(m);
-
- /* And update all RRs attached to any interface */
- avahi_interface_monitor_update_rrs(m, 0);
-
- /* Tell the user that the wild dump is complete */
- avahi_log_info("Network interface enumeration completed.");
- }
-
- } else if (n->nlmsg_type == NLMSG_ERROR &&
- (n->nlmsg_seq == m->osdep.query_link_seq || n->nlmsg_seq == m->osdep.query_addr_seq)) {
- struct nlmsgerr *e = NLMSG_DATA (n);
-
- /* Some kind of error happened. Let's just tell the user and
- * ignore it otherwise */
-
- if (e->error)
- avahi_log_warn("NETLINK: Failed to browse: %s", strerror(-e->error));
- }
-}
-
-int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
- assert(m);
-
- /* Initialize our own data */
-
- m->osdep.netlink = NULL;
- m->osdep.query_addr_seq = m->osdep.query_link_seq = 0;
-
- /* Create a netlink object for us. It abstracts some things and
- * makes netlink easier to use. It will attach to the main loop
- * for us and call netlink_callback() whenever an event
- * happens. */
- if (!(m->osdep.netlink = avahi_netlink_new(m->server->poll_api, RTMGRP_LINK|RTMGRP_IPV4_IFADDR|RTMGRP_IPV6_IFADDR, netlink_callback, m)))
- goto fail;
-
- /* Set the initial state. */
- m->osdep.list = LIST_IFACE;
-
- /* Start the wild dump for the interfaces */
- if (netlink_list_items(m->osdep.netlink, RTM_GETLINK, &m->osdep.query_link_seq) < 0)
- goto fail;
-
- return 0;
-
-fail:
-
- if (m->osdep.netlink) {
- avahi_netlink_free(m->osdep.netlink);
- m->osdep.netlink = NULL;
- }
-
- return -1;
-}
-
-void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m) {
- assert(m);
-
- if (m->osdep.netlink) {
- avahi_netlink_free(m->osdep.netlink);
- m->osdep.netlink = NULL;
- }
-}
-
-void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
- assert(m);
-
- /* Let's handle netlink events until we are done with wild
- * dumping */
-
- while (!m->list_complete)
- if (!avahi_netlink_work(m->osdep.netlink, 1) == 0)
- break;
-
- /* At this point Avahi knows about all local interfaces and
- * addresses in existance. */
-}
diff --git a/release-0.6.9/avahi-core/iface-linux.h b/release-0.6.9/avahi-core/iface-linux.h
deleted file mode 100644
index eed648c..0000000
--- a/release-0.6.9/avahi-core/iface-linux.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef fooifacelinuxhfoo
-#define fooifacelinuxhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
-
-#include "netlink.h"
-
-struct AvahiInterfaceMonitorOSDep {
- AvahiNetlink *netlink;
-
- unsigned query_addr_seq, query_link_seq;
-
- enum {
- LIST_IFACE,
- LIST_ADDR,
- LIST_DONE
- } list;
-};
-
-
-#endif
diff --git a/release-0.6.9/avahi-core/iface-pfroute.c b/release-0.6.9/avahi-core/iface-pfroute.c
deleted file mode 100644
index 8b76afa..0000000
--- a/release-0.6.9/avahi-core/iface-pfroute.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/malloc.h>
-
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/param.h>
-#include <sys/sysctl.h>
-
-#include <net/route.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <netinet/in.h>
-
-#include "log.h"
-#include "iface.h"
-#include "iface-pfroute.h"
-#include "util.h"
-
-static int bitcount (unsigned int n)
-{
- int count=0 ;
- while (n)
- {
- count++ ;
- n &= (n - 1) ;
- }
- return count ;
-}
-
-static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
-{
- AvahiHwInterface *hw;
- struct if_msghdr *ifm = (struct if_msghdr *)rtm;
- struct sockaddr_dl *sdl = (struct sockaddr_dl *)(ifm + 1);
-
- if (sdl->sdl_family != AF_LINK)
- return;
-
- if (ifm->ifm_addrs == 0 && ifm->ifm_index > 0) {
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) ifm->ifm_index)))
- return;
- avahi_hw_interface_free(hw, 0);
- return;
- }
-
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, ifm->ifm_index)))
- if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) ifm->ifm_index)))
- return; /* OOM */
-
- hw->flags_ok =
- (ifm->ifm_flags & IFF_UP) &&
- (!m->server->config.use_iff_running || (ifm->ifm_flags & IFF_RUNNING)) &&
- !(ifm->ifm_flags & IFF_LOOPBACK) &&
- (ifm->ifm_flags & IFF_MULTICAST) &&
- (m->server->config.allow_point_to_point || !(ifm->ifm_flags & IFF_POINTOPOINT));
-
- avahi_free(hw->name);
- hw->name = avahi_strndup(sdl->sdl_data, sdl->sdl_nlen);
-
- hw->mtu = ifm->ifm_data.ifi_mtu;
-
- hw->mac_address_size = sdl->sdl_alen;
- if (hw->mac_address_size > AVAHI_MAC_ADDRESS_MAX)
- hw->mac_address_size = AVAHI_MAC_ADDRESS_MAX;
-
- memcpy(hw->mac_address, sdl->sdl_data + sdl->sdl_nlen, hw->mac_address_size);
-
-/* { */
-/* char mac[256]; */
-/* avahi_log_debug("======\n name: %s\n index:%d\n mtu:%d\n mac:%s\n flags_ok:%d\n======", */
-/* hw->name, hw->index, */
-/* hw->mtu, */
-/* avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size), */
-/* hw->flags_ok); */
-/* } */
-
- avahi_hw_interface_check_relevant(hw);
- avahi_hw_interface_update_rrs(hw, 0);
-}
-
-#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
-
-static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
-{
- AvahiInterface *iface;
- AvahiAddress raddr;
- int raddr_valid = 0;
- struct ifa_msghdr *ifam = (struct ifa_msghdr *) rtm;
- char *cp = (char *)(ifam + 1);
- int addrs = ifam->ifam_addrs;
- int i;
- int prefixlen = 0;
- struct sockaddr *sa =NULL;
-
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- if(((struct sockaddr *)cp)->sa_family == AF_UNSPEC)
- ((struct sockaddr *)cp)->sa_family = AF_INET;
-#endif
-
- if(((struct sockaddr *)cp)->sa_family != AF_INET && ((struct sockaddr *)cp)->sa_family != AF_INET6)
- return;
-
- if (!(iface = avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifam->ifam_index, avahi_af_to_proto(((struct sockaddr *)cp)->sa_family))))
- return;
-
- raddr.proto = avahi_af_to_proto(((struct sockaddr *)cp)->sa_family);
-
- for(i = 0; addrs != 0 && i < RTAX_MAX; addrs &= ~(1<<i), i++)
- {
- if (!(addrs & 1<<i))
- continue;
- sa = (struct sockaddr *)cp;
- if (sa->sa_len == 0)
- continue;
- switch(sa->sa_family) {
- case AF_INET:
- switch (1<<i) {
- case RTA_NETMASK:
- prefixlen = bitcount((unsigned int)((struct sockaddr_in *)sa)->sin_addr.s_addr);
- break;
- case RTA_IFA:
- memcpy(raddr.data.data, &((struct sockaddr_in *)sa)->sin_addr, sizeof(struct in_addr));
- raddr_valid = 1;
- default:
- break;
- }
- break;
- case AF_INET6:
- switch (1<<i) {
- case RTA_NETMASK:
- prefixlen = bitcount((unsigned int)((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr);
- break;
- case RTA_IFA:
- memcpy(raddr.data.data, &((struct sockaddr_in6 *)sa)->sin6_addr, sizeof(struct in6_addr));
- raddr_valid = 1;
- default:
- break;
- }
- break;
- default:
- break;
- }
-#ifdef SA_SIZE
- cp += SA_SIZE(sa);
-#else
- ADVANCE(cp, sa);
-#endif
- }
-
- if (!raddr_valid)
- return;
-
- if(rtm->rtm_type == RTM_NEWADDR)
- {
- AvahiInterfaceAddress *addriface;
- if (!(addriface = avahi_interface_monitor_get_address(m, iface, &raddr)))
- if (!(addriface = avahi_interface_address_new(m, iface, &raddr, prefixlen)))
- return; /* OOM */
- /* FIXME */
- /* addriface->global_scope = ifaddrmsg->ifa_scope == RT_SCOPE_UNIVERSE || ifaddrmsg->ifa_scope == RT_SCOPE_SITE; */
- addriface->global_scope = 1;
- }
- else
- {
- AvahiInterfaceAddress *addriface;
- assert(rtm->rtm_type == RTM_DELADDR);
- if (!(addriface = avahi_interface_monitor_get_address(m, iface, &raddr)))
- return;
- avahi_interface_address_free(addriface);
- }
-
- avahi_interface_check_relevant(iface);
- avahi_interface_update_rrs(iface, 0);
-}
-
-static void parse_rtmsg(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
-{
- assert(m);
- assert(rtm);
-
- if (rtm->rtm_version != RTM_VERSION) {
- avahi_log_warn("routing message version %d not understood",
- rtm->rtm_version);
- return;
- }
-
- switch (rtm->rtm_type) {
- case RTM_IFINFO:
- rtm_info(rtm,m);
- break;
- case RTM_NEWADDR:
- case RTM_DELADDR:
- rtm_addr(rtm,m);
- break;
- default:
- break;
- }
-}
-
-static void socket_event(AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event,void *userdata) {
- AvahiInterfaceMonitor *m = (AvahiInterfaceMonitor *)userdata;
- AvahiPfRoute *nl = m->osdep.pfroute;
- ssize_t bytes;
- char msg[2048];
-
- assert(m);
- assert(w);
- assert(nl);
- assert(fd == nl->fd);
-
- do {
- if((bytes = recv(nl->fd, msg, 2048, MSG_DONTWAIT)) < 0) {
- if (errno == EAGAIN || errno == EINTR)
- return;
- avahi_log_error(__FILE__": recv() failed: %s", strerror(errno));
- return;
- }
- parse_rtmsg((struct rt_msghdr *)msg, m);
- }
- while (bytes > 0);
-}
-
-int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
- int fd = -1;
- m->osdep.pfroute = NULL;
-
- assert(m);
-
- if ((fd = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0) {
- avahi_log_error(__FILE__": socket(PF_ROUTE): %s", strerror(errno));
- goto fail;
- }
-
- if (!(m->osdep.pfroute = avahi_new(AvahiPfRoute , 1))) {
- avahi_log_error(__FILE__": avahi_new() failed.");
- goto fail;
- }
- m->osdep.pfroute->fd = fd;
-
- if (!(m->osdep.pfroute->watch = m->server->poll_api->watch_new(m->server->poll_api,
- m->osdep.pfroute->fd,
- AVAHI_WATCH_IN,
- socket_event,
- m))) {
- avahi_log_error(__FILE__": Failed to create watch.");
- goto fail;
- }
-
- return 0;
-
-fail:
-
- if (m->osdep.pfroute) {
- if (m->osdep.pfroute->watch)
- m->server->poll_api->watch_free(m->osdep.pfroute->watch);
-
- if (fd >= 0)
- close(fd);
-
- m->osdep.pfroute = NULL;
- }
-
- return -1;
-}
-
-void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m) {
- assert(m);
-
- if (m->osdep.pfroute) {
- if (m->osdep.pfroute->watch)
- m->server->poll_api->watch_free(m->osdep.pfroute->watch);
-
- if (m->osdep.pfroute->fd >= 0)
- close(m->osdep.pfroute->fd);
-
- avahi_free(m->osdep.pfroute);
- m->osdep.pfroute = NULL;
- }
-}
-
-void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
- size_t needed;
- int mib[6];
- char *buf, *lim, *next, count = 0;
- struct rt_msghdr *rtm;
-
- assert(m);
-
- retry2:
- mib[0] = CTL_NET;
- mib[1] = PF_ROUTE;
- mib[2] = 0; /* protocol */
- mib[3] = 0; /* wildcard address family */
- mib[4] = NET_RT_IFLIST;
- mib[5] = 0; /* no flags */
- if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
- {
- avahi_log_error("sysctl failed: %s", strerror(errno));
- avahi_log_error("route-sysctl-estimate");
- return;
- }
- if ((buf = avahi_malloc(needed)) == NULL)
- {
- avahi_log_error("malloc failed in avahi_interface_monitor_sync");
- return;
- }
- if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
- avahi_log_warn("sysctl failed: %s", strerror(errno));
- if (errno == ENOMEM && count++ < 10) {
- avahi_log_warn("Routing table grew, retrying");
- sleep(1);
- avahi_free(buf);
- goto retry2;
- }
- }
- lim = buf + needed;
- for (next = buf; next < lim; next += rtm->rtm_msglen) {
- rtm = (struct rt_msghdr *)next;
- parse_rtmsg(rtm, m);
- }
-
- m->list_complete = 1;
- avahi_interface_monitor_check_relevant(m);
- avahi_interface_monitor_update_rrs(m, 0);
- avahi_log_info("Network interface enumeration completed.");
-}
diff --git a/release-0.6.9/avahi-core/iface-pfroute.h b/release-0.6.9/avahi-core/iface-pfroute.h
deleted file mode 100644
index 34098da..0000000
--- a/release-0.6.9/avahi-core/iface-pfroute.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef fooifacepfroutehfoo
-#define fooifacepfroutehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-#include <avahi-common/watch.h>
-
-typedef struct AvahiPfRoute AvahiPfRoute;
-struct AvahiPfRoute {
- int fd;
- AvahiWatch *watch;
- AvahiInterfaceMonitor *m;
-};
-
-typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
-
-struct AvahiInterfaceMonitorOSDep {
- AvahiPfRoute *pfroute;
-};
-
-#endif
diff --git a/release-0.6.9/avahi-core/iface.c b/release-0.6.9/avahi-core/iface.c
deleted file mode 100644
index 5685618..0000000
--- a/release-0.6.9/avahi-core/iface.c
+++ /dev/null
@@ -1,812 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-
-#include "iface.h"
-#include "dns.h"
-#include "socket.h"
-#include "announce.h"
-#include "util.h"
-#include "log.h"
-#include "multicast-lookup.h"
-#include "querier.h"
-
-void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs) {
- AvahiInterfaceMonitor *m;
-
- assert(a);
- m = a->monitor;
-
- if (a->interface->announcing &&
- m->list_complete &&
- avahi_interface_address_is_relevant(a) &&
- !remove_rrs &&
- m->server->config.publish_addresses &&
- (m->server->state == AVAHI_SERVER_RUNNING ||
- m->server->state == AVAHI_SERVER_REGISTERING)) {
-
- /* Fill the entry group */
- if (!a->entry_group)
- a->entry_group = avahi_s_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL);
-
- if (!a->entry_group) /* OOM */
- return;
-
- if (avahi_s_entry_group_is_empty(a->entry_group)) {
- char t[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(t, sizeof(t), &a->address);
-
- avahi_log_info("Registering new address record for %s on %s.", t, a->interface->hardware->name);
-
- if (avahi_server_add_address(m->server, a->entry_group, a->interface->hardware->index, a->interface->protocol, 0, NULL, &a->address) < 0) {
- avahi_log_warn(__FILE__": avahi_server_add_address() failed: %s", avahi_strerror(m->server->error));
- avahi_s_entry_group_free(a->entry_group);
- a->entry_group = NULL;
- return;
- }
-
- avahi_s_entry_group_commit(a->entry_group);
- }
- } else {
-
- /* Clear the entry group */
-
- if (a->entry_group && !avahi_s_entry_group_is_empty(a->entry_group)) {
- char t[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(t, sizeof(t), &a->address);
-
- if (avahi_s_entry_group_get_state(a->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING &&
- m->server->state == AVAHI_SERVER_REGISTERING)
- avahi_server_decrease_host_rr_pending(m->server);
-
- avahi_log_info("Withdrawing address record for %s on %s.", t, a->interface->hardware->name);
-
- avahi_s_entry_group_reset(a->entry_group);
- }
- }
-}
-
-void avahi_interface_update_rrs(AvahiInterface *i, int remove_rrs) {
- AvahiInterfaceAddress *a;
-
- assert(i);
-
- for (a = i->addresses; a; a = a->address_next)
- avahi_interface_address_update_rrs(a, remove_rrs);
-}
-
-void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs) {
- AvahiInterface *i;
- AvahiInterfaceMonitor *m;
-
- assert(hw);
- m = hw->monitor;
-
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- avahi_interface_update_rrs(i, remove_rrs);
-
- if (m->list_complete &&
- !remove_rrs &&
- m->server->config.publish_workstation &&
- (m->server->state == AVAHI_SERVER_RUNNING)) {
-
- if (!hw->entry_group)
- hw->entry_group = avahi_s_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL);
-
- if (!hw->entry_group)
- return; /* OOM */
-
- if (avahi_s_entry_group_is_empty(hw->entry_group)) {
- char name[AVAHI_LABEL_MAX], mac[256];
-
- avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size);
- snprintf(name, sizeof(name), "%s [%s]", m->server->host_name, mac);
-
- if (avahi_server_add_service(m->server, hw->entry_group, hw->index, AVAHI_PROTO_UNSPEC, 0, name, "_workstation._tcp", NULL, NULL, 9, NULL) < 0) {
- avahi_log_warn(__FILE__": avahi_server_add_service() failed: %s", avahi_strerror(m->server->error));
- avahi_s_entry_group_free(hw->entry_group);
- hw->entry_group = NULL;
- } else
- avahi_s_entry_group_commit(hw->entry_group);
- }
-
- } else {
-
- if (hw->entry_group && !avahi_s_entry_group_is_empty(hw->entry_group)) {
-
- if (avahi_s_entry_group_get_state(hw->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING)
- avahi_server_decrease_host_rr_pending(m->server);
-
- avahi_s_entry_group_reset(hw->entry_group);
- }
- }
-}
-
-void avahi_interface_monitor_update_rrs(AvahiInterfaceMonitor *m, int remove_rrs) {
- AvahiHwInterface *hw;
-
- assert(m);
-
- for (hw = m->hw_interfaces; hw; hw = hw->hardware_next)
- avahi_hw_interface_update_rrs(hw, remove_rrs);
-}
-
-static int interface_mdns_mcast_join(AvahiInterface *i, int join) {
- char at[AVAHI_ADDRESS_STR_MAX];
- int r;
- assert(i);
-
- if (!!join == !!i->mcast_joined)
- return 0;
-
- if (join) {
- AvahiInterfaceAddress *a;
-
- /* Look if there's an address with global scope */
- for (a = i->addresses; a; a = a->address_next)
- if (a->global_scope)
- break;
-
- /* No address with a global scope has been found, so let's use
- * any. */
- if (!a)
- a = i->addresses;
-
- /* Hmm, there is no address available. */
- if (!a) {
- avahi_log_warn(__FILE__": interface_mdns_mcast_join() called but no local address available.");
- return -1;
- }
-
- i->local_mcast_address = a->address;
- }
-
- avahi_log_info("%s mDNS multicast group on interface %s.%s with address %s.",
- join ? "Joining" : "Leaving",
- i->hardware->name,
- avahi_proto_to_string(i->protocol),
- avahi_address_snprint(at, sizeof(at), &i->local_mcast_address));
-
- if (i->protocol == AVAHI_PROTO_INET6)
- r = avahi_mdns_mcast_join_ipv6(i->monitor->server->fd_ipv6, &i->local_mcast_address.data.ipv6, i->hardware->index, join);
- else {
- assert(i->protocol == AVAHI_PROTO_INET);
-
- r = avahi_mdns_mcast_join_ipv4(i->monitor->server->fd_ipv4, &i->local_mcast_address.data.ipv4, i->hardware->index, join);
- }
-
- if (r < 0)
- i->mcast_joined = 0;
- else
- i->mcast_joined = join;
-
- return 0;
-}
-
-static int interface_mdns_mcast_rejoin(AvahiInterface *i) {
- AvahiInterfaceAddress *a, *usable = NULL, *found = NULL;
- assert(i);
-
- if (!i->mcast_joined)
- return 0;
-
- /* Check whether old address we joined with is still available. If
- * not, rejoin using an other address. */
-
- for (a = i->addresses; a; a = a->address_next) {
- if (a->global_scope && !usable)
- usable = a;
-
- if (avahi_address_cmp(&a->address, &i->local_mcast_address) == 0) {
-
- if (a->global_scope)
- /* No action necessary: the address still exists and
- * has global scope. */
- return 0;
-
- found = a;
- }
- }
-
- if (found && !usable)
- /* No action necessary: the address still exists and no better one has been found */
- return 0;
-
- interface_mdns_mcast_join(i, 0);
- return interface_mdns_mcast_join(i, 1);
-}
-
-void avahi_interface_address_free(AvahiInterfaceAddress *a) {
- assert(a);
- assert(a->interface);
-
- avahi_interface_address_update_rrs(a, 1);
- AVAHI_LLIST_REMOVE(AvahiInterfaceAddress, address, a->interface->addresses, a);
-
- if (a->entry_group)
- avahi_s_entry_group_free(a->entry_group);
-
- interface_mdns_mcast_rejoin(a->interface);
-
- avahi_free(a);
-}
-
-void avahi_interface_free(AvahiInterface *i, int send_goodbye) {
- assert(i);
-
- /* Handle goodbyes and remove announcers */
- avahi_goodbye_interface(i->monitor->server, i, send_goodbye, 1);
- avahi_response_scheduler_force(i->response_scheduler);
- assert(!i->announcers);
-
- if (i->mcast_joined)
- interface_mdns_mcast_join(i, 0);
-
- /* Remove queriers */
- avahi_querier_free_all(i);
- avahi_hashmap_free(i->queriers_by_key);
-
- /* Remove local RRs */
- avahi_interface_update_rrs(i, 1);
-
- while (i->addresses)
- avahi_interface_address_free(i->addresses);
-
- avahi_response_scheduler_free(i->response_scheduler);
- avahi_query_scheduler_free(i->query_scheduler);
- avahi_probe_scheduler_free(i->probe_scheduler);
- avahi_cache_free(i->cache);
-
- AVAHI_LLIST_REMOVE(AvahiInterface, interface, i->monitor->interfaces, i);
- AVAHI_LLIST_REMOVE(AvahiInterface, by_hardware, i->hardware->interfaces, i);
-
- avahi_free(i);
-}
-
-void avahi_hw_interface_free(AvahiHwInterface *hw, int send_goodbye) {
- assert(hw);
-
- avahi_hw_interface_update_rrs(hw, 1);
-
- while (hw->interfaces)
- avahi_interface_free(hw->interfaces, send_goodbye);
-
- if (hw->entry_group)
- avahi_s_entry_group_free(hw->entry_group);
-
- AVAHI_LLIST_REMOVE(AvahiHwInterface, hardware, hw->monitor->hw_interfaces, hw);
- avahi_hashmap_remove(hw->monitor->hashmap, &hw->index);
-
- avahi_free(hw->name);
- avahi_free(hw);
-}
-
-AvahiInterface* avahi_interface_new(AvahiInterfaceMonitor *m, AvahiHwInterface *hw, AvahiProtocol protocol) {
- AvahiInterface *i;
-
- assert(m);
- assert(hw);
- assert(AVAHI_PROTO_VALID(protocol));
-
- if (!(i = avahi_new(AvahiInterface, 1)))
- goto fail; /* OOM */
-
- i->monitor = m;
- i->hardware = hw;
- i->protocol = protocol;
- i->announcing = 0;
- i->mcast_joined = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiInterfaceAddress, i->addresses);
- AVAHI_LLIST_HEAD_INIT(AvahiAnnouncer, i->announcers);
-
- AVAHI_LLIST_HEAD_INIT(AvahiQuerier, i->queriers);
- i->queriers_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL);
-
- i->cache = avahi_cache_new(m->server, i);
- i->response_scheduler = avahi_response_scheduler_new(i);
- i->query_scheduler = avahi_query_scheduler_new(i);
- i->probe_scheduler = avahi_probe_scheduler_new(i);
-
- if (!i->cache || !i->response_scheduler || !i->query_scheduler || !i->probe_scheduler)
- goto fail; /* OOM */
-
- AVAHI_LLIST_PREPEND(AvahiInterface, by_hardware, hw->interfaces, i);
- AVAHI_LLIST_PREPEND(AvahiInterface, interface, m->interfaces, i);
-
- return i;
-
-fail:
-
- if (i) {
- if (i->cache)
- avahi_cache_free(i->cache);
- if (i->response_scheduler)
- avahi_response_scheduler_free(i->response_scheduler);
- if (i->query_scheduler)
- avahi_query_scheduler_free(i->query_scheduler);
- if (i->probe_scheduler)
- avahi_probe_scheduler_free(i->probe_scheduler);
- }
-
- return NULL;
-}
-
-AvahiHwInterface *avahi_hw_interface_new(AvahiInterfaceMonitor *m, AvahiIfIndex idx) {
- AvahiHwInterface *hw;
-
- assert(m);
- assert(AVAHI_IF_VALID(idx));
-
- if (!(hw = avahi_new(AvahiHwInterface, 1)))
- return NULL;
-
- hw->monitor = m;
- hw->name = NULL;
- hw->flags_ok = 0;
- hw->mtu = 1500;
- hw->index = idx;
- hw->mac_address_size = 0;
- hw->entry_group = NULL;
-
- AVAHI_LLIST_HEAD_INIT(AvahiInterface, hw->interfaces);
- AVAHI_LLIST_PREPEND(AvahiHwInterface, hardware, m->hw_interfaces, hw);
-
- avahi_hashmap_insert(m->hashmap, &hw->index, hw);
-
- if (m->server->fd_ipv4 >= 0)
- avahi_interface_new(m, hw, AVAHI_PROTO_INET);
- if (m->server->fd_ipv6 >= 0)
- avahi_interface_new(m, hw, AVAHI_PROTO_INET6);
-
- return hw;
-}
-
-AvahiInterfaceAddress *avahi_interface_address_new(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *addr, unsigned prefix_len) {
- AvahiInterfaceAddress *a;
-
- assert(m);
- assert(i);
-
- if (!(a = avahi_new(AvahiInterfaceAddress, 1)))
- return NULL;
-
- a->interface = i;
- a->monitor = m;
- a->address = *addr;
- a->prefix_len = prefix_len;
- a->global_scope = 0;
- a->entry_group = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiInterfaceAddress, address, i->addresses, a);
-
- return a;
-}
-
-void avahi_interface_check_relevant(AvahiInterface *i) {
- int b;
- AvahiInterfaceMonitor *m;
-
- assert(i);
- m = i->monitor;
-
- b = avahi_interface_is_relevant(i);
-
- if (m->list_complete && b && !i->announcing) {
- avahi_log_info("New relevant interface %s.%s for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol));
-
- interface_mdns_mcast_join(i, 1);
-
- i->announcing = 1;
- avahi_announce_interface(m->server, i);
- avahi_multicast_lookup_engine_new_interface(m->server->multicast_lookup_engine, i);
- } else if (!b && i->announcing) {
- avahi_log_info("Interface %s.%s no longer relevant for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol));
-
- interface_mdns_mcast_join(i, 0);
-
- avahi_goodbye_interface(m->server, i, 0, 1);
- avahi_querier_free_all(i);
-
- avahi_response_scheduler_clear(i->response_scheduler);
- avahi_query_scheduler_clear(i->query_scheduler);
- avahi_probe_scheduler_clear(i->probe_scheduler);
- avahi_cache_flush(i->cache);
-
- i->announcing = 0;
-
- } else
- interface_mdns_mcast_rejoin(i);
-}
-
-void avahi_hw_interface_check_relevant(AvahiHwInterface *hw) {
- AvahiInterface *i;
-
- assert(hw);
-
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- avahi_interface_check_relevant(i);
-}
-
-void avahi_interface_monitor_check_relevant(AvahiInterfaceMonitor *m) {
- AvahiInterface *i;
-
- assert(m);
-
- for (i = m->interfaces; i; i = i->interface_next)
- avahi_interface_check_relevant(i);
-}
-
-AvahiInterfaceMonitor *avahi_interface_monitor_new(AvahiServer *s) {
- AvahiInterfaceMonitor *m = NULL;
-
- if (!(m = avahi_new0(AvahiInterfaceMonitor, 1)))
- return NULL; /* OOM */
-
- m->server = s;
- m->list_complete = 0;
- m->hashmap = avahi_hashmap_new(avahi_int_hash, avahi_int_equal, NULL, NULL);
-
- AVAHI_LLIST_HEAD_INIT(AvahiInterface, m->interfaces);
- AVAHI_LLIST_HEAD_INIT(AvahiHwInterface, m->hw_interfaces);
-
- if (avahi_interface_monitor_init_osdep(m) < 0)
- goto fail;
-
- return m;
-
-fail:
- avahi_interface_monitor_free(m);
- return NULL;
-}
-
-void avahi_interface_monitor_free(AvahiInterfaceMonitor *m) {
- assert(m);
-
- while (m->hw_interfaces)
- avahi_hw_interface_free(m->hw_interfaces, 1);
-
- assert(!m->interfaces);
-
- avahi_interface_monitor_free_osdep(m);
-
- if (m->hashmap)
- avahi_hashmap_free(m->hashmap);
-
- avahi_free(m);
-}
-
-
-AvahiInterface* avahi_interface_monitor_get_interface(AvahiInterfaceMonitor *m, AvahiIfIndex idx, AvahiProtocol protocol) {
- AvahiHwInterface *hw;
- AvahiInterface *i;
-
- assert(m);
- assert(idx >= 0);
- assert(protocol != AVAHI_PROTO_UNSPEC);
-
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, idx)))
- return NULL;
-
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- if (i->protocol == protocol)
- return i;
-
- return NULL;
-}
-
-AvahiHwInterface* avahi_interface_monitor_get_hw_interface(AvahiInterfaceMonitor *m, AvahiIfIndex idx) {
- assert(m);
- assert(idx > 0);
-
- return avahi_hashmap_lookup(m->hashmap, &idx);
-}
-
-AvahiInterfaceAddress* avahi_interface_monitor_get_address(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *raddr) {
- AvahiInterfaceAddress *ia;
-
- assert(m);
- assert(i);
- assert(raddr);
-
- for (ia = i->addresses; ia; ia = ia->address_next)
- if (avahi_address_cmp(&ia->address, raddr) == 0)
- return ia;
-
- return NULL;
-}
-
-void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port) {
- assert(i);
- assert(p);
-
- if (!avahi_interface_is_relevant(i))
- return;
-
- assert(!a || a->proto == i->protocol);
-
- if (i->protocol == AVAHI_PROTO_INET && i->monitor->server->fd_ipv4 >= 0)
- avahi_send_dns_packet_ipv4(i->monitor->server->fd_ipv4, i->hardware->index, p, i->mcast_joined ? &i->local_mcast_address.data.ipv4 : NULL, a ? &a->data.ipv4 : NULL, port);
- else if (i->protocol == AVAHI_PROTO_INET6 && i->monitor->server->fd_ipv6 >= 0)
- avahi_send_dns_packet_ipv6(i->monitor->server->fd_ipv6, i->hardware->index, p, i->mcast_joined ? &i->local_mcast_address.data.ipv6 : NULL, a ? &a->data.ipv6 : NULL, port);
-}
-
-void avahi_interface_send_packet(AvahiInterface *i, AvahiDnsPacket *p) {
- assert(i);
- assert(p);
-
- avahi_interface_send_packet_unicast(i, p, NULL, 0);
-}
-
-int avahi_interface_post_query(AvahiInterface *i, AvahiKey *key, int immediately, unsigned *ret_id) {
- assert(i);
- assert(key);
-
- if (avahi_interface_is_relevant(i))
- return avahi_query_scheduler_post(i->query_scheduler, key, immediately, ret_id);
-
- return 0;
-}
-
-int avahi_interface_withraw_query(AvahiInterface *i, unsigned id) {
-
- return avahi_query_scheduler_withdraw_by_id(i->query_scheduler, id);
-}
-
-int avahi_interface_post_response(AvahiInterface *i, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately) {
- assert(i);
- assert(record);
-
- if (avahi_interface_is_relevant(i))
- return avahi_response_scheduler_post(i->response_scheduler, record, flush_cache, querier, immediately);
-
- return 0;
-}
-
-int avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *record, int immediately) {
- assert(i);
- assert(record);
-
- if (avahi_interface_is_relevant(i))
- return avahi_probe_scheduler_post(i->probe_scheduler, record, immediately);
-
- return 0;
-}
-
-int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void* userdata) {
- AvahiInterface *i;
- assert(m);
-
- for (i = m->interfaces; i; i = i->interface_next) {
- if (avahi_interface_is_relevant(i)) {
- char ln[256];
- snprintf(ln, sizeof(ln), ";;; INTERFACE %s.%s ;;;", i->hardware->name, avahi_proto_to_string(i->protocol));
- callback(ln, userdata);
- if (avahi_cache_dump(i->cache, callback, userdata) < 0)
- return -1;
- }
- }
-
- return 0;
-}
-
-int avahi_interface_is_relevant(AvahiInterface *i) {
- AvahiInterfaceAddress *a;
- int relevant_address;
-
- assert(i);
-
- relevant_address = 0;
-
- for (a = i->addresses; a; a = a->address_next)
- if (avahi_interface_address_is_relevant(a)) {
- relevant_address = 1;
- break;
- }
-
- return i->hardware->flags_ok && relevant_address;
-}
-
-int avahi_interface_address_is_relevant(AvahiInterfaceAddress *a) {
- AvahiInterfaceAddress *b;
- assert(a);
-
- /* Publish public IP addresses */
- if (a->global_scope)
- return 1;
- else {
-
- /* Publish link local IP addresses if they are the only ones on the link */
- for (b = a->interface->addresses; b; b = b->address_next) {
- if (b == a)
- continue;
-
- if (b->global_scope)
- return 0;
- }
-
- return 1;
- }
-
- return 0;
-}
-
-int avahi_interface_match(AvahiInterface *i, AvahiIfIndex idx, AvahiProtocol protocol) {
- assert(i);
-
- if (idx != AVAHI_IF_UNSPEC && idx != i->hardware->index)
- return 0;
-
- if (protocol != AVAHI_PROTO_UNSPEC && protocol != i->protocol)
- return 0;
-
- return 1;
-}
-
-void avahi_interface_monitor_walk(AvahiInterfaceMonitor *m, AvahiIfIndex interface, AvahiProtocol protocol, AvahiInterfaceMonitorWalkCallback callback, void* userdata) {
- assert(m);
- assert(callback);
-
- if (interface != AVAHI_IF_UNSPEC) {
- if (protocol != AVAHI_PROTO_UNSPEC) {
- AvahiInterface *i;
-
- if ((i = avahi_interface_monitor_get_interface(m, interface, protocol)))
- callback(m, i, userdata);
-
- } else {
- AvahiHwInterface *hw;
- AvahiInterface *i;
-
- if ((hw = avahi_interface_monitor_get_hw_interface(m, interface)))
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- if (avahi_interface_match(i, interface, protocol))
- callback(m, i, userdata);
- }
-
- } else {
- AvahiInterface *i;
-
- for (i = m->interfaces; i; i = i->interface_next)
- if (avahi_interface_match(i, interface, protocol))
- callback(m, i, userdata);
- }
-}
-
-
-int avahi_address_is_local(AvahiInterfaceMonitor *m, const AvahiAddress *a) {
- AvahiInterface *i;
- AvahiInterfaceAddress *ia;
- assert(m);
- assert(a);
-
- for (i = m->interfaces; i; i = i->interface_next)
- for (ia = i->addresses; ia; ia = ia->address_next)
- if (avahi_address_cmp(a, &ia->address) == 0)
- return 1;
-
- return 0;
-}
-
-int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a) {
- AvahiInterfaceAddress *ia;
-
- assert(i);
- assert(a);
-
- if (a->proto != i->protocol)
- return 0;
-
- for (ia = i->addresses; ia; ia = ia->address_next) {
-
- if (a->proto == AVAHI_PROTO_INET) {
- uint32_t m;
-
- m = ~(((uint32_t) -1) >> ia->prefix_len);
-
- if ((ntohl(a->data.ipv4.address) & m) == (ntohl(ia->address.data.ipv4.address) & m))
- return 1;
- } else {
- unsigned j;
- unsigned char pl;
- assert(a->proto == AVAHI_PROTO_INET6);
-
- pl = ia->prefix_len;
-
- for (j = 0; j < 16; j++) {
- uint8_t m;
-
- if (pl == 0)
- return 1;
-
- if (pl >= 8) {
- m = 0xFF;
- pl -= 8;
- } else {
- m = ~(0xFF >> pl);
- pl = 0;
- }
-
- if ((a->data.ipv6.address[j] & m) != (ia->address.data.ipv6.address[j] & m))
- break;
- }
- }
- }
-
- return 0;
-}
-
-int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, const AvahiAddress *a) {
- AvahiInterface *i;
- AvahiInterfaceAddress *j;
-
- assert(m);
- assert(iface != AVAHI_IF_UNSPEC);
- assert(a);
-
- if (!(i = avahi_interface_monitor_get_interface(m, iface, a->proto)))
- return 0;
-
- for (j = i->addresses; j; j = j->address_next)
- if (avahi_address_cmp(a, &j->address) == 0)
- return 1;
-
- return 0;
-}
-
-AvahiIfIndex avahi_find_interface_for_address(AvahiInterfaceMonitor *m, const AvahiAddress *a) {
- AvahiInterface *i;
- assert(m);
-
- /* Some stupid OS don't support passing the interface index when a
- * packet is recieved. We have to work around that limitation by
- * looking for an interface that has the incoming address
- * attached. This is sometimes ambiguous, but we have to live with
- * it. */
-
- for (i = m->interfaces; i; i = i->interface_next) {
- AvahiInterfaceAddress *ai;
-
- if (i->protocol != a->proto)
- continue;
-
- for (ai = i->addresses; ai; ai = ai->address_next)
- if (avahi_address_cmp(a, &ai->address) == 0)
- return i->hardware->index;
- }
-
- return AVAHI_IF_UNSPEC;
-}
diff --git a/release-0.6.9/avahi-core/iface.h b/release-0.6.9/avahi-core/iface.h
deleted file mode 100644
index 4106ea7..0000000
--- a/release-0.6.9/avahi-core/iface.h
+++ /dev/null
@@ -1,192 +0,0 @@
-#ifndef fooifacehfoo
-#define fooifacehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiInterfaceMonitor AvahiInterfaceMonitor;
-typedef struct AvahiInterfaceAddress AvahiInterfaceAddress;
-typedef struct AvahiInterface AvahiInterface;
-typedef struct AvahiHwInterface AvahiHwInterface;
-
-#include <avahi-common/llist.h>
-#include <avahi-common/address.h>
-
-#include "internal.h"
-#include "cache.h"
-#include "response-sched.h"
-#include "query-sched.h"
-#include "probe-sched.h"
-#include "dns.h"
-#include "announce.h"
-#include "browse.h"
-#include "querier.h"
-
-#ifdef HAVE_NETLINK
-#include "iface-linux.h"
-#elif defined(HAVE_PF_ROUTE)
-#include "iface-pfroute.h"
-#else
-typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
-struct AvahiInterfaceMonitorOSDep {
-
- unsigned query_addr_seq, query_link_seq;
-
- enum {
- LIST_IFACE,
- LIST_ADDR,
- LIST_DONE
- } list;
-};
-#endif
-
-#define AVAHI_MAC_ADDRESS_MAX 32
-
-struct AvahiInterfaceMonitor {
- AvahiServer *server;
- AvahiHashmap *hashmap;
-
- AVAHI_LLIST_HEAD(AvahiInterface, interfaces);
- AVAHI_LLIST_HEAD(AvahiHwInterface, hw_interfaces);
-
- int list_complete;
- AvahiInterfaceMonitorOSDep osdep;
-};
-
-struct AvahiHwInterface {
- AvahiInterfaceMonitor *monitor;
-
- AVAHI_LLIST_FIELDS(AvahiHwInterface, hardware);
-
- char *name;
- AvahiIfIndex index;
- int flags_ok;
-
- unsigned mtu;
-
- uint8_t mac_address[AVAHI_MAC_ADDRESS_MAX];
- size_t mac_address_size;
-
- AvahiSEntryGroup *entry_group;
-
- AVAHI_LLIST_HEAD(AvahiInterface, interfaces);
-};
-
-struct AvahiInterface {
- AvahiInterfaceMonitor *monitor;
- AvahiHwInterface *hardware;
-
- AVAHI_LLIST_FIELDS(AvahiInterface, interface);
- AVAHI_LLIST_FIELDS(AvahiInterface, by_hardware);
-
- AvahiProtocol protocol;
- int announcing;
- AvahiAddress local_mcast_address;
- int mcast_joined;
-
- AvahiCache *cache;
-
- AvahiQueryScheduler *query_scheduler;
- AvahiResponseScheduler * response_scheduler;
- AvahiProbeScheduler *probe_scheduler;
-
- AVAHI_LLIST_HEAD(AvahiInterfaceAddress, addresses);
- AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
-
- AvahiHashmap *queriers_by_key;
- AVAHI_LLIST_HEAD(AvahiQuerier, queriers);
-};
-
-struct AvahiInterfaceAddress {
- AvahiInterfaceMonitor *monitor;
- AvahiInterface *interface;
-
- AVAHI_LLIST_FIELDS(AvahiInterfaceAddress, address);
-
- AvahiAddress address;
- unsigned prefix_len;
-
- int global_scope;
-
- AvahiSEntryGroup *entry_group;
-};
-
-AvahiInterfaceMonitor *avahi_interface_monitor_new(AvahiServer *server);
-void avahi_interface_monitor_free(AvahiInterfaceMonitor *m);
-
-int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m);
-void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m);
-void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m);
-
-typedef void (*AvahiInterfaceMonitorWalkCallback)(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata);
-void avahi_interface_monitor_walk(AvahiInterfaceMonitor *m, AvahiIfIndex idx, AvahiProtocol protocol, AvahiInterfaceMonitorWalkCallback callback, void* userdata);
-int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void* userdata);
-
-void avahi_interface_monitor_update_rrs(AvahiInterfaceMonitor *m, int remove_rrs);
-int avahi_address_is_local(AvahiInterfaceMonitor *m, const AvahiAddress *a);
-void avahi_interface_monitor_check_relevant(AvahiInterfaceMonitor *m);
-
-/* AvahiHwInterface */
-
-AvahiHwInterface *avahi_hw_interface_new(AvahiInterfaceMonitor *m, AvahiIfIndex idx);
-void avahi_hw_interface_free(AvahiHwInterface *hw, int send_goodbye);
-
-void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs);
-void avahi_hw_interface_check_relevant(AvahiHwInterface *hw);
-
-AvahiHwInterface* avahi_interface_monitor_get_hw_interface(AvahiInterfaceMonitor *m, int idx);
-
-/* AvahiInterface */
-
-AvahiInterface* avahi_interface_new(AvahiInterfaceMonitor *m, AvahiHwInterface *hw, AvahiProtocol protocol);
-void avahi_interface_free(AvahiInterface *i, int send_goodbye);
-
-void avahi_interface_update_rrs(AvahiInterface *i, int remove_rrs);
-void avahi_interface_check_relevant(AvahiInterface *i);
-int avahi_interface_is_relevant(AvahiInterface *i);
-
-void avahi_interface_send_packet(AvahiInterface *i, AvahiDnsPacket *p);
-void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port);
-
-int avahi_interface_post_query(AvahiInterface *i, AvahiKey *k, int immediately, unsigned *ret_id);
-int avahi_interface_withraw_query(AvahiInterface *i, unsigned id);
-int avahi_interface_post_response(AvahiInterface *i, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately);
-int avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *p, int immediately);
-
-int avahi_interface_match(AvahiInterface *i, AvahiIfIndex idx, AvahiProtocol protocol);
-int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a);
-int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, const AvahiAddress *a);
-
-AvahiInterface* avahi_interface_monitor_get_interface(AvahiInterfaceMonitor *m, AvahiIfIndex idx, AvahiProtocol protocol);
-
-/* AvahiInterfaceAddress */
-
-AvahiInterfaceAddress *avahi_interface_address_new(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *addr, unsigned prefix_len);
-void avahi_interface_address_free(AvahiInterfaceAddress *a);
-
-void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs);
-int avahi_interface_address_is_relevant(AvahiInterfaceAddress *a);
-
-AvahiInterfaceAddress* avahi_interface_monitor_get_address(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *raddr);
-
-AvahiIfIndex avahi_find_interface_for_address(AvahiInterfaceMonitor *m, const AvahiAddress *a);
-
-#endif
diff --git a/release-0.6.9/avahi-core/internal.h b/release-0.6.9/avahi-core/internal.h
deleted file mode 100644
index 0d88d5a..0000000
--- a/release-0.6.9/avahi-core/internal.h
+++ /dev/null
@@ -1,227 +0,0 @@
-#ifndef foointernalhfoo
-#define foointernalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** A locally registered DNS resource record */
-typedef struct AvahiEntry AvahiEntry;
-
-#include <avahi-common/llist.h>
-#include <avahi-common/watch.h>
-
-#include "core.h"
-#include "iface.h"
-#include "prioq.h"
-#include "timeeventq.h"
-#include "announce.h"
-#include "browse.h"
-#include "dns.h"
-#include "rrlist.h"
-#include "hashmap.h"
-#include "wide-area.h"
-#include "multicast-lookup.h"
-#include "dns-srv-rr.h"
-
-#define AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX 100
-
-#define AVAHI_FLAGS_VALID(flags, max) (!((flags) & ~(max)))
-
-#define AVAHI_RR_HOLDOFF_MSEC 1000
-#define AVAHI_RR_HOLDOFF_MSEC_RATE_LIMIT 20000
-#define AVAHI_RR_RATE_LIMIT_COUNT 15
-
-typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot;
-
-struct AvahiLegacyUnicastReflectSlot {
- AvahiServer *server;
-
- uint16_t id, original_id;
- AvahiAddress address;
- uint16_t port;
- int interface;
- struct timeval elapse_time;
- AvahiTimeEvent *time_event;
-};
-
-struct AvahiEntry {
- AvahiServer *server;
- AvahiSEntryGroup *group;
-
- int dead;
-
- AvahiPublishFlags flags;
- AvahiRecord *record;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- AVAHI_LLIST_FIELDS(AvahiEntry, entries);
- AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
- AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
-
- AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
-};
-
-struct AvahiSEntryGroup {
- AvahiServer *server;
- int dead;
-
- AvahiEntryGroupState state;
- void* userdata;
- AvahiSEntryGroupCallback callback;
-
- unsigned n_probing;
-
- unsigned n_register_try;
- struct timeval register_time;
- AvahiTimeEvent *register_time_event;
-
- struct timeval established_at;
-
- AVAHI_LLIST_FIELDS(AvahiSEntryGroup, groups);
- AVAHI_LLIST_HEAD(AvahiEntry, entries);
-};
-
-struct AvahiServer {
- const AvahiPoll *poll_api;
-
- AvahiInterfaceMonitor *monitor;
- AvahiServerConfig config;
-
- AVAHI_LLIST_HEAD(AvahiEntry, entries);
- AvahiHashmap *entries_by_key;
-
- AVAHI_LLIST_HEAD(AvahiSEntryGroup, groups);
-
- AVAHI_LLIST_HEAD(AvahiSRecordBrowser, record_browsers);
- AvahiHashmap *record_browser_hashmap;
- AVAHI_LLIST_HEAD(AvahiSHostNameResolver, host_name_resolvers);
- AVAHI_LLIST_HEAD(AvahiSAddressResolver, address_resolvers);
- AVAHI_LLIST_HEAD(AvahiSDomainBrowser, domain_browsers);
- AVAHI_LLIST_HEAD(AvahiSServiceTypeBrowser, service_type_browsers);
- AVAHI_LLIST_HEAD(AvahiSServiceBrowser, service_browsers);
- AVAHI_LLIST_HEAD(AvahiSServiceResolver, service_resolvers);
- AVAHI_LLIST_HEAD(AvahiSDNSServerBrowser, dns_server_browsers);
-
- int need_entry_cleanup, need_group_cleanup, need_browser_cleanup;
-
- AvahiTimeEventQueue *time_event_queue;
-
- char *host_name, *host_name_fqdn, *domain_name;
-
- int fd_ipv4, fd_ipv6,
- /* The following two sockets two are used for reflection only */
- fd_legacy_unicast_ipv4, fd_legacy_unicast_ipv6;
-
- AvahiWatch *watch_ipv4, *watch_ipv6,
- *watch_legacy_unicast_ipv4, *watch_legacy_unicast_ipv6;
-
- AvahiServerState state;
- AvahiServerCallback callback;
- void* userdata;
-
- AvahiSEntryGroup *hinfo_entry_group;
- AvahiSEntryGroup *browse_domain_entry_group;
- unsigned n_host_rr_pending;
-
- /* Used for assembling responses */
- AvahiRecordList *record_list;
-
- /* Used for reflection of legacy unicast packets */
- AvahiLegacyUnicastReflectSlot **legacy_unicast_reflect_slots;
- uint16_t legacy_unicast_reflect_id;
-
- /* The last error code */
- int error;
-
- /* The local service cookie */
- uint32_t local_service_cookie;
-
- AvahiMulticastLookupEngine *multicast_lookup_engine;
- AvahiWideAreaLookupEngine *wide_area_lookup_engine;
-
- AvahiStringList *static_browse_domains;
-};
-
-void avahi_entry_free(AvahiServer*s, AvahiEntry *e);
-void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g);
-
-void avahi_cleanup_dead_entries(AvahiServer *s);
-
-void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, int unicast_response, int auxiliary);
-void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response);
-void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port, int legacy_unicast, int is_probe);
-
-void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state);
-
-int avahi_entry_is_commited(AvahiEntry *e);
-
-void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata);
-
-void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata);
-
-void avahi_server_decrease_host_rr_pending(AvahiServer *s);
-
-int avahi_server_set_errno(AvahiServer *s, int error);
-
-int avahi_server_is_service_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name);
-int avahi_server_is_record_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *record);
-
-int avahi_server_add_ptr(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- const char *dest);
-
-#define AVAHI_CHECK_VALIDITY(server, expression, error) { \
- if (!(expression)) \
- return avahi_server_set_errno((server), (error)); \
-}
-
-#define AVAHI_CHECK_VALIDITY_RETURN_NULL(server, expression, error) { \
- if (!(expression)) { \
- avahi_server_set_errno((server), (error)); \
- return NULL; \
- } \
-}
-
-#define AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(server, expression, error) {\
- if (!(expression)) { \
- ret = avahi_server_set_errno((server), (error)); \
- goto fail; \
- } \
-}
-
-#define AVAHI_ASSERT_TRUE(expression) { \
- int __tmp = !!(expression); \
- assert(__tmp); \
-}
-
-#define AVAHI_ASSERT_SUCCESS(expression) { \
- int __tmp = (expression); \
- assert(__tmp == 0); \
-}
-
-#endif
diff --git a/release-0.6.9/avahi-core/log.c b/release-0.6.9/avahi-core/log.c
deleted file mode 100644
index bfd4021..0000000
--- a/release-0.6.9/avahi-core/log.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "log.h"
-
-static AvahiLogFunction log_function = NULL;
-
-void avahi_set_log_function(AvahiLogFunction function) {
- log_function = function;
-}
-
-void avahi_log_ap(AvahiLogLevel level, const char*format, va_list ap) {
- char txt[256];
-
- vsnprintf(txt, sizeof(txt), format, ap);
-
- if (log_function)
- log_function(level, txt);
- else
- fprintf(stderr, "%s\n", txt);
-}
-
-void avahi_log(AvahiLogLevel level, const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(level, format, ap);
- va_end(ap);
-}
-
-void avahi_log_error(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_ERROR, format, ap);
- va_end(ap);
-}
-
-void avahi_log_warn(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_WARN, format, ap);
- va_end(ap);
-}
-
-void avahi_log_notice(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_NOTICE, format, ap);
- va_end(ap);
-}
-
-void avahi_log_info(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_INFO, format, ap);
- va_end(ap);
-}
-
-void avahi_log_debug(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_DEBUG, format, ap);
- va_end(ap);
-}
diff --git a/release-0.6.9/avahi-core/log.h b/release-0.6.9/avahi-core/log.h
deleted file mode 100644
index 25e3940..0000000
--- a/release-0.6.9/avahi-core/log.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef foologhfoo
-#define foologhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdarg.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/gccmacro.h>
-
-/** \file log.h Extensible logging subsystem */
-
-AVAHI_C_DECL_BEGIN
-
-/** Log level for avahi_log_xxx() */
-typedef enum {
- AVAHI_LOG_ERROR = 0, /**< Error messages */
- AVAHI_LOG_WARN = 1, /**< Warning messages */
- AVAHI_LOG_NOTICE = 2, /**< Notice messages */
- AVAHI_LOG_INFO = 3, /**< Info messages */
- AVAHI_LOG_DEBUG = 4, /**< Debug messages */
- AVAHI_LOG_LEVEL_MAX
-} AvahiLogLevel;
-
-/** Prototype for a user supplied log function */
-typedef void (*AvahiLogFunction)(AvahiLogLevel level, const char *txt);
-
-/** Set a user supplied log function, replacing the default which
- * prints to log messages unconditionally to STDERR. Pass NULL for
- * resetting to the default log function */
-void avahi_set_log_function(AvahiLogFunction function);
-
-/** Issue a log message using a va_list object */
-void avahi_log_ap(AvahiLogLevel level, const char *format, va_list ap);
-
-/** Issue a log message by passing a log level and a format string */
-void avahi_log(AvahiLogLevel level, const char*format, ...) AVAHI_GCC_PRINTF_ATTR23;
-
-/** Shortcut for avahi_log(AVAHI_LOG_ERROR, ...) */
-void avahi_log_error(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_WARN, ...) */
-void avahi_log_warn(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_NOTICE, ...) */
-void avahi_log_notice(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_INFO, ...) */
-void avahi_log_info(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_DEBUG, ...) */
-void avahi_log_debug(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/lookup.h b/release-0.6.9/avahi-core/lookup.h
deleted file mode 100644
index 0ce6fe8..0000000
--- a/release-0.6.9/avahi-core/lookup.h
+++ /dev/null
@@ -1,237 +0,0 @@
-#ifndef foolookuphfoo
-#define foolookuphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file avahi-core/lookup.h Functions for browsing/resolving services and other RRs */
-
-/** \example core-browse-services.c Example how to browse for DNS-SD
- * services using an embedded mDNS stack. */
-
-/** A browsing object for arbitrary RRs */
-typedef struct AvahiSRecordBrowser AvahiSRecordBrowser;
-
-/** A host name to IP adddress resolver object */
-typedef struct AvahiSHostNameResolver AvahiSHostNameResolver;
-
-/** An IP address to host name resolver object ("reverse lookup") */
-typedef struct AvahiSAddressResolver AvahiSAddressResolver;
-
-/** A local domain browsing object. May be used to enumerate domains used on the local LAN */
-typedef struct AvahiSDomainBrowser AvahiSDomainBrowser;
-
-/** A DNS-SD service type browsing object. May be used to enumerate the service types of all available services on the local LAN */
-typedef struct AvahiSServiceTypeBrowser AvahiSServiceTypeBrowser;
-
-/** A DNS-SD service browser. Use this to enumerate available services of a certain kind on the local LAN. Use AvahiSServiceResolver to get specific service data like address and port for a service. */
-typedef struct AvahiSServiceBrowser AvahiSServiceBrowser;
-
-/** A DNS-SD service resolver. Use this to retrieve addres, port and TXT data for a DNS-SD service */
-typedef struct AvahiSServiceResolver AvahiSServiceResolver;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/defs.h>
-#include <avahi-core/core.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Callback prototype for AvahiSRecordBrowser events */
-typedef void (*AvahiSRecordBrowserCallback)(
- AvahiSRecordBrowser *b, /**< The AvahiSRecordBrowser object that is emitting this callback */
- AvahiIfIndex interface, /**< Logical OS network interface number the record was found on */
- AvahiProtocol protocol, /**< Protocol number the record was found. */
- AvahiBrowserEvent event, /**< Browsing event, either AVAHI_BROWSER_NEW or AVAHI_BROWSER_REMOVE */
- AvahiRecord *record, /**< The record that was found */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata /**< Arbitrary user data passed to avahi_s_record_browser_new() */ );
-
-/** Create a new browsing object for arbitrary RRs */
-AvahiSRecordBrowser *avahi_s_record_browser_new(
- AvahiServer *server, /**< The server object to which attach this query */
- AvahiIfIndex interface, /**< Logical OS interface number where to look for the records, or AVAHI_IF_UNSPEC to look on interfaces */
- AvahiProtocol protocol, /**< Protocol number to use when looking for the record, or AVAHI_PROTO_UNSPEC to look on all protocols */
- AvahiKey *key, /**< The search key */
- AvahiLookupFlags flags, /**< Lookup flags. Must have set either AVAHI_LOOKUP_FORCE_WIDE_AREA or AVAHI_LOOKUP_FORCE_MULTICAST, since domain based detection is not available here. */
- AvahiSRecordBrowserCallback callback, /**< The callback to call on browsing events */
- void* userdata /**< Arbitrary use suppliable data which is passed to the callback */);
-
-/** Free an AvahiSRecordBrowser object */
-void avahi_s_record_browser_free(AvahiSRecordBrowser *b);
-
-/** Callback prototype for AvahiSHostNameResolver events */
-typedef void (*AvahiSHostNameResolverCallback)(
- AvahiSHostNameResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event, /**< Resolving event */
- const char *host_name, /**< Host name which should be resolved. May differ in case from the query */
- const AvahiAddress *a, /**< The address, or NULL if the host name couldn't be resolved. */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create an AvahiSHostNameResolver object for resolving a host name to an adddress. See AvahiSRecordBrowser for more info on the paramters. */
-AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *host_name, /**< The host name to look for */
- AvahiProtocol aprotocol, /**< The address family of the desired address or AVAHI_PROTO_UNSPEC if doesn't matter. */
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSHostNameResolverCallback calback,
- void* userdata);
-
-/** Free a AvahiSHostNameResolver object */
-void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r);
-
-/** Callback prototype for AvahiSAddressResolver events */
-typedef void (*AvahiSAddressResolverCallback)(
- AvahiSAddressResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *host_name, /**< A host name for the specified address, if one was found, i.e. event == AVAHI_RESOLVER_FOUND */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create an AvahiSAddressResolver object. See AvahiSRecordBrowser for more info on the paramters. */
-AvahiSAddressResolver *avahi_s_address_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *address,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSAddressResolverCallback calback,
- void* userdata);
-
-/** Free an AvahiSAddressResolver object */
-void avahi_s_address_resolver_free(AvahiSAddressResolver *r);
-
-/** Callback prototype for AvahiSDomainBrowser events */
-typedef void (*AvahiSDomainBrowserCallback)(
- AvahiSDomainBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSDomainBrowser object */
-AvahiSDomainBrowser *avahi_s_domain_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType type,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSDomainBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSDomainBrowser object */
-void avahi_s_domain_browser_free(AvahiSDomainBrowser *b);
-
-/** Callback prototype for AvahiSServiceTypeBrowser events */
-typedef void (*AvahiSServiceTypeBrowserCallback)(
- AvahiSServiceTypeBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSServiceTypeBrowser object. */
-AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSServiceTypeBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSServiceTypeBrowser object */
-void avahi_s_service_type_browser_free(AvahiSServiceTypeBrowser *b);
-
-/** Callback prototype for AvahiSServiceBrowser events */
-typedef void (*AvahiSServiceBrowserCallback)(
- AvahiSServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name /**< Service name, e.g. "Lennart's Files" */,
- const char *type /**< DNS-SD type, e.g. "_http._tcp" */,
- const char *domain /**< Domain of this service, e.g. "local" */,
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSServiceBrowser object. */
-AvahiSServiceBrowser *avahi_s_service_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *service_type /** DNS-SD service type, e.g. "_http._tcp" */,
- const char *domain,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSServiceBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSServiceBrowser object */
-void avahi_s_service_browser_free(AvahiSServiceBrowser *b);
-
-/** Callback prototype for AvahiSServiceResolver events */
-typedef void (*AvahiSServiceResolverCallback)(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event, /**< Is AVAHI_RESOLVER_FOUND when the service was resolved successfully, and everytime it changes. Is AVAHI_RESOLVER_TIMOUT when the service failed to resolve or disappeared. */
- const char *name, /**< Service name */
- const char *type, /**< Service Type */
- const char *domain,
- const char *host_name, /**< Host name of the service */
- const AvahiAddress *a, /**< The resolved host name */
- uint16_t port, /**< Service name */
- AvahiStringList *txt, /**< TXT record data */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSServiceResolver object. The specified callback function will be called with the resolved service data. */
-AvahiSServiceResolver *avahi_s_service_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol, /**< Address family of the desired service address. Use AVAHI_PROTO_UNSPEC if you don't care */
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSServiceResolverCallback calback,
- void* userdata);
-
-/** Free an AvahiSServiceResolver object */
-void avahi_s_service_resolver_free(AvahiSServiceResolver *r);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/multicast-lookup.c b/release-0.6.9/avahi-core/multicast-lookup.c
deleted file mode 100644
index c3afcb0..0000000
--- a/release-0.6.9/avahi-core/multicast-lookup.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/timeval.h>
-
-#include "internal.h"
-#include "browse.h"
-#include "socket.h"
-#include "log.h"
-#include "hashmap.h"
-#include "multicast-lookup.h"
-#include "rr-util.h"
-
-struct AvahiMulticastLookup {
- AvahiMulticastLookupEngine *engine;
- int dead;
-
- AvahiKey *key, *cname_key;
-
- AvahiMulticastLookupCallback callback;
- void *userdata;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- int queriers_added;
-
- AvahiTimeEvent *all_for_now_event;
-
- AVAHI_LLIST_FIELDS(AvahiMulticastLookup, lookups);
- AVAHI_LLIST_FIELDS(AvahiMulticastLookup, by_key);
-};
-
-struct AvahiMulticastLookupEngine {
- AvahiServer *server;
-
- /* Lookups */
- AVAHI_LLIST_HEAD(AvahiMulticastLookup, lookups);
- AvahiHashmap *lookups_by_key;
-
- int cleanup_dead;
-};
-
-static void all_for_now_callback(AvahiTimeEvent *e, void* userdata) {
- AvahiMulticastLookup *l = userdata;
-
- assert(e);
- assert(l);
-
- avahi_time_event_free(l->all_for_now_event);
- l->all_for_now_event = NULL;
-
- l->callback(l->engine, l->interface, l->protocol, AVAHI_BROWSER_ALL_FOR_NOW, AVAHI_LOOKUP_RESULT_MULTICAST, NULL, l->userdata);
-}
-
-AvahiMulticastLookup *avahi_multicast_lookup_new(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiKey *key,
- AvahiMulticastLookupCallback callback,
- void *userdata) {
-
- AvahiMulticastLookup *l, *t;
- struct timeval tv;
-
- assert(e);
- assert(AVAHI_IF_VALID(interface));
- assert(AVAHI_PROTO_VALID(protocol));
- assert(key);
- assert(callback);
-
- l = avahi_new(AvahiMulticastLookup, 1);
- l->engine = e;
- l->dead = 0;
- l->key = avahi_key_ref(key);
- l->cname_key = avahi_key_new_cname(l->key);
- l->callback = callback;
- l->userdata = userdata;
- l->interface = interface;
- l->protocol = protocol;
- l->all_for_now_event = NULL;
- l->queriers_added = 0;
-
- t = avahi_hashmap_lookup(e->lookups_by_key, l->key);
- AVAHI_LLIST_PREPEND(AvahiMulticastLookup, by_key, t, l);
- avahi_hashmap_replace(e->lookups_by_key, avahi_key_ref(l->key), t);
-
- AVAHI_LLIST_PREPEND(AvahiMulticastLookup, lookups, e->lookups, l);
-
- avahi_querier_add_for_all(e->server, interface, protocol, l->key, &tv);
- l->queriers_added = 1;
-
- /* Add a second */
- avahi_timeval_add(&tv, 1000000);
-
- /* Issue the ALL_FOR_NOW event one second after the querier was initially created */
- l->all_for_now_event = avahi_time_event_new(e->server->time_event_queue, &tv, all_for_now_callback, l);
-
- return l;
-}
-
-static void lookup_stop(AvahiMulticastLookup *l) {
- assert(l);
-
- l->callback = NULL;
-
- if (l->queriers_added) {
- avahi_querier_remove_for_all(l->engine->server, l->interface, l->protocol, l->key);
- l->queriers_added = 0;
- }
-
- if (l->all_for_now_event) {
- avahi_time_event_free(l->all_for_now_event);
- l->all_for_now_event = NULL;
- }
-}
-
-static void lookup_destroy(AvahiMulticastLookup *l) {
- AvahiMulticastLookup *t;
- assert(l);
-
- lookup_stop(l);
-
- t = avahi_hashmap_lookup(l->engine->lookups_by_key, l->key);
- AVAHI_LLIST_REMOVE(AvahiMulticastLookup, by_key, t, l);
- if (t)
- avahi_hashmap_replace(l->engine->lookups_by_key, avahi_key_ref(l->key), t);
- else
- avahi_hashmap_remove(l->engine->lookups_by_key, l->key);
-
- AVAHI_LLIST_REMOVE(AvahiMulticastLookup, lookups, l->engine->lookups, l);
-
- if (l->key)
- avahi_key_unref(l->key);
-
- if (l->cname_key)
- avahi_key_unref(l->cname_key);
-
- avahi_free(l);
-}
-
-void avahi_multicast_lookup_free(AvahiMulticastLookup *l) {
- assert(l);
-
- if (l->dead)
- return;
-
- l->dead = 1;
- l->engine->cleanup_dead = 1;
- lookup_stop(l);
-}
-
-void avahi_multicast_lookup_engine_cleanup(AvahiMulticastLookupEngine *e) {
- AvahiMulticastLookup *l, *n;
- assert(e);
-
- while (e->cleanup_dead) {
- e->cleanup_dead = 0;
-
- for (l = e->lookups; l; l = n) {
- n = l->lookups_next;
-
- if (l->dead)
- lookup_destroy(l);
- }
- }
-}
-
-struct cbdata {
- AvahiMulticastLookupEngine *engine;
- AvahiMulticastLookupCallback callback;
- void *userdata;
- AvahiKey *key, *cname_key;
- AvahiInterface *interface;
- unsigned n_found;
-};
-
-static void* scan_cache_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
- struct cbdata *cbdata = userdata;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(cbdata);
-
- cbdata->callback(
- cbdata->engine,
- cbdata->interface->hardware->index,
- cbdata->interface->protocol,
- AVAHI_BROWSER_NEW,
- AVAHI_LOOKUP_RESULT_CACHED|AVAHI_LOOKUP_RESULT_MULTICAST,
- e->record,
- cbdata->userdata);
-
- cbdata->n_found ++;
-
- return NULL;
-}
-
-static void scan_interface_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- struct cbdata *cbdata = userdata;
-
- assert(m);
- assert(i);
- assert(cbdata);
-
- cbdata->interface = i;
-
- avahi_cache_walk(i->cache, cbdata->key, scan_cache_callback, cbdata);
-
- if (cbdata->cname_key)
- avahi_cache_walk(i->cache, cbdata->cname_key, scan_cache_callback, cbdata);
-
- cbdata->interface = NULL;
-}
-
-unsigned avahi_multicast_lookup_engine_scan_cache(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiKey *key,
- AvahiMulticastLookupCallback callback,
- void *userdata) {
-
- struct cbdata cbdata;
-
- assert(e);
- assert(key);
- assert(callback);
-
- assert(AVAHI_IF_VALID(interface));
- assert(AVAHI_PROTO_VALID(protocol));
-
- cbdata.engine = e;
- cbdata.key = key;
- cbdata.cname_key = avahi_key_new_cname(key);
- cbdata.callback = callback;
- cbdata.userdata = userdata;
- cbdata.interface = NULL;
- cbdata.n_found = 0;
-
- avahi_interface_monitor_walk(e->server->monitor, interface, protocol, scan_interface_callback, &cbdata);
-
- if (cbdata.cname_key)
- avahi_key_unref(cbdata.cname_key);
-
- return cbdata.n_found;
-}
-
-void avahi_multicast_lookup_engine_new_interface(AvahiMulticastLookupEngine *e, AvahiInterface *i) {
- AvahiMulticastLookup *l;
-
- assert(e);
- assert(i);
-
- for (l = e->lookups; l; l = l->lookups_next) {
-
- if (l->dead || !l->callback)
- continue;
-
- if (l->queriers_added && avahi_interface_match(i, l->interface, l->protocol))
- avahi_querier_add(i, l->key, NULL);
- }
-}
-
-void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiInterface *i, AvahiRecord *record, AvahiBrowserEvent event) {
- AvahiMulticastLookup *l;
-
- assert(e);
- assert(record);
- assert(i);
-
- for (l = avahi_hashmap_lookup(e->lookups_by_key, record->key); l; l = l->by_key_next) {
- if (l->dead || !l->callback)
- continue;
-
- if (avahi_interface_match(i, l->interface, l->protocol))
- l->callback(e, i->hardware->index, i->protocol, event, AVAHI_LOOKUP_RESULT_MULTICAST, record, l->userdata);
- }
-
-
- if (record->key->clazz == AVAHI_DNS_CLASS_IN && record->key->type == AVAHI_DNS_TYPE_CNAME) {
- /* It's a CNAME record, so we have to scan the all lookups to see if one matches */
-
- for (l = e->lookups; l; l = l->lookups_next) {
- AvahiKey *key;
-
- if (l->dead || !l->callback)
- continue;
-
- if ((key = avahi_key_new_cname(l->key))) {
- if (avahi_key_equal(record->key, key))
- l->callback(e, i->hardware->index, i->protocol, event, AVAHI_LOOKUP_RESULT_MULTICAST, record, l->userdata);
-
- avahi_key_unref(key);
- }
- }
- }
-}
-
-AvahiMulticastLookupEngine *avahi_multicast_lookup_engine_new(AvahiServer *s) {
- AvahiMulticastLookupEngine *e;
-
- assert(s);
-
- e = avahi_new(AvahiMulticastLookupEngine, 1);
- e->server = s;
- e->cleanup_dead = 0;
-
- /* Initialize lookup list */
- e->lookups_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, (AvahiFreeFunc) avahi_key_unref, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiWideAreaLookup, e->lookups);
-
- return e;
-}
-
-void avahi_multicast_lookup_engine_free(AvahiMulticastLookupEngine *e) {
- assert(e);
-
- while (e->lookups)
- lookup_destroy(e->lookups);
-
- avahi_hashmap_free(e->lookups_by_key);
- avahi_free(e);
-}
-
diff --git a/release-0.6.9/avahi-core/multicast-lookup.h b/release-0.6.9/avahi-core/multicast-lookup.h
deleted file mode 100644
index 43e240d..0000000
--- a/release-0.6.9/avahi-core/multicast-lookup.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef foomulticastlookuphfoo
-#define foomulticastlookuphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "lookup.h"
-#include "browse.h"
-
-typedef struct AvahiMulticastLookupEngine AvahiMulticastLookupEngine;
-typedef struct AvahiMulticastLookup AvahiMulticastLookup;
-
-typedef void (*AvahiMulticastLookupCallback)(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex idx,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata);
-
-AvahiMulticastLookupEngine *avahi_multicast_lookup_engine_new(AvahiServer *s);
-void avahi_multicast_lookup_engine_free(AvahiMulticastLookupEngine *e);
-
-unsigned avahi_multicast_lookup_engine_scan_cache(AvahiMulticastLookupEngine *e, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, AvahiMulticastLookupCallback callback, void *userdata);
-void avahi_multicast_lookup_engine_new_interface(AvahiMulticastLookupEngine *e, AvahiInterface *i);
-void avahi_multicast_lookup_engine_cleanup(AvahiMulticastLookupEngine *e);
-void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiInterface *i, AvahiRecord *record, AvahiBrowserEvent event);
-
-AvahiMulticastLookup *avahi_multicast_lookup_new(AvahiMulticastLookupEngine *e, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, AvahiMulticastLookupCallback callback, void *userdata);
-void avahi_multicast_lookup_free(AvahiMulticastLookup *q);
-
-
-#endif
-
diff --git a/release-0.6.9/avahi-core/netlink.c b/release-0.6.9/avahi-core/netlink.c
deleted file mode 100644
index b2a6684..0000000
--- a/release-0.6.9/avahi-core/netlink.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-
-#include <avahi-common/malloc.h>
-#include "netlink.h"
-#include "log.h"
-
-struct AvahiNetlink {
- int fd;
- unsigned seq;
- AvahiNetlinkCallback callback;
- void* userdata;
- uint8_t* buffer;
- size_t buffer_length;
-
- const AvahiPoll *poll_api;
- AvahiWatch *watch;
-};
-
-int avahi_netlink_work(AvahiNetlink *nl, int block) {
- ssize_t bytes;
- struct nlmsghdr *p;
-
- assert(nl);
-
- if ((bytes = recv(nl->fd, nl->buffer, nl->buffer_length, block ? 0 : MSG_DONTWAIT)) < 0) {
-
- if (errno == EAGAIN || errno == EINTR)
- return 0;
-
- avahi_log_error(__FILE__": recv() failed: %s", strerror(errno));
- return -1;
- }
-
- p = (struct nlmsghdr *) nl->buffer;
-
- assert(nl->callback);
-
- for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
- if (!NLMSG_OK(p, (size_t) bytes)) {
- avahi_log_warn(__FILE__": packet truncated");
- return -1;
- }
-
- nl->callback(nl, p, nl->userdata);
- }
-
- return 0;
-}
-
-static void socket_event(AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, void *userdata) {
- AvahiNetlink *nl = userdata;
-
- assert(w);
- assert(nl);
- assert(fd == nl->fd);
-
- avahi_netlink_work(nl, 0);
-}
-
-AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void (*cb) (AvahiNetlink *nl, struct nlmsghdr *n, void* userdata), void* userdata) {
- int fd = -1;
- struct sockaddr_nl addr;
- AvahiNetlink *nl = NULL;
-
- assert(poll_api);
- assert(cb);
-
- if ((fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
- avahi_log_error(__FILE__": socket(PF_NETLINK): %s", strerror(errno));
- return NULL;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.nl_family = AF_NETLINK;
- addr.nl_groups = groups;
- addr.nl_pid = getpid();
-
- if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- avahi_log_error(__FILE__": bind(): %s", strerror(errno));
- goto fail;
- }
-
- if (!(nl = avahi_new(AvahiNetlink, 1))) {
- avahi_log_error(__FILE__": avahi_new() failed.");
- goto fail;
- }
-
- nl->poll_api = poll_api;
- nl->fd = fd;
- nl->seq = 0;
- nl->callback = cb;
- nl->userdata = userdata;
-
- if (!(nl->buffer = avahi_new(uint8_t, nl->buffer_length = 64*1024))) {
- avahi_log_error(__FILE__": avahi_new() failed.");
- goto fail;
- }
-
- if (!(nl->watch = poll_api->watch_new(poll_api, fd, AVAHI_WATCH_IN, socket_event, nl))) {
- avahi_log_error(__FILE__": Failed to create watch.");
- goto fail;
- }
-
- return nl;
-
-fail:
-
- if (fd >= 0)
- close(fd);
-
- if (nl) {
- avahi_free(nl->buffer);
- avahi_free(nl);
- }
-
- return NULL;
-}
-
-void avahi_netlink_free(AvahiNetlink *nl) {
- assert(nl);
-
- if (nl->watch)
- nl->poll_api->watch_free(nl->watch);
-
- if (nl->fd >= 0)
- close(nl->fd);
-
- avahi_free(nl->buffer);
- avahi_free(nl);
-}
-
-int avahi_netlink_send(AvahiNetlink *nl, struct nlmsghdr *m, unsigned *ret_seq) {
- assert(nl);
- assert(m);
-
- m->nlmsg_seq = nl->seq++;
- m->nlmsg_flags |= NLM_F_ACK;
-
- if (send(nl->fd, m, m->nlmsg_len, 0) < 0) {
- avahi_log_error(__FILE__": send(): %s", strerror(errno));
- return -1;
- }
-
- if (ret_seq)
- *ret_seq = m->nlmsg_seq;
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/netlink.h b/release-0.6.9/avahi-core/netlink.h
deleted file mode 100644
index 8f2f8cb..0000000
--- a/release-0.6.9/avahi-core/netlink.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef foonetlinkhfoo
-#define foonetlinkhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <sys/socket.h>
-#include <asm/types.h>
-#include <inttypes.h>
-
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-
-#include <avahi-common/watch.h>
-
-typedef struct AvahiNetlink AvahiNetlink;
-
-typedef void (*AvahiNetlinkCallback)(AvahiNetlink *n, struct nlmsghdr *m, void* userdata);
-
-AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, AvahiNetlinkCallback callback, void* userdata);
-void avahi_netlink_free(AvahiNetlink *n);
-int avahi_netlink_send(AvahiNetlink *n, struct nlmsghdr *m, unsigned *ret_seq);
-int avahi_netlink_work(AvahiNetlink *n, int block);
-
-#endif
diff --git a/release-0.6.9/avahi-core/prioq-test.c b/release-0.6.9/avahi-core/prioq-test.c
deleted file mode 100644
index d85a222..0000000
--- a/release-0.6.9/avahi-core/prioq-test.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-common/gccmacro.h>
-
-#include "prioq.h"
-
-#define POINTER_TO_INT(p) ((int) (p))
-#define INT_TO_POINTER(i) ((void*) (i))
-
-static int compare_int(const void* a, const void* b) {
- int i = POINTER_TO_INT(a), j = POINTER_TO_INT(b);
-
- return i < j ? -1 : (i > j ? 1 : 0);
-}
-
-static int compare_ptr(const void* a, const void* b) {
- return a < b ? -1 : (a > b ? 1 : 0);
-}
-
-static void rec(AvahiPrioQueueNode *n) {
- if (!n)
- return;
-
- if (n->left)
- assert(n->left->parent == n);
-
- if (n->right)
- assert(n->right->parent == n);
-
- if (n->parent) {
- assert(n->parent->left == n || n->parent->right == n);
-
- if (n->parent->left == n)
- assert(n->next == n->parent->right);
- }
-
- if (!n->next) {
- assert(n->queue->last == n);
-
- if (n->parent && n->parent->left == n)
- assert(n->parent->right == NULL);
- }
-
-
- if (n->parent) {
- int a = POINTER_TO_INT(n->parent->data), b = POINTER_TO_INT(n->data);
- if (a > b) {
- printf("%i <= %i: NO\n", a, b);
- abort();
- }
- }
-
- rec(n->left);
- rec(n->right);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiPrioQueue *q, *q2;
- int i;
-
- q = avahi_prio_queue_new(compare_int);
- q2 = avahi_prio_queue_new(compare_ptr);
-
- srand(time(NULL));
-
- for (i = 0; i < 10000; i++)
- avahi_prio_queue_put(q2, avahi_prio_queue_put(q, INT_TO_POINTER(random() & 0xFFFF)));
-
- while (q2->root) {
- rec(q->root);
- rec(q2->root);
-
- assert(q->n_nodes == q2->n_nodes);
-
- printf("%i\n", POINTER_TO_INT(((AvahiPrioQueueNode*)q2->root->data)->data));
-
- avahi_prio_queue_remove(q, q2->root->data);
- avahi_prio_queue_remove(q2, q2->root);
- }
-
-
-/* prev = 0; */
-/* while (q->root) { */
-/* int v = GPOINTER_TO_INT(q->root->data); */
-/* rec(q->root); */
-/* printf("%i\n", v); */
-/* avahi_prio_queue_remove(q, q->root); */
-/* assert(v >= prev); */
-/* prev = v; */
-/* } */
-
- avahi_prio_queue_free(q);
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/prioq.c b/release-0.6.9/avahi-core/prioq.c
deleted file mode 100644
index 8d91d87..0000000
--- a/release-0.6.9/avahi-core/prioq.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/malloc.h>
-
-#include "prioq.h"
-
-AvahiPrioQueue* avahi_prio_queue_new(AvahiPQCompareFunc compare) {
- AvahiPrioQueue *q;
- assert(compare);
-
- if (!(q = avahi_new(AvahiPrioQueue, 1)))
- return NULL; /* OOM */
-
- q->root = q->last = NULL;
- q->n_nodes = 0;
- q->compare = compare;
-
- return q;
-}
-
-void avahi_prio_queue_free(AvahiPrioQueue *q) {
- assert(q);
-
- while (q->last)
- avahi_prio_queue_remove(q, q->last);
-
- assert(!q->n_nodes);
- avahi_free(q);
-}
-
-static AvahiPrioQueueNode* get_node_at_xy(AvahiPrioQueue *q, unsigned x, unsigned y) {
- unsigned r;
- AvahiPrioQueueNode *n;
- assert(q);
-
- n = q->root;
- assert(n);
-
- for (r = 0; r < y; r++) {
- assert(n);
-
- if ((x >> (y-r-1)) & 1)
- n = n->right;
- else
- n = n->left;
- }
-
- assert(n->x == x);
- assert(n->y == y);
-
- return n;
-}
-
-static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQueueNode *b) {
- AvahiPrioQueueNode *l, *r, *p, *ap, *an, *bp, *bn;
- unsigned t;
- assert(q);
- assert(a);
- assert(b);
- assert(a != b);
-
- /* Swap positions */
- t = a->x; a->x = b->x; b->x = t;
- t = a->y; a->y = b->y; b->y = t;
-
- if (a->parent == b) {
- /* B is parent of A */
-
- p = b->parent;
- b->parent = a;
-
- if ((a->parent = p)) {
- if (a->parent->left == b)
- a->parent->left = a;
- else
- a->parent->right = a;
- } else
- q->root = a;
-
- if (b->left == a) {
- if ((b->left = a->left))
- b->left->parent = b;
- a->left = b;
-
- r = a->right;
- if ((a->right = b->right))
- a->right->parent = a;
- if ((b->right = r))
- b->right->parent = b;
-
- } else {
- if ((b->right = a->right))
- b->right->parent = b;
- a->right = b;
-
- l = a->left;
- if ((a->left = b->left))
- a->left->parent = a;
- if ((b->left = l))
- b->left->parent = b;
- }
- } else if (b->parent == a) {
- /* A ist parent of B */
-
- p = a->parent;
- a->parent = b;
-
- if ((b->parent = p)) {
- if (b->parent->left == a)
- b->parent->left = b;
- else
- b->parent->right = b;
- } else
- q->root = b;
-
- if (a->left == b) {
- if ((a->left = b->left))
- a->left->parent = a;
- b->left = a;
-
- r = a->right;
- if ((a->right = b->right))
- a->right->parent = a;
- if ((b->right = r))
- b->right->parent = b;
- } else {
- if ((a->right = b->right))
- a->right->parent = a;
- b->right = a;
-
- l = a->left;
- if ((a->left = b->left))
- a->left->parent = a;
- if ((b->left = l))
- b->left->parent = b;
- }
- } else {
- AvahiPrioQueueNode *apl = NULL, *bpl = NULL;
-
- /* Swap parents */
- ap = a->parent;
- bp = b->parent;
-
- if (ap)
- apl = ap->left;
- if (bp)
- bpl = bp->left;
-
- if ((a->parent = bp)) {
- if (bpl == b)
- bp->left = a;
- else
- bp->right = a;
- } else
- q->root = a;
-
- if ((b->parent = ap)) {
- if (apl == a)
- ap->left = b;
- else
- ap->right = b;
- } else
- q->root = b;
-
- /* Swap children */
- l = a->left;
- r = a->right;
-
- if ((a->left = b->left))
- a->left->parent = a;
-
- if ((b->left = l))
- b->left->parent = b;
-
- if ((a->right = b->right))
- a->right->parent = a;
-
- if ((b->right = r))
- b->right->parent = b;
- }
-
- /* Swap siblings */
- ap = a->prev; an = a->next;
- bp = b->prev; bn = b->next;
-
- if (a->next == b) {
- /* A is predecessor of B */
- a->prev = b;
- b->next = a;
-
- if ((a->next = bn))
- a->next->prev = a;
- else
- q->last = a;
-
- if ((b->prev = ap))
- b->prev->next = b;
-
- } else if (b->next == a) {
- /* B is predecessor of A */
- a->next = b;
- b->prev = a;
-
- if ((a->prev = bp))
- a->prev->next = a;
-
- if ((b->next = an))
- b->next->prev = b;
- else
- q->last = b;
-
- } else {
- /* A is no neighbour of B */
-
- if ((a->prev = bp))
- a->prev->next = a;
-
- if ((a->next = bn))
- a->next->prev = a;
- else
- q->last = a;
-
- if ((b->prev = ap))
- b->prev->next = b;
-
- if ((b->next = an))
- b->next->prev = b;
- else
- q->last = b;
- }
-}
-
-/* Move a node to the correct position */
-void avahi_prio_queue_shuffle(AvahiPrioQueue *q, AvahiPrioQueueNode *n) {
- assert(q);
- assert(n);
- assert(n->queue == q);
-
- /* Move up until the position is OK */
- while (n->parent && q->compare(n->parent->data, n->data) > 0)
- exchange_nodes(q, n, n->parent);
-
- /* Move down until the position is OK */
- for (;;) {
- AvahiPrioQueueNode *min;
-
- if (!(min = n->left)) {
- /* No children */
- assert(!n->right);
- break;
- }
-
- if (n->right && q->compare(n->right->data, min->data) < 0)
- min = n->right;
-
- /* min now contains the smaller one of our two children */
-
- if (q->compare(n->data, min->data) <= 0)
- /* Order OK */
- break;
-
- exchange_nodes(q, n, min);
- }
-}
-
-AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
- AvahiPrioQueueNode *n;
- assert(q);
-
- if (!(n = avahi_new(AvahiPrioQueueNode, 1)))
- return NULL; /* OOM */
-
- n->queue = q;
- n->data = data;
-
- if (q->last) {
- assert(q->root);
- assert(q->n_nodes);
-
- n->y = q->last->y;
- n->x = q->last->x+1;
-
- if (n->x >= ((unsigned) 1 << n->y)) {
- n->x = 0;
- n->y++;
- }
-
- q->last->next = n;
- n->prev = q->last;
-
- assert(n->y > 0);
- n->parent = get_node_at_xy(q, n->x/2, n->y-1);
-
- if (n->x & 1)
- n->parent->right = n;
- else
- n->parent->left = n;
- } else {
- assert(!q->root);
- assert(!q->n_nodes);
-
- n->y = n->x = 0;
- q->root = n;
- n->prev = n->parent = NULL;
- }
-
- n->next = n->left = n->right = NULL;
- q->last = n;
- q->n_nodes++;
-
- avahi_prio_queue_shuffle(q, n);
-
- return n;
-}
-
-void avahi_prio_queue_remove(AvahiPrioQueue *q, AvahiPrioQueueNode *n) {
- assert(q);
- assert(n);
- assert(q == n->queue);
-
- if (n != q->last) {
- AvahiPrioQueueNode *replacement = q->last;
- exchange_nodes(q, replacement, n);
- avahi_prio_queue_remove(q, n);
- avahi_prio_queue_shuffle(q, replacement);
- return;
- }
-
- assert(n == q->last);
- assert(!n->next);
- assert(!n->left);
- assert(!n->right);
-
- q->last = n->prev;
-
- if (n->prev) {
- n->prev->next = NULL;
- assert(n->parent);
- } else
- assert(!n->parent);
-
- if (n->parent) {
- assert(n->prev);
- if (n->parent->left == n) {
- assert(n->parent->right == NULL);
- n->parent->left = NULL;
- } else {
- assert(n->parent->right == n);
- assert(n->parent->left != NULL);
- n->parent->right = NULL;
- }
- } else {
- assert(q->root == n);
- assert(!n->prev);
- assert(q->n_nodes == 1);
- q->root = NULL;
- }
-
- avahi_free(n);
-
- assert(q->n_nodes > 0);
- q->n_nodes--;
-}
-
diff --git a/release-0.6.9/avahi-core/prioq.h b/release-0.6.9/avahi-core/prioq.h
deleted file mode 100644
index ace92f6..0000000
--- a/release-0.6.9/avahi-core/prioq.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef fooprioqhfoo
-#define fooprioqhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiPrioQueue AvahiPrioQueue;
-typedef struct AvahiPrioQueueNode AvahiPrioQueueNode;
-
-typedef int (*AvahiPQCompareFunc)(const void* a, const void* b);
-
-struct AvahiPrioQueue {
- AvahiPrioQueueNode *root, *last;
- unsigned n_nodes;
- AvahiPQCompareFunc compare;
-};
-
-struct AvahiPrioQueueNode {
- AvahiPrioQueue *queue;
- void* data;
- unsigned x, y;
- AvahiPrioQueueNode *left, *right, *parent, *next, *prev;
-};
-
-AvahiPrioQueue* avahi_prio_queue_new(AvahiPQCompareFunc compare);
-void avahi_prio_queue_free(AvahiPrioQueue *q);
-
-AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data);
-void avahi_prio_queue_remove(AvahiPrioQueue *q, AvahiPrioQueueNode *n);
-
-void avahi_prio_queue_shuffle(AvahiPrioQueue *q, AvahiPrioQueueNode *n);
-
-#endif
diff --git a/release-0.6.9/avahi-core/probe-sched.c b/release-0.6.9/avahi-core/probe-sched.c
deleted file mode 100644
index f430bce..0000000
--- a/release-0.6.9/avahi-core/probe-sched.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "probe-sched.h"
-#include "log.h"
-#include "rr-util.h"
-
-#define AVAHI_PROBE_HISTORY_MSEC 150
-#define AVAHI_PROBE_DEFER_MSEC 50
-
-typedef struct AvahiProbeJob AvahiProbeJob;
-
-struct AvahiProbeJob {
- AvahiProbeScheduler *scheduler;
- AvahiTimeEvent *time_event;
-
- int chosen; /* Use for packet assembling */
- int done;
- struct timeval delivery;
-
- AvahiRecord *record;
-
- AVAHI_LLIST_FIELDS(AvahiProbeJob, jobs);
-};
-
-struct AvahiProbeScheduler {
- AvahiInterface *interface;
- AvahiTimeEventQueue *time_event_queue;
-
- AVAHI_LLIST_HEAD(AvahiProbeJob, jobs);
- AVAHI_LLIST_HEAD(AvahiProbeJob, history);
-};
-
-static AvahiProbeJob* job_new(AvahiProbeScheduler *s, AvahiRecord *record, int done) {
- AvahiProbeJob *pj;
-
- assert(s);
- assert(record);
-
- if (!(pj = avahi_new(AvahiProbeJob, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL; /* OOM */
- }
-
- pj->scheduler = s;
- pj->record = avahi_record_ref(record);
- pj->time_event = NULL;
- pj->chosen = 0;
-
- if ((pj->done = done))
- AVAHI_LLIST_PREPEND(AvahiProbeJob, jobs, s->history, pj);
- else
- AVAHI_LLIST_PREPEND(AvahiProbeJob, jobs, s->jobs, pj);
-
- return pj;
-}
-
-static void job_free(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
- assert(pj);
-
- if (pj->time_event)
- avahi_time_event_free(pj->time_event);
-
- if (pj->done)
- AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->history, pj);
- else
- AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->jobs, pj);
-
- avahi_record_unref(pj->record);
- avahi_free(pj);
-}
-
-static void elapse_callback(AvahiTimeEvent *e, void* data);
-
-static void job_set_elapse_time(AvahiProbeScheduler *s, AvahiProbeJob *pj, unsigned msec, unsigned jitter) {
- struct timeval tv;
-
- assert(s);
- assert(pj);
-
- avahi_elapse_time(&tv, msec, jitter);
-
- if (pj->time_event)
- avahi_time_event_update(pj->time_event, &tv);
- else
- pj->time_event = avahi_time_event_new(s->time_event_queue, &tv, elapse_callback, pj);
-}
-
-static void job_mark_done(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
- assert(s);
- assert(pj);
-
- assert(!pj->done);
-
- AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->jobs, pj);
- AVAHI_LLIST_PREPEND(AvahiProbeJob, jobs, s->history, pj);
-
- pj->done = 1;
-
- job_set_elapse_time(s, pj, AVAHI_PROBE_HISTORY_MSEC, 0);
- gettimeofday(&pj->delivery, NULL);
-}
-
-AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i) {
- AvahiProbeScheduler *s;
-
- assert(i);
-
- if (!(s = avahi_new(AvahiProbeScheduler, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- s->interface = i;
- s->time_event_queue = i->monitor->server->time_event_queue;
-
- AVAHI_LLIST_HEAD_INIT(AvahiProbeJob, s->jobs);
- AVAHI_LLIST_HEAD_INIT(AvahiProbeJob, s->history);
-
- return s;
-}
-
-void avahi_probe_scheduler_free(AvahiProbeScheduler *s) {
- assert(s);
-
- avahi_probe_scheduler_clear(s);
- avahi_free(s);
-}
-
-void avahi_probe_scheduler_clear(AvahiProbeScheduler *s) {
- assert(s);
-
- while (s->jobs)
- job_free(s, s->jobs);
- while (s->history)
- job_free(s, s->history);
-}
-
-static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, AvahiProbeJob *pj) {
- size_t size;
- AvahiKey *k;
- int b;
-
- assert(s);
- assert(p);
- assert(pj);
-
- assert(!pj->chosen);
-
- /* Estimate the size for this record */
- size =
- avahi_key_get_estimate_size(pj->record->key) +
- avahi_record_get_estimate_size(pj->record);
-
- /* Too large */
- if (size > avahi_dns_packet_space(p))
- return 0;
-
- /* Create the probe query */
- if (!(k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY)))
- return 0; /* OOM */
-
- b = !!avahi_dns_packet_append_key(p, k, 0);
- assert(b);
-
- /* Mark this job for addition to the packet */
- pj->chosen = 1;
-
- /* Scan for more jobs whith matching key pattern */
- for (pj = s->jobs; pj; pj = pj->jobs_next) {
- if (pj->chosen)
- continue;
-
- /* Does the record match the probe? */
- if (k->clazz != pj->record->key->clazz || !avahi_domain_equal(k->name, pj->record->key->name))
- continue;
-
- /* This job wouldn't fit in */
- if (avahi_record_get_estimate_size(pj->record) > avahi_dns_packet_space(p))
- break;
-
- /* Mark this job for addition to the packet */
- pj->chosen = 1;
- }
-
- avahi_key_unref(k);
-
- return 1;
-}
-
-static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
- AvahiProbeJob *pj = data, *next;
- AvahiProbeScheduler *s;
- AvahiDnsPacket *p;
- unsigned n;
-
- assert(pj);
- s = pj->scheduler;
-
- if (pj->done) {
- /* Lets remove it from the history */
- job_free(s, pj);
- return;
- }
-
- if (!(p = avahi_dns_packet_new_query(s->interface->hardware->mtu)))
- return; /* OOM */
- n = 1;
-
- /* Add the import probe */
- if (!packet_add_probe_query(s, p, pj)) {
- size_t size;
- AvahiKey *k;
- int b;
-
- avahi_dns_packet_free(p);
-
- /* The probe didn't fit in the package, so let's allocate a larger one */
-
- size =
- avahi_key_get_estimate_size(pj->record->key) +
- avahi_record_get_estimate_size(pj->record) +
- AVAHI_DNS_PACKET_HEADER_SIZE;
-
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(p = avahi_dns_packet_new_query(size)))
- return; /* OOM */
-
- if (!(k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY))) {
- avahi_dns_packet_free(p);
- return; /* OOM */
- }
-
- b = avahi_dns_packet_append_key(p, k, 0) && avahi_dns_packet_append_record(p, pj->record, 0, 0);
- avahi_key_unref(k);
-
- if (b) {
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_NSCOUNT, 1);
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_QDCOUNT, 1);
- avahi_interface_send_packet(s->interface, p);
- } else
- avahi_log_warn("Probe record too large, cannot send");
-
- avahi_dns_packet_free(p);
- job_mark_done(s, pj);
-
- return;
- }
-
- /* Try to fill up packet with more probes, if available */
- for (pj = s->jobs; pj; pj = pj->jobs_next) {
-
- if (pj->chosen)
- continue;
-
- if (!packet_add_probe_query(s, p, pj))
- break;
-
- n++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_QDCOUNT, n);
-
- n = 0;
-
- /* Now add the chosen records to the authorative section */
- for (pj = s->jobs; pj; pj = next) {
-
- next = pj->jobs_next;
-
- if (!pj->chosen)
- continue;
-
- if (!avahi_dns_packet_append_record(p, pj->record, 0, 0)) {
-/* avahi_log_warn("Bad probe size estimate!"); */
-
- /* Unmark all following jobs */
- for (; pj; pj = pj->jobs_next)
- pj->chosen = 0;
-
- break;
- }
-
- job_mark_done(s, pj);
-
- n ++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_NSCOUNT, n);
-
- /* Send it now */
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-}
-
-static AvahiProbeJob* find_scheduled_job(AvahiProbeScheduler *s, AvahiRecord *record) {
- AvahiProbeJob *pj;
-
- assert(s);
- assert(record);
-
- for (pj = s->jobs; pj; pj = pj->jobs_next) {
- assert(!pj->done);
-
- if (avahi_record_equal_no_ttl(pj->record, record))
- return pj;
- }
-
- return NULL;
-}
-
-static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *record) {
- AvahiProbeJob *pj;
-
- assert(s);
- assert(record);
-
- for (pj = s->history; pj; pj = pj->jobs_next) {
- assert(pj->done);
-
- if (avahi_record_equal_no_ttl(pj->record, record)) {
- /* Check whether this entry is outdated */
-
- if (avahi_age(&pj->delivery) > AVAHI_PROBE_HISTORY_MSEC*1000) {
- /* it is outdated, so let's remove it */
- job_free(s, pj);
- return NULL;
- }
-
- return pj;
- }
- }
-
- return NULL;
-}
-
-int avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, int immediately) {
- AvahiProbeJob *pj;
- struct timeval tv;
-
- assert(s);
- assert(record);
- assert(!avahi_key_is_pattern(record->key));
-
- if ((pj = find_history_job(s, record)))
- return 0;
-
- avahi_elapse_time(&tv, immediately ? 0 : AVAHI_PROBE_DEFER_MSEC, 0);
-
- if ((pj = find_scheduled_job(s, record))) {
-
- if (avahi_timeval_compare(&tv, &pj->delivery) < 0) {
- /* If the new entry should be scheduled earlier, update the old entry */
- pj->delivery = tv;
- avahi_time_event_update(pj->time_event, &pj->delivery);
- }
-
- return 1;
- } else {
- /* Create a new job and schedule it */
- if (!(pj = job_new(s, record, 0)))
- return 0; /* OOM */
-
- pj->delivery = tv;
- pj->time_event = avahi_time_event_new(s->time_event_queue, &pj->delivery, elapse_callback, pj);
-
-
-/* avahi_log_debug("Accepted new probe job."); */
-
- return 1;
- }
-}
diff --git a/release-0.6.9/avahi-core/probe-sched.h b/release-0.6.9/avahi-core/probe-sched.h
deleted file mode 100644
index 3af1319..0000000
--- a/release-0.6.9/avahi-core/probe-sched.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef fooprobeschedhfoo
-#define fooprobeschedhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiProbeScheduler AvahiProbeScheduler;
-
-#include <avahi-common/address.h>
-#include "iface.h"
-
-AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i);
-void avahi_probe_scheduler_free(AvahiProbeScheduler *s);
-void avahi_probe_scheduler_clear(AvahiProbeScheduler *s);
-
-int avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, int immediately);
-
-#endif
diff --git a/release-0.6.9/avahi-core/publish.h b/release-0.6.9/avahi-core/publish.h
deleted file mode 100644
index 77c49af..0000000
--- a/release-0.6.9/avahi-core/publish.h
+++ /dev/null
@@ -1,177 +0,0 @@
-#ifndef foopublishhfoo
-#define foopublishhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file core/publish.h Functions for publising local services and RRs */
-
-/** \example core-publish-service.c Example how to register a DNS-SD
- * service using an embedded mDNS stack. It behaves like a network
- * printer registering both an IPP and a BSD LPR service. */
-
-/** A group of locally registered DNS RRs */
-typedef struct AvahiSEntryGroup AvahiSEntryGroup;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-core/core.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Prototype for callback functions which are called whenever the state of an AvahiSEntryGroup object changes */
-typedef void (*AvahiSEntryGroupCallback) (AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
-
-/** Iterate through all local entries of the server. (when g is NULL)
- * or of a specified entry group. At the first call state should point
- * to a NULL initialized void pointer, That pointer is used to track
- * the current iteration. It is not safe to call any other
- * avahi_server_xxx() function during the iteration. If the last entry
- * has been read, NULL is returned. */
-const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, void **state);
-
-/** Create a new entry group. The specified callback function is
- * called whenever the state of the group changes. Use entry group
- * objects to keep track of you RRs. Add new RRs to a group using
- * avahi_server_add_xxx(). Make sure to call avahi_s_entry_group_commit()
- * to start the registration process for your RRs */
-AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallback callback, void* userdata);
-
-/** Free an entry group. All RRs assigned to the group are removed from the server */
-void avahi_s_entry_group_free(AvahiSEntryGroup *g);
-
-/** Commit an entry group. This starts the probing and registration process for all RRs in the group */
-int avahi_s_entry_group_commit(AvahiSEntryGroup *g);
-
-/** Remove all entries from the entry group and reset the state to AVAHI_ENTRY_GROUP_UNCOMMITED. */
-void avahi_s_entry_group_reset(AvahiSEntryGroup *g);
-
-/** Return 1 if the entry group is empty, i.e. has no records attached. */
-int avahi_s_entry_group_is_empty(AvahiSEntryGroup *g);
-
-/** Return the current state of the specified entry group */
-AvahiEntryGroupState avahi_s_entry_group_get_state(AvahiSEntryGroup *g);
-
-/** Change the opaque user data pointer attached to an entry group object */
-void avahi_s_entry_group_set_data(AvahiSEntryGroup *g, void* userdata);
-
-/** Return the opaque user data pointer currently set for the entry group object */
-void* avahi_s_entry_group_get_data(AvahiSEntryGroup *g);
-
-/** Add a new resource record to the server. Returns 0 on success, negative otherwise. */
-int avahi_server_add(
- AvahiServer *s, /**< The server object to add this record to */
- AvahiSEntryGroup *g, /**< An entry group object if this new record shall be attached to one, or NULL. If you plan to remove the record sometime later you a required to pass an entry group object here. */
- AvahiIfIndex interface, /**< A numeric index of a network interface to attach this record to, or AVAHI_IF_UNSPEC to attach this record to all interfaces */
- AvahiProtocol protocol, /**< A protocol family to attach this record to. One of the AVAHI_PROTO_xxx constants. Use AVAHI_PROTO_UNSPEC to make this record available on all protocols (wich means on both IPv4 and IPv6). */
- AvahiPublishFlags flags, /**< Special flags for this record */
- AvahiRecord *r /**< The record to add. This function increases the reference counter of this object. */);
-
-/** Add an IP address mapping to the server. This will add both the
- * host-name-to-address and the reverse mapping to the server. See
- * avahi_server_add() for more information. If adding one of the RRs
- * fails, the function returns with an error, but it is not defined if
- * the other RR is deleted from the server or not. Therefore, you have
- * to free the AvahiSEntryGroup and create a new one before
- * proceeding. */
-int avahi_server_add_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- AvahiAddress *a);
-
-/** Add an DNS-SD service to the Server. This will add all required
- * RRs to the server. See avahi_server_add() for more information. If
- * adding one of the RRs fails, the function returns with an error,
- * but it is not defined if the other RR is deleted from the server or
- * not. Therefore, you have to free the AvahiSEntryGroup and create a
- * new one before proceeding. */
-int avahi_server_add_service(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name, /**< Service name, e.g. "Lennart's Files" */
- const char *type, /**< DNS-SD type, e.g. "_http._tcp" */
- const char *domain,
- const char *host, /**< Host name where this servcie resides, or NULL if on the local host */
- uint16_t port, /**< Port number of the service */
- ... /**< Text records, terminated by NULL */) AVAHI_GCC_SENTINEL;
-
-/** Mostly identical to avahi_server_add_service(), but takes an AvahiStringList object for the TXT records. The AvahiStringList object is copied. */
-int avahi_server_add_service_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *strlst);
-
-/** Add a subtype for an already existing service */
-int avahi_server_add_service_subtype(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name, /**< Specify the name of main service you already added here */
- const char *type, /**< Specify the main type of the service you already added here */
- const char *domain, /**< Specify the main type of the service you already added here */
- const char *subtype /**< The new subtype for the specified service */ );
-
-/** Update the TXT record for a service with the data from the specified string list */
-int avahi_server_update_service_txt_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst);
-
-/** Update the TXT record for a service with the NULL termonate list of strings */
-int avahi_server_update_service_txt(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- ...) AVAHI_GCC_SENTINEL;
-
-/** Check if there is a service locally defined and return the entry group it is attached to. Returns NULL if the service isn't local*/
-int avahi_server_get_group_of_service(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiSEntryGroup** ret_group);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/querier-test.c b/release-0.6.9/avahi-core/querier-test.c
deleted file mode 100644
index 1c28ea0..0000000
--- a/release-0.6.9/avahi-core/querier-test.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-
-#define DOMAIN NULL
-#define SERVICE_TYPE "_http._tcp"
-
-static AvahiSServiceBrowser *service_browser1 = NULL, *service_browser2 = NULL;
-static const AvahiPoll * poll_api = NULL;
-static AvahiServer *server = NULL;
-static AvahiSimplePoll *simple_poll;
-
-static const char *browser_event_to_string(AvahiBrowserEvent event) {
- switch (event) {
- case AVAHI_BROWSER_NEW : return "NEW";
- case AVAHI_BROWSER_REMOVE : return "REMOVE";
- case AVAHI_BROWSER_CACHE_EXHAUSTED : return "CACHE_EXHAUSTED";
- case AVAHI_BROWSER_ALL_FOR_NOW : return "ALL_FOR_NOW";
- case AVAHI_BROWSER_FAILURE : return "FAILURE";
- }
-
- abort();
-}
-
-static void sb_callback(
- AvahiSServiceBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *service_type,
- const char *domain,
- AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("SB%i: (%i.%s) <%s> as <%s> in <%s> [%s] cached=%i", b == service_browser1 ? 1 : 2, iface, avahi_proto_to_string(protocol), name, service_type, domain, browser_event_to_string(event), !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
-}
-
-static void create_second_service_browser(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void* userdata) {
-
- service_browser2 = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, DOMAIN, 0, sb_callback, NULL);
- assert(service_browser2);
-
- poll_api->timeout_free(timeout);
-}
-
-static void quit(AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
- avahi_simple_poll_quit(simple_poll);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- struct timeval tv;
- AvahiServerConfig config;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- avahi_server_config_init(&config);
- config.publish_hinfo = 0;
- config.publish_addresses = 0;
- config.publish_workstation = 0;
- config.publish_domain = 0;
-
- avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
- config.n_wide_area_servers = 1;
- config.enable_wide_area = 1;
-
- server = avahi_server_new(poll_api, &config, NULL, NULL, NULL);
- assert(server);
- avahi_server_config_free(&config);
-
- service_browser1 = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, DOMAIN, 0, sb_callback, NULL);
- assert(service_browser1);
-
- poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 10000, 0), create_second_service_browser, NULL);
-
- poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 60000, 0), quit, NULL);
-
-
- for (;;)
- if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
- break;
-
- avahi_server_free(server);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/querier.c b/release-0.6.9/avahi-core/querier.c
deleted file mode 100644
index 8a230cd..0000000
--- a/release-0.6.9/avahi-core/querier.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-
-#include "querier.h"
-#include "log.h"
-
-struct AvahiQuerier {
- AvahiInterface *interface;
-
- AvahiKey *key;
- int n_used;
-
- unsigned sec_delay;
-
- AvahiTimeEvent *time_event;
-
- struct timeval creation_time;
-
- unsigned post_id;
- int post_id_valid;
-
- AVAHI_LLIST_FIELDS(AvahiQuerier, queriers);
-};
-
-void avahi_querier_free(AvahiQuerier *q) {
- assert(q);
-
- AVAHI_LLIST_REMOVE(AvahiQuerier, queriers, q->interface->queriers, q);
- avahi_hashmap_remove(q->interface->queriers_by_key, q->key);
-
- avahi_key_unref(q->key);
- avahi_time_event_free(q->time_event);
-
- avahi_free(q);
-}
-
-static void querier_elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
- AvahiQuerier *q = userdata;
- struct timeval tv;
-
- assert(q);
-
- if (q->n_used <= 0) {
-
- /* We are not referenced by anyone anymore, so let's free
- * ourselves. We should not send out any further queries from
- * this querier object anymore. */
-
- avahi_querier_free(q);
- return;
- }
-
- if (avahi_interface_post_query(q->interface, q->key, 0, &q->post_id)) {
-
- /* The queue accepted our query. We store the query id here,
- * that allows us to drop the query at a later point if the
- * query is very short-lived. */
-
- q->post_id_valid = 1;
- }
-
- q->sec_delay *= 2;
-
- if (q->sec_delay >= 60*60) /* 1h */
- q->sec_delay = 60*60;
-
- avahi_elapse_time(&tv, q->sec_delay*1000, 0);
- avahi_time_event_update(q->time_event, &tv);
-}
-
-void avahi_querier_add(AvahiInterface *i, AvahiKey *key, struct timeval *ret_ctime) {
- AvahiQuerier *q;
- struct timeval tv;
-
- assert(i);
- assert(key);
-
- if ((q = avahi_hashmap_lookup(i->queriers_by_key, key))) {
-
- /* Someone is already browsing for records of this RR key */
- q->n_used++;
-
- /* Return the creation time. This is used for generating the
- * ALL_FOR_NOW event one second after the querier was
- * initially created. */
- if (ret_ctime)
- *ret_ctime = q->creation_time;
- return;
- }
-
- /* No one is browsing for this RR key, so we add a new querier */
- if (!(q = avahi_new(AvahiQuerier, 1)))
- return; /* OOM */
-
- q->key = avahi_key_ref(key);
- q->interface = i;
- q->n_used = 1;
- q->sec_delay = 1;
- q->post_id_valid = 0;
- gettimeofday(&q->creation_time, NULL);
-
- /* Do the initial query */
- if (avahi_interface_post_query(i, key, 0, &q->post_id))
- q->post_id_valid = 1;
-
- /* Schedule next queries */
- q->time_event = avahi_time_event_new(i->monitor->server->time_event_queue, avahi_elapse_time(&tv, q->sec_delay*1000, 0), querier_elapse_callback, q);
-
- AVAHI_LLIST_PREPEND(AvahiQuerier, queriers, i->queriers, q);
- avahi_hashmap_insert(i->queriers_by_key, q->key, q);
-
- /* Return the creation time. This is used for generating the
- * ALL_FOR_NOW event one second after the querier was initially
- * created. */
- if (ret_ctime)
- *ret_ctime = q->creation_time;
-}
-
-void avahi_querier_remove(AvahiInterface *i, AvahiKey *key) {
- AvahiQuerier *q;
-
- if (!(q = avahi_hashmap_lookup(i->queriers_by_key, key)) || q->n_used <= 0) {
- /* There was no querier for this RR key, or it wasn't referenced by anyone */
- avahi_log_warn(__FILE__": querier_remove() called but no querier to remove.");
- return;
- }
-
- if ((--q->n_used) <= 0) {
-
- /* Nobody references us anymore. */
-
- if (q->post_id_valid && avahi_interface_withraw_query(i, q->post_id)) {
-
- /* We succeeded in withdrawing our query from the queue,
- * so let's drop dead. */
-
- avahi_querier_free(q);
- }
-
- /* If we failed to withdraw our query from the queue, we stay
- * alive, in case someone else might recycle our querier at a
- * later point. We are freed at our next expiry, in case
- * nobody recycled us. */
- }
-}
-
-static void remove_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- assert(m);
- assert(i);
- assert(userdata);
-
- if (i->announcing)
- avahi_querier_remove(i, (AvahiKey*) userdata);
-}
-
-void avahi_querier_remove_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key) {
- assert(s);
- assert(key);
-
- avahi_interface_monitor_walk(s->monitor, idx, protocol, remove_querier_callback, key);
-}
-
-struct cbdata {
- AvahiKey *key;
- struct timeval *ret_ctime;
-};
-
-static void add_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- struct cbdata *cbdata = userdata;
-
- assert(m);
- assert(i);
- assert(cbdata);
-
- if (i->announcing) {
- struct timeval tv;
- avahi_querier_add(i, cbdata->key, &tv);
-
- if (cbdata->ret_ctime && avahi_timeval_compare(&tv, cbdata->ret_ctime) > 0)
- *cbdata->ret_ctime = tv;
- }
-}
-
-void avahi_querier_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, struct timeval *ret_ctime) {
- struct cbdata cbdata;
-
- assert(s);
- assert(key);
-
- cbdata.key = key;
- cbdata.ret_ctime = ret_ctime;
-
- if (ret_ctime)
- ret_ctime->tv_sec = ret_ctime->tv_usec = 0;
-
- avahi_interface_monitor_walk(s->monitor, idx, protocol, add_querier_callback, &cbdata);
-}
-
-int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key) {
- AvahiQuerier *q;
-
- assert(i);
- assert(key);
-
- /* Called by the cache maintainer */
-
- if (!(q = avahi_hashmap_lookup(i->queriers_by_key, key)))
- /* This key is currently not subscribed at all, so no cache
- * refresh is needed */
- return 0;
-
- if (q->n_used <= 0) {
-
- /* If this is an entry nobody references right now, don't
- * consider it "existing". */
-
- /* Remove this querier since it is referenced by nobody
- * and the cached data will soon be out of date */
- avahi_querier_free(q);
-
- /* Tell the cache that no refresh is needed */
- return 0;
-
- } else {
- struct timeval tv;
-
- /* We can defer our query a little, since the cache will now
- * issue a refresh query anyway. */
- avahi_elapse_time(&tv, q->sec_delay*1000, 0);
- avahi_time_event_update(q->time_event, &tv);
-
- /* Tell the cache that a refresh should be issued */
- return 1;
- }
-}
-
-void avahi_querier_free_all(AvahiInterface *i) {
- assert(i);
-
- while (i->queriers)
- avahi_querier_free(i->queriers);
-}
diff --git a/release-0.6.9/avahi-core/querier.h b/release-0.6.9/avahi-core/querier.h
deleted file mode 100644
index 3f4eead..0000000
--- a/release-0.6.9/avahi-core/querier.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef fooquerierhfoo
-#define fooquerierhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiQuerier AvahiQuerier;
-
-#include "iface.h"
-
-/** Add querier for the specified key to the specified interface */
-void avahi_querier_add(AvahiInterface *i, AvahiKey *key, struct timeval *ret_ctime);
-
-/** Remove a querier for the specified key from the specified interface */
-void avahi_querier_remove(AvahiInterface *i, AvahiKey *key);
-
-/** Add a querier for the specified key on all interfaces that mach */
-void avahi_querier_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, struct timeval *ret_ctime);
-
-/** Remove a querier for the specified key on all interfaces that mach */
-void avahi_querier_remove_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key);
-
-/** Free all queriers */
-void avahi_querier_free(AvahiQuerier *q);
-
-/** Free all queriers on the specified interface */
-void avahi_querier_free_all(AvahiInterface *i);
-
-/** Return 1 if there is a querier for the specified key on the specified interface */
-int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key);
-
-#endif
diff --git a/release-0.6.9/avahi-core/query-sched.c b/release-0.6.9/avahi-core/query-sched.c
deleted file mode 100644
index 0319b02..0000000
--- a/release-0.6.9/avahi-core/query-sched.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "query-sched.h"
-#include "log.h"
-
-#define AVAHI_QUERY_HISTORY_MSEC 100
-#define AVAHI_QUERY_DEFER_MSEC 100
-
-typedef struct AvahiQueryJob AvahiQueryJob;
-typedef struct AvahiKnownAnswer AvahiKnownAnswer;
-
-struct AvahiQueryJob {
- unsigned id;
- int n_posted;
-
- AvahiQueryScheduler *scheduler;
- AvahiTimeEvent *time_event;
-
- int done;
- struct timeval delivery;
-
- AvahiKey *key;
-
- /* Jobs are stored in a simple linked list. It might turn out in
- * the future that this list grows too long and we must switch to
- * some other kind of data structure. This needs further
- * investigation. I expect the list to be very short (< 20
- * entries) most of the time, but this might be a wrong
- * assumption, especially on setups where traffic reflection is
- * involved. */
-
- AVAHI_LLIST_FIELDS(AvahiQueryJob, jobs);
-};
-
-struct AvahiKnownAnswer {
- AvahiQueryScheduler *scheduler;
- AvahiRecord *record;
-
- AVAHI_LLIST_FIELDS(AvahiKnownAnswer, known_answer);
-};
-
-struct AvahiQueryScheduler {
- AvahiInterface *interface;
- AvahiTimeEventQueue *time_event_queue;
-
- unsigned next_id;
-
- AVAHI_LLIST_HEAD(AvahiQueryJob, jobs);
- AVAHI_LLIST_HEAD(AvahiQueryJob, history);
- AVAHI_LLIST_HEAD(AvahiKnownAnswer, known_answers);
-};
-
-static AvahiQueryJob* job_new(AvahiQueryScheduler *s, AvahiKey *key, int done) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- if (!(qj = avahi_new(AvahiQueryJob, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- qj->scheduler = s;
- qj->key = avahi_key_ref(key);
- qj->time_event = NULL;
- qj->n_posted = 1;
- qj->id = s->next_id++;
-
- if ((qj->done = done))
- AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->history, qj);
- else
- AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->jobs, qj);
-
- return qj;
-}
-
-static void job_free(AvahiQueryScheduler *s, AvahiQueryJob *qj) {
- assert(s);
- assert(qj);
-
- if (qj->time_event)
- avahi_time_event_free(qj->time_event);
-
- if (qj->done)
- AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->history, qj);
- else
- AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->jobs, qj);
-
- avahi_key_unref(qj->key);
- avahi_free(qj);
-}
-
-static void elapse_callback(AvahiTimeEvent *e, void* data);
-
-static void job_set_elapse_time(AvahiQueryScheduler *s, AvahiQueryJob *qj, unsigned msec, unsigned jitter) {
- struct timeval tv;
-
- assert(s);
- assert(qj);
-
- avahi_elapse_time(&tv, msec, jitter);
-
- if (qj->time_event)
- avahi_time_event_update(qj->time_event, &tv);
- else
- qj->time_event = avahi_time_event_new(s->time_event_queue, &tv, elapse_callback, qj);
-}
-
-static void job_mark_done(AvahiQueryScheduler *s, AvahiQueryJob *qj) {
- assert(s);
- assert(qj);
-
- assert(!qj->done);
-
- AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->jobs, qj);
- AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->history, qj);
-
- qj->done = 1;
-
- job_set_elapse_time(s, qj, AVAHI_QUERY_HISTORY_MSEC, 0);
- gettimeofday(&qj->delivery, NULL);
-}
-
-AvahiQueryScheduler *avahi_query_scheduler_new(AvahiInterface *i) {
- AvahiQueryScheduler *s;
- assert(i);
-
- if (!(s = avahi_new(AvahiQueryScheduler, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL; /* OOM */
- }
-
- s->interface = i;
- s->time_event_queue = i->monitor->server->time_event_queue;
- s->next_id = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiQueryJob, s->jobs);
- AVAHI_LLIST_HEAD_INIT(AvahiQueryJob, s->history);
- AVAHI_LLIST_HEAD_INIT(AvahiKnownAnswer, s->known_answers);
-
- return s;
-}
-
-void avahi_query_scheduler_free(AvahiQueryScheduler *s) {
- assert(s);
-
- assert(!s->known_answers);
- avahi_query_scheduler_clear(s);
- avahi_free(s);
-}
-
-void avahi_query_scheduler_clear(AvahiQueryScheduler *s) {
- assert(s);
-
- while (s->jobs)
- job_free(s, s->jobs);
- while (s->history)
- job_free(s, s->history);
-}
-
-static void* known_answer_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
- AvahiQueryScheduler *s = userdata;
- AvahiKnownAnswer *ka;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(s);
-
- if (avahi_cache_entry_half_ttl(c, e))
- return NULL;
-
- if (!(ka = avahi_new0(AvahiKnownAnswer, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- ka->scheduler = s;
- ka->record = avahi_record_ref(e->record);
-
- AVAHI_LLIST_PREPEND(AvahiKnownAnswer, known_answer, s->known_answers, ka);
- return NULL;
-}
-
-static int packet_add_query_job(AvahiQueryScheduler *s, AvahiDnsPacket *p, AvahiQueryJob *qj) {
- assert(s);
- assert(p);
- assert(qj);
-
- if (!avahi_dns_packet_append_key(p, qj->key, 0))
- return 0;
-
- /* Add all matching known answers to the list */
- avahi_cache_walk(s->interface->cache, qj->key, known_answer_walk_callback, s);
-
- job_mark_done(s, qj);
-
- return 1;
-}
-
-static void append_known_answers_and_send(AvahiQueryScheduler *s, AvahiDnsPacket *p) {
- AvahiKnownAnswer *ka;
- unsigned n;
- assert(s);
- assert(p);
-
- n = 0;
-
- while ((ka = s->known_answers)) {
- int too_large = 0;
-
- while (!avahi_dns_packet_append_record(p, ka->record, 0, 0)) {
-
- if (avahi_dns_packet_is_empty(p)) {
- /* The record is too large to fit into one packet, so
- there's no point in sending it. Better is letting
- the owner of the record send it as a response. This
- has the advantage of a cache refresh. */
-
- too_large = 1;
- break;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) | AVAHI_DNS_FLAG_TC);
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ANCOUNT, n);
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-
- p = avahi_dns_packet_new_query(s->interface->hardware->mtu);
- n = 0;
- }
-
- AVAHI_LLIST_REMOVE(AvahiKnownAnswer, known_answer, s->known_answers, ka);
- avahi_record_unref(ka->record);
- avahi_free(ka);
-
- if (!too_large)
- n++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ANCOUNT, n);
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-}
-
-static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
- AvahiQueryJob *qj = data;
- AvahiQueryScheduler *s;
- AvahiDnsPacket *p;
- unsigned n;
- int b;
-
- assert(qj);
- s = qj->scheduler;
-
- if (qj->done) {
- /* Lets remove it from the history */
- job_free(s, qj);
- return;
- }
-
- assert(!s->known_answers);
-
- if (!(p = avahi_dns_packet_new_query(s->interface->hardware->mtu)))
- return; /* OOM */
-
- b = packet_add_query_job(s, p, qj);
- assert(b); /* An query must always fit in */
- n = 1;
-
- /* Try to fill up packet with more queries, if available */
- while (s->jobs) {
-
- if (!packet_add_query_job(s, p, s->jobs))
- break;
-
- n++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_QDCOUNT, n);
-
- /* Now add known answers */
- append_known_answers_and_send(s, p);
-}
-
-static AvahiQueryJob* find_scheduled_job(AvahiQueryScheduler *s, AvahiKey *key) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- for (qj = s->jobs; qj; qj = qj->jobs_next) {
- assert(!qj->done);
-
- if (avahi_key_equal(qj->key, key))
- return qj;
- }
-
- return NULL;
-}
-
-static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- for (qj = s->history; qj; qj = qj->jobs_next) {
- assert(qj->done);
-
- if (avahi_key_equal(qj->key, key)) {
- /* Check whether this entry is outdated */
-
- if (avahi_age(&qj->delivery) > AVAHI_QUERY_HISTORY_MSEC*1000) {
- /* it is outdated, so let's remove it */
- job_free(s, qj);
- return NULL;
- }
-
- return qj;
- }
- }
-
- return NULL;
-}
-
-int avahi_query_scheduler_post(AvahiQueryScheduler *s, AvahiKey *key, int immediately, unsigned *ret_id) {
- struct timeval tv;
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- if ((qj = find_history_job(s, key)))
- return 0;
-
- avahi_elapse_time(&tv, immediately ? 0 : AVAHI_QUERY_DEFER_MSEC, 0);
-
- if ((qj = find_scheduled_job(s, key))) {
- /* Duplicate questions suppression */
-
- if (avahi_timeval_compare(&tv, &qj->delivery) < 0) {
- /* If the new entry should be scheduled earlier,
- * update the old entry */
- qj->delivery = tv;
- avahi_time_event_update(qj->time_event, &qj->delivery);
- }
-
- qj->n_posted++;
-
- } else {
-
- if (!(qj = job_new(s, key, 0)))
- return 0; /* OOM */
-
- qj->delivery = tv;
- qj->time_event = avahi_time_event_new(s->time_event_queue, &qj->delivery, elapse_callback, qj);
- }
-
- if (ret_id)
- *ret_id = qj->id;
-
- return 1;
-}
-
-void avahi_query_scheduler_incoming(AvahiQueryScheduler *s, AvahiKey *key) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- /* This function is called whenever an incoming query was
- * received. We drop scheduled queries that match. The keyword is
- * "DUPLICATE QUESTION SUPPRESION". */
-
- if ((qj = find_scheduled_job(s, key))) {
- job_mark_done(s, qj);
- return;
- }
-
- /* Look if there's a history job for this key. If there is, just
- * update the elapse time */
- if (!(qj = find_history_job(s, key)))
- if (!(qj = job_new(s, key, 1)))
- return; /* OOM */
-
- gettimeofday(&qj->delivery, NULL);
- job_set_elapse_time(s, qj, AVAHI_QUERY_HISTORY_MSEC, 0);
-}
-
-int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id) {
- AvahiQueryJob *qj;
-
- assert(s);
-
- /* Very short lived queries can withdraw an already scheduled item
- * from the queue using this function, simply by passing the id
- * returned by avahi_query_scheduler_post(). */
-
- for (qj = s->jobs; qj; qj = qj->jobs_next) {
- assert(!qj->done);
-
- if (qj->id == id) {
- /* Entry found */
-
- assert(qj->n_posted >= 1);
-
- if (--qj->n_posted <= 0) {
-
- /* We withdraw this job only if the calling object was
- * the only remaining poster. (Usually this is the
- * case since there should exist only one querier per
- * key, but there are exceptions, notably reflected
- * traffic.) */
-
- job_free(s, qj);
- return 1;
- }
- }
- }
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/query-sched.h b/release-0.6.9/avahi-core/query-sched.h
deleted file mode 100644
index 5238558..0000000
--- a/release-0.6.9/avahi-core/query-sched.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef fooqueryschedhfoo
-#define fooqueryschedhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiQueryScheduler AvahiQueryScheduler;
-
-#include <avahi-common/address.h>
-#include "iface.h"
-
-AvahiQueryScheduler *avahi_query_scheduler_new(AvahiInterface *i);
-void avahi_query_scheduler_free(AvahiQueryScheduler *s);
-void avahi_query_scheduler_clear(AvahiQueryScheduler *s);
-
-int avahi_query_scheduler_post(AvahiQueryScheduler *s, AvahiKey *key, int immediately, unsigned *ret_id);
-int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id);
-void avahi_query_scheduler_incoming(AvahiQueryScheduler *s, AvahiKey *key);
-
-#endif
diff --git a/release-0.6.9/avahi-core/resolve-address.c b/release-0.6.9/avahi-core/resolve-address.c
deleted file mode 100644
index 25d21ac..0000000
--- a/release-0.6.9/avahi-core/resolve-address.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-
-#include "browse.h"
-
-#define TIMEOUT_MSEC 5000
-
-struct AvahiSAddressResolver {
- AvahiServer *server;
- AvahiAddress address;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiSAddressResolverCallback callback;
- void* userdata;
-
- AvahiRecord *ptr_record;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupResultFlags flags;
-
- int retry_with_multicast;
- AvahiKey *key;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiSAddressResolver, resolver);
-};
-
-static void finish(AvahiSAddressResolver *r, AvahiResolverEvent event) {
- assert(r);
-
- if (r->time_event) {
- avahi_time_event_free(r->time_event);
- r->time_event = NULL;
- }
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
- r->callback(r, r->interface, r->protocol, event, &r->address, NULL, r->flags, r->userdata);
- break;
-
- case AVAHI_RESOLVER_FOUND:
- assert(r->ptr_record);
- r->callback(r, r->interface, r->protocol, event, &r->address, r->ptr_record->data.ptr.name, r->flags, r->userdata);
- break;
- }
-}
-
-static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSAddressResolver *r = userdata;
-
- assert(e);
- assert(r);
-
- avahi_server_set_errno(r->server, AVAHI_ERR_TIMEOUT);
- finish(r, AVAHI_RESOLVER_FAILURE);
-}
-
-static void start_timeout(AvahiSAddressResolver *r) {
- struct timeval tv;
- assert(r);
-
- if (r->time_event)
- return;
-
- avahi_elapse_time(&tv, TIMEOUT_MSEC, 0);
- r->time_event = avahi_time_event_new(r->server->time_event_queue, &tv, time_event_callback, r);
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSAddressResolver *r = userdata;
-
- assert(rr);
- assert(r);
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (r->interface > 0 && interface != r->interface)
- return;
-
- if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
- return;
-
- if (r->interface <= 0)
- r->interface = interface;
-
- if (r->protocol == AVAHI_PROTO_UNSPEC)
- r->protocol = protocol;
-
- if (!r->ptr_record) {
- r->ptr_record = avahi_record_ref(record);
- r->flags = flags;
-
- finish(r, AVAHI_RESOLVER_FOUND);
- }
- break;
-
- case AVAHI_BROWSER_REMOVE:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (r->ptr_record && avahi_record_equal_no_ttl(record, r->ptr_record)) {
- avahi_record_unref(r->ptr_record);
- r->ptr_record = NULL;
- r->flags = flags;
-
- /** Look for a replacement */
- avahi_s_record_browser_restart(r->record_browser);
- start_timeout(r);
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE:
-
- if (r->retry_with_multicast) {
- r->retry_with_multicast = 0;
-
- avahi_s_record_browser_free(r->record_browser);
- r->record_browser = avahi_s_record_browser_new(r->server, r->interface, r->protocol, r->key, AVAHI_LOOKUP_USE_MULTICAST, record_browser_callback, r);
-
- if (r->record_browser) {
- start_timeout(r);
- break;
- }
- }
-
- r->flags = flags;
- finish(r, AVAHI_RESOLVER_FAILURE);
- break;
- }
-}
-
-AvahiSAddressResolver *avahi_s_address_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *address,
- AvahiLookupFlags flags,
- AvahiSAddressResolverCallback callback,
- void* userdata) {
-
- AvahiSAddressResolver *r;
- AvahiKey *k;
- char n[AVAHI_DOMAIN_NAME_MAX];
-
- assert(server);
- assert(address);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6, AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- avahi_reverse_lookup_name(address, n, sizeof(n));
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- if (!(r = avahi_new(AvahiSAddressResolver, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- avahi_key_unref(k);
- return NULL;
- }
-
- r->server = server;
- r->address = *address;
- r->callback = callback;
- r->userdata = userdata;
- r->ptr_record = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->flags = 0;
- r->retry_with_multicast = 0;
- r->key = k;
-
- r->record_browser = NULL;
- AVAHI_LLIST_PREPEND(AvahiSAddressResolver, resolver, server->address_resolvers, r);
-
- r->time_event = NULL;
-
- if (!(flags & (AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_USE_WIDE_AREA))) {
-
- if (!server->wide_area_lookup_engine || !avahi_wide_area_has_servers(server->wide_area_lookup_engine))
- flags |= AVAHI_LOOKUP_USE_MULTICAST;
- else {
- flags |= AVAHI_LOOKUP_USE_WIDE_AREA;
- r->retry_with_multicast = 1;
- }
- }
-
- r->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, r);
-
- if (!r->record_browser) {
- avahi_s_address_resolver_free(r);
- return NULL;
- }
-
- start_timeout(r);
-
- return r;
-}
-
-void avahi_s_address_resolver_free(AvahiSAddressResolver *r) {
- assert(r);
-
- AVAHI_LLIST_REMOVE(AvahiSAddressResolver, resolver, r->server->address_resolvers, r);
-
- if (r->record_browser)
- avahi_s_record_browser_free(r->record_browser);
-
- if (r->time_event)
- avahi_time_event_free(r->time_event);
-
- if (r->ptr_record)
- avahi_record_unref(r->ptr_record);
-
- if (r->key)
- avahi_key_unref(r->key);
-
- avahi_free(r);
-}
diff --git a/release-0.6.9/avahi-core/resolve-host-name.c b/release-0.6.9/avahi-core/resolve-host-name.c
deleted file mode 100644
index 59dc3cf..0000000
--- a/release-0.6.9/avahi-core/resolve-host-name.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-#define TIMEOUT_MSEC 5000
-
-struct AvahiSHostNameResolver {
- AvahiServer *server;
- char *host_name;
-
- AvahiSRecordBrowser *record_browser_a;
- AvahiSRecordBrowser *record_browser_aaaa;
-
- AvahiSHostNameResolverCallback callback;
- void* userdata;
-
- AvahiRecord *address_record;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupResultFlags flags;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiSHostNameResolver, resolver);
-};
-
-static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
- assert(r);
-
- if (r->time_event) {
- avahi_time_event_free(r->time_event);
- r->time_event = NULL;
- }
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- AvahiAddress a;
-
- assert(r->address_record);
-
- switch (r->address_record->key->type) {
- case AVAHI_DNS_TYPE_A:
- a.proto = AVAHI_PROTO_INET;
- a.data.ipv4 = r->address_record->data.a.address;
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- a.proto = AVAHI_PROTO_INET6;
- a.data.ipv6 = r->address_record->data.aaaa.address;
- break;
-
- default:
- abort();
- }
-
- r->callback(r, r->interface, r->protocol, AVAHI_RESOLVER_FOUND, r->address_record->key->name, &a, r->flags, r->userdata);
- break;
-
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- r->callback(r, r->interface, r->protocol, event, r->host_name, NULL, r->flags, r->userdata);
- break;
- }
-}
-
-static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSHostNameResolver *r = userdata;
-
- assert(e);
- assert(r);
-
- avahi_server_set_errno(r->server, AVAHI_ERR_TIMEOUT);
- finish(r, AVAHI_RESOLVER_FAILURE);
-}
-
-static void start_timeout(AvahiSHostNameResolver *r) {
- struct timeval tv;
- assert(r);
-
- if (r->time_event)
- return;
-
- avahi_elapse_time(&tv, TIMEOUT_MSEC, 0);
-
- r->time_event = avahi_time_event_new(r->server->time_event_queue, &tv, time_event_callback, r);
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSHostNameResolver *r = userdata;
-
- assert(rr);
- assert(r);
-
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_A || record->key->type == AVAHI_DNS_TYPE_AAAA);
-
- if (r->interface > 0 && interface != r->interface)
- return;
-
- if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
- return;
-
- if (r->interface <= 0)
- r->interface = interface;
-
- if (r->protocol == AVAHI_PROTO_UNSPEC)
- r->protocol = protocol;
-
- if (!r->address_record) {
- r->address_record = avahi_record_ref(record);
- r->flags = flags;
-
- finish(r, AVAHI_RESOLVER_FOUND);
- }
-
- break;
-
- case AVAHI_BROWSER_REMOVE:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_A || record->key->type == AVAHI_DNS_TYPE_AAAA);
-
- if (r->address_record && avahi_record_equal_no_ttl(record, r->address_record)) {
- avahi_record_unref(r->address_record);
- r->address_record = NULL;
-
- r->flags = flags;
-
-
- /** Look for a replacement */
- if (r->record_browser_aaaa)
- avahi_s_record_browser_restart(r->record_browser_aaaa);
- if (r->record_browser_a)
- avahi_s_record_browser_restart(r->record_browser_a);
-
- start_timeout(r);
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- /* Ignore */
- break;
-
- case AVAHI_BROWSER_FAILURE:
-
- /* Stop browsers */
-
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
-
- r->record_browser_a = r->record_browser_aaaa = NULL;
- r->flags = flags;
-
- finish(r, AVAHI_RESOLVER_FAILURE);
- break;
- }
-}
-
-AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *host_name,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiSHostNameResolverCallback callback,
- void* userdata) {
-
- AvahiSHostNameResolver *r;
- AvahiKey *k;
-
- assert(server);
- assert(host_name);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_is_valid_fqdn(host_name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(aprotocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!(r = avahi_new(AvahiSHostNameResolver, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->server = server;
- r->host_name = avahi_normalize_name_strdup(host_name);
- r->callback = callback;
- r->userdata = userdata;
- r->address_record = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->flags = 0;
-
- r->record_browser_a = r->record_browser_aaaa = NULL;
-
- r->time_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSHostNameResolver, resolver, server->host_name_resolvers, r);
-
- r->record_browser_aaaa = r->record_browser_a = NULL;
-
- if (aprotocol == AVAHI_PROTO_INET || aprotocol == AVAHI_PROTO_UNSPEC) {
- k = avahi_key_new(host_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A);
- r->record_browser_a = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_a)
- goto fail;
- }
-
- if (aprotocol == AVAHI_PROTO_INET6 || aprotocol == AVAHI_PROTO_UNSPEC) {
- k = avahi_key_new(host_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA);
- r->record_browser_aaaa = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_aaaa)
- goto fail;
- }
-
- assert(r->record_browser_aaaa || r->record_browser_a);
-
- start_timeout(r);
-
- return r;
-
-fail:
- avahi_s_host_name_resolver_free(r);
- return NULL;
-}
-
-void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r) {
- assert(r);
-
- AVAHI_LLIST_REMOVE(AvahiSHostNameResolver, resolver, r->server->host_name_resolvers, r);
-
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
-
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
-
- if (r->time_event)
- avahi_time_event_free(r->time_event);
-
- if (r->address_record)
- avahi_record_unref(r->address_record);
-
- avahi_free(r->host_name);
- avahi_free(r);
-}
diff --git a/release-0.6.9/avahi-core/resolve-service.c b/release-0.6.9/avahi-core/resolve-service.c
deleted file mode 100644
index a897546..0000000
--- a/release-0.6.9/avahi-core/resolve-service.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-#define TIMEOUT_MSEC 5000
-
-struct AvahiSServiceResolver {
- AvahiServer *server;
- char *service_name;
- char *service_type;
- char *domain_name;
- AvahiProtocol address_protocol;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- AvahiSRecordBrowser *record_browser_srv;
- AvahiSRecordBrowser *record_browser_txt;
- AvahiSRecordBrowser *record_browser_a;
- AvahiSRecordBrowser *record_browser_aaaa;
-
- AvahiRecord *srv_record, *txt_record, *address_record;
- AvahiLookupResultFlags srv_flags, txt_flags, address_flags;
-
- AvahiSServiceResolverCallback callback;
- void* userdata;
- AvahiLookupFlags user_flags;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiSServiceResolver, resolver);
-};
-
-static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
- AvahiLookupResultFlags flags;
-
- assert(r);
-
- if (r->time_event) {
- avahi_time_event_free(r->time_event);
- r->time_event = NULL;
- }
-
- flags =
- r->txt_flags |
- r->srv_flags |
- r->address_flags;
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
-
- r->callback(
- r,
- r->interface,
- r->protocol,
- event,
- r->service_name,
- r->service_type,
- r->domain_name,
- NULL,
- NULL,
- 0,
- NULL,
- flags,
- r->userdata);
-
- break;
-
- case AVAHI_RESOLVER_FOUND: {
- AvahiAddress a;
-
- assert(event == AVAHI_RESOLVER_FOUND);
-
- assert(r->srv_record);
-
- if (r->address_record) {
- switch (r->address_record->key->type) {
- case AVAHI_DNS_TYPE_A:
- a.proto = AVAHI_PROTO_INET;
- a.data.ipv4 = r->address_record->data.a.address;
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- a.proto = AVAHI_PROTO_INET6;
- a.data.ipv6 = r->address_record->data.aaaa.address;
- break;
-
- default:
- assert(0);
- }
- }
-
- r->callback(
- r,
- r->interface,
- r->protocol,
- event,
- r->service_name,
- r->service_type,
- r->domain_name,
- r->address_record ? r->address_record->key->name : r->srv_record->data.srv.name,
- r->address_record ? &a : NULL,
- r->srv_record->data.srv.port,
- r->txt_record ? r->txt_record->data.txt.string_list : NULL,
- flags,
- r->userdata);
-
- break;
- }
- }
-}
-
-static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSServiceResolver *r = userdata;
-
- assert(e);
- assert(r);
-
- avahi_server_set_errno(r->server, AVAHI_ERR_TIMEOUT);
- finish(r, AVAHI_RESOLVER_FAILURE);
-}
-
-static void start_timeout(AvahiSServiceResolver *r) {
- struct timeval tv;
- assert(r);
-
- if (r->time_event)
- return;
-
- avahi_elapse_time(&tv, TIMEOUT_MSEC, 0);
-
- r->time_event = avahi_time_event_new(r->server->time_event_queue, &tv, time_event_callback, r);
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSServiceResolver *r = userdata;
-
- assert(rr);
- assert(r);
-
- if (rr == r->record_browser_aaaa || rr == r->record_browser_a)
- r->address_flags = flags;
- else if (rr == r->record_browser_srv)
- r->srv_flags = flags;
- else if (rr == r->record_browser_txt)
- r->txt_flags = flags;
-
- switch (event) {
-
- case AVAHI_BROWSER_NEW: {
- int changed = 0;
- assert(record);
-
- if (r->interface > 0 && interface > 0 && interface != r->interface)
- return;
-
- if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
- return;
-
- if (r->interface <= 0)
- r->interface = interface;
-
- if (r->protocol == AVAHI_PROTO_UNSPEC)
- r->protocol = protocol;
-
- switch (record->key->type) {
- case AVAHI_DNS_TYPE_SRV:
- if (!r->srv_record) {
- r->srv_record = avahi_record_ref(record);
- changed = 1;
-
- if (r->record_browser_a) {
- avahi_s_record_browser_free(r->record_browser_a);
- r->record_browser_a = NULL;
- }
-
- if (r->record_browser_aaaa) {
- avahi_s_record_browser_free(r->record_browser_aaaa);
- r->record_browser_aaaa = NULL;
- }
-
- if (!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS)) {
-
- if (r->address_protocol == AVAHI_PROTO_INET || r->address_protocol == AVAHI_PROTO_UNSPEC) {
- AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A);
- r->record_browser_a = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, r->user_flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
- }
-
- if (r->address_protocol == AVAHI_PROTO_INET6 || r->address_protocol == AVAHI_PROTO_UNSPEC) {
- AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA);
- r->record_browser_aaaa = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, r->user_flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
- }
- }
- }
- break;
-
- case AVAHI_DNS_TYPE_TXT:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_TXT));
-
- if (!r->txt_record) {
- r->txt_record = avahi_record_ref(record);
- changed = 1;
- }
- break;
-
- case AVAHI_DNS_TYPE_A:
- case AVAHI_DNS_TYPE_AAAA:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS));
-
- if (!r->address_record) {
- r->address_record = avahi_record_ref(record);
- changed = 1;
- }
- break;
-
- default:
- abort();
- }
-
-
- if (changed &&
- r->srv_record &&
- (r->txt_record || (r->user_flags & AVAHI_LOOKUP_NO_TXT)) &&
- (r->address_record || (r->user_flags & AVAHI_LOOKUP_NO_ADDRESS)))
- finish(r, AVAHI_RESOLVER_FOUND);
-
- break;
-
- }
-
- case AVAHI_BROWSER_REMOVE:
-
- assert(record);
-
- switch (record->key->type) {
- case AVAHI_DNS_TYPE_SRV:
-
- if (r->srv_record && avahi_record_equal_no_ttl(record, r->srv_record)) {
- avahi_record_unref(r->srv_record);
- r->srv_record = NULL;
-
- if (r->record_browser_a) {
- avahi_s_record_browser_free(r->record_browser_a);
- r->record_browser_a = NULL;
- }
-
- if (r->record_browser_aaaa) {
- avahi_s_record_browser_free(r->record_browser_aaaa);
- r->record_browser_aaaa = NULL;
- }
-
- /** Look for a replacement */
- avahi_s_record_browser_restart(r->record_browser_srv);
- start_timeout(r);
- }
-
- break;
-
- case AVAHI_DNS_TYPE_TXT:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_TXT));
-
- if (r->txt_record && avahi_record_equal_no_ttl(record, r->txt_record)) {
- avahi_record_unref(r->txt_record);
- r->txt_record = NULL;
-
- /** Look for a replacement */
- avahi_s_record_browser_restart(r->record_browser_txt);
- start_timeout(r);
- }
- break;
-
- case AVAHI_DNS_TYPE_A:
- case AVAHI_DNS_TYPE_AAAA:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS));
-
- if (r->address_record && avahi_record_equal_no_ttl(record, r->address_record)) {
- avahi_record_unref(r->address_record);
- r->address_record = NULL;
-
- /** Look for a replacement */
- if (r->record_browser_aaaa)
- avahi_s_record_browser_restart(r->record_browser_aaaa);
- if (r->record_browser_a)
- avahi_s_record_browser_restart(r->record_browser_a);
- start_timeout(r);
- }
- break;
-
- default:
- abort();
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE:
-
- if (rr == r->record_browser_a && r->record_browser_aaaa) {
- /* We were looking for both AAAA and A, and the other query is still living, so we'll not die */
- avahi_s_record_browser_free(r->record_browser_a);
- r->record_browser_a = NULL;
- break;
- }
-
- if (rr == r->record_browser_aaaa && r->record_browser_a) {
- /* We were looking for both AAAA and A, and the other query is still living, so we'll not die */
- avahi_s_record_browser_free(r->record_browser_aaaa);
- r->record_browser_aaaa = NULL;
- break;
- }
-
- /* Hmm, everything's lost, tell the user */
-
- if (r->record_browser_srv)
- avahi_s_record_browser_free(r->record_browser_srv);
- if (r->record_browser_txt)
- avahi_s_record_browser_free(r->record_browser_txt);
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
-
- r->record_browser_srv = r->record_browser_txt = r->record_browser_a = r->record_browser_aaaa = NULL;
-
- finish(r, AVAHI_RESOLVER_FAILURE);
- break;
- }
-}
-
-AvahiSServiceResolver *avahi_s_service_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiSServiceResolverCallback callback,
- void* userdata) {
-
- AvahiSServiceResolver *r;
- AvahiKey *k;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int ret;
-
- assert(server);
- assert(type);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(aprotocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !name || avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((ret = avahi_service_name_join(n, sizeof(n), name, type, domain)) < 0) {
- avahi_server_set_errno(server, ret);
- return NULL;
- }
-
- if (!(r = avahi_new(AvahiSServiceResolver, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->server = server;
- r->service_name = avahi_strdup(name);
- r->service_type = avahi_normalize_name_strdup(type);
- r->domain_name = avahi_normalize_name_strdup(domain);
- r->callback = callback;
- r->userdata = userdata;
- r->address_protocol = aprotocol;
- r->srv_record = r->txt_record = r->address_record = NULL;
- r->srv_flags = r->txt_flags = r->address_flags = 0;
- r->interface = interface;
- r->protocol = protocol;
- r->user_flags = flags;
- r->record_browser_a = r->record_browser_aaaa = r->record_browser_srv = r->record_browser_txt = NULL;
- r->time_event = NULL;
- AVAHI_LLIST_PREPEND(AvahiSServiceResolver, resolver, server->service_resolvers, r);
-
- k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV);
- r->record_browser_srv = avahi_s_record_browser_new(server, interface, protocol, k, flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_srv) {
- avahi_s_service_resolver_free(r);
- return NULL;
- }
-
- if (!(flags & AVAHI_LOOKUP_NO_TXT)) {
- k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT);
- r->record_browser_txt = avahi_s_record_browser_new(server, interface, protocol, k, flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_txt) {
- avahi_s_service_resolver_free(r);
- return NULL;
- }
- }
-
- start_timeout(r);
-
- return r;
-}
-
-void avahi_s_service_resolver_free(AvahiSServiceResolver *r) {
- assert(r);
-
- AVAHI_LLIST_REMOVE(AvahiSServiceResolver, resolver, r->server->service_resolvers, r);
-
- if (r->time_event)
- avahi_time_event_free(r->time_event);
-
- if (r->record_browser_srv)
- avahi_s_record_browser_free(r->record_browser_srv);
- if (r->record_browser_txt)
- avahi_s_record_browser_free(r->record_browser_txt);
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
-
- if (r->srv_record)
- avahi_record_unref(r->srv_record);
- if (r->txt_record)
- avahi_record_unref(r->txt_record);
- if (r->address_record)
- avahi_record_unref(r->address_record);
-
- avahi_free(r->service_name);
- avahi_free(r->service_type);
- avahi_free(r->domain_name);
- avahi_free(r);
-}
diff --git a/release-0.6.9/avahi-core/response-sched.c b/release-0.6.9/avahi-core/response-sched.c
deleted file mode 100644
index ef10eca..0000000
--- a/release-0.6.9/avahi-core/response-sched.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "response-sched.h"
-#include "log.h"
-#include "rr-util.h"
-
-/* Local packets are supressed this long after sending them */
-#define AVAHI_RESPONSE_HISTORY_MSEC 500
-
-/* Local packets are deferred this long before sending them */
-#define AVAHI_RESPONSE_DEFER_MSEC 20
-
-/* Additional jitter for deferred packets */
-#define AVAHI_RESPONSE_JITTER_MSEC 100
-
-/* Remote packets can suppress local traffic as long as this value */
-#define AVAHI_RESPONSE_SUPPRESS_MSEC 700
-
-typedef struct AvahiResponseJob AvahiResponseJob;
-
-typedef enum {
- AVAHI_SCHEDULED,
- AVAHI_DONE,
- AVAHI_SUPPRESSED
-} AvahiResponseJobState;
-
-struct AvahiResponseJob {
- AvahiResponseScheduler *scheduler;
- AvahiTimeEvent *time_event;
-
- AvahiResponseJobState state;
- struct timeval delivery;
-
- AvahiRecord *record;
- int flush_cache;
- AvahiAddress querier;
- int querier_valid;
-
- AVAHI_LLIST_FIELDS(AvahiResponseJob, jobs);
-};
-
-struct AvahiResponseScheduler {
- AvahiInterface *interface;
- AvahiTimeEventQueue *time_event_queue;
-
- AVAHI_LLIST_HEAD(AvahiResponseJob, jobs);
- AVAHI_LLIST_HEAD(AvahiResponseJob, history);
- AVAHI_LLIST_HEAD(AvahiResponseJob, suppressed);
-};
-
-static AvahiResponseJob* job_new(AvahiResponseScheduler *s, AvahiRecord *record, AvahiResponseJobState state) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
-
- if (!(rj = avahi_new(AvahiResponseJob, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- rj->scheduler = s;
- rj->record = avahi_record_ref(record);
- rj->time_event = NULL;
- rj->flush_cache = 0;
- rj->querier_valid = 0;
-
- if ((rj->state = state) == AVAHI_SCHEDULED)
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->jobs, rj);
- else if (rj->state == AVAHI_DONE)
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->history, rj);
- else /* rj->state == AVAHI_SUPPRESSED */
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->suppressed, rj);
-
- return rj;
-}
-
-static void job_free(AvahiResponseScheduler *s, AvahiResponseJob *rj) {
- assert(s);
- assert(rj);
-
- if (rj->time_event)
- avahi_time_event_free(rj->time_event);
-
- if (rj->state == AVAHI_SCHEDULED)
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->jobs, rj);
- else if (rj->state == AVAHI_DONE)
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->history, rj);
- else /* rj->state == AVAHI_SUPPRESSED */
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->suppressed, rj);
-
- avahi_record_unref(rj->record);
- avahi_free(rj);
-}
-
-static void elapse_callback(AvahiTimeEvent *e, void* data);
-
-static void job_set_elapse_time(AvahiResponseScheduler *s, AvahiResponseJob *rj, unsigned msec, unsigned jitter) {
- struct timeval tv;
-
- assert(s);
- assert(rj);
-
- avahi_elapse_time(&tv, msec, jitter);
-
- if (rj->time_event)
- avahi_time_event_update(rj->time_event, &tv);
- else
- rj->time_event = avahi_time_event_new(s->time_event_queue, &tv, elapse_callback, rj);
-}
-
-static void job_mark_done(AvahiResponseScheduler *s, AvahiResponseJob *rj) {
- assert(s);
- assert(rj);
-
- assert(rj->state == AVAHI_SCHEDULED);
-
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->jobs, rj);
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->history, rj);
-
- rj->state = AVAHI_DONE;
-
- job_set_elapse_time(s, rj, AVAHI_RESPONSE_HISTORY_MSEC, 0);
-
- gettimeofday(&rj->delivery, NULL);
-}
-
-AvahiResponseScheduler *avahi_response_scheduler_new(AvahiInterface *i) {
- AvahiResponseScheduler *s;
- assert(i);
-
- if (!(s = avahi_new(AvahiResponseScheduler, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- s->interface = i;
- s->time_event_queue = i->monitor->server->time_event_queue;
-
- AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->jobs);
- AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->history);
- AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->suppressed);
-
- return s;
-}
-
-void avahi_response_scheduler_free(AvahiResponseScheduler *s) {
- assert(s);
-
- avahi_response_scheduler_clear(s);
- avahi_free(s);
-}
-
-void avahi_response_scheduler_clear(AvahiResponseScheduler *s) {
- assert(s);
-
- while (s->jobs)
- job_free(s, s->jobs);
- while (s->history)
- job_free(s, s->history);
- while (s->suppressed)
- job_free(s, s->suppressed);
-}
-
-static void enumerate_aux_records_callback(AVAHI_GCC_UNUSED AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata) {
- AvahiResponseJob *rj = userdata;
-
- assert(r);
- assert(rj);
-
- avahi_response_scheduler_post(rj->scheduler, r, flush_cache, rj->querier_valid ? &rj->querier : NULL, 0);
-}
-
-static int packet_add_response_job(AvahiResponseScheduler *s, AvahiDnsPacket *p, AvahiResponseJob *rj) {
- assert(s);
- assert(p);
- assert(rj);
-
- /* Try to add this record to the packet */
- if (!avahi_dns_packet_append_record(p, rj->record, rj->flush_cache, 0))
- return 0;
-
- /* Ok, this record will definitely be sent, so schedule the
- * auxilliary packets, too */
- avahi_server_enumerate_aux_records(s->interface->monitor->server, s->interface, rj->record, enumerate_aux_records_callback, rj);
- job_mark_done(s, rj);
-
- return 1;
-}
-
-static void send_response_packet(AvahiResponseScheduler *s, AvahiResponseJob *rj) {
- AvahiDnsPacket *p;
- unsigned n;
-
- assert(s);
- assert(rj);
-
- if (!(p = avahi_dns_packet_new_response(s->interface->hardware->mtu, 1)))
- return; /* OOM */
- n = 1;
-
- /* Put it in the packet. */
- if (packet_add_response_job(s, p, rj)) {
-
- /* Try to fill up packet with more responses, if available */
- while (s->jobs) {
-
- if (!packet_add_response_job(s, p, s->jobs))
- break;
-
- n++;
- }
-
- } else {
- size_t size;
-
- avahi_dns_packet_free(p);
-
- /* OK, the packet was too small, so create one that fits */
- size = avahi_record_get_estimate_size(rj->record) + AVAHI_DNS_PACKET_HEADER_SIZE;
-
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(p = avahi_dns_packet_new_response(size, 1)))
- return; /* OOM */
-
- if (!packet_add_response_job(s, p, rj)) {
- avahi_dns_packet_free(p);
-
- avahi_log_warn("Record too large, cannot send");
- job_mark_done(s, rj);
- return;
- }
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ANCOUNT, n);
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-}
-
-static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
- AvahiResponseJob *rj = data;
-
- assert(rj);
-
- if (rj->state == AVAHI_DONE || rj->state == AVAHI_SUPPRESSED)
- job_free(rj->scheduler, rj); /* Lets drop this entry */
- else
- send_response_packet(rj->scheduler, rj);
-}
-
-static AvahiResponseJob* find_scheduled_job(AvahiResponseScheduler *s, AvahiRecord *record) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
-
- for (rj = s->jobs; rj; rj = rj->jobs_next) {
- assert(rj->state == AVAHI_SCHEDULED);
-
- if (avahi_record_equal_no_ttl(rj->record, record))
- return rj;
- }
-
- return NULL;
-}
-
-static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord *record) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
-
- for (rj = s->history; rj; rj = rj->jobs_next) {
- assert(rj->state == AVAHI_DONE);
-
- if (avahi_record_equal_no_ttl(rj->record, record)) {
- /* Check whether this entry is outdated */
-
-/* avahi_log_debug("history age: %u", (unsigned) (avahi_age(&rj->delivery)/1000)); */
-
- if (avahi_age(&rj->delivery)/1000 > AVAHI_RESPONSE_HISTORY_MSEC) {
- /* it is outdated, so let's remove it */
- job_free(s, rj);
- return NULL;
- }
-
- return rj;
- }
- }
-
- return NULL;
-}
-
-static AvahiResponseJob* find_suppressed_job(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
- assert(querier);
-
- for (rj = s->suppressed; rj; rj = rj->jobs_next) {
- assert(rj->state == AVAHI_SUPPRESSED);
- assert(rj->querier_valid);
-
- if (avahi_record_equal_no_ttl(rj->record, record) &&
- avahi_address_cmp(&rj->querier, querier) == 0) {
- /* Check whether this entry is outdated */
-
- if (avahi_age(&rj->delivery) > AVAHI_RESPONSE_SUPPRESS_MSEC*1000) {
- /* it is outdated, so let's remove it */
- job_free(s, rj);
- return NULL;
- }
-
- return rj;
- }
- }
-
- return NULL;
-}
-
-int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately) {
- AvahiResponseJob *rj;
- struct timeval tv;
-/* char *t; */
-
- assert(s);
- assert(record);
-
- assert(!avahi_key_is_pattern(record->key));
-
-/* t = avahi_record_to_string(record); */
-/* avahi_log_debug("post %i %s", immediately, t); */
-/* avahi_free(t); */
-
- /* Check whether this response is suppressed */
- if (querier &&
- (rj = find_suppressed_job(s, record, querier)) &&
- avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) &&
- rj->record->ttl >= record->ttl/2) {
-
-/* avahi_log_debug("Response suppressed by known answer suppression."); */
- return 0;
- }
-
- /* Check if we already sent this response recently */
- if ((rj = find_history_job(s, record))) {
-
- if (avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) &&
- rj->record->ttl >= record->ttl/2 &&
- (rj->flush_cache || !flush_cache)) {
-/* avahi_log_debug("Response suppressed by local duplicate suppression (history)"); */
- return 0;
- }
-
- /* Outdated ... */
- job_free(s, rj);
- }
-
- avahi_elapse_time(&tv, immediately ? 0 : AVAHI_RESPONSE_DEFER_MSEC, immediately ? 0 : AVAHI_RESPONSE_JITTER_MSEC);
-
- if ((rj = find_scheduled_job(s, record))) {
-/* avahi_log_debug("Response suppressed by local duplicate suppression (scheduled)"); */
-
- /* Update a little ... */
-
- /* Update the time if the new is prior to the old */
- if (avahi_timeval_compare(&tv, &rj->delivery) < 0) {
- rj->delivery = tv;
- avahi_time_event_update(rj->time_event, &rj->delivery);
- }
-
- /* Update the flush cache bit */
- if (flush_cache)
- rj->flush_cache = 1;
-
- /* Update the querier field */
- if (!querier || (rj->querier_valid && avahi_address_cmp(querier, &rj->querier) != 0))
- rj->querier_valid = 0;
-
- /* Update record data (just for the TTL) */
- avahi_record_unref(rj->record);
- rj->record = avahi_record_ref(record);
-
- return 1;
- } else {
-/* avahi_log_debug("Accepted new response job."); */
-
- /* Create a new job and schedule it */
- if (!(rj = job_new(s, record, AVAHI_SCHEDULED)))
- return 0; /* OOM */
-
- rj->delivery = tv;
- rj->time_event = avahi_time_event_new(s->time_event_queue, &rj->delivery, elapse_callback, rj);
- rj->flush_cache = flush_cache;
-
- if ((rj->querier_valid = !!querier))
- rj->querier = *querier;
-
- return 1;
- }
-}
-
-void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache) {
- AvahiResponseJob *rj;
- assert(s);
-
- /* This function is called whenever an incoming response was
- * receieved. We drop scheduled responses which match here. The
- * keyword is "DUPLICATE ANSWER SUPPRESION". */
-
- if ((rj = find_scheduled_job(s, record))) {
-
- if ((!rj->flush_cache || flush_cache) && /* flush cache bit was set correctly */
- avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) && /* both goodbye packets, or both not */
- record->ttl >= rj->record->ttl/2) { /* sensible TTL */
-
- /* A matching entry was found, so let's mark it done */
-/* avahi_log_debug("Response suppressed by distributed duplicate suppression"); */
- job_mark_done(s, rj);
- }
-
- return;
- }
-
- if ((rj = find_history_job(s, record))) {
- /* Found a history job, let's update it */
- avahi_record_unref(rj->record);
- rj->record = avahi_record_ref(record);
- } else
- /* Found no existing history job, so let's create a new one */
- if (!(rj = job_new(s, record, AVAHI_DONE)))
- return; /* OOM */
-
- rj->flush_cache = flush_cache;
- rj->querier_valid = 0;
-
- gettimeofday(&rj->delivery, NULL);
- job_set_elapse_time(s, rj, AVAHI_RESPONSE_HISTORY_MSEC, 0);
-}
-
-void avahi_response_scheduler_suppress(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
- assert(querier);
-
- if ((rj = find_scheduled_job(s, record))) {
-
- if (rj->querier_valid && avahi_address_cmp(querier, &rj->querier) == 0 && /* same originator */
- avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) && /* both goodbye packets, or both not */
- record->ttl >= rj->record->ttl/2) { /* sensible TTL */
-
- /* A matching entry was found, so let's drop it */
-/* avahi_log_debug("Known answer suppression active!"); */
- job_free(s, rj);
- }
- }
-
- if ((rj = find_suppressed_job(s, record, querier))) {
-
- /* Let's update the old entry */
- avahi_record_unref(rj->record);
- rj->record = avahi_record_ref(record);
-
- } else {
-
- /* Create a new entry */
- if (!(rj = job_new(s, record, AVAHI_SUPPRESSED)))
- return; /* OOM */
- rj->querier_valid = 1;
- rj->querier = *querier;
- }
-
- gettimeofday(&rj->delivery, NULL);
- job_set_elapse_time(s, rj, AVAHI_RESPONSE_SUPPRESS_MSEC, 0);
-}
-
-void avahi_response_scheduler_force(AvahiResponseScheduler *s) {
- assert(s);
-
- /* Send all scheduled responses immediately */
- while (s->jobs)
- send_response_packet(s, s->jobs);
-}
diff --git a/release-0.6.9/avahi-core/response-sched.h b/release-0.6.9/avahi-core/response-sched.h
deleted file mode 100644
index 68c4a9d..0000000
--- a/release-0.6.9/avahi-core/response-sched.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef fooresponseschedhfoo
-#define fooresponseschedhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiResponseScheduler AvahiResponseScheduler;
-
-#include <avahi-common/address.h>
-#include "iface.h"
-
-AvahiResponseScheduler *avahi_response_scheduler_new(AvahiInterface *i);
-void avahi_response_scheduler_free(AvahiResponseScheduler *s);
-void avahi_response_scheduler_clear(AvahiResponseScheduler *s);
-void avahi_response_scheduler_force(AvahiResponseScheduler *s);
-
-int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately);
-void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache);
-void avahi_response_scheduler_suppress(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier);
-
-#endif
diff --git a/release-0.6.9/avahi-core/rr-util.h b/release-0.6.9/avahi-core/rr-util.h
deleted file mode 100644
index b3c35b4..0000000
--- a/release-0.6.9/avahi-core/rr-util.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef foorrutilhfoo
-#define foorrutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "rr.h"
-
-AVAHI_C_DECL_BEGIN
-
-/** Creaze new AvahiKey object based on an existing key but replaceing the type by CNAME */
-AvahiKey *avahi_key_new_cname(AvahiKey *key);
-
-/** Match a key to a key pattern. The pattern has a type of
-AVAHI_DNS_CLASS_ANY, the classes are taken to be equal. Same for the
-type. If the pattern has neither class nor type with ANY constants,
-this function is identical to avahi_key_equal(). In contrast to
-avahi_equal() this function is not commutative. */
-int avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k);
-
-/** Check whether a key is a pattern key, i.e. the class/type has a
- * value of AVAHI_DNS_CLASS_ANY/AVAHI_DNS_TYPE_ANY */
-int avahi_key_is_pattern(const AvahiKey *k);
-
-/** Returns a maximum estimate for the space that is needed to store
- * this key in a DNS packet. */
-size_t avahi_key_get_estimate_size(AvahiKey *k);
-
-/** Returns a maximum estimate for the space that is needed to store
- * the record in a DNS packet. */
-size_t avahi_record_get_estimate_size(AvahiRecord *r);
-
-/** Do a mDNS spec conforming lexicographical comparison of the two
- * records. Return a negative value if a < b, a positive if a > b,
- * zero if equal. */
-int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b);
-
-/** Return 1 if the specified record is an mDNS goodbye record. i.e. TTL is zero. */
-int avahi_record_is_goodbye(AvahiRecord *r);
-
-/** Make a deep copy of an AvahiRecord object */
-AvahiRecord *avahi_record_copy(AvahiRecord *r);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/rr.c b/release-0.6.9/avahi-core/rr.c
deleted file mode 100644
index 46aa7a2..0000000
--- a/release-0.6.9/avahi-core/rr.c
+++ /dev/null
@@ -1,703 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <assert.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/defs.h>
-
-#include "rr.h"
-#include "log.h"
-#include "util.h"
-#include "hashmap.h"
-#include "domain-util.h"
-#include "rr-util.h"
-
-AvahiKey *avahi_key_new(const char *name, uint16_t class, uint16_t type) {
- AvahiKey *k;
- assert(name);
-
- if (!(k = avahi_new(AvahiKey, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- if (!(k->name = avahi_normalize_name_strdup(name))) {
- avahi_log_error("avahi_normalize_name() failed.");
- avahi_free(k);
- return NULL;
- }
-
- k->ref = 1;
- k->clazz = class;
- k->type = type;
-
- return k;
-}
-
-AvahiKey *avahi_key_new_cname(AvahiKey *key) {
- assert(key);
-
- if (key->clazz != AVAHI_DNS_CLASS_IN)
- return NULL;
-
- if (key->type == AVAHI_DNS_TYPE_CNAME)
- return NULL;
-
- return avahi_key_new(key->name, key->clazz, AVAHI_DNS_TYPE_CNAME);
-}
-
-AvahiKey *avahi_key_ref(AvahiKey *k) {
- assert(k);
- assert(k->ref >= 1);
-
- k->ref++;
-
- return k;
-}
-
-void avahi_key_unref(AvahiKey *k) {
- assert(k);
- assert(k->ref >= 1);
-
- if ((--k->ref) <= 0) {
- avahi_free(k->name);
- avahi_free(k);
- }
-}
-
-AvahiRecord *avahi_record_new(AvahiKey *k, uint32_t ttl) {
- AvahiRecord *r;
-
- assert(k);
-
- if (!(r = avahi_new(AvahiRecord, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- r->ref = 1;
- r->key = avahi_key_ref(k);
-
- memset(&r->data, 0, sizeof(r->data));
-
- r->ttl = ttl != (uint32_t) -1 ? ttl : AVAHI_DEFAULT_TTL;
-
- return r;
-}
-
-AvahiRecord *avahi_record_new_full(const char *name, uint16_t class, uint16_t type, uint32_t ttl) {
- AvahiRecord *r;
- AvahiKey *k;
-
- assert(name);
-
- if (!(k = avahi_key_new(name, class, type))) {
- avahi_log_error("avahi_key_new() failed.");
- return NULL;
- }
-
- r = avahi_record_new(k, ttl);
- avahi_key_unref(k);
-
- if (!r) {
- avahi_log_error("avahi_record_new() failed.");
- return NULL;
- }
-
- return r;
-}
-
-AvahiRecord *avahi_record_ref(AvahiRecord *r) {
- assert(r);
- assert(r->ref >= 1);
-
- r->ref++;
- return r;
-}
-
-void avahi_record_unref(AvahiRecord *r) {
- assert(r);
- assert(r->ref >= 1);
-
- if ((--r->ref) <= 0) {
- switch (r->key->type) {
-
- case AVAHI_DNS_TYPE_SRV:
- avahi_free(r->data.srv.name);
- break;
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- avahi_free(r->data.ptr.name);
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- avahi_free(r->data.hinfo.cpu);
- avahi_free(r->data.hinfo.os);
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- avahi_string_list_free(r->data.txt.string_list);
- break;
-
- case AVAHI_DNS_TYPE_A:
- case AVAHI_DNS_TYPE_AAAA:
- break;
-
- default:
- avahi_free(r->data.generic.data);
- }
-
- avahi_key_unref(r->key);
- avahi_free(r);
- }
-}
-
-const char *avahi_dns_class_to_string(uint16_t class) {
- if (class & AVAHI_DNS_CACHE_FLUSH)
- return "FLUSH";
-
- switch (class) {
- case AVAHI_DNS_CLASS_IN:
- return "IN";
- case AVAHI_DNS_CLASS_ANY:
- return "ANY";
- default:
- return NULL;
- }
-}
-
-const char *avahi_dns_type_to_string(uint16_t type) {
- switch (type) {
- case AVAHI_DNS_TYPE_CNAME:
- return "CNAME";
- case AVAHI_DNS_TYPE_A:
- return "A";
- case AVAHI_DNS_TYPE_AAAA:
- return "AAAA";
- case AVAHI_DNS_TYPE_PTR:
- return "PTR";
- case AVAHI_DNS_TYPE_HINFO:
- return "HINFO";
- case AVAHI_DNS_TYPE_TXT:
- return "TXT";
- case AVAHI_DNS_TYPE_SRV:
- return "SRV";
- case AVAHI_DNS_TYPE_ANY:
- return "ANY";
- case AVAHI_DNS_TYPE_SOA:
- return "SOA";
- case AVAHI_DNS_TYPE_NS:
- return "NS";
- default:
- return NULL;
- }
-}
-
-char *avahi_key_to_string(const AvahiKey *k) {
- char class[16], type[16];
- const char *c, *t;
-
- assert(k);
- assert(k->ref >= 1);
-
- /* According to RFC3597 */
-
- if (!(c = avahi_dns_class_to_string(k->clazz))) {
- snprintf(class, sizeof(class), "CLASS%u", k->clazz);
- c = class;
- }
-
- if (!(t = avahi_dns_type_to_string(k->type))) {
- snprintf(type, sizeof(type), "TYPE%u", k->type);
- t = type;
- }
-
- return avahi_strdup_printf("%s\t%s\t%s", k->name, c, t);
-}
-
-char *avahi_record_to_string(const AvahiRecord *r) {
- char *p, *s;
- char buf[1024], *t = NULL, *d = NULL;
-
- assert(r);
- assert(r->ref >= 1);
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_A:
- inet_ntop(AF_INET, &r->data.a.address.address, t = buf, sizeof(buf));
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- inet_ntop(AF_INET6, &r->data.aaaa.address.address, t = buf, sizeof(buf));
- break;
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
-
- t = r->data.ptr.name;
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- t = d = avahi_string_list_to_string(r->data.txt.string_list);
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
-
- snprintf(t = buf, sizeof(buf), "\"%s\" \"%s\"", r->data.hinfo.cpu, r->data.hinfo.os);
- break;
-
- case AVAHI_DNS_TYPE_SRV:
-
- snprintf(t = buf, sizeof(buf), "%u %u %u %s",
- r->data.srv.priority,
- r->data.srv.weight,
- r->data.srv.port,
- r->data.srv.name);
-
- break;
-
- default: {
-
- uint8_t *c;
- uint16_t n;
- int i;
- char *e;
-
- /* According to RFC3597 */
-
- snprintf(t = buf, sizeof(buf), "\\# %u", r->data.generic.size);
-
- e = strchr(t, 0);
-
- for (c = r->data.generic.data, n = r->data.generic.size, i = 0;
- n > 0 && i < 20;
- c ++, n --) {
-
- sprintf(e, " %02X", *c);
- e = strchr(e, 0);
- }
-
- break;
- }
- }
-
- p = avahi_key_to_string(r->key);
- s = avahi_strdup_printf("%s %s ; ttl=%u", p, t, r->ttl);
- avahi_free(p);
- avahi_free(d);
-
- return s;
-}
-
-int avahi_key_equal(const AvahiKey *a, const AvahiKey *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 1;
-
- return avahi_domain_equal(a->name, b->name) &&
- a->type == b->type &&
- a->clazz == b->clazz;
-}
-
-int avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k) {
- assert(pattern);
- assert(k);
-
- assert(!avahi_key_is_pattern(k));
-
- if (pattern == k)
- return 1;
-
- return avahi_domain_equal(pattern->name, k->name) &&
- (pattern->type == k->type || pattern->type == AVAHI_DNS_TYPE_ANY) &&
- (pattern->clazz == k->clazz || pattern->clazz == AVAHI_DNS_CLASS_ANY);
-}
-
-int avahi_key_is_pattern(const AvahiKey *k) {
- assert(k);
-
- return
- k->type == AVAHI_DNS_TYPE_ANY ||
- k->clazz == AVAHI_DNS_CLASS_ANY;
-}
-
-unsigned avahi_key_hash(const AvahiKey *k) {
- assert(k);
-
- return
- avahi_domain_hash(k->name) +
- k->type +
- k->clazz;
-}
-
-static int rdata_equal(const AvahiRecord *a, const AvahiRecord *b) {
- assert(a);
- assert(b);
- assert(a->key->type == b->key->type);
-
- switch (a->key->type) {
- case AVAHI_DNS_TYPE_SRV:
- return
- a->data.srv.priority == b->data.srv.priority &&
- a->data.srv.weight == b->data.srv.weight &&
- a->data.srv.port == b->data.srv.port &&
- avahi_domain_equal(a->data.srv.name, b->data.srv.name);
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- return avahi_domain_equal(a->data.ptr.name, b->data.ptr.name);
-
- case AVAHI_DNS_TYPE_HINFO:
- return
- !strcmp(a->data.hinfo.cpu, b->data.hinfo.cpu) &&
- !strcmp(a->data.hinfo.os, b->data.hinfo.os);
-
- case AVAHI_DNS_TYPE_TXT:
- return avahi_string_list_equal(a->data.txt.string_list, b->data.txt.string_list);
-
- case AVAHI_DNS_TYPE_A:
- return memcmp(&a->data.a.address, &b->data.a.address, sizeof(AvahiIPv4Address)) == 0;
-
- case AVAHI_DNS_TYPE_AAAA:
- return memcmp(&a->data.aaaa.address, &b->data.aaaa.address, sizeof(AvahiIPv6Address)) == 0;
-
- default:
- return a->data.generic.size == b->data.generic.size &&
- (a->data.generic.size == 0 || memcmp(a->data.generic.data, b->data.generic.data, a->data.generic.size) == 0);
- }
-
-}
-
-int avahi_record_equal_no_ttl(const AvahiRecord *a, const AvahiRecord *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 1;
-
- return
- avahi_key_equal(a->key, b->key) &&
- rdata_equal(a, b);
-}
-
-
-AvahiRecord *avahi_record_copy(AvahiRecord *r) {
- AvahiRecord *copy;
-
- if (!(copy = avahi_new(AvahiRecord, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- copy->ref = 1;
- copy->key = avahi_key_ref(r->key);
- copy->ttl = r->ttl;
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- if (!(copy->data.ptr.name = avahi_strdup(r->data.ptr.name)))
- goto fail;
- break;
-
- case AVAHI_DNS_TYPE_SRV:
- copy->data.srv.priority = r->data.srv.priority;
- copy->data.srv.weight = r->data.srv.weight;
- copy->data.srv.port = r->data.srv.port;
- if (!(copy->data.srv.name = avahi_strdup(r->data.srv.name)))
- goto fail;
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- if (!(copy->data.hinfo.os = avahi_strdup(r->data.hinfo.os)))
- goto fail;
-
- if (!(copy->data.hinfo.cpu = avahi_strdup(r->data.hinfo.cpu))) {
- avahi_free(r->data.hinfo.os);
- goto fail;
- }
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- copy->data.txt.string_list = avahi_string_list_copy(r->data.txt.string_list);
- break;
-
- case AVAHI_DNS_TYPE_A:
- copy->data.a.address = r->data.a.address;
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- copy->data.aaaa.address = r->data.aaaa.address;
- break;
-
- default:
- if (!(copy->data.generic.data = avahi_memdup(r->data.generic.data, r->data.generic.size)))
- goto fail;
- copy->data.generic.size = r->data.generic.size;
- break;
-
- }
-
- return copy;
-
-fail:
- avahi_log_error("Failed to allocate memory");
-
- avahi_key_unref(copy->key);
- avahi_free(copy);
-
- return NULL;
-}
-
-
-size_t avahi_key_get_estimate_size(AvahiKey *k) {
- assert(k);
-
- return strlen(k->name)+1+4;
-}
-
-size_t avahi_record_get_estimate_size(AvahiRecord *r) {
- size_t n;
- assert(r);
-
- n = avahi_key_get_estimate_size(r->key) + 4 + 2;
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- n += strlen(r->data.ptr.name) + 1;
- break;
-
- case AVAHI_DNS_TYPE_SRV:
- n += 6 + strlen(r->data.srv.name) + 1;
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- n += strlen(r->data.hinfo.os) + 1 + strlen(r->data.hinfo.cpu) + 1;
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- n += avahi_string_list_serialize(r->data.txt.string_list, NULL, 0);
- break;
-
- case AVAHI_DNS_TYPE_A:
- n += sizeof(AvahiIPv4Address);
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- n += sizeof(AvahiIPv6Address);
- break;
-
- default:
- n += r->data.generic.size;
- }
-
- return n;
-}
-
-static int lexicographical_memcmp(const void* a, size_t al, const void* b, size_t bl) {
- size_t c;
- int ret;
-
- assert(a);
- assert(b);
-
- c = al < bl ? al : bl;
- if ((ret = memcmp(a, b, c)))
- return ret;
-
- if (al == bl)
- return 0;
- else
- return al == c ? 1 : -1;
-}
-
-static int uint16_cmp(uint16_t a, uint16_t b) {
- return a == b ? 0 : (a < b ? -1 : 1);
-}
-
-int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) {
- int r;
-/* char *t1, *t2; */
-
- assert(a);
- assert(b);
-
-/* t1 = avahi_record_to_string(a); */
-/* t2 = avahi_record_to_string(b); */
-/* g_message("lexicocmp: %s %s", t1, t2); */
-/* avahi_free(t1); */
-/* avahi_free(t2); */
-
- if (a == b)
- return 0;
-
- if ((r = uint16_cmp(a->key->clazz, b->key->clazz)) ||
- (r = uint16_cmp(a->key->type, b->key->type)))
- return r;
-
- switch (a->key->type) {
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- return avahi_binary_domain_cmp(a->data.ptr.name, b->data.ptr.name);
-
- case AVAHI_DNS_TYPE_SRV: {
- if ((r = uint16_cmp(a->data.srv.priority, b->data.srv.priority)) == 0 &&
- (r = uint16_cmp(a->data.srv.weight, b->data.srv.weight)) == 0 &&
- (r = uint16_cmp(a->data.srv.port, b->data.srv.port)) == 0)
- r = avahi_binary_domain_cmp(a->data.srv.name, b->data.srv.name);
-
- return r;
- }
-
- case AVAHI_DNS_TYPE_HINFO: {
-
- if ((r = strcmp(a->data.hinfo.cpu, b->data.hinfo.cpu)) ||
- (r = strcmp(a->data.hinfo.os, b->data.hinfo.os)))
- return r;
-
- return 0;
-
- }
-
- case AVAHI_DNS_TYPE_TXT: {
-
- uint8_t *ma = NULL, *mb = NULL;
- size_t asize, bsize;
-
- asize = avahi_string_list_serialize(a->data.txt.string_list, NULL, 0);
- bsize = avahi_string_list_serialize(b->data.txt.string_list, NULL, 0);
-
- if (asize > 0 && !(ma = avahi_new(uint8_t, asize)))
- goto fail;
-
- if (bsize > 0 && !(mb = avahi_new(uint8_t, bsize))) {
- avahi_free(ma);
- goto fail;
- }
-
- avahi_string_list_serialize(a->data.txt.string_list, ma, asize);
- avahi_string_list_serialize(b->data.txt.string_list, mb, bsize);
-
- if (asize && bsize)
- r = lexicographical_memcmp(ma, asize, mb, bsize);
- else if (asize && !bsize)
- r = 1;
- else if (!asize && bsize)
- r = -1;
- else
- r = 0;
-
- avahi_free(ma);
- avahi_free(mb);
-
- return r;
- }
-
- case AVAHI_DNS_TYPE_A:
- return memcmp(&a->data.a.address, &b->data.a.address, sizeof(AvahiIPv4Address));
-
- case AVAHI_DNS_TYPE_AAAA:
- return memcmp(&a->data.aaaa.address, &b->data.aaaa.address, sizeof(AvahiIPv6Address));
-
- default:
- return lexicographical_memcmp(a->data.generic.data, a->data.generic.size,
- b->data.generic.data, b->data.generic.size);
- }
-
-
-fail:
- avahi_log_error(__FILE__": Out of memory");
- return -1; /* or whatever ... */
-}
-
-int avahi_record_is_goodbye(AvahiRecord *r) {
- assert(r);
-
- return r->ttl == 0;
-}
-
-int avahi_key_is_valid(AvahiKey *k) {
- assert(k);
-
- if (!avahi_is_valid_domain_name(k->name))
- return 0;
-
- return 1;
-}
-
-int avahi_record_is_valid(AvahiRecord *r) {
- assert(r);
-
- if (!avahi_key_is_valid(r->key))
- return 0;
-
- switch (r->key->type) {
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- return avahi_is_valid_domain_name(r->data.ptr.name);
-
- case AVAHI_DNS_TYPE_SRV:
- return avahi_is_valid_domain_name(r->data.srv.name);
-
- case AVAHI_DNS_TYPE_HINFO:
- return
- strlen(r->data.hinfo.os) <= 255 &&
- strlen(r->data.hinfo.cpu) <= 255;
-
- case AVAHI_DNS_TYPE_TXT: {
-
- AvahiStringList *strlst;
-
- for (strlst = r->data.txt.string_list; strlst; strlst = strlst->next)
- if (strlst->size > 255 || strlst->size <= 0)
- return 0;
-
- return 1;
- }
- }
-
-
- return 1;
-}
diff --git a/release-0.6.9/avahi-core/rr.h b/release-0.6.9/avahi-core/rr.h
deleted file mode 100644
index 6bfe0ec..0000000
--- a/release-0.6.9/avahi-core/rr.h
+++ /dev/null
@@ -1,174 +0,0 @@
-#ifndef foorrhfoo
-#define foorrhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file rr.h Functions and definitions for manipulating DNS resource record (RR) data. */
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/address.h>
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** DNS record types, see RFC 1035, in addition to those defined in defs.h */
-enum {
- AVAHI_DNS_TYPE_ANY = 0xFF, /**< Special query type for requesting all records */
- AVAHI_DNS_TYPE_OPT = 41, /**< EDNS0 option */
- AVAHI_DNS_TYPE_TKEY = 249,
- AVAHI_DNS_TYPE_TSIG = 250,
- AVAHI_DNS_TYPE_IXFR = 251,
- AVAHI_DNS_TYPE_AXFR = 252
-};
-
-/** DNS record classes, see RFC 1035, in addition to those defined in defs.h */
-enum {
- AVAHI_DNS_CLASS_ANY = 0xFF, /**< Special query type for requesting all records */
- AVAHI_DNS_CACHE_FLUSH = 0x8000, /**< Not really a class but a bit which may be set in response packets, see mDNS spec for more information */
- AVAHI_DNS_UNICAST_RESPONSE = 0x8000 /**< Not really a class but a bit which may be set in query packets, see mDNS spec for more information */
-};
-
-/** Encapsulates a DNS query key consisting of class, type and
- name. Use avahi_key_ref()/avahi_key_unref() for manipulating the
- reference counter. The structure is intended to be treated as "immutable", no
- changes should be imposed after creation */
-typedef struct AvahiKey {
- int ref; /**< Reference counter */
- char *name; /**< Record name */
- uint16_t clazz; /**< Record class, one of the AVAHI_DNS_CLASS_xxx constants */
- uint16_t type; /**< Record type, one of the AVAHI_DNS_TYPE_xxx constants */
-} AvahiKey;
-
-/** Encapsulates a DNS resource record. The structure is intended to
- * be treated as "immutable", no changes should be imposed after
- * creation. */
-typedef struct AvahiRecord {
- int ref; /**< Reference counter */
- AvahiKey *key; /**< Reference to the query key of this record */
-
- uint32_t ttl; /**< DNS TTL of this record */
-
- union {
-
- struct {
- void* data;
- uint16_t size;
- } generic; /**< Generic record data for unknown types */
-
- struct {
- uint16_t priority;
- uint16_t weight;
- uint16_t port;
- char *name;
- } srv; /**< Data for SRV records */
-
- struct {
- char *name;
- } ptr, ns, cname; /**< Data for PTR, NS and CNAME records */
-
- struct {
- char *cpu;
- char *os;
- } hinfo; /**< Data for HINFO records */
-
- struct {
- AvahiStringList *string_list;
- } txt; /**< Data for TXT records */
-
- struct {
- AvahiIPv4Address address;
- } a; /**< Data for A records */
-
- struct {
- AvahiIPv6Address address;
- } aaaa; /**< Data for AAAA records */
-
- } data; /**< Record data */
-
-} AvahiRecord;
-
-/** Create a new AvahiKey object. The reference counter will be set to 1. */
-AvahiKey *avahi_key_new(const char *name, uint16_t clazz, uint16_t type);
-
-/** Increase the reference counter of an AvahiKey object by one */
-AvahiKey *avahi_key_ref(AvahiKey *k);
-
-/** Decrease the reference counter of an AvahiKey object by one */
-void avahi_key_unref(AvahiKey *k);
-
-/** Check whether two AvahiKey object contain the same
- * data. AVAHI_DNS_CLASS_ANY/AVAHI_DNS_TYPE_ANY are treated like any
- * other class/type. */
-int avahi_key_equal(const AvahiKey *a, const AvahiKey *b);
-
-/** Return a numeric hash value for a key for usage in hash tables. */
-unsigned avahi_key_hash(const AvahiKey *k);
-
-/** Create a new record object. Record data should be filled in right after creation. The reference counter is set to 1. */
-AvahiRecord *avahi_record_new(AvahiKey *k, uint32_t ttl);
-
-/** Create a new record object. Record data should be filled in right after creation. The reference counter is set to 1. */
-AvahiRecord *avahi_record_new_full(const char *name, uint16_t clazz, uint16_t type, uint32_t ttl);
-
-/** Increase the reference counter of an AvahiRecord by one. */
-AvahiRecord *avahi_record_ref(AvahiRecord *r);
-
-/** Decrease the reference counter of an AvahiRecord by one. */
-void avahi_record_unref(AvahiRecord *r);
-
-/** Return a textual representation of the specified DNS class. The
- * returned pointer points to a read only internal string. */
-const char *avahi_dns_class_to_string(uint16_t clazz);
-
-/** Return a textual representation of the specified DNS class. The
- * returned pointer points to a read only internal string. */
-const char *avahi_dns_type_to_string(uint16_t type);
-
-/** Create a textual representation of the specified key. avahi_free() the
- * result! */
-char *avahi_key_to_string(const AvahiKey *k);
-
-/** Create a textual representation of the specified record, similar
- * in style to BIND zone file data. avahi_free() the result! */
-char *avahi_record_to_string(const AvahiRecord *r);
-
-/** Check whether two records are equal (regardless of the TTL */
-int avahi_record_equal_no_ttl(const AvahiRecord *a, const AvahiRecord *b);
-
-/** Check whether the specified key is valid */
-int avahi_key_is_valid(AvahiKey *k);
-
-/** Check whether the specified record is valid */
-int avahi_record_is_valid(AvahiRecord *r);
-
-/** Parse a binary rdata object and fill it into *record. This function is actually implemented in dns.c */
-int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size);
-
-/** Serialize an AvahiRecord object into binary rdata. This function is actually implemented in dns.c */
-size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/rrlist.c b/release-0.6.9/avahi-core/rrlist.c
deleted file mode 100644
index 915ecbb..0000000
--- a/release-0.6.9/avahi-core/rrlist.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-
-#include "rrlist.h"
-#include "log.h"
-
-typedef struct AvahiRecordListItem AvahiRecordListItem;
-
-struct AvahiRecordListItem {
- int read;
- AvahiRecord *record;
- int unicast_response;
- int flush_cache;
- int auxiliary;
- AVAHI_LLIST_FIELDS(AvahiRecordListItem, items);
-};
-
-struct AvahiRecordList {
- AVAHI_LLIST_HEAD(AvahiRecordListItem, read);
- AVAHI_LLIST_HEAD(AvahiRecordListItem, unread);
-
- int all_flush_cache;
-};
-
-AvahiRecordList *avahi_record_list_new(void) {
- AvahiRecordList *l;
-
- if (!(l = avahi_new(AvahiRecordList, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->read);
- AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->unread);
-
- l->all_flush_cache = 1;
- return l;
-}
-
-void avahi_record_list_free(AvahiRecordList *l) {
- assert(l);
-
- avahi_record_list_flush(l);
- avahi_free(l);
-}
-
-static void item_free(AvahiRecordList *l, AvahiRecordListItem *i) {
- assert(l);
- assert(i);
-
- if (i->read)
- AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->read, i);
- else
- AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
-
- avahi_record_unref(i->record);
- avahi_free(i);
-}
-
-void avahi_record_list_flush(AvahiRecordList *l) {
- assert(l);
-
- while (l->read)
- item_free(l, l->read);
- while (l->unread)
- item_free(l, l->unread);
-
- l->all_flush_cache = 1;
-}
-
-AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, int *ret_unicast_response, int *ret_auxiliary) {
- AvahiRecord *r;
- AvahiRecordListItem *i;
-
- if (!(i = l->unread))
- return NULL;
-
- assert(!i->read);
-
- r = avahi_record_ref(i->record);
- if (ret_unicast_response)
- *ret_unicast_response = i->unicast_response;
- if (ret_flush_cache)
- *ret_flush_cache = i->flush_cache;
- if (ret_auxiliary)
- *ret_auxiliary = i->auxiliary;
-
- AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
- AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->read, i);
-
- i->read = 1;
-
- return r;
-}
-
-static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) {
- AvahiRecordListItem *i;
-
- assert(l);
- assert(r);
-
- for (i = l->read; i; i = i->items_next)
- if (avahi_record_equal_no_ttl(i->record, r))
- return i;
-
- for (i = l->unread; i; i = i->items_next)
- if (avahi_record_equal_no_ttl(i->record, r))
- return i;
-
- return NULL;
-}
-
-void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary) {
- AvahiRecordListItem *i;
-
- assert(l);
- assert(r);
-
- if (get(l, r))
- return;
-
- if (!(i = avahi_new(AvahiRecordListItem, 1))) {
- avahi_log_error("avahi_new() failed.");
- return;
- }
-
- i->unicast_response = unicast_response;
- i->flush_cache = flush_cache;
- i->auxiliary = auxiliary;
- i->record = avahi_record_ref(r);
- i->read = 0;
-
- l->all_flush_cache = l->all_flush_cache && flush_cache;
-
- AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->unread, i);
-}
-
-void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r) {
- AvahiRecordListItem *i;
-
- assert(l);
- assert(r);
-
- if (!(i = get(l, r)))
- return;
-
- item_free(l, i);
-}
-
-int avahi_record_list_is_empty(AvahiRecordList *l) {
- assert(l);
-
- return !l->unread && !l->read;
-}
-
-int avahi_record_list_all_flush_cache(AvahiRecordList *l) {
- assert(l);
-
- /* Return TRUE if all entries in this list have flush_cache set */
-
- return l->all_flush_cache;
-}
diff --git a/release-0.6.9/avahi-core/rrlist.h b/release-0.6.9/avahi-core/rrlist.h
deleted file mode 100644
index 9c07ecd..0000000
--- a/release-0.6.9/avahi-core/rrlist.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef foorrlisthfoo
-#define foorrlisthfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-#include "rr.h"
-
-typedef struct AvahiRecordList AvahiRecordList;
-
-AvahiRecordList *avahi_record_list_new(void);
-void avahi_record_list_free(AvahiRecordList *l);
-void avahi_record_list_flush(AvahiRecordList *l);
-
-AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, int *ret_unicast_response, int *ret_auxiliary);
-void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary);
-void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r);
-
-int avahi_record_list_all_flush_cache(AvahiRecordList *l);
-
-int avahi_record_list_is_empty(AvahiRecordList *l);
-
-#endif
diff --git a/release-0.6.9/avahi-core/server.c b/release-0.6.9/avahi-core/server.c
deleted file mode 100644
index 4aa48a8..0000000
--- a/release-0.6.9/avahi-core/server.c
+++ /dev/null
@@ -1,1702 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "internal.h"
-#include "iface.h"
-#include "socket.h"
-#include "browse.h"
-#include "log.h"
-#include "util.h"
-#include "dns-srv-rr.h"
-#include "addr-util.h"
-#include "domain-util.h"
-#include "rr-util.h"
-
-static void enum_aux_records(AvahiServer *s, AvahiInterface *i, const char *name, uint16_t type, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata) {
- assert(s);
- assert(i);
- assert(name);
- assert(callback);
-
- if (type == AVAHI_DNS_TYPE_ANY) {
- AvahiEntry *e;
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead &&
- avahi_entry_is_registered(s, e, i) &&
- e->record->key->clazz == AVAHI_DNS_CLASS_IN &&
- avahi_domain_equal(name, e->record->key->name))
- callback(s, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, userdata);
-
- } else {
- AvahiEntry *e;
- AvahiKey *k;
-
- if (!(k = avahi_key_new(name, AVAHI_DNS_CLASS_IN, type)))
- return; /** OOM */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, k); e; e = e->by_key_next)
- if (!e->dead && avahi_entry_is_registered(s, e, i))
- callback(s, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, userdata);
-
- avahi_key_unref(k);
- }
-}
-
-void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata) {
- assert(s);
- assert(i);
- assert(r);
- assert(callback);
-
- /* Call the specified callback far all records referenced by the one specified in *r */
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN) {
- if (r->key->type == AVAHI_DNS_TYPE_PTR) {
- enum_aux_records(s, i, r->data.ptr.name, AVAHI_DNS_TYPE_SRV, callback, userdata);
- enum_aux_records(s, i, r->data.ptr.name, AVAHI_DNS_TYPE_TXT, callback, userdata);
- } else if (r->key->type == AVAHI_DNS_TYPE_SRV) {
- enum_aux_records(s, i, r->data.srv.name, AVAHI_DNS_TYPE_A, callback, userdata);
- enum_aux_records(s, i, r->data.srv.name, AVAHI_DNS_TYPE_AAAA, callback, userdata);
- } else if (r->key->type == AVAHI_DNS_TYPE_CNAME)
- enum_aux_records(s, i, r->data.cname.name, AVAHI_DNS_TYPE_ANY, callback, userdata);
- }
-}
-
-void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, int unicast_response, int auxiliary) {
- assert(s);
- assert(i);
- assert(e);
-
- avahi_record_list_push(s->record_list, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, unicast_response, auxiliary);
-}
-
-void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response) {
- assert(s);
- assert(i);
- assert(k);
-
- /* Push all records that match the specified key to the record list */
-
- if (avahi_key_is_pattern(k)) {
- AvahiEntry *e;
-
- /* Handle ANY query */
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead && avahi_key_pattern_match(k, e->record->key) && avahi_entry_is_registered(s, e, i))
- avahi_server_prepare_response(s, i, e, unicast_response, 0);
-
- } else {
- AvahiEntry *e;
-
- /* Handle all other queries */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, k); e; e = e->by_key_next)
- if (!e->dead && avahi_entry_is_registered(s, e, i))
- avahi_server_prepare_response(s, i, e, unicast_response, 0);
- }
-
- /* Look for CNAME records */
-
- if ((k->clazz == AVAHI_DNS_CLASS_IN || k->clazz == AVAHI_DNS_CLASS_ANY)
- && k->type != AVAHI_DNS_TYPE_CNAME && k->type != AVAHI_DNS_TYPE_ANY) {
-
- AvahiKey *cname_key;
-
- if (!(cname_key = avahi_key_new(k->name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_CNAME)))
- return;
-
- avahi_server_prepare_matching_responses(s, i, cname_key, unicast_response);
- avahi_key_unref(cname_key);
- }
-}
-
-static void withdraw_entry(AvahiServer *s, AvahiEntry *e) {
- assert(s);
- assert(e);
-
- /* Withdraw the specified entry, and if is part of an entry group,
- * put that into COLLISION state */
-
- if (e->dead)
- return;
-
- if (e->group) {
- AvahiEntry *k;
-
- for (k = e->group->entries; k; k = k->by_group_next)
- if (!k->dead) {
- avahi_goodbye_entry(s, k, 0, 1);
- k->dead = 1;
- }
-
- e->group->n_probing = 0;
-
- avahi_s_entry_group_change_state(e->group, AVAHI_ENTRY_GROUP_COLLISION);
- } else {
- avahi_goodbye_entry(s, e, 0, 1);
- e->dead = 1;
- }
-
- s->need_entry_cleanup = 1;
-}
-
-static void withdraw_rrset(AvahiServer *s, AvahiKey *key) {
- AvahiEntry *e;
-
- assert(s);
- assert(key);
-
- /* Withdraw an entry RRSset */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, key); e; e = e->by_key_next)
- withdraw_entry(s, e);
-}
-
-static void incoming_probe(AvahiServer *s, AvahiRecord *record, AvahiInterface *i) {
- AvahiEntry *e, *n;
- int ours = 0, won = 0, lost = 0;
-
- assert(s);
- assert(record);
- assert(i);
-
- /* Handle incoming probes and check if they conflict our own probes */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, record->key); e; e = n) {
- int cmp;
- n = e->by_key_next;
-
- if (e->dead)
- continue;
-
- if ((cmp = avahi_record_lexicographical_compare(e->record, record)) == 0) {
- ours = 1;
- break;
- } else {
-
- if (avahi_entry_is_probing(s, e, i)) {
- if (cmp > 0)
- won = 1;
- else /* cmp < 0 */
- lost = 1;
- }
- }
- }
-
- if (!ours) {
- char *t = avahi_record_to_string(record);
-
- if (won)
- avahi_log_debug("Recieved conflicting probe [%s]. Local host won.", t);
- else if (lost) {
- avahi_log_debug("Recieved conflicting probe [%s]. Local host lost. Withdrawing.", t);
- withdraw_rrset(s, record->key);
- }
-
- avahi_free(t);
- }
-}
-
-static int handle_conflict(AvahiServer *s, AvahiInterface *i, AvahiRecord *record, int unique) {
- int valid = 1, ours = 0, conflict = 0, withdraw_immediately = 0;
- AvahiEntry *e, *n, *conflicting_entry = NULL;
-
- assert(s);
- assert(i);
- assert(record);
-
- /* Check whether an incoming record conflicts with one of our own */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, record->key); e; e = n) {
- n = e->by_key_next;
-
- if (e->dead)
- continue;
-
- /* Check if the incoming is a goodbye record */
- if (avahi_record_is_goodbye(record)) {
-
- if (avahi_record_equal_no_ttl(e->record, record)) {
- char *t;
-
- /* Refresh */
- t = avahi_record_to_string(record);
- avahi_log_debug("Recieved goodbye record for one of our records [%s]. Refreshing.", t);
- avahi_server_prepare_matching_responses(s, i, e->record->key, 0);
-
- valid = 0;
- avahi_free(t);
- break;
- }
-
- /* If the goodybe packet doesn't match one of our own RRs, we simply ignore it. */
- continue;
- }
-
- if (!(e->flags & AVAHI_PUBLISH_UNIQUE) && !unique)
- continue;
-
- /* Either our entry or the other is intended to be unique, so let's check */
-
- if (avahi_record_equal_no_ttl(e->record, record)) {
- ours = 1; /* We have an identical record, so this is no conflict */
-
- /* Check wheter there is a TTL conflict */
- if (record->ttl <= e->record->ttl/2 &&
- avahi_entry_is_registered(s, e, i)) {
- char *t;
- /* Refresh */
- t = avahi_record_to_string(record);
-
- avahi_log_debug("Recieved record with bad TTL [%s]. Refreshing.", t);
- avahi_server_prepare_matching_responses(s, i, e->record->key, 0);
- valid = 0;
-
- avahi_free(t);
- }
-
- /* There's no need to check the other entries of this RRset */
- break;
-
- } else {
-
- if (avahi_entry_is_registered(s, e, i)) {
-
- /* A conflict => we have to return to probe mode */
- conflict = 1;
- conflicting_entry = e;
-
- } else if (avahi_entry_is_probing(s, e, i)) {
-
- /* We are currently registering a matching record, but
- * someone else already claimed it, so let's
- * withdraw */
- conflict = 1;
- withdraw_immediately = 1;
- }
- }
- }
-
- if (!ours && conflict) {
- char *t;
-
- valid = 0;
-
- t = avahi_record_to_string(record);
-
- if (withdraw_immediately) {
- avahi_log_debug("Recieved conflicting record [%s] with local record to be. Withdrawing.", t);
- withdraw_rrset(s, record->key);
- } else {
- assert(conflicting_entry);
- avahi_log_debug("Recieved conflicting record [%s]. Resetting our record.", t);
- avahi_entry_return_to_initial_state(s, conflicting_entry, i);
-
- /* Local unique records are returned to probing
- * state. Local shared records are reannounced. */
- }
-
- avahi_free(t);
- }
-
- return valid;
-}
-
-static void append_aux_callback(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata) {
- int *unicast_response = userdata;
-
- assert(s);
- assert(r);
- assert(unicast_response);
-
- avahi_record_list_push(s->record_list, r, flush_cache, *unicast_response, 1);
-}
-
-static void append_aux_records_to_list(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, int unicast_response) {
- assert(s);
- assert(r);
-
- avahi_server_enumerate_aux_records(s, i, r, append_aux_callback, &unicast_response);
-}
-
-void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port, int legacy_unicast, int immediately) {
-
- assert(s);
- assert(i);
- assert(!legacy_unicast || (a && port > 0 && p));
-
- if (legacy_unicast) {
- AvahiDnsPacket *reply;
- AvahiRecord *r;
-
- if (!(reply = avahi_dns_packet_new_reply(p, 512 /* unicast DNS maximum packet size is 512 */ , 1, 1)))
- return; /* OOM */
-
- while ((r = avahi_record_list_next(s->record_list, NULL, NULL, NULL))) {
-
- append_aux_records_to_list(s, i, r, 0);
-
- if (avahi_dns_packet_append_record(reply, r, 0, 10))
- avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
- else {
- char *t = avahi_record_to_string(r);
- avahi_log_warn("Record [%s] not fitting in legacy unicast packet, dropping.", t);
- avahi_free(t);
- }
-
- avahi_record_unref(r);
- }
-
- if (avahi_dns_packet_get_field(reply, AVAHI_DNS_FIELD_ANCOUNT) != 0)
- avahi_interface_send_packet_unicast(i, reply, a, port);
-
- avahi_dns_packet_free(reply);
-
- } else {
- int unicast_response, flush_cache, auxiliary;
- AvahiDnsPacket *reply = NULL;
- AvahiRecord *r;
-
- /* In case the query packet was truncated never respond
- immediately, because known answer suppression records might be
- contained in later packets */
- int tc = p && !!(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_TC);
-
- while ((r = avahi_record_list_next(s->record_list, &flush_cache, &unicast_response, &auxiliary))) {
-
- int im = immediately;
-
- /* Only send the response immediately if it contains a
- * unique entry AND it is not in reply to a truncated
- * packet AND it is not an auxiliary record AND all other
- * responses for this record are unique too. */
-
- if (flush_cache && !tc && !auxiliary && avahi_record_list_all_flush_cache(s->record_list))
- im = 1;
-
- if (!avahi_interface_post_response(i, r, flush_cache, a, im) && unicast_response) {
-
- /* Due to some reasons the record has not been scheduled.
- * The client requested an unicast response in that
- * case. Therefore we prepare such a response */
-
- append_aux_records_to_list(s, i, r, unicast_response);
-
- for (;;) {
-
- if (!reply) {
- assert(p);
-
- if (!(reply = avahi_dns_packet_new_reply(p, i->hardware->mtu, 0, 0)))
- break; /* OOM */
- }
-
- if (avahi_dns_packet_append_record(reply, r, flush_cache, 0)) {
-
- /* Appending this record succeeded, so incremeant
- * the specific header field, and return to the caller */
-
- avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
-
- break;
- }
-
- if (avahi_dns_packet_get_field(reply, AVAHI_DNS_FIELD_ANCOUNT) == 0) {
- size_t size;
-
- /* The record is too large for one packet, so create a larger packet */
-
- avahi_dns_packet_free(reply);
- size = avahi_record_get_estimate_size(r) + AVAHI_DNS_PACKET_HEADER_SIZE;
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(reply = avahi_dns_packet_new_reply(p, size, 0, 1)))
- break; /* OOM */
-
- if (!avahi_dns_packet_append_record(reply, r, flush_cache, 0)) {
- char *t;
- avahi_dns_packet_free(reply);
- t = avahi_record_to_string(r);
- avahi_log_warn("Record [%s] too large, doesn't fit in any packet!", t);
- avahi_free(t);
- break;
- } else
- avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
- }
-
- /* Appending the record didn't succeeed, so let's send this packet, and create a new one */
- avahi_interface_send_packet_unicast(i, reply, a, port);
- avahi_dns_packet_free(reply);
- reply = NULL;
- }
- }
-
- avahi_record_unref(r);
- }
-
- if (reply) {
- if (avahi_dns_packet_get_field(reply, AVAHI_DNS_FIELD_ANCOUNT) != 0)
- avahi_interface_send_packet_unicast(i, reply, a, port);
- avahi_dns_packet_free(reply);
- }
- }
-
- avahi_record_list_flush(s->record_list);
-}
-
-static void reflect_response(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, int flush_cache) {
- AvahiInterface *j;
-
- assert(s);
- assert(i);
- assert(r);
-
- if (!s->config.enable_reflector)
- return;
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol))
- avahi_interface_post_response(j, r, flush_cache, NULL, 1);
-}
-
-static void* reflect_cache_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
- AvahiServer *s = userdata;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(s);
-
- avahi_record_list_push(s->record_list, e->record, e->cache_flush, 0, 0);
- return NULL;
-}
-
-static void reflect_query(AvahiServer *s, AvahiInterface *i, AvahiKey *k) {
- AvahiInterface *j;
-
- assert(s);
- assert(i);
- assert(k);
-
- if (!s->config.enable_reflector)
- return;
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol)) {
- /* Post the query to other networks */
- avahi_interface_post_query(j, k, 1, NULL);
-
- /* Reply from caches of other network. This is needed to
- * "work around" known answer suppression. */
-
- avahi_cache_walk(j->cache, k, reflect_cache_walk_callback, s);
- }
-}
-
-static void reflect_probe(AvahiServer *s, AvahiInterface *i, AvahiRecord *r) {
- AvahiInterface *j;
-
- assert(s);
- assert(i);
- assert(r);
-
- if (!s->config.enable_reflector)
- return;
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol))
- avahi_interface_post_probe(j, r, 1);
-}
-
-static void handle_query_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a, uint16_t port, int legacy_unicast, int from_local_iface) {
- size_t n;
- int is_probe;
-
- assert(s);
- assert(p);
- assert(i);
- assert(a);
-
- assert(avahi_record_list_is_empty(s->record_list));
-
- is_probe = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) > 0;
-
- /* Handle the questions */
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); n > 0; n --) {
- AvahiKey *key;
- int unicast_response = 0;
-
- if (!(key = avahi_dns_packet_consume_key(p, &unicast_response))) {
- avahi_log_warn("Packet too short (1)");
- goto fail;
- }
-
- if (!legacy_unicast && !from_local_iface) {
- reflect_query(s, i, key);
- avahi_cache_start_poof(i->cache, key, a);
- }
-
- if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 &&
- !(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_TC))
- /* Allow our own queries to be suppressed by incoming
- * queries only when they do not include known answers */
- avahi_query_scheduler_incoming(i->query_scheduler, key);
-
- avahi_server_prepare_matching_responses(s, i, key, unicast_response);
- avahi_key_unref(key);
- }
-
- if (!legacy_unicast) {
-
- /* Known Answer Suppression */
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT); n > 0; n --) {
- AvahiRecord *record;
- int unique = 0;
-
- if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
- avahi_log_warn("Packet too short (2)");
- goto fail;
- }
-
- if (handle_conflict(s, i, record, unique)) {
- avahi_response_scheduler_suppress(i->response_scheduler, record, a);
- avahi_record_list_drop(s->record_list, record);
- avahi_cache_stop_poof(i->cache, record, a);
- }
-
- avahi_record_unref(record);
- }
-
- /* Probe record */
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT); n > 0; n --) {
- AvahiRecord *record;
- int unique = 0;
-
- if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
- avahi_log_warn("Packet too short (3)");
- goto fail;
- }
-
- if (!avahi_key_is_pattern(record->key)) {
- if (!from_local_iface)
- reflect_probe(s, i, record);
- incoming_probe(s, record, i);
- }
-
- avahi_record_unref(record);
- }
- }
-
- if (!avahi_record_list_is_empty(s->record_list))
- avahi_server_generate_response(s, i, p, a, port, legacy_unicast, is_probe);
-
- return;
-
-fail:
- avahi_record_list_flush(s->record_list);
-}
-
-static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a, int from_local_iface) {
- unsigned n;
-
- assert(s);
- assert(p);
- assert(i);
- assert(a);
-
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) +
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT); n > 0; n--) {
- AvahiRecord *record;
- int cache_flush = 0;
-/* char *txt; */
-
- if (!(record = avahi_dns_packet_consume_record(p, &cache_flush))) {
- avahi_log_warn("Packet too short (4)");
- break;
- }
-
- if (!avahi_key_is_pattern(record->key)) {
-
- if (handle_conflict(s, i, record, cache_flush)) {
- if (!from_local_iface)
- reflect_response(s, i, record, cache_flush);
- avahi_cache_update(i->cache, record, cache_flush, a);
- avahi_response_scheduler_incoming(i->response_scheduler, record, cache_flush);
- }
- }
-
- avahi_record_unref(record);
- }
-
- /* If the incoming response contained a conflicting record, some
- records have been scheduling for sending. We need to flush them
- here. */
- if (!avahi_record_list_is_empty(s->record_list))
- avahi_server_generate_response(s, i, NULL, NULL, 0, 0, 1);
-}
-
-static AvahiLegacyUnicastReflectSlot* allocate_slot(AvahiServer *s) {
- unsigned n, idx = (unsigned) -1;
- AvahiLegacyUnicastReflectSlot *slot;
-
- assert(s);
-
- if (!s->legacy_unicast_reflect_slots)
- s->legacy_unicast_reflect_slots = avahi_new0(AvahiLegacyUnicastReflectSlot*, AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX);
-
- for (n = 0; n < AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX; n++, s->legacy_unicast_reflect_id++) {
- idx = s->legacy_unicast_reflect_id % AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX;
-
- if (!s->legacy_unicast_reflect_slots[idx])
- break;
- }
-
- if (idx == (unsigned) -1 || s->legacy_unicast_reflect_slots[idx])
- return NULL;
-
- if (!(slot = avahi_new(AvahiLegacyUnicastReflectSlot, 1)))
- return NULL; /* OOM */
-
- s->legacy_unicast_reflect_slots[idx] = slot;
- slot->id = s->legacy_unicast_reflect_id++;
- slot->server = s;
-
- return slot;
-}
-
-static void deallocate_slot(AvahiServer *s, AvahiLegacyUnicastReflectSlot *slot) {
- unsigned idx;
-
- assert(s);
- assert(slot);
-
- idx = slot->id % AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX;
-
- assert(s->legacy_unicast_reflect_slots[idx] == slot);
-
- avahi_time_event_free(slot->time_event);
-
- avahi_free(slot);
- s->legacy_unicast_reflect_slots[idx] = NULL;
-}
-
-static void free_slots(AvahiServer *s) {
- unsigned idx;
- assert(s);
-
- if (!s->legacy_unicast_reflect_slots)
- return;
-
- for (idx = 0; idx < AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX; idx ++)
- if (s->legacy_unicast_reflect_slots[idx])
- deallocate_slot(s, s->legacy_unicast_reflect_slots[idx]);
-
- avahi_free(s->legacy_unicast_reflect_slots);
- s->legacy_unicast_reflect_slots = NULL;
-}
-
-static AvahiLegacyUnicastReflectSlot* find_slot(AvahiServer *s, uint16_t id) {
- unsigned idx;
-
- assert(s);
-
- if (!s->legacy_unicast_reflect_slots)
- return NULL;
-
- idx = id % AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX;
-
- if (!s->legacy_unicast_reflect_slots[idx] || s->legacy_unicast_reflect_slots[idx]->id != id)
- return NULL;
-
- return s->legacy_unicast_reflect_slots[idx];
-}
-
-static void legacy_unicast_reflect_slot_timeout(AvahiTimeEvent *e, void *userdata) {
- AvahiLegacyUnicastReflectSlot *slot = userdata;
-
- assert(e);
- assert(slot);
- assert(slot->time_event == e);
-
- deallocate_slot(slot->server, slot);
-}
-
-static void reflect_legacy_unicast_query_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a, uint16_t port) {
- AvahiLegacyUnicastReflectSlot *slot;
- AvahiInterface *j;
-
- assert(s);
- assert(p);
- assert(i);
- assert(a);
- assert(port > 0);
- assert(i->protocol == a->proto);
-
- if (!s->config.enable_reflector)
- return;
-
- /* Reflecting legacy unicast queries is a little more complicated
- than reflecting normal queries, since we must route the
- responses back to the right client. Therefore we must store
- some information for finding the right client contact data for
- response packets. In contrast to normal queries legacy
- unicast query and response packets are reflected untouched and
- are not reassembled into larger packets */
-
- if (!(slot = allocate_slot(s))) {
- /* No slot available, we drop this legacy unicast query */
- avahi_log_warn("No slot available for legacy unicast reflection, dropping query packet.");
- return;
- }
-
- slot->original_id = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID);
- slot->address = *a;
- slot->port = port;
- slot->interface = i->hardware->index;
-
- avahi_elapse_time(&slot->elapse_time, 2000, 0);
- slot->time_event = avahi_time_event_new(s->time_event_queue, &slot->elapse_time, legacy_unicast_reflect_slot_timeout, slot);
-
- /* Patch the packet with our new locally generatet id */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->id);
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (avahi_interface_is_relevant(j) &&
- j != i &&
- (s->config.reflect_ipv || j->protocol == i->protocol)) {
-
- if (j->protocol == AVAHI_PROTO_INET && s->fd_legacy_unicast_ipv4 >= 0) {
- avahi_send_dns_packet_ipv4(s->fd_legacy_unicast_ipv4, j->hardware->index, p, NULL, NULL, 0);
- } else if (j->protocol == AVAHI_PROTO_INET6 && s->fd_legacy_unicast_ipv6 >= 0)
- avahi_send_dns_packet_ipv6(s->fd_legacy_unicast_ipv6, j->hardware->index, p, NULL, NULL, 0);
- }
-
- /* Reset the id */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->original_id);
-}
-
-static int originates_from_local_legacy_unicast_socket(AvahiServer *s, const AvahiAddress *address, uint16_t port) {
- assert(s);
- assert(address);
- assert(port > 0);
-
- if (!s->config.enable_reflector)
- return 0;
-
- if (!avahi_address_is_local(s->monitor, address))
- return 0;
-
- if (address->proto == AVAHI_PROTO_INET && s->fd_legacy_unicast_ipv4 >= 0) {
- struct sockaddr_in lsa;
- socklen_t l = sizeof(lsa);
-
- if (getsockname(s->fd_legacy_unicast_ipv4, (struct sockaddr*) &lsa, &l) != 0)
- avahi_log_warn("getsockname(): %s", strerror(errno));
- else
- return lsa.sin_port == port;
-
- }
-
- if (address->proto == AVAHI_PROTO_INET6 && s->fd_legacy_unicast_ipv6 >= 0) {
- struct sockaddr_in6 lsa;
- socklen_t l = sizeof(lsa);
-
- if (getsockname(s->fd_legacy_unicast_ipv6, (struct sockaddr*) &lsa, &l) != 0)
- avahi_log_warn("getsockname(): %s", strerror(errno));
- else
- return lsa.sin6_port == port;
- }
-
- return 0;
-}
-
-static int is_mdns_mcast_address(const AvahiAddress *a) {
- AvahiAddress b;
- assert(a);
-
- avahi_address_parse(a->proto == AVAHI_PROTO_INET ? AVAHI_IPV4_MCAST_GROUP : AVAHI_IPV6_MCAST_GROUP, a->proto, &b);
- return avahi_address_cmp(a, &b) == 0;
-}
-
-static int originates_from_local_iface(AvahiServer *s, AvahiIfIndex iface, const AvahiAddress *a, uint16_t port) {
- assert(s);
- assert(iface != AVAHI_IF_UNSPEC);
- assert(a);
-
- /* If it isn't the MDNS port it can't be generated by us */
- if (port != AVAHI_MDNS_PORT)
- return 0;
-
- return avahi_interface_has_address(s->monitor, iface, a);
-}
-
-static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddress *src_address, uint16_t port, const AvahiAddress *dst_address, AvahiIfIndex iface, int ttl) {
- AvahiInterface *i;
- int from_local_iface = 0;
-
- assert(s);
- assert(p);
- assert(src_address);
- assert(dst_address);
- assert(iface > 0);
- assert(src_address->proto == dst_address->proto);
-
- if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, src_address->proto)) ||
- !avahi_interface_is_relevant(i)) {
- avahi_log_warn("Recieved packet from invalid interface.");
- return;
- }
-
- if (avahi_address_is_ipv4_in_ipv6(src_address))
- /* This is an IPv4 address encapsulated in IPv6, so let's ignore it. */
- return;
-
- if (originates_from_local_legacy_unicast_socket(s, src_address, port))
- /* This originates from our local reflector, so let's ignore it */
- return;
-
- /* We don't want to reflect local traffic, so we check if this packet is generated locally. */
- if (s->config.enable_reflector)
- from_local_iface = originates_from_local_iface(s, iface, src_address, port);
-
- if (avahi_dns_packet_check_valid_multicast(p) < 0) {
- avahi_log_warn("Recieved invalid packet.");
- return;
- }
-
- if (avahi_dns_packet_is_query(p)) {
- int legacy_unicast = 0;
-
- if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT) != 0) {
- avahi_log_warn("Invalid query packet.");
- return;
- }
-
- if (port != AVAHI_MDNS_PORT) {
- /* Legacy Unicast */
-
- if ((avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) != 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0)) {
- avahi_log_warn("Invalid legacy unicast query packet.");
- return;
- }
-
- legacy_unicast = 1;
- }
-
- if (legacy_unicast)
- reflect_legacy_unicast_query_packet(s, p, i, src_address, port);
-
- handle_query_packet(s, p, i, src_address, port, legacy_unicast, from_local_iface);
-
- } else {
- if (port != AVAHI_MDNS_PORT) {
- avahi_log_warn("Recieved repsonse with invalid source port %u on interface '%s.%i'", port, i->hardware->name, i->protocol);
- return;
- }
-
- if (ttl != 255 && s->config.check_response_ttl) {
- avahi_log_warn("Recieved response with invalid TTL %u on interface '%s.%i'.", ttl, i->hardware->name, i->protocol);
- return;
- }
-
- if (!is_mdns_mcast_address(dst_address) &&
- !avahi_interface_address_on_link(i, src_address)) {
- avahi_log_warn("Received non-local response on interface '%s.%i'.", i->hardware->name, i->protocol);
- return;
- }
-
- if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT) != 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0) {
- avahi_log_warn("Invalid response packet.");
- return;
- }
-
- handle_response_packet(s, p, i, src_address, from_local_iface);
- }
-}
-
-static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p) {
- AvahiInterface *j;
- AvahiLegacyUnicastReflectSlot *slot;
-
- assert(s);
- assert(p);
-
- if (avahi_dns_packet_check_valid(p) < 0 || avahi_dns_packet_is_query(p)) {
- avahi_log_warn("Recieved invalid packet.");
- return;
- }
-
- if (!(slot = find_slot(s, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID)))) {
- avahi_log_warn("Recieved legacy unicast response with unknown id");
- return;
- }
-
- if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.proto)) ||
- !avahi_interface_is_relevant(j))
- return;
-
- /* Patch the original ID into this response */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->original_id);
-
- /* Forward the response to the correct client */
- avahi_interface_send_packet_unicast(j, p, &slot->address, slot->port);
-
- /* Undo changes to packet */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->id);
-}
-
-static void cleanup_dead(AvahiServer *s) {
- assert(s);
-
- avahi_cleanup_dead_entries(s);
- avahi_browser_cleanup(s);
-}
-
-static void mcast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *userdata) {
- AvahiServer *s = userdata;
- AvahiAddress dest, src;
- AvahiDnsPacket *p = NULL;
- AvahiIfIndex iface;
- uint16_t port;
- uint8_t ttl;
-
- assert(w);
- assert(fd >= 0);
- assert(events & AVAHI_WATCH_IN);
-
- if (fd == s->fd_ipv4) {
- dest.proto = src.proto = AVAHI_PROTO_INET;
- p = avahi_recv_dns_packet_ipv4(s->fd_ipv4, &src.data.ipv4, &port, &dest.data.ipv4, &iface, &ttl);
- } else {
- assert(fd == s->fd_ipv6);
- dest.proto = src.proto = AVAHI_PROTO_INET6;
- p = avahi_recv_dns_packet_ipv6(s->fd_ipv6, &src.data.ipv6, &port, &dest.data.ipv6, &iface, &ttl);
- }
-
- if (p) {
- if (iface == AVAHI_IF_UNSPEC)
- iface = avahi_find_interface_for_address(s->monitor, &dest);
-
- if (iface != AVAHI_IF_UNSPEC)
- dispatch_packet(s, p, &src, port, &dest, iface, ttl);
- else
- avahi_log_error("Incoming packet recieved on address that isn't local.");
-
- avahi_dns_packet_free(p);
-
- cleanup_dead(s);
- }
-}
-
-static void legacy_unicast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *userdata) {
- AvahiServer *s = userdata;
- AvahiDnsPacket *p = NULL;
-
- assert(w);
- assert(fd >= 0);
- assert(events & AVAHI_WATCH_IN);
-
- if (fd == s->fd_legacy_unicast_ipv4)
- p = avahi_recv_dns_packet_ipv4(s->fd_legacy_unicast_ipv4, NULL, NULL, NULL, NULL, NULL);
- else {
- assert(fd == s->fd_legacy_unicast_ipv6);
- p = avahi_recv_dns_packet_ipv6(s->fd_legacy_unicast_ipv6, NULL, NULL, NULL, NULL, NULL);
- }
-
- if (p) {
- dispatch_legacy_unicast_packet(s, p);
- avahi_dns_packet_free(p);
-
- cleanup_dead(s);
- }
-}
-
-static void server_set_state(AvahiServer *s, AvahiServerState state) {
- assert(s);
-
- if (s->state == state)
- return;
-
- s->state = state;
-
- avahi_interface_monitor_update_rrs(s->monitor, 0);
-
- if (s->callback)
- s->callback(s, state, s->userdata);
-}
-
-static void withdraw_host_rrs(AvahiServer *s) {
- assert(s);
-
- if (s->hinfo_entry_group)
- avahi_s_entry_group_reset(s->hinfo_entry_group);
-
- if (s->browse_domain_entry_group)
- avahi_s_entry_group_reset(s->browse_domain_entry_group);
-
- avahi_interface_monitor_update_rrs(s->monitor, 1);
- s->n_host_rr_pending = 0;
-}
-
-void avahi_server_decrease_host_rr_pending(AvahiServer *s) {
- assert(s);
-
- assert(s->n_host_rr_pending > 0);
-
- if (--s->n_host_rr_pending == 0)
- server_set_state(s, AVAHI_SERVER_RUNNING);
-}
-
-void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) {
- assert(s);
- assert(g);
-
- if (state == AVAHI_ENTRY_GROUP_REGISTERING &&
- s->state == AVAHI_SERVER_REGISTERING)
- s->n_host_rr_pending ++;
-
- else if (state == AVAHI_ENTRY_GROUP_COLLISION &&
- (s->state == AVAHI_SERVER_REGISTERING || s->state == AVAHI_SERVER_RUNNING)) {
- withdraw_host_rrs(s);
- server_set_state(s, AVAHI_SERVER_COLLISION);
-
- } else if (state == AVAHI_ENTRY_GROUP_ESTABLISHED &&
- s->state == AVAHI_SERVER_REGISTERING)
- avahi_server_decrease_host_rr_pending(s);
-}
-
-static void register_hinfo(AvahiServer *s) {
- struct utsname utsname;
- AvahiRecord *r;
-
- assert(s);
-
- if (!s->config.publish_hinfo)
- return;
-
- if (s->hinfo_entry_group)
- assert(avahi_s_entry_group_is_empty(s->hinfo_entry_group));
- else
- s->hinfo_entry_group = avahi_s_entry_group_new(s, avahi_host_rr_entry_group_callback, NULL);
-
- if (!s->hinfo_entry_group) {
- avahi_log_warn("Failed to create HINFO entry group: %s", avahi_strerror(s->error));
- return;
- }
-
- /* Fill in HINFO rr */
- if ((r = avahi_record_new_full(s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, AVAHI_DEFAULT_TTL_HOST_NAME))) {
-
- if (uname(&utsname) < 0)
- avahi_log_warn("uname() failed: %s\n", avahi_strerror(errno));
- else {
-
- r->data.hinfo.cpu = avahi_strdup(avahi_strup(utsname.machine));
- r->data.hinfo.os = avahi_strdup(avahi_strup(utsname.sysname));
-
- avahi_log_info("Registering HINFO record with values '%s'/'%s'.", r->data.hinfo.cpu, r->data.hinfo.os);
-
- if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UNIQUE, r) < 0) {
- avahi_log_warn("Failed to add HINFO RR: %s", avahi_strerror(s->error));
- return;
- }
- }
-
- avahi_record_unref(r);
- }
-
- if (avahi_s_entry_group_commit(s->hinfo_entry_group) < 0)
- avahi_log_warn("Failed to commit HINFO entry group: %s", avahi_strerror(s->error));
-
-}
-
-static void register_localhost(AvahiServer *s) {
- AvahiAddress a;
- assert(s);
-
- /* Add localhost entries */
- avahi_address_parse("127.0.0.1", AVAHI_PROTO_INET, &a);
- avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_NO_ANNOUNCE, "localhost", &a);
-
- avahi_address_parse("::1", AVAHI_PROTO_INET6, &a);
- avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_NO_ANNOUNCE, "ip6-localhost", &a);
-}
-
-static void register_browse_domain(AvahiServer *s) {
- assert(s);
-
- if (!s->config.publish_domain)
- return;
-
- if (avahi_domain_equal(s->domain_name, "local"))
- return;
-
- if (s->browse_domain_entry_group)
- assert(avahi_s_entry_group_is_empty(s->browse_domain_entry_group));
- else
- s->browse_domain_entry_group = avahi_s_entry_group_new(s, NULL, NULL);
-
- if (!s->browse_domain_entry_group) {
- avahi_log_warn("Failed to create browse domain entry group: %s", avahi_strerror(s->error));
- return;
- }
-
- if (avahi_server_add_ptr(s, s->browse_domain_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, AVAHI_DEFAULT_TTL, "b._dns-sd._udp.local", s->domain_name) < 0) {
- avahi_log_warn("Failed to add browse domain RR: %s", avahi_strerror(s->error));
- return;
- }
-
- if (avahi_s_entry_group_commit(s->browse_domain_entry_group) < 0)
- avahi_log_warn("Failed to commit browse domain entry group: %s", avahi_strerror(s->error));
-}
-
-static void register_stuff(AvahiServer *s) {
- assert(s);
-
- server_set_state(s, AVAHI_SERVER_REGISTERING);
- s->n_host_rr_pending ++; /** Make sure that the state isn't changed tp AVAHI_SERVER_RUNNING too early */
-
- register_hinfo(s);
- register_browse_domain(s);
- avahi_interface_monitor_update_rrs(s->monitor, 0);
-
- s->n_host_rr_pending --;
-
- if (s->n_host_rr_pending == 0)
- server_set_state(s, AVAHI_SERVER_RUNNING);
-}
-
-static void update_fqdn(AvahiServer *s) {
- char *n;
-
- assert(s);
- assert(s->host_name);
- assert(s->domain_name);
-
- if (!(n = avahi_strdup_printf("%s.%s", s->host_name, s->domain_name)))
- return; /* OOM */
-
- avahi_free(s->host_name_fqdn);
- s->host_name_fqdn = n;
-}
-
-int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
- assert(s);
- assert(host_name);
-
- if (host_name && !avahi_is_valid_host_name(host_name))
- return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
-
- withdraw_host_rrs(s);
-
- avahi_free(s->host_name);
- s->host_name = host_name ? avahi_normalize_name_strdup(host_name) : avahi_get_host_name_strdup();
- s->host_name[strcspn(s->host_name, ".")] = 0;
- update_fqdn(s);
-
- register_stuff(s);
- return AVAHI_OK;
-}
-
-int avahi_server_set_domain_name(AvahiServer *s, const char *domain_name) {
- assert(s);
- assert(domain_name);
-
- if (domain_name && !avahi_is_valid_domain_name(domain_name))
- return avahi_server_set_errno(s, AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- withdraw_host_rrs(s);
-
- avahi_free(s->domain_name);
- s->domain_name = domain_name ? avahi_normalize_name_strdup(domain_name) : avahi_strdup("local");
- update_fqdn(s);
-
- register_stuff(s);
- return AVAHI_OK;
-}
-
-static int valid_server_config(const AvahiServerConfig *sc) {
-
- if (sc->host_name && !avahi_is_valid_host_name(sc->host_name))
- return AVAHI_ERR_INVALID_HOST_NAME;
-
- if (sc->domain_name && !avahi_is_valid_domain_name(sc->domain_name))
- return AVAHI_ERR_INVALID_DOMAIN_NAME;
-
- return AVAHI_OK;
-}
-
-static int setup_sockets(AvahiServer *s) {
- assert(s);
-
- s->fd_ipv4 = s->config.use_ipv4 ? avahi_open_socket_ipv4(s->config.disallow_other_stacks) : -1;
- s->fd_ipv6 = s->config.use_ipv6 ? avahi_open_socket_ipv6(s->config.disallow_other_stacks) : -1;
-
- if (s->fd_ipv6 < 0 && s->fd_ipv4 < 0)
- return AVAHI_ERR_NO_NETWORK;
-
- if (s->fd_ipv4 < 0 && s->config.use_ipv4)
- avahi_log_notice("Failed to create IPv4 socket, proceeding in IPv6 only mode");
- else if (s->fd_ipv6 < 0 && s->config.use_ipv6)
- avahi_log_notice("Failed to create IPv6 socket, proceeding in IPv4 only mode");
-
- s->fd_legacy_unicast_ipv4 = s->fd_ipv4 >= 0 && s->config.enable_reflector ? avahi_open_unicast_socket_ipv4() : -1;
- s->fd_legacy_unicast_ipv6 = s->fd_ipv6 >= 0 && s->config.enable_reflector ? avahi_open_unicast_socket_ipv6() : -1;
-
- s->watch_ipv4 =
- s->watch_ipv6 =
- s->watch_legacy_unicast_ipv4 =
- s->watch_legacy_unicast_ipv6 = NULL;
-
- if (s->fd_ipv4 >= 0)
- s->watch_ipv4 = s->poll_api->watch_new(s->poll_api, s->fd_ipv4, AVAHI_WATCH_IN, mcast_socket_event, s);
- if (s->fd_ipv6 >= 0)
- s->watch_ipv6 = s->poll_api->watch_new(s->poll_api, s->fd_ipv6, AVAHI_WATCH_IN, mcast_socket_event, s);
-
- if (s->fd_legacy_unicast_ipv4 >= 0)
- s->watch_legacy_unicast_ipv4 = s->poll_api->watch_new(s->poll_api, s->fd_legacy_unicast_ipv4, AVAHI_WATCH_IN, legacy_unicast_socket_event, s);
- if (s->fd_legacy_unicast_ipv6 >= 0)
- s->watch_legacy_unicast_ipv6 = s->poll_api->watch_new(s->poll_api, s->fd_legacy_unicast_ipv6, AVAHI_WATCH_IN, legacy_unicast_socket_event, s);
-
- return 0;
-}
-
-AvahiServer *avahi_server_new(const AvahiPoll *poll_api, const AvahiServerConfig *sc, AvahiServerCallback callback, void* userdata, int *error) {
- AvahiServer *s;
- int e;
-
- if (sc && (e = valid_server_config(sc)) < 0) {
- if (error)
- *error = e;
- return NULL;
- }
-
- if (!(s = avahi_new(AvahiServer, 1))) {
- if (error)
- *error = AVAHI_ERR_NO_MEMORY;
-
- return NULL;
- }
-
- s->poll_api = poll_api;
-
- if (sc)
- avahi_server_config_copy(&s->config, sc);
- else
- avahi_server_config_init(&s->config);
-
- if ((e = setup_sockets(s)) < 0) {
- if (error)
- *error = e;
-
- avahi_server_config_free(&s->config);
- avahi_free(s);
-
- return NULL;
- }
-
- s->n_host_rr_pending = 0;
- s->need_entry_cleanup = 0;
- s->need_group_cleanup = 0;
- s->need_browser_cleanup = 0;
- s->hinfo_entry_group = NULL;
- s->browse_domain_entry_group = NULL;
- s->error = AVAHI_OK;
- s->state = AVAHI_SERVER_INVALID;
-
- s->callback = callback;
- s->userdata = userdata;
-
- s->time_event_queue = avahi_time_event_queue_new(poll_api);
-
- s->entries_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiEntry, s->entries);
- AVAHI_LLIST_HEAD_INIT(AvahiGroup, s->groups);
-
- s->record_browser_hashmap = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiSRecordBrowser, s->record_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSHostNameResolver, s->host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiSAddressResolver, s->address_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiSDomainBrowser, s->domain_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSServiceTypeBrowser, s->service_type_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSServiceBrowser, s->service_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSServiceResolver, s->service_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiSDNSServerBrowser, s->dns_server_browsers);
-
- s->legacy_unicast_reflect_slots = NULL;
- s->legacy_unicast_reflect_id = 0;
-
- s->record_list = avahi_record_list_new();
-
- /* Get host name */
- s->host_name = s->config.host_name ? avahi_normalize_name_strdup(s->config.host_name) : avahi_get_host_name_strdup();
- s->host_name[strcspn(s->host_name, ".")] = 0;
- s->domain_name = s->config.domain_name ? avahi_normalize_name_strdup(s->config.domain_name) : avahi_strdup("local");
- s->host_name_fqdn = NULL;
- update_fqdn(s);
-
- do {
- s->local_service_cookie = (uint32_t) rand() * (uint32_t) rand();
- } while (s->local_service_cookie == AVAHI_SERVICE_COOKIE_INVALID);
-
- if (s->config.enable_wide_area) {
- s->wide_area_lookup_engine = avahi_wide_area_engine_new(s);
- avahi_wide_area_set_servers(s->wide_area_lookup_engine, s->config.wide_area_servers, s->config.n_wide_area_servers);
- } else
- s->wide_area_lookup_engine = NULL;
-
- s->multicast_lookup_engine = avahi_multicast_lookup_engine_new(s);
-
- s->monitor = avahi_interface_monitor_new(s);
- avahi_interface_monitor_sync(s->monitor);
-
- register_localhost(s);
- register_stuff(s);
-
- return s;
-}
-
-void avahi_server_free(AvahiServer* s) {
- assert(s);
-
- /* Remove all browsers */
-
- while (s->dns_server_browsers)
- avahi_s_dns_server_browser_free(s->dns_server_browsers);
- while (s->host_name_resolvers)
- avahi_s_host_name_resolver_free(s->host_name_resolvers);
- while (s->address_resolvers)
- avahi_s_address_resolver_free(s->address_resolvers);
- while (s->domain_browsers)
- avahi_s_domain_browser_free(s->domain_browsers);
- while (s->service_type_browsers)
- avahi_s_service_type_browser_free(s->service_type_browsers);
- while (s->service_browsers)
- avahi_s_service_browser_free(s->service_browsers);
- while (s->service_resolvers)
- avahi_s_service_resolver_free(s->service_resolvers);
- while (s->record_browsers)
- avahi_s_record_browser_destroy(s->record_browsers);
-
- /* Remove all locally rgeistered stuff */
-
- while(s->entries)
- avahi_entry_free(s, s->entries);
-
- avahi_interface_monitor_free(s->monitor);
-
- while (s->groups)
- avahi_entry_group_free(s, s->groups);
-
- free_slots(s);
-
- avahi_hashmap_free(s->entries_by_key);
- avahi_record_list_free(s->record_list);
- avahi_hashmap_free(s->record_browser_hashmap);
-
- if (s->wide_area_lookup_engine)
- avahi_wide_area_engine_free(s->wide_area_lookup_engine);
- avahi_multicast_lookup_engine_free(s->multicast_lookup_engine);
-
- avahi_time_event_queue_free(s->time_event_queue);
-
- /* Free watches */
-
- if (s->watch_ipv4)
- s->poll_api->watch_free(s->watch_ipv4);
- if (s->watch_ipv6)
- s->poll_api->watch_free(s->watch_ipv6);
-
- if (s->watch_legacy_unicast_ipv4)
- s->poll_api->watch_free(s->watch_legacy_unicast_ipv4);
- if (s->watch_legacy_unicast_ipv6)
- s->poll_api->watch_free(s->watch_legacy_unicast_ipv6);
-
- /* Free sockets */
-
- if (s->fd_ipv4 >= 0)
- close(s->fd_ipv4);
- if (s->fd_ipv6 >= 0)
- close(s->fd_ipv6);
-
- if (s->fd_legacy_unicast_ipv4 >= 0)
- close(s->fd_legacy_unicast_ipv4);
- if (s->fd_legacy_unicast_ipv6 >= 0)
- close(s->fd_legacy_unicast_ipv6);
-
- /* Free other stuff */
-
- avahi_free(s->host_name);
- avahi_free(s->domain_name);
- avahi_free(s->host_name_fqdn);
-
- avahi_server_config_free(&s->config);
-
- avahi_free(s);
-}
-
-const char* avahi_server_get_domain_name(AvahiServer *s) {
- assert(s);
-
- return s->domain_name;
-}
-
-const char* avahi_server_get_host_name(AvahiServer *s) {
- assert(s);
-
- return s->host_name;
-}
-
-const char* avahi_server_get_host_name_fqdn(AvahiServer *s) {
- assert(s);
-
- return s->host_name_fqdn;
-}
-
-void* avahi_server_get_data(AvahiServer *s) {
- assert(s);
-
- return s->userdata;
-}
-
-void avahi_server_set_data(AvahiServer *s, void* userdata) {
- assert(s);
-
- s->userdata = userdata;
-}
-
-AvahiServerState avahi_server_get_state(AvahiServer *s) {
- assert(s);
-
- return s->state;
-}
-
-AvahiServerConfig* avahi_server_config_init(AvahiServerConfig *c) {
- assert(c);
-
- memset(c, 0, sizeof(AvahiServerConfig));
- c->use_ipv6 = 1;
- c->use_ipv4 = 1;
- c->host_name = NULL;
- c->domain_name = NULL;
- c->check_response_ttl = 0;
- c->publish_hinfo = 1;
- c->publish_addresses = 1;
- c->publish_workstation = 1;
- c->publish_domain = 1;
- c->use_iff_running = 0;
- c->enable_reflector = 0;
- c->reflect_ipv = 0;
- c->add_service_cookie = 1;
- c->enable_wide_area = 0;
- c->n_wide_area_servers = 0;
- c->disallow_other_stacks = 0;
- c->browse_domains = NULL;
- c->disable_publishing = 0;
- c->allow_point_to_point = 0;
-
- return c;
-}
-
-void avahi_server_config_free(AvahiServerConfig *c) {
- assert(c);
-
- avahi_free(c->host_name);
- avahi_free(c->domain_name);
- avahi_string_list_free(c->browse_domains);
-}
-
-AvahiServerConfig* avahi_server_config_copy(AvahiServerConfig *ret, const AvahiServerConfig *c) {
- char *d = NULL, *h = NULL;
- AvahiStringList *l = NULL;
- assert(ret);
- assert(c);
-
- if (c->host_name)
- if (!(h = avahi_strdup(c->host_name)))
- return NULL;
-
- if (c->domain_name)
- if (!(d = avahi_strdup(c->domain_name))) {
- avahi_free(h);
- return NULL;
- }
-
- if (!(l = avahi_string_list_copy(c->browse_domains)) && c->browse_domains) {
- avahi_free(h);
- avahi_free(d);
- return NULL;
- }
-
- *ret = *c;
- ret->host_name = h;
- ret->domain_name = d;
- ret->browse_domains = l;
-
- return ret;
-}
-
-int avahi_server_errno(AvahiServer *s) {
- assert(s);
-
- return s->error;
-}
-
-/* Just for internal use */
-int avahi_server_set_errno(AvahiServer *s, int error) {
- assert(s);
-
- return s->error = error;
-}
-
-uint32_t avahi_server_get_local_service_cookie(AvahiServer *s) {
- assert(s);
-
- return s->local_service_cookie;
-}
-
-static AvahiEntry *find_entry(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key) {
- AvahiEntry *e;
-
- assert(s);
- assert(key);
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, key); e; e = e->by_key_next)
-
- if ((e->interface == interface || e->interface <= 0 || interface <= 0) &&
- (e->protocol == protocol || e->protocol == AVAHI_PROTO_UNSPEC || protocol == AVAHI_PROTO_UNSPEC) &&
- (!e->group || e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED || e->group->state == AVAHI_ENTRY_GROUP_REGISTERING))
-
- return e;
-
- return NULL;
-}
-
-int avahi_server_get_group_of_service(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiSEntryGroup** ret_group) {
- AvahiKey *key = NULL;
- AvahiEntry *e;
- int ret;
- char n[AVAHI_DOMAIN_NAME_MAX];
-
- assert(s);
- assert(name);
- assert(type);
- assert(ret_group);
-
- AVAHI_CHECK_VALIDITY(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if ((ret = avahi_service_name_join(n, sizeof(n), name, type, domain) < 0))
- return avahi_server_set_errno(s, ret);
-
- if (!(key = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV)))
- return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
- e = find_entry(s, interface, protocol, key);
- avahi_key_unref(key);
-
- if (e) {
- *ret_group = e->group;
- return AVAHI_OK;
- }
-
- return avahi_server_set_errno(s, AVAHI_ERR_NOT_FOUND);
-}
-
-int avahi_server_is_service_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name) {
- AvahiKey *key = NULL;
- AvahiEntry *e;
-
- assert(s);
- assert(name);
-
- if (!s->host_name_fqdn)
- return 0;
-
- if (!(key = avahi_key_new(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV)))
- return 0;
-
- e = find_entry(s, interface, protocol, key);
- avahi_key_unref(key);
-
- if (!e)
- return 0;
-
- return avahi_domain_equal(s->host_name_fqdn, e->record->data.srv.name);
-}
-
-int avahi_server_is_record_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *record) {
- AvahiEntry *e;
-
- assert(s);
- assert(record);
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, record->key); e; e = e->by_key_next)
-
- if ((e->interface == interface || e->interface <= 0 || interface <= 0) &&
- (e->protocol == protocol || e->protocol == AVAHI_PROTO_UNSPEC || protocol == AVAHI_PROTO_UNSPEC) &&
- (!e->group || e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED || e->group->state == AVAHI_ENTRY_GROUP_REGISTERING) &&
- avahi_record_equal_no_ttl(record, e->record))
- return 1;
-
- return 0;
-}
-
-/** Set the wide area DNS servers */
-int avahi_server_set_wide_area_servers(AvahiServer *s, const AvahiAddress *a, unsigned n) {
- assert(s);
-
- if (!s->wide_area_lookup_engine)
- return avahi_server_set_errno(s, AVAHI_ERR_INVALID_CONFIG);
-
- avahi_wide_area_set_servers(s->wide_area_lookup_engine, a, n);
- return AVAHI_OK;
-}
diff --git a/release-0.6.9/avahi-core/socket.c b/release-0.6.9/avahi-core/socket.c
deleted file mode 100644
index 82622d3..0000000
--- a/release-0.6.9/avahi-core/socket.c
+++ /dev/null
@@ -1,910 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <inttypes.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <sys/uio.h>
-
-#ifdef IP_RECVIF
-#include <net/if_dl.h>
-#endif
-
-#include "dns.h"
-#include "fdutil.h"
-#include "socket.h"
-#include "log.h"
-#include "addr-util.h"
-
-/* this is a portability hack */
-#ifndef IPV6_ADD_MEMBERSHIP
-#ifdef IPV6_JOIN_GROUP
-#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
-#endif
-#endif
-
-#ifndef IPV6_DROP_MEMBERSHIP
-#ifdef IPV6_LEAVE_GROUP
-#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
-#endif
-#endif
-
-static void mdns_mcast_group_ipv4(struct sockaddr_in *ret_sa) {
- assert(ret_sa);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in));
- ret_sa->sin_family = AF_INET;
- ret_sa->sin_port = htons(AVAHI_MDNS_PORT);
- inet_pton(AF_INET, AVAHI_IPV4_MCAST_GROUP, &ret_sa->sin_addr);
-}
-
-static void mdns_mcast_group_ipv6(struct sockaddr_in6 *ret_sa) {
- assert(ret_sa);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in6));
- ret_sa->sin6_family = AF_INET6;
- ret_sa->sin6_port = htons(AVAHI_MDNS_PORT);
- inet_pton(AF_INET6, AVAHI_IPV6_MCAST_GROUP, &ret_sa->sin6_addr);
-}
-
-static void ipv4_address_to_sockaddr(struct sockaddr_in *ret_sa, const AvahiIPv4Address *a, uint16_t port) {
- assert(ret_sa);
- assert(a);
- assert(port > 0);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in));
- ret_sa->sin_family = AF_INET;
- ret_sa->sin_port = htons(port);
- memcpy(&ret_sa->sin_addr, a, sizeof(AvahiIPv4Address));
-}
-
-static void ipv6_address_to_sockaddr(struct sockaddr_in6 *ret_sa, const AvahiIPv6Address *a, uint16_t port) {
- assert(ret_sa);
- assert(a);
- assert(port > 0);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in6));
- ret_sa->sin6_family = AF_INET6;
- ret_sa->sin6_port = htons(port);
- memcpy(&ret_sa->sin6_addr, a, sizeof(AvahiIPv6Address));
-}
-
-int avahi_mdns_mcast_join_ipv4(int fd, const AvahiIPv4Address *a, int idx, int join) {
-#ifdef HAVE_STRUCT_IP_MREQN
- struct ip_mreqn mreq;
-#else
- struct ip_mreq mreq;
-#endif
- struct sockaddr_in sa;
-
- assert(fd >= 0);
- assert(idx >= 0);
- assert(a);
-
- memset(&mreq, 0, sizeof(mreq));
-#ifdef HAVE_STRUCT_IP_MREQN
- mreq.imr_ifindex = idx;
- mreq.imr_address.s_addr = a->address;
-#else
- mreq.imr_interface.s_addr = a->address;
-#endif
- mdns_mcast_group_ipv4(&sa);
- mreq.imr_multiaddr = sa.sin_addr;
-
- /* Some network drivers have issues with dropping membership of
- * mcast groups when the iface is down, but don't allow rejoining
- * when it comes back up. This is an ugly workaround */
- if (join)
- setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
-
- if (setsockopt(fd, IPPROTO_IP, join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
- avahi_log_warn("%s failed: %s", join ? "IP_ADD_MEMBERSHIP" : "IP_DROP_MEMBERSHIP", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-int avahi_mdns_mcast_join_ipv6(int fd, const AvahiIPv6Address *a, int idx, int join) {
- struct ipv6_mreq mreq6;
- struct sockaddr_in6 sa6;
-
- assert(fd >= 0);
- assert(idx >= 0);
- assert(a);
-
- memset(&mreq6, 0, sizeof(mreq6));
- mdns_mcast_group_ipv6 (&sa6);
- mreq6.ipv6mr_multiaddr = sa6.sin6_addr;
- mreq6.ipv6mr_interface = idx;
-
- if (join)
- setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6));
-
- if (setsockopt(fd, IPPROTO_IPV6, join ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
- avahi_log_warn("%s failed: %s", join ? "IPV6_ADD_MEMBERSHIP" : "IPV6_DROP_MEMBERSHIP", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int reuseaddr(int fd) {
- int yes;
-
- yes = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("SO_REUSEADDR failed: %s", strerror(errno));
- return -1;
- }
-
-#ifdef SO_REUSEPORT
- yes = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("SO_REUSEPORT failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
- return 0;
-}
-
-static int bind_with_warn(int fd, const struct sockaddr *sa, socklen_t l) {
-
- assert(fd >= 0);
- assert(sa);
- assert(l > 0);
-
- if (bind(fd, sa, l) < 0) {
-
- if (errno != EADDRINUSE) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- return -1;
- }
-
- avahi_log_warn("*** WARNING: Detected another %s mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***",
- sa->sa_family == AF_INET ? "IPv4" : "IPv6");
-
- /* Try again, this time with SO_REUSEADDR set */
- if (reuseaddr(fd) < 0)
- return -1;
-
- if (bind(fd, sa, l) < 0) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- return -1;
- }
- } else {
-
- /* We enable SO_REUSEADDR afterwards, to make sure that the
- * user may run other mDNS implementations if he really
- * wants. */
-
- if (reuseaddr(fd) < 0)
- return -1;
- }
-
- return 0;
-}
-
-static int ipv4_pktinfo(int fd) {
- int yes;
-
-#ifdef IP_PKTINFO
- yes = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_PKTINFO failed: %s", strerror(errno));
- return -1;
- }
-#else
-
-#ifdef IP_RECVINTERFACE
- yes = 1;
- if (setsockopt (fd, IPPROTO_IP, IP_RECVINTERFACE, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVINTERFACE failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IP_RECVIF)
- yes = 1;
- if (setsockopt (fd, IPPROTO_IP, IP_RECVIF, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVIF failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
-#ifdef IP_RECVDSTADDR
- yes = 1;
- if (setsockopt (fd, IPPROTO_IP, IP_RECVDSTADDR, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVDSTADDR failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
-#endif /* IP_PKTINFO */
-
-#ifdef IP_RECVTTL
- yes = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_RECVTTL, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVTTL failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
- return 0;
-}
-
-static int ipv6_pktinfo(int fd) {
- int yes;
-
-#ifdef IPV6_RECVPKTINFO
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_RECVPKTINFO failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IPV6_PKTINFO)
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_PKTINFO, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_PKTINFO failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
-#ifdef IPV6_RECVHOPS
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPS, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_RECVHOPS failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IPV6_RECVHOPLIMIT)
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_RECVHOPLIMIT failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IPV6_HOPLIMIT)
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_HOPLIMIT, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_HOPLIMIT failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
- return 0;
-}
-
-int avahi_open_socket_ipv4(int no_reuse) {
- struct sockaddr_in local;
- int fd = -1, r, ittl;
- uint8_t ttl, cyes;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- ttl = 255;
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0) {
- avahi_log_warn("IP_MULTICAST_TTL failed: %s", strerror(errno));
- goto fail;
- }
-
- ittl = 255;
- if (setsockopt(fd, IPPROTO_IP, IP_TTL, &ittl, sizeof(ittl)) < 0) {
- avahi_log_warn("IP_TTL failed: %s", strerror(errno));
- goto fail;
- }
-
- cyes = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &cyes, sizeof(cyes)) < 0) {
- avahi_log_warn("IP_MULTICAST_LOOP failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin_family = AF_INET;
- local.sin_port = htons(AVAHI_MDNS_PORT);
-
- if (no_reuse)
- r = bind(fd, (struct sockaddr*) &local, sizeof(local));
- else
- r = bind_with_warn(fd, (struct sockaddr*) &local, sizeof(local));
-
- if (r < 0)
- goto fail;
-
- if (ipv4_pktinfo (fd) < 0)
- goto fail;
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-int avahi_open_socket_ipv6(int no_reuse) {
- struct sockaddr_in6 sa, local;
- int fd = -1, yes, r;
- int ttl;
-
- mdns_mcast_group_ipv6(&sa);
-
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- ttl = 255;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl)) < 0) {
- avahi_log_warn("IPV6_MULTICAST_HOPS failed: %s", strerror(errno));
- goto fail;
- }
-
- ttl = 255;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)) < 0) {
- avahi_log_warn("IPV6_UNICAST_HOPS failed: %s", strerror(errno));
- goto fail;
- }
-
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_V6ONLY failed: %s", strerror(errno));
- goto fail;
- }
-
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_MULTICAST_LOOP failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin6_family = AF_INET6;
- local.sin6_port = htons(AVAHI_MDNS_PORT);
-
- if (no_reuse)
- r = bind(fd, (struct sockaddr*) &local, sizeof(local));
- else
- r = bind_with_warn(fd, (struct sockaddr*) &local, sizeof(local));
-
- if (r < 0)
- goto fail;
-
- if (ipv6_pktinfo(fd) < 0)
- goto fail;
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-static int sendmsg_loop(int fd, struct msghdr *msg, int flags) {
- assert(fd >= 0);
- assert(msg);
-
- for (;;) {
-
- if (sendmsg(fd, msg, flags) >= 0)
- break;
-
- if (errno != EAGAIN) {
- avahi_log_debug("sendmsg() failed: %s", strerror(errno));
- return -1;
- }
-
- if (avahi_wait_for_write(fd) < 0)
- return -1;
- }
-
- return 0;
-}
-
-int avahi_send_dns_packet_ipv4(int fd, AvahiIfIndex interface, AvahiDnsPacket *p, const AvahiIPv4Address *src_address, const AvahiIPv4Address *dst_address, uint16_t dst_port) {
- struct sockaddr_in sa;
- struct msghdr msg;
- struct iovec io;
-#ifdef IP_PKTINFO
- struct cmsghdr *cmsg;
- size_t cmsg_data[( CMSG_SPACE(sizeof(struct in_pktinfo)) / sizeof(size_t)) + 1];
-#elif defined(IP_SENDSRCADDR)
- struct cmsghdr *cmsg;
- size_t cmsg_data[( CMSG_SPACE(sizeof(struct in_addr)) / sizeof(size_t)) + 1];
-#endif
-
- assert(fd >= 0);
- assert(p);
- assert(avahi_dns_packet_check_valid(p) >= 0);
- assert(!dst_address || dst_port > 0);
-
- if (!dst_address)
- mdns_mcast_group_ipv4(&sa);
- else
- ipv4_address_to_sockaddr(&sa, dst_address, dst_port);
-
- memset(&io, 0, sizeof(io));
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &sa;
- msg.msg_namelen = sizeof(sa);
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_flags = 0;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
-
-#ifdef IP_PKTINFO
- if (interface > 0 || src_address) {
- struct in_pktinfo *pkti;
-
- memset(cmsg_data, 0, sizeof(cmsg_data));
- cmsg = (struct cmsghdr*) cmsg_data;
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
- cmsg->cmsg_level = IPPROTO_IP;
- cmsg->cmsg_type = IP_PKTINFO;
-
- pkti = (struct in_pktinfo*) CMSG_DATA(cmsg);
-
- if (interface > 0)
- pkti->ipi_ifindex = interface;
-
- if (src_address)
- pkti->ipi_spec_dst.s_addr = src_address->address;
-
- msg.msg_control = cmsg_data;
- msg.msg_controllen = sizeof(cmsg_data);
- }
-#elif defined(IP_SENDSRCADDR)
- if (src_address) {
- struct in_addr *addr;
-
- memset(cmsg_data, 0, sizeof(cmsg_data));
- cmsg = (struct cmsghdr*) cmsg_data;
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
- cmsg->cmsg_level = IPPROTO_IP;
- cmsg->cmsg_type = IP_SENDSRCADDR;
-
- addr = (struct in_addr *)CMSG_DATA(cmsg);
- addr->s_addr = src_address->address;
-
- msg.msg_control = cmsg_data;
- msg.msg_controllen = sizeof(cmsg_data);
- }
-#elif defined(IP_MULTICAST_IF)
- {
- struct in_addr any = { INADDR_ANY };
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, src_address ? (const void*) &src_address->address : (const void*) &any, sizeof(struct in_addr)) < 0) {
- avahi_log_warn("IP_MULTICAST_IF failed: %s", strerror(errno));
- return -1;
- }
- }
-#elif defined(__GNUC__)
-#warning "FIXME: We need some code to set the outgoing interface/local address here if IP_PKTINFO/IP_MULTICAST_IF is not available"
-#endif
-
- return sendmsg_loop(fd, &msg, 0);
-}
-
-int avahi_send_dns_packet_ipv6(int fd, AvahiIfIndex interface, AvahiDnsPacket *p, const AvahiIPv6Address *src_address, const AvahiIPv6Address *dst_address, uint16_t dst_port) {
- struct sockaddr_in6 sa;
- struct msghdr msg;
- struct iovec io;
- struct cmsghdr *cmsg;
- size_t cmsg_data[(CMSG_SPACE(sizeof(struct in6_pktinfo))/sizeof(size_t)) + 1];
-
- assert(fd >= 0);
- assert(p);
- assert(avahi_dns_packet_check_valid(p) >= 0);
- assert(!dst_address || dst_port > 0);
-
- if (!dst_address)
- mdns_mcast_group_ipv6(&sa);
- else
- ipv6_address_to_sockaddr(&sa, dst_address, dst_port);
-
- memset(&io, 0, sizeof(io));
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &sa;
- msg.msg_namelen = sizeof(sa);
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_flags = 0;
-
- if (interface > 0 || src_address) {
- struct in6_pktinfo *pkti;
-
- memset(cmsg_data, 0, sizeof(cmsg_data));
- cmsg = (struct cmsghdr*) cmsg_data;
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
- cmsg->cmsg_level = IPPROTO_IPV6;
- cmsg->cmsg_type = IPV6_PKTINFO;
-
- pkti = (struct in6_pktinfo*) CMSG_DATA(cmsg);
-
- if (interface > 0)
- pkti->ipi6_ifindex = interface;
-
- if (src_address)
- memcpy(&pkti->ipi6_addr, src_address->address, sizeof(src_address->address));
-
- msg.msg_control = cmsg_data;
- msg.msg_controllen = sizeof(cmsg_data);
- } else {
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- }
-
- return sendmsg_loop(fd, &msg, 0);
-}
-
-AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv4Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl) {
- AvahiDnsPacket *p= NULL;
- struct msghdr msg;
- struct iovec io;
- size_t aux[1024 / sizeof(size_t)]; /* for alignment on ia64 ! */
- ssize_t l;
- struct cmsghdr *cmsg;
- int found_addr = 0;
- int ms;
- struct sockaddr_in sa;
-
- assert(fd >= 0);
-
- if (ioctl(fd, FIONREAD, &ms) < 0) {
- avahi_log_warn("ioctl(): %s", strerror(errno));
- goto fail;
- }
-
- p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
-
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->max_size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &sa;
- msg.msg_namelen = sizeof(sa);
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_control = aux;
- msg.msg_controllen = sizeof(aux);
- msg.msg_flags = 0;
-
- if ((l = recvmsg(fd, &msg, 0)) < 0) {
- avahi_log_warn("recvmsg(): %s", strerror(errno));
- goto fail;
- }
-
- if (sa.sin_addr.s_addr == INADDR_ANY) {
- /* Linux 2.4 behaves very strangely sometimes! */
- goto fail;
- }
-
- assert(!(msg.msg_flags & MSG_CTRUNC));
- assert(!(msg.msg_flags & MSG_TRUNC));
-
- p->size = (size_t) l;
-
- if (ret_src_port)
- *ret_src_port = avahi_port_from_sockaddr((struct sockaddr*) &sa);
-
- if (ret_src_address) {
- AvahiAddress a;
- avahi_address_from_sockaddr((struct sockaddr*) &sa, &a);
- *ret_src_address = a.data.ipv4;
- }
-
- if (ret_ttl)
- *ret_ttl = 255;
-
- if (ret_iface)
- *ret_iface = AVAHI_IF_UNSPEC;
-
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-
- if (cmsg->cmsg_level == IPPROTO_IP) {
-
- switch (cmsg->cmsg_type) {
-#ifdef IP_RECVTTL
- case IP_RECVTTL:
-#endif
- case IP_TTL:
- if (ret_ttl)
- *ret_ttl = (uint8_t) (*(int *) CMSG_DATA(cmsg));
-
- break;
-
-#ifdef IP_PKTINFO
- case IP_PKTINFO: {
- struct in_pktinfo *i = (struct in_pktinfo*) CMSG_DATA(cmsg);
-
- if (ret_iface)
- *ret_iface = (int) i->ipi_ifindex;
-
- if (ret_dst_address)
- ret_dst_address->address = i->ipi_addr.s_addr;
-
- found_addr = 1;
-
- break;
- }
-#endif
-
-#ifdef IP_RECVIF
- case IP_RECVIF: {
- struct sockaddr_dl *sdl = (struct sockaddr_dl *) CMSG_DATA (cmsg);
-
- if (ret_iface)
- *ret_iface = (int) sdl->sdl_index;
-
- break;
- }
-#endif
-
-#ifdef IP_RECVDSTADDR
- case IP_RECVDSTADDR:
- if (ret_dst_address)
- memcpy(&ret_dst_address->address, CMSG_DATA (cmsg), 4);
-
- found_addr = 1;
- break;
-#endif
-
- default:
- avahi_log_warn("Unhandled cmsg_type : %d", cmsg->cmsg_type);
- break;
- }
- }
- }
-
- assert(found_addr);
-
- return p;
-
-fail:
- if (p)
- avahi_dns_packet_free(p);
-
- return NULL;
-}
-
-AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv6Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl) {
- AvahiDnsPacket *p = NULL;
- struct msghdr msg;
- struct iovec io;
- size_t aux[1024 / sizeof(size_t)];
- ssize_t l;
- int ms;
- struct cmsghdr *cmsg;
- int found_ttl = 0, found_iface = 0;
- struct sockaddr_in6 sa;
-
- assert(fd >= 0);
-
- if (ioctl(fd, FIONREAD, &ms) < 0) {
- avahi_log_warn("ioctl(): %s", strerror(errno));
- goto fail;
- }
-
- p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
-
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->max_size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = (struct sockaddr*) &sa;
- msg.msg_namelen = sizeof(sa);
-
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_control = aux;
- msg.msg_controllen = sizeof(aux);
- msg.msg_flags = 0;
-
- if ((l = recvmsg(fd, &msg, 0)) < 0) {
- avahi_log_warn("recvmsg(): %s", strerror(errno));
- goto fail;
- }
-
- assert(!(msg.msg_flags & MSG_CTRUNC));
- assert(!(msg.msg_flags & MSG_TRUNC));
-
- p->size = (size_t) l;
-
- if (ret_src_port)
- *ret_src_port = avahi_port_from_sockaddr((struct sockaddr*) &sa);
-
- if (ret_src_address) {
- AvahiAddress a;
- avahi_address_from_sockaddr((struct sockaddr*) &sa, &a);
- *ret_src_address = a.data.ipv6;
- }
-
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-
- if (cmsg->cmsg_level == IPPROTO_IPV6) {
-
- switch (cmsg->cmsg_type) {
-
- case IPV6_HOPLIMIT:
-
- if (ret_ttl)
- *ret_ttl = (uint8_t) (*(int *) CMSG_DATA(cmsg));
-
- found_ttl = 1;
-
- break;
-
- case IPV6_PKTINFO: {
- struct in6_pktinfo *i = (struct in6_pktinfo*) CMSG_DATA(cmsg);
-
- if (ret_iface)
- *ret_iface = i->ipi6_ifindex;
-
- if (ret_dst_address)
- memcpy(ret_dst_address->address, i->ipi6_addr.s6_addr, 16);
-
- found_iface = 1;
- break;
- }
-
- default:
- avahi_log_warn("Unhandled cmsg_type : %d", cmsg->cmsg_type);
- break;
- }
- }
- }
-
- assert(found_iface);
- assert(found_ttl);
-
- return p;
-
-fail:
- if (p)
- avahi_dns_packet_free(p);
-
- return NULL;
-}
-
-int avahi_open_unicast_socket_ipv4(void) {
- struct sockaddr_in local;
- int fd = -1;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin_family = AF_INET;
-
- if (bind(fd, (struct sockaddr*) &local, sizeof(local)) < 0) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- goto fail;
- }
-
- if (ipv4_pktinfo(fd) < 0) {
- goto fail;
- }
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-int avahi_open_unicast_socket_ipv6(void) {
- struct sockaddr_in6 local;
- int fd = -1;
-
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin6_family = AF_INET6;
-
- if (bind(fd, (struct sockaddr*) &local, sizeof(local)) < 0) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- goto fail;
- }
-
- if (ipv6_pktinfo(fd) < 0)
- goto fail;
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
diff --git a/release-0.6.9/avahi-core/socket.h b/release-0.6.9/avahi-core/socket.h
deleted file mode 100644
index 237b534..0000000
--- a/release-0.6.9/avahi-core/socket.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef foosockethfoo
-#define foosockethfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include "dns.h"
-
-#define AVAHI_MDNS_PORT 5353
-#define AVAHI_DNS_PORT 53
-#define AVAHI_IPV4_MCAST_GROUP "224.0.0.251"
-#define AVAHI_IPV6_MCAST_GROUP "ff02::fb"
-
-int avahi_open_socket_ipv4(int no_reuse);
-int avahi_open_socket_ipv6(int no_reuse);
-
-int avahi_open_unicast_socket_ipv4(void);
-int avahi_open_unicast_socket_ipv6(void);
-
-int avahi_send_dns_packet_ipv4(int fd, AvahiIfIndex iface, AvahiDnsPacket *p, const AvahiIPv4Address *src_address, const AvahiIPv4Address *dst_address, uint16_t dst_port);
-int avahi_send_dns_packet_ipv6(int fd, AvahiIfIndex iface, AvahiDnsPacket *p, const AvahiIPv6Address *src_address, const AvahiIPv6Address *dst_address, uint16_t dst_port);
-
-AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv4Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl);
-AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv6Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl);
-
-int avahi_mdns_mcast_join_ipv4(int fd, const AvahiIPv4Address *local_address, int iface, int join);
-int avahi_mdns_mcast_join_ipv6(int fd, const AvahiIPv6Address *local_address, int iface, int join);
-
-#endif
diff --git a/release-0.6.9/avahi-core/timeeventq-test.c b/release-0.6.9/avahi-core/timeeventq-test.c
deleted file mode 100644
index c66a55a..0000000
--- a/release-0.6.9/avahi-core/timeeventq-test.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/simple-watch.h>
-
-#include "timeeventq.h"
-#include "log.h"
-
-#define POINTER_TO_INT(p) ((int) (p))
-#define INT_TO_POINTER(i) ((void*) (i))
-
-static AvahiTimeEventQueue *q = NULL;
-
-static void callback(AvahiTimeEvent*e, void* userdata) {
- struct timeval tv = {0, 0};
- assert(e);
- avahi_log_info("callback(%i)", POINTER_TO_INT(userdata));
- avahi_elapse_time(&tv, 1000, 100);
- avahi_time_event_update(e, &tv);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- struct timeval tv;
- AvahiSimplePoll *s;
-
- s = avahi_simple_poll_new();
-
- q = avahi_time_event_queue_new(avahi_simple_poll_get(s));
-
- avahi_time_event_new(q, avahi_elapse_time(&tv, 5000, 100), callback, INT_TO_POINTER(1));
- avahi_time_event_new(q, avahi_elapse_time(&tv, 5000, 100), callback, INT_TO_POINTER(2));
-
- avahi_log_info("starting");
-
- for (;;)
- if (avahi_simple_poll_iterate(s, -1) != 0)
- break;
-
- avahi_time_event_queue_free(q);
- avahi_simple_poll_free(s);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-core/timeeventq.c b/release-0.6.9/avahi-core/timeeventq.c
deleted file mode 100644
index 17334ee..0000000
--- a/release-0.6.9/avahi-core/timeeventq.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "timeeventq.h"
-#include "log.h"
-
-struct AvahiTimeEvent {
- AvahiTimeEventQueue *queue;
- AvahiPrioQueueNode *node;
- struct timeval expiry;
- struct timeval last_run;
- AvahiTimeEventCallback callback;
- void* userdata;
-};
-
-struct AvahiTimeEventQueue {
- const AvahiPoll *poll_api;
- AvahiPrioQueue *prioq;
- AvahiTimeout *timeout;
-};
-
-static int compare(const void* _a, const void* _b) {
- const AvahiTimeEvent *a = _a, *b = _b;
- int ret;
-
- if ((ret = avahi_timeval_compare(&a->expiry, &b->expiry)) != 0)
- return ret;
-
- /* If both exevents are scheduled for the same time, put the entry
- * that has been run earlier the last time first. */
- return avahi_timeval_compare(&a->last_run, &b->last_run);
-}
-
-static AvahiTimeEvent* time_event_queue_root(AvahiTimeEventQueue *q) {
- assert(q);
-
- return q->prioq->root ? q->prioq->root->data : NULL;
-}
-
-static void update_timeout(AvahiTimeEventQueue *q) {
- AvahiTimeEvent *e;
- assert(q);
-
- if ((e = time_event_queue_root(q)))
- q->poll_api->timeout_update(q->timeout, &e->expiry);
- else
- q->poll_api->timeout_update(q->timeout, NULL);
-}
-
-static void expiration_event(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void *userdata) {
- AvahiTimeEventQueue *q = userdata;
- AvahiTimeEvent *e;
-
- if ((e = time_event_queue_root(q))) {
- struct timeval now;
-
- gettimeofday(&now, NULL);
-
- /* Check if expired */
- if (avahi_timeval_compare(&now, &e->expiry) >= 0) {
-
- /* Make sure to move the entry away from the front */
- e->last_run = now;
- avahi_prio_queue_shuffle(q->prioq, e->node);
-
- /* Run it */
- assert(e->callback);
- e->callback(e, e->userdata);
-
- update_timeout(q);
- return;
- }
- }
-
- avahi_log_debug(__FILE__": Strange, expiration_event() called, but nothing really happened.");
- update_timeout(q);
-}
-
-static void fix_expiry_time(AvahiTimeEvent *e) {
- struct timeval now;
- assert(e);
-
- return; /*** DO WE REALLY NEED THIS? ***/
-
- gettimeofday(&now, NULL);
-
- if (avahi_timeval_compare(&now, &e->expiry) > 0)
- e->expiry = now;
-}
-
-AvahiTimeEventQueue* avahi_time_event_queue_new(const AvahiPoll *poll_api) {
- AvahiTimeEventQueue *q;
-
- if (!(q = avahi_new(AvahiTimeEventQueue, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- goto oom;
- }
-
- q->poll_api = poll_api;
-
- if (!(q->prioq = avahi_prio_queue_new(compare)))
- goto oom;
-
- if (!(q->timeout = poll_api->timeout_new(poll_api, NULL, expiration_event, q)))
- goto oom;
-
- return q;
-
-oom:
-
- if (q) {
- avahi_free(q);
-
- if (q->prioq)
- avahi_prio_queue_free(q->prioq);
- }
-
- return NULL;
-}
-
-void avahi_time_event_queue_free(AvahiTimeEventQueue *q) {
- AvahiTimeEvent *e;
-
- assert(q);
-
- while ((e = time_event_queue_root(q)))
- avahi_time_event_free(e);
- avahi_prio_queue_free(q->prioq);
-
- q->poll_api->timeout_free(q->timeout);
-
- avahi_free(q);
-}
-
-AvahiTimeEvent* avahi_time_event_new(
- AvahiTimeEventQueue *q,
- const struct timeval *timeval,
- AvahiTimeEventCallback callback,
- void* userdata) {
-
- AvahiTimeEvent *e;
-
- assert(q);
- assert(callback);
- assert(userdata);
-
- if (!(e = avahi_new(AvahiTimeEvent, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL; /* OOM */
- }
-
- e->queue = q;
- e->callback = callback;
- e->userdata = userdata;
-
- if (timeval)
- e->expiry = *timeval;
- else {
- e->expiry.tv_sec = 0;
- e->expiry.tv_usec = 0;
- }
-
- fix_expiry_time(e);
-
- e->last_run.tv_sec = 0;
- e->last_run.tv_usec = 0;
-
- if (!(e->node = avahi_prio_queue_put(q->prioq, e))) {
- avahi_free(e);
- return NULL;
- }
-
- update_timeout(q);
- return e;
-}
-
-void avahi_time_event_free(AvahiTimeEvent *e) {
- AvahiTimeEventQueue *q;
- assert(e);
-
- q = e->queue;
-
- avahi_prio_queue_remove(q->prioq, e->node);
- avahi_free(e);
-
- update_timeout(q);
-}
-
-void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval) {
- assert(e);
- assert(timeval);
-
- e->expiry = *timeval;
- fix_expiry_time(e);
- avahi_prio_queue_shuffle(e->queue->prioq, e->node);
-
- update_timeout(e->queue);
-}
-
diff --git a/release-0.6.9/avahi-core/timeeventq.h b/release-0.6.9/avahi-core/timeeventq.h
deleted file mode 100644
index cdfa5e6..0000000
--- a/release-0.6.9/avahi-core/timeeventq.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef footimeeventqhfoo
-#define footimeeventqhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <sys/types.h>
-
-typedef struct AvahiTimeEventQueue AvahiTimeEventQueue;
-typedef struct AvahiTimeEvent AvahiTimeEvent;
-
-#include <avahi-common/watch.h>
-
-#include "prioq.h"
-
-typedef void (*AvahiTimeEventCallback)(AvahiTimeEvent *e, void* userdata);
-
-AvahiTimeEventQueue* avahi_time_event_queue_new(const AvahiPoll *poll_api);
-void avahi_time_event_queue_free(AvahiTimeEventQueue *q);
-
-AvahiTimeEvent* avahi_time_event_new(
- AvahiTimeEventQueue *q,
- const struct timeval *timeval,
- AvahiTimeEventCallback callback,
- void* userdata);
-
-void avahi_time_event_free(AvahiTimeEvent *e);
-void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval);
-
-#endif
diff --git a/release-0.6.9/avahi-core/update-test.c b/release-0.6.9/avahi-core/update-test.c
deleted file mode 100644
index bdffc0c..0000000
--- a/release-0.6.9/avahi-core/update-test.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-
-static AvahiSEntryGroup *group = NULL;
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
-
- avahi_log_debug("server state: %i", state);
-
- if (state == AVAHI_SERVER_RUNNING) {
- int ret;
-
- group = avahi_s_entry_group_new(s, NULL, NULL);
- assert(group);
-
- ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "foo", "_http._tcp", NULL, NULL, 80, "test1", NULL);
- assert(ret == AVAHI_OK);
-
- avahi_s_entry_group_commit(group);
- }
-}
-
-static void modify_txt_callback(AVAHI_GCC_UNUSED AvahiTimeout *e, void *userdata) {
- int ret;
- AvahiServer *s = userdata;
-
- avahi_log_debug("modifying");
-
- ret = avahi_server_update_service_txt(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "foo", "_http._tcp", NULL, "test2", NULL);
- assert(ret == AVAHI_OK);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiSimplePoll *simple_poll;
- const AvahiPoll *poll_api;
- AvahiServer *server;
- struct timeval tv;
- AvahiServerConfig config;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- avahi_server_config_init(&config);
- config.publish_domain = config.publish_workstation = config.use_ipv6 = config.publish_hinfo = 0;
- server = avahi_server_new(poll_api, &config, server_callback, NULL, NULL);
- assert(server);
- avahi_server_config_free(&config);
-
- poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 1000*10, 0), modify_txt_callback, server);
-
- avahi_simple_poll_loop(simple_poll);
-}
diff --git a/release-0.6.9/avahi-core/util.c b/release-0.6.9/avahi-core/util.c
deleted file mode 100644
index b1925f0..0000000
--- a/release-0.6.9/avahi-core/util.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <ctype.h>
-
-#include <avahi-common/malloc.h>
-#include "util.h"
-
-void avahi_hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-char *avahi_format_mac_address(char *r, size_t l, const uint8_t* mac, size_t size) {
- char *t = r;
- unsigned i;
- static const char hex[] = "0123456789abcdef";
-
- assert(r);
- assert(l > 0);
- assert(mac);
-
- if (size <= 0) {
- *r = 0;
- return r;
- }
-
- for (i = 0; i < size; i++) {
- if (l < 3)
- break;
-
- *(t++) = hex[*mac >> 4];
- *(t++) = hex[*mac & 0xF];
- *(t++) = ':';
-
- l -= 3;
-
- mac++;
- }
-
- if (t > r)
- *(t-1) = 0;
- else
- *r = 0;
-
- return r;
-}
-
-char *avahi_strup(char *s) {
- char *c;
- assert(s);
-
- for (c = s; *c; c++)
- *c = (char) toupper(*c);
-
- return s;
-}
-
-char *avahi_strdown(char *s) {
- char *c;
- assert(s);
-
- for (c = s; *c; c++)
- *c = (char) tolower(*c);
-
- return s;
-}
diff --git a/release-0.6.9/avahi-core/util.h b/release-0.6.9/avahi-core/util.h
deleted file mode 100644
index 8d2caee..0000000
--- a/release-0.6.9/avahi-core/util.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef fooutilhfoo
-#define fooutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-void avahi_hexdump(const void *p, size_t size);
-
-char *avahi_format_mac_address(char *t, size_t l, const uint8_t* mac, size_t size);
-
-/** Change every character in the string to upper case (ASCII), return a pointer to the string */
-char *avahi_strup(char *s);
-
-/** Change every character in the string to lower case (ASCII), return a pointer to the string */
-char *avahi_strdown(char *s);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-core/wide-area.c b/release-0.6.9/avahi-core/wide-area.c
deleted file mode 100644
index d86e548..0000000
--- a/release-0.6.9/avahi-core/wide-area.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/timeval.h>
-
-#include "internal.h"
-#include "browse.h"
-#include "socket.h"
-#include "log.h"
-#include "hashmap.h"
-#include "wide-area.h"
-#include "addr-util.h"
-#include "rr-util.h"
-
-#define CACHE_ENTRIES_MAX 500
-
-typedef struct AvahiWideAreaCacheEntry AvahiWideAreaCacheEntry;
-
-struct AvahiWideAreaCacheEntry {
- AvahiWideAreaLookupEngine *engine;
-
- AvahiRecord *record;
- struct timeval timestamp;
- struct timeval expiry;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiWideAreaCacheEntry, by_key);
- AVAHI_LLIST_FIELDS(AvahiWideAreaCacheEntry, cache);
-};
-
-struct AvahiWideAreaLookup {
- AvahiWideAreaLookupEngine *engine;
- int dead;
-
- uint32_t id; /* effectively just an uint16_t, but we need it as an index for a hash table */
- AvahiTimeEvent *time_event;
-
- AvahiKey *key, *cname_key;
-
- int n_send;
- AvahiDnsPacket *packet;
-
- AvahiWideAreaLookupCallback callback;
- void *userdata;
-
- AvahiAddress dns_server_used;
-
- AVAHI_LLIST_FIELDS(AvahiWideAreaLookup, lookups);
- AVAHI_LLIST_FIELDS(AvahiWideAreaLookup, by_key);
-};
-
-struct AvahiWideAreaLookupEngine {
- AvahiServer *server;
-
- int fd_ipv4, fd_ipv6;
- AvahiWatch *watch_ipv4, *watch_ipv6;
-
- uint16_t next_id;
-
- /* Cache */
- AVAHI_LLIST_HEAD(AvahiWideAreaCacheEntry, cache);
- AvahiHashmap *cache_by_key;
- unsigned cache_n_entries;
-
- /* Lookups */
- AVAHI_LLIST_HEAD(AvahiWideAreaLookup, lookups);
- AvahiHashmap *lookups_by_id;
- AvahiHashmap *lookups_by_key;
-
- int cleanup_dead;
-
- AvahiAddress dns_servers[AVAHI_WIDE_AREA_SERVERS_MAX];
- unsigned n_dns_servers;
- unsigned current_dns_server;
-};
-
-static AvahiWideAreaLookup* find_lookup(AvahiWideAreaLookupEngine *e, uint16_t id) {
- AvahiWideAreaLookup *l;
- int i = (int) id;
-
- assert(e);
-
- if (!(l = avahi_hashmap_lookup(e->lookups_by_id, &i)))
- return NULL;
-
- assert(l->id == id);
-
- if (l->dead)
- return NULL;
-
- return l;
-}
-
-static int send_to_dns_server(AvahiWideAreaLookup *l, AvahiDnsPacket *p) {
- AvahiAddress *a;
-
- assert(l);
- assert(p);
-
- if (l->engine->n_dns_servers <= 0)
- return -1;
-
- assert(l->engine->current_dns_server < l->engine->n_dns_servers);
-
- a = &l->engine->dns_servers[l->engine->current_dns_server];
- l->dns_server_used = *a;
-
- if (a->proto == AVAHI_PROTO_INET) {
-
- if (l->engine->fd_ipv4 < 0)
- return -1;
-
- return avahi_send_dns_packet_ipv4(l->engine->fd_ipv4, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv4, AVAHI_DNS_PORT);
-
- } else {
- assert(a->proto == AVAHI_PROTO_INET6);
-
- if (l->engine->fd_ipv6 < 0)
- return -1;
-
- return avahi_send_dns_packet_ipv6(l->engine->fd_ipv6, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv6, AVAHI_DNS_PORT);
- }
-}
-
-static void next_dns_server(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- e->current_dns_server++;
-
- if (e->current_dns_server >= e->n_dns_servers)
- e->current_dns_server = 0;
-}
-
-static void lookup_stop(AvahiWideAreaLookup *l) {
- assert(l);
-
- l->callback = NULL;
-
- if (l->time_event) {
- avahi_time_event_free(l->time_event);
- l->time_event = NULL;
- }
-}
-
-static void sender_timeout_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiWideAreaLookup *l = userdata;
- struct timeval tv;
-
- assert(l);
-
- /* Try another DNS server after three retries */
- if (l->n_send >= 3 && avahi_address_cmp(&l->engine->dns_servers[l->engine->current_dns_server], &l->dns_server_used) == 0) {
- next_dns_server(l->engine);
-
- if (avahi_address_cmp(&l->engine->dns_servers[l->engine->current_dns_server], &l->dns_server_used) == 0)
- /* There is no other DNS server, fail */
- l->n_send = 1000;
- }
-
- if (l->n_send >= 6) {
- avahi_log_warn(__FILE__": Query timed out.");
- avahi_server_set_errno(l->engine->server, AVAHI_ERR_TIMEOUT);
- l->callback(l->engine, AVAHI_BROWSER_FAILURE, AVAHI_LOOKUP_RESULT_WIDE_AREA, NULL, l->userdata);
- lookup_stop(l);
- return;
- }
-
- assert(l->packet);
- send_to_dns_server(l, l->packet);
- l->n_send++;
-
- avahi_time_event_update(e, avahi_elapse_time(&tv, 1000, 0));
-}
-
-AvahiWideAreaLookup *avahi_wide_area_lookup_new(
- AvahiWideAreaLookupEngine *e,
- AvahiKey *key,
- AvahiWideAreaLookupCallback callback,
- void *userdata) {
-
- struct timeval tv;
- AvahiWideAreaLookup *l, *t;
- uint8_t *p;
-
- assert(e);
- assert(key);
- assert(callback);
- assert(userdata);
-
- l = avahi_new(AvahiWideAreaLookup, 1);
- l->engine = e;
- l->dead = 0;
- l->key = avahi_key_ref(key);
- l->cname_key = avahi_key_new_cname(l->key);
- l->callback = callback;
- l->userdata = userdata;
-
- /* If more than 65K wide area quries are issued simultaneously,
- * this will break. This should be limited by some higher level */
-
- for (;; e->next_id++)
- if (!find_lookup(e, e->next_id))
- break; /* This ID is not yet used. */
-
- l->id = e->next_id++;
-
- /* We keep the packet around in case we need to repeat our query */
- l->packet = avahi_dns_packet_new(0);
-
- avahi_dns_packet_set_field(l->packet, AVAHI_DNS_FIELD_ID, (uint16_t) l->id);
- avahi_dns_packet_set_field(l->packet, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(0, 0, 0, 0, 1, 0, 0, 0, 0, 0));
-
- p = avahi_dns_packet_append_key(l->packet, key, 0);
- assert(p);
-
- avahi_dns_packet_set_field(l->packet, AVAHI_DNS_FIELD_QDCOUNT, 1);
-
- if (send_to_dns_server(l, l->packet) < 0) {
- avahi_log_error(__FILE__": Failed to send packet.");
- avahi_dns_packet_free(l->packet);
- avahi_key_unref(l->key);
- if (l->cname_key)
- avahi_key_unref(l->cname_key);
- avahi_free(l);
- return NULL;
- }
-
- l->n_send = 1;
-
- l->time_event = avahi_time_event_new(e->server->time_event_queue, avahi_elapse_time(&tv, 500, 0), sender_timeout_callback, l);
-
- avahi_hashmap_insert(e->lookups_by_id, &l->id, l);
-
- t = avahi_hashmap_lookup(e->lookups_by_key, l->key);
- AVAHI_LLIST_PREPEND(AvahiWideAreaLookup, by_key, t, l);
- avahi_hashmap_replace(e->lookups_by_key, avahi_key_ref(l->key), t);
-
- AVAHI_LLIST_PREPEND(AvahiWideAreaLookup, lookups, e->lookups, l);
-
- return l;
-}
-
-static void lookup_destroy(AvahiWideAreaLookup *l) {
- AvahiWideAreaLookup *t;
- assert(l);
-
- lookup_stop(l);
-
- t = avahi_hashmap_lookup(l->engine->lookups_by_key, l->key);
- AVAHI_LLIST_REMOVE(AvahiWideAreaLookup, by_key, t, l);
- if (t)
- avahi_hashmap_replace(l->engine->lookups_by_key, avahi_key_ref(l->key), t);
- else
- avahi_hashmap_remove(l->engine->lookups_by_key, l->key);
-
- AVAHI_LLIST_REMOVE(AvahiWideAreaLookup, lookups, l->engine->lookups, l);
-
- avahi_hashmap_remove(l->engine->lookups_by_id, &l->id);
- avahi_dns_packet_free(l->packet);
-
- if (l->key)
- avahi_key_unref(l->key);
-
- if (l->cname_key)
- avahi_key_unref(l->cname_key);
-
- avahi_free(l);
-}
-
-void avahi_wide_area_lookup_free(AvahiWideAreaLookup *l) {
- assert(l);
-
- if (l->dead)
- return;
-
- l->dead = 1;
- l->engine->cleanup_dead = 1;
- lookup_stop(l);
-}
-
-void avahi_wide_area_cleanup(AvahiWideAreaLookupEngine *e) {
- AvahiWideAreaLookup *l, *n;
- assert(e);
-
- while (e->cleanup_dead) {
- e->cleanup_dead = 0;
-
- for (l = e->lookups; l; l = n) {
- n = l->lookups_next;
-
- if (l->dead)
- lookup_destroy(l);
- }
- }
-}
-
-static void cache_entry_free(AvahiWideAreaCacheEntry *c) {
- AvahiWideAreaCacheEntry *t;
- assert(c);
-
- if (c->time_event)
- avahi_time_event_free(c->time_event);
-
- AVAHI_LLIST_REMOVE(AvahiWideAreaCacheEntry, cache, c->engine->cache, c);
-
- t = avahi_hashmap_lookup(c->engine->cache_by_key, c->record->key);
- AVAHI_LLIST_REMOVE(AvahiWideAreaCacheEntry, by_key, t, c);
- if (t)
- avahi_hashmap_replace(c->engine->cache_by_key, avahi_key_ref(c->record->key), t);
- else
- avahi_hashmap_remove(c->engine->cache_by_key, c->record->key);
-
- c->engine->cache_n_entries --;
-
- avahi_record_unref(c->record);
- avahi_free(c);
-}
-
-static void expiry_event(AvahiTimeEvent *te, void *userdata) {
- AvahiWideAreaCacheEntry *e = userdata;
-
- assert(te);
- assert(e);
-
- cache_entry_free(e);
-}
-
-static AvahiWideAreaCacheEntry* find_record_in_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
- AvahiWideAreaCacheEntry *c;
-
- assert(e);
- assert(r);
-
- for (c = avahi_hashmap_lookup(e->cache_by_key, r->key); c; c = c->by_key_next)
- if (avahi_record_equal_no_ttl(r, c->record))
- return c;
-
- return NULL;
-}
-
-static void run_callbacks(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
- AvahiWideAreaLookup *l;
-
- assert(e);
- assert(r);
-
- for (l = avahi_hashmap_lookup(e->lookups_by_key, r->key); l; l = l->by_key_next) {
- if (l->dead || !l->callback)
- continue;
-
- l->callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA, r, l->userdata);
- }
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN && r->key->type == AVAHI_DNS_TYPE_CNAME) {
- /* It's a CNAME record, so we have to scan the all lookups to see if one matches */
-
- for (l = e->lookups; l; l = l->lookups_next) {
- AvahiKey *key;
-
- if (l->dead || !l->callback)
- continue;
-
- if ((key = avahi_key_new_cname(l->key))) {
- if (avahi_key_equal(r->key, key))
- l->callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA, r, l->userdata);
-
- avahi_key_unref(key);
- }
- }
- }
-}
-
-static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
- AvahiWideAreaCacheEntry *c;
- int is_new;
-
- assert(e);
- assert(r);
-
- if ((c = find_record_in_cache(e, r))) {
- is_new = 0;
-
- /* Update the existing entry */
- avahi_record_unref(c->record);
- } else {
- AvahiWideAreaCacheEntry *t;
-
- is_new = 1;
-
- /* Enforce cache size */
- if (e->cache_n_entries >= CACHE_ENTRIES_MAX)
- /* Eventually we should improve the caching algorithm here */
- goto finish;
-
- c = avahi_new(AvahiWideAreaCacheEntry, 1);
- c->engine = e;
- c->time_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiWideAreaCacheEntry, cache, e->cache, c);
-
- /* Add the new entry to the cache entry hash table */
- t = avahi_hashmap_lookup(e->cache_by_key, r->key);
- AVAHI_LLIST_PREPEND(AvahiWideAreaCacheEntry, by_key, t, c);
- avahi_hashmap_replace(e->cache_by_key, avahi_key_ref(r->key), t);
-
- e->cache_n_entries ++;
- }
-
- c->record = avahi_record_ref(r);
-
- gettimeofday(&c->timestamp, NULL);
- c->expiry = c->timestamp;
- avahi_timeval_add(&c->expiry, r->ttl * 1000000);
-
- if (c->time_event)
- avahi_time_event_update(c->time_event, &c->expiry);
- else
- c->time_event = avahi_time_event_new(e->server->time_event_queue, &c->expiry, expiry_event, c);
-
-finish:
-
- if (is_new)
- run_callbacks(e, r);
-}
-
-static int map_dns_error(uint16_t error) {
- static const int table[16] = {
- AVAHI_OK,
- AVAHI_ERR_DNS_FORMERR,
- AVAHI_ERR_DNS_SERVFAIL,
- AVAHI_ERR_DNS_NXDOMAIN,
- AVAHI_ERR_DNS_NOTIMP,
- AVAHI_ERR_DNS_REFUSED,
- AVAHI_ERR_DNS_YXDOMAIN,
- AVAHI_ERR_DNS_YXRRSET,
- AVAHI_ERR_DNS_NXRRSET,
- AVAHI_ERR_DNS_NOTAUTH,
- AVAHI_ERR_DNS_NOTZONE,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR
- };
-
- assert(error <= 15);
-
- return table[error];
-}
-
-static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
- AvahiWideAreaLookup *l = NULL;
- int i, r;
-
- AvahiBrowserEvent final_event = AVAHI_BROWSER_ALL_FOR_NOW;
-
- assert(e);
- assert(p);
-
- /* Some superficial validity tests */
- if (avahi_dns_packet_check_valid(p) < 0 || avahi_dns_packet_is_query(p)) {
- avahi_log_warn(__FILE__": Ignoring invalid response for wide area datagram.");
- goto finish;
- }
-
- /* Look for the lookup that issued this query */
- if (!(l = find_lookup(e, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID))) || l->dead)
- goto finish;
-
- /* Check whether this a packet indicating a failure */
- if ((r = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & 15) != 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0) {
-
- avahi_server_set_errno(e->server, r == 0 ? AVAHI_ERR_NOT_FOUND : map_dns_error(r));
- /* Tell the user about the failure */
- final_event = AVAHI_BROWSER_FAILURE;
-
- /* We go on here, since some of the records contained in the
- reply might be interesting in some way */
- }
-
- /* Skip over the question */
- for (i = (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); i > 0; i--) {
- AvahiKey *k;
-
- if (!(k = avahi_dns_packet_consume_key(p, NULL))) {
- avahi_log_warn(__FILE__": Wide area response packet too short.");
- avahi_server_set_errno(e->server, AVAHI_ERR_INVALID_PACKET);
- final_event = AVAHI_BROWSER_FAILURE;
- goto finish;
- }
-
- avahi_key_unref(k);
- }
-
- /* Process responses */
- for (i = (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) +
- (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) +
- (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT); i > 0; i--) {
-
- AvahiRecord *rr;
-
- if (!(rr = avahi_dns_packet_consume_record(p, NULL))) {
- avahi_log_warn(__FILE__": Wide area response packet too short (2).");
- avahi_server_set_errno(e->server, AVAHI_ERR_INVALID_PACKET);
- final_event = AVAHI_BROWSER_FAILURE;
- goto finish;
- }
-
- add_to_cache(e, rr);
- avahi_record_unref(rr);
- }
-
-finish:
-
- if (l && !l->dead) {
- if (l->callback)
- l->callback(e, final_event, AVAHI_LOOKUP_RESULT_WIDE_AREA, NULL, l->userdata);
-
- lookup_stop(l);
- }
-}
-
-static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent events, void *userdata) {
- AvahiWideAreaLookupEngine *e = userdata;
- AvahiDnsPacket *p = NULL;
-
- if (fd == e->fd_ipv4)
- p = avahi_recv_dns_packet_ipv4(e->fd_ipv4, NULL, NULL, NULL, NULL, NULL);
- else {
- assert(fd == e->fd_ipv6);
- p = avahi_recv_dns_packet_ipv6(e->fd_ipv6, NULL, NULL, NULL, NULL, NULL);
- }
-
- if (p) {
- handle_packet(e, p);
- avahi_dns_packet_free(p);
- }
-}
-
-AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
- AvahiWideAreaLookupEngine *e;
-
- assert(s);
-
- e = avahi_new(AvahiWideAreaLookupEngine, 1);
- e->server = s;
- e->cleanup_dead = 0;
-
- /* Create sockets */
- e->fd_ipv4 = avahi_open_unicast_socket_ipv4();
- e->fd_ipv6 = avahi_open_unicast_socket_ipv6();
-
- if (e->fd_ipv4 < 0 && e->fd_ipv6 < 0) {
- avahi_log_error(__FILE__": Failed to create wide area sockets: %s", strerror(errno));
-
- if (e->fd_ipv6 >= 0)
- close(e->fd_ipv6);
-
- if (e->fd_ipv4 >= 0)
- close(e->fd_ipv4);
-
- avahi_free(e);
- return NULL;
- }
-
- /* Create watches */
-
- e->watch_ipv4 = e->watch_ipv6 = NULL;
-
- if (e->fd_ipv4 >= 0)
- e->watch_ipv4 = s->poll_api->watch_new(e->server->poll_api, e->fd_ipv4, AVAHI_WATCH_IN, socket_event, e);
- if (e->fd_ipv6 >= 0)
- e->watch_ipv6 = s->poll_api->watch_new(e->server->poll_api, e->fd_ipv6, AVAHI_WATCH_IN, socket_event, e);
-
- e->n_dns_servers = e->current_dns_server = 0;
- e->next_id = (uint16_t) rand();
-
- /* Initialize cache */
- AVAHI_LLIST_HEAD_INIT(AvahiWideAreaCacheEntry, e->cache);
- e->cache_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, (AvahiFreeFunc) avahi_key_unref, NULL);
- e->cache_n_entries = 0;
-
- /* Initialize lookup list */
- e->lookups_by_id = avahi_hashmap_new((AvahiHashFunc) avahi_int_hash, (AvahiEqualFunc) avahi_int_equal, NULL, NULL);
- e->lookups_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, (AvahiFreeFunc) avahi_key_unref, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiWideAreaLookup, e->lookups);
-
- return e;
-}
-
-void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- avahi_wide_area_clear_cache(e);
-
- while (e->lookups)
- lookup_destroy(e->lookups);
-
- avahi_hashmap_free(e->cache_by_key);
- avahi_hashmap_free(e->lookups_by_id);
- avahi_hashmap_free(e->lookups_by_key);
-
- if (e->watch_ipv4)
- e->server->poll_api->watch_free(e->watch_ipv4);
-
- if (e->watch_ipv6)
- e->server->poll_api->watch_free(e->watch_ipv6);
-
- if (e->fd_ipv6 >= 0)
- close(e->fd_ipv6);
-
- if (e->fd_ipv4 >= 0)
- close(e->fd_ipv4);
-
- avahi_free(e);
-}
-
-void avahi_wide_area_clear_cache(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- while (e->cache)
- cache_entry_free(e->cache);
-
- assert(e->cache_n_entries == 0);
-}
-
-void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddress *a, unsigned n) {
- assert(e);
-
- if (a) {
- for (e->n_dns_servers = 0; n > 0 && e->n_dns_servers < AVAHI_WIDE_AREA_SERVERS_MAX; a++, n--)
- if ((a->proto == AVAHI_PROTO_INET && e->fd_ipv4 >= 0) || (a->proto == AVAHI_PROTO_INET6 && e->fd_ipv6 >= 0))
- e->dns_servers[e->n_dns_servers++] = *a;
- } else {
- assert(n == 0);
- e->n_dns_servers = 0;
- }
-
- e->current_dns_server = 0;
-
- avahi_wide_area_clear_cache(e);
-}
-
-void avahi_wide_area_cache_dump(AvahiWideAreaLookupEngine *e, AvahiDumpCallback callback, void* userdata) {
- AvahiWideAreaCacheEntry *c;
-
- assert(e);
- assert(callback);
-
- callback(";; WIDE AREA CACHE ;;; ", userdata);
-
- for (c = e->cache; c; c = c->cache_next) {
- char *t = avahi_record_to_string(c->record);
- callback(t, userdata);
- avahi_free(t);
- }
-}
-
-unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key, AvahiWideAreaLookupCallback callback, void *userdata) {
- AvahiWideAreaCacheEntry *c;
- AvahiKey *cname_key;
- unsigned n = 0;
-
- assert(e);
- assert(key);
- assert(callback);
-
- for (c = avahi_hashmap_lookup(e->cache_by_key, key); c; c = c->by_key_next) {
- callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA|AVAHI_LOOKUP_RESULT_CACHED, c->record, userdata);
- n++;
- }
-
- if ((cname_key = avahi_key_new_cname(key))) {
-
- for (c = avahi_hashmap_lookup(e->cache_by_key, cname_key); c; c = c->by_key_next) {
- callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA|AVAHI_LOOKUP_RESULT_CACHED, c->record, userdata);
- n++;
- }
-
- avahi_key_unref(cname_key);
- }
-
- return n;
-}
-
-int avahi_wide_area_has_servers(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- return e->n_dns_servers > 0;
-}
-
-
-
diff --git a/release-0.6.9/avahi-core/wide-area.h b/release-0.6.9/avahi-core/wide-area.h
deleted file mode 100644
index 1af613b..0000000
--- a/release-0.6.9/avahi-core/wide-area.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef foowideareahfoo
-#define foowideareahfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "lookup.h"
-#include "browse.h"
-
-typedef struct AvahiWideAreaLookupEngine AvahiWideAreaLookupEngine;
-typedef struct AvahiWideAreaLookup AvahiWideAreaLookup;
-
-typedef void (*AvahiWideAreaLookupCallback)(
- AvahiWideAreaLookupEngine *e,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata);
-
-AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s);
-void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e);
-
-unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key, AvahiWideAreaLookupCallback callback, void *userdata);
-void avahi_wide_area_cache_dump(AvahiWideAreaLookupEngine *e, AvahiDumpCallback callback, void* userdata);
-void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddress *a, unsigned n);
-void avahi_wide_area_clear_cache(AvahiWideAreaLookupEngine *e);
-void avahi_wide_area_cleanup(AvahiWideAreaLookupEngine *e);
-int avahi_wide_area_has_servers(AvahiWideAreaLookupEngine *e);
-
-AvahiWideAreaLookup *avahi_wide_area_lookup_new(AvahiWideAreaLookupEngine *e, AvahiKey *key, AvahiWideAreaLookupCallback callback, void *userdata);
-void avahi_wide_area_lookup_free(AvahiWideAreaLookup *q);
-
-
-
-#endif
-
diff --git a/release-0.6.9/avahi-daemon/AddressResolver.introspect b/release-0.6.9/avahi-daemon/AddressResolver.introspect
deleted file mode 100644
index 3550ecd..0000000
--- a/release-0.6.9/avahi-daemon/AddressResolver.introspect
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.AddressResolver">
-
- <method name="Free"/>
-
- <signal name="Found">
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/DomainBrowser.introspect b/release-0.6.9/avahi-daemon/DomainBrowser.introspect
deleted file mode 100644
index 5840060..0000000
--- a/release-0.6.9/avahi-daemon/DomainBrowser.introspect
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.DomainBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
-
diff --git a/release-0.6.9/avahi-daemon/EntryGroup.introspect b/release-0.6.9/avahi-daemon/EntryGroup.introspect
deleted file mode 100644
index e49bbe6..0000000
--- a/release-0.6.9/avahi-daemon/EntryGroup.introspect
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out"/>
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.EntryGroup">
- <method name="Free"/>
- <method name="Commit"/>
- <method name="Reset"/>
-
- <method name="GetState">
- <arg name="state" type="i" direction="out"/>
- </method>
-
- <signal name="StateChanged">
- <arg name="state" type="i"/>
- <arg name="error" type="s"/>
- </signal>
-
- <method name="IsEmpty">
- <arg name="empty" type="b" direction="out"/>
- </method>
-
- <method name="AddService">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="host" type="s" direction="in"/>
- <arg name="port" type="q" direction="in"/>
- <arg name="txt" type="aay" direction="in"/>
- </method>
-
- <method name="AddServiceSubtype">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="subtype" type="s" direction="in"/>
- </method>
-
- <method name="UpdateServiceTxt">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="txt" type="aay" direction="in"/>
- </method>
-
- <method name="AddAddress">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="address" type="s" direction="in"/>
- </method>
-
- <method name="AddRecord">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="clazz" type="q" direction="in"/>
- <arg name="type" type="q" direction="in"/>
- <arg name="ttl" type="u" direction="in"/>
- <arg name="rdata" type="ay" direction="in"/>
- </method>
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/HostNameResolver.introspect b/release-0.6.9/avahi-daemon/HostNameResolver.introspect
deleted file mode 100644
index db77ae3..0000000
--- a/release-0.6.9/avahi-daemon/HostNameResolver.introspect
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceResolver">
-
- <method name="Free"/>
-
- <signal name="Found">
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/Makefile.am b/release-0.6.9/avahi-daemon/Makefile.am
deleted file mode 100644
index 15cbb57..0000000
--- a/release-0.6.9/avahi-daemon/Makefile.am
+++ /dev/null
@@ -1,163 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_LIBDAEMON
-if HAVE_EXPAT
-
-pkgsysconfdir=$(sysconfdir)/avahi
-servicedir=$(pkgsysconfdir)/services
-introspectiondir=$(pkgdatadir)/introspection
-
-AM_CFLAGS+= \
- -DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \
- -DAVAHI_SOCKET=\"$(avahi_socket)\" \
- -DAVAHI_SERVICE_DIR=\"$(servicedir)\" \
- -DAVAHI_CONFIG_FILE=\"$(pkgsysconfdir)/avahi-daemon.conf\" \
- -DAVAHI_HOSTS_FILE=\"$(pkgsysconfdir)/hosts\" \
- -DAVAHI_DBUS_INTROSPECTION_DIR=\"$(introspectiondir)\" \
- -DAVAHI_CONFIG_DIR=\"$(pkgsysconfdir)\"
-
-sbin_PROGRAMS = \
- avahi-daemon
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- ini-file-parser-test
-endif
-
-avahi_daemon_SOURCES = \
- main.c main.h \
- simple-protocol.c simple-protocol.h \
- static-services.c static-services.h \
- static-hosts.c static-hosts.h \
- ini-file-parser.c ini-file-parser.h \
- setproctitle.c setproctitle.h \
- ../avahi-client/check-nss.c
-
-avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
-avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) -lexpat
-
-ini_file_parser_test_SOURCES = \
- ini-file-parser.c ini-file-parser.h \
- ini-file-parser-test.c
-
-ini_file_parser_test_CFLAGS = $(AM_CFLAGS)
-ini_file_parser_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la
-
-pkgsysconf_DATA = \
- avahi-daemon.conf \
- hosts
-
-service_DATA = \
- ssh.service
-
-pkgdata_DATA = \
- avahi-service.dtd
-
-if ENABLE_CHROOT
-
-avahi_daemon_SOURCES += \
- chroot.c chroot.h \
- caps.c caps.h
-
-avahi_daemon_LDADD += -lcap
-
-endif
-
-if HAVE_DLOPEN
-avahi_daemon_LDADD += -ldl
-endif
-
-if HAVE_DBUS
-
-dbusservicedir=$(DBUS_SYS_DIR)
-
-avahi_daemon_SOURCES += \
- dbus-protocol.c dbus-protocol.h \
- dbus-util.c dbus-util.h \
- dbus-internal.h \
- dbus-async-address-resolver.c \
- dbus-async-host-name-resolver.c \
- dbus-async-service-resolver.c \
- dbus-domain-browser.c \
- dbus-entry-group.c \
- dbus-service-browser.c \
- dbus-service-type-browser.c \
- dbus-sync-address-resolver.c \
- dbus-sync-host-name-resolver.c \
- dbus-sync-service-resolver.c \
- dbus-record-browser.c \
- ../avahi-common/dbus.c ../avahi-common/dbus.h \
- ../avahi-common/dbus-watch-glue.c ../avahi-common/dbus-watch-glue.h
-
-avahi_daemon_LDADD += \
- $(DBUS_LIBS)
-
-avahi_daemon_CFLAGS += $(DBUS_CFLAGS)
-
-dbusservice_DATA = avahi-dbus.conf
-
-introspection_DATA = \
- Server.introspect \
- EntryGroup.introspect \
- DomainBrowser.introspect \
- ServiceTypeBrowser.introspect \
- ServiceBrowser.introspect \
- ServiceResolver.introspect \
- AddressResolver.introspect \
- HostNameResolver.introspect \
- RecordBrowser.introspect
-
-endif
-endif
-endif
-
-EXTRA_DIST = \
- avahi-service.dtd \
- avahi-daemon.conf \
- example.service \
- avahi-dbus.conf \
- Server.introspect \
- EntryGroup.introspect \
- DomainBrowser.introspect \
- ServiceTypeBrowser.introspect \
- ServiceBrowser.introspect \
- ServiceResolver.introspect \
- AddressResolver.introspect \
- HostNameResolver.introspect \
- RecordBrowser.introspect \
- ssh.service \
- hosts \
- example.service \
- introspect.dtd \
- introspect.xsl
-
-xmllint:
- xmllint --noout --valid example.service
- for F in $(introspection_DATA) ; do \
- xmllint --noout --valid $$F ; \
- done
-
-install-data-local:
- test -z "$(localstatedir)/run" || $(mkdir_p) "$(DESTDIR)$(localstatedir)/run"
diff --git a/release-0.6.9/avahi-daemon/RecordBrowser.introspect b/release-0.6.9/avahi-daemon/RecordBrowser.introspect
deleted file mode 100644
index 57c1e66..0000000
--- a/release-0.6.9/avahi-daemon/RecordBrowser.introspect
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.RecordBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="clazz" type="q"/>
- <arg name="type" type="q"/>
- <arg name="rdata" type="ay"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="clazz" type="q"/>
- <arg name="type" type="q"/>
- <arg name="rdata" type="ay"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/Server.introspect b/release-0.6.9/avahi-daemon/Server.introspect
deleted file mode 100644
index 6635618..0000000
--- a/release-0.6.9/avahi-daemon/Server.introspect
+++ /dev/null
@@ -1,218 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out"/>
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.Server">
-
- <method name="GetVersionString">
- <arg name="version" type="s" direction="out"/>
- </method>
-
- <method name="GetAPIVersion">
- <arg name="version" type="u" direction="out"/>
- </method>
-
- <method name="GetHostName">
- <arg name="name" type="s" direction="out"/>
- </method>
- <method name="GetHostNameFqdn">
- <arg name="name" type="s" direction="out"/>
- </method>
- <method name="GetDomainName">
- <arg name="name" type="s" direction="out"/>
- </method>
-
- <method name="IsNSSSupportAvailable">
- <arg name="yes" type="b" direction="out"/>
- </method>
-
- <method name="GetState">
- <arg name="state" type="i" direction="out"/>
- </method>
-
- <signal name="StateChanged">
- <arg name="state" type="i"/>
- <arg name="error" type="s"/>
- </signal>
-
- <method name="GetLocalServiceCookie">
- <arg name="cookie" type="u" direction="out"/>
- </method>
-
- <method name="GetAlternativeHostName">
- <arg name="name" type="s" direction="in"/>
- <arg name="name" type="s" direction="out"/>
- </method>
-
- <method name="GetAlternativeServiceName">
- <arg name="name" type="s" direction="in"/>
- <arg name="name" type="s" direction="out"/>
- </method>
-
- <method name="GetNetworkInterfaceNameByIndex">
- <arg name="index" type="i" direction="in"/>
- <arg name="name" type="s" direction="out"/>
- </method>
- <method name="GetNetworkInterfaceIndexByName">
- <arg name="name" type="s" direction="in"/>
- <arg name="index" type="i" direction="out"/>
- </method>
-
- <method name="ResolveHostName">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </method>
-
- <method name="ResolveAddress">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="address" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </method>
-
- <method name="ResolveService">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="type" type="s" direction="out"/>
- <arg name="domain" type="s" direction="out"/>
- <arg name="host" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="port" type="q" direction="out"/>
- <arg name="txt" type="aay" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </method>
-
- <method name="EntryGroupNew">
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="DomainBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="btype" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="ServiceTypeBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="ServiceBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="ServiceResolverNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="HostNameResolverNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="AddressResolverNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="address" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="RecordBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="clazz" type="q" direction="in"/>
- <arg name="type" type="q" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
-
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/ServiceBrowser.introspect b/release-0.6.9/avahi-daemon/ServiceBrowser.introspect
deleted file mode 100644
index 4a7b430..0000000
--- a/release-0.6.9/avahi-daemon/ServiceBrowser.introspect
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/ServiceResolver.introspect b/release-0.6.9/avahi-daemon/ServiceResolver.introspect
deleted file mode 100644
index 2be9347..0000000
--- a/release-0.6.9/avahi-daemon/ServiceResolver.introspect
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceResolver">
-
- <method name="Free"/>
-
- <signal name="Found">
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="type" type="s" direction="out"/>
- <arg name="domain" type="s" direction="out"/>
- <arg name="host" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="port" type="q" direction="out"/>
- <arg name="txt" type="aay" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/ServiceTypeBrowser.introspect b/release-0.6.9/avahi-daemon/ServiceTypeBrowser.introspect
deleted file mode 100644
index cb07f24..0000000
--- a/release-0.6.9/avahi-daemon/ServiceTypeBrowser.introspect
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceTypeBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
diff --git a/release-0.6.9/avahi-daemon/avahi-daemon.conf b/release-0.6.9/avahi-daemon/avahi-daemon.conf
deleted file mode 100644
index 1992a67..0000000
--- a/release-0.6.9/avahi-daemon/avahi-daemon.conf
+++ /dev/null
@@ -1,60 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# See avahi-daemon.conf(5) for more information on this configuration
-# file!
-
-[server]
-#host-name=foo
-#domain-name=local
-browse-domains=0pointer.de, zeroconf.org
-use-ipv4=yes
-use-ipv6=no
-#check-response-ttl=no
-#use-iff-running=no
-#enable-dbus=yes
-#disallow-other-stacks=no
-#allow-point-to-point=no
-
-[wide-area]
-enable-wide-area=yes
-
-[publish]
-#disable-publishing=no
-#disable-user-service-publishing=no
-#add-service-cookie=yes
-#publish-addresses=yes
-#publish-hinfo=yes
-#publish-workstation=yes
-#publish-domain=yes
-#publish-dns-servers=192.168.50.1, 192.168.50.2
-#publish-resolv-conf-dns-servers=yes
-
-[reflector]
-#enable-reflector=no
-#reflect-ipv=no
-
-[rlimits]
-#rlimit-as=
-rlimit-core=0
-rlimit-data=4194304
-rlimit-fsize=0
-rlimit-nofile=30
-rlimit-stack=4194304
-rlimit-nproc=3
diff --git a/release-0.6.9/avahi-daemon/avahi-dbus.conf.in b/release-0.6.9/avahi-daemon/avahi-dbus.conf.in
deleted file mode 100644
index 416c8dc..0000000
--- a/release-0.6.9/avahi-daemon/avahi-dbus.conf.in
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE busconfig PUBLIC
- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-
- <!-- Only root or user @AVAHI_USER@ can own the Avahi service -->
- <policy user="@AVAHI_USER@">
- <allow own="org.freedesktop.Avahi"/>
- </policy>
- <policy user="root">
- <allow own="org.freedesktop.Avahi"/>
- </policy>
-
- <!-- Allow anyone to invoke methods on the Manager and Device interfaces -->
- <policy context="default">
- <allow send_interface="org.freedesktop.Avahi"/>
-
- <allow receive_interface="org.freedesktop.Avahi"
- receive_sender="org.freedesktop.Avahi"/>
- </policy>
-
- <limit name="max_match_rules_per_connection">512</limit>
- <limit name="max_connections_per_user">20</limit>
-
-</busconfig>
diff --git a/release-0.6.9/avahi-daemon/avahi-service.dtd b/release-0.6.9/avahi-daemon/avahi-service.dtd
deleted file mode 100644
index c3c25e2..0000000
--- a/release-0.6.9/avahi-daemon/avahi-service.dtd
+++ /dev/null
@@ -1,20 +0,0 @@
-<!-- $Id$ -->
-
-<!ELEMENT service-group (name,service+)>
-<!ATTLIST service-group>
-<!ELEMENT name (#PCDATA)>
-<!ATTLIST name replace-wildcards (yes|no) "no">
-<!ELEMENT service (type,subtype*,domain-name?,host-name?,port,txt-record*)>
-<!ATTLIST service protocol (ipv4|ipv6|any) "any">
-<!ELEMENT type (#PCDATA)>
-<!ATTLIST type>
-<!ELEMENT subtype (#PCDATA)>
-<!ATTLIST subtype>
-<!ELEMENT domain-name (#PCDATA)>
-<!ATTLIST domain-name>
-<!ELEMENT host-name (#PCDATA)>
-<!ATTLIST host-name>
-<!ELEMENT port (#PCDATA)>
-<!ATTLIST port>
-<!ELEMENT txt-record (#PCDATA)>
-<!ATTLIST txt-record>
diff --git a/release-0.6.9/avahi-daemon/caps.c b/release-0.6.9/avahi-daemon/caps.c
deleted file mode 100644
index 2d0f39a..0000000
--- a/release-0.6.9/avahi-daemon/caps.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/capability.h>
-#include <sys/prctl.h>
-
-#include <avahi-core/log.h>
-
-#include "caps.h"
-
-int avahi_caps_reduce(void) {
- int ret = 0;
- cap_t caps;
- static cap_value_t cap_values[] = { CAP_SYS_CHROOT, CAP_SETUID, CAP_SETGID };
-
- /* Let's reduce our caps to the minimum set and tell Linux to keep
- * them accross setuid(). This is called before we droppped
- * priviliges. */
-
- caps = cap_init();
- assert(caps);
- cap_clear(caps);
-
- cap_set_flag(caps, CAP_EFFECTIVE, 3, cap_values, CAP_SET);
- cap_set_flag(caps, CAP_PERMITTED, 3, cap_values, CAP_SET);
-
- if (cap_set_proc(caps) < 0) {
- avahi_log_error("cap_set_proc() failed: %s", strerror(errno));
- ret = -1;
- }
- cap_free(caps);
-
- /* Retain capabilities accros setuid() */
- if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) {
- avahi_log_error("prctl(PR_SET_KEEPCAPS) failed: %s", strerror(errno));
- ret = -1;
- }
-
- return ret;
-}
-
-int avahi_caps_reduce2(void) {
- int ret = 0;
- cap_t caps;
- static cap_value_t cap_values[] = { CAP_SYS_CHROOT };
-
- /* Reduce our caps to the bare minimum and tell Linux not to keep
- * them across setuid(). This is called after we dropped
- * privilige. */
-
- /* No longer retain caps across setuid() */
- if (prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0) < 0) {
- avahi_log_error("prctl(PR_SET_KEEPCAPS) failed: %s", strerror(errno));
- ret = -1;
- }
-
- caps = cap_init();
- assert(caps);
- cap_clear(caps);
-
- /* setuid() zeroed our effective caps, let's get them back */
- cap_set_flag(caps, CAP_EFFECTIVE, 1, cap_values, CAP_SET);
- cap_set_flag(caps, CAP_PERMITTED, 1, cap_values, CAP_SET);
-
- if (cap_set_proc(caps) < 0) {
- avahi_log_error("cap_set_proc() failed: %s", strerror(errno));
- ret = -1;
- }
- cap_free(caps);
-
- return ret;
-}
-
-int avahi_caps_drop_all(void) {
- cap_t caps;
- int ret = 0;
-
- /* Drop all capabilities and turn ourselves into a normal user process */
-
- caps = cap_init();
- assert(caps);
- cap_clear(caps);
-
- if (cap_set_proc(caps) < 0) {
- avahi_log_error("cap_set_proc() failed: %s", strerror(errno));
- ret = -1;
- }
- cap_free(caps);
-
- return ret;
-}
diff --git a/release-0.6.9/avahi-daemon/caps.h b/release-0.6.9/avahi-daemon/caps.h
deleted file mode 100644
index 788aceb..0000000
--- a/release-0.6.9/avahi-daemon/caps.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef foocapshfoo
-#define foocapshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-int avahi_caps_reduce(void);
-int avahi_caps_reduce2(void);
-int avahi_caps_drop_all(void);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/chroot.c b/release-0.6.9/avahi-daemon/chroot.c
deleted file mode 100644
index 5ca605d..0000000
--- a/release-0.6.9/avahi-daemon/chroot.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <inttypes.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/un.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <avahi-core/log.h>
-#include <libdaemon/dfork.h>
-
-#include "chroot.h"
-#include "caps.h"
-#include "setproctitle.h"
-
-enum {
- AVAHI_CHROOT_SUCCESS = 0,
- AVAHI_CHROOT_FAILURE,
- AVAHI_CHROOT_GET_RESOLV_CONF,
-#ifdef HAVE_DBUS
- AVAHI_CHROOT_GET_SERVER_INTROSPECT,
- AVAHI_CHROOT_GET_ENTRY_GROUP_INTROSPECT,
- AVAHI_CHROOT_GET_ADDRESS_RESOLVER_INTROSPECT,
- AVAHI_CHROOT_GET_DOMAIN_BROWSER_INTROSPECT,
- AVAHI_CHROOT_GET_HOST_NAME_RESOLVER_INTROSPECT,
- AVAHI_CHROOT_GET_SERVICE_BROWSER_INTROSPECT,
- AVAHI_CHROOT_GET_SERVICE_RESOLVER_INTROSPECT,
- AVAHI_CHROOT_GET_SERVICE_TYPE_BROWSER_INTROSPECT,
- AVAHI_CHROOT_GET_RECORD_BROWSER_INTROSPECT,
-#endif
- AVAHI_CHROOT_UNLINK_PID,
- AVAHI_CHROOT_UNLINK_SOCKET,
- AVAHI_CHROOT_MAX
-};
-
-static const char* const get_file_name_table[AVAHI_CHROOT_MAX] = {
- NULL,
- NULL,
- "/etc/resolv.conf",
-#ifdef HAVE_DBUS
- AVAHI_DBUS_INTROSPECTION_DIR"/Server.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/EntryGroup.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/AddressResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/DomainBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/HostNameResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceTypeBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/RecordBrowser.introspect",
-#endif
- NULL,
- NULL
-};
-
-static const char *const unlink_file_name_table[AVAHI_CHROOT_MAX] = {
- NULL,
- NULL,
- NULL,
-#ifdef HAVE_DBUS
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-#endif
- AVAHI_DAEMON_RUNTIME_DIR"/pid",
- AVAHI_SOCKET
-};
-
-static int helper_fd = -1;
-
-static int send_fd(int fd, int payload_fd) {
- uint8_t dummy = AVAHI_CHROOT_SUCCESS;
- struct iovec iov;
- struct msghdr msg;
- union {
- struct cmsghdr hdr;
- char buf[CMSG_SPACE(sizeof(int))];
- } cmsg;
-
- /* Send a file descriptor over the socket */
-
- memset(&iov, 0, sizeof(iov));
- memset(&msg, 0, sizeof(msg));
- memset(&cmsg, 0, sizeof(cmsg));
-
- iov.iov_base = &dummy;
- iov.iov_len = sizeof(dummy);
-
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
-
- msg.msg_control = &cmsg;
- msg.msg_controllen = sizeof(cmsg);
- msg.msg_flags = 0;
-
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
- cmsg.hdr.cmsg_level = SOL_SOCKET;
- cmsg.hdr.cmsg_type = SCM_RIGHTS;
- *((int*) CMSG_DATA(&cmsg.hdr)) = payload_fd;
-
- if (sendmsg(fd, &msg, 0) < 0) {
- avahi_log_error("sendmsg() failed: %s", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int recv_fd(int fd) {
- uint8_t dummy;
- struct iovec iov;
- struct msghdr msg;
- union {
- struct cmsghdr hdr;
- char buf[CMSG_SPACE(sizeof(int))];
- } cmsg;
-
- /* Receive a file descriptor from a socket */
-
- memset(&iov, 0, sizeof(iov));
- memset(&msg, 0, sizeof(msg));
- memset(&cmsg, 0, sizeof(cmsg));
-
- iov.iov_base = &dummy;
- iov.iov_len = sizeof(dummy);
-
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
-
- msg.msg_control = cmsg.buf;
- msg.msg_controllen = sizeof(cmsg);
- msg.msg_flags = 0;
-
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
- cmsg.hdr.cmsg_level = SOL_SOCKET;
- cmsg.hdr.cmsg_type = SCM_RIGHTS;
- *((int*) CMSG_DATA(&cmsg.hdr)) = -1;
-
- if (recvmsg(fd, &msg, 0) <= 0) {
- avahi_log_error("recvmsg() failed: %s", strerror(errno));
- return -1;
- } else {
- struct cmsghdr* h;
-
- if (dummy != AVAHI_CHROOT_SUCCESS) {
- errno = EINVAL;
- return -1;
- }
-
- if (!(h = CMSG_FIRSTHDR(&msg))) {
- avahi_log_error("recvmsg() sent no fd.");
- errno = EINVAL;
- return -1;
- }
-
- assert(h->cmsg_len = CMSG_LEN(sizeof(int)));
- assert(h->cmsg_level = SOL_SOCKET);
- assert(h->cmsg_type == SCM_RIGHTS);
-
- return *((int*)CMSG_DATA(h));
- }
-}
-
-static int helper_main(int fd) {
- int ret = 1;
- assert(fd >= 0);
-
- /* This is the main function of our helper process which is forked
- * off to access files outside the chroot environment. Keep in
- * mind that this code is security sensitive! */
-
- avahi_log_debug(__FILE__": chroot() helper started");
-
- for (;;) {
- uint8_t command;
- ssize_t r;
-
- if ((r = read(fd, &command, sizeof(command))) <= 0) {
-
- /* EOF? */
- if (r == 0)
- break;
-
- avahi_log_error(__FILE__": read() failed: %s", strerror(errno));
- goto fail;
- }
-
- assert(r == sizeof(command));
-
- avahi_log_debug(__FILE__": chroot() helper got command %02x", command);
-
- switch (command) {
-#ifdef HAVE_DBUS
- case AVAHI_CHROOT_GET_SERVER_INTROSPECT:
- case AVAHI_CHROOT_GET_ENTRY_GROUP_INTROSPECT:
- case AVAHI_CHROOT_GET_ADDRESS_RESOLVER_INTROSPECT:
- case AVAHI_CHROOT_GET_DOMAIN_BROWSER_INTROSPECT:
- case AVAHI_CHROOT_GET_HOST_NAME_RESOLVER_INTROSPECT:
- case AVAHI_CHROOT_GET_SERVICE_BROWSER_INTROSPECT:
- case AVAHI_CHROOT_GET_SERVICE_RESOLVER_INTROSPECT:
- case AVAHI_CHROOT_GET_SERVICE_TYPE_BROWSER_INTROSPECT:
- case AVAHI_CHROOT_GET_RECORD_BROWSER_INTROSPECT:
-#endif
- case AVAHI_CHROOT_GET_RESOLV_CONF: {
- int payload;
-
- if ((payload = open(get_file_name_table[(int) command], O_RDONLY)) < 0) {
- uint8_t c = AVAHI_CHROOT_FAILURE;
-
- avahi_log_error(__FILE__": open() failed: %s", strerror(errno));
-
- if (write(fd, &c, sizeof(c)) != sizeof(c)) {
- avahi_log_error(__FILE__": write() failed: %s\n", strerror(errno));
- goto fail;
- }
-
- break;
- }
-
- if (send_fd(fd, payload) < 0)
- goto fail;
-
- close(payload);
-
- break;
- }
-
- case AVAHI_CHROOT_UNLINK_SOCKET:
- case AVAHI_CHROOT_UNLINK_PID: {
- uint8_t c = AVAHI_CHROOT_SUCCESS;
-
- unlink(unlink_file_name_table[(int) command]);
-
- if (write(fd, &c, sizeof(c)) != sizeof(c)) {
- avahi_log_error(__FILE__": write() failed: %s\n", strerror(errno));
- goto fail;
- }
-
- break;
- }
-
- default:
- avahi_log_error(__FILE__": Unknown command %02x.", command);
- break;
- }
- }
-
- ret = 0;
-
-fail:
-
- avahi_log_debug(__FILE__": chroot() helper exiting with return value %i", ret);
-
- return ret;
-}
-
-int avahi_chroot_helper_start(const char *argv0) {
- int sock[2];
- pid_t pid;
-
- assert(helper_fd < 0);
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, sock) < 0) {
- avahi_log_error("socketpair() failed: %s", strerror(errno));
- return -1;
- }
-
- if ((pid = fork()) < 0) {
- close(sock[0]);
- close(sock[1]);
- avahi_log_error(__FILE__": fork() failed: %s", strerror(errno));
- return -1;
- } else if (pid == 0) {
-
- setsid();
-
- /* Drop all remaining capabilities */
- avahi_caps_drop_all();
-
- avahi_set_proc_title("%s: chroot helper process", argv0);
-
- close(sock[0]);
- helper_main(sock[1]);
- _exit(0);
- }
-
- close(sock[1]);
- helper_fd = sock[0];
-
- return 0;
-}
-
-void avahi_chroot_helper_shutdown(void) {
-
- if (helper_fd <= 0)
- return;
-
- close(helper_fd);
- helper_fd = -1;
-}
-
-int avahi_chroot_helper_get_fd(const char *fname) {
-
- if (helper_fd >= 0) {
- uint8_t command;
-
- for (command = 2; command < AVAHI_CHROOT_MAX; command++)
- if (get_file_name_table[(int) command] &&
- strcmp(fname, get_file_name_table[(int) command]) == 0)
- break;
-
- if (command >= AVAHI_CHROOT_MAX) {
- avahi_log_error("chroot() helper accessed for invalid file name");
- errno = EACCES;
- return -1;
- }
-
- assert(get_file_name_table[(int) command]);
-
- if (write(helper_fd, &command, sizeof(command)) < 0) {
- avahi_log_error("write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- return recv_fd(helper_fd);
-
- } else
- return open(fname, O_RDONLY);
-}
-
-
-FILE *avahi_chroot_helper_get_file(const char *fname) {
- FILE *f;
- int fd;
-
- if ((fd = avahi_chroot_helper_get_fd(fname)) < 0)
- return NULL;
-
- f = fdopen(fd, "r");
- assert(f);
-
- return f;
-}
-
-int avahi_chroot_helper_unlink(const char *fname) {
-
- if (helper_fd >= 0) {
- uint8_t c, command;
- ssize_t r;
-
- for (command = 2; command < AVAHI_CHROOT_MAX; command++)
- if (unlink_file_name_table[(int) command] &&
- strcmp(fname, unlink_file_name_table[(int) command]) == 0)
- break;
-
- if (command >= AVAHI_CHROOT_MAX) {
- avahi_log_error("chroot() helper accessed for invalid file name");
- errno = EACCES;
- return -1;
- }
-
- if (write(helper_fd, &command, sizeof(command)) < 0) {
- avahi_log_error("write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- if ((r = read(helper_fd, &c, sizeof(c))) < 0) {
- avahi_log_error("read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- return -1;
- }
-
- return 0;
-
- } else
-
- return unlink(fname);
-
-}
diff --git a/release-0.6.9/avahi-daemon/chroot.h b/release-0.6.9/avahi-daemon/chroot.h
deleted file mode 100644
index ea61c5a..0000000
--- a/release-0.6.9/avahi-daemon/chroot.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef foochroothelperhfoo
-#define foochroothelperhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-
-int avahi_chroot_helper_start(const char *argv0);
-void avahi_chroot_helper_shutdown(void);
-int avahi_chroot_helper_get(const char *fname);
-
-int avahi_chroot_helper_get_fd(const char *fname);
-FILE *avahi_chroot_helper_get_file(const char *fname);
-
-int avahi_chroot_helper_unlink(const char *fname);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/dbus-async-address-resolver.c b/release-0.6.9/avahi-daemon/dbus-async-address-resolver.c
deleted file mode 100644
index f51d205..0000000
--- a/release-0.6.9/avahi-daemon/dbus-async-address-resolver.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i) {
- assert(i);
-
- if (i->address_resolver)
- avahi_s_address_resolver_free(i->address_resolver);
- dbus_connection_unregister_object_path(server->bus, i->path);
- AVAHI_LLIST_REMOVE(AsyncAddressResolverInfo, async_address_resolvers, i->client->async_address_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata) {
- AsyncAddressResolverInfo *i = userdata;
- DBusMessage *reply;
-
- assert(r);
- assert(i);
-
- reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, avahi_dbus_map_resolve_signal_name(event));
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
-
- assert(address);
- assert(host_name);
- avahi_address_snprint(t, sizeof(t), address);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) address->proto;
- u_flags = (uint32_t) flags;
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_append_server_error(reply);
- }
-
- dbus_message_set_destination(reply, i->client->name);
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
-}
-
-DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- AsyncAddressResolverInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "AddressResolver.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing AddressResolver::Free message");
- goto fail;
- }
-
- avahi_dbus_async_address_resolver_free(i);
- return avahi_dbus_respond_ok(c, m);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
diff --git a/release-0.6.9/avahi-daemon/dbus-async-host-name-resolver.c b/release-0.6.9/avahi-daemon/dbus-async-host-name-resolver.c
deleted file mode 100644
index 38b5c2a..0000000
--- a/release-0.6.9/avahi-daemon/dbus-async-host-name-resolver.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i) {
- assert(i);
-
- if (i->host_name_resolver)
- avahi_s_host_name_resolver_free(i->host_name_resolver);
- dbus_connection_unregister_object_path(server->bus, i->path);
- AVAHI_LLIST_REMOVE(AsyncHostNameResolverInfo, async_host_name_resolvers, i->client->async_host_name_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_async_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata) {
- AsyncHostNameResolverInfo *i = userdata;
- DBusMessage *reply;
-
- assert(r);
- assert(i);
-
- reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, avahi_dbus_map_resolve_signal_name(event));
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
-
- assert(a);
- assert(host_name);
- avahi_address_snprint(t, sizeof(t), a);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) a->proto;
- u_flags = (uint32_t) flags;
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_append_server_error(reply);
- }
-
- dbus_message_set_destination(reply, i->client->name);
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
-}
-
-DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- AsyncHostNameResolverInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "HostNameResolver.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing HostNameResolver::Free message");
- goto fail;
- }
-
- avahi_dbus_async_host_name_resolver_free(i);
- return avahi_dbus_respond_ok(c, m);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
diff --git a/release-0.6.9/avahi-daemon/dbus-async-service-resolver.c b/release-0.6.9/avahi-daemon/dbus-async-service-resolver.c
deleted file mode 100644
index 9fea5a1..0000000
--- a/release-0.6.9/avahi-daemon/dbus-async-service-resolver.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i) {
- assert(i);
-
- if (i->service_resolver)
- avahi_s_service_resolver_free(i->service_resolver);
-
- dbus_connection_unregister_object_path(server->bus, i->path);
- AVAHI_LLIST_REMOVE(AsyncServiceResolverInfo, async_service_resolvers, i->client->async_service_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_async_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AsyncServiceResolverInfo *i = userdata;
- DBusMessage *reply;
-
- assert(r);
- assert(i);
-
- reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, avahi_dbus_map_resolve_signal_name(event));
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
-
- assert(host_name);
-
-/* avahi_log_debug(__FILE__": [%s] Successfully resolved service <%s.%s.%s>", i->path, name, type, domain); */
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
- else
- t[0] = 0;
-
- if (!name)
- name = "";
-
- if (avahi_dbus_is_our_own_service(i->client, interface, protocol, name, type, domain) > 0)
- flags |= AVAHI_LOOKUP_RESULT_OUR_OWN;
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- if (a)
- i_aprotocol = (int32_t) a->proto;
- else
- i_aprotocol = AVAHI_PROTO_UNSPEC;
- u_flags = (uint32_t) flags;
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID);
-
- avahi_dbus_append_string_list(reply, txt);
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_append_server_error(reply);
- }
-
- dbus_message_set_destination(reply, i->client->name);
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
-}
-
-DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- AsyncServiceResolverInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceResolver.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing ServiceResolver::Free message");
- goto fail;
- }
-
- avahi_dbus_async_service_resolver_free(i);
- return avahi_dbus_respond_ok(c, m);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
diff --git a/release-0.6.9/avahi-daemon/dbus-domain-browser.c b/release-0.6.9/avahi-daemon/dbus-domain-browser.c
deleted file mode 100644
index a17de8f..0000000
--- a/release-0.6.9/avahi-daemon/dbus-domain-browser.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_domain_browser_free(DomainBrowserInfo *i) {
- assert(i);
-
- if (i->domain_browser)
- avahi_s_domain_browser_free(i->domain_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- AVAHI_LLIST_REMOVE(DomainBrowserInfo, domain_browsers, i->client->domain_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- DomainBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "DomainBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing DomainBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_domain_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
- DomainBrowserInfo *i = userdata;
- DBusMessage *m;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- assert(domain);
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
diff --git a/release-0.6.9/avahi-daemon/dbus-entry-group.c b/release-0.6.9/avahi-daemon/dbus-entry-group.c
deleted file mode 100644
index 1d8c957..0000000
--- a/release-0.6.9/avahi-daemon/dbus-entry-group.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_entry_group_free(EntryGroupInfo *i) {
- assert(i);
-
- if (i->entry_group)
- avahi_s_entry_group_free(i->entry_group);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- AVAHI_LLIST_REMOVE(EntryGroupInfo, entry_groups, i->client->entry_groups, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata) {
- EntryGroupInfo *i = userdata;
- DBusMessage *m;
- int32_t t;
- const char *e;
-
- assert(s);
- assert(g);
- assert(i);
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "StateChanged");
-
- t = (int32_t) state;
- if (state == AVAHI_ENTRY_GROUP_FAILURE)
- e = avahi_error_number_to_dbus(avahi_server_errno(s));
- else if (state == AVAHI_ENTRY_GROUP_COLLISION)
- e = AVAHI_DBUS_ERR_COLLISION;
- else
- e = AVAHI_DBUS_ERR_OK;
-
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &t,
- DBUS_TYPE_STRING, &e,
- DBUS_TYPE_INVALID);
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
-DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- EntryGroupInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "EntryGroup.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::Free message");
- goto fail;
- }
-
- avahi_dbus_entry_group_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "Commit")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::Commit message");
- goto fail;
- }
-
- if (avahi_s_entry_group_commit(i->entry_group) < 0)
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
-
- return avahi_dbus_respond_ok(c, m);
-
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "Reset")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::Reset message");
- goto fail;
- }
-
- avahi_s_entry_group_reset(i->entry_group);
- i->n_entries = 0;
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "IsEmpty")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::IsEmpty message");
- goto fail;
- }
-
- return avahi_dbus_respond_boolean(c, m, !!avahi_s_entry_group_is_empty(i->entry_group));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "GetState")) {
- AvahiEntryGroupState state;
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::GetState message");
- goto fail;
- }
-
- state = avahi_s_entry_group_get_state(i->entry_group);
- return avahi_dbus_respond_int32(c, m, (int32_t) state);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddService")) {
- int32_t interface, protocol;
- uint32_t flags;
- char *type, *name, *domain, *host;
- uint16_t port;
- AvahiStringList *strlst = NULL;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID) ||
- !type || !name ||
- avahi_dbus_read_strlst(m, 8, &strlst) < 0) {
- avahi_log_warn("Error parsing EntryGroup::AddService message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX) {
- avahi_string_list_free(strlst);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
- }
-
- if (domain && !*domain)
- domain = NULL;
-
- if (host && !*host)
- host = NULL;
-
- if (avahi_server_add_service_strlst(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, type, domain, host, port, strlst) < 0) {
- avahi_string_list_free(strlst);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- avahi_string_list_free(strlst);
-
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddServiceSubtype")) {
-
- int32_t interface, protocol;
- uint32_t flags;
- char *type, *name, *domain, *subtype;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &subtype,
- DBUS_TYPE_INVALID) || !type || !name || !subtype) {
- avahi_log_warn("Error parsing EntryGroup::AddServiceSubtype message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
-
- if (domain && !*domain)
- domain = NULL;
-
- if (avahi_server_add_service_subtype(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, type, domain, subtype) < 0)
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "UpdateServiceTxt")) {
- int32_t interface, protocol;
- uint32_t flags;
- char *type, *name, *domain;
- AvahiStringList *strlst;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INVALID) ||
- !type || !name ||
- avahi_dbus_read_strlst(m, 6, &strlst)) {
- avahi_log_warn("Error parsing EntryGroup::UpdateServiceTxt message");
- goto fail;
- }
-
- if (domain && !*domain)
- domain = NULL;
-
- if (avahi_server_update_service_txt_strlst(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, type, domain, strlst) < 0) {
- avahi_string_list_free(strlst);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_string_list_free(strlst);
-
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddAddress")) {
- int32_t interface, protocol;
- uint32_t flags;
- char *name, *address;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_INVALID) || !name || !address) {
- avahi_log_warn("Error parsing EntryGroup::AddAddress message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
-
- if (!(avahi_address_parse(address, AVAHI_PROTO_UNSPEC, &a)))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_ADDRESS, NULL);
-
- if (avahi_server_add_address(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, &a) < 0)
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- return avahi_dbus_respond_ok(c, m);
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddRecord")) {
- int32_t interface, protocol;
- uint32_t flags, ttl, size;
- uint16_t clazz, type;
- char *name;
- void *rdata;
- AvahiRecord *r;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &ttl,
- DBUS_TYPE_INVALID) || !name ||
- avahi_dbus_read_rdata (m, 7, &rdata, &size)) {
- avahi_log_warn("Error parsing EntryGroup::AddRecord message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
-
- if (!avahi_is_valid_domain_name (name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_DOMAIN_NAME, NULL);
-
- if (!(r = avahi_record_new_full (name, clazz, type, ttl)))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_NO_MEMORY, NULL);
-
- if (avahi_rdata_parse (r, rdata, size) < 0) {
- avahi_record_unref (r);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_RDATA, NULL);
- }
-
- if (avahi_server_add(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, r) < 0) {
- avahi_record_unref (r);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- avahi_record_unref (r);
-
- return avahi_dbus_respond_ok(c, m);
- }
-
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
diff --git a/release-0.6.9/avahi-daemon/dbus-internal.h b/release-0.6.9/avahi-daemon/dbus-internal.h
deleted file mode 100644
index f91407e..0000000
--- a/release-0.6.9/avahi-daemon/dbus-internal.h
+++ /dev/null
@@ -1,248 +0,0 @@
-#ifndef foodbusinternalhfoo
-#define foodbusinternalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-#include <dbus/dbus.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-
-#include <avahi-common/llist.h>
-
-typedef struct Server Server;
-typedef struct Client Client;
-typedef struct EntryGroupInfo EntryGroupInfo;
-typedef struct SyncHostNameResolverInfo SyncHostNameResolverInfo;
-typedef struct AsyncHostNameResolverInfo AsyncHostNameResolverInfo;
-typedef struct SyncAddressResolverInfo SyncAddressResolverInfo;
-typedef struct AsyncAddressResolverInfo AsyncAddressResolverInfo;
-typedef struct DomainBrowserInfo DomainBrowserInfo;
-typedef struct ServiceTypeBrowserInfo ServiceTypeBrowserInfo;
-typedef struct ServiceBrowserInfo ServiceBrowserInfo;
-typedef struct SyncServiceResolverInfo SyncServiceResolverInfo;
-typedef struct AsyncServiceResolverInfo AsyncServiceResolverInfo;
-typedef struct RecordBrowserInfo RecordBrowserInfo;
-
-#define CLIENTS_MAX 256
-#define OBJECTS_PER_CLIENT_MAX 250
-#define ENTRIES_PER_ENTRY_GROUP_MAX 20
-
-struct EntryGroupInfo {
- unsigned id;
- Client *client;
- AvahiSEntryGroup *entry_group;
- char *path;
-
- int n_entries;
-
- AVAHI_LLIST_FIELDS(EntryGroupInfo, entry_groups);
-};
-
-struct SyncHostNameResolverInfo {
- Client *client;
- AvahiSHostNameResolver *host_name_resolver;
- DBusMessage *message;
-
- AVAHI_LLIST_FIELDS(SyncHostNameResolverInfo, sync_host_name_resolvers);
-};
-
-struct AsyncHostNameResolverInfo {
- unsigned id;
- Client *client;
- AvahiSHostNameResolver *host_name_resolver;
- char *path;
-
- AVAHI_LLIST_FIELDS(AsyncHostNameResolverInfo, async_host_name_resolvers);
-};
-
-struct SyncAddressResolverInfo {
- Client *client;
- AvahiSAddressResolver *address_resolver;
- DBusMessage *message;
-
- AVAHI_LLIST_FIELDS(SyncAddressResolverInfo, sync_address_resolvers);
-};
-
-struct AsyncAddressResolverInfo {
- unsigned id;
- Client *client;
- AvahiSAddressResolver *address_resolver;
- char *path;
-
- AVAHI_LLIST_FIELDS(AsyncAddressResolverInfo, async_address_resolvers);
-};
-
-struct DomainBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSDomainBrowser *domain_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(DomainBrowserInfo, domain_browsers);
-};
-
-struct ServiceTypeBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSServiceTypeBrowser *service_type_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(ServiceTypeBrowserInfo, service_type_browsers);
-};
-
-struct ServiceBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSServiceBrowser *service_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(ServiceBrowserInfo, service_browsers);
-};
-
-struct SyncServiceResolverInfo {
- Client *client;
- AvahiSServiceResolver *service_resolver;
- DBusMessage *message;
-
- AVAHI_LLIST_FIELDS(SyncServiceResolverInfo, sync_service_resolvers);
-};
-
-struct AsyncServiceResolverInfo {
- unsigned id;
- Client *client;
- AvahiSServiceResolver *service_resolver;
- char *path;
-
- AVAHI_LLIST_FIELDS(AsyncServiceResolverInfo, async_service_resolvers);
-};
-
-struct RecordBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSRecordBrowser *record_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(RecordBrowserInfo, record_browsers);
-};
-
-struct Client {
- unsigned id;
- char *name;
- unsigned current_id;
- int n_objects;
-
- AVAHI_LLIST_FIELDS(Client, clients);
- AVAHI_LLIST_HEAD(EntryGroupInfo, entry_groups);
- AVAHI_LLIST_HEAD(SyncHostNameResolverInfo, sync_host_name_resolvers);
- AVAHI_LLIST_HEAD(AsyncHostNameResolverInfo, async_host_name_resolvers);
- AVAHI_LLIST_HEAD(SyncAddressResolverInfo, sync_address_resolvers);
- AVAHI_LLIST_HEAD(AsyncAddressResolverInfo, async_address_resolvers);
- AVAHI_LLIST_HEAD(DomainBrowserInfo, domain_browsers);
- AVAHI_LLIST_HEAD(ServiceTypeBrowserInfo, service_type_browsers);
- AVAHI_LLIST_HEAD(ServiceBrowserInfo, service_browsers);
- AVAHI_LLIST_HEAD(SyncServiceResolverInfo, sync_service_resolvers);
- AVAHI_LLIST_HEAD(AsyncServiceResolverInfo, async_service_resolvers);
- AVAHI_LLIST_HEAD(RecordBrowserInfo, record_browsers);
-};
-
-struct Server {
- DBusConnection *bus;
- AVAHI_LLIST_HEAD(Client, clients);
- int n_clients;
- unsigned current_id;
-};
-
-extern Server *server;
-
-void avahi_dbus_entry_group_free(EntryGroupInfo *i);
-void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
-DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_sync_host_name_resolver_free(SyncHostNameResolverInfo *i);
-void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i);
-void avahi_dbus_async_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata);
-DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_sync_address_resolver_free(SyncAddressResolverInfo *i);
-void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i);
-void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata);
-DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_domain_browser_free(DomainBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_service_browser_free(ServiceBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i);
-
-void avahi_dbus_sync_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata);
-
-void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i);
-void avahi_dbus_async_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata);
-
-DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_record_browser_free(RecordBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_record_browser_callback(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, AvahiLookupResultFlags flags, void* userdata);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/dbus-protocol.c b/release-0.6.9/avahi-daemon/dbus-protocol.c
deleted file mode 100644
index 2e3fd2f..0000000
--- a/release-0.6.9/avahi-daemon/dbus-protocol.c
+++ /dev/null
@@ -1,1107 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <errno.h>
-#include <unistd.h>
-#include <assert.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <signal.h>
-#include <stdlib.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/dbus-watch-glue.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-
-#include <avahi-core/log.h>
-#include <avahi-core/core.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/publish.h>
-
-#include "dbus-protocol.h"
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-/* #define VALGRIND_WORKAROUND 1 */
-
-Server *server = NULL;
-
-static int disable_user_service_publishing = 0;
-
-static void client_free(Client *c) {
-
- assert(server);
- assert(c);
-
- while (c->entry_groups)
- avahi_dbus_entry_group_free(c->entry_groups);
-
- while (c->sync_host_name_resolvers)
- avahi_dbus_sync_host_name_resolver_free(c->sync_host_name_resolvers);
-
- while (c->async_host_name_resolvers)
- avahi_dbus_async_host_name_resolver_free(c->async_host_name_resolvers);
-
- while (c->sync_address_resolvers)
- avahi_dbus_sync_address_resolver_free(c->sync_address_resolvers);
-
- while (c->async_address_resolvers)
- avahi_dbus_async_address_resolver_free(c->async_address_resolvers);
-
- while (c->domain_browsers)
- avahi_dbus_domain_browser_free(c->domain_browsers);
-
- while (c->service_type_browsers)
- avahi_dbus_service_type_browser_free(c->service_type_browsers);
-
- while (c->service_browsers)
- avahi_dbus_service_browser_free(c->service_browsers);
-
- while (c->sync_service_resolvers)
- avahi_dbus_sync_service_resolver_free(c->sync_service_resolvers);
-
- while (c->async_service_resolvers)
- avahi_dbus_async_service_resolver_free(c->async_service_resolvers);
-
- while (c->record_browsers)
- avahi_dbus_record_browser_free(c->record_browsers);
-
- assert(c->n_objects == 0);
-
- avahi_free(c->name);
- AVAHI_LLIST_REMOVE(Client, clients, server->clients, c);
- avahi_free(c);
-
- server->n_clients --;
- assert(server->n_clients >= 0);
-}
-
-static Client *client_get(const char *name, int create) {
- Client *client;
-
- assert(server);
- assert(name);
-
- for (client = server->clients; client; client = client->clients_next)
- if (!strcmp(name, client->name))
- return client;
-
- if (!create)
- return NULL;
-
- if (server->n_clients >= CLIENTS_MAX)
- return NULL;
-
- /* If not existant yet, create a new entry */
- client = avahi_new(Client, 1);
- client->id = server->current_id++;
- client->name = avahi_strdup(name);
- client->current_id = 0;
- client->n_objects = 0;
-
- AVAHI_LLIST_HEAD_INIT(EntryGroupInfo, client->entry_groups);
- AVAHI_LLIST_HEAD_INIT(SyncHostNameResolverInfo, client->sync_host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(AsyncHostNameResolverInfo, client->async_host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(SyncAddressResolverInfo, client->sync_address_resolvers);
- AVAHI_LLIST_HEAD_INIT(AsyncAddressResolverInfo, client->async_address_resolvers);
- AVAHI_LLIST_HEAD_INIT(DomainBrowserInfo, client->domain_browsers);
- AVAHI_LLIST_HEAD_INIT(ServiceTypeBrowserInfo, client->service_type_browsers);
- AVAHI_LLIST_HEAD_INIT(ServiceBrowserInfo, client->service_browsers);
- AVAHI_LLIST_HEAD_INIT(SyncServiceResolverInfo, client->sync_service_resolvers);
- AVAHI_LLIST_HEAD_INIT(AsyncServiceResolverInfo, client->async_service_resolvers);
- AVAHI_LLIST_HEAD_INIT(RecordBrowserInfo, client->record_browsers);
-
- AVAHI_LLIST_PREPEND(Client, clients, server->clients, client);
-
- server->n_clients++;
- assert(server->n_clients > 0);
-
- return client;
-}
-
-static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection *c, DBusMessage *m, AVAHI_GCC_UNUSED void *userdata) {
- DBusError error;
-
- dbus_error_init(&error);
-
-/* avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s", */
-/* dbus_message_get_interface(m), */
-/* dbus_message_get_path(m), */
-/* dbus_message_get_member(m)); */
-
- if (dbus_message_is_signal(m, DBUS_INTERFACE_LOCAL, "Disconnected")) {
- /* No, we shouldn't quit, but until we get somewhere
- * usefull such that we can restore our state, we will */
- avahi_log_warn("Disconnnected from D-BUS, terminating...");
-
- raise(SIGQUIT); /* The signal handler will catch this and terminate the process cleanly*/
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameAcquired")) {
- char *name;
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing NameAcquired message");
- goto fail;
- }
-
-/* avahi_log_info(__FILE__": name acquired (%s)", name); */
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
- char *name, *old, *new;
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &old, DBUS_TYPE_STRING, &new, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing NameOwnerChanged message");
- goto fail;
- }
-
- if (!*new) {
- Client *client;
-
- if ((client = client_get(name, FALSE))) {
- avahi_log_debug(__FILE__": client %s vanished.", name);
- client_free(client);
- }
- }
- }
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAHI_GCC_UNUSED void *userdata) {
- DBusError error;
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "Server.introspect");
-
- else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostName")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::GetHostName message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, avahi_server_get_host_name(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetDomainName")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::GetDomainName message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, avahi_server_get_domain_name(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostNameFqdn")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetHostNameFqdn message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, avahi_server_get_host_name_fqdn(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "IsNSSSupportAvailable")) {
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::IsNSSSupportAvailable message");
- goto fail;
- }
-
- return avahi_dbus_respond_boolean(c, m, nss_support);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetVersionString")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetVersionString message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, PACKAGE_STRING);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAPIVersion")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetAPIVersion message");
- goto fail;
- }
-
- return avahi_dbus_respond_uint32(c, m, AVAHI_DBUS_API_VERSION);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetState")) {
- AvahiServerState state;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetState message");
- goto fail;
- }
-
- state = avahi_server_get_state(avahi_server);
- return avahi_dbus_respond_int32(c, m, (int32_t) state);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetLocalServiceCookie")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetLocalServiceCookie message");
- goto fail;
- }
-
- return avahi_dbus_respond_uint32(c, m, avahi_server_get_local_service_cookie(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetNetworkInterfaceNameByIndex")) {
- int32_t idx;
- int fd;
- char name[IF_NAMESIZE];
-
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INT32, &idx, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetNetworkInterfaceNameByIndex message");
- goto fail;
- }
-
-#ifdef VALGRIND_WORKAROUND
- return respond_string(c, m, "blah");
-#else
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
- if ((!if_indextoname(idx, name))) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- close(fd);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
- close(fd);
-
- return avahi_dbus_respond_string(c, m, name);
-#endif
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetNetworkInterfaceIndexByName")) {
- char *n;
- int fd;
- int32_t idx;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID)) || !n) {
- avahi_log_warn("Error parsing Server::GetNetworkInterfaceIndexByName message");
- goto fail;
- }
-
-#ifdef VALGRIND_WORKAROUND
- return respond_int32(c, m, 1);
-#else
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
- if (!(idx = if_nametoindex(n))) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- close(fd);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
- close(fd);
-
- return avahi_dbus_respond_int32(c, m, idx);
-#endif
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAlternativeHostName")) {
- char *n, * t;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID)) || !n) {
- avahi_log_warn("Error parsing Server::GetAlternativeHostName message");
- goto fail;
- }
-
- t = avahi_alternative_host_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAlternativeServiceName")) {
- char *n, *t;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID)) || !n) {
- avahi_log_warn("Error parsing Server::GetAlternativeServiceName message");
- goto fail;
- }
-
- t = avahi_alternative_service_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "EntryGroupNew")) {
- Client *client;
- EntryGroupInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_entry_group_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::EntryGroupNew message");
- goto fail;
- }
-
- if (disable_user_service_publishing)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_PERMITTED, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(EntryGroupInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
- i->n_entries = 0;
- AVAHI_LLIST_PREPEND(EntryGroupInfo, entry_groups, client->entry_groups, i);
- client->n_objects++;
-
- if (!(i->entry_group = avahi_s_entry_group_new(avahi_server, avahi_dbus_entry_group_callback, i))) {
- avahi_dbus_entry_group_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveHostName")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name;
- SyncHostNameResolverInfo *i;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !name) {
- avahi_log_warn("Error parsing Server::ResolveHostName message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(SyncHostNameResolverInfo, 1);
- i->client = client;
- i->message = dbus_message_ref(m);
- AVAHI_LLIST_PREPEND(SyncHostNameResolverInfo, sync_host_name_resolvers, client->sync_host_name_resolvers, i);
- client->n_objects++;
-
- if (!(i->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, (AvahiProtocol) aprotocol, (AvahiLookupFlags) flags, avahi_dbus_sync_host_name_resolver_callback, i))) {
- avahi_dbus_sync_host_name_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveAddress")) {
- Client *client;
- int32_t interface, protocol;
- uint32_t flags;
- char *address;
- SyncAddressResolverInfo *i;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !address) {
- avahi_log_warn("Error parsing Server::ResolveAddress message");
- goto fail;
- }
-
- if (!avahi_address_parse(address, AVAHI_PROTO_UNSPEC, &a))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_ADDRESS, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(SyncAddressResolverInfo, 1);
- i->client = client;
- i->message = dbus_message_ref(m);
- AVAHI_LLIST_PREPEND(SyncAddressResolverInfo, sync_address_resolvers, client->sync_address_resolvers, i);
- client->n_objects++;
-
- if (!(i->address_resolver = avahi_s_address_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, &a, (AvahiLookupFlags) flags, avahi_dbus_sync_address_resolver_callback, i))) {
- avahi_dbus_sync_address_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "DomainBrowserNew")) {
- Client *client;
- DomainBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_domain_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol, type;
- uint32_t flags;
- char *domain;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &type,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || type < 0 || type >= AVAHI_DOMAIN_BROWSER_MAX) {
- avahi_log_warn("Error parsing Server::DomainBrowserNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- i = avahi_new(DomainBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
- AVAHI_LLIST_PREPEND(DomainBrowserInfo, domain_browsers, client->domain_browsers, i);
- client->n_objects++;
-
- if (!(i->domain_browser = avahi_s_domain_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, (AvahiDomainBrowserType) type, (AvahiLookupFlags) flags, avahi_dbus_domain_browser_callback, i))) {
- avahi_dbus_domain_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ServiceTypeBrowserNew")) {
- Client *client;
- ServiceTypeBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_service_type_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol;
- uint32_t flags;
- char *domain;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::ServiceTypeBrowserNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- i = avahi_new(ServiceTypeBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
- AVAHI_LLIST_PREPEND(ServiceTypeBrowserInfo, service_type_browsers, client->service_type_browsers, i);
- client->n_objects++;
-
- if (!(i->service_type_browser = avahi_s_service_type_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, (AvahiLookupFlags) flags, avahi_dbus_service_type_browser_callback, i))) {
- avahi_dbus_service_type_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ServiceBrowserNew")) {
- Client *client;
- ServiceBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_service_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol;
- uint32_t flags;
- char *domain, *type;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !type) {
- avahi_log_warn("Error parsing Server::ServiceBrowserNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- i = avahi_new(ServiceBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
- AVAHI_LLIST_PREPEND(ServiceBrowserInfo, service_browsers, client->service_browsers, i);
- client->n_objects++;
-
- if (!(i->service_browser = avahi_s_service_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, type, domain, (AvahiLookupFlags) flags, avahi_dbus_service_browser_callback, i))) {
- avahi_dbus_service_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveService")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *type, *domain;
- SyncServiceResolverInfo *i;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !type) {
- avahi_log_warn("Error parsing Server::ResolveService message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- if (!*name)
- name = NULL;
-
- i = avahi_new(SyncServiceResolverInfo, 1);
- i->client = client;
- i->message = dbus_message_ref(m);
- AVAHI_LLIST_PREPEND(SyncServiceResolverInfo, sync_service_resolvers, client->sync_service_resolvers, i);
- client->n_objects++;
-
- if (!(i->service_resolver = avahi_s_service_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, type, domain, (AvahiProtocol) aprotocol, (AvahiLookupFlags) flags, avahi_dbus_sync_service_resolver_callback, i))) {
- avahi_dbus_sync_service_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ServiceResolverNew")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *type, *domain;
- AsyncServiceResolverInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_async_service_resolver_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !type) {
- avahi_log_warn("Error parsing Server::ServiceResolverNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn(__FILE__": Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn(__FILE__": Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- if (!*name)
- name = NULL;
-
- i = avahi_new(AsyncServiceResolverInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/ServiceResolver%u", client->id, i->id);
- AVAHI_LLIST_PREPEND(AsyncServiceResolverInfo, async_service_resolvers, client->async_service_resolvers, i);
- client->n_objects++;
-
- if (!(i->service_resolver = avahi_s_service_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, type, domain, (AvahiProtocol) aprotocol, (AvahiLookupFlags) flags, avahi_dbus_async_service_resolver_callback, i))) {
- avahi_dbus_async_service_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
-/* avahi_log_debug(__FILE__": [%s], new service resolver for <%s.%s.%s>", i->path, name, type, domain); */
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "HostNameResolverNew")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name;
- AsyncHostNameResolverInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_async_host_name_resolver_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !name) {
- avahi_log_warn("Error parsing Server::HostNameResolverNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn(__FILE__": Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn(__FILE__": Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(AsyncHostNameResolverInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/HostNameResolver%u", client->id, i->id);
- AVAHI_LLIST_PREPEND(AsyncHostNameResolverInfo, async_host_name_resolvers, client->async_host_name_resolvers, i);
- client->n_objects++;
-
- if (!(i->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, aprotocol, (AvahiLookupFlags) flags, avahi_dbus_async_host_name_resolver_callback, i))) {
- avahi_dbus_async_host_name_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "AddressResolverNew")) {
- Client *client;
- int32_t interface, protocol;
- uint32_t flags;
- char *address;
- AsyncAddressResolverInfo *i;
- AvahiAddress a;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_async_address_resolver_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !address) {
- avahi_log_warn("Error parsing Server::AddressResolverNew message");
- goto fail;
- }
-
- if (!avahi_address_parse(address, AVAHI_PROTO_UNSPEC, &a))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_ADDRESS, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn(__FILE__": Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn(__FILE__": Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(AsyncAddressResolverInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/AddressResolver%u", client->id, i->id);
- AVAHI_LLIST_PREPEND(AsyncAddressResolverInfo, async_address_resolvers, client->async_address_resolvers, i);
- client->n_objects++;
-
- if (!(i->address_resolver = avahi_s_address_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, &a, (AvahiLookupFlags) flags, avahi_dbus_async_address_resolver_callback, i))) {
- avahi_dbus_async_address_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "RecordBrowserNew")) {
- Client *client;
- RecordBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_record_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol;
- uint32_t flags;
- char *name;
- uint16_t type, clazz;
- AvahiKey *key;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !name) {
- avahi_log_warn("Error parsing Server::RecordBrowserNew message");
- goto fail;
- }
-
- if (!avahi_is_valid_domain_name(name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_DOMAIN_NAME, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(RecordBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);
- AVAHI_LLIST_PREPEND(RecordBrowserInfo, record_browsers, client->record_browsers, i);
- client->n_objects++;
-
- key = avahi_key_new(name, clazz, type);
- assert(key);
-
- if (!(i->record_browser = avahi_s_record_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, key, (AvahiLookupFlags) flags, avahi_dbus_record_browser_callback, i))) {
- avahi_key_unref(key);
- avahi_dbus_record_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_key_unref(key);
-
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void dbus_protocol_server_state_changed(AvahiServerState state) {
- DBusMessage *m;
- int32_t t;
- const char *e;
-
- if (!server)
- return;
-
- m = dbus_message_new_signal(AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "StateChanged");
- t = (int32_t) state;
-
- if (state == AVAHI_SERVER_COLLISION)
- e = AVAHI_DBUS_ERR_COLLISION;
- else if (state == AVAHI_SERVER_FAILURE)
- e = avahi_error_number_to_dbus(avahi_server_errno(avahi_server));
- else
- e = AVAHI_DBUS_ERR_OK;
-
- dbus_message_append_args(m, DBUS_TYPE_INT32, &t, DBUS_TYPE_STRING, &e, DBUS_TYPE_INVALID);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
-int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_publishing) {
- DBusError error;
-
- static const DBusObjectPathVTable server_vtable = {
- NULL,
- msg_server_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- dbus_error_init(&error);
-
- disable_user_service_publishing = _disable_user_service_publishing;
-
- server = avahi_new(Server, 1);
- AVAHI_LLIST_HEAD_INIT(Clients, server->clients);
- server->current_id = 0;
- server->n_clients = 0;
-
- if (!(server->bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) {
- assert(dbus_error_is_set(&error));
- avahi_log_error("dbus_bus_get(): %s", error.message);
- goto fail;
- }
-
- if (avahi_dbus_connection_glue(server->bus, poll_api) < 0) {
- avahi_log_error("avahi_dbus_connection_glue() failed");
- goto fail;
- }
-
- if (dbus_bus_request_name(
- server->bus,
- AVAHI_DBUS_NAME,
-#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 60)
- DBUS_NAME_FLAG_DO_NOT_QUEUE,
-#else
- DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT,
-#endif
- &error) != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- if (dbus_error_is_set(&error)) {
- avahi_log_error("dbus_bus_request_name(): %s", error.message);
- goto fail;
- }
-
- avahi_log_error("Failed to acquire DBUS name '"AVAHI_DBUS_NAME"'");
- goto fail;
- }
-
- if (!(dbus_connection_add_filter(server->bus, msg_signal_filter_impl, (void*) poll_api, NULL))) {
- avahi_log_error("dbus_connection_add_filter() failed");
- goto fail;
- }
-
- dbus_bus_add_match(server->bus, "type='signal',""interface='" DBUS_INTERFACE_DBUS "'", &error);
-
- if (dbus_error_is_set(&error)) {
- avahi_log_error("dbus_bus_add_match(): %s", error.message);
- goto fail;
- }
-
- if (!(dbus_connection_register_object_path(server->bus, AVAHI_DBUS_PATH_SERVER, &server_vtable, NULL))) {
- avahi_log_error("dbus_connection_register_object_path() failed");
- goto fail;
- }
-
- return 0;
-
-fail:
- if (server->bus) {
- dbus_connection_disconnect(server->bus);
- dbus_connection_unref(server->bus);
- }
-
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- avahi_free(server);
- server = NULL;
- return -1;
-}
-
-void dbus_protocol_shutdown(void) {
-
- if (server) {
-
- while (server->clients)
- client_free(server->clients);
-
- assert(server->n_clients == 0);
-
- if (server->bus) {
- dbus_connection_disconnect(server->bus);
- dbus_connection_unref(server->bus);
- }
-
- avahi_free(server);
- server = NULL;
- }
-}
diff --git a/release-0.6.9/avahi-daemon/dbus-protocol.h b/release-0.6.9/avahi-daemon/dbus-protocol.h
deleted file mode 100644
index d23b524..0000000
--- a/release-0.6.9/avahi-daemon/dbus-protocol.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef foodbusprotocolhfoo
-#define foodbusprotocolhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-int dbus_protocol_setup(const AvahiPoll *poll_api, int disable_user_service_publishing);
-void dbus_protocol_shutdown(void);
-void dbus_protocol_server_state_changed(AvahiServerState state);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/dbus-record-browser.c b/release-0.6.9/avahi-daemon/dbus-record-browser.c
deleted file mode 100644
index 0ddd7b8..0000000
--- a/release-0.6.9/avahi-daemon/dbus-record-browser.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_record_browser_free(RecordBrowserInfo *i) {
- assert(i);
-
- if (i->record_browser)
- avahi_s_record_browser_free(i->record_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- AVAHI_LLIST_REMOVE(RecordBrowserInfo, record_browsers, i->client->record_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- RecordBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "RecordBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing RecordBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_record_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_record_browser_callback(
- AvahiSRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- RecordBrowserInfo *i = userdata;
- DBusMessage *m = NULL;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- uint8_t rdata[0xFFFF];
- size_t size;
- assert(record);
-
- if (!(dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &record->key->name,
- DBUS_TYPE_UINT16, &record->key->clazz,
- DBUS_TYPE_UINT16, &record->key->type,
- DBUS_TYPE_INVALID)))
- goto fail;
-
- if ((size = avahi_rdata_serialize(record, rdata, sizeof(rdata))) == (size_t) -1 ||
- avahi_dbus_append_rdata(m, rdata, size) < 0) {
- avahi_log_debug(__FILE__": Failed to append rdata");
- dbus_message_unref(m);
- return;
- }
-
- dbus_message_append_args(
- m,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-
- return;
-
-fail:
-
- if (m)
- dbus_message_unref(m);
-}
diff --git a/release-0.6.9/avahi-daemon/dbus-service-browser.c b/release-0.6.9/avahi-daemon/dbus-service-browser.c
deleted file mode 100644
index 975cce9..0000000
--- a/release-0.6.9/avahi-daemon/dbus-service-browser.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_service_browser_free(ServiceBrowserInfo *i) {
- assert(i);
-
- if (i->service_browser)
- avahi_s_service_browser_free(i->service_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- AVAHI_LLIST_REMOVE(ServiceBrowserInfo, service_browsers, i->client->service_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- ServiceBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing ServiceBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_service_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
- ServiceBrowserInfo *i = userdata;
- DBusMessage *m;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW) {
- /* Patch in AVAHI_LOOKUP_RESULT_OUR_OWN */
-
- if (avahi_dbus_is_our_own_service(i->client, interface, protocol, name, type, domain) > 0)
- flags |= AVAHI_LOOKUP_RESULT_OUR_OWN;
- }
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- assert(name);
- assert(type);
- assert(domain);
-
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
diff --git a/release-0.6.9/avahi-daemon/dbus-service-type-browser.c b/release-0.6.9/avahi-daemon/dbus-service-type-browser.c
deleted file mode 100644
index ac2a17c..0000000
--- a/release-0.6.9/avahi-daemon/dbus-service-type-browser.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i) {
- assert(i);
-
- if (i->service_type_browser)
- avahi_s_service_type_browser_free(i->service_type_browser);
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- AVAHI_LLIST_REMOVE(ServiceTypeBrowserInfo, service_type_browsers, i->client->service_type_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- ServiceTypeBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceTypeBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing ServiceTypeBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_service_type_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
- ServiceTypeBrowserInfo *i = userdata;
- DBusMessage *m;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- assert(type);
- assert(domain);
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
-
diff --git a/release-0.6.9/avahi-daemon/dbus-sync-address-resolver.c b/release-0.6.9/avahi-daemon/dbus-sync-address-resolver.c
deleted file mode 100644
index 0a5fa59..0000000
--- a/release-0.6.9/avahi-daemon/dbus-sync-address-resolver.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_sync_address_resolver_free(SyncAddressResolverInfo *i) {
- assert(i);
-
- if (i->address_resolver)
- avahi_s_address_resolver_free(i->address_resolver);
- dbus_message_unref(i->message);
- AVAHI_LLIST_REMOVE(SyncAddressResolverInfo, sync_address_resolvers, i->client->sync_address_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata) {
- SyncAddressResolverInfo *i = userdata;
-
- assert(r);
- assert(address);
- assert(i);
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- DBusMessage *reply;
-
- assert(host_name);
- avahi_address_snprint(t, sizeof(t), address);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) address->proto;
- u_flags = (uint32_t) flags;
-
- reply = dbus_message_new_method_return(i->message);
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_respond_error(server->bus, i->message, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_dbus_sync_address_resolver_free(i);
-}
-
diff --git a/release-0.6.9/avahi-daemon/dbus-sync-host-name-resolver.c b/release-0.6.9/avahi-daemon/dbus-sync-host-name-resolver.c
deleted file mode 100644
index 9750dd4..0000000
--- a/release-0.6.9/avahi-daemon/dbus-sync-host-name-resolver.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_sync_host_name_resolver_free(SyncHostNameResolverInfo *i) {
- assert(i);
-
- if (i->host_name_resolver)
- avahi_s_host_name_resolver_free(i->host_name_resolver);
- dbus_message_unref(i->message);
- AVAHI_LLIST_REMOVE(SyncHostNameResolverInfo, sync_host_name_resolvers, i->client->sync_host_name_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata) {
- SyncHostNameResolverInfo *i = userdata;
-
- assert(r);
- assert(host_name);
- assert(i);
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- DBusMessage *reply;
-
- assert(a);
- avahi_address_snprint(t, sizeof(t), a);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) a->proto;
- u_flags = (uint32_t) flags;
-
- reply = dbus_message_new_method_return(i->message);
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_respond_error(server->bus, i->message, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_dbus_sync_host_name_resolver_free(i);
-}
-
diff --git a/release-0.6.9/avahi-daemon/dbus-sync-service-resolver.c b/release-0.6.9/avahi-daemon/dbus-sync-service-resolver.c
deleted file mode 100644
index 21ae481..0000000
--- a/release-0.6.9/avahi-daemon/dbus-sync-service-resolver.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i) {
- assert(i);
-
- if (i->service_resolver)
- avahi_s_service_resolver_free(i->service_resolver);
- dbus_message_unref(i->message);
- AVAHI_LLIST_REMOVE(SyncServiceResolverInfo, sync_service_resolvers, i->client->sync_service_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_sync_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- SyncServiceResolverInfo *i = userdata;
-
- assert(r);
- assert(i);
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- DBusMessage *reply;
-
- assert(host_name);
-
- if (!name)
- name = "";
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
- else
- t[0] = 0;
-
- /* Patch in AVAHI_LOOKUP_RESULT_OUR_OWN */
-
- if (avahi_dbus_is_our_own_service(i->client, interface, protocol, name, type, domain) > 0)
- flags |= AVAHI_LOOKUP_RESULT_OUR_OWN;
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- if (a)
- i_aprotocol = (int32_t) a->proto;
- else
- i_aprotocol = AVAHI_PROTO_UNSPEC;
- u_flags = (uint32_t) flags;
-
- reply = dbus_message_new_method_return(i->message);
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID);
-
- avahi_dbus_append_string_list(reply, txt);
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
-
- avahi_dbus_respond_error(server->bus, i->message, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_dbus_sync_service_resolver_free(i);
-}
diff --git a/release-0.6.9/avahi-daemon/dbus-util.c b/release-0.6.9/avahi-daemon/dbus-util.c
deleted file mode 100644
index c9ef949..0000000
--- a/release-0.6.9/avahi-daemon/dbus-util.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/malloc.h>
-#include <avahi-core/log.h>
-#include <avahi-core/core.h>
-
-#ifdef ENABLE_CHROOT
-#include "chroot.h"
-#endif
-
-#include "main.h"
-#include "dbus-util.h"
-
-DBusHandlerResult avahi_dbus_respond_error(DBusConnection *c, DBusMessage *m, int error, const char *text) {
- DBusMessage *reply;
-
- assert(-error > -AVAHI_OK);
- assert(-error < -AVAHI_ERR_MAX);
-
- if (!text)
- text = avahi_strerror(error);
-
- reply = dbus_message_new_error(m, avahi_error_number_to_dbus(error), text);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- avahi_log_debug(__FILE__": Responding error '%s' (%i)", text, error);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_string(DBusConnection *c, DBusMessage *m, const char *text) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &text, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_int32(DBusConnection *c, DBusMessage *m, int32_t i) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_uint32(DBusConnection *c, DBusMessage *m, uint32_t u) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_UINT32, &u, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_boolean(DBusConnection *c, DBusMessage *m, int b) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &b, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_ok(DBusConnection *c, DBusMessage *m) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_path(DBusConnection *c, DBusMessage *m, const char *path) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-void avahi_dbus_append_server_error(DBusMessage *reply) {
- const char *t;
-
- t = avahi_error_number_to_dbus(avahi_server_errno(avahi_server));
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_STRING, &t,
- DBUS_TYPE_INVALID);
-}
-
-const char *avahi_dbus_map_browse_signal_name(AvahiBrowserEvent e) {
- switch (e) {
- case AVAHI_BROWSER_NEW : return "ItemNew";
- case AVAHI_BROWSER_REMOVE : return "ItemRemove";
- case AVAHI_BROWSER_FAILURE : return "Failure";
- case AVAHI_BROWSER_CACHE_EXHAUSTED : return "CacheExhausted";
- case AVAHI_BROWSER_ALL_FOR_NOW : return "AllForNow";
- }
-
- abort();
-}
-
-const char *avahi_dbus_map_resolve_signal_name(AvahiResolverEvent e) {
- switch (e) {
- case AVAHI_RESOLVER_FOUND : return "Found";
- case AVAHI_RESOLVER_FAILURE : return "Failure";
- }
-
- abort();
-}
-
-static char *file_get_contents(const char *fname) {
- int fd = -1;
- struct stat st;
- ssize_t size;
- char *buf = NULL;
-
- assert(fname);
-
-#ifdef ENABLE_CHROOT
- fd = avahi_chroot_helper_get_fd(fname);
-#else
- fd = open(fname, O_RDONLY);
-#endif
-
- if (fd < 0) {
- avahi_log_error("Failed to open %s: %s", fname, strerror(errno));
- goto fail;
- }
-
- if (fstat(fd, &st) < 0) {
- avahi_log_error("stat(%s) failed: %s", fname, strerror(errno));
- goto fail;
- }
-
- if (!(S_ISREG(st.st_mode))) {
- avahi_log_error("Invalid file %s", fname);
- goto fail;
- }
-
- if (st.st_size > 1024*1024) { /** 1MB */
- avahi_log_error("File too large %s", fname);
- goto fail;
- }
-
- buf = avahi_new(char, st.st_size+1);
-
- if ((size = read(fd, buf, st.st_size)) < 0) {
- avahi_log_error("read() failed: %s\n", strerror(errno));
- goto fail;
- }
-
- buf[size] = 0;
-
- close(fd);
-
- return buf;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- if (buf)
- avahi_free(buf);
-
- return NULL;
-
-}
-
-DBusHandlerResult avahi_dbus_handle_introspect(DBusConnection *c, DBusMessage *m, const char *fname) {
- char *contents, *path;
- DBusError error;
-
- assert(c);
- assert(m);
- assert(fname);
-
- dbus_error_init(&error);
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_error("Error parsing Introspect message: %s", error.message);
- goto fail;
- }
-
- path = avahi_strdup_printf("%s/%s", AVAHI_DBUS_INTROSPECTION_DIR, fname);
- contents = file_get_contents(path);
- avahi_free(path);
-
- if (!contents) {
- avahi_log_error("Failed to load introspection data.");
- goto fail;
- }
-
- avahi_dbus_respond_string(c, m, contents);
- avahi_free(contents);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
-}
-
-void avahi_dbus_append_string_list(DBusMessage *reply, AvahiStringList *txt) {
- AvahiStringList *p;
- DBusMessageIter iter, sub;
-
- assert(reply);
-
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "ay", &sub);
-
- for (p = txt; p; p = p->next) {
- DBusMessageIter sub2;
- const uint8_t *data = p->text;
-
- dbus_message_iter_open_container(&sub, DBUS_TYPE_ARRAY, "y", &sub2);
- dbus_message_iter_append_fixed_array(&sub2, DBUS_TYPE_BYTE, &data, p->size);
- dbus_message_iter_close_container(&sub, &sub2);
-
- }
- dbus_message_iter_close_container(&iter, &sub);
-}
-
-int avahi_dbus_read_rdata(DBusMessage *m, int idx, void **rdata, uint32_t *size) {
- DBusMessageIter iter, sub;
- int n, j;
- uint8_t *k;
-
- assert(m);
-
- dbus_message_iter_init(m, &iter);
-
- for (j = 0; j < idx; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE)
- goto fail;
-
- dbus_message_iter_recurse(&iter, &sub);
- dbus_message_iter_get_fixed_array(&sub, &k, &n);
-
- *rdata = k;
- *size = n;
-
- return 0;
-
-fail:
- avahi_log_warn("Error parsing data");
-
- *rdata = NULL;
- size = 0;
- return -1;
-}
-
-int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) {
- DBusMessageIter iter, sub;
- int j;
- AvahiStringList *strlst = NULL;
-
- assert(m);
- assert(l);
-
- dbus_message_iter_init(m, &iter);
-
- for (j = 0; j < idx; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_ARRAY)
- goto fail;
-
- dbus_message_iter_recurse(&iter, &sub);
-
- for (;;) {
- int at, n;
- const uint8_t *k;
- DBusMessageIter sub2;
-
- if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
- break;
-
- assert(at == DBUS_TYPE_ARRAY);
-
- if (dbus_message_iter_get_element_type(&sub) != DBUS_TYPE_BYTE)
- goto fail;
-
- dbus_message_iter_recurse(&sub, &sub2);
-
- if (dbus_message_iter_get_array_len(&sub2) > 0)
- dbus_message_iter_get_fixed_array(&sub2, &k, &n);
- else {
- k = (const uint8_t*) "";
- n = 0;
- }
-
- strlst = avahi_string_list_add_arbitrary(strlst, k, n);
-
- dbus_message_iter_next(&sub);
- }
-
- *l = strlst;
-
- return 0;
-
-fail:
- avahi_log_warn("Error parsing TXT data");
-
- avahi_string_list_free(strlst);
- *l = NULL;
- return -1;
-}
-
-int avahi_dbus_is_our_own_service(Client *c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- AvahiSEntryGroup *g;
-
- if (avahi_server_get_group_of_service(avahi_server, interface, protocol, name, type, domain, &g) == AVAHI_OK) {
- EntryGroupInfo *egi;
-
- for (egi = c->entry_groups; egi; egi = egi->entry_groups_next)
- if (egi->entry_group == g)
- return 1;
- }
-
- return 0;
-}
-
-int avahi_dbus_append_rdata(DBusMessage *message, const void *rdata, size_t size) {
- DBusMessageIter iter, sub;
-
- assert(message);
-
- dbus_message_iter_init_append(message, &iter);
-
- if (!(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &sub)) ||
- !(dbus_message_iter_append_fixed_array(&sub, DBUS_TYPE_BYTE, &rdata, size)) ||
- !(dbus_message_iter_close_container(&iter, &sub)))
- return -1;
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-daemon/dbus-util.h b/release-0.6.9/avahi-daemon/dbus-util.h
deleted file mode 100644
index e994915..0000000
--- a/release-0.6.9/avahi-daemon/dbus-util.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef foodbusutilhfoo
-#define foodbusutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-
-#include "dbus-internal.h"
-
-DBusHandlerResult avahi_dbus_respond_error(DBusConnection *c, DBusMessage *m, int error, const char *text);
-DBusHandlerResult avahi_dbus_respond_string(DBusConnection *c, DBusMessage *m, const char *text);
-DBusHandlerResult avahi_dbus_respond_int32(DBusConnection *c, DBusMessage *m, int32_t i);
-DBusHandlerResult avahi_dbus_respond_uint32(DBusConnection *c, DBusMessage *m, uint32_t u);
-DBusHandlerResult avahi_dbus_respond_boolean(DBusConnection *c, DBusMessage *m, int b);
-DBusHandlerResult avahi_dbus_respond_ok(DBusConnection *c, DBusMessage *m);
-DBusHandlerResult avahi_dbus_respond_path(DBusConnection *c, DBusMessage *m, const char *path);
-
-void avahi_dbus_append_server_error(DBusMessage *reply);
-
-const char *avahi_dbus_map_browse_signal_name(AvahiBrowserEvent e);
-
-const char *avahi_dbus_map_resolve_signal_name(AvahiResolverEvent e);
-
-DBusHandlerResult avahi_dbus_handle_introspect(DBusConnection *c, DBusMessage *m, const char *fname);
-
-void avahi_dbus_append_string_list(DBusMessage *reply, AvahiStringList *txt);
-
-int avahi_dbus_read_rdata(DBusMessage *m, int idx, void **rdata, uint32_t *size);
-int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l);
-
-int avahi_dbus_is_our_own_service(Client *c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain);
-
-int avahi_dbus_append_rdata(DBusMessage *message, const void *rdata, size_t size);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/example.service b/release-0.6.9/avahi-daemon/example.service
deleted file mode 100644
index 7d6c6b8..0000000
--- a/release-0.6.9/avahi-daemon/example.service
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<!-- See avahi.service(5) for more information about this configuration file -->
-
-<service-group>
-
- <name replace-wildcards="yes">Printer on %h</name>
-
- <service>
- <type>_printer._tcp</type>
- <port>515</port>
- </service>
-
- <service>
- <type>_ipp._tcp</type>
- <subtype>_colour._sub._ipp._tcp</subtype>
- <port>631</port>
- </service>
-
- <service protocol="ipv6">
- <type>_uberprinter._tcp</type>
- <domain-name>local</domain-name>
- <host-name>quux.local</host-name>
- <port>4711</port>
- <txt-record>this=is</txt-record>
- <txt-record>a=really</txt-record>
- <txt-record>bad=example</txt-record>
- </service>
-
-</service-group>
diff --git a/release-0.6.9/avahi-daemon/hosts b/release-0.6.9/avahi-daemon/hosts
deleted file mode 100644
index 495daa7..0000000
--- a/release-0.6.9/avahi-daemon/hosts
+++ /dev/null
@@ -1,29 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This file contains static ip address <-> host name mappings. These
-# can be useful to publish services on behalf of a non-avahi enabled
-# device. Please bear in mind that host names are expected to be
-# fully qualified domain names, i.e. ending in .local!
-
-# See avahi.hosts(5) for more information on this configuration file!
-
-# Examples:
-# 192.168.0.1 router.local
-# 2001::81:1 test.local
diff --git a/release-0.6.9/avahi-daemon/ini-file-parser-test.c b/release-0.6.9/avahi-daemon/ini-file-parser-test.c
deleted file mode 100644
index 47530b5..0000000
--- a/release-0.6.9/avahi-daemon/ini-file-parser-test.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-
-#include <avahi-common/malloc.h>
-
-#include "ini-file-parser.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- AvahiIniFile *f;
- AvahiIniFileGroup *g;
-
- if (!(f = avahi_ini_file_load("avahi-daemon.conf"))) {
- return 1;
- }
-
- printf("%u groups\n", f->n_groups);
-
- for (g = f->groups; g; g = g->groups_next) {
- AvahiIniFilePair *p;
- printf("<%s> (%u pairs)\n", g->name, g->n_pairs);
-
- for (p = g->pairs; p; p = p->pairs_next) {
- char **split, **i;
-
- printf("\t<%s> = ", p->key);
- split = avahi_split_csv(p->value);
-
- for (i = split; *i; i++)
- printf("<%s> ", *i);
-
- avahi_strfreev(split);
-
- printf("\n");
- }
- }
-
- avahi_ini_file_free(f);
- return 0;
-}
diff --git a/release-0.6.9/avahi-daemon/ini-file-parser.c b/release-0.6.9/avahi-daemon/ini-file-parser.c
deleted file mode 100644
index 135876e..0000000
--- a/release-0.6.9/avahi-daemon/ini-file-parser.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-core/log.h>
-
-#include "ini-file-parser.h"
-
-AvahiIniFile* avahi_ini_file_load(const char *fname) {
- AvahiIniFile *f;
- FILE *fo;
- AvahiIniFileGroup *group = NULL;
- unsigned line;
-
- assert(fname);
-
- if (!(fo = fopen(fname, "r"))) {
- avahi_log_error("Failed to open file '%s': %s", fname, strerror(errno));
- return NULL;
- }
-
- f = avahi_new(AvahiIniFile, 1);
- AVAHI_LLIST_HEAD_INIT(AvahiIniFileGroup, f->groups);
- f->n_groups = 0;
-
- line = 0;
- while (!feof(fo)) {
- char ln[256], *s, *e;
- AvahiIniFilePair *pair;
-
- if (!(fgets(ln, sizeof(ln), fo)))
- break;
-
- line++;
-
- s = ln + strspn(ln, " \t");
- s[strcspn(s, "\r\n")] = 0;
-
- /* Skip comments and empty lines */
- if (*s == '#' || *s == '%' || *s == 0)
- continue;
-
- if (*s == '[') {
- /* new group */
-
- if (!(e = strchr(s, ']'))) {
- avahi_log_error("Unclosed group header in %s:%u: <%s>", fname, line, s);
- goto fail;
- }
-
- *e = 0;
-
- group = avahi_new(AvahiIniFileGroup, 1);
- group->name = avahi_strdup(s+1);
- group->n_pairs = 0;
- AVAHI_LLIST_HEAD_INIT(AvahiIniFilePair, group->pairs);
-
- AVAHI_LLIST_PREPEND(AvahiIniFileGroup, groups, f->groups, group);
- f->n_groups++;
- } else {
-
- /* Normal assignment */
- if (!(e = strchr(s, '='))) {
- avahi_log_error("Missing assignment in %s:%u: <%s>", fname, line, s);
- goto fail;
- }
-
- if (!group) {
- avahi_log_error("Assignment outside group in %s:%u <%s>", fname, line, s);
- goto fail;
- }
-
- /* Split the key and the value */
- *(e++) = 0;
-
- pair = avahi_new(AvahiIniFilePair, 1);
- pair->key = avahi_strdup(s);
- pair->value = avahi_strdup(e);
-
- AVAHI_LLIST_PREPEND(AvahiIniFilePair, pairs, group->pairs, pair);
- group->n_pairs++;
- }
- }
-
- fclose(fo);
-
- return f;
-
-fail:
-
- if (fo)
- fclose(fo);
-
- if (f)
- avahi_ini_file_free(f);
-
- return NULL;
-}
-
-void avahi_ini_file_free(AvahiIniFile *f) {
- AvahiIniFileGroup *g;
- assert(f);
-
- while ((g = f->groups)) {
- AvahiIniFilePair *p;
-
- while ((p = g->pairs)) {
- avahi_free(p->key);
- avahi_free(p->value);
-
- AVAHI_LLIST_REMOVE(AvahiIniFilePair, pairs, g->pairs, p);
- avahi_free(p);
- }
-
- avahi_free(g->name);
-
- AVAHI_LLIST_REMOVE(AvahiIniFileGroup, groups, f->groups, g);
- avahi_free(g);
- }
-
- avahi_free(f);
-}
-
-char** avahi_split_csv(const char *t) {
- unsigned n_comma = 0;
- const char *p;
- char **r, **i;
-
- for (p = t; *p; p++)
- if (*p == ',')
- n_comma++;
-
- i = r = avahi_new(char*, n_comma+2);
-
- for (;;) {
- size_t n, l = strcspn(t, ",");
- const char *c;
-
- /* Ignore leading blanks */
- for (c = t, n = l; isblank(*c); c++, n--);
-
- /* Ignore trailing blanks */
- for (; n > 0 && isblank(c[n-1]); n--);
-
- *(i++) = avahi_strndup(c, n);
-
- t += l;
-
- if (*t == 0)
- break;
-
- assert(*t == ',');
- t++;
- }
-
- *i = NULL;
-
- return r;
-}
-
-void avahi_strfreev(char **p) {
- char **i;
-
- if (!p)
- return;
-
- for (i = p; *i; i++)
- avahi_free(*i);
-
- avahi_free(p);
-}
diff --git a/release-0.6.9/avahi-daemon/ini-file-parser.h b/release-0.6.9/avahi-daemon/ini-file-parser.h
deleted file mode 100644
index 82c5acf..0000000
--- a/release-0.6.9/avahi-daemon/ini-file-parser.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef fooinifileparserhfoo
-#define fooinifileparserhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/llist.h>
-
-typedef struct AvahiIniFile AvahiIniFile;
-typedef struct AvahiIniFilePair AvahiIniFilePair;
-typedef struct AvahiIniFileGroup AvahiIniFileGroup;
-
-struct AvahiIniFilePair {
- AVAHI_LLIST_FIELDS(AvahiIniFilePair, pairs);
- char *key, *value;
-};
-
-struct AvahiIniFileGroup {
- AVAHI_LLIST_FIELDS(AvahiIniFileGroup, groups);
- char *name;
-
- AVAHI_LLIST_HEAD(AvahiIniFilePair, pairs);
- unsigned n_pairs;
-};
-
-struct AvahiIniFile {
- AVAHI_LLIST_HEAD(AvahiIniFileGroup, groups);
- unsigned n_groups;
-};
-
-
-AvahiIniFile* avahi_ini_file_load(const char *fname);
-void avahi_ini_file_free(AvahiIniFile *f);
-
-char** avahi_split_csv(const char *t);
-
-void avahi_strfreev(char **);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/introspect.dtd b/release-0.6.9/avahi-daemon/introspect.dtd
deleted file mode 100644
index 15d913a..0000000
--- a/release-0.6.9/avahi-daemon/introspect.dtd
+++ /dev/null
@@ -1,37 +0,0 @@
-<!-- DTD for D-BUS Introspection data -->
-<!-- (C) 2005-02-02 David A. Wheeler; released under the D-BUS licenses,
- GNU GPL version 2 (or greater) and AFL 1.1 (or greater) -->
-
-<!-- see D-BUS specification for documentation -->
-
-<!ELEMENT node (node|interface)*>
-<!ATTLIST node name CDATA #IMPLIED>
-
-<!ELEMENT interface (method|signal|property|annotation)*>
-<!ATTLIST interface name CDATA #REQUIRED>
-
-<!ELEMENT method (arg|annotation)*>
-<!ATTLIST method name CDATA #REQUIRED>
-
-<!ELEMENT signal (arg|annotation)*>
-<!ATTLIST signal name CDATA #REQUIRED>
-
-<!ELEMENT arg EMPTY>
-<!ATTLIST arg name CDATA #IMPLIED>
-<!ATTLIST arg type CDATA #REQUIRED>
-<!-- Method arguments SHOULD include "direction",
- while signal and error arguments SHOULD not (since there's no point).
- The DTD format can't express that subtlety. -->
-<!ATTLIST arg direction (in|out) "in">
-
-<!-- AKA "attribute" -->
-<!ELEMENT property (annotation)*>
-<!ATTLIST property name CDATA #REQUIRED>
-<!ATTLIST property type CDATA #REQUIRED>
-<!ATTLIST property access (read|write|readwrite) #REQUIRED>
-
-<!ELEMENT annotation EMPTY> <!-- Generic metadata -->
-<!ATTLIST annotation name CDATA #REQUIRED>
-<!ATTLIST annotation value CDATA #REQUIRED>
-
-
diff --git a/release-0.6.9/avahi-daemon/introspect.xsl b/release-0.6.9/avahi-daemon/introspect.xsl
deleted file mode 100644
index 32a371c..0000000
--- a/release-0.6.9/avahi-daemon/introspect.xsl
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-15"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
--->
-
-<!-- $Id$ -->
-
-<xsl:output method="xml" version="1.0" encoding="iso-8859-15" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
-
-<xsl:template match="/">
- <html>
- <head>
- <title>DBUS Introspection data</title>
- <style type="text/css">
- body { color: black; background-color: white }
- h1 { font-family: sans-serif }
- ul { list-style-type: none; margin-bottom: 10px }
- li { font-family: sans-serif }
- .keyword { font-style: italic }
- .type { font-weight: bold }
- .symbol { font-family: monospace }
- .interface { padding: 10px; margin: 10px }
- </style>
- </head>
- <body>
- <xsl:for-each select="node/interface">
- <div class="interface">
- <h1>
- <span class="keyword">interface</span><xsl:text> </xsl:text>
- <span class="symbol"><xsl:value-of select="@name"/></span>
- </h1>
-
- <ul>
-
- <xsl:apply-templates select="annotation"/>
-
- <xsl:for-each select="method|signal|property">
- <li>
- <span class="keyword"><xsl:value-of select="name()"/></span>
- <xsl:text> </xsl:text>
- <span class="symbol"><xsl:value-of select="@name"/></span>
-
- <ul>
- <xsl:apply-templates select="annotation"/>
- <xsl:for-each select="arg">
- <li>
- <span class="keyword">
- <xsl:choose>
- <xsl:when test="@direction != &quot;&quot;">
- <xsl:value-of select="@direction"/>
- </xsl:when>
- <xsl:when test="name(..) = &quot;signal&quot;">
- out
- </xsl:when>
- <xsl:otherwise>
- in
- </xsl:otherwise>
- </xsl:choose>
- </span>
-
- <xsl:text> </xsl:text>
-
- <span class="type"><xsl:value-of select="@type"/></span><xsl:text> </xsl:text>
- <span class="symbol"><xsl:value-of select="@name"/></span><xsl:text> </xsl:text>
- </li>
- </xsl:for-each>
- </ul>
-
- </li>
- </xsl:for-each>
-
- </ul>
- </div>
- </xsl:for-each>
- </body>
- </html>
-</xsl:template>
-
-
-<xsl:template match="annotation">
- <li>
- <span class="keyword">annotation</span>
- <code><xsl:value-of select="@name"/></code><xsl:text> = </xsl:text>
- <code><xsl:value-of select="@value"/></code>
- </li>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/release-0.6.9/avahi-daemon/main.c b/release-0.6.9/avahi-daemon/main.c
deleted file mode 100644
index f32cbd6..0000000
--- a/release-0.6.9/avahi-daemon/main.c
+++ /dev/null
@@ -1,1217 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <getopt.h>
-#include <string.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <grp.h>
-#include <pwd.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-
-#include <libdaemon/dfork.h>
-#include <libdaemon/dsignal.h>
-#include <libdaemon/dlog.h>
-#include <libdaemon/dpid.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/domain.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/dns-srv-rr.h>
-#include <avahi-core/log.h>
-
-#ifdef ENABLE_CHROOT
-#include "chroot.h"
-#include "caps.h"
-#endif
-
-#include "setproctitle.h"
-#include "main.h"
-#include "simple-protocol.h"
-#include "static-services.h"
-#include "static-hosts.h"
-#include "ini-file-parser.h"
-
-#ifdef HAVE_DBUS
-#include "dbus-protocol.h"
-#endif
-
-AvahiServer *avahi_server = NULL;
-AvahiSimplePoll *simple_poll_api = NULL;
-static char *argv0 = NULL;
-int nss_support = 0;
-
-typedef enum {
- DAEMON_RUN,
- DAEMON_KILL,
- DAEMON_VERSION,
- DAEMON_HELP,
- DAEMON_RELOAD,
- DAEMON_CHECK
-} DaemonCommand;
-
-typedef struct {
- AvahiServerConfig server_config;
- DaemonCommand command;
- int daemonize;
- int use_syslog;
- char *config_file;
-#ifdef HAVE_DBUS
- int enable_dbus;
- int fail_on_missing_dbus;
-#endif
- int drop_root;
- int set_rlimits;
-#ifdef ENABLE_CHROOT
- int use_chroot;
-#endif
- int modify_proc_title;
-
- int disable_user_service_publishing;
- int publish_resolv_conf;
- char ** publish_dns_servers;
- int debug;
-
- int rlimit_as_set, rlimit_core_set, rlimit_data_set, rlimit_fsize_set, rlimit_nofile_set, rlimit_stack_set;
- rlim_t rlimit_as, rlimit_core, rlimit_data, rlimit_fsize, rlimit_nofile, rlimit_stack;
-
-#ifdef RLIMIT_NPROC
- int rlimit_nproc_set;
- rlim_t rlimit_nproc;
-#endif
-} DaemonConfig;
-
-#define RESOLV_CONF "/etc/resolv.conf"
-
-static AvahiSEntryGroup *dns_servers_entry_group = NULL;
-static AvahiSEntryGroup *resolv_conf_entry_group = NULL;
-
-static char **resolv_conf = NULL;
-
-static DaemonConfig config;
-
-static int has_prefix(const char *s, const char *prefix) {
- size_t l;
-
- l = strlen(prefix);
-
- return strlen(s) >= l && strncmp(s, prefix, l) == 0;
-}
-
-static int load_resolv_conf(void) {
- int ret = -1;
- FILE *f;
- int i = 0;
-
- avahi_strfreev(resolv_conf);
- resolv_conf = NULL;
-
-#ifdef ENABLE_CHROOT
- f = avahi_chroot_helper_get_file(RESOLV_CONF);
-#else
- f = fopen(RESOLV_CONF, "r");
-#endif
-
- if (!f) {
- avahi_log_warn("Failed to open "RESOLV_CONF": %s", strerror(errno));
- goto finish;
- }
-
- resolv_conf = avahi_new0(char*, AVAHI_WIDE_AREA_SERVERS_MAX+1);
-
- while (!feof(f) && i < AVAHI_WIDE_AREA_SERVERS_MAX) {
- char ln[128];
- char *p;
-
- if (!(fgets(ln, sizeof(ln), f)))
- break;
-
- ln[strcspn(ln, "\r\n#")] = 0;
- p = ln + strspn(ln, "\t ");
-
- if (has_prefix(p, "nameserver")) {
- p += 10;
- p += strspn(p, "\t ");
- p[strcspn(p, "\t ")] = 0;
- resolv_conf[i++] = avahi_strdup(p);
- }
- }
-
- ret = 0;
-
-finish:
-
- if (ret != 0) {
- avahi_strfreev(resolv_conf);
- resolv_conf = NULL;
- }
-
- if (f)
- fclose(f);
-
- return ret;
-}
-
-static AvahiSEntryGroup* add_dns_servers(AvahiServer *s, AvahiSEntryGroup* g, char **l) {
- char **p;
-
- assert(s);
- assert(l);
-
- if (!g)
- g = avahi_s_entry_group_new(s, NULL, NULL);
-
- assert(avahi_s_entry_group_is_empty(g));
-
- for (p = l; *p; p++) {
- AvahiAddress a;
-
- if (!avahi_address_parse(*p, AVAHI_PROTO_UNSPEC, &a))
- avahi_log_warn("Failed to parse address '%s', ignoring.", *p);
- else
- if (avahi_server_add_dns_server_address(s, g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, NULL, AVAHI_DNS_SERVER_RESOLVE, &a, 53) < 0) {
- avahi_s_entry_group_free(g);
- avahi_log_error("Failed to add DNS server address: %s", avahi_strerror(avahi_server_errno(s)));
- return NULL;
- }
- }
-
- avahi_s_entry_group_commit(g);
-
- return g;
-}
-
-static void remove_dns_server_entry_groups(void) {
-
- if (resolv_conf_entry_group)
- avahi_s_entry_group_reset(resolv_conf_entry_group);
-
- if (dns_servers_entry_group)
- avahi_s_entry_group_reset(dns_servers_entry_group);
-}
-
-static void update_wide_area_servers(void) {
- AvahiAddress a[AVAHI_WIDE_AREA_SERVERS_MAX];
- unsigned n = 0;
- char **p;
-
- if (!resolv_conf) {
- avahi_server_set_wide_area_servers(avahi_server, NULL, 0);
- return;
- }
-
- for (p = resolv_conf; *p && n < AVAHI_WIDE_AREA_SERVERS_MAX; p++) {
- if (!avahi_address_parse(*p, AVAHI_PROTO_UNSPEC, &a[n]))
- avahi_log_warn("Failed to parse address '%s', ignoring.", *p);
- else
- n++;
- }
-
- avahi_server_set_wide_area_servers(avahi_server, a, n);
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, void *userdata) {
- DaemonConfig *c = userdata;
-
- assert(s);
- assert(c);
-
- /* This function is possibly called before the global variable
- * avahi_server has been set, therefore we do it explicitly */
-
- avahi_server = s;
-
-#ifdef HAVE_DBUS
- if (c->enable_dbus && state != AVAHI_SERVER_INVALID && state != AVAHI_SERVER_FAILURE)
- dbus_protocol_server_state_changed(state);
-#endif
-
- switch (state) {
- case AVAHI_SERVER_RUNNING:
- avahi_log_info("Server startup complete. Host name is %s. Local service cookie is %u.", avahi_server_get_host_name_fqdn(s), avahi_server_get_local_service_cookie(s));
-
- avahi_set_proc_title("%s: running [%s]", argv0, avahi_server_get_host_name_fqdn(s));
-
- static_service_add_to_server();
- static_hosts_add_to_server();
-
- remove_dns_server_entry_groups();
-
- if (c->publish_resolv_conf && resolv_conf && resolv_conf[0])
- resolv_conf_entry_group = add_dns_servers(s, resolv_conf_entry_group, resolv_conf);
-
- if (c->publish_dns_servers && c->publish_dns_servers[0])
- dns_servers_entry_group = add_dns_servers(s, dns_servers_entry_group, c->publish_dns_servers);
-
- simple_protocol_restart_queries();
- break;
-
- case AVAHI_SERVER_COLLISION: {
- char *n;
-
- static_service_remove_from_server();
- static_hosts_remove_from_server();
-
- remove_dns_server_entry_groups();
-
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
- avahi_log_warn("Host name conflict, retrying with <%s>", n);
- avahi_server_set_host_name(s, n);
- avahi_free(n);
-
- avahi_set_proc_title("%s: collision", argv0);
-
- break;
- }
-
- case AVAHI_SERVER_FAILURE:
-
- avahi_log_error("Server error: %s", avahi_strerror(avahi_server_errno(s)));
- avahi_simple_poll_quit(simple_poll_api);
- break;
-
- case AVAHI_SERVER_REGISTERING:
- avahi_set_proc_title("%s: registering [%s]", argv0, avahi_server_get_host_name_fqdn(s));
-
-
- case AVAHI_SERVER_INVALID:
- break;
-
- }
-}
-
-static void help(FILE *f) {
- fprintf(f,
- "%s [options]\n"
- " -h --help Show this help\n"
- " -D --daemonize Daemonize after startup (implies -s)\n"
- " -s --syslog Write log messages to syslog(3) instead of STDERR\n"
- " -k --kill Kill a running daemon\n"
- " -r --reload Request a running daemon to reload static services\n"
- " -c --check Return 0 if a daemon is already running\n"
- " -V --version Show version\n"
- " -f --file=FILE Load the specified configuration file instead of\n"
- " "AVAHI_CONFIG_FILE"\n"
- " --no-rlimits Don't enforce resource limits\n"
- " --no-drop-root Don't drop privileges\n"
-#ifdef ENABLE_CHROOT
- " --no-chroot Don't chroot()\n"
-#endif
- " --no-proc-title Don't modify process title\n"
- " --debug Increase verbosity\n",
- argv0);
-}
-
-
-static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
- int o;
-
- enum {
- OPTION_NO_RLIMITS = 256,
- OPTION_NO_DROP_ROOT,
-#ifdef ENABLE_CHROOT
- OPTION_NO_CHROOT,
-#endif
- OPTION_NO_PROC_TITLE,
- OPTION_DEBUG
- };
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "daemonize", no_argument, NULL, 'D' },
- { "kill", no_argument, NULL, 'k' },
- { "version", no_argument, NULL, 'V' },
- { "file", required_argument, NULL, 'f' },
- { "reload", no_argument, NULL, 'r' },
- { "check", no_argument, NULL, 'c' },
- { "syslog", no_argument, NULL, 's' },
- { "no-rlimits", no_argument, NULL, OPTION_NO_RLIMITS },
- { "no-drop-root", no_argument, NULL, OPTION_NO_DROP_ROOT },
-#ifdef ENABLE_CHROOT
- { "no-chroot", no_argument, NULL, OPTION_NO_CHROOT },
-#endif
- { "no-proc-title", no_argument, NULL, OPTION_NO_PROC_TITLE },
- { "debug", no_argument, NULL, OPTION_DEBUG },
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hDkVf:rcs", long_options, NULL)) >= 0) {
-
- switch(o) {
- case 's':
- c->use_syslog = 1;
- break;
- case 'h':
- c->command = DAEMON_HELP;
- break;
- case 'D':
- c->daemonize = 1;
- break;
- case 'k':
- c->command = DAEMON_KILL;
- break;
- case 'V':
- c->command = DAEMON_VERSION;
- break;
- case 'f':
- avahi_free(c->config_file);
- c->config_file = avahi_strdup(optarg);
- break;
- case 'r':
- c->command = DAEMON_RELOAD;
- break;
- case 'c':
- c->command = DAEMON_CHECK;
- break;
- case OPTION_NO_RLIMITS:
- c->set_rlimits = 0;
- break;
- case OPTION_NO_DROP_ROOT:
- c->drop_root = 0;
- break;
-#ifdef ENABLE_CHROOT
- case OPTION_NO_CHROOT:
- c->use_chroot = 0;
- break;
-#endif
- case OPTION_NO_PROC_TITLE:
- c->modify_proc_title = 0;
- break;
- case OPTION_DEBUG:
- c->debug = 1;
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr, "Too many arguments\n");
- return -1;
- }
-
- return 0;
-}
-
-static int is_yes(const char *s) {
- assert(s);
-
- return *s == 'y' || *s == 'Y';
-}
-
-static int load_config_file(DaemonConfig *c) {
- int r = -1;
- AvahiIniFile *f;
- AvahiIniFileGroup *g;
-
- assert(c);
-
- if (!(f = avahi_ini_file_load(c->config_file ? c->config_file : AVAHI_CONFIG_FILE)))
- goto finish;
-
- for (g = f->groups; g; g = g->groups_next) {
-
- if (strcasecmp(g->name, "server") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "host-name") == 0) {
- avahi_free(c->server_config.host_name);
- c->server_config.host_name = avahi_strdup(p->value);
- } else if (strcasecmp(p->key, "domain-name") == 0) {
- avahi_free(c->server_config.domain_name);
- c->server_config.domain_name = avahi_strdup(p->value);
- } else if (strcasecmp(p->key, "browse-domains") == 0) {
- char **e, **t;
-
- e = avahi_split_csv(p->value);
-
- for (t = e; *t; t++) {
- char cleaned[AVAHI_DOMAIN_NAME_MAX];
-
- if (!avahi_normalize_name(*t, cleaned, sizeof(cleaned))) {
- avahi_log_error("Invalid domain name \"%s\" for key \"%s\" in group \"%s\"\n", *t, p->key, g->name);
- avahi_strfreev(e);
- goto finish;
- }
-
- c->server_config.browse_domains = avahi_string_list_add(c->server_config.browse_domains, cleaned);
- }
-
- avahi_strfreev(e);
- } else if (strcasecmp(p->key, "use-ipv4") == 0)
- c->server_config.use_ipv4 = is_yes(p->value);
- else if (strcasecmp(p->key, "use-ipv6") == 0)
- c->server_config.use_ipv6 = is_yes(p->value);
- else if (strcasecmp(p->key, "check-response-ttl") == 0)
- c->server_config.check_response_ttl = is_yes(p->value);
- else if (strcasecmp(p->key, "allow-point-to-point") == 0)
- c->server_config.allow_point_to_point = is_yes(p->value);
- else if (strcasecmp(p->key, "use-iff-running") == 0)
- c->server_config.use_iff_running = is_yes(p->value);
- else if (strcasecmp(p->key, "disallow-other-stacks") == 0)
- c->server_config.disallow_other_stacks = is_yes(p->value);
-#ifdef HAVE_DBUS
- else if (strcasecmp(p->key, "enable-dbus") == 0) {
-
- if (*(p->value) == 'w' || *(p->value) == 'W') {
- c->fail_on_missing_dbus = 0;
- c->enable_dbus = 1;
- } else if (*(p->value) == 'y' || *(p->value) == 'Y') {
- c->fail_on_missing_dbus = 1;
- c->enable_dbus = 1;
- } else {
- c->enable_dbus = 0;
- }
- }
-#endif
- else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "publish") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "publish-addresses") == 0)
- c->server_config.publish_addresses = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-hinfo") == 0)
- c->server_config.publish_hinfo = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-workstation") == 0)
- c->server_config.publish_workstation = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-domain") == 0)
- c->server_config.publish_domain = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-resolv-conf-dns-servers") == 0)
- c->publish_resolv_conf = is_yes(p->value);
- else if (strcasecmp(p->key, "disable-publishing") == 0)
- c->server_config.disable_publishing = is_yes(p->value);
- else if (strcasecmp(p->key, "disable-user-service-publishing") == 0)
- c->disable_user_service_publishing = is_yes(p->value);
- else if (strcasecmp(p->key, "add-service-cookie") == 0)
- c->server_config.add_service_cookie = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-dns-servers") == 0) {
- avahi_strfreev(c->publish_dns_servers);
- c->publish_dns_servers = avahi_split_csv(p->value);
- } else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "wide-area") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "enable-wide-area") == 0)
- c->server_config.enable_wide_area = is_yes(p->value);
- else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "reflector") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "enable-reflector") == 0)
- c->server_config.enable_reflector = is_yes(p->value);
- else if (strcasecmp(p->key, "reflect-ipv") == 0)
- c->server_config.reflect_ipv = is_yes(p->value);
- else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "rlimits") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "rlimit-as") == 0) {
- c->rlimit_as_set = 1;
- c->rlimit_as = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-core") == 0) {
- c->rlimit_core_set = 1;
- c->rlimit_core = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-data") == 0) {
- c->rlimit_data_set = 1;
- c->rlimit_data = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-fsize") == 0) {
- c->rlimit_fsize_set = 1;
- c->rlimit_fsize = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-nofile") == 0) {
- c->rlimit_nofile_set = 1;
- c->rlimit_nofile = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-stack") == 0) {
- c->rlimit_stack_set = 1;
- c->rlimit_stack = atoi(p->value);
-#ifdef RLIMIT_NPROC
- } else if (strcasecmp(p->key, "rlimit-nproc") == 0) {
- c->rlimit_nproc_set = 1;
- c->rlimit_nproc = atoi(p->value);
-#endif
- } else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
-
- }
-
- } else {
- avahi_log_error("Invalid configuration file group \"%s\".\n", g->name);
- goto finish;
- }
- }
-
- r = 0;
-
-finish:
-
- if (f)
- avahi_ini_file_free(f);
-
- return r;
-}
-
-static void log_function(AvahiLogLevel level, const char *txt) {
-
- static const int log_level_map[] = {
- LOG_ERR,
- LOG_WARNING,
- LOG_NOTICE,
- LOG_INFO,
- LOG_DEBUG
- };
-
- assert(level < AVAHI_LOG_LEVEL_MAX);
- assert(txt);
-
- if (!config.debug && level == AVAHI_LOG_DEBUG)
- return;
-
- daemon_log(log_level_map[level], "%s", txt);
-}
-
-static void dump(const char *text, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_info("%s", text);
-}
-
-static void signal_callback(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
- int sig;
- const AvahiPoll *poll_api;
-
- assert(watch);
- assert(simple_poll_api);
-
- poll_api = avahi_simple_poll_get(simple_poll_api);
-
- if ((sig = daemon_signal_next()) <= 0) {
- avahi_log_error("daemon_signal_next() failed");
- poll_api->watch_free(watch);
- return;
- }
-
- switch (sig) {
- case SIGINT:
- case SIGQUIT:
- case SIGTERM:
- avahi_log_info(
- "Got %s, quitting.",
- sig == SIGINT ? "SIGINT" :
- (sig == SIGQUIT ? "SIGQUIT" : "SIGTERM"));
- avahi_simple_poll_quit(simple_poll_api);
- break;
-
- case SIGHUP:
- avahi_log_info("Got SIGHUP, reloading.");
-#ifdef ENABLE_CHROOT
- static_service_load(config.use_chroot);
- static_hosts_load(config.use_chroot);
-#else
- static_service_load(0);
- static_hosts_load(0);
-#endif
- static_service_add_to_server();
- static_service_remove_from_server();
-
- if (resolv_conf_entry_group)
- avahi_s_entry_group_reset(resolv_conf_entry_group);
-
- load_resolv_conf();
-
- update_wide_area_servers();
-
- if (config.publish_resolv_conf && resolv_conf && resolv_conf[0])
- resolv_conf_entry_group = add_dns_servers(avahi_server, resolv_conf_entry_group, resolv_conf);
-
- break;
-
- case SIGUSR1:
- avahi_log_info("Got SIGUSR1, dumping record data.");
- avahi_server_dump(avahi_server, dump, NULL);
- break;
-
- default:
- avahi_log_warn("Got spurious signal, ignoring.");
- break;
- }
-}
-
-/* Imported from ../avahi-client/nss-check.c */
-int avahi_nss_support(void);
-
-static int run_server(DaemonConfig *c) {
- int r = -1;
- int error;
- const AvahiPoll *poll_api = NULL;
- AvahiWatch *sig_watch = NULL;
- int retval_is_sent = 0;
-
- assert(c);
-
- if (!(nss_support = avahi_nss_support()))
- avahi_log_warn("WARNING: No NSS support for mDNS detected, consider installing nss-mdns!");
-
- if (!(simple_poll_api = avahi_simple_poll_new())) {
- avahi_log_error("Failed to create main loop object.");
- goto finish;
- }
-
- poll_api = avahi_simple_poll_get(simple_poll_api);
-
- if (daemon_signal_init(SIGINT, SIGQUIT, SIGHUP, SIGTERM, SIGUSR1, 0) < 0) {
- avahi_log_error("Could not register signal handlers (%s).", strerror(errno));
- goto finish;
- }
-
- if (!(sig_watch = poll_api->watch_new(poll_api, daemon_signal_fd(), AVAHI_WATCH_IN, signal_callback, simple_poll_api))) {
- avahi_log_error( "Failed to create signal watcher");
- goto finish;
- }
-
- if (simple_protocol_setup(poll_api) < 0)
- goto finish;
-
-#ifdef HAVE_DBUS
- if (c->enable_dbus) {
- if (dbus_protocol_setup(poll_api, config.disable_user_service_publishing) < 0) {
-
- if (c->fail_on_missing_dbus)
- goto finish;
-
- avahi_log_warn("WARNING: Failed to contact D-BUS daemon, disabling D-BUS support.");
- c->enable_dbus = 0;
- }
- }
-#endif
-
-#ifdef ENABLE_CHROOT
-
- if (config.drop_root && config.use_chroot) {
- if (chroot(AVAHI_CONFIG_DIR) < 0) {
- avahi_log_error("Failed to chroot(): %s", strerror(errno));
- goto finish;
- }
-
- avahi_log_info("Successfully called chroot().");
- chdir("/");
-
- if (avahi_caps_drop_all() < 0) {
- avahi_log_error("Failed to drop capabilities.");
- goto finish;
- }
- avahi_log_info("Successfully dropped remaining capabilities.");
- }
-
-#endif
-
- load_resolv_conf();
-#ifdef ENABLE_CHROOT
- static_service_load(config.use_chroot);
- static_hosts_load(config.use_chroot);
-#else
- static_service_load(0);
- static_hosts_load(0);
-#endif
-
- if (!(avahi_server = avahi_server_new(poll_api, &c->server_config, server_callback, c, &error))) {
- avahi_log_error("Failed to create server: %s", avahi_strerror(error));
- goto finish;
- }
-
- update_wide_area_servers();
-
- if (c->daemonize) {
- daemon_retval_send(0);
- retval_is_sent = 1;
- }
-
- for (;;) {
- if ((r = avahi_simple_poll_iterate(simple_poll_api, -1)) < 0) {
-
- /* We handle signals through an FD, so let's continue */
- if (errno == EINTR)
- continue;
-
- avahi_log_error("poll(): %s", strerror(errno));
- goto finish;
- } else if (r > 0)
- /* Quit */
- break;
- }
-
-
-finish:
-
- static_service_remove_from_server();
- static_service_free_all();
-
- static_hosts_remove_from_server();
- static_hosts_free_all();
-
- remove_dns_server_entry_groups();
-
- simple_protocol_shutdown();
-
-#ifdef HAVE_DBUS
- if (c->enable_dbus)
- dbus_protocol_shutdown();
-#endif
-
- if (avahi_server) {
- avahi_server_free(avahi_server);
- avahi_server = NULL;
- }
-
- daemon_signal_done();
-
- if (sig_watch)
- poll_api->watch_free(sig_watch);
-
- if (simple_poll_api) {
- avahi_simple_poll_free(simple_poll_api);
- simple_poll_api = NULL;
- }
-
- if (!retval_is_sent && c->daemonize)
- daemon_retval_send(1);
-
- return r;
-}
-
-#define set_env(key, value) putenv(avahi_strdup_printf("%s=%s", (key), (value)))
-
-static int drop_root(void) {
- struct passwd *pw;
- struct group * gr;
- int r;
-
- if (!(pw = getpwnam(AVAHI_USER))) {
- avahi_log_error( "Failed to find user '"AVAHI_USER"'.");
- return -1;
- }
-
- if (!(gr = getgrnam(AVAHI_GROUP))) {
- avahi_log_error( "Failed to find group '"AVAHI_GROUP"'.");
- return -1;
- }
-
- avahi_log_info("Found user '"AVAHI_USER"' (UID %lu) and group '"AVAHI_GROUP"' (GID %lu).", (unsigned long) pw->pw_uid, (unsigned long) gr->gr_gid);
-
- if (initgroups(AVAHI_USER, gr->gr_gid) != 0) {
- avahi_log_error("Failed to change group list: %s", strerror(errno));
- return -1;
- }
-
-#if defined(HAVE_SETRESGID)
- r = setresgid(gr->gr_gid, gr->gr_gid, gr->gr_gid);
-#elif defined(HAVE_SETEGID)
- if ((r = setgid(gr->gr_gid)) >= 0)
- r = setegid(gr->gr_gid);
-#elif defined(HAVE_SETREGID)
- r = setregid(gr->gr_gid, gr->gr_gid);
-#else
-#error "No API to drop priviliges"
-#endif
-
- if (r < 0) {
- avahi_log_error("Failed to change GID: %s", strerror(errno));
- return -1;
- }
-
-#if defined(HAVE_SETRESUID)
- r = setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid);
-#elif defined(HAVE_SETEUID)
- if ((r = setuid(pw->pw_uid)) >= 0)
- r = seteuid(pw->pw_uid);
-#elif defined(HAVE_SETREUID)
- r = setreuid(pw->pw_uid, pw->pw_uid);
-#else
-#error "No API to drop priviliges"
-#endif
-
- if (r < 0) {
- avahi_log_error("Failed to change UID: %s", strerror(errno));
- return -1;
- }
-
- set_env("USER", pw->pw_name);
- set_env("LOGNAME", pw->pw_name);
- set_env("HOME", pw->pw_dir);
-
- avahi_log_info("Successfully dropped root privileges.");
-
- return 0;
-}
-
-static const char* pid_file_proc(void) {
- return AVAHI_DAEMON_RUNTIME_DIR"/pid";
-}
-
-static int make_runtime_dir(void) {
- int r = -1;
- mode_t u;
- int reset_umask = 0;
- struct passwd *pw;
- struct group * gr;
- struct stat st;
-
- if (!(pw = getpwnam(AVAHI_USER))) {
- avahi_log_error( "Failed to find user '"AVAHI_USER"'.");
- goto fail;
- }
-
- if (!(gr = getgrnam(AVAHI_GROUP))) {
- avahi_log_error( "Failed to find group '"AVAHI_GROUP"'.");
- goto fail;
- }
-
- u = umask(0000);
- reset_umask = 1;
-
- if (mkdir(AVAHI_DAEMON_RUNTIME_DIR, 0755) < 0 && errno != EEXIST) {
- avahi_log_error("mkdir(\""AVAHI_DAEMON_RUNTIME_DIR"\"): %s", strerror(errno));
- goto fail;
- }
-
- chown(AVAHI_DAEMON_RUNTIME_DIR, pw->pw_uid, gr->gr_gid);
-
- if (stat(AVAHI_DAEMON_RUNTIME_DIR, &st) < 0) {
- avahi_log_error("stat(): %s\n", strerror(errno));
- goto fail;
- }
-
- if (!S_ISDIR(st.st_mode) || st.st_uid != pw->pw_uid || st.st_gid != gr->gr_gid) {
- avahi_log_error("Failed to create runtime directory "AVAHI_DAEMON_RUNTIME_DIR".");
- goto fail;
- }
-
- r = 0;
-
-fail:
- if (reset_umask)
- umask(u);
- return r;
-}
-
-static void set_one_rlimit(int resource, rlim_t limit, const char *name) {
- struct rlimit rl;
- rl.rlim_cur = rl.rlim_max = limit;
-
- if (setrlimit(resource, &rl) < 0)
- avahi_log_warn("setrlimit(%s, {%u, %u}) failed: %s", name, (unsigned) limit, (unsigned) limit, strerror(errno));
-}
-
-static void enforce_rlimits(void) {
-#ifdef RLIMIT_AS
- if (config.rlimit_as_set)
- set_one_rlimit(RLIMIT_AS, config.rlimit_as, "RLIMIT_AS");
-#endif
- if (config.rlimit_core_set)
- set_one_rlimit(RLIMIT_CORE, config.rlimit_core, "RLIMIT_CORE");
- if (config.rlimit_data_set)
- set_one_rlimit(RLIMIT_DATA, config.rlimit_data, "RLIMIT_DATA");
- if (config.rlimit_fsize_set)
- set_one_rlimit(RLIMIT_FSIZE, config.rlimit_fsize, "RLIMIT_FSIZE");
- if (config.rlimit_nofile_set)
- set_one_rlimit(RLIMIT_NOFILE, config.rlimit_nofile, "RLIMIT_NOFILE");
- if (config.rlimit_stack_set)
- set_one_rlimit(RLIMIT_STACK, config.rlimit_stack, "RLIMIT_STACK");
-#ifdef RLIMIT_NPROC
- if (config.rlimit_nproc_set)
- set_one_rlimit(RLIMIT_NPROC, config.rlimit_nproc, "RLIMIT_NPROC");
-#endif
-
- /* the sysctl() call from iface-pfroute.c needs locked memory on FreeBSD */
-#if defined(RLIMIT_MEMLOCK) && !defined(__FreeBSD__)
- /* We don't need locked memory */
- set_one_rlimit(RLIMIT_MEMLOCK, 0, "RLIMIT_MEMLOCK");
-#endif
-}
-
-#define RANDOM_DEVICE "/dev/urandom"
-
-static void init_rand_seed(void) {
- int fd;
- unsigned seed = 0;
-
- /* Try to initialize seed from /dev/urandom, to make it a little
- * less predictable, and to make sure that multiple machines
- * booted at the same time choose different random seeds. */
- if ((fd = open(RANDOM_DEVICE, O_RDONLY)) >= 0) {
- read(fd, &seed, sizeof(seed));
- close(fd);
- }
-
- /* If the initialization failed by some reason, we add the time to the seed*/
- seed |= (unsigned) time(NULL);
-
- srand(seed);
-}
-
-int main(int argc, char *argv[]) {
- int r = 255;
- int wrote_pid_file = 0;
-
- avahi_set_log_function(log_function);
-
- init_rand_seed();
-
- avahi_server_config_init(&config.server_config);
- config.command = DAEMON_RUN;
- config.daemonize = 0;
- config.config_file = NULL;
-#ifdef HAVE_DBUS
- config.enable_dbus = 1;
- config.fail_on_missing_dbus = 1;
-#endif
-
- config.drop_root = 1;
- config.set_rlimits = 1;
-#ifdef ENABLE_CHROOT
- config.use_chroot = 1;
-#endif
- config.modify_proc_title = 1;
-
- config.disable_user_service_publishing = 0;
- config.publish_dns_servers = NULL;
- config.publish_resolv_conf = 0;
- config.use_syslog = 0;
- config.debug = 0;
- config.rlimit_as_set = 0;
- config.rlimit_core_set = 0;
- config.rlimit_data_set = 0;
- config.rlimit_fsize_set = 0;
- config.rlimit_nofile_set = 0;
- config.rlimit_stack_set = 0;
-#ifdef RLIMIT_NPROC
- config.rlimit_nproc_set = 0;
-#endif
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0 = avahi_strdup(argv0 + 1);
- else
- argv0 = avahi_strdup(argv[0]);
-
- daemon_pid_file_ident = (const char *) argv0;
- daemon_log_ident = (char*) argv0;
- daemon_pid_file_proc = pid_file_proc;
-
- if (parse_command_line(&config, argc, argv) < 0)
- goto finish;
-
- if (config.modify_proc_title)
- avahi_init_proc_title(argc, argv);
-
-#ifdef ENABLE_CHROOT
- config.use_chroot = config.use_chroot && config.drop_root;
-#endif
-
- if (config.command == DAEMON_HELP) {
- help(stdout);
- r = 0;
- } else if (config.command == DAEMON_VERSION) {
- printf("%s "PACKAGE_VERSION"\n", argv0);
- r = 0;
- } else if (config.command == DAEMON_KILL) {
- if (daemon_pid_file_kill_wait(SIGTERM, 5) < 0) {
- avahi_log_warn("Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
-
- } else if (config.command == DAEMON_RELOAD) {
- if (daemon_pid_file_kill(SIGHUP) < 0) {
- avahi_log_warn("Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
-
- } else if (config.command == DAEMON_CHECK)
- r = (daemon_pid_file_is_running() >= 0) ? 0 : 1;
- else if (config.command == DAEMON_RUN) {
- pid_t pid;
-
- if (getuid() != 0 && config.drop_root) {
- avahi_log_error("This program is intended to be run as root.");
- goto finish;
- }
-
- if ((pid = daemon_pid_file_is_running()) >= 0) {
- avahi_log_error("Daemon already running on PID %u", pid);
- goto finish;
- }
-
- if (load_config_file(&config) < 0)
- goto finish;
-
- if (config.daemonize) {
- daemon_retval_init();
-
- if ((pid = daemon_fork()) < 0)
- goto finish;
- else if (pid != 0) {
- int ret;
- /** Parent **/
-
- if ((ret = daemon_retval_wait(20)) < 0) {
- avahi_log_error("Could not receive return value from daemon process.");
- goto finish;
- }
-
- r = ret;
- goto finish;
- }
-
- /* Child */
- }
-
- if (config.use_syslog || config.daemonize)
- daemon_log_use = DAEMON_LOG_SYSLOG;
-
- if (make_runtime_dir() < 0)
- goto finish;
-
- if (config.drop_root) {
-#ifdef ENABLE_CHROOT
- if (config.use_chroot)
- if (avahi_caps_reduce() < 0)
- goto finish;
-#endif
-
- if (drop_root() < 0)
- goto finish;
-
-#ifdef ENABLE_CHROOT
- if (config.use_chroot)
- if (avahi_caps_reduce2() < 0)
- goto finish;
-#endif
- }
-
- if (daemon_pid_file_create() < 0) {
- avahi_log_error("Failed to create PID file: %s", strerror(errno));
-
- if (config.daemonize)
- daemon_retval_send(1);
- goto finish;
- } else
- wrote_pid_file = 1;
-
- if (config.set_rlimits)
- enforce_rlimits();
-
- chdir("/");
-
-#ifdef ENABLE_CHROOT
- if (config.drop_root && config.use_chroot)
- if (avahi_chroot_helper_start(argv0) < 0) {
- avahi_log_error("failed to start chroot() helper daemon.");
- goto finish;
- }
-#endif
- avahi_log_info("%s "PACKAGE_VERSION" starting up.", argv0);
-
- avahi_set_proc_title("%s: starting up", argv0);
-
- if (run_server(&config) == 0)
- r = 0;
- }
-
-finish:
-
- if (config.daemonize)
- daemon_retval_done();
-
- avahi_server_config_free(&config.server_config);
- avahi_free(config.config_file);
- avahi_strfreev(config.publish_dns_servers);
- avahi_strfreev(resolv_conf);
-
- if (wrote_pid_file) {
-#ifdef ENABLE_CHROOT
- avahi_chroot_helper_unlink(pid_file_proc());
-#else
- daemon_pid_file_remove();
-#endif
- }
-
-#ifdef ENABLE_CHROOT
- avahi_chroot_helper_shutdown();
-#endif
-
- avahi_free(argv0);
-
- return r;
-}
diff --git a/release-0.6.9/avahi-daemon/main.h b/release-0.6.9/avahi-daemon/main.h
deleted file mode 100644
index 77af0d0..0000000
--- a/release-0.6.9/avahi-daemon/main.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef foomainhfoo
-#define foomainhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-core/core.h>
-#include <avahi-common/simple-watch.h>
-
-extern AvahiServer *avahi_server;
-extern AvahiSimplePoll *simple_poll_api;
-
-extern int nss_support;
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/setproctitle.c b/release-0.6.9/avahi-daemon/setproctitle.c
deleted file mode 100644
index f8d3ddb..0000000
--- a/release-0.6.9/avahi-daemon/setproctitle.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <unistd.h>
-
-#include <avahi-common/malloc.h>
-
-#include "setproctitle.h"
-
-#if !defined(HAVE_SETPROCTITLE) && defined(__linux__)
-static char** argv_buffer = NULL;
-static size_t argv_size = 0;
-
-#if !HAVE_DECL_ENVIRON
-extern char **environ;
-#endif
-
-#endif
-
-void avahi_init_proc_title(int argc, char **argv) {
-
-#if !defined(HAVE_SETPROCTITLE) && defined(__linux__)
-
- unsigned i;
- char **new_environ, *endptr;
-
- /* This code is really really ugly. We make some memory layout
- * assumptions and reuse the environment array as memory to store
- * our process title in */
-
- for (i = 0; environ[i]; i++);
-
- endptr = i ? environ[i-1] + strlen(environ[i-1]) : argv[argc-1] + strlen(argv[argc-1]);
-
- argv_buffer = argv;
- argv_size = endptr - argv_buffer[0];
-
- /* Make a copy of environ */
-
- new_environ = avahi_malloc(sizeof(char*) * (i + 1));
- for (i = 0; environ[i]; i++)
- new_environ[i] = avahi_strdup(environ[i]);
- new_environ[i] = NULL;
-
- environ = new_environ;
-
-#endif
-}
-
-void avahi_set_proc_title(const char *fmt,...) {
-#ifdef HAVE_SETPROCTITLE
- char t[256];
-
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(t, sizeof(t), fmt, ap);
- va_end(ap);
-
- setproctitle("-%s", t);
-#elif __linux__
- size_t l;
- va_list ap;
-
- if (!argv_buffer)
- return;
-
- va_start(ap, fmt);
- vsnprintf(argv_buffer[0], argv_size, fmt, ap);
- va_end(ap);
-
- l = strlen(argv_buffer[0]);
-
- memset(argv_buffer[0] + l, 0, argv_size - l);
- argv_buffer[1] = NULL;
-#endif
-}
diff --git a/release-0.6.9/avahi-daemon/setproctitle.h b/release-0.6.9/avahi-daemon/setproctitle.h
deleted file mode 100644
index 6ac7612..0000000
--- a/release-0.6.9/avahi-daemon/setproctitle.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef foosetproctitlehfoo
-#define foosetproctitlehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-void avahi_init_proc_title(int argc, char **argv);
-void avahi_set_proc_title(const char *fmt, ...);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/simple-protocol.c b/release-0.6.9/avahi-daemon/simple-protocol.c
deleted file mode 100644
index 3cac713..0000000
--- a/release-0.6.9/avahi-daemon/simple-protocol.c
+++ /dev/null
@@ -1,540 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include <avahi-core/log.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/dns-srv-rr.h>
-
-#include "simple-protocol.h"
-#include "main.h"
-
-#ifdef ENABLE_CHROOT
-#include "chroot.h"
-#endif
-
-#define BUFFER_SIZE (20*1024)
-
-#define CLIENTS_MAX 50
-
-typedef struct Client Client;
-typedef struct Server Server;
-
-typedef enum {
- CLIENT_IDLE,
- CLIENT_RESOLVE_HOSTNAME,
- CLIENT_RESOLVE_ADDRESS,
- CLIENT_BROWSE_DNS_SERVERS,
- CLIENT_DEAD
-} ClientState;
-
-struct Client {
- Server *server;
-
- ClientState state;
-
- int fd;
- AvahiWatch *watch;
-
- char inbuf[BUFFER_SIZE], outbuf[BUFFER_SIZE];
- size_t inbuf_length, outbuf_length;
-
- AvahiSHostNameResolver *host_name_resolver;
- AvahiSAddressResolver *address_resolver;
- AvahiSDNSServerBrowser *dns_server_browser;
-
- AvahiProtocol afquery;
-
- AVAHI_LLIST_FIELDS(Client, clients);
-};
-
-struct Server {
- const AvahiPoll *poll_api;
- int fd;
- AvahiWatch *watch;
- AVAHI_LLIST_HEAD(Client, clients);
-
- unsigned n_clients;
- int bind_successful;
-};
-
-static Server *server = NULL;
-
-static void client_work(AvahiWatch *watch, int fd, AvahiWatchEvent events, void *userdata);
-
-static void client_free(Client *c) {
- assert(c);
-
- assert(c->server->n_clients >= 1);
- c->server->n_clients--;
-
- if (c->host_name_resolver)
- avahi_s_host_name_resolver_free(c->host_name_resolver);
-
- if (c->address_resolver)
- avahi_s_address_resolver_free(c->address_resolver);
-
- if (c->dns_server_browser)
- avahi_s_dns_server_browser_free(c->dns_server_browser);
-
- c->server->poll_api->watch_free(c->watch);
- close(c->fd);
-
- AVAHI_LLIST_REMOVE(Client, clients, c->server->clients, c);
- avahi_free(c);
-}
-
-static void client_new(Server *s, int fd) {
- Client *c;
-
- assert(fd >= 0);
-
- c = avahi_new(Client, 1);
- c->server = s;
- c->fd = fd;
- c->state = CLIENT_IDLE;
-
- c->inbuf_length = c->outbuf_length = 0;
-
- c->host_name_resolver = NULL;
- c->address_resolver = NULL;
- c->dns_server_browser = NULL;
-
- c->watch = s->poll_api->watch_new(s->poll_api, fd, AVAHI_WATCH_IN, client_work, c);
-
- AVAHI_LLIST_PREPEND(Client, clients, s->clients, c);
- s->n_clients++;
-}
-
-static void client_output(Client *c, const uint8_t*data, size_t size) {
- size_t k, m;
-
- assert(c);
- assert(data);
-
- if (!size)
- return;
-
- k = sizeof(c->outbuf) - c->outbuf_length;
- m = size > k ? k : size;
-
- memcpy(c->outbuf + c->outbuf_length, data, m);
- c->outbuf_length += m;
-
- server->poll_api->watch_update(c->watch, AVAHI_WATCH_OUT);
-}
-
-static void client_output_printf(Client *c, const char *format, ...) {
- char *t;
- va_list ap;
-
- va_start(ap, format);
- t = avahi_strdup_vprintf(format, ap);
- va_end(ap);
-
- client_output(c, (uint8_t*) t, strlen(t));
- avahi_free(t);
-}
-
-static void host_name_resolver_callback(
- AVAHI_GCC_UNUSED AvahiSHostNameResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *hostname,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- Client *c = userdata;
-
- assert(c);
-
- if (event == AVAHI_RESOLVER_FAILURE)
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- else if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(t, sizeof(t), a);
- client_output_printf(c, "+ %i %u %s %s\n", iface, protocol, hostname, t);
- }
-
- c->state = CLIENT_DEAD;
-}
-
-static void address_resolver_callback(
- AVAHI_GCC_UNUSED AvahiSAddressResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- AVAHI_GCC_UNUSED const AvahiAddress *a,
- const char *hostname,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- Client *c = userdata;
-
- assert(c);
-
- if (event == AVAHI_RESOLVER_FAILURE)
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- else if (event == AVAHI_RESOLVER_FOUND)
- client_output_printf(c, "+ %i %u %s\n", iface, protocol, hostname);
-
- c->state = CLIENT_DEAD;
-}
-
-static void dns_server_browser_callback(
- AVAHI_GCC_UNUSED AvahiSDNSServerBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AVAHI_GCC_UNUSED const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- Client *c = userdata;
- char t[AVAHI_ADDRESS_STR_MAX];
-
- assert(c);
-
- if (!a)
- return;
-
- switch (event) {
- case AVAHI_BROWSER_FAILURE:
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- c->state = CLIENT_DEAD;
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- break;
-
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
-
- avahi_address_snprint(t, sizeof(t), a);
- client_output_printf(c, "%c %i %u %s %u\n", event == AVAHI_BROWSER_NEW ? '>' : '<', interface, protocol, t, port);
- break;
- }
-}
-
-static void handle_line(Client *c, const char *s) {
- char cmd[64], arg[64];
- int n_args;
-
- assert(c);
- assert(s);
-
- if (c->state != CLIENT_IDLE)
- return;
-
- if ((n_args = sscanf(s, "%63s %63s", cmd, arg)) < 1 ) {
- client_output_printf(c, "%+i Failed to parse command, try \"HELP\".\n", AVAHI_ERR_INVALID_OPERATION);
- c->state = CLIENT_DEAD;
- return;
- }
-
- if (strcmp(cmd, "HELP") == 0) {
- client_output_printf(c,
- "+ Available commands are:\n"
- "+ RESOLVE-HOSTNAME <hostname>\n"
- "+ RESOLVE-HOSTNAME-IPV6 <hostname>\n"
- "+ RESOLVE-HOSTNAME-IPV4 <hostname>\n"
- "+ RESOLVE-ADDRESS <address>\n"
- "+ BROWSE-DNS-SERVERS\n"
- "+ BROWSE-DNS-SERVERS-IPV4\n"
- "+ BROWSE-DNS-SERVERS-IPV6\n");
- c->state = CLIENT_DEAD; }
- else if (strcmp(cmd, "FUCK") == 0 && n_args == 1) {
- client_output_printf(c, "+ FUCK: Go fuck yourself!\n");
- c->state = CLIENT_DEAD;
- } else if (strcmp(cmd, "RESOLVE-HOSTNAME-IPV4") == 0 && n_args == 2) {
- c->state = CLIENT_RESOLVE_HOSTNAME;
- if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, arg, c->afquery = AVAHI_PROTO_INET, AVAHI_LOOKUP_USE_MULTICAST, host_name_resolver_callback, c)))
- goto fail;
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
- } else if (strcmp(cmd, "RESOLVE-HOSTNAME-IPV6") == 0 && n_args == 2) {
- c->state = CLIENT_RESOLVE_HOSTNAME;
- if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, arg, c->afquery = AVAHI_PROTO_INET6, AVAHI_LOOKUP_USE_MULTICAST, host_name_resolver_callback, c)))
- goto fail;
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
- } else if (strcmp(cmd, "RESOLVE-HOSTNAME") == 0 && n_args == 2) {
- c->state = CLIENT_RESOLVE_HOSTNAME;
- if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, arg, c->afquery = AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_USE_MULTICAST, host_name_resolver_callback, c)))
- goto fail;
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
- } else if (strcmp(cmd, "RESOLVE-ADDRESS") == 0 && n_args == 2) {
- AvahiAddress addr;
-
- if (!(avahi_address_parse(arg, AVAHI_PROTO_UNSPEC, &addr))) {
- client_output_printf(c, "%+i Failed to parse address \"%s\".\n", AVAHI_ERR_INVALID_ADDRESS, arg);
- c->state = CLIENT_DEAD;
- } else {
- c->state = CLIENT_RESOLVE_ADDRESS;
- if (!(c->address_resolver = avahi_s_address_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, &addr, AVAHI_LOOKUP_USE_MULTICAST, address_resolver_callback, c)))
- goto fail;
- }
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
-
- } else if (strcmp(cmd, "BROWSE-DNS-SERVERS-IPV4") == 0 && n_args == 1) {
- c->state = CLIENT_BROWSE_DNS_SERVERS;
- if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AVAHI_PROTO_INET, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c)))
- goto fail;
- client_output_printf(c, "+ Browsing ...\n");
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
-
- } else if (strcmp(cmd, "BROWSE-DNS-SERVERS-IPV6") == 0 && n_args == 1) {
- c->state = CLIENT_BROWSE_DNS_SERVERS;
- if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AVAHI_PROTO_INET6, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c)))
- goto fail;
- client_output_printf(c, "+ Browsing ...\n");
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
-
- } else if (strcmp(cmd, "BROWSE-DNS-SERVERS") == 0 && n_args == 1) {
- c->state = CLIENT_BROWSE_DNS_SERVERS;
- if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c)))
- goto fail;
- client_output_printf(c, "+ Browsing ...\n");
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
-
- } else {
- client_output_printf(c, "%+i Invalid command \"%s\", try \"HELP\".\n", AVAHI_ERR_INVALID_OPERATION, cmd);
- c->state = CLIENT_DEAD;
-
- avahi_log_debug(__FILE__": Got invalid request '%s'.", cmd);
- }
-
- return;
-
-fail:
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- c->state = CLIENT_DEAD;
-}
-
-static void handle_input(Client *c) {
- assert(c);
-
- for (;;) {
- char *e;
- size_t k;
-
- if (!(e = memchr(c->inbuf, '\n', c->inbuf_length)))
- break;
-
- k = e - (char*) c->inbuf;
- *e = 0;
-
- handle_line(c, c->inbuf);
- c->inbuf_length -= k + 1;
- memmove(c->inbuf, e+1, c->inbuf_length);
- }
-}
-
-static void client_work(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEvent events, void *userdata) {
- Client *c = userdata;
-
- assert(c);
-
- if ((events & AVAHI_WATCH_IN) && c->inbuf_length < sizeof(c->inbuf)) {
- ssize_t r;
-
- if ((r = read(c->fd, c->inbuf + c->inbuf_length, sizeof(c->inbuf) - c->inbuf_length)) <= 0) {
- if (r < 0)
- avahi_log_warn("read(): %s", strerror(errno));
- client_free(c);
- return;
- }
-
- c->inbuf_length += r;
- assert(c->inbuf_length <= sizeof(c->inbuf));
-
- handle_input(c);
- }
-
- if ((events & AVAHI_WATCH_OUT) && c->outbuf_length > 0) {
- ssize_t r;
-
- if ((r = write(c->fd, c->outbuf, c->outbuf_length)) < 0) {
- avahi_log_warn("write(): %s", strerror(errno));
- client_free(c);
- return;
- }
-
- assert((size_t) r <= c->outbuf_length);
- c->outbuf_length -= r;
-
- if (c->outbuf_length)
- memmove(c->outbuf, c->outbuf + r, c->outbuf_length - r);
-
- if (c->outbuf_length == 0 && c->state == CLIENT_DEAD) {
- client_free(c);
- return;
- }
- }
-
- c->server->poll_api->watch_update(
- watch,
- (c->outbuf_length > 0 ? AVAHI_WATCH_OUT : 0) |
- (c->inbuf_length < sizeof(c->inbuf) ? AVAHI_WATCH_IN : 0));
-}
-
-static void server_work(AVAHI_GCC_UNUSED AvahiWatch *watch, int fd, AvahiWatchEvent events, void *userdata) {
- Server *s = userdata;
-
- assert(s);
-
- if (events & AVAHI_WATCH_IN) {
- int cfd;
-
- if ((cfd = accept(fd, NULL, NULL)) < 0)
- avahi_log_error("accept(): %s", strerror(errno));
- else
- client_new(s, cfd);
- }
-}
-
-int simple_protocol_setup(const AvahiPoll *poll_api) {
- struct sockaddr_un sa;
- mode_t u;
-
- assert(!server);
-
- server = avahi_new(Server, 1);
- server->poll_api = poll_api;
- server->bind_successful = 0;
- server->fd = -1;
- server->n_clients = 0;
- AVAHI_LLIST_HEAD_INIT(Client, server->clients);
- server->watch = NULL;
-
- u = umask(0000);
-
- if ((server->fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
- avahi_log_warn("socket(PF_LOCAL, SOCK_STREAM, 0): %s", strerror(errno));
- goto fail;
- }
-
- memset(&sa, 0, sizeof(sa));
- sa.sun_family = AF_LOCAL;
- strncpy(sa.sun_path, AVAHI_SOCKET, sizeof(sa.sun_path)-1);
-
- /* We simply remove existing UNIX sockets under this name. The
- Avahi daemons makes sure that it runs only once on a host,
- therefore sockets that already exist are stale and may be
- removed without any ill effects */
-
- unlink(AVAHI_SOCKET);
-
- if (bind(server->fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
- avahi_log_warn("bind(): %s", strerror(errno));
- goto fail;
- }
-
- server->bind_successful = 1;
-
- if (listen(server->fd, 2) < 0) {
- avahi_log_warn("listen(): %s", strerror(errno));
- goto fail;
- }
-
- umask(u);
-
- server->watch = poll_api->watch_new(poll_api, server->fd, AVAHI_WATCH_IN, server_work, server);
-
- return 0;
-
-fail:
-
- umask(u);
- simple_protocol_shutdown();
-
- return -1;
-}
-
-void simple_protocol_shutdown(void) {
-
- if (server) {
-
- if (server->bind_successful)
-#ifdef ENABLE_CHROOT
- avahi_chroot_helper_unlink(AVAHI_SOCKET);
-#else
- unlink(AVAHI_SOCKET);
-#endif
-
- while (server->clients)
- client_free(server->clients);
-
- if (server->watch)
- server->poll_api->watch_free(server->watch);
-
- if (server->fd >= 0)
- close(server->fd);
-
- avahi_free(server);
-
- server = NULL;
- }
-}
-
-void simple_protocol_restart_queries(void) {
- Client *c;
-
- /* Restart queries in case of local domain name changes */
-
- assert(server);
-
- for (c = server->clients; c; c = c->clients_next)
- if (c->state == CLIENT_BROWSE_DNS_SERVERS && c->dns_server_browser) {
- avahi_s_dns_server_browser_free(c->dns_server_browser);
- c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c);
- }
-}
-
-
diff --git a/release-0.6.9/avahi-daemon/simple-protocol.h b/release-0.6.9/avahi-daemon/simple-protocol.h
deleted file mode 100644
index 1e64036..0000000
--- a/release-0.6.9/avahi-daemon/simple-protocol.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef foosimpleprotocolhfoo
-#define foosimpleprotocolhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/watch.h>
-
-int simple_protocol_setup(const AvahiPoll *poll_api);
-void simple_protocol_shutdown(void);
-void simple_protocol_restart_queries(void);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/ssh.service b/release-0.6.9/avahi-daemon/ssh.service
deleted file mode 100644
index 41e3a5a..0000000
--- a/release-0.6.9/avahi-daemon/ssh.service
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<!-- See avahi.service(5) for more information about this configuration file -->
-
-<service-group>
-
- <name replace-wildcards="yes">Remote Terminal on %h</name>
-
- <service>
- <type>_ssh._tcp</type>
- <port>22</port>
- </service>
-
-</service-group>
diff --git a/release-0.6.9/avahi-daemon/static-hosts.c b/release-0.6.9/avahi-daemon/static-hosts.c
deleted file mode 100644
index 17b268b..0000000
--- a/release-0.6.9/avahi-daemon/static-hosts.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-
-#include "main.h"
-#include "static-hosts.h"
-
-typedef struct StaticHost StaticHost;
-
-struct StaticHost {
- AvahiSEntryGroup *group;
-
- char *host, *ip;
-
- AVAHI_LLIST_FIELDS(StaticHost, hosts);
-};
-
-static AVAHI_LLIST_HEAD(StaticHost, hosts) = NULL;
-
-static void add_static_host_to_server(StaticHost *h);
-static void remove_static_host_from_server(StaticHost *h);
-
-static void entry_group_callback(AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *eg, AvahiEntryGroupState state, void* userdata) {
- StaticHost *h;
-
- assert(s);
- assert(eg);
-
- h = userdata;
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_COLLISION:
- avahi_log_error("Host name conflict for \"%s\", not established.", h->host);
- break;
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
- avahi_log_notice ("Static host name \"%s\" successfully established.", h->host);
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- avahi_log_notice ("Failed to establish static host name \"%s\": %s.", h->host, avahi_strerror (avahi_server_errno (s)));
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static StaticHost *static_host_new(void) {
- StaticHost *s;
-
- s = avahi_new(StaticHost, 1);
-
- s->group = NULL;
- s->host = NULL;
- s->ip = NULL;
-
- AVAHI_LLIST_PREPEND(StaticHost, hosts, hosts, s);
-
- return s;
-}
-
-static void static_host_free(StaticHost *s) {
- assert(s);
-
- AVAHI_LLIST_REMOVE(StaticHost, hosts, hosts, s);
-
- avahi_s_entry_group_free (s->group);
-
- avahi_free(s->host);
- avahi_free(s->ip);
-
- avahi_free(s);
-}
-
-static void add_static_host_to_server(StaticHost *h)
-{
- AvahiAddress a;
- int err;
-
- if (!h->group)
- h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h);
-
- if (!avahi_address_parse (h->ip, AVAHI_PROTO_UNSPEC, &a)) {
- avahi_log_error("Static host name %s: avahi_address_parse failed", h->host);
- return;
- }
-
- if ((err = avahi_server_add_address(avahi_server, h->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, h->host, &a))) {
- avahi_log_error ("Static host name %s: avahi_server_add_address failure: %s", h->host, avahi_strerror(err));
- return;
- }
-
- avahi_s_entry_group_commit (h->group);
-}
-
-static void remove_static_host_from_server(StaticHost *h)
-{
- avahi_s_entry_group_reset (h->group);
-}
-
-void static_hosts_add_to_server(void) {
- StaticHost *h;
-
- for (h = hosts; h; h = h->hosts_next) {
- add_static_host_to_server(h);
- }
-}
-
-void static_hosts_remove_from_server(void) {
- StaticHost *h;
-
- for (h = hosts; h; h = h->hosts_next) {
- remove_static_host_from_server(h);
- }
-}
-
-void static_hosts_load(int in_chroot) {
- FILE *f;
- unsigned int line = 0;
- const char *filename = (in_chroot ? "/hosts" : AVAHI_CONFIG_DIR "/hosts");
-
- if (!(f = fopen(filename, "r")))
- {
- if (errno != ENOENT)
- avahi_log_error ("Failed to open static hosts file: %s", strerror (errno));
- return;
- }
-
- while (!feof(f)) {
- unsigned int len;
- char ln[256], *s;
- char *host, *ip;
- StaticHost *h;
-
- if (!fgets(ln, sizeof (ln), f))
- break;
-
- line++;
-
- /* Find the start of the line, ignore whitespace */
- s = ln + strspn(ln, " \t");
- /* Set the end of the string to NULL */
- s[strcspn(s, "#\r\n")] = 0;
-
- /* Ignore blank lines */
- if (*s == 0)
- continue;
-
- /* Read the first string (ip) up to the next whitespace */
- len = strcspn(s, " \t");
- ip = avahi_strndup(s, len);
-
- /* Skip past it */
- s += len;
-
- /* Find the next token */
- s += strspn(s, " \t");
- len = strcspn(s, " \t");
- host = avahi_strndup(s, len);
-
- if (*host == 0)
- {
- avahi_log_error("%s:%d: Error, unexpected end of line!", filename, line);
- avahi_free(host);
- avahi_free(ip);
- break;
- }
-
- /* Skip over the host */
- s += len;
-
- /* Skip past any more spaces */
- s += strspn(s, " \t");
-
- /* Anything left? */
- if (*s != 0) {
- avahi_log_error ("%s:%d: Junk on the end of the line!", filename, line);
- avahi_free(host);
- avahi_free(ip);
- break;
- }
-
- h = static_host_new();
- h->host = host;
- h->ip = ip;
- }
-
- fclose(f);
-}
-
-void static_hosts_free_all (void)
-{
- while(hosts)
- static_host_free(hosts);
-}
diff --git a/release-0.6.9/avahi-daemon/static-hosts.h b/release-0.6.9/avahi-daemon/static-hosts.h
deleted file mode 100644
index 2fdb0bd..0000000
--- a/release-0.6.9/avahi-daemon/static-hosts.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foostatichostshfoo
-#define foostatichostshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-void static_hosts_load(int in_chroot);
-void static_hosts_free_all(void);
-void static_hosts_add_to_server(void);
-void static_hosts_remove_from_server(void);
-
-#endif
diff --git a/release-0.6.9/avahi-daemon/static-services.c b/release-0.6.9/avahi-daemon/static-services.c
deleted file mode 100644
index a750c2f..0000000
--- a/release-0.6.9/avahi-daemon/static-services.c
+++ /dev/null
@@ -1,712 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/stat.h>
-#include <glob.h>
-#include <limits.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <expat.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-
-#include "main.h"
-#include "static-services.h"
-
-typedef struct StaticService StaticService;
-typedef struct StaticServiceGroup StaticServiceGroup;
-
-struct StaticService {
- StaticServiceGroup *group;
-
- char *type;
- char *domain_name;
- char *host_name;
- uint16_t port;
- int protocol;
-
- AvahiStringList *subtypes;
-
- AvahiStringList *txt_records;
-
- AVAHI_LLIST_FIELDS(StaticService, services);
-};
-
-struct StaticServiceGroup {
- char *filename;
- time_t mtime;
-
- char *name, *chosen_name;
- int replace_wildcards;
-
- AvahiSEntryGroup *entry_group;
- AVAHI_LLIST_HEAD(StaticService, services);
- AVAHI_LLIST_FIELDS(StaticServiceGroup, groups);
-};
-
-static AVAHI_LLIST_HEAD(StaticServiceGroup, groups) = NULL;
-
-static char *replacestr(const char *pattern, const char *a, const char *b) {
- char *r = NULL, *e, *n;
-
- while ((e = strstr(pattern, a))) {
- char *k;
-
- k = avahi_strndup(pattern, e - pattern);
- if (r)
- n = avahi_strdup_printf("%s%s%s", r, k, b);
- else
- n = avahi_strdup_printf("%s%s", k, b);
-
- avahi_free(k);
- avahi_free(r);
- r = n;
-
- pattern = e + strlen(a);
- }
-
- if (!r)
- return avahi_strdup(pattern);
-
- n = avahi_strdup_printf("%s%s", r, pattern);
- avahi_free(r);
-
- return n;
-}
-
-static void add_static_service_group_to_server(StaticServiceGroup *g);
-static void remove_static_service_group_from_server(StaticServiceGroup *g);
-
-static StaticService *static_service_new(StaticServiceGroup *group) {
- StaticService *s;
-
- assert(group);
- s = avahi_new(StaticService, 1);
- s->group = group;
-
- s->type = s->host_name = s->domain_name = NULL;
- s->port = 0;
- s->protocol = AVAHI_PROTO_UNSPEC;
-
- s->txt_records = NULL;
- s->subtypes = NULL;
-
- AVAHI_LLIST_PREPEND(StaticService, services, group->services, s);
-
- return s;
-}
-
-static StaticServiceGroup *static_service_group_new(char *filename) {
- StaticServiceGroup *g;
- assert(filename);
-
- g = avahi_new(StaticServiceGroup, 1);
- g->filename = avahi_strdup(filename);
- g->mtime = 0;
- g->name = g->chosen_name = NULL;
- g->replace_wildcards = 0;
- g->entry_group = NULL;
-
- AVAHI_LLIST_HEAD_INIT(StaticService, g->services);
- AVAHI_LLIST_PREPEND(StaticServiceGroup, groups, groups, g);
-
- return g;
-}
-
-static void static_service_free(StaticService *s) {
- assert(s);
-
- AVAHI_LLIST_REMOVE(StaticService, services, s->group->services, s);
-
- avahi_free(s->type);
- avahi_free(s->host_name);
- avahi_free(s->domain_name);
-
- avahi_string_list_free(s->txt_records);
- avahi_string_list_free(s->subtypes);
-
- avahi_free(s);
-}
-
-static void static_service_group_free(StaticServiceGroup *g) {
- assert(g);
-
- if (g->entry_group)
- avahi_s_entry_group_free(g->entry_group);
-
- while (g->services)
- static_service_free(g->services);
-
- AVAHI_LLIST_REMOVE(StaticServiceGroup, groups, groups, g);
-
- avahi_free(g->filename);
- avahi_free(g->name);
- avahi_free(g->chosen_name);
- avahi_free(g);
-}
-
-static void entry_group_callback(AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *eg, AvahiEntryGroupState state, void* userdata) {
- StaticServiceGroup *g = userdata;
-
- assert(s);
- assert(g);
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
-
- remove_static_service_group_from_server(g);
-
- n = avahi_alternative_service_name(g->chosen_name);
- avahi_free(g->chosen_name);
- g->chosen_name = n;
-
- avahi_log_notice("Service name conflict for \"%s\" (%s), retrying with \"%s\".", g->name, g->filename, g->chosen_name);
-
- add_static_service_group_to_server(g);
- break;
- }
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
- avahi_log_info("Service \"%s\" (%s) successfully established.", g->chosen_name, g->filename);
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- avahi_log_warn("Failed to publish service \"%s\" (%s): %s", g->chosen_name, g->filename, avahi_strerror(avahi_server_errno(s)));
- remove_static_service_group_from_server(g);
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void add_static_service_group_to_server(StaticServiceGroup *g) {
- StaticService *s;
-
- assert(g);
-
- if (g->entry_group && !avahi_s_entry_group_is_empty(g->entry_group))
- /* This service group is already registered in the server */
- return;
-
- if (!g->chosen_name) {
-
- if (g->replace_wildcards)
- g->chosen_name = replacestr(g->name, "%h", avahi_server_get_host_name(avahi_server));
- else
- g->chosen_name = avahi_strdup(g->name);
-
- }
-
- if (!g->entry_group)
- g->entry_group = avahi_s_entry_group_new(avahi_server, entry_group_callback, g);
-
- assert(avahi_s_entry_group_is_empty(g->entry_group));
-
- for (s = g->services; s; s = s->services_next) {
- AvahiStringList *i;
-
- if (avahi_server_add_service_strlst(
- avahi_server,
- g->entry_group,
- AVAHI_IF_UNSPEC, s->protocol,
- 0,
- g->chosen_name, s->type, s->domain_name,
- s->host_name, s->port,
- s->txt_records) < 0) {
- avahi_log_error("Failed to add service '%s' of type '%s', ignoring service group (%s): %s",
- g->chosen_name, s->type, g->filename,
- avahi_strerror(avahi_server_errno(avahi_server)));
- remove_static_service_group_from_server(g);
- return;
- }
-
- for (i = s->subtypes; i; i = i->next) {
-
- if (avahi_server_add_service_subtype(
- avahi_server,
- g->entry_group,
- AVAHI_IF_UNSPEC, s->protocol,
- 0,
- g->chosen_name, s->type, s->domain_name,
- (char*) i->text) < 0) {
-
- avahi_log_error("Failed to add subtype '%s' for service '%s' of type '%s', ignoring subtype (%s): %s",
- i->text, g->chosen_name, s->type, g->filename,
- avahi_strerror(avahi_server_errno(avahi_server)));
- }
- }
- }
-
- avahi_s_entry_group_commit(g->entry_group);
-}
-
-static void remove_static_service_group_from_server(StaticServiceGroup *g) {
- assert(g);
-
- if (g->entry_group)
- avahi_s_entry_group_reset(g->entry_group);
-}
-
-typedef enum {
- XML_TAG_INVALID,
- XML_TAG_SERVICE_GROUP,
- XML_TAG_NAME,
- XML_TAG_SERVICE,
- XML_TAG_TYPE,
- XML_TAG_SUBTYPE,
- XML_TAG_DOMAIN_NAME,
- XML_TAG_HOST_NAME,
- XML_TAG_PORT,
- XML_TAG_TXT_RECORD
-} xml_tag_name;
-
-struct xml_userdata {
- StaticServiceGroup *group;
- StaticService *service;
- xml_tag_name current_tag;
- int failed;
- char *buf;
-};
-
-#ifndef XMLCALL
-#define XMLCALL
-#endif
-
-static void XMLCALL xml_start(void *data, const char *el, const char *attr[]) {
- struct xml_userdata *u = data;
-
- assert(u);
-
- if (u->failed)
- return;
-
- if (u->current_tag == XML_TAG_INVALID && strcmp(el, "service-group") == 0) {
-
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_SERVICE_GROUP;
- } else if (u->current_tag == XML_TAG_SERVICE_GROUP && strcmp(el, "name") == 0) {
- u->current_tag = XML_TAG_NAME;
-
- if (attr[0]) {
- if (strcmp(attr[0], "replace-wildcards") == 0)
- u->group->replace_wildcards = strcmp(attr[1], "yes") == 0;
- else
- goto invalid_attr;
-
- if (attr[2])
- goto invalid_attr;
- }
-
- } else if (u->current_tag == XML_TAG_SERVICE_GROUP && strcmp(el, "service") == 0) {
- u->current_tag = XML_TAG_SERVICE;
-
- assert(!u->service);
- u->service = static_service_new(u->group);
-
- if (attr[0]) {
- if (strcmp(attr[0], "protocol") == 0) {
- AvahiProtocol protocol;
-
- if (strcmp(attr[1], "ipv4") == 0) {
- protocol = AVAHI_PROTO_INET;
- } else if (strcmp(attr[1], "ipv6") == 0) {
- protocol = AVAHI_PROTO_INET6;
- } else if (strcmp(attr[1], "any") == 0) {
- protocol = AVAHI_PROTO_UNSPEC;
- } else {
- avahi_log_error("%s: parse failure: invalid protocol specification \"%s\".", u->group->filename, attr[1]);
- u->failed = 1;
- return;
- }
-
- u->service->protocol = protocol;
- } else
- goto invalid_attr;
-
- if (attr[2])
- goto invalid_attr;
- }
-
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "type") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_TYPE;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "subtype") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_SUBTYPE;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "domain-name") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_DOMAIN_NAME;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "host-name") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_HOST_NAME;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "port") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_PORT;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "txt-record") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_TXT_RECORD;
- } else {
- avahi_log_error("%s: parse failure: didn't expect element <%s>.", u->group->filename, el);
- u->failed = 1;
- }
-
- return;
-
-invalid_attr:
- avahi_log_error("%s: parse failure: invalid attribute for element <%s>.", u->group->filename, el);
- u->failed = 1;
- return;
-}
-
-static void XMLCALL xml_end(void *data, AVAHI_GCC_UNUSED const char *el) {
- struct xml_userdata *u = data;
- assert(u);
-
- if (u->failed)
- return;
-
- switch (u->current_tag) {
- case XML_TAG_SERVICE_GROUP:
-
- if (!u->group->name || !u->group->services) {
- avahi_log_error("%s: parse failure: service group incomplete.", u->group->filename);
- u->failed = 1;
- return;
- }
-
- u->current_tag = XML_TAG_INVALID;
- break;
-
- case XML_TAG_SERVICE:
-
- if (!u->service->type) {
- avahi_log_error("%s: parse failure: service incomplete.", u->group->filename);
- u->failed = 1;
- return;
- }
-
- u->service = NULL;
- u->current_tag = XML_TAG_SERVICE_GROUP;
- break;
-
- case XML_TAG_NAME:
- u->current_tag = XML_TAG_SERVICE_GROUP;
- break;
-
- case XML_TAG_PORT: {
- int p;
- assert(u->service);
-
- p = u->buf ? atoi(u->buf) : 0;
-
- if (p < 0 || p > 0xFFFF) {
- avahi_log_error("%s: parse failure: invalid port specification \"%s\".", u->group->filename, u->buf);
- u->failed = 1;
- return;
- }
-
- u->service->port = (uint16_t) p;
-
- u->current_tag = XML_TAG_SERVICE;
- break;
- }
-
- case XML_TAG_TXT_RECORD: {
- assert(u->service);
-
- u->service->txt_records = avahi_string_list_add(u->service->txt_records, u->buf ? u->buf : "");
- u->current_tag = XML_TAG_SERVICE;
- break;
- }
-
- case XML_TAG_SUBTYPE: {
- assert(u->service);
-
- u->service->subtypes = avahi_string_list_add(u->service->subtypes, u->buf ? u->buf : "");
- u->current_tag = XML_TAG_SERVICE;
- break;
- }
-
- case XML_TAG_TYPE:
- case XML_TAG_DOMAIN_NAME:
- case XML_TAG_HOST_NAME:
- u->current_tag = XML_TAG_SERVICE;
- break;
-
- case XML_TAG_INVALID:
- ;
- }
-
- avahi_free(u->buf);
- u->buf = NULL;
-}
-
-static char *append_cdata(char *t, const char *n, int length) {
- char *r, *k;
-
- if (!length)
- return t;
-
-
- k = avahi_strndup(n, length);
-
- if (t) {
- r = avahi_strdup_printf("%s%s", t, k);
- avahi_free(k);
- avahi_free(t);
- } else
- r = k;
-
- return r;
-}
-
-static void XMLCALL xml_cdata(void *data, const XML_Char *s, int len) {
- struct xml_userdata *u = data;
- assert(u);
-
- if (u->failed)
- return;
-
- switch (u->current_tag) {
- case XML_TAG_NAME:
- u->group->name = append_cdata(u->group->name, s, len);
- break;
-
- case XML_TAG_TYPE:
- assert(u->service);
- u->service->type = append_cdata(u->service->type, s, len);
- break;
-
- case XML_TAG_DOMAIN_NAME:
- assert(u->service);
- u->service->domain_name = append_cdata(u->service->domain_name, s, len);
- break;
-
- case XML_TAG_HOST_NAME:
- assert(u->service);
- u->service->host_name = append_cdata(u->service->host_name, s, len);
- break;
-
- case XML_TAG_PORT:
- case XML_TAG_TXT_RECORD:
- case XML_TAG_SUBTYPE:
- assert(u->service);
- u->buf = append_cdata(u->buf, s, len);
- break;
-
- case XML_TAG_SERVICE_GROUP:
- case XML_TAG_SERVICE:
- case XML_TAG_INVALID:
- ;
- }
-}
-
-static int static_service_group_load(StaticServiceGroup *g) {
- XML_Parser parser = NULL;
- int fd = -1;
- struct xml_userdata u;
- int r = -1;
- struct stat st;
- ssize_t n;
-
- assert(g);
-
- u.buf = NULL;
- u.group = g;
- u.service = NULL;
- u.current_tag = XML_TAG_INVALID;
- u.failed = 0;
-
- /* Cleanup old data in this service group, if available */
- remove_static_service_group_from_server(g);
- while (g->services)
- static_service_free(g->services);
-
- avahi_free(g->name);
- avahi_free(g->chosen_name);
- g->name = g->chosen_name = NULL;
- g->replace_wildcards = 0;
-
- if (!(parser = XML_ParserCreate(NULL))) {
- avahi_log_error("XML_ParserCreate() failed.");
- goto finish;
- }
-
- if ((fd = open(g->filename, O_RDONLY)) < 0) {
- avahi_log_error("open(\"%s\", O_RDONLY): %s", g->filename, strerror(errno));
- goto finish;
- }
-
- if (fstat(fd, &st) < 0) {
- avahi_log_error("fstat(): %s", strerror(errno));
- goto finish;
- }
-
- g->mtime = st.st_mtime;
-
- XML_SetUserData(parser, &u);
-
- XML_SetElementHandler(parser, xml_start, xml_end);
- XML_SetCharacterDataHandler(parser, xml_cdata);
-
- do {
- void *buffer;
-
-#define BUFSIZE (10*1024)
-
- if (!(buffer = XML_GetBuffer(parser, BUFSIZE))) {
- avahi_log_error("XML_GetBuffer() failed.");
- goto finish;
- }
-
- if ((n = read(fd, buffer, BUFSIZE)) < 0) {
- avahi_log_error("read(): %s\n", strerror(errno));
- goto finish;
- }
-
- if (!XML_ParseBuffer(parser, n, n == 0)) {
- avahi_log_error("XML_ParseBuffer() failed at line %d: %s.\n", (int) XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser)));
- goto finish;
- }
-
- } while (n != 0);
-
- if (!u.failed)
- r = 0;
-
-finish:
-
- if (fd >= 0)
- close(fd);
-
- if (parser)
- XML_ParserFree(parser);
-
- avahi_free(u.buf);
-
- return r;
-}
-
-static void load_file(char *n) {
- StaticServiceGroup *g;
- assert(n);
-
- for (g = groups; g; g = g->groups_next)
- if (strcmp(g->filename, n) == 0)
- return;
-
- avahi_log_info("Loading service file %s.", n);
-
- g = static_service_group_new(n);
- if (static_service_group_load(g) < 0) {
- avahi_log_error("Failed to load service group file %s, ignoring.", g->filename);
- static_service_group_free(g);
- }
-}
-
-void static_service_load(int in_chroot) {
- StaticServiceGroup *g, *n;
- glob_t globbuf;
- char **p;
-
- for (g = groups; g; g = n) {
- struct stat st;
-
- n = g->groups_next;
-
- if (stat(g->filename, &st) < 0) {
-
- if (errno == ENOENT)
- avahi_log_info("Service group file %s vanished, removing services.", g->filename);
- else
- avahi_log_warn("Failed to stat() file %s, ignoring: %s", g->filename, strerror(errno));
-
- static_service_group_free(g);
- } else if (st.st_mtime != g->mtime) {
- avahi_log_info("Service group file %s changed, reloading.", g->filename);
-
- if (static_service_group_load(g) < 0) {
- avahi_log_warn("Failed to load service group file %s, removing service.", g->filename);
- static_service_group_free(g);
- }
- }
- }
-
- memset(&globbuf, 0, sizeof(globbuf));
- if (glob(in_chroot ? "/services/*.service" : AVAHI_SERVICE_DIR "/*.service", GLOB_ERR, NULL, &globbuf) != 0)
- avahi_log_error("Failed to read service directory.");
- else {
- for (p = globbuf.gl_pathv; *p; p++)
- load_file(*p);
-
- globfree(&globbuf);
- }
-}
-
-void static_service_free_all(void) {
-
- while (groups)
- static_service_group_free(groups);
-}
-
-void static_service_add_to_server(void) {
- StaticServiceGroup *g;
-
- for (g = groups; g; g = g->groups_next)
- add_static_service_group_to_server(g);
-}
-
-void static_service_remove_from_server(void) {
- StaticServiceGroup *g;
-
- for (g = groups; g; g = g->groups_next)
- remove_static_service_group_from_server(g);
-}
diff --git a/release-0.6.9/avahi-daemon/static-services.h b/release-0.6.9/avahi-daemon/static-services.h
deleted file mode 100644
index a2bc355..0000000
--- a/release-0.6.9/avahi-daemon/static-services.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foostaticserviceshfoo
-#define foostaticserviceshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-void static_service_load(int in_chroot);
-void static_service_free_all(void);
-void static_service_add_to_server(void);
-void static_service_remove_from_server(void);
-
-#endif
diff --git a/release-0.6.9/avahi-discover-standalone/Makefile.am b/release-0.6.9/avahi-discover-standalone/Makefile.am
deleted file mode 100644
index bbf1895..0000000
--- a/release-0.6.9/avahi-discover-standalone/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-interfaces = \
- avahi-discover.glade
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_GTK
-bin_PROGRAMS = \
- avahi-discover-standalone
-
-avahi_discover_standalone_SOURCES = \
- main.c
-
-avahi_discover_standalone_CFLAGS = \
- $(AM_CFLAGS) \
- $(GLIB20_CFLAGS) $(GTK20_CFLAGS) $(GLADE20_CFLAGS)\
- -DAVAHI_INTERFACES_DIR=\"$(interfacesdir)\"
-
-avahi_discover_standalone_LDADD = \
- $(AM_LDADD) \
- ../avahi-common/libavahi-common.la \
- ../avahi-glib/libavahi-glib.la \
- ../avahi-core/libavahi-core.la \
- $(GLIB20_LIBS) $(GTK20_LIBS) $(GLADE20_LIBS)
-
-interfaces_DATA = $(interfaces)
-
-else
-
-if HAVE_PYTHON
-if HAVE_DBUS
-
-interfaces_DATA = $(interfaces)
-
-endif
-endif
-endif
-
-EXTRA_DIST = \
- $(interfaces) \
- avahi-discover.gladep
diff --git a/release-0.6.9/avahi-discover-standalone/avahi-discover.glade b/release-0.6.9/avahi-discover-standalone/avahi-discover.glade
deleted file mode 100644
index bb456c2..0000000
--- a/release-0.6.9/avahi-discover-standalone/avahi-discover.glade
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkWindow" id="main_window">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Avahi Discovery</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="default_width">500</property>
- <property name="default_height">400</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <signal handler="gtk_main_quit" name="destroy" after="False"/>
-
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkTreeView" id="tree_view">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</property>
- <signal name="cursor_changed" handler="on_tree_view_cursor_changed" last_modification_time="Sat, 30 Jul 2005 21:39:13 GMT"/>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="info_label">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">&lt;i&gt;No service currently selected.&lt;/i&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/release-0.6.9/avahi-discover-standalone/avahi-discover.gladep b/release-0.6.9/avahi-discover-standalone/avahi-discover.gladep
deleted file mode 100644
index a9feaa6..0000000
--- a/release-0.6.9/avahi-discover-standalone/avahi-discover.gladep
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
-
-<glade-project>
- <name>Avahi-discover</name>
- <program_name>avahi-discover</program_name>
- <gnome_support>FALSE</gnome_support>
-</glade-project>
diff --git a/release-0.6.9/avahi-discover-standalone/main.c b/release-0.6.9/avahi-discover-standalone/main.c
deleted file mode 100644
index 90c74f3..0000000
--- a/release-0.6.9/avahi-discover-standalone/main.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/ioctl.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <unistd.h>
-
-#include <gtk/gtk.h>
-#include <glade/glade.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/lookup.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/error.h>
-
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
-
-struct ServiceType;
-
-struct Service {
- struct ServiceType *service_type;
- gchar *service_name;
- gchar *domain_name;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- GtkTreeRowReference *tree_ref;
-};
-
-struct ServiceType {
- gchar *service_type;
- AvahiSServiceBrowser *browser;
-
- GList *services;
- GtkTreeRowReference *tree_ref;
-};
-
-static GtkWidget *main_window = NULL;
-static GtkTreeView *tree_view = NULL;
-static GtkTreeStore *tree_store = NULL;
-static GtkLabel *info_label = NULL;
-static AvahiServer *server = NULL;
-static AvahiSServiceTypeBrowser *service_type_browser = NULL;
-static GHashTable *service_type_hash_table = NULL;
-static AvahiSServiceResolver *service_resolver = NULL;
-static struct Service *current_service = NULL;
-
-static struct Service *get_service(const gchar *service_type, const gchar *service_name, const gchar*domain_name, AvahiIfIndex interface, AvahiProtocol protocol) {
- struct ServiceType *st;
- GList *l;
-
- if (!(st = g_hash_table_lookup(service_type_hash_table, service_type)))
- return NULL;
-
- for (l = st->services; l; l = l->next) {
- struct Service *s = l->data;
-
- if (s->interface == interface &&
- s->protocol == protocol &&
- avahi_domain_equal(s->service_name, service_name) &&
- avahi_domain_equal(s->domain_name, domain_name))
- return s;
- }
-
- return NULL;
-}
-
-static void free_service(struct Service *s) {
- GtkTreeIter iter;
- GtkTreePath *path;
-
- if (current_service == s) {
- current_service = NULL;
-
- if (service_resolver) {
- avahi_s_service_resolver_free(service_resolver);
- service_resolver = NULL;
- }
-
- gtk_label_set_text(info_label, "<i>Service removed</i>");
- }
-
- s->service_type->services = g_list_remove(s->service_type->services, s);
-
- if ((path = gtk_tree_row_reference_get_path(s->tree_ref))) {
- gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &iter, path);
- gtk_tree_path_free(path);
- }
-
- gtk_tree_store_remove(tree_store, &iter);
-
- gtk_tree_row_reference_free(s->tree_ref);
-
- g_free(s->service_name);
- g_free(s->domain_name);
- g_free(s);
-}
-
-static void service_browser_callback(
- AVAHI_GCC_UNUSED AvahiSServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *service_name,
- const char *service_type,
- const char *domain_name,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- if (event == AVAHI_BROWSER_NEW) {
- struct Service *s;
- GtkTreeIter iter, piter;
- GtkTreePath *path, *ppath;
- gchar iface[256];
- char name[IF_NAMESIZE];
-
- s = g_new(struct Service, 1);
- s->service_name = g_strdup(service_name);
- s->domain_name = g_strdup(domain_name);
- s->interface = interface;
- s->protocol = protocol;
- s->service_type = g_hash_table_lookup(service_type_hash_table, service_type);
- g_assert(s->service_type);
-
- s->service_type->services = g_list_prepend(s->service_type->services, s);
-
- ppath = gtk_tree_row_reference_get_path(s->service_type->tree_ref);
- gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &piter, ppath);
-
- snprintf(iface, sizeof(iface), "%s %s", if_indextoname(interface, name), avahi_proto_to_string(protocol));
-
- gtk_tree_store_append(tree_store, &iter, &piter);
- gtk_tree_store_set(tree_store, &iter, 0, s->service_name, 1, iface, 2, s, -1);
-
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store), &iter);
- s->tree_ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(tree_store), path);
- gtk_tree_path_free(path);
-
- gtk_tree_view_expand_row(tree_view, ppath, FALSE);
- gtk_tree_path_free(ppath);
-
-
- } else if (event == AVAHI_BROWSER_REMOVE) {
- struct Service* s;
-
- if ((s = get_service(service_type, service_name, domain_name, interface, protocol)))
- free_service(s);
- }
-}
-
-static void service_type_browser_callback(
- AVAHI_GCC_UNUSED AvahiSServiceTypeBrowser *b,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *service_type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void * userdata) {
-
- struct ServiceType *st;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- if (event != AVAHI_BROWSER_NEW)
- return;
-
- if (g_hash_table_lookup(service_type_hash_table, service_type))
- return;
-
- st = g_new(struct ServiceType, 1);
- st->service_type = g_strdup(service_type);
- st->services = NULL;
-
- gtk_tree_store_append(tree_store, &iter, NULL);
- gtk_tree_store_set(tree_store, &iter, 0, st->service_type, 1, "", 2, NULL, -1);
-
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store), &iter);
- st->tree_ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(tree_store), path);
- gtk_tree_path_free(path);
-
- g_hash_table_insert(service_type_hash_table, st->service_type, st);
-
- st->browser = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, st->service_type, domain, 0, service_browser_callback, NULL);
-}
-
-static void update_label(struct Service *s, const gchar *hostname, const AvahiAddress *a, guint16 port, AvahiStringList *txt) {
- gchar t[512], address[64], *txt_s;
- char name[IF_NAMESIZE];
-
- if (a && hostname) {
- char na[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(na, sizeof(na), a);
- snprintf(address, sizeof(address), "%s/%s:%u", hostname, na, port);
-
- if (txt)
- txt_s = avahi_string_list_to_string(txt);
- else
- txt_s = g_strdup("<i>empty</i>");
- } else {
- snprintf(address, sizeof(address), "<i>n/a</i>");
- txt_s = g_strdup("<i>n/a</i>");
- }
-
- snprintf(t, sizeof(t),
- "<b>Service Type:</b> %s\n"
- "<b>Service Name:</b> %s\n"
- "<b>Domain Name:</b> %s\n"
- "<b>Interface:</b> %s %s\n"
- "<b>Address:</b> %s\n"
- "<b>TXT Data:</b> %s",
- s->service_type->service_type,
- s->service_name,
- s->domain_name,
- if_indextoname(s->interface,name), avahi_proto_to_string(s->protocol),
- address,
- txt_s);
-
- gtk_label_set_markup(info_label, t);
-
- g_free(txt_s);
-}
-
-static struct Service *get_service_on_cursor(void) {
- GtkTreePath *path;
- struct Service *s;
- GtkTreeIter iter;
-
- gtk_tree_view_get_cursor(tree_view, &path, NULL);
-
- if (!path)
- return NULL;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &iter, path);
- gtk_tree_model_get(GTK_TREE_MODEL(tree_store), &iter, 2, &s, -1);
- gtk_tree_path_free(path);
-
- return s;
-}
-
-static void service_resolver_callback(
- AvahiSServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- AVAHI_GCC_UNUSED const char *name,
- AVAHI_GCC_UNUSED const char *type,
- AVAHI_GCC_UNUSED const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- struct Service *s;
- g_assert(r);
-
- if (!(s = get_service_on_cursor()) || userdata != s) {
- g_assert(r == service_resolver);
- avahi_s_service_resolver_free(service_resolver);
- service_resolver = NULL;
- return;
- }
-
- if (event == AVAHI_RESOLVER_FAILURE) {
- char t[256];
- snprintf(t, sizeof(t), "<i>Failed to resolve: %s.</i>", avahi_strerror(avahi_server_errno(server)));
- gtk_label_set_markup(info_label, t);
- } else if (event == AVAHI_RESOLVER_FOUND)
- update_label(s, host_name, a, port, txt);
-}
-
-static void tree_view_on_cursor_changed(AVAHI_GCC_UNUSED GtkTreeView *tv, AVAHI_GCC_UNUSED gpointer userdata) {
- struct Service *s;
-
- if (!(s = get_service_on_cursor()))
- return;
-
- if (service_resolver)
- avahi_s_service_resolver_free(service_resolver);
-
- update_label(s, NULL, NULL, 0, NULL);
-
- service_resolver = avahi_s_service_resolver_new(server, s->interface, s->protocol, s->service_name, s->service_type->service_type, s->domain_name, AVAHI_PROTO_UNSPEC, 0, service_resolver_callback, s);
-}
-
-static gboolean main_window_on_delete_event(AVAHI_GCC_UNUSED GtkWidget *widget, AVAHI_GCC_UNUSED GdkEvent *event, AVAHI_GCC_UNUSED gpointer user_data) {
- gtk_main_quit();
- return FALSE;
-}
-
-int main(int argc, char *argv[]) {
- GladeXML *xml;
- AvahiServerConfig config;
- GtkTreeViewColumn *c;
- gint error;
- AvahiGLibPoll *poll_api;
-
- gtk_init(&argc, &argv);
- glade_init();
-
- avahi_set_allocator(avahi_glib_allocator());
-
- poll_api = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
-
- xml = glade_xml_new(AVAHI_INTERFACES_DIR"avahi-discover.glade", NULL, NULL);
- main_window = glade_xml_get_widget(xml, "main_window");
- g_signal_connect(main_window, "delete-event", (GCallback) main_window_on_delete_event, NULL);
-
- tree_view = GTK_TREE_VIEW(glade_xml_get_widget(xml, "tree_view"));
- g_signal_connect(GTK_WIDGET(tree_view), "cursor-changed", (GCallback) tree_view_on_cursor_changed, NULL);
-
- info_label = GTK_LABEL(glade_xml_get_widget(xml, "info_label"));
-
- tree_store = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
- gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(tree_store));
- gtk_tree_view_insert_column_with_attributes(tree_view, -1, "Name", gtk_cell_renderer_text_new(), "text", 0, NULL);
- gtk_tree_view_insert_column_with_attributes(tree_view, -1, "Interface", gtk_cell_renderer_text_new(), "text", 1, NULL);
-
- gtk_tree_view_column_set_resizable(c = gtk_tree_view_get_column(tree_view, 0), TRUE);
- gtk_tree_view_column_set_sizing(c, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
- gtk_tree_view_column_set_expand(c, TRUE);
-
- service_type_hash_table = g_hash_table_new((GHashFunc) avahi_domain_hash, (GEqualFunc) avahi_domain_equal);
-
- avahi_server_config_init(&config);
- config.publish_hinfo = config.publish_addresses = config.publish_domain = config.publish_workstation = FALSE;
- server = avahi_server_new(avahi_glib_poll_get(poll_api), &config, NULL, NULL, &error);
- avahi_server_config_free(&config);
-
- g_assert(server);
-
- service_type_browser = avahi_s_service_type_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, argc >= 2 ? argv[1] : NULL, 0, service_type_browser_callback, NULL);
-
- gtk_main();
-
- avahi_server_free(server);
- avahi_glib_poll_free(poll_api);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-dnsconfd/Makefile.am b/release-0.6.9/avahi-dnsconfd/Makefile.am
deleted file mode 100644
index 18b3adf..0000000
--- a/release-0.6.9/avahi-dnsconfd/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-if HAVE_EXPAT
-if HAVE_LIBDAEMON
-
-pkgsysconfdir=$(sysconfdir)/avahi
-
-AM_CFLAGS= \
- -I$(top_srcdir) \
- -DAVAHI_RUNTIME_DIR=\"$(avahi_runtime_dir)/\" \
- -DAVAHI_SOCKET=\"$(avahi_socket)\" \
- -DAVAHI_DNSCONF_SCRIPT=\"$(pkgsysconfdir)/avahi-dnsconfd.action\"
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-sbin_PROGRAMS = avahi-dnsconfd
-
-avahi_dnsconfd_SOURCES = main.c
-avahi_dnsconfd_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
-avahi_dnsconfd_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(LIBDAEMON_LIBS)
-
-pkgsysconf_SCRIPTS=avahi-dnsconfd.action
-
-endif
-endif
-
-EXTRA_DIST=avahi-dnsconfd.action
diff --git a/release-0.6.9/avahi-dnsconfd/avahi-dnsconfd.action b/release-0.6.9/avahi-dnsconfd/avahi-dnsconfd.action
deleted file mode 100755
index 9337a6d..0000000
--- a/release-0.6.9/avahi-dnsconfd/avahi-dnsconfd.action
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-set -e
-
-test "x$AVAHI_INTERFACE" != "x"
-
-# Command line arguments:
-# $1 "+" if a new DNS server was found, "-" if one was removed
-# $2 DNS Server address
-# $3 interface index where this server was found on
-# $4 protocol number where this server was found on
-
-# Available environment variables:
-#
-# $AVAHI_INTERFACE The interface name where this DNS server was found on
-# $AVAHI_INTERFACE_DNS_SERVERS A whitespace seperated list of DNS servers on $AVAHI_INTERFACE
-# $AVAHI_DNS_SERVERS The complete list of all DNS servers found on all interfaces
-
-if [ -x /sbin/resolvconf ] ; then
-
- # We have Debian's resolvconf tool
-
- if [ "x$AVAHI_INTERFACE_DNS_SERVERS" = "x" ] ; then
- /sbin/resolvconf -d "$AVAHI_INTERFACE.avahi"
- else
- for n in $AVAHI_INTERFACE_DNS_SERVERS ; do
- echo "nameserver $n"
- done | /sbin/resolvconf -a "$AVAHI_INTERFACE.avahi"
- fi
-else
-
- # No resolvconf tool available
-
- if [ "x$AVAHI_DNS_SERVERS" = "x" ] ; then
- test -f /etc/resolv.conf.avahi && mv /etc/resolv.conf.avahi /etc/resolv.conf
- else
- test -f /etc/resolv.conf.avahi || mv /etc/resolv.conf /etc/resolv.conf.avahi
-
- for n in $AVAHI_DNS_SERVERS ; do
- echo "nameserver $n"
- done > /etc/resolv.conf
- fi
-fi
diff --git a/release-0.6.9/avahi-dnsconfd/main.c b/release-0.6.9/avahi-dnsconfd/main.c
deleted file mode 100644
index b384a03..0000000
--- a/release-0.6.9/avahi-dnsconfd/main.c
+++ /dev/null
@@ -1,652 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <getopt.h>
-#include <assert.h>
-#include <inttypes.h>
-#include <stdlib.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/address.h>
-
-#include <libdaemon/dfork.h>
-#include <libdaemon/dsignal.h>
-#include <libdaemon/dlog.h>
-#include <libdaemon/dpid.h>
-#include <libdaemon/dexec.h>
-
-#define BROWSE_DNS_SERVERS "BROWSE-DNS-SERVERS\n"
-
-#define ENV_INTERFACE_DNS_SERVERS "AVAHI_INTERFACE_DNS_SERVERS"
-#define ENV_DNS_SERVERS "AVAHI_DNS_SERVERS"
-#define ENV_INTERFACE "AVAHI_INTERFACE"
-
-static enum {
- ACKWAIT,
- BROWSING
-} state = ACKWAIT;
-
-static enum {
- DAEMON_RUN,
- DAEMON_KILL,
- DAEMON_REFRESH,
- DAEMON_VERSION,
- DAEMON_HELP,
- DAEMON_CHECK
-} command = DAEMON_RUN;
-
-static int quit = 0;
-static int daemonize = 0;
-
-#if !HAVE_DECL_ENVIRON
-extern char **environ;
-#endif
-
-typedef struct DNSServerInfo DNSServerInfo;
-
-struct DNSServerInfo {
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- char *address;
- AVAHI_LLIST_FIELDS(DNSServerInfo, servers);
-};
-
-static AVAHI_LLIST_HEAD(DNSServerInfo, servers);
-
-static void server_info_free(DNSServerInfo *i) {
- assert(i);
-
- avahi_free(i->address);
-
- AVAHI_LLIST_REMOVE(DNSServerInfo, servers, servers, i);
- avahi_free(i);
-}
-
-static DNSServerInfo* get_server_info(AvahiIfIndex interface, AvahiProtocol protocol, const char *address) {
- DNSServerInfo *i;
- assert(address);
-
- for (i = servers; i; i = i->servers_next)
- if (i->interface == interface &&
- i->protocol == protocol &&
- strcmp(i->address, address) == 0)
- return i;
-
- return NULL;
-}
-
-static DNSServerInfo* new_server_info(AvahiIfIndex interface, AvahiProtocol protocol, const char *address) {
- DNSServerInfo *i;
-
- assert(address);
-
- i = avahi_new(DNSServerInfo, 1);
- i->interface = interface;
- i->protocol = protocol;
- i->address = avahi_strdup(address);
-
- AVAHI_LLIST_PREPEND(DNSServerInfo, servers, servers, i);
-
- return i;
-}
-
-static int set_cloexec(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFD)) < 0)
- return -1;
-
- if (n & FD_CLOEXEC)
- return 0;
-
- return fcntl(fd, F_SETFD, n|FD_CLOEXEC);
-}
-
-static int open_socket(void) {
- int fd = -1;
- struct sockaddr_un sa;
-
- if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- daemon_log(LOG_ERR, "socket(): %s", strerror(errno));
- goto fail;
- }
-
- if (set_cloexec(fd) < 0) {
- daemon_log(LOG_ERR, "fcntl(): %s", strerror(errno));
- goto fail;
- }
-
- memset(&sa, 0, sizeof(sa));
- sa.sun_family = AF_UNIX;
- strncpy(sa.sun_path, AVAHI_SOCKET, sizeof(sa.sun_path)-1);
- sa.sun_path[sizeof(sa.sun_path)-1] = 0;
-
- if (connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
- daemon_log(LOG_ERR, "connect(): %s", strerror(errno));
- daemon_log(LOG_INFO, "Failed to connect to the daemon. This probably means that you");
- daemon_log(LOG_INFO, "didn't start avahi-daemon before avahi-dnsconfd.");
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-static ssize_t loop_write(int fd, const void*data, size_t size) {
-
- ssize_t ret = 0;
- assert(fd >= 0 && data && size);
-
- while (size > 0) {
- ssize_t r;
-
- if ((r = write(fd, data, size)) < 0)
- return r;
-
- if (r == 0)
- break;
-
- ret += r;
- data = (const uint8_t*) data + r;
- size -= r;
- }
-
- return ret;
-}
-
-static char *concat_dns_servers(AvahiIfIndex interface) {
- DNSServerInfo *i;
- char *r = NULL;
-
- for (i = servers; i; i = i->servers_next)
- if (i->interface == interface || interface <= 0) {
- char *t;
-
- if (!r)
- t = avahi_strdup(i->address);
- else
- t = avahi_strdup_printf("%s %s", r, i->address);
-
- avahi_free(r);
- r = t;
- }
-
- return r;
-}
-
-static void set_env(const char *name, const char *value) {
- char **e;
- size_t l;
-
- assert(name);
- assert(value);
-
- l = strlen(name);
-
- for (e = environ; *e; e++) {
- /* Search for the variable */
- if (strlen(*e) < l+1)
- continue;
-
- if (strncmp(*e, name, l) != 0 || (*e)[l] != '=')
- continue;
-
- /* We simply free the record, sicne we know that we created it previously */
- avahi_free(*e);
- *e = avahi_strdup_printf("%s=%s", name, value);
- return;
- }
-
- assert(0);
-}
-
-static void run_script(int new, AvahiIfIndex interface, AvahiProtocol protocol, const char *address) {
- char *p;
- int ret;
- char ia[16], pa[16];
- char name[IF_NAMESIZE];
-
- assert(interface > 0);
-
- if (!if_indextoname(interface, name))
- return;
-
- p = concat_dns_servers(interface);
- set_env(ENV_INTERFACE_DNS_SERVERS, p ? p : "");
- avahi_free(p);
-
- p = concat_dns_servers(-1);
- set_env(ENV_DNS_SERVERS, p ? p : "");
- avahi_free(p);
-
- set_env(ENV_INTERFACE, name);
-
- snprintf(ia, sizeof(ia), "%i", (int) interface);
- snprintf(pa, sizeof(pa), "%i", (int) protocol);
-
- if (daemon_exec("/", &ret, AVAHI_DNSCONF_SCRIPT, AVAHI_DNSCONF_SCRIPT, new ? "+" : "-", address, ia, pa, avahi_proto_to_string(protocol), NULL) < 0)
- daemon_log(LOG_WARNING, "Failed to run script");
- else if (ret != 0)
- daemon_log(LOG_WARNING, "Script returned with non-zero exit code %i", ret);
-}
-
-static int new_line(const char *l) {
- assert(l);
-
- if (state == ACKWAIT) {
- if (*l != '+') {
- daemon_log(LOG_ERR, "Avahi command failed: %s", l);
- return -1;
- }
-
- daemon_log(LOG_INFO, "Successfully connected to Avahi daemon.");
- state = BROWSING;
- } else {
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- int i_interface, i_protocol, port;
- char a[AVAHI_ADDRESS_STR_MAX];
-
- assert(state == BROWSING);
-
- if (*l != '<' && *l != '>') {
- daemon_log(LOG_ERR, "Avahi sent us an invalid browsing line: %s", l);
- return -1;
- }
-
- if (sscanf(l+1, "%i %i %39s %i", &i_interface, &i_protocol, a, &port) != 4) {
- daemon_log(LOG_ERR, "Failed to parse browsing line: %s", l);
- return -1;
- }
-
- interface = (AvahiIfIndex) i_interface;
- protocol = (AvahiProtocol) i_protocol;
-
- if (*l == '>') {
- if (port != 53)
- daemon_log(LOG_WARNING, "DNS server with port address != 53 found, ignoring");
- else {
- daemon_log(LOG_INFO, "New DNS Server %s (interface: %i.%s)", a, interface, avahi_proto_to_string(protocol));
- new_server_info(interface, protocol, a);
- run_script(1, interface, protocol, a);
- }
- } else {
- DNSServerInfo *i;
-
- if (port == 53)
- if ((i = get_server_info(interface, protocol, a))) {
- daemon_log(LOG_INFO, "DNS Server %s removed (interface: %i.%s)", a, interface, avahi_proto_to_string(protocol));
- server_info_free(i);
- run_script(0, interface, protocol, a);
- }
- }
-
- }
-
- return 0;
-}
-
-static int do_connect(void) {
- int fd = -1;
-
- if ((fd = open_socket()) < 0)
- goto fail;
-
- if (loop_write(fd, BROWSE_DNS_SERVERS, sizeof(BROWSE_DNS_SERVERS)-1) < 0) {
- daemon_log(LOG_ERR, "write(): %s", strerror(errno));
- goto fail;
- }
-
- state = ACKWAIT;
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-static void free_dns_server_info_list(void) {
- while (servers) {
- AvahiIfIndex interface = servers->interface;
- AvahiProtocol protocol = servers->protocol;
- char *address = avahi_strdup(servers->address);
- server_info_free(servers);
-
- run_script(0, interface, protocol, address);
- avahi_free(address);
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- fprintf(f,
- "%s [options]\n"
- " -h --help Show this help\n"
- " -D --daemonize Daemonize after startup\n"
- " -k --kill Kill a running daemon\n"
- " -r --refresh Request a running daemon to refresh DNS server data\n"
- " -c --check Return 0 if a daemon is already running\n"
- " -V --version Show version\n",
- argv0);
-}
-
-static int parse_command_line(int argc, char *argv[]) {
- int c;
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "daemonize", no_argument, NULL, 'D' },
- { "kill", no_argument, NULL, 'k' },
- { "version", no_argument, NULL, 'V' },
- { "refresh", no_argument, NULL, 'r' },
- { "check", no_argument, NULL, 'c' },
- };
-
- opterr = 0;
- while ((c = getopt_long(argc, argv, "hDkVrc", long_options, NULL)) >= 0) {
-
- switch(c) {
- case 'h':
- command = DAEMON_HELP;
- break;
- case 'D':
- daemonize = 1;
- break;
- case 'k':
- command = DAEMON_KILL;
- break;
- case 'V':
- command = DAEMON_VERSION;
- break;
- case 'r':
- command = DAEMON_REFRESH;
- break;
- case 'c':
- command = DAEMON_CHECK;
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", c);
- return -1;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr, "Too many arguments\n");
- return -1;
- }
-
- return 0;
-}
-
-static int run_daemon(void) {
- int fd = -1, ret = -1;
- char buf[1024];
- size_t buflen = 0;
-
- AVAHI_LLIST_HEAD_INIT(DNSServerInfo, servers);
-
- daemon_signal_init(SIGINT, SIGTERM, SIGCHLD, SIGHUP, 0);
-
- /* Allocate some memory for our environment variables */
- putenv(avahi_strdup(ENV_INTERFACE"="));
- putenv(avahi_strdup(ENV_DNS_SERVERS"="));
- putenv(avahi_strdup(ENV_INTERFACE_DNS_SERVERS"="));
-
- if ((fd = do_connect()) < 0)
- goto finish;
-
- if (daemonize)
- daemon_retval_send(0);
-
- ret = 0;
-
- while (!quit) {
- fd_set rfds, wfds;
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
-
- FD_SET(fd, &rfds);
- FD_SET(daemon_signal_fd(), &rfds);
-
- for (;;) {
- if (select(fd+1, &rfds, NULL, NULL, NULL) < 0) {
- if (errno == EINTR)
- continue;
-
- daemon_log(LOG_ERR, "select(): %s", strerror(errno));
- goto finish;
- }
-
- break;
- }
-
- if (FD_ISSET(daemon_signal_fd(), &rfds)) {
-
- int sig;
-
- if ((sig = daemon_signal_next()) <= 0) {
- daemon_log(LOG_ERR, "daemon_signal_next() failed");
- goto finish;
- }
-
- switch(sig) {
- case SIGINT:
- case SIGTERM:
- daemon_log(LOG_INFO, "Got %s, quitting.", sig == SIGINT ? "SIGINT" : "SIGTERM");
- ret = 0;
- goto finish;
-
- case SIGCHLD:
- waitpid(-1, NULL, WNOHANG);
- break;
-
- case SIGHUP:
- daemon_log(LOG_INFO, "Refreshing DNS Server list");
-
- close(fd);
- free_dns_server_info_list();
-
- if ((fd = do_connect()) < 0)
- goto finish;
-
- break;
- }
-
- } else if (FD_ISSET(fd, &rfds)) {
- ssize_t r;
- char *n;
-
- if ((r = read(fd, buf, sizeof(buf) - buflen - 1)) <= 0) {
- daemon_log(LOG_ERR, "read(): %s", r < 0 ? strerror(errno) : "EOF");
- goto finish;
- }
-
- buflen += r;
- assert(buflen <= sizeof(buf)-1);
-
- while ((n = memchr(buf, '\n', buflen))) {
- *(n++) = 0;
-
- if (new_line(buf) < 0)
- goto finish;
-
- buflen -= (n - buf);
- memmove(buf, n, buflen);
- }
-
- if (buflen >= sizeof(buf)-1) {
- /* The incoming line is horribly long */
- buf[sizeof(buf)-1] = 0;
-
- if (new_line(buf) < 0)
- goto finish;
-
- buflen = 0;
- }
- }
- }
-
-finish:
-
- free_dns_server_info_list();
-
- if (fd >= 0)
- close(fd);
-
- daemon_signal_done();
-
- if (ret != 0 && daemonize)
- daemon_retval_send(1);
-
- return ret;
-}
-
-static const char* pid_file_proc(void) {
- return AVAHI_RUNTIME_DIR"/avahi-dnsconfd.pid";
-}
-
-int main(int argc, char *argv[]) {
- char *argv0;
- int r = 1;
- int wrote_pid_file = 0;
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- daemon_pid_file_ident = daemon_log_ident = argv0;
- daemon_pid_file_proc = pid_file_proc;
-
- if (parse_command_line(argc, argv) < 0)
- goto finish;
-
- if (command == DAEMON_RUN) {
- pid_t pid;
-
- if (getuid() != 0) {
- daemon_log(LOG_ERR, "This program is intended to be run as root.");
- goto finish;
- }
-
- if ((pid = daemon_pid_file_is_running()) >= 0) {
- daemon_log(LOG_ERR, "Daemon already running on PID %u", pid);
- goto finish;
- }
-
- if (daemonize) {
- daemon_retval_init();
-
- if ((pid = daemon_fork()) < 0)
- goto finish;
- else if (pid != 0) {
- int ret;
- /** Parent **/
-
- if ((ret = daemon_retval_wait(20)) < 0) {
- daemon_log(LOG_ERR, "Could not receive return value from daemon process.");
- goto finish;
- }
-
- r = ret;
- goto finish;
- }
-
- /* Child */
- }
-
- chdir("/");
-
- if (daemon_pid_file_create() < 0) {
- daemon_log(LOG_ERR, "Failed to create PID file: %s", strerror(errno));
-
- if (daemonize)
- daemon_retval_send(1);
- goto finish;
- } else
- wrote_pid_file = 1;
-
- if (run_daemon() < 0)
- goto finish;
-
- r = 0;
- } else if (command == DAEMON_HELP) {
- help(stdout, argv0);
-
- r = 0;
- } else if (command == DAEMON_VERSION) {
- printf("%s "PACKAGE_VERSION"\n", argv0);
-
- r = 0;
- } else if (command == DAEMON_KILL) {
- if (daemon_pid_file_kill_wait(SIGTERM, 5) < 0) {
- daemon_log(LOG_WARNING, "Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
- } else if (command == DAEMON_REFRESH) {
- if (daemon_pid_file_kill(SIGHUP) < 0) {
- daemon_log(LOG_WARNING, "Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
- } else if (command == DAEMON_CHECK)
- r = (daemon_pid_file_is_running() >= 0) ? 0 : 1;
-
-
-finish:
-
- if (daemonize)
- daemon_retval_done();
-
- if (wrote_pid_file)
- daemon_pid_file_remove();
-
- return r;
-}
diff --git a/release-0.6.9/avahi-glib.pc.in b/release-0.6.9/avahi-glib.pc.in
deleted file mode 100644
index f163e89..0000000
--- a/release-0.6.9/avahi-glib.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-glib
-Description: Avahi Multicast DNS Responder (GLib Support)
-Version: @PACKAGE_VERSION@
-Requires: glib-2.0
-Libs: -L${libdir} -lavahi-glib
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/release-0.6.9/avahi-glib/Makefile.am b/release-0.6.9/avahi-glib/Makefile.am
deleted file mode 100644
index 69bd51e..0000000
--- a/release-0.6.9/avahi-glib/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_GLIB
-
-avahiincludedir=$(includedir)/avahi-glib
-
-avahiinclude_HEADERS = \
- glib-watch.h \
- glib-malloc.h
-
-lib_LTLIBRARIES = \
- libavahi-glib.la
-
-if ENABLE_TESTS
-
-noinst_PROGRAMS = \
- glib-watch-test
-
-endif
-
-libavahi_glib_la_SOURCES = \
- glib-watch.c glib-watch.h \
- glib-malloc.h glib-malloc.c
-libavahi_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-libavahi_glib_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
-libavahi_glib_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_GLIB_VERSION_INFO)
-
-glib_watch_test_SOURCES = \
- glib-watch.c glib-watch.h \
- glib-watch-test.c
-glib_watch_test_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-glib_watch_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
-
-endif
diff --git a/release-0.6.9/avahi-glib/glib-malloc.c b/release-0.6.9/avahi-glib/glib-malloc.c
deleted file mode 100644
index 2968abc..0000000
--- a/release-0.6.9/avahi-glib/glib-malloc.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-
-#include "glib-malloc.h"
-
-static void* malloc_glue(size_t l) {
- return g_malloc(l);
-}
-
-static void* realloc_glue(void *p, size_t l) {
- return g_realloc(p, l);
-}
-
-static void* calloc_glue(size_t nmemb, size_t size) {
- return g_malloc0(nmemb * size);
-}
-
-const AvahiAllocator *avahi_glib_allocator(void) {
-
- static AvahiAllocator allocator;
- static int allocator_initialized = 0;
-
- if (!allocator_initialized) {
- allocator.malloc = malloc_glue;
- allocator.free = g_free;
- allocator.realloc = realloc_glue;
- allocator.calloc = calloc_glue;
- allocator_initialized = 1;
- }
-
- return &allocator;
-}
diff --git a/release-0.6.9/avahi-glib/glib-malloc.h b/release-0.6.9/avahi-glib/glib-malloc.h
deleted file mode 100644
index 5982e08..0000000
--- a/release-0.6.9/avahi-glib/glib-malloc.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef fooglibmallochfoo
-#define fooglibmallochfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file glib-malloc.h GLib's memory allocator for Avahi */
-
-#include <glib.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/malloc.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Return a pointer to a memory allocator that uses GLib's g_malloc()
- and frinds. Th returned structure is statically allocated, and needs
- not to be copied or freed. Pass this directly to avahi_set_allocator(). */
-const AvahiAllocator * avahi_glib_allocator(void);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-glib/glib-watch-test.c b/release-0.6.9/avahi-glib/glib-watch-test.c
deleted file mode 100644
index 733c81f..0000000
--- a/release-0.6.9/avahi-glib/glib-watch-test.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-
-#include <avahi-common/watch.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/gccmacro.h>
-
-#include "glib-watch.h"
-
-static const AvahiPoll *api = NULL;
-static GMainLoop *loop = NULL;
-
-static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
-
- if (event & AVAHI_WATCH_IN) {
- ssize_t r;
- char c;
-
- if ((r = read(fd, &c, 1)) <= 0) {
- fprintf(stderr, "read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- api->watch_free(w);
- return;
- }
-
- printf("Read: %c\n", c >= 32 && c < 127 ? c : '.');
- }
-}
-
-static void wakeup(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) {
- struct timeval tv;
- static int i = 0;
-
- printf("Wakeup #%i\n", i++);
-
- if (i > 10)
- g_main_loop_quit(loop);
-
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_update(t, &tv);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiGLibPoll *g;
- struct timeval tv;
-
- g = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
- assert(g);
-
- api = avahi_glib_poll_get(g);
-
- api->watch_new(api, 0, AVAHI_WATCH_IN, callback, NULL);
-
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_new(api, &tv, wakeup, NULL);
-
- loop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(loop);
- g_main_loop_unref(loop);
-
- avahi_glib_poll_free(g);
-
- return 0;
-}
diff --git a/release-0.6.9/avahi-glib/glib-watch.c b/release-0.6.9/avahi-glib/glib-watch.c
deleted file mode 100644
index 9d80440..0000000
--- a/release-0.6.9/avahi-glib/glib-watch.c
+++ /dev/null
@@ -1,388 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/timeval.h>
-
-#include "glib-watch.h"
-
-struct AvahiWatch {
- AvahiGLibPoll *glib_poll;
- int dead;
-
- GPollFD pollfd;
- int pollfd_added;
-
- AvahiWatchCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiWatch, watches);
-};
-
-struct AvahiTimeout {
- AvahiGLibPoll *glib_poll;
- gboolean dead;
-
- gboolean enabled;
- struct timeval expiry;
-
- AvahiTimeoutCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiTimeout, timeouts);
-};
-
-struct AvahiGLibPoll {
- GSource source;
- AvahiPoll api;
- GMainContext *context;
-
- gboolean timeout_req_cleanup;
- gboolean watch_req_cleanup;
-
- AVAHI_LLIST_HEAD(AvahiWatch, watches);
- AVAHI_LLIST_HEAD(AvahiTimeout, timeouts);
-};
-
-static void destroy_watch(AvahiWatch *w) {
- assert(w);
-
- if (w->pollfd_added)
- g_source_remove_poll(&w->glib_poll->source, &w->pollfd);
-
- AVAHI_LLIST_REMOVE(AvahiWatch, watches, w->glib_poll->watches, w);
-
- avahi_free(w);
-}
-
-static void cleanup_watches(AvahiGLibPoll *g, int all) {
- AvahiWatch *w, *next;
- assert(g);
-
- for (w = g->watches; w; w = next) {
- next = w->watches_next;
-
- if (all || w->dead)
- destroy_watch(w);
- }
-
- g->watch_req_cleanup = 0;
-}
-
-static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata) {
- AvahiWatch *w;
- AvahiGLibPoll *g;
-
- assert(api);
- assert(fd >= 0);
- assert(callback);
-
- g = api->userdata;
- assert(g);
-
- if (!(w = avahi_new(AvahiWatch, 1)))
- return NULL;
-
- w->glib_poll = g;
- w->pollfd.fd = fd;
- w->pollfd.events =
- (event & AVAHI_WATCH_IN ? G_IO_IN : 0) |
- (event & AVAHI_WATCH_OUT ? G_IO_OUT : 0) |
- (event & AVAHI_WATCH_ERR ? G_IO_ERR : 0) |
- (event & AVAHI_WATCH_HUP ? G_IO_HUP : 0);
- w->pollfd.revents = 0;
- w->callback = callback;
- w->userdata = userdata;
- w->dead = FALSE;
-
- g_source_add_poll(&g->source, &w->pollfd);
- w->pollfd_added = TRUE;
-
- AVAHI_LLIST_PREPEND(AvahiWatch, watches, g->watches, w);
-
- return w;
-}
-
-static void watch_update(AvahiWatch *w, AvahiWatchEvent events) {
- assert(w);
- assert(!w->dead);
-
- w->pollfd.events = events;
-}
-
-static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
- assert(w);
- assert(!w->dead);
-
- return w->pollfd.revents;
-}
-
-static void watch_free(AvahiWatch *w) {
- assert(w);
- assert(!w->dead);
-
- if (w->pollfd_added) {
- g_source_remove_poll(&w->glib_poll->source, &w->pollfd);
- w->pollfd_added = TRUE;
- }
-
- w->dead = TRUE;
- w->glib_poll->timeout_req_cleanup = TRUE;
-}
-
-static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
- AvahiTimeout *t;
- AvahiGLibPoll *g;
-
- assert(api);
- assert(callback);
-
- g = api->userdata;
- assert(g);
-
- if (!(t = avahi_new(AvahiTimeout, 1)))
- return NULL;
-
- t->glib_poll = g;
- t->dead = FALSE;
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-
- t->callback = callback;
- t->userdata = userdata;
-
- AVAHI_LLIST_PREPEND(AvahiTimeout, timeouts, g->timeouts, t);
-
- return t;
-}
-
-static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
- assert(t);
- assert(!t->dead);
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-}
-
-static void timeout_free(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
-
- t->dead = TRUE;
- t->glib_poll->timeout_req_cleanup = TRUE;
-}
-
-static void destroy_timeout(AvahiTimeout *t) {
- assert(t);
-
- AVAHI_LLIST_REMOVE(AvahiTimeout, timeouts, t->glib_poll->timeouts, t);
- avahi_free(t);
-}
-
-static void cleanup_timeouts(AvahiGLibPoll *g, int all) {
- AvahiTimeout *t, *next;
- assert(g);
-
- for (t = g->timeouts; t; t = next) {
- next = t->timeouts_next;
-
- if (all || t->dead)
- destroy_timeout(t);
- }
-
- g->timeout_req_cleanup = FALSE;
-}
-
-static AvahiTimeout* find_next_timeout(AvahiGLibPoll *g) {
- AvahiTimeout *t, *n = NULL;
- assert(g);
-
- for (t = g->timeouts; t; t = t->timeouts_next) {
-
- if (t->dead || !t->enabled)
- continue;
-
- if (!n || avahi_timeval_compare(&t->expiry, &n->expiry) < 0)
- n = t;
- }
-
- return n;
-}
-
-static void start_timeout_callback(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
- assert(t->enabled);
-
- t->enabled = 0;
- t->callback(t, t->userdata);
-}
-
-static gboolean prepare_func(GSource *source, gint *timeout) {
- AvahiGLibPoll *g = (AvahiGLibPoll*) source;
- AvahiTimeout *next_timeout;
-
- g_assert(g);
- g_assert(timeout);
-
- if (g->watch_req_cleanup)
- cleanup_watches(g, 0);
-
- if (g->timeout_req_cleanup)
- cleanup_timeouts(g, 0);
-
- if ((next_timeout = find_next_timeout(g))) {
- GTimeVal now;
- struct timeval tvnow;
- AvahiUsec usec;
-
- g_source_get_current_time(source, &now);
- tvnow.tv_sec = now.tv_sec;
- tvnow.tv_usec = now.tv_usec;
-
- usec = avahi_timeval_diff(&next_timeout->expiry, &tvnow);
-
- if (usec <= 0)
- return TRUE;
-
- *timeout = (gint) (usec / 1000);
- }
-
- return FALSE;
-}
-
-static gboolean check_func(GSource *source) {
- AvahiGLibPoll *g = (AvahiGLibPoll*) source;
- AvahiWatch *w;
- AvahiTimeout *next_timeout;
-
- g_assert(g);
-
- if ((next_timeout = find_next_timeout(g))) {
- GTimeVal now;
- struct timeval tvnow;
- g_source_get_current_time(source, &now);
- tvnow.tv_sec = now.tv_sec;
- tvnow.tv_usec = now.tv_usec;
-
- if (avahi_timeval_compare(&next_timeout->expiry, &tvnow) < 0)
- return TRUE;
- }
-
- for (w = g->watches; w; w = w->watches_next)
- if (w->pollfd.revents > 0)
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean dispatch_func(GSource *source, AVAHI_GCC_UNUSED GSourceFunc callback, AVAHI_GCC_UNUSED gpointer userdata) {
- AvahiGLibPoll* g = (AvahiGLibPoll*) source;
- AvahiWatch *w;
- AvahiTimeout *next_timeout;
-
- g_assert(g);
-
- if ((next_timeout = find_next_timeout(g))) {
- GTimeVal now;
- struct timeval tvnow;
- g_source_get_current_time(source, &now);
- tvnow.tv_sec = now.tv_sec;
- tvnow.tv_usec = now.tv_usec;
-
- if (avahi_timeval_compare(&next_timeout->expiry, &tvnow) < 0) {
- start_timeout_callback(next_timeout);
- return TRUE;
- }
- }
-
- for (w = g->watches; w; w = w->watches_next)
- if (w->pollfd.revents > 0) {
- assert(w->callback);
- w->callback(w, w->pollfd.fd, w->pollfd.revents, w->userdata);
- w->pollfd.revents = 0;
- return TRUE;
- }
-
- return TRUE;
-}
-
-AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority) {
- AvahiGLibPoll *g;
-
- static GSourceFuncs source_funcs = {
- prepare_func,
- check_func,
- dispatch_func,
- NULL,
- NULL,
- NULL
- };
-
- g = (AvahiGLibPoll*) g_source_new(&source_funcs, sizeof(AvahiGLibPoll));
- g_main_context_ref(g->context = context ? context : g_main_context_default());
-
- g->api.userdata = g;
-
- g->api.watch_new = watch_new;
- g->api.watch_free = watch_free;
- g->api.watch_update = watch_update;
- g->api.watch_get_events = watch_get_events;
-
- g->api.timeout_new = timeout_new;
- g->api.timeout_free = timeout_free;
- g->api.timeout_update = timeout_update;
-
- g->watch_req_cleanup = FALSE;
- g->timeout_req_cleanup = FALSE;
-
- AVAHI_LLIST_HEAD_INIT(AvahiWatch, g->watches);
- AVAHI_LLIST_HEAD_INIT(AvahiTimeout, g->timeouts);
-
- g_source_attach(&g->source, g->context);
- g_source_set_priority(&g->source, priority);
-
- return g;
-}
-
-void avahi_glib_poll_free(AvahiGLibPoll *g) {
- GSource *s = &g->source;
- assert(g);
-
- cleanup_watches(g, 1);
- cleanup_timeouts(g, 1);
-
- g_main_context_unref(g->context);
- g_source_destroy(s);
- g_source_unref(s);
-}
-
-const AvahiPoll* avahi_glib_poll_get(AvahiGLibPoll *g) {
- assert(g);
-
- return &g->api;
-}
diff --git a/release-0.6.9/avahi-glib/glib-watch.h b/release-0.6.9/avahi-glib/glib-watch.h
deleted file mode 100644
index 895a686..0000000
--- a/release-0.6.9/avahi-glib/glib-watch.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef fooglibwatchhfoo
-#define fooglibwatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file glib-watch.h GLib main loop adapter */
-
-#include <glib.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** GLib main loop adapter. You can safely cast this into a GSource */
-typedef struct AvahiGLibPoll AvahiGLibPoll;
-
-/** Create a new GLib main loop adapter attached to the specified
- context. If context is NULL, the default main loop context is
- used. You can attach as many AvahiGLibPoll objects to the same context
- as you want. priority takes on of GLib's G_PRIORITY constants. */
-AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority);
-
-/** Free GLib main loop adapter */
-void avahi_glib_poll_free(AvahiGLibPoll *g);
-
-/** Return the abstract poll API structure for this object. This will
- * return the same pointer to a internally allocated structure on each
- * call */
-const AvahiPoll *avahi_glib_poll_get(AvahiGLibPoll *g);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-python/Makefile.am b/release-0.6.9/avahi-python/Makefile.am
deleted file mode 100644
index 7f4980a..0000000
--- a/release-0.6.9/avahi-python/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-EXTRA_DIST = \
- avahi-bookmarks.in \
- avahi-discover.in \
- avahi-discover.desktop.in
-
-SUBDIRS=avahi
-
-if HAVE_PYTHON
-if HAVE_PYTHON_DBUS
-if HAVE_PYGTK
-
-pythonscripts = \
- avahi-bookmarks \
- avahi-discover
-
-desktopdir = $(datadir)/applications
-desktop_DATA = avahi-discover.desktop
-
-avahi-discover.desktop: avahi-discover.desktop.in
- sed -e 's,@bindir\@,$(bindir),g' $< > $@
- chmod +x $@
-
-avahi-discover: avahi-discover.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@interfacesdir\@,$(interfacesdir),g' $< > $@
- chmod +x $@
-
-avahi-bookmarks: avahi-bookmarks.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' $< > $@
- chmod +x $@
-
-bin_SCRIPTS = $(pythonscripts)
-CLEANFILES = $(pythonscripts) $(desktop_DATA)
-
-endif
-endif
-endif
diff --git a/release-0.6.9/avahi-python/avahi-bookmarks.in b/release-0.6.9/avahi-python/avahi-bookmarks.in
deleted file mode 100755
index 6466a22..0000000
--- a/release-0.6.9/avahi-python/avahi-bookmarks.in
+++ /dev/null
@@ -1,183 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import sys, getopt
-
-try:
- import avahi, gobject, dbus
-except ImportError:
- print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus."
- sys.exit(1)
-
-try:
- import dbus.glib
-except ImportError:
- pass
-
-try:
- from twisted.internet import glib2reactor
- glib2reactor.install()
- from twisted.internet import reactor
- from twisted.web import server, resource
-except ImportError:
- print "Sorry, to use this tool you need to install twisted and twisted.web."
- sys.exit(1)
-
-urlproto = { "_http._tcp" : "http", "_https._tcp" : "https", "_ftp._tcp" : "ftp" }
-
-port = 8080
-address = "127.0.0.1"
-use_host_names = None
-domain = "local"
-
-class AvahiBookmarks(resource.Resource):
- isLeaf = True
-
- services = {}
-
- def __init__(self, use_host_names):
- resource.Resource.__init__(self)
-
- self.bus = dbus.SystemBus()
- self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
-
- self.version_string = self.server.GetVersionString()
-
- self.browse_service_type("_http._tcp")
- self.browse_service_type("_https._tcp")
- self.browse_service_type("_ftp._tcp")
-
- if use_host_names is None:
- try:
- self.use_host_names = self.server.IsNSSSupportAvailable()
- except:
- self.use_host_names = False
- else:
- self.use_host_names = use_host_names
-
- def browse_service_type(self, stype):
-
- global domain
-
- browser = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, stype, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
- browser.connect_to_signal('ItemNew', self.new_service)
- browser.connect_to_signal('ItemRemove', self.remove_service)
-
- def find_path(self, txt):
-
- l = avahi.txt_array_to_string_array(txt)
-
- for k in l:
- if k[:5] == "path=":
- if k[5:].startswith("/"):
- return k[5:]
- else:
- return "/" + k[5:]
-
- return "/"
-
- def render_GET(self, request):
-
- t = '<html><head><title>Zeroconf Bookmarks</title></head><body><h1>Zeroconf Bookmarks</h1>'
-
- if len(self.services) == 0:
- t += '<p>Sorry, no web services have been registered on the local LAN.</p>'
- else:
- t += '<ul style="padding: 0px; margin: 20px; list-style-type: none">'
-
- for k, v in self.services.iteritems():
-
- if v[3] == 80:
- port = ''
- else:
- port = ':%i' % v[3]
-
- path = self.find_path(v[4])
- t += '<li><a href="%s://%s%s%s">%s</a></li>' % (urlproto[k[3]], v[2], port, path, k[2])
-
- t += '</ul>'
-
- t += '<hr noshade/><p style="font-size: 8; font-family: sans-serif">Served by %s</p></body></html>' % self.version_string
-
- return str(t)
-
-
- def new_service(self, interface, protocol, name, type, domain, flags):
-
- interface, protocol, name, type, domain, host, aprotocol, address, port, txt, flags = self.server.ResolveService(interface, protocol, name, type, domain, avahi.PROTO_UNSPEC, dbus.UInt32(0))
-
- if self.use_host_names:
- h = host
- else:
- if aprotocol == avahi.PROTO_INET6:
- h = "[" + address + "]"
- else:
- h = address
-
- self.services[(interface, protocol, name, type, domain)] = (host, aprotocol, h, port, txt)
-
- def remove_service(self, interface, protocol, name, type, domain):
- del self.services[(interface, protocol, name, type, domain)]
-
-
-def usage(retval = 0):
- print "%s [options]\n" % sys.argv[0]
- print " -h --help Show this help"
- print " -p --port PORT Specify the port to use (default %u)" % port
- print " -a --address ADDRESS Specify the address to bind to (default %s)" % address
- print " -H --host-names Show links with real hostnames"
- print " -A --addresses Show links with numeric IP addresses"
- print " -d --domain DOMAIN Specify the domain to browse"
- sys.exit(retval)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "hp:a:HAd:", ["help", "port=", "address=", "host-names", "addresses", "domain="])
-except getopt.GetoptError:
- usage(2)
-
-for o, a in opts:
- if o in ("-h", "--help"):
- usage()
-
- if o in ("-p", "--port"):
- port = int(a)
-
- if o in ("-a", "--address"):
- address = a
-
- if o in ("-H", "--host-names"):
- use_host_names = True
-
- if o in ("-A", "--addresses"):
- use_host_names = False
-
- if o in ("-d", "--domain"):
- domain = a
-
-site = server.Site(AvahiBookmarks(use_host_names))
-reactor.listenTCP(port, site, interface=address)
-
-print "Now point your web browser to http://%s:%u/!" % (address, port)
-
-try:
- reactor.run()
-except KeyboardInterrupt, k:
- pass
diff --git a/release-0.6.9/avahi-python/avahi-discover.desktop.in b/release-0.6.9/avahi-python/avahi-discover.desktop.in
deleted file mode 100644
index 2362cd4..0000000
--- a/release-0.6.9/avahi-python/avahi-discover.desktop.in
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Name=Avahi Zeroconf Browser
-Comment=Browse for Zeroconf services available on your network
-Exec=@bindir@/avahi-discover
-Terminal=false
-Type=Application
-Icon=gnome-nettool.png
-Categories=GNOME;Application;System;Utility
-StartupNotify=false
diff --git a/release-0.6.9/avahi-python/avahi-discover.in b/release-0.6.9/avahi-python/avahi-discover.in
deleted file mode 100755
index 5174b5a..0000000
--- a/release-0.6.9/avahi-python/avahi-discover.in
+++ /dev/null
@@ -1,252 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import os, sys
-
-try:
- import avahi, gtk, gobject, dbus, avahi.ServiceTypeDatabase
- from avahi.SimpleGladeApp import SimpleGladeApp
-except ImportError:
- print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus."
- sys.exit(1)
-
-try:
- import dbus.glib
-except ImportError, e:
- pass
-
-service_type_browsers = {}
-service_browsers = {}
-
-glade_dir = "@interfacesdir@"
-
-service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase()
-
-class Main_window(SimpleGladeApp):
- def __init__(self, path="avahi-discover.glade", root="main_window", domain=None, **kwargs):
- path = os.path.join(glade_dir, path)
- gtk.window_set_default_icon_name("gnome-networktool")
- SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
-
- def on_tree_view_cursor_changed(self, widget, *args):
- (model, iter) = widget.get_selection().get_selected()
- (name,interface,protocol,stype,domain) = self.treemodel.get(iter,1,2,3,4,5)
- if stype == None:
- self.info_label.set_markup("<i>No service currently selected.</i>")
- return
- #Asynchronous resolving
- self.server.ResolveService( int(interface), int(protocol), name, stype, domain, avahi.PROTO_UNSPEC, dbus.UInt32(0), reply_handler=self.service_resolved, error_handler=self.print_error)
-
- def protoname(self,protocol):
- if protocol == avahi.PROTO_INET:
- return "IPv4"
- if protocol == avahi.PROTO_INET6:
- return "IPv6"
- return "n/a"
-
- def siocgifname(self, interface):
- if interface <= 0:
- return "n/a"
- else:
- return self.server.GetNetworkInterfaceNameByIndex(interface)
-
- def get_interface_name(self, interface, protocol):
- if interface == avahi.IF_UNSPEC and protocol == avahi.PROTO_UNSPEC:
- return "Wide Area"
- else:
- return str(self.siocgifname(interface)) + " " + str(self.protoname(protocol))
-
- def service_resolved(self, interface, protocol, name, stype, domain, host, aprotocol, address, port, txt, flags):
- print "Service data for service '%s' of type '%s' in domain '%s' on %i.%i:" % (name, stype, domain, interface, protocol)
-
- print "\tHost %s (%s), port %i, TXT data: %s" % (host, address, port, str(avahi.txt_array_to_string_array(txt)))
-
- self.update_label(interface, protocol, name, stype, domain, host, aprotocol, address, port, avahi.txt_array_to_string_array(txt))
-
- def print_error(self, err):
- error_label = "<b>Error:</b> %s" % (err)
- self.info_label.set_markup(error_label)
- print "Error:", str(err)
-
- def lookup_type(self, stype):
- global service_type_db
-
- try:
- return service_type_db[stype]
- except KeyError:
- return stype
-
- def new_service(self, interface, protocol, name, stype, domain, flags):
- print "Found service '%s' of type '%s' in domain '%s' on %i.%i." % (name, stype, domain, interface, protocol)
- if self.zc_ifaces.has_key((interface,protocol)) == False:
-
- ifn = self.get_interface_name(interface, protocol)
-
- self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, ifn, None,interface,protocol,None,domain)
- if self.zc_domains.has_key((interface,protocol,domain)) == False:
- self.zc_domains[(interface,protocol,domain)] = self.insert_row(self.treemodel, self.zc_ifaces[(interface,protocol)], domain,None,interface,protocol,None,domain)
- if self.zc_types.has_key((interface,protocol,stype,domain)) == False:
- thisDomain = self.zc_domains[(interface,protocol,domain)]
- self.zc_types[(interface,protocol,stype,domain)] = self.insert_row(self.treemodel, thisDomain, self.lookup_type(stype), name, interface,None,None,None)
- treeiter = self.insert_row(self.treemodel,self.zc_types[(interface,protocol,stype,domain)], name, name, interface,protocol,stype,domain)
- self.services_browsed[(interface, protocol, name, stype, domain)] = treeiter
- # expand the tree of this path
- self.tree_view.expand_to_path(self.treemodel.get_path(treeiter))
-
- def remove_service(self, interface, protocol, name, stype, domain, flags):
- print "Service '%s' of type '%s' in domain '%s' on %i.%i disappeared." % (name, stype, domain, interface, protocol)
- self.info_label.set_markup("")
- treeiter=self.services_browsed[(interface, protocol, name, stype, domain)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.services_browsed[(interface, protocol, name, stype, domain)]
- if self.treemodel.iter_has_child(parent) == False:
- treeiter=self.zc_types[(interface,protocol,stype,domain)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.zc_types[(interface,protocol,stype,domain)]
- if self.treemodel.iter_has_child(parent) == False:
- treeiter=self.zc_domains[(interface,protocol,domain)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.zc_domains[(interface,protocol,domain)]
- if self.treemodel.iter_has_child(parent) == False:
- treeiter=self.zc_ifaces[(interface,protocol)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.zc_ifaces[(interface,protocol)]
-
- def new_service_type(self, interface, protocol, stype, domain, flags):
- global service_browsers
-
- # Are we already browsing this domain for this type?
- if service_browsers.has_key((interface, protocol, stype, domain)):
- return
-
- print "Browsing for services of type '%s' in domain '%s' on %i.%i ..." % (stype, domain, interface, protocol)
-
- b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(interface, protocol, stype, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
- b.connect_to_signal('ItemNew', self.new_service)
- b.connect_to_signal('ItemRemove', self.remove_service)
-
- service_browsers[(interface, protocol, stype, domain)] = b
-
- def browse_domain(self, interface, protocol, domain):
- global service_type_browsers
-
- # Are we already browsing this domain?
- if service_type_browsers.has_key((interface, protocol, domain)):
- return
-
- if self.stype is None:
- print "Browsing domain '%s' on %i.%i ..." % (domain, interface, protocol)
-
- b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceTypeBrowserNew(interface, protocol, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_TYPE_BROWSER)
- b.connect_to_signal('ItemNew', self.new_service_type)
-
- service_type_browsers[(interface, protocol, domain)] = b
- else:
- new_service_type(interface, protocol, stype, domain)
-
- def new_domain(self,interface, protocol, domain, flags):
- if self.zc_ifaces.has_key((interface,protocol)) == False:
- ifn = self.get_interface_name(interface, protocol)
- self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, ifn,None,interface,protocol,None,domain)
- if self.zc_domains.has_key((interface,protocol,domain)) == False:
- self.zc_domains[(interface,protocol,domain)] = self.insert_row(self.treemodel, self.zc_ifaces[(interface,protocol)], domain,None,interface,protocol,None,domain)
- if domain != "local":
- self.browse_domain(interface, protocol, domain)
-
- def pair_to_dict(self, l):
- res = dict()
- for el in l:
- if "=" not in el:
- res[el]=''
- else:
- tmp = el.split('=',1)
- if len(tmp[0]) > 0:
- res[tmp[0]] = tmp[1]
- return res
-
-
- def update_label(self,interface, protocol, name, stype, domain, host, aprotocol, address, port, txt):
- if len(txt) != 0:
- txts = ""
- txtd = self.pair_to_dict(txt)
- for k,v in txtd.items():
- txts+="<b>TXT <i>%s</i></b> = %s\n" % (k,v)
- else:
- txts = "<b>TXT Data:</b> <i>empty</i>"
-
- infos = "<b>Service Type:</b> %s\n<b>Service Name:</b> %s\n<b>Domain Name:</b> %s\n<b>Interface:</b> %s %s\n<b>Address:</b> %s/%s:%i\n%s" % (stype, name, domain, self.siocgifname(interface), self.protoname(protocol), host, address, port, txts.strip())
- self.info_label.set_markup(infos)
-
- def insert_row(self, model,parent,
- content, name, interface,protocol,stype,domain):
- myiter=model.insert_after(parent,None)
- model.set(myiter,0,content,1,name,2,interface,3,protocol,4,stype,5,domain)
- return myiter
-
- def new(self):
- print "A new main_window has been created"
- self.treemodel=gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
- self.tree_view.set_model(self.treemodel)
-
- #creating the columns headers
- self.tree_view.set_headers_visible(False)
- renderer=gtk.CellRendererText()
- column=gtk.TreeViewColumn("",renderer, text=0)
- column.set_resizable(True)
- column.set_sizing("GTK_TREE_VIEW_COLUMN_GROW_ONLY");
- column.set_expand(True);
- self.tree_view.append_column(column)
-
- self.domain = None
- self.stype = None
- self.zc_ifaces = {}
- self.zc_domains = {}
- self.zc_types = {}
- self.services_browsed = {}
-
- self.bus = dbus.SystemBus()
- self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
-
- if self.domain is None:
- # Explicitly browse .local
- self.browse_domain(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "local")
-
- # Browse for other browsable domains
- db = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.DomainBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "", avahi.DOMAIN_BROWSER_BROWSE, dbus.UInt32(0))), avahi.DBUS_INTERFACE_DOMAIN_BROWSER)
- db.connect_to_signal('ItemNew', self.new_domain)
- else:
- # Just browse the domain the user wants us to browse
- self.browse_domain(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, domain)
-
-
-def main():
- main_window = Main_window()
-
- main_window.run()
-
-if __name__ == "__main__":
- main()
-
-
diff --git a/release-0.6.9/avahi-python/avahi/Makefile.am b/release-0.6.9/avahi-python/avahi/Makefile.am
deleted file mode 100644
index b1ebe22..0000000
--- a/release-0.6.9/avahi-python/avahi/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-EXTRA_DIST = __init__.py SimpleGladeApp.py ServiceTypeDatabase.py.in
-
-if HAVE_PYTHON
-
-avahidir = $(pythondir)/avahi
-
-avahi_SCRIPTS = ServiceTypeDatabase.py
-
-ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@pkgdatadir\@,$(pkgdatadir),g' $< > $@
- chmod +x $@
-
-if HAVE_PYGTK
-if HAVE_PYTHON_DBUS
-
-avahi_PYTHON = __init__.py SimpleGladeApp.py
-
-endif
-endif
-endif
-
-CLEANFILES=*.pyc *.pyo ServiceTypeDatabase.py
-
-
diff --git a/release-0.6.9/avahi-python/avahi/ServiceTypeDatabase.py.in b/release-0.6.9/avahi-python/avahi/ServiceTypeDatabase.py.in
deleted file mode 100644
index 66b29c8..0000000
--- a/release-0.6.9/avahi-python/avahi/ServiceTypeDatabase.py.in
+++ /dev/null
@@ -1,109 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import gdbm
-import locale
-import re
-
-locale.setlocale(locale.LC_ALL, '')
-
-class ServiceTypeDatabase:
-
- def __init__(self, filename = "@pkgdatadir@/service-types.db"):
-
- self.db = gdbm.open(filename, "r")
-
- l = locale.getlocale(locale.LC_MESSAGES)
-
- self.suffixes = ()
-
- if not l[0] is None:
-
- if not l[1] is None:
- self.suffixes += (l[0] + "@" + l[1], )
-
- self.suffixes += (l[0], )
-
- i = l[0].find("_")
-
- if i >= 0:
-
- k = l[0][:i]
-
- if not l[1] is None:
- self.suffixes += (k + "@" + l[1], )
-
- self.suffixes += (k, )
-
-
- self.suffixes = tuple(map(lambda x: "["+x+"]", self.suffixes)) + ("", )
-
- def __getitem__(self, key):
-
- for suffix in self.suffixes:
- try:
- return self.db[key + suffix]
- except KeyError:
- pass
-
- raise KeyError()
-
- def items(self):
-
- items = []
- key = self.db.firstkey()
- while key is not None:
- if re.search('_\w*\._\w*', key) and not re.search('_\w*\._\w*\[.*\]', key):
- localized_service_name = self[key]
- items.append((key, localized_service_name))
- key = self.db.nextkey(key)
- return items
-
- def has_key(self, key):
-
- for suffix in self.suffixes:
-
- if self.db.has_key(key + suffix):
- return True
-
- return False
-
- def __contains__(self, item):
-
- for suffix in self.suffixes:
-
- if item+suffix in self.db:
- return True
-
- return False
-
-
-
-if __name__ == "__main__":
-
- b = ServiceTypeDatabase()
-
- print b["_http._tcp"]
- print b["_ftp._tcp"]
- print b["_webdav._tcp"]
- print b["_webdavs._tcp"]
-
- print b["gurki._tcp"]
diff --git a/release-0.6.9/avahi-python/avahi/SimpleGladeApp.py b/release-0.6.9/avahi-python/avahi/SimpleGladeApp.py
deleted file mode 100644
index 90c598c..0000000
--- a/release-0.6.9/avahi-python/avahi/SimpleGladeApp.py
+++ /dev/null
@@ -1,341 +0,0 @@
-"""
- SimpleGladeApp.py
- Module that provides an object oriented abstraction to pygtk and libglade.
- Copyright (C) 2004 Sandino Flores Moreno
-"""
-
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import sys
-import re
-
-import tokenize
-import gtk
-import gtk.glade
-import weakref
-import inspect
-
-__version__ = "1.0"
-__author__ = 'Sandino "tigrux" Flores-Moreno'
-
-def bindtextdomain(app_name, locale_dir=None):
- """
- Bind the domain represented by app_name to the locale directory locale_dir.
- It has the effect of loading translations, enabling applications for different
- languages.
-
- app_name:
- a domain to look for translations, tipically the name of an application.
-
- locale_dir:
- a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
- If omitted or None, then the current binding for app_name is used.
- """
- try:
- import locale
- import gettext
- locale.setlocale(locale.LC_ALL, "")
- gtk.glade.bindtextdomain(app_name, locale_dir)
- gettext.install(app_name, locale_dir, unicode=1)
- except (IOError,locale.Error), e:
- print "Warning", app_name, e
- __builtins__.__dict__["_"] = lambda x : x
-
-
-class SimpleGladeApp:
-
- def __init__(self, path, root=None, domain=None, **kwargs):
- """
- Load a glade file specified by glade_filename, using root as
- root widget and domain as the domain for translations.
-
- If it receives extra named arguments (argname=value), then they are used
- as attributes of the instance.
-
- path:
- path to a glade filename.
- If glade_filename cannot be found, then it will be searched in the
- same directory of the program (sys.argv[0])
-
- root:
- the name of the widget that is the root of the user interface,
- usually a window or dialog (a top level widget).
- If None or ommited, the full user interface is loaded.
-
- domain:
- A domain to use for loading translations.
- If None or ommited, no translation is loaded.
-
- **kwargs:
- a dictionary representing the named extra arguments.
- It is useful to set attributes of new instances, for example:
- glade_app = SimpleGladeApp("ui.glade", foo="some value", bar="another value")
- sets two attributes (foo and bar) to glade_app.
- """
- if os.path.isfile(path):
- self.glade_path = path
- else:
- glade_dir = os.path.dirname( sys.argv[0] )
- self.glade_path = os.path.join(glade_dir, path)
- for key, value in kwargs.items():
- try:
- setattr(self, key, weakref.proxy(value) )
- except TypeError:
- setattr(self, key, value)
- self.glade = None
- self.install_custom_handler(self.custom_handler)
- self.glade = self.create_glade(self.glade_path, root, domain)
- if root:
- self.main_widget = self.get_widget(root)
- else:
- self.main_widget = None
- self.normalize_names()
- self.add_callbacks(self)
- self.new()
-
- def __repr__(self):
- class_name = self.__class__.__name__
- if self.main_widget:
- root = gtk.Widget.get_name(self.main_widget)
- repr = '%s(path="%s", root="%s")' % (class_name, self.glade_path, root)
- else:
- repr = '%s(path="%s")' % (class_name, self.glade_path)
- return repr
-
- def new(self):
- """
- Method called when the user interface is loaded and ready to be used.
- At this moment, the widgets are loaded and can be refered as self.widget_name
- """
- pass
-
- def add_callbacks(self, callbacks_proxy):
- """
- It uses the methods of callbacks_proxy as callbacks.
- The callbacks are specified by using:
- Properties window -> Signals tab
- in glade-2 (or any other gui designer like gazpacho).
-
- Methods of classes inheriting from SimpleGladeApp are used as
- callbacks automatically.
-
- callbacks_proxy:
- an instance with methods as code of callbacks.
- It means it has methods like on_button1_clicked, on_entry1_activate, etc.
- """
- self.glade.signal_autoconnect(callbacks_proxy)
-
- def normalize_names(self):
- """
- It is internally used to normalize the name of the widgets.
- It means a widget named foo:vbox-dialog in glade
- is refered self.vbox_dialog in the code.
-
- It also sets a data "prefixes" with the list of
- prefixes a widget has for each widget.
- """
- for widget in self.get_widgets():
- widget_name = gtk.Widget.get_name(widget)
- prefixes_name_l = widget_name.split(":")
- prefixes = prefixes_name_l[ : -1]
- widget_api_name = prefixes_name_l[-1]
- widget_api_name = "_".join( re.findall(tokenize.Name, widget_api_name) )
- gtk.Widget.set_name(widget, widget_api_name)
- if hasattr(self, widget_api_name):
- raise AttributeError("instance %s already has an attribute %s" % (self,widget_api_name))
- else:
- setattr(self, widget_api_name, widget)
- if prefixes:
- gtk.Widget.set_data(widget, "prefixes", prefixes)
-
- def add_prefix_actions(self, prefix_actions_proxy):
- """
- By using a gui designer (glade-2, gazpacho, etc)
- widgets can have a prefix in theirs names
- like foo:entry1 or foo:label3
- It means entry1 and label3 has a prefix action named foo.
-
- Then, prefix_actions_proxy must have a method named prefix_foo which
- is called everytime a widget with prefix foo is found, using the found widget
- as argument.
-
- prefix_actions_proxy:
- An instance with methods as prefix actions.
- It means it has methods like prefix_foo, prefix_bar, etc.
- """
- prefix_s = "prefix_"
- prefix_pos = len(prefix_s)
-
- is_method = lambda t : callable( t[1] )
- is_prefix_action = lambda t : t[0].startswith(prefix_s)
- drop_prefix = lambda (k,w): (k[prefix_pos:],w)
-
- members_t = inspect.getmembers(prefix_actions_proxy)
- methods_t = filter(is_method, members_t)
- prefix_actions_t = filter(is_prefix_action, methods_t)
- prefix_actions_d = dict( map(drop_prefix, prefix_actions_t) )
-
- for widget in self.get_widgets():
- prefixes = gtk.Widget.get_data(widget, "prefixes")
- if prefixes:
- for prefix in prefixes:
- if prefix in prefix_actions_d:
- prefix_action = prefix_actions_d[prefix]
- prefix_action(widget)
-
- def custom_handler(self,
- glade, function_name, widget_name,
- str1, str2, int1, int2):
- """
- Generic handler for creating custom widgets, internally used to
- enable custom widgets (custom widgets of glade).
-
- The custom widgets have a creation function specified in design time.
- Those creation functions are always called with str1,str2,int1,int2 as
- arguments, that are values specified in design time.
-
- Methods of classes inheriting from SimpleGladeApp are used as
- creation functions automatically.
-
- If a custom widget has create_foo as creation function, then the
- method named create_foo is called with str1,str2,int1,int2 as arguments.
- """
- try:
- handler = getattr(self, function_name)
- return handler(str1, str2, int1, int2)
- except AttributeError:
- return None
-
- def gtk_widget_show(self, widget, *args):
- """
- Predefined callback.
- The widget is showed.
- Equivalent to widget.show()
- """
- widget.show()
-
- def gtk_widget_hide(self, widget, *args):
- """
- Predefined callback.
- The widget is hidden.
- Equivalent to widget.hide()
- """
- widget.hide()
-
- def gtk_widget_grab_focus(self, widget, *args):
- """
- Predefined callback.
- The widget grabs the focus.
- Equivalent to widget.grab_focus()
- """
- widget.grab_focus()
-
- def gtk_widget_destroy(self, widget, *args):
- """
- Predefined callback.
- The widget is destroyed.
- Equivalent to widget.destroy()
- """
- widget.destroy()
-
- def gtk_window_activate_default(self, window, *args):
- """
- Predefined callback.
- The default widget of the window is activated.
- Equivalent to window.activate_default()
- """
- widget.activate_default()
-
- def gtk_true(self, *args):
- """
- Predefined callback.
- Equivalent to return True in a callback.
- Useful for stopping propagation of signals.
- """
- return True
-
- def gtk_false(self, *args):
- """
- Predefined callback.
- Equivalent to return False in a callback.
- """
- return False
-
- def gtk_main_quit(self, *args):
- """
- Predefined callback.
- Equivalent to self.quit()
- """
- self.quit()
-
- def main(self):
- """
- Starts the main loop of processing events.
- The default implementation calls gtk.main()
-
- Useful for applications that needs a non gtk main loop.
- For example, applications based on gstreamer needs to override
- this method with gst.main()
-
- Do not directly call this method in your programs.
- Use the method run() instead.
- """
- gtk.main()
-
- def quit(self):
- """
- Quit processing events.
- The default implementation calls gtk.main_quit()
-
- Useful for applications that needs a non gtk main loop.
- For example, applications based on gstreamer needs to override
- this method with gst.main_quit()
- """
- gtk.main_quit()
-
- def run(self):
- """
- Starts the main loop of processing events checking for Control-C.
-
- The default implementation checks wheter a Control-C is pressed,
- then calls on_keyboard_interrupt().
-
- Use this method for starting programs.
- """
- try:
- self.main()
- except KeyboardInterrupt:
- self.on_keyboard_interrupt()
-
- def on_keyboard_interrupt(self):
- """
- This method is called by the default implementation of run()
- after a program is finished by pressing Control-C.
- """
- pass
-
- def install_custom_handler(self, custom_handler):
- gtk.glade.set_custom_handler(custom_handler)
-
- def create_glade(self, glade_path, root, domain):
- return gtk.glade.XML(self.glade_path, root, domain)
-
- def get_widget(self, widget_name):
- return self.glade.get_widget(widget_name)
-
- def get_widgets(self):
- return self.glade.get_widget_prefix("")
diff --git a/release-0.6.9/avahi-python/avahi/__init__.py b/release-0.6.9/avahi-python/avahi/__init__.py
deleted file mode 100644
index 81e2754..0000000
--- a/release-0.6.9/avahi-python/avahi/__init__.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Some definitions matching those in avahi-common/defs.h
-
-import dbus
-
-SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION, SERVER_FAILURE = range(0, 5)
-
-ENTRY_GROUP_UNCOMMITED, ENTRY_GROUP_REGISTERING, ENTRY_GROUP_ESTABLISHED, ENTRY_GROUP_COLLISION, ENTRY_GROUP_FAILURE = range(0, 5)
-
-DOMAIN_BROWSER_BROWSE, DOMAIN_BROWSER_BROWSE_DEFAULT, DOMAIN_BROWSER_REGISTER, DOMAIN_BROWSER_REGISTER_DEFAULT, DOMAIN_BROWSER_BROWSE_LEGACY = range(0, 5)
-
-PROTO_UNSPEC, PROTO_INET, PROTO_INET6 = -1, 0, 1
-
-IF_UNSPEC = -1
-
-PUBLISH_UNIQUE = 1
-PUBLISH_NO_PROBE = 2
-PUBLISH_NO_ANNOUNCE = 4
-PUBLISH_ALLOW_MULTIPLE = 8
-PUBLISH_NO_REVERSE = 16
-PUBLISH_NO_COOKIE = 32
-PUBLISH_UPDATE = 64
-PUBLISH_USE_WIDE_AREA = 128
-PUBLISH_USE_MULTICAST = 256
-
-LOOKUP_USE_WIDE_AREA = 1
-LOOKUP_USE_MULTICAST = 2
-LOOKUP_NO_TXT = 4
-LOOKUP_NO_ADDRESS = 8
-
-LOOKUP_RESULT_CACHED = 1
-LOOKUP_RESULT_WIDE_AREA = 2
-LOOKUP_RESULT_MULTICAST = 4
-LOOKUP_RESULT_LOCAL = 8
-LOOKUP_RESULT_OUR_OWN = 16
-LOOKUP_RESULT_STATIC = 32
-
-SERVICE_COOKIE = "org.freedesktop.Avahi.cookie"
-SERVICE_COOKIE_INVALID = 0
-
-DBUS_NAME = "org.freedesktop.Avahi"
-DBUS_INTERFACE_SERVER = DBUS_NAME + ".Server"
-DBUS_PATH_SERVER = "/"
-DBUS_INTERFACE_ENTRY_GROUP = DBUS_NAME + ".EntryGroup"
-DBUS_INTERFACE_DOMAIN_BROWSER = DBUS_NAME + ".DomainBrowser"
-DBUS_INTERFACE_SERVICE_TYPE_BROWSER = DBUS_NAME + ".ServiceTypeBrowser"
-DBUS_INTERFACE_SERVICE_BROWSER = DBUS_NAME + ".ServiceBrowser"
-DBUS_INTERFACE_ADDRESS_RESOLVER = DBUS_NAME + ".AddressResolver"
-DBUS_INTERFACE_HOST_NAME_RESOLVER = DBUS_NAME + ".HostNameResolver"
-DBUS_INTERFACE_SERVICE_RESOLVER = DBUS_NAME + ".ServiceResolver"
-DBUS_INTERFACE_RECORD_BROWSER = DBUS_NAME + ".RecordBrowser"
-
-def byte_array_to_string(s):
- r = ""
-
- for c in s:
-
- if c >= 32 and c < 127:
- r += "%c" % c
- else:
- r += "."
-
- return r
-
-def txt_array_to_string_array(t):
- l = []
-
- for s in t:
- l.append(byte_array_to_string(s))
-
- return l
-
-
-def string_to_byte_array(s):
- r = []
-
- for c in s:
- r.append(dbus.Byte(ord(c)))
-
- return r
-
-def string_array_to_txt_array(t):
- l = []
-
- for s in t:
- l.append(string_to_byte_array(s))
-
- return l
-
-def dict_to_txt_array(txt_dict):
- l = []
-
- for k,v in txt_dict.items():
- l.append(string_to_byte_array("%s=%s" % (k,v)))
-
- return l
diff --git a/release-0.6.9/avahi-qt/Makefile.am b/release-0.6.9/avahi-qt/Makefile.am
deleted file mode 100644
index 4cd047b..0000000
--- a/release-0.6.9/avahi-qt/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-lib_LTLIBRARIES =
-BUILT_SOURCES =
-
-if HAVE_QT3
-
-avahiqt3includedir=$(includedir)/avahi-qt3
-
-avahiqt3include_HEADERS = \
- qt-watch.h
-
-lib_LTLIBRARIES += \
- libavahi-qt3.la
-
-BUILT_SOURCES += qt-watch.moc3
-
-libavahi_qt3_la_SOURCES = \
- qt-watch.cpp
-
-qt-watch.moc3: qt-watch.cpp
- $(MOC_QT3) $^ > $@
-
-libavahi_qt3_la_CPPFLAGS = $(AM_CFLAGS) $(QT3_CFLAGS)
-libavahi_qt3_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT3_LIBS)
-libavahi_qt3_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_QT3_VERSION_INFO)
-
-endif
-
-if HAVE_QT4
-
-avahiqt4includedir=$(includedir)/avahi-qt4
-avahiqt4include_HEADERS = \
- qt-watch.h
-
-lib_LTLIBRARIES += \
- libavahi-qt4.la
-
-BUILT_SOURCES += qt-watch.moc4
-
-libavahi_qt4_la_SOURCES = \
- qt-watch.cpp
-
-qt-watch.moc4: qt-watch.cpp
- $(MOC_QT4) $^ > $@
-
-libavahi_qt4_la_CPPFLAGS = $(AM_CFLAGS) $(QT4_CFLAGS) -DQT4
-libavahi_qt4_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT4_LIBS)
-libavahi_qt4_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_QT4_VERSION_INFO)
-
-endif
-
-CLEANFILES = $(BUILT_SOURCES)
diff --git a/release-0.6.9/avahi-qt/qt-watch.cpp b/release-0.6.9/avahi-qt/qt-watch.cpp
deleted file mode 100644
index f29b517..0000000
--- a/release-0.6.9/avahi-qt/qt-watch.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <sys/time.h>
-#ifdef QT4
-#include <Qt/qsocketnotifier.h>
-#include <Qt/qobject.h>
-#include <Qt/qtimer.h>
-#else
-#include <qsocketnotifier.h>
-#include <qobject.h>
-#include <qtimer.h>
-#endif
-#include <avahi-common/timeval.h>
-#include "qt-watch.h"
-
-class AvahiWatch : public QObject
-{
- Q_OBJECT
-public:
- AvahiWatch(int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void* userdata);
- ~AvahiWatch() {}
- AvahiWatchEvent getEvents() const { return m_incallback ? m_lastEvent : (AvahiWatchEvent)0; }
- void setWatchedEvents(AvahiWatchEvent event);
-
-private slots:
- void gotIn();
- void gotOut();
-
-private:
- QSocketNotifier* m_in;
- QSocketNotifier* m_out;
- //FIXME: ERR and HUP?
- AvahiWatchCallback m_callback;
- AvahiWatchEvent m_lastEvent;
- int m_fd;
- void* m_userdata;
- bool m_incallback;
-};
-
-class AvahiTimeout : public QObject
-{
- Q_OBJECT
-
-public:
- AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callback, void* userdata);
- ~AvahiTimeout() {}
- void update(const struct timeval* tv);
-
-private slots:
- void timeout();
-
-private:
- QTimer m_timer;
- AvahiTimeoutCallback m_callback;
- void* m_userdata;
-};
-
-
-
-AvahiWatch::AvahiWatch(int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void* userdata) :
- m_in(0), m_out(0), m_callback(callback), m_fd(fd), m_userdata(userdata), m_incallback(false)
-{
- setWatchedEvents(event);
-}
-
-void AvahiWatch::gotIn()
-{
- m_lastEvent = AVAHI_WATCH_IN;
- m_incallback=true;
- m_callback(this,m_fd,m_lastEvent,m_userdata);
- m_incallback=false;
-}
-
-void AvahiWatch::gotOut()
-{
- m_lastEvent = AVAHI_WATCH_IN;
- m_incallback=true;
- m_callback(this,m_fd,m_lastEvent,m_userdata);
- m_incallback=false;
-}
-
-void AvahiWatch::setWatchedEvents(AvahiWatchEvent event)
-{
- if (!(event & AVAHI_WATCH_IN)) { delete m_in; m_in=0; }
- if (!(event & AVAHI_WATCH_OUT)) { delete m_out; m_out=0; }
- if (event & AVAHI_WATCH_IN) {
- m_in = new QSocketNotifier(m_fd,QSocketNotifier::Read, this);
- connect(m_in,SIGNAL(activated(int)),SLOT(gotIn()));
- }
- if (event & AVAHI_WATCH_OUT) {
- m_out = new QSocketNotifier(m_fd,QSocketNotifier::Write, this);
- connect(m_out,SIGNAL(activated(int)),SLOT(gotOut()));
- }
-}
-
-AvahiTimeout::AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callback, void *userdata) :
- m_callback(callback), m_userdata(userdata)
-{
- connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
-#ifdef QT4
- m_timer.setSingleShot(true);
-#endif
- update(tv);
-}
-
-void AvahiTimeout::update(const struct timeval *tv)
-{
- m_timer.stop();
- if (tv) {
- AvahiUsec u = avahi_age(tv)/1000;
-#ifdef QT4
- m_timer.start( (u>0) ? 0 : -u);
-#else
- m_timer.start( (u>0) ? 0 : -u,true);
-#endif
- }
-}
-
-void AvahiTimeout::timeout()
-{
- m_callback(this,m_userdata);
-}
-
-static AvahiWatch* q_watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback,
- void *userdata)
-{
- return new AvahiWatch(fd, event, callback, userdata);
-}
-
-static void q_watch_update(AvahiWatch *w, AvahiWatchEvent events)
-{
- w->setWatchedEvents(events);
-}
-
-static AvahiWatchEvent q_watch_get_events(AvahiWatch *w)
-{
- return w->getEvents();
-}
-
-static void q_watch_free(AvahiWatch *w)
-{
- delete w;
-}
-
-static AvahiTimeout* q_timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback,
- void *userdata)
-{
- return new AvahiTimeout(tv, callback, userdata);
-}
-
-static void q_timeout_update(AvahiTimeout *t, const struct timeval *tv)
-{
- t->update(tv);
-}
-
-static void q_timeout_free(AvahiTimeout *t)
-{
- delete t;
-}
-
-const AvahiPoll* avahi_qt_poll_get(void)
-{
- static const AvahiPoll qt_poll = {
- NULL,
- q_watch_new,
- q_watch_update,
- q_watch_get_events,
- q_watch_free,
- q_timeout_new,
- q_timeout_update,
- q_timeout_free
- };
-
- return &qt_poll;
-}
-
-#ifdef QT4
-#include "qt-watch.moc4"
-#else
-#include "qt-watch.moc3"
-#endif
diff --git a/release-0.6.9/avahi-qt/qt-watch.h b/release-0.6.9/avahi-qt/qt-watch.h
deleted file mode 100644
index 0a3476d..0000000
--- a/release-0.6.9/avahi-qt/qt-watch.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef QAVAHI_H
-#define QAVAHI_H
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file qt-watch.h Qt main loop adapter */
-
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Setup abstract poll structure for integration with Qt main loop */
-const AvahiPoll* avahi_qt_poll_get(void);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/release-0.6.9/avahi-qt3.pc.in b/release-0.6.9/avahi-qt3.pc.in
deleted file mode 100644
index c18f080..0000000
--- a/release-0.6.9/avahi-qt3.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-qt3
-Description: Avahi Multicast DNS Responder (QT3 Support)
-Version: @PACKAGE_VERSION@
-Requires.private: qt-mt >= 3.0.0
-Libs: -L${libdir} -lavahi-qt3
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/release-0.6.9/avahi-qt4.pc.in b/release-0.6.9/avahi-qt4.pc.in
deleted file mode 100644
index f62f717..0000000
--- a/release-0.6.9/avahi-qt4.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-qt4
-Description: Avahi Multicast DNS Responder (QT4 Support)
-Version: @PACKAGE_VERSION@
-Requires.private: QtCore >= 4.0.0
-Libs: -L${libdir} -lavahi-qt4
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/release-0.6.9/avahi-sharp.pc.in b/release-0.6.9/avahi-sharp.pc.in
deleted file mode 100644
index 3cc78b6..0000000
--- a/release-0.6.9/avahi-sharp.pc.in
+++ /dev/null
@@ -1,8 +0,0 @@
-prefix=@prefix@
-exec_prefix=@prefix@
-libdir=@libdir@
-
-Name: avahi-sharp
-Description: Mono bindings for the Avahi mDNS/DNS-SD stack
-Version: @PACKAGE_VERSION@
-Libs: -r:${libdir}/mono/avahi-sharp/avahi-sharp.dll
diff --git a/release-0.6.9/avahi-sharp/AddressResolver.cs b/release-0.6.9/avahi-sharp/AddressResolver.cs
deleted file mode 100644
index 3025102..0000000
--- a/release-0.6.9/avahi-sharp/AddressResolver.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Net;
-using System.Runtime.InteropServices;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- internal delegate void AddressResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr address,
- IntPtr hostname, LookupResultFlags flags, IntPtr userdata);
-
- public delegate void HostAddressHandler (object o, HostAddressArgs args);
-
- public class HostAddressArgs : EventArgs
- {
- private string host;
- private IPAddress address;
-
- public string Host
- {
- get { return host; }
- }
-
- public IPAddress Address
- {
- get { return address; }
- }
-
- public HostAddressArgs (string host, IPAddress address)
- {
- this.host = host;
- this.address = address;
- }
- }
-
- public class AddressResolver : ResolverBase, IDisposable
- {
- private IntPtr handle;
- private Client client;
- private int iface;
- private Protocol proto;
- private IPAddress address;
- private LookupFlags flags;
- private AddressResolverCallback cb;
-
- private IPAddress currentAddress;
- private string currentHost;
-
- private ArrayList foundListeners = new ArrayList ();
- private ArrayList timeoutListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_address_resolver_new (IntPtr client, int iface, Protocol proto,
- IntPtr address, LookupFlags flags,
- AddressResolverCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_address_resolver_free (IntPtr handle);
-
- public event HostAddressHandler Found
- {
- add {
- foundListeners.Add (value);
- Start ();
- }
- remove {
- foundListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event EventHandler Timeout
- {
- add {
- timeoutListeners.Add (value);
- Start ();
- }
- remove {
- timeoutListeners.Remove (value);
- Stop (false);
- }
- }
-
- public IPAddress Address
- {
- get { return currentAddress; }
- }
-
- public string HostName
- {
- get { return currentHost; }
- }
-
- public AddressResolver (Client client, IPAddress address) : this (client, -1, Protocol.Unspecified,
- address, LookupFlags.None)
- {
- }
-
- public AddressResolver (Client client, int iface, Protocol proto, IPAddress address, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.address = address;
- this.flags = flags;
- cb = OnAddressResolverCallback;
- }
-
- ~AddressResolver ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (foundListeners.Count == 0 && timeoutListeners.Count == 0))
- return;
-
- IntPtr addrPtr = Utility.AddressToPtr (address);
-
- lock (client) {
- handle = avahi_address_resolver_new (client.Handle, iface, proto, addrPtr, flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
-
- Utility.Free (addrPtr);
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (foundListeners.Count == 0 && timeoutListeners.Count == 0))) {
-
- lock (client) {
- avahi_address_resolver_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnAddressResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr address,
- IntPtr hostname, LookupResultFlags flags, IntPtr userdata)
- {
- switch (revent) {
- case ResolverEvent.Found:
- currentAddress = Utility.PtrToAddress (address);
- currentHost = Utility.PtrToString (hostname);
-
- foreach (HostAddressHandler handler in foundListeners)
- handler (this, new HostAddressArgs (currentHost, currentAddress));
- break;
- case ResolverEvent.Failure:
- EmitFailure (client.LastError);
- break;
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/AssemblyInfo.cs b/release-0.6.9/avahi-sharp/AssemblyInfo.cs
deleted file mode 100644
index f8dd4ed..0000000
--- a/release-0.6.9/avahi-sharp/AssemblyInfo.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("avahi-sharp")]
-[assembly: AssemblyDescription("Mono bindings for the Avahi mDNS/DNS-SD stack")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("(C) 2005 James Willcox <snorp@snorp.net>")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.0")]
diff --git a/release-0.6.9/avahi-sharp/AvahiTest.cs b/release-0.6.9/avahi-sharp/AvahiTest.cs
deleted file mode 100644
index fcec737..0000000
--- a/release-0.6.9/avahi-sharp/AvahiTest.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Text;
-using System.Net;
-using Avahi;
-
-public class AvahiTest {
- private static Client client;
- private static ArrayList objects = new ArrayList ();
-
- public static void Main () {
- client = new Client ();
-
- Console.WriteLine ("joined service name: " + Client.JoinServiceName ("FooBar", "_foo", "local"));
-
- EntryGroup eg = new EntryGroup (client);
- eg.StateChanged += OnEntryGroupChanged;
- eg.AddService ("foobar2", "_dingdong._tcp", client.DomainName,
- 444, new string[] { "foo=stuff", "bar=stuff2", "baz=stuff3" });
- eg.Commit ();
- BrowseServiceTypes ("local");
- Console.WriteLine ("Press enter to quit");
- Console.ReadLine ();
- }
-
- private static void OnEntryGroupChanged (object o, EntryGroupStateArgs args)
- {
- Console.WriteLine ("Entry group status: " + args.State);
- if (args.State == EntryGroupState.Established) {
- DomainBrowser browser = new DomainBrowser (client);
- objects.Add (browser);
-
- browser.DomainAdded += OnDomainAdded;
- }
- }
-
- private static void OnDomainAdded (object o, DomainInfoArgs args)
- {
- Console.WriteLine ("Got domain added: " + args.Domain.Domain);
- // BrowseServiceTypes (args.Domain.Domain);
- }
-
- private static void BrowseServiceTypes (string domain)
- {
- ServiceTypeBrowser stb = new ServiceTypeBrowser (client, domain);
- objects.Add (stb);
-
- stb.CacheExhausted += OnCacheExhausted;
- stb.ServiceTypeAdded += OnServiceTypeAdded;
- }
-
- private static void OnCacheExhausted (object o, EventArgs args)
- {
- Console.WriteLine ("Cache is exhausted");
- }
-
- private static void OnServiceTypeAdded (object o, ServiceTypeInfoArgs args)
- {
- Console.WriteLine ("Got service type: " + args.ServiceType.ServiceType);
- ServiceBrowser sb = new ServiceBrowser (client, args.ServiceType.ServiceType, args.ServiceType.Domain);
- objects.Add (sb);
-
- sb.ServiceAdded += OnServiceAdded;
- }
-
- private static void OnServiceAdded (object o, ServiceInfoArgs args)
- {
- // Console.WriteLine ("Got service: " + info.Name);
- ServiceResolver resolver = new ServiceResolver (client, args.Service);
- objects.Add (resolver);
- resolver.Found += OnServiceResolved;
- }
-
- private static void OnServiceResolved (object o, ServiceInfoArgs args)
- {
- objects.Remove (o);
-
- Console.WriteLine ("Service '{0}' at {1}:{2}", args.Service.Name, args.Service.HostName, args.Service.Port);
- foreach (byte[] bytes in args.Service.Text) {
- Console.WriteLine ("Text: " + Encoding.UTF8.GetString (bytes));
- }
-
- AddressResolver ar = new AddressResolver (client, args.Service.Address);
- objects.Add (ar);
-
- ar.Found += OnAddressResolved;
- ar.Failed += OnAddressResolverFailed;
- }
-
- private static void OnAddressResolverFailed (object o, ErrorCodeArgs args)
- {
- Console.WriteLine ("Failed to resolve '{0}': {1}", (o as AddressResolver).Address, args.ErrorCode);
- }
-
- private static void OnAddressResolved (object o, HostAddressArgs args)
- {
- objects.Remove (o);
-
- Console.WriteLine ("Resolved {0} to {1}", args.Address, args.Host);
- HostNameResolver hr = new HostNameResolver (client, args.Host);
- objects.Add (hr);
-
- hr.Found += OnHostNameResolved;
- }
-
- private static void OnHostNameResolved (object o, HostAddressArgs args)
- {
- objects.Remove (o);
- Console.WriteLine ("Resolved {0} to {1}", args.Host, args.Address);
- }
-}
diff --git a/release-0.6.9/avahi-sharp/BrowserBase.cs b/release-0.6.9/avahi-sharp/BrowserBase.cs
deleted file mode 100644
index 0a1e3a7..0000000
--- a/release-0.6.9/avahi-sharp/BrowserBase.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-
-namespace Avahi
-{
- public abstract class BrowserBase
- {
- public event EventHandler CacheExhausted;
- public event EventHandler AllForNow;
- public event EventHandler Failed;
-
- internal void EmitBrowserEvent (BrowserEvent bevent)
- {
- switch (bevent) {
- case BrowserEvent.CacheExhausted:
- if (CacheExhausted != null)
- CacheExhausted (this, new EventArgs ());
- break;
- case BrowserEvent.AllForNow:
- if (AllForNow != null)
- AllForNow (this, new EventArgs ());
- break;
- case BrowserEvent.Failure:
- if (Failed != null)
- Failed (this, new EventArgs ());
- break;
- default:
- break;
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/Client.cs b/release-0.6.9/avahi-sharp/Client.cs
deleted file mode 100644
index 8ec6616..0000000
--- a/release-0.6.9/avahi-sharp/Client.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-using System;
-using System.Threading;
-using System.Collections;
-using System.Runtime.InteropServices;
-using Mono.Unix;
-using Mono.Unix.Native;
-
-using Stdlib = Mono.Unix.Native.Stdlib;
-
-namespace Avahi
-{
- internal enum ResolverEvent {
- Found,
- Failure
- }
-
- internal enum BrowserEvent {
- Added,
- Removed,
- CacheExhausted,
- AllForNow,
- Failure
- }
-
- internal delegate int PollCallback (IntPtr ufds, uint nfds, int timeout);
- internal delegate void ClientCallback (IntPtr client, ClientState state, IntPtr userData);
-
- public delegate void ClientStateHandler (object o, ClientStateArgs state);
-
- public class ClientStateArgs : EventArgs
- {
- private ClientState state;
-
- public ClientState State
- {
- get { return state; }
- }
-
- public ClientStateArgs (ClientState state)
- {
- this.state = state;
- }
- }
-
- public enum Protocol {
- Unspecified = -1,
- IPv4 = 0,
- IPv6 = 1
- }
-
- internal enum ServerState {
- Invalid,
- Registering,
- Running,
- Collision
- }
-
- public enum ClientState {
- Registering = ServerState.Registering,
- Running = ServerState.Running,
- Collision = ServerState.Collision,
- Failure = 100,
- Connecting = 101
- }
-
- [Flags]
- public enum LookupFlags {
- None = 0,
- UseWideArea = 1,
- UseMulticast = 2,
- NoTxt = 4,
- NoAddress = 8
- }
-
- [Flags]
- public enum LookupResultFlags {
- None = 0,
- Cached = 1,
- WideArea = 2,
- Multicast = 4,
- Local = 8,
- OurOwn = 16,
- }
-
- [Flags]
- public enum ClientFlags {
- None = 0,
- IgnoreUserConfig = 1,
- NoFail = 2
- }
-
- public class Client : IDisposable
- {
- private IntPtr handle;
- private ClientCallback cb;
- private PollCallback pollcb;
- private IntPtr spoll;
-
- private Thread thread;
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_new (IntPtr poll, ClientFlags flags, ClientCallback handler,
- IntPtr userData, out int error);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_client_free (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_version_string (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_host_name (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_domain_name (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_host_name_fqdn (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern ClientState avahi_client_get_state (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_client_errno (IntPtr handle);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_simple_poll_new ();
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_simple_poll_get (IntPtr spoll);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_simple_poll_free (IntPtr spoll);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_simple_poll_loop (IntPtr spoll);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_simple_poll_set_func (IntPtr spoll, PollCallback cb);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_simple_poll_quit (IntPtr spoll);
-
- [DllImport ("avahi-client")]
- private static extern uint avahi_client_get_local_service_cookie (IntPtr client);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_service_name_join (IntPtr buf, int len, byte[] name, byte[] type,
- byte[] domain);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_service_name_split (byte[] service, IntPtr name, int name_len,
- IntPtr type, int type_len,
- IntPtr domain, int domain_len);
-
-
- [DllImport ("libc")]
- private static extern int poll(IntPtr ufds, uint nfds, int timeout);
-
- public event ClientStateHandler StateChanged;
-
- internal IntPtr Handle
- {
- get { return handle; }
- }
-
- public string Version
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_version_string (handle));
- }
- }
- }
-
- public string HostName
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_host_name (handle));
- }
- }
- }
-
- public string DomainName
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_domain_name (handle));
- }
- }
- }
-
- public string HostNameFqdn
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_host_name_fqdn (handle));
- }
- }
- }
-
- public ClientState State
- {
- get {
- lock (this) {
- return (ClientState) avahi_client_get_state (handle);
- }
- }
- }
-
- public uint LocalServiceCookie
- {
- get {
- lock (this) {
- return avahi_client_get_local_service_cookie (handle);
- }
- }
- }
-
- internal ErrorCode LastError
- {
- get {
- lock (this) {
- return (ErrorCode) avahi_client_errno (handle);
- }
- }
- }
-
- public Client (ClientFlags flags)
- {
- spoll = avahi_simple_poll_new ();
-
- pollcb = OnPollCallback;
- avahi_simple_poll_set_func (spoll, pollcb);
- IntPtr poll = avahi_simple_poll_get (spoll);
- cb = OnClientCallback;
-
- int error;
- handle = avahi_client_new (poll, flags, cb, IntPtr.Zero, out error);
- if (error != 0)
- throw new ClientException (error);
-
- thread = new Thread (PollLoop);
- thread.IsBackground = true;
- thread.Start ();
- }
-
- public Client () : this (ClientFlags.None) {
- }
-
- ~Client ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- if (handle != IntPtr.Zero) {
- avahi_client_free (handle);
- avahi_simple_poll_quit (spoll);
- avahi_simple_poll_free (spoll);
- handle = IntPtr.Zero;
- }
- }
-
- public static string JoinServiceName (string name, string type, string domain)
- {
- int len = 4 * (name.Length + type.Length + domain.Length) + 4;
- IntPtr buf = Stdlib.malloc ((ulong) len);
-
- int ret = avahi_service_name_join (buf, len,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain));
-
- if (ret < 0) {
- Utility.Free (buf);
- return null; // FIXME, should throw exception
- }
-
- string service = Utility.PtrToString (buf);
- Utility.Free (buf);
-
- return service;
- }
-
- public static void SplitServiceName (string service, out string name, out string type, out string domain)
- {
- int len = 1024;
-
- IntPtr namePtr = Stdlib.malloc ((ulong) len);
- IntPtr typePtr = Stdlib.malloc ((ulong) len);
- IntPtr domainPtr = Stdlib.malloc ((ulong) len);
-
- int ret = avahi_service_name_split (Utility.StringToBytes (service), namePtr, len, typePtr, len,
- domainPtr, len);
-
- if (ret < 0) {
- Utility.Free (namePtr);
- Utility.Free (typePtr);
- Utility.Free (domainPtr);
-
- name = null;
- type = null;
- domain = null;
- return;
- }
-
- name = Utility.PtrToString (namePtr);
- type = Utility.PtrToString (typePtr);
- domain = Utility.PtrToString (domainPtr);
-
- Utility.Free (namePtr);
- Utility.Free (typePtr);
- Utility.Free (domainPtr);
- }
-
- internal void ThrowError ()
- {
- ErrorCode error = LastError;
-
- if (error != ErrorCode.Ok)
- throw new ClientException (error);
- }
-
- private void OnClientCallback (IntPtr client, ClientState state, IntPtr userData)
- {
- if (StateChanged != null)
- StateChanged (this, new ClientStateArgs (state));
- }
-
- private int OnPollCallback (IntPtr ufds, uint nfds, int timeout) {
- Monitor.Exit (this);
- int result = poll (ufds, nfds, timeout);
- Monitor.Enter (this);
- return result;
- }
-
- private void PollLoop () {
- try {
- lock (this) {
- avahi_simple_poll_loop (spoll);
- }
- } catch (Exception e) {
- Console.Error.WriteLine ("Error in avahi-sharp event loop: " + e);
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/ClientException.cs b/release-0.6.9/avahi-sharp/ClientException.cs
deleted file mode 100644
index fadcce9..0000000
--- a/release-0.6.9/avahi-sharp/ClientException.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Avahi
-{
- public enum ErrorCode {
- Ok = 0,
- Failure = -1,
- BadState = -2,
- InvalidHostName = - 3,
- InvalidDomainName = -4,
- NoNetwork = -5,
- InvalidTTL = -6,
- IsPattern = -7,
- Collision = -8,
- InvalidRecord = -9,
- InvalidServiceName = -10,
- InvalidServiceType = -11,
- InvalidPort = -12,
- InvalidKey = -13,
- InvalidAddress = -14,
- Timeout = -15,
- TooManyClients = -16,
- TooManyObjects = -17,
- TooManyEntries = -18,
- OS = -19,
- AccessDenied = -20,
- InvalidOperation = -21,
- DBusError = -22,
- Disconnected = -23,
- NoMemory = -24,
- InvalidObject = -25,
- NoDaemon = -26,
- InvalidInterface = -27,
- InvalidProtocol = -28,
- InvalidFlags = -29,
- NotFound = -30,
- InvalidConfig = -31,
- VersionMismatch = -32,
- InvalidServiceSubtype = -33,
- InvalidPacket = -34,
- InvalidDnsError = -35,
- DnsFormErr = -36,
- DnsServFail = -37,
- DnsNxDomain = -38,
- DnsNoTimp = -39,
- DnsRefused = -40,
- DnsYxDomain = -41,
- DnsYxRrSet = -42,
- DnsNxRrSet = -43,
- DnsNotAuth = -44,
- DnsNotZone = -45,
- InvalidRData = -46,
- InvalidDnsClass = -47,
- InvalidDnsType = -48,
- NotSupported = -49,
- NotPermitted = -50
- }
-
- public delegate void ErrorCodeHandler (object o, ErrorCodeArgs args);
-
- public class ErrorCodeArgs : EventArgs
- {
- private ErrorCode code;
-
- public ErrorCode ErrorCode
- {
- get { return code; }
- }
-
- public ErrorCodeArgs (ErrorCode code)
- {
- this.code = code;
- }
- }
-
- public class ClientException : ApplicationException
- {
- private ErrorCode code;
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_strerror (ErrorCode code);
-
- public ErrorCode ErrorCode
- {
- get { return code; }
- }
-
- internal ClientException (int code) : this ((ErrorCode) code) {
- }
-
- internal ClientException (ErrorCode code) : base (GetErrorString (code))
- {
- this.code = code;
- }
-
- private static string GetErrorString (ErrorCode code)
- {
- IntPtr str = avahi_strerror (code);
- return Utility.PtrToString (str);
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/DomainBrowser.cs b/release-0.6.9/avahi-sharp/DomainBrowser.cs
deleted file mode 100644
index 50da54e..0000000
--- a/release-0.6.9/avahi-sharp/DomainBrowser.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
- internal delegate void DomainBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr domain, LookupResultFlags flags, IntPtr userdata);
-
- public enum DomainBrowserType {
- Browse,
- BrowseDefault,
- Register,
- RegisterDefault,
- BrowseLegacy
- }
-
- public struct DomainInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Domain;
- public LookupResultFlags Flags;
- }
-
- public class DomainInfoArgs : EventArgs
- {
- private DomainInfo domain;
-
- public DomainInfo Domain
- {
- get { return domain; }
- }
-
- public DomainInfoArgs (DomainInfo domain)
- {
- this.domain = domain;
- }
- }
-
- public delegate void DomainInfoHandler (object o, DomainInfoArgs args);
-
- public class DomainBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string domain;
- private DomainBrowserType btype;
- private LookupFlags flags;
- private DomainBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_domain_browser_new (IntPtr client, int iface, int proto,
- byte[] domain, int btype, LookupFlags flags,
- DomainBrowserCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_domain_browser_free (IntPtr handle);
-
- public event DomainInfoHandler DomainAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event DomainInfoHandler DomainRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public DomainInfo[] Domains
- {
- get { return (DomainInfo[]) infos.ToArray (typeof (DomainInfo)); }
- }
-
- public DomainBrowser (Client client) : this (client, -1, Protocol.Unspecified, client.DomainName,
- DomainBrowserType.Browse, LookupFlags.None) {
- }
-
- public DomainBrowser (Client client, int iface, Protocol proto, string domain,
- DomainBrowserType btype, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.domain = domain;
- this.btype = btype;
- this.flags = flags;
- cb = OnDomainBrowserCallback;
- }
-
- ~DomainBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero && handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_domain_browser_new (client.Handle, iface, (int) proto,
- Utility.StringToBytes (domain), (int) btype, flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
- lock (client) {
- avahi_domain_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnDomainBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr domain, LookupResultFlags flags, IntPtr userdata)
- {
-
- DomainInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.Flags = flags;
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (DomainInfoHandler handler in addListeners)
- handler (this, new DomainInfoArgs (info));
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (DomainInfoHandler handler in removeListeners)
- handler (this, new DomainInfoArgs (info));
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/EntryGroup.cs b/release-0.6.9/avahi-sharp/EntryGroup.cs
deleted file mode 100644
index ab89544..0000000
--- a/release-0.6.9/avahi-sharp/EntryGroup.cs
+++ /dev/null
@@ -1,374 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Runtime.InteropServices;
-using System.Text;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- [Flags]
- public enum PublishFlags {
- None = 0,
- Unique = 1,
- NoProbe = 2,
- NoAnnounce = 4,
- AllowMultiple = 8,
- NoReverse = 16,
- NoCookie = 32,
- Update = 64,
- UseWideArea = 128,
- UseMulticast = 256
- }
-
- public enum EntryGroupState {
- Uncommited,
- Registering,
- Established,
- Collision,
- Failure
- }
-
- public class EntryGroupStateArgs : EventArgs
- {
- private EntryGroupState state;
-
- public EntryGroupState State
- {
- get { return state; }
- }
-
- public EntryGroupStateArgs (EntryGroupState state)
- {
- this.state = state;
- }
- }
-
- internal delegate void EntryGroupCallback (IntPtr group, EntryGroupState state, IntPtr userdata);
- public delegate void EntryGroupStateHandler (object o, EntryGroupStateArgs args);
-
- public class EntryGroup : IDisposable
- {
- private Client client;
- private IntPtr handle;
- private EntryGroupCallback cb;
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_entry_group_new (IntPtr client, EntryGroupCallback cb, IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_commit (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_reset (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern EntryGroupState avahi_entry_group_get_state (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern bool avahi_entry_group_is_empty (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_service_strlst (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, byte[] type,
- byte[] domain, byte[] host, UInt16 port,
- IntPtr strlst);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_update_service_strlst (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name,
- byte[] type, byte[] domain, IntPtr strlst);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_service_subtype (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, byte[] type,
- byte[] domain, byte[] subtype);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_address (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, IntPtr address);
-
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_record (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, RecordClass clazz,
- RecordType type, uint ttl, byte[] rdata, int size);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_entry_group_free (IntPtr group);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_new (IntPtr txt);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_add (IntPtr list, byte[] txt);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_string_list_free (IntPtr list);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_alternative_service_name (byte[] name);
-
- public event EntryGroupStateHandler StateChanged;
-
- public EntryGroupState State
- {
- get {
- lock (client) {
- return avahi_entry_group_get_state (handle);
- }
- }
- }
-
- public bool IsEmpty
- {
- get {
- lock (client) {
- return avahi_entry_group_is_empty (handle);
- }
- }
- }
-
- public EntryGroup (Client client)
- {
- this.client = client;
- cb = OnEntryGroupCallback;
-
- lock (client) {
- handle = avahi_entry_group_new (client.Handle, cb, IntPtr.Zero);
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- ~EntryGroup ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero) {
- lock (client) {
- avahi_entry_group_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- public void Commit ()
- {
- lock (client) {
- if (avahi_entry_group_commit (handle) < 0)
- client.ThrowError ();
- }
- }
-
- public void Reset ()
- {
- lock (client) {
- if (avahi_entry_group_reset (handle) < 0)
- client.ThrowError ();
- }
- }
-
- public void AddService (string name, string type, string domain,
- UInt16 port, params string[] txt)
- {
- AddService (PublishFlags.None, name, type, domain, port, txt);
- }
-
- public void AddService (PublishFlags flags, string name, string type, string domain,
- UInt16 port, params string[] txt)
- {
- AddService (-1, Protocol.Unspecified, flags, name, type, domain, null, port, txt);
- }
-
- public void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type, string domain,
- string host, UInt16 port, params string[] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (string item in txt) {
- list = avahi_string_list_add (list, Utility.StringToBytes (item));
- }
- }
-
- AddService (iface, proto, flags, name, type, domain, host, port, list);
- }
-
- public void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type, string domain,
- string host, UInt16 port, params byte[][] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (byte[] item in txt) {
- list = avahi_string_list_add (list, item);
- }
- }
-
- AddService (iface, proto, flags, name, type, domain, host, port, list);
- }
-
- private void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, string host, UInt16 port, IntPtr list)
- {
- int ret = avahi_entry_group_add_service_strlst (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain),
- Utility.StringToBytes (host), port, list);
-
- avahi_string_list_free (list);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
-
- public void UpdateService (string name, string type, string domain, params string[] txt)
- {
- UpdateService (-1, Protocol.Unspecified, PublishFlags.None, name, type, domain, txt);
- }
-
- public void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, params string[] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (string item in txt) {
- list = avahi_string_list_add (list, Utility.StringToBytes (item));
- }
- }
-
- UpdateService (iface, proto, flags, name, type, domain, list);
- }
-
- public void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, params byte[][] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (byte[] item in txt) {
- list = avahi_string_list_add (list, item);
- }
- }
-
- UpdateService (iface, proto, flags, name, type, domain, list);
- }
-
- private void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, IntPtr list)
- {
- lock (client) {
- int ret = avahi_entry_group_update_service_strlst (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain),
- list);
-
- avahi_string_list_free (list);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public void AddServiceSubtype (string name, string type, string domain, string subtype)
- {
- AddServiceSubtype (-1, Protocol.Unspecified, PublishFlags.None, name, type, domain, subtype);
- }
-
- public void AddServiceSubtype (int iface, Protocol proto, PublishFlags flags, string name,
- string type, string domain, string subtype)
- {
- lock (client) {
- int ret = avahi_entry_group_add_service_subtype (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain),
- Utility.StringToBytes (subtype));
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public void AddAddress (string name, IPAddress address)
- {
- AddAddress (-1, Protocol.Unspecified, PublishFlags.None, name, address);
- }
-
- public void AddAddress (int iface, Protocol proto, PublishFlags flags, string name, IPAddress address)
- {
- IntPtr addressPtr = Utility.AddressToPtr (address);
-
- lock (client) {
- int ret = avahi_entry_group_add_address (handle, iface, proto, flags,
- Utility.StringToBytes (name), addressPtr);
-
- Utility.Free (addressPtr);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public void AddRecord (string name, RecordClass clazz, RecordType type, uint ttl, byte[] rdata, int length)
- {
- AddRecord (-1, Protocol.Unspecified, PublishFlags.None, name, clazz, type, ttl, rdata, length);
- }
-
- public void AddRecord (int iface, Protocol proto, PublishFlags flags, string name,
- RecordClass clazz, RecordType type, uint ttl, byte[] rdata, int length)
- {
- lock (client) {
- int ret = avahi_entry_group_add_record (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- clazz, type, ttl, rdata, length);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public static string GetAlternativeServiceName (string name) {
- return Utility.PtrToStringFree (avahi_alternative_service_name (Utility.StringToBytes (name)));
- }
-
- private void OnEntryGroupCallback (IntPtr group, EntryGroupState state, IntPtr userdata)
- {
- if (StateChanged != null)
- StateChanged (this, new EntryGroupStateArgs (state));
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/HostNameResolver.cs b/release-0.6.9/avahi-sharp/HostNameResolver.cs
deleted file mode 100644
index 81305fd..0000000
--- a/release-0.6.9/avahi-sharp/HostNameResolver.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Net;
-using System.Runtime.InteropServices;
-using System.Text;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- internal delegate void HostNameResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr hostname, IntPtr address,
- LookupResultFlags flags, IntPtr userdata);
-
- public class HostNameResolver : ResolverBase, IDisposable
- {
- private IntPtr handle;
- private Client client;
- private int iface;
- private Protocol proto;
- private string hostname;
- private Protocol aproto;
- private LookupFlags flags;
- private HostNameResolverCallback cb;
-
- private IPAddress currentAddress;
- private string currentHost;
-
- private ArrayList foundListeners = new ArrayList ();
- private ArrayList timeoutListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_host_name_resolver_new (IntPtr client, int iface, Protocol proto,
- byte[] hostname, Protocol aproto, LookupFlags flags,
- HostNameResolverCallback cb, IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_host_name_resolver_free (IntPtr handle);
-
- public event HostAddressHandler Found
- {
- add {
- foundListeners.Add (value);
- Start ();
- }
- remove {
- foundListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event EventHandler Timeout
- {
- add {
- timeoutListeners.Add (value);
- Start ();
- }
- remove {
- timeoutListeners.Remove (value);
- Stop (false);
- }
- }
-
- public IPAddress Address
- {
- get { return currentAddress; }
- }
-
- public string HostName
- {
- get { return currentHost; }
- }
-
- public HostNameResolver (Client client, string hostname) : this (client, -1, Protocol.Unspecified,
- hostname, Protocol.Unspecified,
- LookupFlags.None)
- {
- }
-
- public HostNameResolver (Client client, int iface, Protocol proto, string hostname,
- Protocol aproto, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.hostname = hostname;
- this.aproto = aproto;
- this.flags = flags;
- cb = OnHostNameResolverCallback;
- }
-
- ~HostNameResolver ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (foundListeners.Count == 0 && timeoutListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_host_name_resolver_new (client.Handle, iface, proto,
- Utility.StringToBytes (hostname), aproto, flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (foundListeners.Count == 0 && timeoutListeners.Count == 0))) {
-
- lock (client) {
- avahi_host_name_resolver_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnHostNameResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr hostname, IntPtr address,
- LookupResultFlags flags, IntPtr userdata)
- {
- switch (revent) {
- case ResolverEvent.Found:
- currentAddress = Utility.PtrToAddress (address);
- currentHost = Utility.PtrToString (hostname);
-
- foreach (HostAddressHandler handler in foundListeners)
- handler (this, new HostAddressArgs (currentHost, currentAddress));
- break;
- case ResolverEvent.Failure:
- EmitFailure (client.LastError);
- break;
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/Makefile.am b/release-0.6.9/avahi-sharp/Makefile.am
deleted file mode 100644
index 4ca3c11..0000000
--- a/release-0.6.9/avahi-sharp/Makefile.am
+++ /dev/null
@@ -1,84 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-ASSEMBLY = avahi-sharp.dll
-
-CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config
-
-AVAHISOURCES = \
- $(srcdir)/AddressResolver.cs \
- $(srcdir)/AssemblyInfo.cs \
- $(srcdir)/BrowserBase.cs \
- $(srcdir)/Client.cs \
- $(srcdir)/ClientException.cs \
- $(srcdir)/DomainBrowser.cs \
- $(srcdir)/EntryGroup.cs \
- $(srcdir)/HostNameResolver.cs \
- $(srcdir)/RecordBrowser.cs \
- $(srcdir)/ResolverBase.cs \
- $(srcdir)/ServiceBrowser.cs \
- $(srcdir)/ServiceResolver.cs \
- $(srcdir)/ServiceTypeBrowser.cs \
- $(srcdir)/Utility.cs
-
-EXTRA_DIST = \
- $(AVAHISOURCES) \
- $(srcdir)/AvahiTest.cs \
- $(srcdir)/avahi.snk \
- $(srcdir)/$(ASSEMBLY).config.in \
- $(srcdir)/avahi-sharp-docs.source \
- $(srcdir)/en/*.xml \
- $(srcdir)/en/*/*.xml \
- $(srcdir)/gencfg.sh
-
-$(ASSEMBLY): $(AVAHISOURCES)
- mcs -keyfile:$(srcdir)/avahi.snk -target:library -out:$@ -debug $(AVAHISOURCES) -r:Mono.Posix
-
-
-$(ASSEMBLY).config: $(ASSEMBLY).config.in
- $(srcdir)/gencfg.sh $(top_builddir)/avahi-client/libavahi-client.la \
- $(top_builddir)/avahi-common/libavahi-common.la \
- $(top_builddir)/avahi-glib/libavahi-glib.la < $< > $@
-
-if HAVE_MONO
-if HAVE_DBUS
-all: $(ASSEMBLY) $(ASSEMBLY).config
-
-if HAVE_MONODOC
-update-docs: $(ASSEMBLY)
- $(MONODOCER) -assembly:$(ASSEMBLY) -path:en
-
-avahi-sharp-docs.zip: avahi-sharp-docs.tree
-
-avahi-sharp-docs.tree: $(srcdir)/en/*/*
- $(MDASSEMBLER) --out avahi-sharp-docs --ecma $(srcdir)/en
-
-docdir = $(MONODOC_DIR)
-doc_DATA = avahi-sharp-docs.zip avahi-sharp-docs.tree avahi-sharp-docs.source
-
-endif
-
-install-data-hook: $(ASSEMBLY)
- $(GACUTIL) /i $(ASSEMBLY) /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
-
-uninstall-hook: $(ASSEMBLY)
- $(GACUTIL) /u avahi-sharp /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
-
-endif
-endif
diff --git a/release-0.6.9/avahi-sharp/RecordBrowser.cs b/release-0.6.9/avahi-sharp/RecordBrowser.cs
deleted file mode 100644
index f65f8ac..0000000
--- a/release-0.6.9/avahi-sharp/RecordBrowser.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-/* $Id: ServiceBrowser.cs 635 2005-09-26 03:57:30Z snorp $ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
-
- public delegate void RecordInfoHandler (object o, RecordInfoArgs args);
-
- internal delegate void RecordBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, ushort clazz, ushort type, IntPtr rdata, int size,
- LookupResultFlags flags, IntPtr userdata);
-
- public enum RecordClass {
- In = 1
- }
-
- public enum RecordType {
- A = 1,
- Ns = 2,
- Cname = 5,
- Soa = 6,
- Ptr = 12,
- Hinfo = 13,
- Mx = 15,
- Txt = 16,
- Aaa = 28,
- Srv = 33
- }
-
- public struct RecordInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Name;
- public RecordClass Class;
- public RecordType Type;
- public byte[] Data;
- public LookupResultFlags Flags;
- }
-
- public class RecordInfoArgs : EventArgs
- {
- private RecordInfo record;
-
- public RecordInfo Record {
- get { return record; }
- }
-
- public RecordInfoArgs (RecordInfo record)
- {
- this.record = record;
- }
- }
-
- public class RecordBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string name;
- private RecordClass clazz;
- private RecordType type;
- private LookupFlags flags;
- private RecordBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_record_browser_new (IntPtr client, int iface, Protocol proto,
- byte[] name, ushort clazz, ushort type,
- LookupFlags flags, RecordBrowserCallback cb,
- IntPtr userdata);
-
-
- [DllImport ("avahi-client")]
- private static extern void avahi_record_browser_free (IntPtr handle);
-
- public event RecordInfoHandler RecordAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event RecordInfoHandler RecordRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public RecordInfo[] Records
- {
- get { return (RecordInfo[]) infos.ToArray (typeof (RecordInfo)); }
- }
-
- public RecordBrowser (Client client, string name, RecordType type) :
- this (client, -1, Protocol.Unspecified, name, RecordClass.In, type, LookupFlags.None)
- {
- }
-
- public RecordBrowser (Client client, int iface, Protocol proto, string name, RecordClass clazz,
- RecordType type, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.name = name;
- this.clazz = clazz;
- this.type = type;
- this.flags = flags;
- cb = OnRecordBrowserCallback;
- }
-
- ~RecordBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_record_browser_new (client.Handle, iface, proto, Utility.StringToBytes (name),
- (ushort) clazz, (ushort) type, flags, cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
-
- lock (client) {
- avahi_record_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnRecordBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, ushort clazz, ushort type, IntPtr rdata, int size,
- LookupResultFlags flags, IntPtr userdata)
- {
- RecordInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Name = Utility.PtrToString (name);
- info.Class = (RecordClass) clazz;
- info.Type = (RecordType) type;
- info.Flags = flags;
- info.Data = new byte[size];
-
- if (rdata != IntPtr.Zero) {
- Marshal.Copy (rdata, info.Data, 0, size);
- }
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (RecordInfoHandler handler in addListeners)
- handler (this, new RecordInfoArgs (info));
-
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (RecordInfoHandler handler in removeListeners)
- handler (this, new RecordInfoArgs (info));
-
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/ResolverBase.cs b/release-0.6.9/avahi-sharp/ResolverBase.cs
deleted file mode 100644
index 0a5a2a8..0000000
--- a/release-0.6.9/avahi-sharp/ResolverBase.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-
-namespace Avahi
-{
- public abstract class ResolverBase
- {
- public event ErrorCodeHandler Failed;
-
- internal void EmitFailure (ErrorCode code)
- {
- if (Failed != null)
- Failed (this, new ErrorCodeArgs (code));
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/ServiceBrowser.cs b/release-0.6.9/avahi-sharp/ServiceBrowser.cs
deleted file mode 100644
index 520e339..0000000
--- a/release-0.6.9/avahi-sharp/ServiceBrowser.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
- internal delegate void ServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata);
-
- public struct ServiceInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Domain;
- public string ServiceType;
- public string Name;
-
- public string HostName;
- public IPAddress Address;
- public UInt16 Port;
- public byte[][] Text;
- public LookupResultFlags Flags;
-
- public static ServiceInfo Zero = new ServiceInfo ();
- }
-
- public class ServiceInfoArgs : EventArgs
- {
- private ServiceInfo service;
-
- public ServiceInfo Service {
- get { return service; }
- }
-
- public ServiceInfoArgs (ServiceInfo service)
- {
- this.service = service;
- }
- }
-
- public delegate void ServiceInfoHandler (object o, ServiceInfoArgs args);
-
- public class ServiceBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string domain;
- private string type;
- private LookupFlags flags;
- private ServiceBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_service_browser_new (IntPtr client, int iface, int proto, byte[] type,
- byte[] domain, LookupFlags flags,
- ServiceBrowserCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_service_browser_free (IntPtr handle);
-
- public event ServiceInfoHandler ServiceAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event ServiceInfoHandler ServiceRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public ServiceInfo[] Services
- {
- get { return (ServiceInfo[]) infos.ToArray (typeof (ServiceInfo)); }
- }
-
- public ServiceBrowser (Client client, string type) : this (client, type, client.DomainName)
- {
- }
-
- public ServiceBrowser (Client client, string type, string domain) : this (client, -1, Protocol.Unspecified,
- type, domain, LookupFlags.None)
- {
- }
-
- public ServiceBrowser (Client client, int iface, Protocol proto, string type, string domain, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.domain = domain;
- this.type = type;
- this.flags = flags;
- cb = OnServiceBrowserCallback;
- }
-
- ~ServiceBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_service_browser_new (client.Handle, iface, (int) proto,
- Utility.StringToBytes (type), Utility.StringToBytes (domain),
- flags, cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
-
- lock (client) {
- avahi_service_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata)
- {
-
- ServiceInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.ServiceType = Utility.PtrToString (type);
- info.Name = Utility.PtrToString (name);
- info.HostName = null;
- info.Address = null;
- info.Port = 0;
- info.Text = null;
- info.Flags = flags;
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (ServiceInfoHandler handler in addListeners)
- handler (this, new ServiceInfoArgs (info));
-
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (ServiceInfoHandler handler in removeListeners)
- handler (this, new ServiceInfoArgs (info));
-
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/ServiceResolver.cs b/release-0.6.9/avahi-sharp/ServiceResolver.cs
deleted file mode 100644
index 945372b..0000000
--- a/release-0.6.9/avahi-sharp/ServiceResolver.cs
+++ /dev/null
@@ -1,224 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Net;
-using System.Runtime.InteropServices;
-using System.Text;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- internal delegate void ServiceResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr name, IntPtr type,
- IntPtr domain, IntPtr host, IntPtr address,
- UInt16 port, IntPtr txt, LookupResultFlags flags,
- IntPtr userdata);
-
- public class ServiceResolver : ResolverBase, IDisposable
- {
- private IntPtr handle;
- private ServiceInfo currentInfo;
- private Client client;
- private int iface;
- private Protocol proto;
- private string name;
- private string type;
- private string domain;
- private Protocol aproto;
- private LookupFlags flags;
- private ServiceResolverCallback cb;
-
- private ArrayList foundListeners = new ArrayList ();
- private ArrayList timeoutListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_service_resolver_new (IntPtr client, int iface, Protocol proto,
- byte[] name, byte[] type, byte[] domain,
- Protocol aproto, LookupFlags flags,
- ServiceResolverCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_get_next (IntPtr list);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_get_text (IntPtr list);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_string_list_get_size (IntPtr list);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_service_resolver_free (IntPtr handle);
-
- public event ServiceInfoHandler Found
- {
- add {
- foundListeners.Add (value);
- Start ();
- }
- remove {
- foundListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event EventHandler Timeout
- {
- add {
- timeoutListeners.Add (value);
- Start ();
- }
- remove {
- timeoutListeners.Remove (value);
- Stop (false);
- }
- }
-
- public ServiceInfo Service
- {
- get { return currentInfo; }
- }
-
- public ServiceResolver (Client client, string name, string type, string domain) : this (client, -1,
- Protocol.Unspecified,
- name, type, domain,
- Protocol.Unspecified,
- LookupFlags.None)
- {
- }
-
- public ServiceResolver (Client client, ServiceInfo service) : this (client, service.NetworkInterface,
- service.Protocol, service.Name,
- service.ServiceType, service.Domain,
- Protocol.Unspecified,
- GetLookupFlags (service.Flags))
- {
- }
-
- public ServiceResolver (Client client, int iface, Protocol proto, string name,
- string type, string domain, Protocol aproto, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.name = name;
- this.type = type;
- this.domain = domain;
- this.aproto = aproto;
- this.flags = flags;
- cb = OnServiceResolverCallback;
- }
-
- ~ServiceResolver ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (foundListeners.Count == 0 && timeoutListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_service_resolver_new (client.Handle, iface, proto,
- Utility.StringToBytes (name), Utility.StringToBytes (type),
- Utility.StringToBytes (domain), aproto, flags, cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (foundListeners.Count == 0 && timeoutListeners.Count == 0))) {
-
- lock (client) {
- avahi_service_resolver_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnServiceResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr name, IntPtr type,
- IntPtr domain, IntPtr host, IntPtr address,
- UInt16 port, IntPtr txt, LookupResultFlags flags,
- IntPtr userdata)
- {
- ServiceInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.ServiceType = Utility.PtrToString (type);
- info.Name = Utility.PtrToString (name);
- info.HostName = Utility.PtrToString (host);
- info.Address = Utility.PtrToAddress (address);
- info.Port = port;
-
- ArrayList txtlist = new ArrayList ();
- for (IntPtr l = txt; l != IntPtr.Zero; l = avahi_string_list_get_next (l)) {
- IntPtr buf = avahi_string_list_get_text (l);
- int len = avahi_string_list_get_size (l);
-
- byte[] txtbuf = new byte[len];
- Marshal.Copy (buf, txtbuf, 0, len);
- txtlist.Add (txtbuf);
- }
-
- info.Text = (byte[][]) txtlist.ToArray (typeof (byte[]));
- info.Flags = flags;
-
- switch (revent) {
- case ResolverEvent.Found:
- currentInfo = info;
-
- foreach (ServiceInfoHandler handler in foundListeners)
- handler (this, new ServiceInfoArgs (info));
- break;
- case ResolverEvent.Failure:
- EmitFailure (client.LastError);
- break;
- }
- }
-
- private static LookupFlags GetLookupFlags (LookupResultFlags rflags) {
- LookupFlags ret = LookupFlags.None;
-
- if ((rflags & LookupResultFlags.Multicast) > 0)
- ret |= LookupFlags.UseMulticast;
- if ((rflags & LookupResultFlags.WideArea) > 0)
- ret |= LookupFlags.UseWideArea;
-
- return ret;
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/ServiceTypeBrowser.cs b/release-0.6.9/avahi-sharp/ServiceTypeBrowser.cs
deleted file mode 100644
index 3796d60..0000000
--- a/release-0.6.9/avahi-sharp/ServiceTypeBrowser.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
- internal delegate void ServiceTypeBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata);
-
- public struct ServiceTypeInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Domain;
- public string ServiceType;
- public LookupResultFlags Flags;
- }
-
- public class ServiceTypeInfoArgs : EventArgs
- {
- private ServiceTypeInfo type;
-
- public ServiceTypeInfo ServiceType
- {
- get { return type; }
- }
-
- public ServiceTypeInfoArgs (ServiceTypeInfo type)
- {
- this.type = type;
- }
- }
-
- public delegate void ServiceTypeInfoHandler (object o, ServiceTypeInfoArgs args);
-
- public class ServiceTypeBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string domain;
- private LookupFlags flags;
- private ServiceTypeBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_service_type_browser_new (IntPtr client, int iface, int proto,
- byte[] domain, LookupFlags flags,
- ServiceTypeBrowserCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_service_type_browser_free (IntPtr handle);
-
- public event ServiceTypeInfoHandler ServiceTypeAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event ServiceTypeInfoHandler ServiceTypeRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public ServiceTypeInfo[] ServiceTypes
- {
- get { return (ServiceTypeInfo[]) infos.ToArray (typeof (ServiceTypeInfo)); }
- }
-
- public ServiceTypeBrowser (Client client) : this (client, client.DomainName)
- {
- }
-
- public ServiceTypeBrowser (Client client, string domain) : this (client, -1, Protocol.Unspecified,
- domain, LookupFlags.None)
- {
- }
-
- public ServiceTypeBrowser (Client client, int iface, Protocol proto, string domain, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.domain = domain;
- this.flags = flags;
- cb = OnServiceTypeBrowserCallback;
- }
-
- ~ServiceTypeBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_service_type_browser_new (client.Handle, iface, (int) proto,
- Utility.StringToBytes (domain), flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
-
- lock (client) {
- avahi_service_type_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnServiceTypeBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata)
- {
-
- ServiceTypeInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.ServiceType = Utility.PtrToString (type);
- info.Flags = flags;
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (ServiceTypeInfoHandler handler in addListeners)
- handler (this, new ServiceTypeInfoArgs (info));
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (ServiceTypeInfoHandler handler in removeListeners)
- handler (this, new ServiceTypeInfoArgs (info));
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/Utility.cs b/release-0.6.9/avahi-sharp/Utility.cs
deleted file mode 100644
index 9081b01..0000000
--- a/release-0.6.9/avahi-sharp/Utility.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Text;
-using System.Runtime.InteropServices;
-using Mono.Unix;
-using Mono.Unix.Native;
-
-using Stdlib = Mono.Unix.Native.Stdlib;
-
-namespace Avahi
-{
- internal class Utility
- {
- [DllImport ("libc")]
- private static extern int strlen (IntPtr ptr);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_address_snprint (IntPtr buf, int size, IntPtr address);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_address_parse (IntPtr str, Protocol proto, IntPtr ret);
-
- public static string PtrToString (IntPtr ptr)
- {
- if (ptr == IntPtr.Zero)
- return null;
-
- int len = strlen (ptr);
- byte[] bytes = new byte[len];
- Marshal.Copy (ptr, bytes, 0, len);
- return Encoding.UTF8.GetString (bytes);
- }
-
- public static string PtrToStringFree (IntPtr ptr)
- {
- if (ptr == IntPtr.Zero)
- return null;
-
- string ret = PtrToString (ptr);
- Free (ptr);
- return ret;
- }
-
- public static byte[] StringToBytes (string str)
- {
- if (str == null)
- return null;
-
- return Encoding.UTF8.GetBytes (str + "\0"); // lame.
- }
-
- private static IntPtr StringToPtr (string str)
- {
- if (str == null)
- return IntPtr.Zero;
-
- byte[] bytes = Utility.StringToBytes (str);
- IntPtr buf = Stdlib.malloc ((uint) bytes.Length + 1);
- Marshal.Copy (bytes, 0, buf, bytes.Length);
- Marshal.WriteByte (buf, bytes.Length, 0);
- return buf;
- }
-
- public static void Free (IntPtr ptr)
- {
- Stdlib.free (ptr);
- }
-
- public static IntPtr AddressToPtr (IPAddress address)
- {
- IntPtr straddr = Utility.StringToPtr (address.ToString ());
- IntPtr addrPtr = Stdlib.malloc (32);
- avahi_address_parse (straddr, Protocol.Unspecified, addrPtr);
- Utility.Free (straddr);
-
- return addrPtr;
- }
-
- public static IPAddress PtrToAddress (IntPtr ptr)
- {
- IPAddress address = null;
-
- if (ptr != IntPtr.Zero) {
- IntPtr buf = Stdlib.malloc (256);
- IntPtr addrPtr = avahi_address_snprint (buf, 256, ptr);
- address = IPAddress.Parse (Utility.PtrToString (addrPtr));
- Utility.Free (addrPtr);
- }
-
- return address;
- }
- }
-}
diff --git a/release-0.6.9/avahi-sharp/avahi-sharp-docs.source b/release-0.6.9/avahi-sharp/avahi-sharp-docs.source
deleted file mode 100644
index f3b3c75..0000000
--- a/release-0.6.9/avahi-sharp/avahi-sharp-docs.source
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<monodoc>
- <source provider="ecma" basefile="avahi-sharp-docs" path="various" title="Avahi" />
-</monodoc>
diff --git a/release-0.6.9/avahi-sharp/avahi-sharp.dll.config.in b/release-0.6.9/avahi-sharp/avahi-sharp.dll.config.in
deleted file mode 100644
index 5bae58f..0000000
--- a/release-0.6.9/avahi-sharp/avahi-sharp.dll.config.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<configuration>
- <dllmap dll="avahi-client" target="@CLIENT_DLNAME@"/>
- <dllmap dll="avahi-common" target="@COMMON_DLNAME@"/>
- <dllmap dll="avahi-glib" target="@GLIB_DLNAME@"/>
-</configuration>
diff --git a/release-0.6.9/avahi-sharp/avahi.snk b/release-0.6.9/avahi-sharp/avahi.snk
deleted file mode 100644
index 58c23bc..0000000
--- a/release-0.6.9/avahi-sharp/avahi.snk
+++ /dev/null
Binary files differ
diff --git a/release-0.6.9/avahi-sharp/en/Avahi.xml b/release-0.6.9/avahi-sharp/en/Avahi.xml
deleted file mode 100644
index 0739013..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<Namespace Name="Avahi">
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Namespace>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/AddressResolver.xml b/release-0.6.9/avahi-sharp/en/Avahi/AddressResolver.xml
deleted file mode 100644
index 064e505..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/AddressResolver.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<Type Name="AddressResolver" FullName="Avahi.AddressResolver">
- <TypeSignature Language="C#" Value="public class AddressResolver : Avahi.ResolverBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.ResolverBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public AddressResolver (Avahi.Client client, System.Net.IPAddress address);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Found">
- <MemberSignature Language="C#" Value="public event Avahi.HostAddressHandler Found;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.HostAddressHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="public event EventHandler Timeout;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public AddressResolver (Avahi.Client client, int iface, Avahi.Protocol proto, System.Net.IPAddress address, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="address">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/BrowserBase.xml b/release-0.6.9/avahi-sharp/en/Avahi/BrowserBase.xml
deleted file mode 100644
index fa6d2ad..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/BrowserBase.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<Type Name="BrowserBase" FullName="Avahi.BrowserBase">
- <TypeSignature Language="C#" Value="public abstract class BrowserBase" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected BrowserBase ();" />
- <MemberType>Constructor</MemberType>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="CacheExhausted">
- <MemberSignature Language="C#" Value="public event EventHandler CacheExhausted;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AllForNow">
- <MemberSignature Language="C#" Value="public event EventHandler AllForNow;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Failed">
- <MemberSignature Language="C#" Value="public event EventHandler Failed;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/Client.xml b/release-0.6.9/avahi-sharp/en/Avahi/Client.xml
deleted file mode 100644
index 0abecf7..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/Client.xml
+++ /dev/null
@@ -1,178 +0,0 @@
-<Type Name="Client" FullName="Avahi.Client">
- <TypeSignature Language="C#" Value="public class Client : System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public Client ();" />
- <MemberType>Constructor</MemberType>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="StateChanged">
- <MemberSignature Language="C#" Value="public event Avahi.ClientStateHandler StateChanged;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientStateHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Version">
- <MemberSignature Language="C#" Value="public string Version { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DomainName">
- <MemberSignature Language="C#" Value="public string DomainName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostNameFqdn">
- <MemberSignature Language="C#" Value="public string HostNameFqdn { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.ClientState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="LocalServiceCookie">
- <MemberSignature Language="C#" Value="public uint LocalServiceCookie { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.UInt32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public Client (Avahi.ClientFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="flags" Type="Avahi.ClientFlags" />
- </Parameters>
- <Docs>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="JoinServiceName">
- <MemberSignature Language="C#" Value="public static string JoinServiceName (string name, string type, string domain);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="SplitServiceName">
- <MemberSignature Language="C#" Value="public static void SplitServiceName (string service, out string name, out string type, out string domain);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="service" Type="System.String" />
- <Parameter Name="name" Type="System.String&amp;" RefType="out" />
- <Parameter Name="type" Type="System.String&amp;" RefType="out" />
- <Parameter Name="domain" Type="System.String&amp;" RefType="out" />
- </Parameters>
- <Docs>
- <param name="service">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ClientException.xml b/release-0.6.9/avahi-sharp/en/Avahi/ClientException.xml
deleted file mode 100644
index 3b8319b..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ClientException.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<Type Name="ClientException" FullName="Avahi.ClientException">
- <TypeSignature Language="C#" Value="public class ClientException : System.ApplicationException" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ApplicationException</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="ErrorCode">
- <MemberSignature Language="C#" Value="public Avahi.ErrorCode ErrorCode { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ClientFlags.xml b/release-0.6.9/avahi-sharp/en/Avahi/ClientFlags.xml
deleted file mode 100644
index d4ea291..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ClientFlags.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<Type Name="ClientFlags" FullName="Avahi.ClientFlags">
- <TypeSignature Language="C#" Value="public enum ClientFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="NoFail">
- <MemberSignature Language="C#" Value="NoFail" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="IgnoreUserConfig">
- <MemberSignature Language="C#" Value="IgnoreUserConfig" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ClientState.xml b/release-0.6.9/avahi-sharp/en/Avahi/ClientState.xml
deleted file mode 100644
index c20a02b..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ClientState.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<Type Name="ClientState" FullName="Avahi.ClientState">
- <TypeSignature Language="C#" Value="public enum ClientState" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="Collision">
- <MemberSignature Language="C#" Value="Collision" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Registering">
- <MemberSignature Language="C#" Value="Registering" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Running">
- <MemberSignature Language="C#" Value="Running" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Connecting">
- <MemberSignature Language="C#" Value="Connecting" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Failure">
- <MemberSignature Language="C#" Value="Failure" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ClientStateArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/ClientStateArgs.xml
deleted file mode 100644
index e5da11d..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ClientStateArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ClientStateArgs" FullName="Avahi.ClientStateArgs">
- <TypeSignature Language="C#" Value="public class ClientStateArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ClientStateArgs (Avahi.ClientState state);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="state" Type="Avahi.ClientState" />
- </Parameters>
- <Docs>
- <param name="state">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.ClientState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ClientStateHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/ClientStateHandler.xml
deleted file mode 100644
index 0576975..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ClientStateHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ClientStateHandler" FullName="Avahi.ClientStateHandler">
- <TypeSignature Language="C#" Value="public delegate void ClientStateHandler(object o, Avahi.ClientStateArgs state);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="state" Type="Avahi.ClientStateArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="state">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/DomainBrowser.xml b/release-0.6.9/avahi-sharp/en/Avahi/DomainBrowser.xml
deleted file mode 100644
index 20536e0..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/DomainBrowser.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<Type Name="DomainBrowser" FullName="Avahi.DomainBrowser">
- <TypeSignature Language="C#" Value="public class DomainBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public DomainBrowser (Avahi.Client client);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DomainAdded">
- <MemberSignature Language="C#" Value="public event Avahi.DomainInfoHandler DomainAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DomainRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.DomainInfoHandler DomainRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domains">
- <MemberSignature Language="C#" Value="public Avahi.DomainInfo[] Domains { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public DomainBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string domain, Avahi.DomainBrowserType btype, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="btype" Type="Avahi.DomainBrowserType" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="btype">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/DomainBrowserType.xml b/release-0.6.9/avahi-sharp/en/Avahi/DomainBrowserType.xml
deleted file mode 100644
index 9743524..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/DomainBrowserType.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<Type Name="DomainBrowserType" FullName="Avahi.DomainBrowserType">
- <TypeSignature Language="C#" Value="public enum DomainBrowserType" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="RegisterDefault">
- <MemberSignature Language="C#" Value="RegisterDefault" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="BrowseDefault">
- <MemberSignature Language="C#" Value="BrowseDefault" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Register">
- <MemberSignature Language="C#" Value="Register" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="BrowseLegacy">
- <MemberSignature Language="C#" Value="BrowseLegacy" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Browse">
- <MemberSignature Language="C#" Value="Browse" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/DomainInfo.xml b/release-0.6.9/avahi-sharp/en/Avahi/DomainInfo.xml
deleted file mode 100644
index dddfd60..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/DomainInfo.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<Type Name="DomainInfo" FullName="Avahi.DomainInfo">
- <TypeSignature Language="C#" Value="public struct DomainInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public string Domain;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/DomainInfoArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/DomainInfoArgs.xml
deleted file mode 100644
index 1967447..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/DomainInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="DomainInfoArgs" FullName="Avahi.DomainInfoArgs">
- <TypeSignature Language="C#" Value="public class DomainInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public DomainInfoArgs (Avahi.DomainInfo domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="domain" Type="Avahi.DomainInfo" />
- </Parameters>
- <Docs>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public Avahi.DomainInfo Domain { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/DomainInfoHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/DomainInfoHandler.xml
deleted file mode 100644
index 793e2b7..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/DomainInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="DomainInfoHandler" FullName="Avahi.DomainInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void DomainInfoHandler(object o, Avahi.DomainInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.DomainInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroup.xml b/release-0.6.9/avahi-sharp/en/Avahi/EntryGroup.xml
deleted file mode 100644
index 93fec22..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroup.xml
+++ /dev/null
@@ -1,491 +0,0 @@
-<Type Name="EntryGroup" FullName="Avahi.EntryGroup">
- <TypeSignature Language="C#" Value="public class EntryGroup : System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public EntryGroup (Avahi.Client client);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="StateChanged">
- <MemberSignature Language="C#" Value="public event Avahi.EntryGroupStateHandler StateChanged;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupStateHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Commit">
- <MemberSignature Language="C#" Value="public void Commit ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Reset">
- <MemberSignature Language="C#" Value="public void Reset ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (string name, string type, string domain, ushort port, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.EntryGroupState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsEmpty">
- <MemberSignature Language="C#" Value="public bool IsEmpty { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetAlternativeServiceName">
- <MemberSignature Language="C#" Value="public static string GetAlternativeServiceName (string name);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (Avahi.PublishFlags flags, string name, string type, string domain, ushort port, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string host, ushort port, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="host" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="host">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="UpdateService">
- <MemberSignature Language="C#" Value="public void UpdateService (string name, string type, string domain, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="UpdateService">
- <MemberSignature Language="C#" Value="public void UpdateService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddServiceSubtype">
- <MemberSignature Language="C#" Value="public void AddServiceSubtype (string name, string type, string domain, string subtype);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="subtype" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="subtype">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddServiceSubtype">
- <MemberSignature Language="C#" Value="public void AddServiceSubtype (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string subtype);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="subtype" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="subtype">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddAddress">
- <MemberSignature Language="C#" Value="public void AddAddress (string name, System.Net.IPAddress address);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddAddress">
- <MemberSignature Language="C#" Value="public void AddAddress (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, System.Net.IPAddress address);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddRecord">
- <MemberSignature Language="C#" Value="public void AddRecord (string name, Avahi.RecordClass clazz, Avahi.RecordType type, uint ttl, byte[] rdata, int length);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="clazz" Type="Avahi.RecordClass" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- <Parameter Name="ttl" Type="System.UInt32" />
- <Parameter Name="rdata" Type="System.Byte[]" />
- <Parameter Name="length" Type="System.Int32" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="clazz">To be added.</param>
- <param name="type">To be added.</param>
- <param name="ttl">To be added.</param>
- <param name="rdata">To be added.</param>
- <param name="length">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddRecord">
- <MemberSignature Language="C#" Value="public void AddRecord (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, Avahi.RecordClass clazz, Avahi.RecordType type, uint ttl, byte[] rdata, int length);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="clazz" Type="Avahi.RecordClass" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- <Parameter Name="ttl" Type="System.UInt32" />
- <Parameter Name="rdata" Type="System.Byte[]" />
- <Parameter Name="length" Type="System.Int32" />
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="clazz">To be added.</param>
- <param name="type">To be added.</param>
- <param name="ttl">To be added.</param>
- <param name="rdata">To be added.</param>
- <param name="length">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string host, ushort port, byte[][] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="host" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.Byte[][]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="host">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="UpdateService">
- <MemberSignature Language="C#" Value="public void UpdateService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, byte[][] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="txt" Type="System.Byte[][]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupState.xml b/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupState.xml
deleted file mode 100644
index c01e1df..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupState.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<Type Name="EntryGroupState" FullName="Avahi.EntryGroupState">
- <TypeSignature Language="C#" Value="public enum EntryGroupState" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="Collision">
- <MemberSignature Language="C#" Value="Collision" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Registering">
- <MemberSignature Language="C#" Value="Registering" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Uncommited">
- <MemberSignature Language="C#" Value="Uncommited" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Established">
- <MemberSignature Language="C#" Value="Established" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Failure">
- <MemberSignature Language="C#" Value="Failure" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml
deleted file mode 100644
index c7d6f8c..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="EntryGroupStateArgs" FullName="Avahi.EntryGroupStateArgs">
- <TypeSignature Language="C#" Value="public class EntryGroupStateArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public EntryGroupStateArgs (Avahi.EntryGroupState state);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="state" Type="Avahi.EntryGroupState" />
- </Parameters>
- <Docs>
- <param name="state">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.EntryGroupState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml
deleted file mode 100644
index 427c519..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="EntryGroupStateHandler" FullName="Avahi.EntryGroupStateHandler">
- <TypeSignature Language="C#" Value="public delegate void EntryGroupStateHandler(object o, Avahi.EntryGroupStateArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.EntryGroupStateArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ErrorCode.xml b/release-0.6.9/avahi-sharp/en/Avahi/ErrorCode.xml
deleted file mode 100644
index 687f524..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ErrorCode.xml
+++ /dev/null
@@ -1,526 +0,0 @@
-<Type Name="ErrorCode" FullName="Avahi.ErrorCode">
- <TypeSignature Language="C#" Value="public enum ErrorCode" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="TooManyEntries">
- <MemberSignature Language="C#" Value="TooManyEntries" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="AccessDenied">
- <MemberSignature Language="C#" Value="AccessDenied" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NotFound">
- <MemberSignature Language="C#" Value="NotFound" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="TooManyClients">
- <MemberSignature Language="C#" Value="TooManyClients" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsYxRrSet">
- <MemberSignature Language="C#" Value="DnsYxRrSet" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidFlags">
- <MemberSignature Language="C#" Value="InvalidFlags" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="BadState">
- <MemberSignature Language="C#" Value="BadState" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNxDomain">
- <MemberSignature Language="C#" Value="DnsNxDomain" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="TooManyObjects">
- <MemberSignature Language="C#" Value="TooManyObjects" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidObject">
- <MemberSignature Language="C#" Value="InvalidObject" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsServFail">
- <MemberSignature Language="C#" Value="DnsServFail" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Disconnected">
- <MemberSignature Language="C#" Value="Disconnected" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidPort">
- <MemberSignature Language="C#" Value="InvalidPort" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Collision">
- <MemberSignature Language="C#" Value="Collision" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidTTL">
- <MemberSignature Language="C#" Value="InvalidTTL" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoNetwork">
- <MemberSignature Language="C#" Value="NoNetwork" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidOperation">
- <MemberSignature Language="C#" Value="InvalidOperation" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NotPermitted">
- <MemberSignature Language="C#" Value="NotPermitted" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDnsType">
- <MemberSignature Language="C#" Value="InvalidDnsType" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDnsError">
- <MemberSignature Language="C#" Value="InvalidDnsError" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNotAuth">
- <MemberSignature Language="C#" Value="DnsNotAuth" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidProtocol">
- <MemberSignature Language="C#" Value="InvalidProtocol" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidConfig">
- <MemberSignature Language="C#" Value="InvalidConfig" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNotZone">
- <MemberSignature Language="C#" Value="DnsNotZone" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Ok">
- <MemberSignature Language="C#" Value="Ok" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidServiceSubtype">
- <MemberSignature Language="C#" Value="InvalidServiceSubtype" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNxRrSet">
- <MemberSignature Language="C#" Value="DnsNxRrSet" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidServiceType">
- <MemberSignature Language="C#" Value="InvalidServiceType" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsFormErr">
- <MemberSignature Language="C#" Value="DnsFormErr" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="IsPattern">
- <MemberSignature Language="C#" Value="IsPattern" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidPacket">
- <MemberSignature Language="C#" Value="InvalidPacket" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidRecord">
- <MemberSignature Language="C#" Value="InvalidRecord" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidKey">
- <MemberSignature Language="C#" Value="InvalidKey" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidRData">
- <MemberSignature Language="C#" Value="InvalidRData" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="VersionMismatch">
- <MemberSignature Language="C#" Value="VersionMismatch" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsRefused">
- <MemberSignature Language="C#" Value="DnsRefused" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidServiceName">
- <MemberSignature Language="C#" Value="InvalidServiceName" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidHostName">
- <MemberSignature Language="C#" Value="InvalidHostName" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidAddress">
- <MemberSignature Language="C#" Value="InvalidAddress" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoDaemon">
- <MemberSignature Language="C#" Value="NoDaemon" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidInterface">
- <MemberSignature Language="C#" Value="InvalidInterface" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Failure">
- <MemberSignature Language="C#" Value="Failure" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsYxDomain">
- <MemberSignature Language="C#" Value="DnsYxDomain" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NotSupported">
- <MemberSignature Language="C#" Value="NotSupported" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoMemory">
- <MemberSignature Language="C#" Value="NoMemory" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="Timeout" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDnsClass">
- <MemberSignature Language="C#" Value="InvalidDnsClass" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DBusError">
- <MemberSignature Language="C#" Value="DBusError" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNoTimp">
- <MemberSignature Language="C#" Value="DnsNoTimp" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="OS">
- <MemberSignature Language="C#" Value="OS" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDomainName">
- <MemberSignature Language="C#" Value="InvalidDomainName" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeArgs.xml
deleted file mode 100644
index c8a7ccc..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ErrorCodeArgs" FullName="Avahi.ErrorCodeArgs">
- <TypeSignature Language="C#" Value="public class ErrorCodeArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ErrorCodeArgs (Avahi.ErrorCode code);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="code" Type="Avahi.ErrorCode" />
- </Parameters>
- <Docs>
- <param name="code">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ErrorCode">
- <MemberSignature Language="C#" Value="public Avahi.ErrorCode ErrorCode { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeHandler.xml
deleted file mode 100644
index 04e22d3..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ErrorCodeHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ErrorCodeHandler" FullName="Avahi.ErrorCodeHandler">
- <TypeSignature Language="C#" Value="public delegate void ErrorCodeHandler(object o, Avahi.ErrorCodeArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.ErrorCodeArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/HostAddressArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/HostAddressArgs.xml
deleted file mode 100644
index 2b126e3..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/HostAddressArgs.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<Type Name="HostAddressArgs" FullName="Avahi.HostAddressArgs">
- <TypeSignature Language="C#" Value="public class HostAddressArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public HostAddressArgs (string host, System.Net.IPAddress address);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="host" Type="System.String" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="host">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Host">
- <MemberSignature Language="C#" Value="public string Host { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/HostAddressHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/HostAddressHandler.xml
deleted file mode 100644
index f0c195e..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/HostAddressHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="HostAddressHandler" FullName="Avahi.HostAddressHandler">
- <TypeSignature Language="C#" Value="public delegate void HostAddressHandler(object o, Avahi.HostAddressArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.HostAddressArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/HostNameResolver.xml b/release-0.6.9/avahi-sharp/en/Avahi/HostNameResolver.xml
deleted file mode 100644
index 37124fd..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/HostNameResolver.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<Type Name="HostNameResolver" FullName="Avahi.HostNameResolver">
- <TypeSignature Language="C#" Value="public class HostNameResolver : Avahi.ResolverBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.ResolverBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public HostNameResolver (Avahi.Client client, string hostname);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="hostname" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="hostname">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Found">
- <MemberSignature Language="C#" Value="public event Avahi.HostAddressHandler Found;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.HostAddressHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="public event EventHandler Timeout;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public HostNameResolver (Avahi.Client client, int iface, Avahi.Protocol proto, string hostname, Avahi.Protocol aproto, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="hostname" Type="System.String" />
- <Parameter Name="aproto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="hostname">To be added.</param>
- <param name="aproto">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/LookupFlags.xml b/release-0.6.9/avahi-sharp/en/Avahi/LookupFlags.xml
deleted file mode 100644
index d7882e0..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/LookupFlags.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<Type Name="LookupFlags" FullName="Avahi.LookupFlags">
- <TypeSignature Language="C#" Value="public enum LookupFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="UseMulticast">
- <MemberSignature Language="C#" Value="UseMulticast" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="UseWideArea">
- <MemberSignature Language="C#" Value="UseWideArea" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoAddress">
- <MemberSignature Language="C#" Value="NoAddress" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoTxt">
- <MemberSignature Language="C#" Value="NoTxt" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/LookupResultFlags.xml b/release-0.6.9/avahi-sharp/en/Avahi/LookupResultFlags.xml
deleted file mode 100644
index 0066493..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/LookupResultFlags.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<Type Name="LookupResultFlags" FullName="Avahi.LookupResultFlags">
- <TypeSignature Language="C#" Value="public enum LookupResultFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="Multicast">
- <MemberSignature Language="C#" Value="Multicast" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="WideArea">
- <MemberSignature Language="C#" Value="WideArea" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Cached">
- <MemberSignature Language="C#" Value="Cached" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Local">
- <MemberSignature Language="C#" Value="Local" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="OurOwn">
- <MemberSignature Language="C#" Value="OurOwn" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/Protocol.xml b/release-0.6.9/avahi-sharp/en/Avahi/Protocol.xml
deleted file mode 100644
index 361f034..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/Protocol.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<Type Name="Protocol" FullName="Avahi.Protocol">
- <TypeSignature Language="C#" Value="public enum Protocol" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="IPv4">
- <MemberSignature Language="C#" Value="IPv4" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Unspecified">
- <MemberSignature Language="C#" Value="Unspecified" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="IPv6">
- <MemberSignature Language="C#" Value="IPv6" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/PublishFlags.xml b/release-0.6.9/avahi-sharp/en/Avahi/PublishFlags.xml
deleted file mode 100644
index c21774c..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/PublishFlags.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<Type Name="PublishFlags" FullName="Avahi.PublishFlags">
- <TypeSignature Language="C#" Value="public enum PublishFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="UseMulticast">
- <MemberSignature Language="C#" Value="UseMulticast" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Update">
- <MemberSignature Language="C#" Value="Update" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="AllowMultiple">
- <MemberSignature Language="C#" Value="AllowMultiple" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="UseWideArea">
- <MemberSignature Language="C#" Value="UseWideArea" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Unique">
- <MemberSignature Language="C#" Value="Unique" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoReverse">
- <MemberSignature Language="C#" Value="NoReverse" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoCookie">
- <MemberSignature Language="C#" Value="NoCookie" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoProbe">
- <MemberSignature Language="C#" Value="NoProbe" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoAnnounce">
- <MemberSignature Language="C#" Value="NoAnnounce" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/RecordBrowser.xml b/release-0.6.9/avahi-sharp/en/Avahi/RecordBrowser.xml
deleted file mode 100644
index fdf32ca..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/RecordBrowser.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<Type Name="RecordBrowser" FullName="Avahi.RecordBrowser">
- <TypeSignature Language="C#" Value="public class RecordBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public RecordBrowser (Avahi.Client client, string name, Avahi.RecordType type);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public RecordBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string name, Avahi.RecordClass clazz, Avahi.RecordType type, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="clazz" Type="Avahi.RecordClass" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="name">To be added.</param>
- <param name="clazz">To be added.</param>
- <param name="type">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="RecordAdded">
- <MemberSignature Language="C#" Value="public event Avahi.RecordInfoHandler RecordAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="RecordRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.RecordInfoHandler RecordRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Records">
- <MemberSignature Language="C#" Value="public Avahi.RecordInfo[] Records { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/RecordClass.xml b/release-0.6.9/avahi-sharp/en/Avahi/RecordClass.xml
deleted file mode 100644
index 69787ce..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/RecordClass.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<Type Name="RecordClass" FullName="Avahi.RecordClass">
- <TypeSignature Language="C#" Value="public enum RecordClass" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="In">
- <MemberSignature Language="C#" Value="In" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordClass</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/RecordInfo.xml b/release-0.6.9/avahi-sharp/en/Avahi/RecordInfo.xml
deleted file mode 100644
index 708678e..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/RecordInfo.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<Type Name="RecordInfo" FullName="Avahi.RecordInfo">
- <TypeSignature Language="C#" Value="public struct RecordInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Name">
- <MemberSignature Language="C#" Value="public string Name;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Class">
- <MemberSignature Language="C#" Value="public Avahi.RecordClass Class;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordClass</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Type">
- <MemberSignature Language="C#" Value="public Avahi.RecordType Type;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Data">
- <MemberSignature Language="C#" Value="public byte[] Data;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Byte[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/RecordInfoArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/RecordInfoArgs.xml
deleted file mode 100644
index 81e6e57..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/RecordInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="RecordInfoArgs" FullName="Avahi.RecordInfoArgs">
- <TypeSignature Language="C#" Value="public class RecordInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public RecordInfoArgs (Avahi.RecordInfo record);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="record" Type="Avahi.RecordInfo" />
- </Parameters>
- <Docs>
- <param name="record">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Record">
- <MemberSignature Language="C#" Value="public Avahi.RecordInfo Record { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/RecordInfoHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/RecordInfoHandler.xml
deleted file mode 100644
index f9cbc17..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/RecordInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="RecordInfoHandler" FullName="Avahi.RecordInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void RecordInfoHandler(object o, Avahi.RecordInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.RecordInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/RecordType.xml b/release-0.6.9/avahi-sharp/en/Avahi/RecordType.xml
deleted file mode 100644
index 7913cad..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/RecordType.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<Type Name="RecordType" FullName="Avahi.RecordType">
- <TypeSignature Language="C#" Value="public enum RecordType" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="Cname">
- <MemberSignature Language="C#" Value="Cname" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Ptr">
- <MemberSignature Language="C#" Value="Ptr" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Aaa">
- <MemberSignature Language="C#" Value="Aaa" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Soa">
- <MemberSignature Language="C#" Value="Soa" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Txt">
- <MemberSignature Language="C#" Value="Txt" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Hinfo">
- <MemberSignature Language="C#" Value="Hinfo" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Ns">
- <MemberSignature Language="C#" Value="Ns" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Mx">
- <MemberSignature Language="C#" Value="Mx" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="A">
- <MemberSignature Language="C#" Value="A" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Srv">
- <MemberSignature Language="C#" Value="Srv" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ResolverBase.xml b/release-0.6.9/avahi-sharp/en/Avahi/ResolverBase.xml
deleted file mode 100644
index c7d8549..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ResolverBase.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<Type Name="ResolverBase" FullName="Avahi.ResolverBase">
- <TypeSignature Language="C#" Value="public abstract class ResolverBase" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected ResolverBase ();" />
- <MemberType>Constructor</MemberType>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Failed">
- <MemberSignature Language="C#" Value="public event Avahi.ErrorCodeHandler Failed;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCodeHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceBrowser.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceBrowser.xml
deleted file mode 100644
index ff4eedb..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceBrowser.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<Type Name="ServiceBrowser" FullName="Avahi.ServiceBrowser">
- <TypeSignature Language="C#" Value="public class ServiceBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceBrowser (Avahi.Client client, string type);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="type" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="type">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceBrowser (Avahi.Client client, string type, string domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceAdded">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceInfoHandler ServiceAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceInfoHandler ServiceRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Services">
- <MemberSignature Language="C#" Value="public Avahi.ServiceInfo[] Services { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string type, string domain, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfo.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfo.xml
deleted file mode 100644
index d780085..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfo.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-<Type Name="ServiceInfo" FullName="Avahi.ServiceInfo">
- <TypeSignature Language="C#" Value="public struct ServiceInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public string Domain;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceType">
- <MemberSignature Language="C#" Value="public string ServiceType;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Name">
- <MemberSignature Language="C#" Value="public string Name;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Port">
- <MemberSignature Language="C#" Value="public ushort Port;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.UInt16</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Text">
- <MemberSignature Language="C#" Value="public byte[][] Text;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Byte[][]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Zero">
- <MemberSignature Language="C#" Value="public static Avahi.ServiceInfo Zero;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoArgs.xml
deleted file mode 100644
index d2ee14d..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ServiceInfoArgs" FullName="Avahi.ServiceInfoArgs">
- <TypeSignature Language="C#" Value="public class ServiceInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceInfoArgs (Avahi.ServiceInfo service);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="service" Type="Avahi.ServiceInfo" />
- </Parameters>
- <Docs>
- <param name="service">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Service">
- <MemberSignature Language="C#" Value="public Avahi.ServiceInfo Service { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoHandler.xml
deleted file mode 100644
index 91cf630..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ServiceInfoHandler" FullName="Avahi.ServiceInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void ServiceInfoHandler(object o, Avahi.ServiceInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.ServiceInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceResolver.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceResolver.xml
deleted file mode 100644
index e8ac750..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceResolver.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<Type Name="ServiceResolver" FullName="Avahi.ServiceResolver">
- <TypeSignature Language="C#" Value="public class ServiceResolver : Avahi.ResolverBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.ResolverBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceResolver (Avahi.Client client, string name, string type, string domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceResolver (Avahi.Client client, Avahi.ServiceInfo service);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="service" Type="Avahi.ServiceInfo" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="service">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Found">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceInfoHandler Found;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="public event EventHandler Timeout;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Service">
- <MemberSignature Language="C#" Value="public Avahi.ServiceInfo Service { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceResolver (Avahi.Client client, int iface, Avahi.Protocol proto, string name, string type, string domain, Avahi.Protocol aproto, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="aproto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="aproto">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml
deleted file mode 100644
index 5ea64ac..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<Type Name="ServiceTypeBrowser" FullName="Avahi.ServiceTypeBrowser">
- <TypeSignature Language="C#" Value="public class ServiceTypeBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeBrowser (Avahi.Client client);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeBrowser (Avahi.Client client, string domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceTypeAdded">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceTypeInfoHandler ServiceTypeAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceTypeRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceTypeInfoHandler ServiceTypeRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceTypes">
- <MemberSignature Language="C#" Value="public Avahi.ServiceTypeInfo[] ServiceTypes { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string domain, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfo.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfo.xml
deleted file mode 100644
index 5b09ae9..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfo.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<Type Name="ServiceTypeInfo" FullName="Avahi.ServiceTypeInfo">
- <TypeSignature Language="C#" Value="public struct ServiceTypeInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public string Domain;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceType">
- <MemberSignature Language="C#" Value="public string ServiceType;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml
deleted file mode 100644
index fd584cd..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ServiceTypeInfoArgs" FullName="Avahi.ServiceTypeInfoArgs">
- <TypeSignature Language="C#" Value="public class ServiceTypeInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeInfoArgs (Avahi.ServiceTypeInfo type);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="type" Type="Avahi.ServiceTypeInfo" />
- </Parameters>
- <Docs>
- <param name="type">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceType">
- <MemberSignature Language="C#" Value="public Avahi.ServiceTypeInfo ServiceType { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml b/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml
deleted file mode 100644
index 0fd751f..0000000
--- a/release-0.6.9/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ServiceTypeInfoHandler" FullName="Avahi.ServiceTypeInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void ServiceTypeInfoHandler(object o, Avahi.ServiceTypeInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.ServiceTypeInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/release-0.6.9/avahi-sharp/en/index.xml b/release-0.6.9/avahi-sharp/en/index.xml
deleted file mode 100644
index e180cd0..0000000
--- a/release-0.6.9/avahi-sharp/en/index.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<Overview>
- <Assemblies>
- <Assembly Name="avahi-sharp" Version="1.0.0.0">
- <Attributes>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyTrademark(Trademark="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyCopyright(Copyright="(C) 2005 James Willcox &lt;snorp@snorp.net&gt;")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyProduct(Product="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyCompany(Company="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyConfiguration(Configuration="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyDescription(Description="Mono bindings for the Avahi mDNS/DNS-SD stack")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyTitle(Title="avahi-sharp")</AttributeName>
- </Attribute>
- </Attributes>
- </Assembly>
- </Assemblies>
- <Remarks>To be added.</Remarks>
- <Copyright>To be added.</Copyright>
- <Types>
- <Namespace Name="Avahi">
- <Type Name="AddressResolver" />
- <Type Name="Client" />
- <Type Name="ClientException" />
- <Type Name="DomainInfo" />
- <Type Name="DomainBrowser" />
- <Type Name="EntryGroup" />
- <Type Name="HostNameResolver" />
- <Type Name="ServiceInfo" />
- <Type Name="ServiceBrowser" />
- <Type Name="ServiceResolver" />
- <Type Name="ServiceTypeInfo" />
- <Type Name="ServiceTypeBrowser" />
- <Type Name="HostAddressHandler" />
- <Type Name="ClientStateHandler" />
- <Type Name="DomainInfoHandler" />
- <Type Name="EntryGroupStateHandler" />
- <Type Name="ServiceInfoHandler" />
- <Type Name="ServiceTypeInfoHandler" />
- <Type Name="Protocol" />
- <Type Name="ClientState" />
- <Type Name="DomainBrowserType" />
- <Type Name="EntryGroupState" />
- <Type Name="LookupFlags" />
- <Type Name="LookupResultFlags" />
- <Type Name="HostAddressArgs" />
- <Type Name="ResolverBase" />
- <Type Name="BrowserBase" />
- <Type Name="ClientStateArgs" />
- <Type Name="ErrorCodeArgs" />
- <Type Name="DomainInfoArgs" />
- <Type Name="EntryGroupStateArgs" />
- <Type Name="RecordInfo" />
- <Type Name="RecordInfoArgs" />
- <Type Name="RecordBrowser" />
- <Type Name="ServiceInfoArgs" />
- <Type Name="ServiceTypeInfoArgs" />
- <Type Name="ErrorCodeHandler" />
- <Type Name="RecordInfoHandler" />
- <Type Name="ClientFlags" />
- <Type Name="ErrorCode" />
- <Type Name="PublishFlags" />
- <Type Name="RecordClass" />
- <Type Name="RecordType" />
- </Namespace>
- </Types>
- <Title>avahi-sharp</Title>
-</Overview>
diff --git a/release-0.6.9/avahi-sharp/gencfg.sh b/release-0.6.9/avahi-sharp/gencfg.sh
deleted file mode 100755
index 3486187..0000000
--- a/release-0.6.9/avahi-sharp/gencfg.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-. $1
-client_dlname=$dlname
-. $2
-common_dlname=$dlname
-. $3
-glib_dlname=$dlname
-
-exec sed -e "s,@CLIENT_DLNAME\@,${client_dlname},g" \
- -e "s,@COMMON_DLNAME\@,${common_dlname},g" \
- -e "s,@GLIB_DLNAME\@,${glib_dlname},g"
diff --git a/release-0.6.9/avahi-utils/Makefile.am b/release-0.6.9/avahi-utils/Makefile.am
deleted file mode 100644
index 61268d3..0000000
--- a/release-0.6.9/avahi-utils/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-
-bin_PROGRAMS = avahi-browse avahi-resolve avahi-publish
-
-avahi_browse_SOURCES = avahi-browse.c sigint.c sigint.h
-avahi_browse_CFLAGS = $(AM_CFLAGS)
-avahi_browse_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-if HAVE_GDBM
-avahi_browse_SOURCES += stdb.h stdb.c
-avahi_browse_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\"
-avahi_browse_LDADD += -lgdbm
-endif
-
-avahi_resolve_SOURCES = avahi-resolve.c sigint.c sigint.h
-avahi_resolve_CFLAGS = $(AM_CFLAGS)
-avahi_resolve_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-avahi_publish_SOURCES = avahi-publish.c sigint.c sigint.h
-avahi_publish_CFLAGS = $(AM_CFLAGS)
-avahi_publish_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-install-exec-local:
- cd $(DESTDIR)/$(bindir) && \
- rm -f avahi-resolve-host-name avahi-resolve-address avahi-browse-domains avahi-publish-address avahi-publish-service && \
- $(LN_S) avahi-resolve avahi-resolve-host-name && \
- $(LN_S) avahi-resolve avahi-resolve-address && \
- $(LN_S) avahi-browse avahi-browse-domains && \
- $(LN_S) avahi-publish avahi-publish-address && \
- $(LN_S) avahi-publish avahi-publish-service
-
-endif
diff --git a/release-0.6.9/avahi-utils/avahi-browse.c b/release-0.6.9/avahi-utils/avahi-browse.c
deleted file mode 100644
index 7abd53e..0000000
--- a/release-0.6.9/avahi-utils/avahi-browse.c
+++ /dev/null
@@ -1,789 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <locale.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/llist.h>
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-
-#include "sigint.h"
-
-#ifdef HAVE_GDBM
-#include "stdb.h"
-#endif
-
-typedef enum {
- COMMAND_HELP,
- COMMAND_VERSION,
- COMMAND_BROWSE_SERVICES,
- COMMAND_BROWSE_ALL_SERVICES,
- COMMAND_BROWSE_DOMAINS
-} Command;
-
-typedef struct Config {
- int verbose;
- int terminate_on_all_for_now;
- int terminate_on_cache_exhausted;
- char *domain;
- char *stype;
- int ignore_local;
- Command command;
- int resolve;
- int no_fail;
-#ifdef HAVE_GDBM
- int no_db_lookup;
-#endif
-} Config;
-
-typedef struct ServiceInfo ServiceInfo;
-
-struct ServiceInfo {
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- char *name, *type, *domain;
-
- AvahiServiceResolver *resolver;
- Config *config;
-
- AVAHI_LLIST_FIELDS(ServiceInfo, info);
-};
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiClient *client = NULL;
-static int n_all_for_now = 0, n_cache_exhausted = 0, n_resolving = 0;
-static AvahiStringList *browsed_types = NULL;
-static ServiceInfo *services = NULL;
-static int n_columns = 80;
-static int browsing = 0;
-
-static void check_terminate(Config *c) {
-
- assert(n_all_for_now >= 0);
- assert(n_cache_exhausted >= 0);
- assert(n_resolving >= 0);
-
- if (n_all_for_now <= 0 && n_resolving <= 0) {
-
- if (c->verbose) {
- printf(": All for now\n");
- n_all_for_now++; /* Make sure that this event is not repeated */
- }
-
- if (c->terminate_on_all_for_now)
- avahi_simple_poll_quit(simple_poll);
- }
-
- if (n_cache_exhausted <= 0 && n_resolving <= 0) {
-
- if (c->verbose) {
- printf(": Cache exhausted\n");
- n_cache_exhausted++; /* Make sure that this event is not repeated */
- }
-
- if (c->terminate_on_cache_exhausted)
- avahi_simple_poll_quit(simple_poll);
- }
-}
-
-static ServiceInfo *find_service(AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- ServiceInfo *i;
-
- for (i = services; i; i = i->info_next)
- if (i->interface == interface &&
- i->protocol == protocol &&
- strcasecmp(i->name, name) == 0 &&
- avahi_domain_equal(i->type, type) &&
- avahi_domain_equal(i->domain, domain))
-
- return i;
-
- return NULL;
-}
-
-static void print_service_line(Config *config, char c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- char ifname[IF_NAMESIZE];
-
-#ifdef HAVE_GDBM
- if (!config->no_db_lookup)
- type = stdb_lookup(type);
-#endif
-
- printf("%c %4s %4s %-*s %-20s %s\n",
- c,
- interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
- protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a",
- n_columns-35, name, type, domain);
-}
-
-static void service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- ServiceInfo *i = userdata;
-
- assert(r);
- assert(i);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- char address[AVAHI_ADDRESS_STR_MAX], *t;
-
- avahi_address_snprint(address, sizeof(address), a);
-
- t = avahi_string_list_to_string(txt);
-
- print_service_line(i->config, '=', interface, protocol, name, type, domain);
-
- printf(" hostname = [%s]\n"
- " address = [%s]\n"
- " port = [%i]\n"
- " txt = [%s]\n",
- host_name,
- address,
- port,
- t);
- avahi_free(t);
-
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- fprintf(stderr, "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(client)));
- break;
- }
-
-
- avahi_service_resolver_free(i->resolver);
- i->resolver = NULL;
-
- assert(n_resolving > 0);
- n_resolving--;
- check_terminate(i->config);
-}
-
-static ServiceInfo *add_service(Config *c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- ServiceInfo *i;
-
- i = avahi_new(ServiceInfo, 1);
-
- if (c->resolve) {
- if (!(i->resolver = avahi_service_resolver_new(client, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, service_resolver_callback, i))) {
- avahi_free(i);
- fprintf(stderr, "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(client)));
- return NULL;
- }
-
- n_resolving++;
- } else
- i->resolver = NULL;
-
- i->interface = interface;
- i->protocol = protocol;
- i->name = avahi_strdup(name);
- i->type = avahi_strdup(type);
- i->domain = avahi_strdup(domain);
- i->config = c;
-
- AVAHI_LLIST_PREPEND(ServiceInfo, info, services, i);
-
- return i;
-}
-
-static void remove_service(Config *c, ServiceInfo *i) {
- assert(c);
- assert(i);
-
- AVAHI_LLIST_REMOVE(ServiceInfo, info, services, i);
-
- if (i->resolver)
- avahi_service_resolver_free(i->resolver);
-
- avahi_free(i->name);
- avahi_free(i->type);
- avahi_free(i->domain);
- avahi_free(i);
-}
-
-static void service_browser_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata) {
-
- Config *c = userdata;
-
- assert(b);
- assert(c);
-
- switch (event) {
- case AVAHI_BROWSER_NEW: {
- if (c->ignore_local && (flags & AVAHI_LOOKUP_RESULT_LOCAL))
- break;
-
- if (find_service(interface, protocol, name, type, domain))
- return;
-
- add_service(c, interface, protocol, name, type, domain);
-
- print_service_line(c, '+', interface, protocol, name, type, domain);
- break;
-
- }
-
- case AVAHI_BROWSER_REMOVE: {
- ServiceInfo *info;
-
- if (!(info = find_service(interface, protocol, name, type, domain)))
- return;
-
- remove_service(c, info);
-
- print_service_line(c, '-', interface, protocol, name, type, domain);
- break;
- }
-
- case AVAHI_BROWSER_FAILURE:
- fprintf(stderr, "service_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- n_cache_exhausted --;
- check_terminate(c);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- n_all_for_now --;
- check_terminate(c);
- break;
- }
-}
-
-static void browse_service_type(Config *c, const char *stype, const char *domain) {
- AvahiServiceBrowser *b;
- AvahiStringList *i;
-
- assert(c);
- assert(client);
- assert(stype);
-
- for (i = browsed_types; i; i = i->next)
- if (avahi_domain_equal(stype, (char*) i->text))
- return;
-
- if (!(b = avahi_service_browser_new(
- client,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- stype,
- domain,
- 0,
- service_browser_callback,
- c))) {
-
- fprintf(stderr, "avahi_service_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- browsed_types = avahi_string_list_add(browsed_types, stype);
-
- n_all_for_now++;
- n_cache_exhausted++;
-}
-
-static void service_type_browser_callback(
- AvahiServiceTypeBrowser *b,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- Config *c = userdata;
-
- assert(b);
- assert(c);
-
- switch (event) {
-
- case AVAHI_BROWSER_NEW:
- browse_service_type(c, type, domain);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- /* We're dirty and never remove the browser again */
- break;
-
- case AVAHI_BROWSER_FAILURE:
- fprintf(stderr, "service_type_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- n_cache_exhausted --;
- check_terminate(c);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- n_all_for_now --;
- check_terminate(c);
- break;
- }
-}
-
-static void browse_all(Config *c) {
- AvahiServiceTypeBrowser *b;
-
- assert(c);
-
- if (!(b = avahi_service_type_browser_new(
- client,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- c->domain,
- 0,
- service_type_browser_callback,
- c))) {
-
- fprintf(stderr, "avahi_service_type_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- n_cache_exhausted++;
- n_all_for_now++;
-}
-
-static void domain_browser_callback(
- AvahiDomainBrowser *b,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- Config *c = userdata;
-
- assert(b);
- assert(c);
-
- switch (event) {
-
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE: {
- char ifname[IF_NAMESIZE];
-
- printf("%c %4s %4s %s\n",
- event == AVAHI_BROWSER_NEW ? '+' : '-',
- interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
- protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a",
- domain);
- break;
- }
-
- case AVAHI_BROWSER_FAILURE:
- fprintf(stderr, "domain_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- n_cache_exhausted --;
- check_terminate(c);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- n_all_for_now --;
- check_terminate(c);
- break;
- }
-}
-
-static void browse_domains(Config *c) {
- AvahiDomainBrowser *b;
-
- assert(c);
-
- if (!(b = avahi_domain_browser_new(
- client,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- c->domain,
- AVAHI_DOMAIN_BROWSER_BROWSE,
- 0,
- domain_browser_callback,
- c))) {
-
- fprintf(stderr, "avahi_domain_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- n_cache_exhausted++;
- n_all_for_now++;
-}
-
-static int start(Config *config) {
-
- assert(!browsing);
-
- if (config->verbose) {
- const char *version, *hn;
-
- if (!(version = avahi_client_get_version_string(client))) {
- fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- if (!(hn = avahi_client_get_host_name_fqdn(client))) {
- fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
-
- if (config->command == COMMAND_BROWSE_DOMAINS)
- fprintf(stderr, "E Ifce Prot Domain\n");
- else
- fprintf(stderr, "E Ifce Prot %-*s %-20s Domain\n", n_columns-35, "Name", "Type");
- }
-
- if (config->command == COMMAND_BROWSE_SERVICES)
- browse_service_type(config, config->stype, config->domain);
- else if (config->command == COMMAND_BROWSE_ALL_SERVICES)
- browse_all(config);
- else {
- assert(config->command == COMMAND_BROWSE_DOMAINS);
- browse_domains(config);
- }
-
- browsing = 1;
- return 0;
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- Config *config = userdata;
-
- /* This function might be called when avahi_client_new() has not
- * returned yet.*/
- client = c;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
-
- if (config->no_fail && avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED) {
- int error;
-
- /* We have been disconnected, so let reconnect */
-
- fprintf(stderr, "Disconnected, reconnecting ...\n");
-
- avahi_client_free(client);
- client = NULL;
-
- avahi_string_list_free(browsed_types);
- browsed_types = NULL;
-
- while (services)
- remove_service(config, services);
-
- browsing = 0;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), AVAHI_CLIENT_NO_FAIL, client_callback, config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- avahi_simple_poll_quit(simple_poll);
- }
-
- } else {
- fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- break;
-
- case AVAHI_CLIENT_S_REGISTERING:
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_S_COLLISION:
-
- if (!browsing)
- if (start(config) < 0)
- avahi_simple_poll_quit(simple_poll);
-
- break;
-
- case AVAHI_CLIENT_CONNECTING:
-
- if (config->verbose)
- fprintf(stderr, "Waiting for daemon ...\n");
-
- break;
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- if (strstr(argv0, "domain"))
- fprintf(f, "%s [options] \n\n", argv0);
- else
- fprintf(f,
- "%s [options] <service type>\n"
- "%s [options] -a\n"
- "%s [options] -D\n\n",
- argv0, argv0, argv0);
-
- fprintf(f,
- " -h --help Show this help\n"
- " -V --version Show version\n"
- " -D --browse-domains Browse for browsing domains instead of services\n"
- " -a --all Show all services, regardless of the type\n"
- " -d --domain=DOMAIN The domain to browse in\n"
- " -v --verbose Enable verbose mode\n"
- " -t --terminate Terminate after dumping a more or less complete list\n"
- " -c --cache Terminate after dumping all entries from the cache\n"
- " -l --ignore-local Ignore local services\n"
- " -r --resolve Resolve services found\n"
- " -f --no-fail Don't fail if the daemon is not available\n"
-#ifdef HAVE_GDBM
- " -k --no-db-lookup Don't lookup service types\n"
-#endif
- );
-}
-
-static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
- int o;
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "browse-domains", no_argument, NULL, 'D' },
- { "domain", required_argument, NULL, 'd' },
- { "all", no_argument, NULL, 'a' },
- { "verbose", no_argument, NULL, 'v' },
- { "terminate", no_argument, NULL, 't' },
- { "cache", no_argument, NULL, 'c' },
- { "ignore-local", no_argument, NULL, 'l' },
- { "resolve", no_argument, NULL, 'r' },
- { "no-fail", no_argument, NULL, 'f' },
-#ifdef HAVE_GDBM
- { "no-db-lookup", no_argument, NULL, 'k' },
-#endif
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- c->command = strstr(argv0, "domain") ? COMMAND_BROWSE_DOMAINS : COMMAND_BROWSE_SERVICES;
- c->verbose =
- c->terminate_on_cache_exhausted =
- c->terminate_on_all_for_now =
- c->ignore_local =
- c->resolve =
- c->no_fail = 0;
- c->domain = c->stype = NULL;
-
-#ifdef HAVE_GDBM
- c->no_db_lookup = 0;
-#endif
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hVd:avtclrDf"
-#ifdef HAVE_GDBM
- "k"
-#endif
- , long_options, NULL)) >= 0) {
-
- switch(o) {
- case 'h':
- c->command = COMMAND_HELP;
- break;
- case 'V':
- c->command = COMMAND_VERSION;
- break;
- case 'a':
- c->command = COMMAND_BROWSE_ALL_SERVICES;
- break;
- case 'D':
- c->command = COMMAND_BROWSE_DOMAINS;
- break;
- case 'd':
- avahi_free(c->domain);
- c->domain = avahi_strdup(optarg);
- break;
- case 'v':
- c->verbose = 1;
- break;
- case 't':
- c->terminate_on_all_for_now = 1;
- break;
- case 'c':
- c->terminate_on_cache_exhausted = 1;
- break;
- case 'l':
- c->ignore_local = 1;
- break;
- case 'r':
- c->resolve = 1;
- break;
- case 'f':
- c->no_fail = 1;
- break;
-#ifdef HAVE_GDBM
- case 'k':
- c->no_db_lookup = 1;
- break;
-#endif
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (c->command == COMMAND_BROWSE_SERVICES) {
- if (optind >= argc) {
- fprintf(stderr, "Too few arguments\n");
- return -1;
- }
-
- c->stype = avahi_strdup(argv[optind]);
- optind++;
- }
-
- if (optind < argc) {
- fprintf(stderr, "Too many arguments\n");
- return -1;
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[]) {
- int ret = 1, error;
- Config config;
- const char *argv0;
- char *ec;
-
- setlocale(LC_ALL, "");
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- if ((ec = getenv("COLUMNS")))
- n_columns = atoi(ec);
-
- if (n_columns < 40)
- n_columns = 40;
-
- if (parse_command_line(&config, argv0, argc, argv) < 0)
- goto fail;
-
- switch (config.command) {
- case COMMAND_HELP:
- help(stdout, argv0);
- ret = 0;
- break;
-
- case COMMAND_VERSION:
- printf("%s "PACKAGE_VERSION"\n", argv0);
- ret = 0;
- break;
-
- case COMMAND_BROWSE_SERVICES:
- case COMMAND_BROWSE_ALL_SERVICES:
- case COMMAND_BROWSE_DOMAINS:
-
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- if (sigint_install(simple_poll) < 0)
- goto fail;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), config.no_fail ? AVAHI_CLIENT_NO_FAIL : 0, client_callback, &config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- avahi_simple_poll_loop(simple_poll);
- ret = 0;
- break;
- }
-
-
-fail:
-
- while (services)
- remove_service(&config, services);
-
- if (client)
- avahi_client_free(client);
-
- sigint_uninstall();
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(config.domain);
- avahi_free(config.stype);
-
- avahi_string_list_free(browsed_types);
-
-#ifdef HAVE_GDBM
- stdb_shutdown();
-#endif
-
- return ret;
-}
diff --git a/release-0.6.9/avahi-utils/avahi-publish.c b/release-0.6.9/avahi-utils/avahi-publish.c
deleted file mode 100644
index 9ca2df2..0000000
--- a/release-0.6.9/avahi-utils/avahi-publish.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <errno.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-
-#include "sigint.h"
-
-typedef enum {
- COMMAND_UNSPEC,
- COMMAND_HELP,
- COMMAND_VERSION,
- COMMAND_PUBLISH_SERVICE,
- COMMAND_PUBLISH_ADDRESS
-} Command;
-
-typedef struct Config {
- int verbose, no_fail;
- Command command;
- char *name, *stype, *domain, *host;
- uint16_t port;
- AvahiStringList *txt, *subtypes;
- AvahiAddress address;
-} Config;
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiClient *client = NULL;
-static AvahiEntryGroup *entry_group = NULL;
-
-static int register_stuff(Config *config);
-
-static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- Config *config = userdata;
-
- assert(g);
- assert(config);
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
-
- fprintf(stderr, "Established under name '%s'\n", config->name);
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
-
- fprintf(stderr, "Failed to register: %s\n", avahi_strerror(avahi_client_errno(client)));
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
-
- if (config->command == COMMAND_PUBLISH_SERVICE)
- n = avahi_alternative_service_name(config->name);
- else {
- assert(config->command == COMMAND_PUBLISH_ADDRESS);
- n = avahi_alternative_host_name(config->name);
- }
-
- fprintf(stderr, "Name collision, picking new name '%s'.\n", n);
- avahi_free(config->name);
- config->name = n;
-
- register_stuff(config);
-
- break;
- }
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static int register_stuff(Config *config) {
- assert(config);
-
- if (!entry_group) {
- if (!(entry_group = avahi_entry_group_new(client, entry_group_callback, config))) {
- fprintf(stderr, "Failed to create entry group: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
- }
-
- assert(avahi_entry_group_is_empty(entry_group));
-
- if (config->command == COMMAND_PUBLISH_ADDRESS) {
-
- if (avahi_entry_group_add_address(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, &config->address) < 0) {
- fprintf(stderr, "Failed to add address: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- } else {
- AvahiStringList *i;
-
- assert(config->command == COMMAND_PUBLISH_SERVICE);
-
- if (avahi_entry_group_add_service_strlst(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, config->host, config->port, config->txt) < 0) {
- fprintf(stderr, "Failed to add service: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- for (i = config->subtypes; i; i = i->next)
- if (avahi_entry_group_add_service_subtype(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, (char*) i->text) < 0) {
- fprintf(stderr, "Failed to add subtype '%s': %s\n", i->text, avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
- }
-
- avahi_entry_group_commit(entry_group);
-
- return 0;
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- Config *config = userdata;
-
- client = c;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
-
- if (config->no_fail && avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED) {
- int error;
-
- /* We have been disconnected, so let reconnect */
-
- fprintf(stderr, "Disconnected, reconnecting ...\n");
-
- avahi_client_free(client);
- client = NULL;
- entry_group = NULL;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), AVAHI_CLIENT_NO_FAIL, client_callback, config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- avahi_simple_poll_quit(simple_poll);
- }
-
- } else {
- fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- break;
-
- case AVAHI_CLIENT_S_RUNNING:
-
- if (register_stuff(config) < 0)
- avahi_simple_poll_quit(simple_poll);
-
- break;
-
- case AVAHI_CLIENT_S_COLLISION:
-
- if (config->verbose)
- fprintf(stderr, "Host name conflict\n");
-
- if (entry_group) {
- avahi_entry_group_free(entry_group);
- entry_group = NULL;
- }
- break;
-
- case AVAHI_CLIENT_CONNECTING:
-
- if (config->verbose)
- fprintf(stderr, "Waiting for daemon ...\n");
- break;
-
- case AVAHI_CLIENT_S_REGISTERING:
- ;
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- fprintf(f,
- "%s [options] %s <name> <type> <port> [<txt ...>]\n"
- "%s [options] %s <host-name> <address>\n\n"
- " -h --help Show this help\n"
- " -V --version Show version\n"
- " -s --service Publish service\n"
- " -a --address Publish address\n"
- " -v --verbose Enable verbose mode\n"
- " -d --domain=DOMAIN Domain to publish service in\n"
- " -H --host=DOMAIN Host where service resides\n"
- " --subtype=SUBTYPE An additional subtype to register this service with\n"
- " -f --no-fail Don't fail if the daemon is not available\n",
- argv0, strstr(argv0, "service") ? "[-s]" : "-s",
- argv0, strstr(argv0, "address") ? "[-a]" : "-a");
-}
-
-static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
- int o;
-
- enum {
- ARG_SUBTYPE = 256
- };
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "service", no_argument, NULL, 's' },
- { "address", no_argument, NULL, 'a' },
- { "verbose", no_argument, NULL, 'v' },
- { "domain", required_argument, NULL, 'd' },
- { "host", required_argument, NULL, 'H' },
- { "subtype", required_argument, NULL, ARG_SUBTYPE},
- { "no-fail", no_argument, NULL, 'f' },
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- c->command = strstr(argv0, "address") ? COMMAND_PUBLISH_ADDRESS : (strstr(argv0, "service") ? COMMAND_PUBLISH_SERVICE : COMMAND_UNSPEC);
- c->verbose = c->no_fail = 0;
- c->host = c->name = c->domain = c->stype = NULL;
- c->port = 0;
- c->txt = c->subtypes = NULL;
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hVsavd:H:f", long_options, NULL)) >= 0) {
-
- switch(o) {
- case 'h':
- c->command = COMMAND_HELP;
- break;
- case 'V':
- c->command = COMMAND_VERSION;
- break;
- case 's':
- c->command = COMMAND_PUBLISH_SERVICE;
- break;
- case 'a':
- c->command = COMMAND_PUBLISH_ADDRESS;
- break;
- case 'v':
- c->verbose = 1;
- break;
- case 'd':
- avahi_free(c->domain);
- c->domain = avahi_strdup(optarg);
- break;
- case 'H':
- avahi_free(c->host);
- c->host = avahi_strdup(optarg);
- break;
- case 'f':
- c->no_fail = 1;
- break;
- case ARG_SUBTYPE:
- c->subtypes = avahi_string_list_add(c->subtypes, optarg);
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (c->command == COMMAND_PUBLISH_ADDRESS) {
- if (optind+2 != argc) {
- fprintf(stderr, "Bad number of arguments\n");
- return -1;
- }
-
- avahi_free(c->name);
- c->name = avahi_strdup(argv[optind]);
- avahi_address_parse(argv[optind+1], AVAHI_PROTO_UNSPEC, &c->address);
-
- } else if (c->command == COMMAND_PUBLISH_SERVICE) {
-
- char *e;
- long int p;
- int i;
-
- if (optind+3 > argc) {
- fprintf(stderr, "Bad number of arguments\n");
- return -1;
- }
-
- c->name = avahi_strdup(argv[optind]);
- c->stype = avahi_strdup(argv[optind+1]);
-
- errno = 0;
- p = strtol(argv[optind+2], &e, 0);
-
- if (errno != 0 || *e || p < 0 || p > 0xFFFF) {
- fprintf(stderr, "Failed to parse port number: %s\n", argv[optind+2]);
- return -1;
- }
-
- c->port = p;
-
- for (i = optind+3; i < argc; i++)
- c->txt = avahi_string_list_add(c->txt, argv[i]);
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[]) {
- int ret = 1, error;
- Config config;
- const char *argv0;
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- if (parse_command_line(&config, argv0, argc, argv) < 0)
- goto fail;
-
- switch (config.command) {
- case COMMAND_UNSPEC:
- ret = 1;
- fprintf(stderr, "No command specified.\n");
- break;
-
- case COMMAND_HELP:
- help(stdout, argv0);
- ret = 0;
- break;
-
- case COMMAND_VERSION:
- printf("%s "PACKAGE_VERSION"\n", argv0);
- ret = 0;
- break;
-
- case COMMAND_PUBLISH_SERVICE:
- case COMMAND_PUBLISH_ADDRESS:
-
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- if (sigint_install(simple_poll) < 0)
- goto fail;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), config.no_fail ? AVAHI_CLIENT_NO_FAIL : 0, client_callback, &config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- if (avahi_client_get_state(client) != AVAHI_CLIENT_CONNECTING && config.verbose) {
- const char *version, *hn;
-
- if (!(version = avahi_client_get_version_string(client))) {
- fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- if (!(hn = avahi_client_get_host_name_fqdn(client))) {
- fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
- }
-
- avahi_simple_poll_loop(simple_poll);
- ret = 0;
- break;
- }
-
-fail:
-
- if (client)
- avahi_client_free(client);
-
- sigint_uninstall();
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(config.host);
- avahi_free(config.name);
- avahi_free(config.stype);
- avahi_free(config.domain);
- avahi_string_list_free(config.subtypes);
- avahi_string_list_free(config.txt);
-
- return ret;
-}
diff --git a/release-0.6.9/avahi-utils/avahi-resolve.c b/release-0.6.9/avahi-utils/avahi-resolve.c
deleted file mode 100644
index 2dafbf0..0000000
--- a/release-0.6.9/avahi-utils/avahi-resolve.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <locale.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/llist.h>
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-
-#include "sigint.h"
-
-#ifdef HAVE_GDBM
-#include "stdb.h"
-#endif
-
-typedef enum {
- COMMAND_UNSPEC,
- COMMAND_HELP,
- COMMAND_VERSION,
- COMMAND_RESOLVE_HOST_NAME,
- COMMAND_RESOLVE_ADDRESS
-} Command;
-
-typedef struct Config {
- int verbose;
- Command command;
- AvahiProtocol proto;
-} Config;
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiClient *client = NULL;
-
-static int n_resolving = 0;
-
-static void host_name_resolver_callback(
- AvahiHostNameResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- assert(r);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- char address[AVAHI_ADDRESS_STR_MAX];
-
- avahi_address_snprint(address, sizeof(address), a);
-
- printf("%s\t%s\n", name, address);
-
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- fprintf(stderr, "Failed to resolve host name '%s': %s\n", name, avahi_strerror(avahi_client_errno(client)));
- break;
- }
-
-
- avahi_host_name_resolver_free(r);
-
- assert(n_resolving > 0);
- n_resolving--;
-
- if (n_resolving <= 0)
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void address_resolver_callback(
- AvahiAddressResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *name,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- char address[AVAHI_ADDRESS_STR_MAX];
- assert(r);
-
- avahi_address_snprint(address, sizeof(address), a);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND:
-
- printf("%s\t%s\n", address, name);
- break;
-
- case AVAHI_RESOLVER_FAILURE:
-
- fprintf(stderr, "Failed to resolve address '%s': %s\n", address, avahi_strerror(avahi_client_errno(client)));
- break;
- }
-
-
- avahi_address_resolver_free(r);
-
- assert(n_resolving > 0);
- n_resolving--;
-
- if (n_resolving <= 0)
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
- fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_CLIENT_S_REGISTERING:
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_CONNECTING:
- ;
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- fprintf(f,
- "%s [options] %s <host name ...>\n"
- "%s [options] %s <address ... >\n\n"
- " -h --help Show this help\n"
- " -V --version Show version\n"
- " -n --name Resolve host name\n"
- " -a --address Resolve address\n"
- " -v --verbose Enable verbose mode\n"
- " -6 Lookup IPv6 address\n"
- " -4 Lookup IPv4 address\n",
- argv0, strstr(argv0, "address") ? "[-a]" : "-a",
- argv0, strstr(argv0, "host-name") ? "[-n]" : "-n");
-}
-
-static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
- int o;
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "name", no_argument, NULL, 'n' },
- { "address", no_argument, NULL, 'a' },
- { "verbose", no_argument, NULL, 'v' },
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- c->command = strstr(argv0, "address") ? COMMAND_RESOLVE_ADDRESS : (strstr(argv0, "host-name") ? COMMAND_RESOLVE_HOST_NAME : COMMAND_UNSPEC);
- c->proto = AVAHI_PROTO_UNSPEC;
- c->verbose = 0;
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hVnav46", long_options, NULL)) >= 0) {
-
- switch(o) {
- case 'h':
- c->command = COMMAND_HELP;
- break;
- case 'V':
- c->command = COMMAND_VERSION;
- break;
- case 'n':
- c->command = COMMAND_RESOLVE_HOST_NAME;
- break;
- case 'a':
- c->command = COMMAND_RESOLVE_ADDRESS;
- break;
- case 'v':
- c->verbose = 1;
- break;
- case '4':
- c->proto = AVAHI_PROTO_INET;
- break;
- case '6':
- c->proto = AVAHI_PROTO_INET6;
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (c->command == COMMAND_RESOLVE_ADDRESS || c->command == COMMAND_RESOLVE_HOST_NAME) {
- if (optind >= argc) {
- fprintf(stderr, "Too few arguments\n");
- return -1;
- }
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[]) {
- int ret = 1, error;
- Config config;
- const char *argv0;
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- if (parse_command_line(&config, argv0, argc, argv) < 0)
- goto fail;
-
- switch (config.command) {
- case COMMAND_UNSPEC:
- ret = 1;
- fprintf(stderr, "No command specified.\n");
- break;
-
- case COMMAND_HELP:
- help(stdout, argv0);
- ret = 0;
- break;
-
- case COMMAND_VERSION:
- printf("%s "PACKAGE_VERSION"\n", argv0);
- ret = 0;
- break;
-
- case COMMAND_RESOLVE_HOST_NAME:
- case COMMAND_RESOLVE_ADDRESS: {
- int i;
-
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- if (sigint_install(simple_poll) < 0)
- goto fail;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- if (config.verbose) {
- const char *version, *hn;
-
- if (!(version = avahi_client_get_version_string(client))) {
- fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- if (!(hn = avahi_client_get_host_name_fqdn(client))) {
- fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
- }
-
- n_resolving = 0;
-
- for (i = optind; i < argc; i++) {
-
- if (config.command == COMMAND_RESOLVE_HOST_NAME) {
-
- if (!(avahi_host_name_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, argv[i], config.proto, 0, host_name_resolver_callback, NULL))) {
- fprintf(stderr, "Failed to create host name resolver: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- } else {
- AvahiAddress a;
-
- assert(config.command == COMMAND_RESOLVE_ADDRESS);
-
- if (!avahi_address_parse(argv[i], AVAHI_PROTO_UNSPEC, &a)) {
- fprintf(stderr, "Failed to parse address '%s'\n", argv[i]);
- goto fail;
- }
-
- if (!(avahi_address_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, &a, 0, address_resolver_callback, NULL))) {
- fprintf(stderr, "Failed to create address resolver: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
- }
-
- n_resolving++;
- }
-
- avahi_simple_poll_loop(simple_poll);
- ret = 0;
- break;
- }
- }
-
-fail:
-
- if (client)
- avahi_client_free(client);
-
- sigint_uninstall();
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return ret;
-}
diff --git a/release-0.6.9/avahi-utils/sigint.c b/release-0.6.9/avahi-utils/sigint.c
deleted file mode 100644
index eb97f38..0000000
--- a/release-0.6.9/avahi-utils/sigint.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include "sigint.h"
-
-static AvahiSimplePoll *simple_poll = NULL;
-static struct sigaction old_sigint_sa, old_sigterm_sa;
-static int pipe_fds[2] = { -1, -1 };
-static AvahiWatch *watch = NULL;
-
-static int set_nonblock(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFL)) < 0)
- return -1;
-
- if (n & O_NONBLOCK)
- return 0;
-
- return fcntl(fd, F_SETFL, n|O_NONBLOCK);
-}
-
-static void handler(int s) {
- write(pipe_fds[1], &s, sizeof(s));
-}
-
-static void close_pipe_fds(void) {
- if (pipe_fds[0] >= 0)
- close(pipe_fds[0]);
- if (pipe_fds[1] >= 0)
- close(pipe_fds[1]);
-
- pipe_fds[0] = pipe_fds[1] = -1;
-}
-
-static void watch_callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
- int s;
- ssize_t l;
-
- assert(w);
- assert(fd == pipe_fds[0]);
- assert(event == AVAHI_WATCH_IN);
-
- l = read(fd, &s, sizeof(s));
- assert(l == sizeof(s));
-
- fprintf(stderr, "Got %s, quitting.\n", s == SIGINT ? "SIGINT" : "SIGTERM");
- avahi_simple_poll_quit(simple_poll);
-}
-
-int sigint_install(AvahiSimplePoll *spoll) {
- struct sigaction sa;
- const AvahiPoll *p;
-
- assert(spoll);
- assert(!simple_poll);
- assert(pipe_fds[0] == -1 && pipe_fds[1] == -1);
-
- if (pipe(pipe_fds) < 0) {
- fprintf(stderr, "pipe() failed: %s\n", strerror(errno));
- return -1;
- }
-
- set_nonblock(pipe_fds[0]);
- set_nonblock(pipe_fds[1]);
-
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = handler;
- sa.sa_flags = SA_RESTART;
-
- if (sigaction(SIGINT, &sa, &old_sigint_sa) < 0) {
- fprintf(stderr, "sigaction() failed: %s\n", strerror(errno));
- close_pipe_fds();
- return -1;
- }
-
- if (sigaction(SIGTERM, &sa, &old_sigterm_sa) < 0) {
- sigaction(SIGINT, &old_sigint_sa, NULL);
- fprintf(stderr, "sigaction() failed: %s\n", strerror(errno));
- close_pipe_fds();
- return -1;
- }
-
- p = avahi_simple_poll_get(spoll);
- watch = p->watch_new(p, pipe_fds[0], AVAHI_WATCH_IN, watch_callback, NULL);
- assert(watch);
-
- simple_poll = spoll;
- return 0;
-}
-
-void sigint_uninstall(void) {
-
- if (!simple_poll)
- return;
-
- sigaction(SIGTERM, &old_sigterm_sa, NULL);
- sigaction(SIGINT, &old_sigint_sa, NULL);
-
- close_pipe_fds();
-
- if (watch) {
- const AvahiPoll *p;
-
- assert(simple_poll);
- p = avahi_simple_poll_get(simple_poll);
-
- p->watch_free(watch);
- watch = NULL;
- }
-
- simple_poll = NULL;
-}
diff --git a/release-0.6.9/avahi-utils/sigint.h b/release-0.6.9/avahi-utils/sigint.h
deleted file mode 100644
index 0bc5c34..0000000
--- a/release-0.6.9/avahi-utils/sigint.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foosigchfoo
-#define foosigchfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/simple-watch.h>
-
-int sigint_install(AvahiSimplePoll *spoll);
-void sigint_uninstall(void);
-
-#endif
diff --git a/release-0.6.9/avahi-utils/stdb.c b/release-0.6.9/avahi-utils/stdb.c
deleted file mode 100644
index 53be776..0000000
--- a/release-0.6.9/avahi-utils/stdb.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <gdbm.h>
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <stdio.h>
-
-#include <avahi-common/malloc.h>
-
-#include "stdb.h"
-
-static GDBM_FILE gdbm_file = NULL;
-static char *buffer = NULL;
-
-static int init(void) {
-
- if (gdbm_file)
- return 0;
-
- if (!(gdbm_file = gdbm_open((char*) DATABASE_FILE, 0, GDBM_READER, 0, NULL)))
- return -1;
-
- return 0;
-}
-
-const char* stdb_lookup(const char *name) {
- datum key, data;
- const char *loc;
-
- if (init() < 0)
- goto fail;
-
- data.dptr = NULL;
- data.dsize = 0;
-
- if ((loc = setlocale(LC_MESSAGES, NULL))) {
- char k[256];
-
- snprintf(k, sizeof(k), "%s[%s]", name, loc);
- key.dptr = k;
- key.dsize = strlen(k);
- data = gdbm_fetch(gdbm_file, key);
-
- if (!data.dptr) {
- char l[32], *e;
- snprintf(l, sizeof(l), "%s", loc);
-
- if ((e = strchr(l, '@'))) {
- *e = 0;
- snprintf(k, sizeof(k), "%s[%s]", name, l);
- key.dptr = k;
- key.dsize = strlen(k);
- data = gdbm_fetch(gdbm_file, key);
- }
-
- if (!data.dptr) {
- if ((e = strchr(l, '_'))) {
- *e = 0;
- snprintf(k, sizeof(k), "%s[%s]", name, l);
- key.dptr = k;
- key.dsize = strlen(k);
- data = gdbm_fetch(gdbm_file, key);
- }
- }
- }
- }
-
- if (!data.dptr) {
- key.dptr = (char*) name;
- key.dsize = strlen(name);
- data = gdbm_fetch(gdbm_file, key);
- }
-
- if (!data.dptr)
- goto fail;
-
- avahi_free(buffer);
- buffer = avahi_strndup(data.dptr, data.dsize);
- free(data.dptr);
-
- return buffer;
-
-fail:
-
- return name;
-}
-
-void stdb_shutdown(void) {
- if (gdbm_file)
- gdbm_close(gdbm_file);
-
- avahi_free(buffer);
-}
diff --git a/release-0.6.9/avahi-utils/stdb.h b/release-0.6.9/avahi-utils/stdb.h
deleted file mode 100644
index 92c2651..0000000
--- a/release-0.6.9/avahi-utils/stdb.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foostdbhfoo
-#define foostdbhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/simple-watch.h>
-
-const char* stdb_lookup(const char *name);
-void stdb_shutdown(void);
-
-#endif
diff --git a/release-0.6.9/bootstrap.sh b/release-0.6.9/bootstrap.sh
deleted file mode 100755
index d0b6256..0000000
--- a/release-0.6.9/bootstrap.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-FLAGS="--sysconfdir=/etc --localstatedir=/var --enable-tests --enable-compat-howl --enable-compat-libdns_sd"
-
-# Feel free to add your own custom flags in here -Lathiat
-
-case `uname -s` in
- Darwin)
- export LIBTOOLIZE=/opt/local/bin/glibtoolize
- export CFLAGS="-I/opt/local/include"
- export LDFLAGS="-L/opt/local/lib"
- export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
- FLAGS="$FLAGS --prefix=/opt/local --disable-pygtk"
- ;;
- FreeBSD)
- cp /usr/local/share/aclocal/libtool15.m4 common
- cp /usr/local/share/aclocal/pkg.m4 common
- export LIBTOOLIZE=/usr/local/bin/libtoolize15
- export CFLAGS="-I/usr/local/include"
- export LDFLAGS="-L/usr/local/lib"
- export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
- FLAGS="$FLAGS --prefix=/opt/ --with-distro=none --disable-python --disable-dbus --disable-glib --disable-gtk"
- ;;
- NetBSD)
- export LIBTOOLIZE=libtoolize
- export CFLAGS="-I/usr/pkg/include"
- export LDFLAGS="-L/usr/pkg/lib"
- export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
- FLAGS="$FLAGS --disable-monodoc --disable-mono --disable-qt3 --disable-qt4 --disable-xmltoman --prefix=/opt --with-distro=none --disable-python --disable-glib --disable-gtk --disable-manpages"
- ;;
- Linux)
- ;;
-esac
-
-case "$USER" in
- lathiat|trentl)
- FLAGS="$FLAGS --disable-qt4"
- ;;
- sebest)
- FLAGS="$FLAGS --disable-monodoc --disable-mono --disable-qt3 --disable-qt4 --sysconfdir=/etc --localstatedir=/var --prefix=/usr --disable-manpages --disable-xmltoman"
- ;;
-esac
-
-CFLAGS="$CFLAGS -g -O0" exec ./autogen.sh $FLAGS "$@"
diff --git a/release-0.6.9/common/Makefile.am b/release-0.6.9/common/Makefile.am
deleted file mode 100644
index e51c02a..0000000
--- a/release-0.6.9/common/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-EXTRA_DIST = \
- doxygen.m4 \
- doxygen.mk \
- python.m4
diff --git a/release-0.6.9/common/acx_pthread.m4 b/release-0.6.9/common/acx_pthread.m4
deleted file mode 100644
index 06af842..0000000
--- a/release-0.6.9/common/acx_pthread.m4
+++ /dev/null
@@ -1,238 +0,0 @@
-dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-dnl
-dnl @summary figure out how to build C programs using POSIX threads
-dnl
-dnl This macro figures out how to build C programs using POSIX threads.
-dnl It sets the PTHREAD_LIBS output variable to the threads library and
-dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
-dnl C compiler flags that are needed. (The user can also force certain
-dnl compiler flags/libs to be tested by setting these environment
-dnl variables.)
-dnl
-dnl Also sets PTHREAD_CC to any special C compiler that is needed for
-dnl multi-threaded programs (defaults to the value of CC otherwise).
-dnl (This is necessary on AIX to use the special cc_r compiler alias.)
-dnl
-dnl NOTE: You are assumed to not only compile your program with these
-dnl flags, but also link it with them as well. e.g. you should link
-dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
-dnl $LIBS
-dnl
-dnl If you are only building threads programs, you may wish to use
-dnl these variables in your default LIBS, CFLAGS, and CC:
-dnl
-dnl LIBS="$PTHREAD_LIBS $LIBS"
-dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-dnl CC="$PTHREAD_CC"
-dnl
-dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
-dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-dnl
-dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
-dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
-dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
-dnl default action will define HAVE_PTHREAD.
-dnl
-dnl Please let the authors know if this macro fails on any platform, or
-dnl if you have any other suggestions or comments. This macro was based
-dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
-dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
-dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
-dnl We are also grateful for the helpful feedback of numerous users.
-dnl
-dnl @category InstalledPackages
-dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
-dnl @version 2005-06-15
-dnl @license GPLWithACException
-
-AC_DEFUN([ACX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_SAVE
-AC_LANG_C
-acx_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
- AC_MSG_RESULT($acx_pthread_ok)
- if test x"$acx_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all, and "pthread-config"
-# which is a program returning the flags for the Pth emulation library.
-
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# ... -mt is also the pthreads flag for HP/aCC
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-# pthread-config: use pthread-config program (for GNU Pth library)
-
-case "${host_cpu}-${host_os}" in
- *solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthreads/-mt/
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
-
- acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
- ;;
-esac
-
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- pthread-config)
- AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
- if test x"$acx_pthread_config" = xno; then continue; fi
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [acx_pthread_ok=yes])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT($acx_pthread_ok)
- if test "x$acx_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- AC_MSG_CHECKING([for joinable pthread attribute])
- attr_name=unknown
- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
- [attr_name=$attr; break])
- done
- AC_MSG_RESULT($attr_name)
- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
- AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
- [Define to necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
- *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
- esac
- AC_MSG_RESULT(${flag})
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: must compile with cc_r
- AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
-else
- PTHREAD_CC="$CC"
-fi
-
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_CC)
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
- ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
- :
-else
- acx_pthread_ok=no
- $2
-fi
-AC_LANG_RESTORE
-])dnl ACX_PTHREAD
diff --git a/release-0.6.9/common/doxygen.m4 b/release-0.6.9/common/doxygen.m4
deleted file mode 100644
index e4688de..0000000
--- a/release-0.6.9/common/doxygen.m4
+++ /dev/null
@@ -1,312 +0,0 @@
-# This file is part of Autoconf. -*- Autoconf -*-
-
-# Copyright (C) 2004 Oren Ben-Kiki
-# This file is distributed under the same terms as the Autoconf macro files.
-
-# Generate automatic documentation using Doxygen. Works in concert with the
-# aminclude.m4 file and a compatible doxygen configuration file. Defines the
-# following public macros:
-#
-# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature.
-# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics,
-# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI'
-# for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF',
-# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment
-# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide'
-# paper size.
-#
-# By default, HTML, PDF and PS documentation is generated as this seems to be
-# the most popular and portable combination. MAN pages created by Doxygen are
-# usually problematic, though by picking an appropriate subset and doing some
-# massaging they might be better than nothing. CHM and RTF are specific for MS
-# (note that you can't generate both HTML and CHM at the same time). The XML is
-# rather useless unless you apply specialized post-processing to it.
-#
-# The macro mainly controls the default state of the feature. The use can
-# override the default by specifying --enable or --disable. The macros ensure
-# that contradictory flags are not given (e.g., --enable-doxygen-html and
-# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.)
-# Finally, each feature will be automatically disabled (with a warning) if the
-# required programs are missing.
-#
-# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with
-# the following parameters: a one-word name for the project for use as a
-# filename base etc., an optional configuration file name (the default is
-# 'Doxyfile', the same as Doxygen's default), and an optional output directory
-# name (the default is 'doxygen-doc').
-
-## ----------##
-## Defaults. ##
-## ----------##
-
-DX_ENV=""
-AC_DEFUN([DX_FEATURE_doc], ON)
-AC_DEFUN([DX_FEATURE_dot], ON)
-AC_DEFUN([DX_FEATURE_man], OFF)
-AC_DEFUN([DX_FEATURE_html], ON)
-AC_DEFUN([DX_FEATURE_chm], OFF)
-AC_DEFUN([DX_FEATURE_chi], OFF)
-AC_DEFUN([DX_FEATURE_rtf], OFF)
-AC_DEFUN([DX_FEATURE_xml], OFF)
-AC_DEFUN([DX_FEATURE_pdf], ON)
-AC_DEFUN([DX_FEATURE_ps], ON)
-
-## --------------- ##
-## Private macros. ##
-## --------------- ##
-
-# DX_ENV_APPEND(VARIABLE, VALUE)
-# ------------------------------
-# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
-AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
-
-# DX_DIRNAME_EXPR
-# ---------------
-# Expand into a shell expression prints the directory part of a path.
-AC_DEFUN([DX_DIRNAME_EXPR],
- [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
-
-# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
-# -------------------------------------
-# Expands according to the M4 (static) status of the feature.
-AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
-
-# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
-# ----------------------------------
-# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
-AC_DEFUN([DX_REQUIRE_PROG], [
-AC_PATH_TOOL([$1], [$2])
-if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
- AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
- AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0)
-fi
-])
-
-# DX_TEST_FEATURE(FEATURE)
-# ------------------------
-# Expand to a shell expression testing whether the feature is active.
-AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
-
-# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
-# -------------------------------------------------
-# Verify that a required features has the right state before trying to turn on
-# the DX_CURRENT_FEATURE.
-AC_DEFUN([DX_CHECK_DEPEND], [
-test "$DX_FLAG_$1" = "$2" \
-|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
- requires, contradicts) doxygen-DX_CURRENT_FEATURE])
-])
-
-# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
-# ----------------------------------------------------------
-# Turn off the DX_CURRENT_FEATURE if the required feature is off.
-AC_DEFUN([DX_CLEAR_DEPEND], [
-test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_[]DX_CURRENT_FEATURE], 0)
-])
-
-# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
-# CHECK_DEPEND, CLEAR_DEPEND,
-# REQUIRE, DO-IF-ON, DO-IF-OFF)
-# --------------------------------------------
-# Parse the command-line option controlling a feature. CHECK_DEPEND is called
-# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
-# otherwise CLEAR_DEPEND is called to turn off the default state if a required
-# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
-# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
-# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
-AC_DEFUN([DX_ARG_ABLE], [
- AC_DEFUN([DX_CURRENT_FEATURE], [$1])
- AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
- AC_ARG_ENABLE(doxygen-$1,
- [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
- [--enable-doxygen-$1]),
- DX_IF_FEATURE([$1], [don't $2], [$2]))],
- [
-case "$enableval" in
-#(
-y|Y|yes|Yes|YES)
- AC_SUBST([DX_FLAG_$1], 1)
- $3
-;; #(
-n|N|no|No|NO)
- AC_SUBST([DX_FLAG_$1], 0)
-;; #(
-*)
- AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
-;;
-esac
-], [
-AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
-$4
-])
-if DX_TEST_FEATURE([$1]); then
- $5
- :
-fi
-if DX_TEST_FEATURE([$1]); then
- AM_CONDITIONAL(DX_COND_$1, :)
- $6
- :
-else
- AM_CONDITIONAL(DX_COND_$1, false)
- $7
- :
-fi
-])
-
-## -------------- ##
-## Public macros. ##
-## -------------- ##
-
-# DX_XXX_FEATURE(DEFAULT_STATE)
-# -----------------------------
-AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
-AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
-AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
-AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
-AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
-AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
-AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
-
-# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
-# ---------------------------------------------------------
-# PROJECT also serves as the base name for the documentation files.
-# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
-AC_DEFUN([DX_INIT_DOXYGEN], [
-
-# Files:
-AC_SUBST([DX_PROJECT], [$1])
-AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
-AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
-
-# Environment variables used inside doxygen.cfg:
-DX_ENV_APPEND(SRCDIR, $srcdir)
-DX_ENV_APPEND(PROJECT, $DX_PROJECT)
-DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
-DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
-
-# Doxygen itself:
-DX_ARG_ABLE(doc, [generate any doxygen documentation],
- [],
- [],
- [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
- DX_REQUIRE_PROG([DX_PERL], perl)],
- [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
-
-# Dot for graphics:
-DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_DOT], dot)],
- [DX_ENV_APPEND(HAVE_DOT, YES)
- DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
- [DX_ENV_APPEND(HAVE_DOT, NO)])
-
-# Man pages generation:
-DX_ARG_ABLE(man, [generate doxygen manual pages],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_MAN, YES)],
- [DX_ENV_APPEND(GENERATE_MAN, NO)])
-
-# RTF file generation:
-DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_RTF, YES)],
- [DX_ENV_APPEND(GENERATE_RTF, NO)])
-
-# XML file generation:
-DX_ARG_ABLE(xml, [generate doxygen XML documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_XML, YES)],
- [DX_ENV_APPEND(GENERATE_XML, NO)])
-
-# (Compressed) HTML help generation:
-DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_HHC], hhc)],
- [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
- DX_ENV_APPEND(GENERATE_HTML, YES)
- DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
- [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
-
-# Seperate CHI file generation.
-DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
- [DX_CHECK_DEPEND(chm, 1)],
- [DX_CLEAR_DEPEND(chm, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_CHI, YES)],
- [DX_ENV_APPEND(GENERATE_CHI, NO)])
-
-# Plain HTML pages generation:
-DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
- [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
- [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
- [],
- [DX_ENV_APPEND(GENERATE_HTML, YES)],
- [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
-
-# PostScript file generation:
-DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_LATEX], latex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_DVIPS], dvips)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# PDF file generation:
-DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# LaTeX generation for PS and/or PDF:
-if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
- AM_CONDITIONAL(DX_COND_latex, :)
- DX_ENV_APPEND(GENERATE_LATEX, YES)
-else
- AM_CONDITIONAL(DX_COND_latex, false)
- DX_ENV_APPEND(GENERATE_LATEX, NO)
-fi
-
-# Paper size for PS and/or PDF:
-AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
- [a4wide (default), a4, letter, legal or executive])
-case "$DOXYGEN_PAPER_SIZE" in
-#(
-"")
- AC_SUBST(DOXYGEN_PAPER_SIZE, "")
-;; #(
-a4wide|a4|letter|legal|executive)
- DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
-;; #(
-*)
- AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
-;;
-esac
-
-#For debugging:
-#echo DX_FLAG_doc=$DX_FLAG_doc
-#echo DX_FLAG_dot=$DX_FLAG_dot
-#echo DX_FLAG_man=$DX_FLAG_man
-#echo DX_FLAG_html=$DX_FLAG_html
-#echo DX_FLAG_chm=$DX_FLAG_chm
-#echo DX_FLAG_chi=$DX_FLAG_chi
-#echo DX_FLAG_rtf=$DX_FLAG_rtf
-#echo DX_FLAG_xml=$DX_FLAG_xml
-#echo DX_FLAG_pdf=$DX_FLAG_pdf
-#echo DX_FLAG_ps=$DX_FLAG_ps
-#echo DX_ENV=$DX_ENV
-])
diff --git a/release-0.6.9/common/doxygen.mk b/release-0.6.9/common/doxygen.mk
deleted file mode 100644
index eca9237..0000000
--- a/release-0.6.9/common/doxygen.mk
+++ /dev/null
@@ -1,187 +0,0 @@
-# Copyright (C) 2004 Oren Ben-Kiki
-# This file is distributed under the same terms as the Automake macro files.
-
-# Generate automatic documentation using Doxygen. Goals and variables values
-# are controlled by the various DX_COND_??? conditionals set by autoconf.
-#
-# The provided goals are:
-# doxygen-doc: Generate all doxygen documentation.
-# doxygen-run: Run doxygen, which will generate some of the documentation
-# (HTML, CHM, CHI, MAN, RTF, XML) but will not do the post
-# processing required for the rest of it (PS, PDF, and some MAN).
-# doxygen-man: Rename some doxygen generated man pages.
-# doxygen-ps: Generate doxygen PostScript documentation.
-# doxygen-pdf: Generate doxygen PDF documentation.
-#
-# Note that by default these are not integrated into the automake goals. If
-# doxygen is used to generate man pages, you can achieve this integration by
-# setting man3_MANS to the list of man pages generated and then adding the
-# dependency:
-#
-# $(man3_MANS): doxygen-doc
-#
-# This will cause make to run doxygen and generate all the documentation.
-#
-# The following variable is intended for use in Makefile.am:
-#
-# DX_CLEANFILES = everything to clean.
-#
-# This is usually added to MOSTLYCLEANFILES.
-
-## --------------------------------- ##
-## Format-independent Doxygen rules. ##
-## --------------------------------- ##
-
-if DX_COND_doc
-
-## ------------------------------- ##
-## Rules specific for HTML output. ##
-## ------------------------------- ##
-
-if DX_COND_html
-
-DX_CLEAN_HTML = @DX_DOCDIR@/html
-
-endif DX_COND_html
-
-## ------------------------------ ##
-## Rules specific for CHM output. ##
-## ------------------------------ ##
-
-if DX_COND_chm
-
-DX_CLEAN_CHM = @DX_DOCDIR@/chm
-
-if DX_COND_chi
-
-DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
-
-endif DX_COND_chi
-
-endif DX_COND_chm
-
-## ------------------------------ ##
-## Rules specific for MAN output. ##
-## ------------------------------ ##
-
-if DX_COND_man
-
-DX_CLEAN_MAN = @DX_DOCDIR@/man
-
-endif DX_COND_man
-
-## ------------------------------ ##
-## Rules specific for RTF output. ##
-## ------------------------------ ##
-
-if DX_COND_rtf
-
-DX_CLEAN_RTF = @DX_DOCDIR@/rtf
-
-endif DX_COND_rtf
-
-## ------------------------------ ##
-## Rules specific for XML output. ##
-## ------------------------------ ##
-
-if DX_COND_xml
-
-DX_CLEAN_XML = @DX_DOCDIR@/xml
-
-endif DX_COND_xml
-
-## ----------------------------- ##
-## Rules specific for PS output. ##
-## ----------------------------- ##
-
-if DX_COND_ps
-
-DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
-
-DX_PS_GOAL = doxygen-ps
-
-doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
-
-@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_LATEX) refman.tex; \
- $(MAKEINDEX_PATH) refman.idx; \
- $(DX_LATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_LATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
-
-endif DX_COND_ps
-
-## ------------------------------ ##
-## Rules specific for PDF output. ##
-## ------------------------------ ##
-
-if DX_COND_pdf
-
-DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
-
-DX_PDF_GOAL = doxygen-pdf
-
-doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
-
-@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_PDFLATEX) refman.tex; \
- $(DX_MAKEINDEX) refman.idx; \
- $(DX_PDFLATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_PDFLATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- mv refman.pdf ../@PACKAGE@.pdf
-
-endif DX_COND_pdf
-
-## ------------------------------------------------- ##
-## Rules specific for LaTeX (shared for PS and PDF). ##
-## ------------------------------------------------- ##
-
-if DX_COND_latex
-
-DX_CLEAN_LATEX = @DX_DOCDIR@/latex
-
-endif DX_COND_latex
-
-.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
-
-doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS) $(DX_INPUT) $(DX_EXAMPLE_PATH)/$(DX_EXAMPLE_PATTERNS)
- rm -rf @DX_DOCDIR@
- INPUT='$(DX_INPUT)' EXAMPLE_PATH='$(DX_EXAMPLE_PATH)' EXAMPLE_PATTERNS='$(DX_EXAMPLE_PATTERNS)' \
- $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
-
-DX_CLEANFILES = \
- @DX_DOCDIR@/@PACKAGE@.tag \
- -r \
- $(DX_CLEAN_HTML) \
- $(DX_CLEAN_CHM) \
- $(DX_CLEAN_CHI) \
- $(DX_CLEAN_MAN) \
- $(DX_CLEAN_RTF) \
- $(DX_CLEAN_XML) \
- $(DX_CLEAN_PS) \
- $(DX_CLEAN_PDF) \
- $(DX_CLEAN_LATEX)
-
-endif DX_COND_doc
diff --git a/release-0.6.9/common/python.m4 b/release-0.6.9/common/python.m4
deleted file mode 100644
index e1c5266..0000000
--- a/release-0.6.9/common/python.m4
+++ /dev/null
@@ -1,62 +0,0 @@
-## this one is commonly used with AM_PATH_PYTHONDIR ...
-dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
-dnl Check if a module containing a given symbol is visible to python.
-AC_DEFUN([AM_CHECK_PYMOD],
-[AC_REQUIRE([AM_PATH_PYTHON])
-py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
-AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
-AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
-ifelse([$2],[], [prog="
-import sys
-try:
- import $1
-except ImportError:
- sys.exit(1)
-except:
- sys.exit(0)
-sys.exit(0)"], [prog="
-import $1
-$1.$2"])
-if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
- then
- eval "py_cv_mod_$py_mod_var=yes"
- else
- eval "py_cv_mod_$py_mod_var=no"
- fi
-])
-py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
-if test "x$py_val" != xno; then
- AC_MSG_RESULT(yes)
- ifelse([$3], [],, [$3
-])dnl
-else
- AC_MSG_RESULT(no)
- ifelse([$4], [],, [$4
-])dnl
-fi
-])
-
-dnl a macro to check for ability to create python extensions
-dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
-dnl function also defines PYTHON_INCLUDES
-AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
-[AC_REQUIRE([AM_PATH_PYTHON])
-AC_MSG_CHECKING(for headers required to compile python extensions)
-dnl deduce PYTHON_INCLUDES
-py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
-py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
-PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
-if test "$py_prefix" != "$py_exec_prefix"; then
- PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
-fi
-AC_SUBST(PYTHON_INCLUDES)
-dnl check if the headers exist:
-save_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
-AC_TRY_CPP([#include <Python.h>],dnl
-[AC_MSG_RESULT(found)
-$1],dnl
-[AC_MSG_RESULT(not found)
-$2])
-CPPFLAGS="$save_CPPFLAGS"
-])
diff --git a/release-0.6.9/configure.ac b/release-0.6.9/configure.ac
deleted file mode 100644
index bbb8545..0000000
--- a/release-0.6.9/configure.ac
+++ /dev/null
@@ -1,850 +0,0 @@
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AC_PREREQ(2.57)
-AC_INIT([avahi],[0.6.9],[avahi (at) lists (dot) freedesktop (dot) org])
-AC_CONFIG_SRCDIR([avahi-core/server.c])
-AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.9 -Wall])
-
-AC_SUBST(PACKAGE_URL, [http://avahi.org/])
-
-AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [6:0:3])
-AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [4:1:0])
-AC_SUBST(LIBAVAHI_CLIENT_VERSION_INFO, [4:1:1])
-AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:0:0])
-AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:1:0])
-AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:1:0])
-AC_SUBST(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO, [1:0:0])
-AC_SUBST(LIBAVAHI_COMPAT_HOWL_VERSION_INFO, [0:0:0])
-AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
-
-if type -p stow > /dev/null && test -d /usr/local/stow ; then
- AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
- ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
-fi
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_CXX
-AC_GNU_SOURCE
-AC_PROG_CPP
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-AC_PROG_GCC_TRADITIONAL
-
-# libtool stuff
-AC_PROG_LIBTOOL
-
-ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
-
-#
-# Check for netlink.h
-#
-AC_CHECK_HEADER(linux/netlink.h,
-HAVE_NETLINK=yes
-AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
-, [], [
-#include <sys/socket.h>
-#include <asm/types.h>
-])
-
-AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
-
-#
-# Check for net/route.h
-#
-AC_CHECK_HEADER(net/route.h,
-HAVE_PF_ROUTE=yes
-AC_DEFINE([HAVE_PF_ROUTE],[],[Support for PF_ROUTE])
-, [], [
-#include <sys/types.h>
-#include <sys/socket.h>
-])
-
-AM_CONDITIONAL(HAVE_PF_ROUTE, [ test x"$HAVE_PF_ROUTE" = xyes ])
-
-#
-# Check for struct ip_mreqn
-#
-AC_MSG_CHECKING(for struct ip_mreqn)
-AC_TRY_COMPILE([#include <netinet/in.h>], [
- struct ip_mreqn mreq;
- mreq.imr_address.s_addr = 0;
-], [
- # Yes, we have it...
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
-], [
- # We'll just have to try and use struct ip_mreq
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(for struct ip_mreq)
- AC_TRY_COMPILE([#include <netinet/in.h>], [
- struct ip_mreq mreq;
- mreq.imr_interface.s_addr = 0;
- ], [
- # Yes, we have it...
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
- ], [
- # No multicast support
- AC_MSG_RESULT(no)
- ])
-])
-
-#
-# Detecting the linux distribution for specific things like init scripts.
-#
-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of debian, gentoo, archlinux, fedora, mandriva, darwin, netbsd, freebsd, slackware or none]))
-if test "z$with_distro" = "z"; then
- AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
- AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
- AC_CHECK_FILE(/etc/arch-release,with_distro="archlinux")
- AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
- AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
- AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
- AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
- if test "z$with_distro" = "z"; then
- with_distro=`uname -s`
- fi
-fi
-with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
-
-case $with_distro in
- debian|gentoo|archlinux|suse|fedora|mandriva|darwin|freebsd|slackware|none)
- ;;
- netbsd)
- AC_MSG_WARN([Your distribution (${with_distro}) is supported but no init script exist yet! (patches welcome)])
- ;;
- linux)
- AC_MSG_ERROR([Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO, set DISTRO to none if your distribution is not supported.])
- ;;
- *)
- AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
- ;;
-esac
-
-AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
-AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
-AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
-AM_CONDITIONAL(TARGET_ARCHLINUX, test x"$with_distro" = xarchlinux)
-AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
-AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
-AM_CONDITIONAL(TARGET_DARWIN, test x"$with_distro" = xdarwin)
-AM_CONDITIONAL(TARGET_NETBSD, test x"$with_distro" = xnetbsd)
-AM_CONDITIONAL(TARGET_FREEBSD, test x"$with_distro" = xfreebsd)
-AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
-
-test_gcc_flag() {
- AC_LANG_CONFTEST([int main() {}])
- $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
- ret=$?
- rm -f conftest.o
- return $ret
-}
-
-# If using GCC specify some additional parameters
-if test "x$GCC" = "xyes" ; then
-
- DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline"
-
- if test "x$HAVE_NETLINK" = "xyes" ; then
- # Test whether rtnetlink.h can be included when compiled with -std=c99
- # some distributions (e.g. archlinux) have broken headers that dont
- # define __u64 with -std=c99
- AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
- OLDCFLAGS="$CFLAGS"
- CFLAGS="-std=c99"
- AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
- use_stdc99=yes, use_stdc99=no)
-
- if test x"$use_stdc99" = xyes; then
- DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
-
- CFLAGS="$OLDCFLAGS"
- else
- DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
- fi
-
- for flag in $DESIRED_FLAGS ; do
- AC_MSG_CHECKING([whether $CC accepts $flag])
- if test_gcc_flag $flag ; then
- CFLAGS="$CFLAGS $flag"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- done
-fi
-
-# Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h netdb.h syslog.h])
-AC_HEADER_STDBOOL
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_HEADER_SYS_WAIT
-
-# Checks for library functions.
-AC_FUNC_MEMCMP
-AC_FUNC_SELECT_ARGTYPES
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
-AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid setresgid setregid strcasecmp gettimeofday putenv strncasecmp strlcpy gethostbyname seteuid setegid setproctitle getprogname])
-
-AC_FUNC_CHOWN
-AC_FUNC_STAT
-AC_TYPE_MODE_T
-AC_TYPE_PID_T
-
-AC_CHECK_DECLS(environ)
-
-enable_chroot=yes
-AC_CHECK_HEADERS([sys/capability.h],,enable_chroot=no)
-AC_CHECK_HEADERS([sys/prctl.h],,enable_chroot=no)
-AC_CHECK_FUNCS([chroot],,enable_chroot=no)
-
-AM_CONDITIONAL(ENABLE_CHROOT, test "x$enable_chroot" = "xyes")
-
-if test "x$enable_chroot" = "xyes" ; then
- AC_DEFINE([ENABLE_CHROOT], 1, [Enable chroot() usage])
-fi
-
-AC_CHECK_LIB(dl, dlopen, [ AC_CHECK_HEADERS(dlfcn.h, HAVE_DLOPEN=yes, HAVE_DLOPEN=no) ], HAVE_DLOPEN=no)
-if test "x$HAVE_DLOPEN" = "xyes" ; then
- AC_DEFINE([HAVE_DLOPEN],1,[Have dlopen()])
-fi
-AM_CONDITIONAL(HAVE_DLOPEN, test "x$HAVE_DLOPEN" = "xyes")
-
-# Check for pkg-config manually first, as if its not installed the
-# PKG_PROG_PKG_CONFIG macro won't be defined.
-AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
-
-if test x"$have_pkg_config" = "xno"; then
- AC_MSG_ERROR(pkg-config is required to install this program)
-fi
-
-PKG_PROG_PKG_CONFIG
-
-#
-# Check for GLIB 2.0
-#
-AC_ARG_ENABLE(glib,
- AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
- [case "${enableval}" in
- yes) HAVE_GLIB=yes ;;
- no) HAVE_GLIB=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
- esac],
- [HAVE_GLIB=yes])
-
-if test "x$HAVE_GLIB" = "xyes" ; then
- PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
- AC_SUBST(GLIB20_CFLAGS)
- AC_SUBST(GLIB20_LIBS)
-fi
-AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
-
-#
-# Check for Qt 3
-#
-AC_ARG_ENABLE(qt3,
- AS_HELP_STRING([--disable-qt3],[Disable building of Qt3 mainloop integration]),
- [case "${enableval}" in
- yes) HAVE_QT3=yes ;;
- no) HAVE_QT3=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt3) ;;
- esac],
- [HAVE_QT3=yes])
-
-if test "x$HAVE_QT3" = "xyes" ; then
- PKG_CHECK_MODULES( QT3, [ qt-mt >= 3.0.0 ])
- AC_SUBST(QT3_CFLAGS)
- AC_SUBST(QT3_LIBS)
- QT3_PREFIX="`$PKG_CONFIG --variable=prefix qt-mt`/bin"
- MOC_QT3="no"
- AC_CHECK_FILE( "$QT3_PREFIX/moc-qt3", [ MOC_QT3=$QT3_PREFIX/moc-qt3 ], [
- AC_CHECK_FILE("$QT3_PREFIX/moc", [ MOC_QT3=$QT3_PREFIX/moc ], [
- AC_MSG_ERROR([Couldn't find QT3 moc])])])
- AC_SUBST(MOC_QT3)
-fi
-AM_CONDITIONAL(HAVE_QT3, test "x$HAVE_QT3" = "xyes")
-
-#
-# Check for Qt 4
-#
-AC_ARG_ENABLE(qt4,
- AS_HELP_STRING([--disable-qt4],[Disable building of Qt4Core mainloop integration]),
- [case "${enableval}" in
- yes) HAVE_QT4=yes ;;
- no) HAVE_QT4=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt4) ;;
- esac],
- [HAVE_QT4=yes])
-
-if test "x$HAVE_QT4" = "xyes" ; then
- PKG_CHECK_MODULES( QT4, [ QtCore >= 4.0.0 ])
- AC_SUBST(QT4_CFLAGS)
- AC_SUBST(QT4_LIBS)
- QT4_PREFIX="`$PKG_CONFIG --variable=prefix QtCore`/bin"
- MOC_QT4="no"
- AC_CHECK_FILE( "$QT4_PREFIX/moc-qt4", [ MOC_QT4=$QT4_PREFIX/moc-qt4 ], [
- AC_CHECK_FILE("$QT4_PREFIX/moc", [ MOC_QT4=$QT4_PREFIX/moc ], [
- AC_MSG_ERROR([Couldn't find QT4 moc])])])
- AC_SUBST(MOC_QT4)
-fi
-AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
-
-#
-# Check for GTK+
-#
-AC_ARG_ENABLE(gtk,
- AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
- [case "${enableval}" in
- yes) HAVE_GTK=yes ;;
- no) HAVE_GTK=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
- esac],
- [HAVE_GTK=yes])
-
-if test "x$HAVE_GTK" = "xyes" ; then
- # Check for GTK 2.0
- PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
- AC_SUBST(GTK20_CFLAGS)
- AC_SUBST(GTK20_LIBS)
-
- # Check for GLADE 2.0
- PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
- AC_SUBST(GLADE20_CFLAGS)
- AC_SUBST(GLADE20_LIBS)
-fi
-AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
-
-#
-# D-BUS
-#
-AC_ARG_ENABLE(dbus,
- AS_HELP_STRING([--disable-dbus],[Disable use of D-BUS]),
- [case "${enableval}" in
- yes) HAVE_DBUS=yes ;;
- no) HAVE_DBUS=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
- esac],
- [HAVE_DBUS=yes])
-
-AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
-AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=<address>], [where the dbus system socket is, you probably want to put unix:path= at the start]))
-
-DBUS_VERSION="Disabled"
-DBUS_SYS_DIR="Disabled"
-DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="Disabled"
-if test "x$HAVE_DBUS" = "xyes" ; then
- PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.34 ])
-
- AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not])
-
- DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
- DBUS_VERSION_MAJOR=`echo $DBUS_VERSION | awk -F. '{print $1}'`
- DBUS_VERSION_MINOR=`echo $DBUS_VERSION | awk -F. '{print $2}'`
- DBUS_VERSION_MICRO=`echo $DBUS_VERSION | awk -F. '{print $3}'`
- if test "z$DBUS_VERSION_MAJOR" = "z"; then
- DBUS_VERSION_MAJOR="0"
- fi
- if test "z$DBUS_VERSION_MINOR" = "z"; then
- DBUS_VERSION_MINOR="0"
- fi
- if test "z$DBUS_VERSION_MICRO" = "z"; then
- DBUS_VERSION_MICRO="0"
- fi
-
- if test "z$DBUS_VERSION_MAJOR" = "z0" -a "z$DBUS_VERSION_MINOR" = "z0" -a "z$DBUS_VERSION_MICRO" = "z0"; then
- echo "Error: Couldn't determine the version of your DBUS package."
- echo " This is probably an error in this script, please report it"
- echo " along with the following information:"
- echo " Base DBUS version ='$DBUS_VERSION'"
- echo " DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
- echo " DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
- echo " DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
- exit 1
- else
- echo "Your dbus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
- fi
-
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
- AC_SUBST(DBUS_CFLAGS)
- AC_SUBST(DBUS_LIBS)
-
- if ! test -z "$with_dbus_sys" ; then
- DBUS_SYS_DIR="$with_dbus_sys"
- else
- DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
- fi
- AC_SUBST(DBUS_SYS_DIR)
-
- if ! test -z "$with_dbus_system_address" ; then
- DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$with_dbus_system_address"
- else
- # This is ugly, but D-BUS doesn't export this address for us
- # so we have to guess, pretty much all setups i've seen have
- # it in /var/lib/dbus or /var/run/dbus, and its defaulted to
- # /var/run upstream so we will try guess first then default
- # to /var/run/dbus
-
- DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"
- TRY_SOCKETS="/var/lib/dbus/system_bus_socket /var/run/dbus/system_bus_socket ${localstatedir}/run/dbus/system_bus_socket ${prefix}/var/run/dbus/system_bus_socket"
- for sock in $TRY_SOCKETS; do
- if test -S $sock; then
- DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$sock"
- fi
- done
- fi
- AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
-
-fi
-AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
-
-#
-# Expat
-#
-AC_ARG_ENABLE(expat,
- AS_HELP_STRING([--disable-expat],[Disable use of Expat]),
- [case "${enableval}" in
- yes) HAVE_EXPAT=yes ;;
- no) HAVE_EXPAT=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-expat) ;;
- esac],
- [HAVE_EXPAT=yes])
-
-if test "x$HAVE_EXPAT" = "xyes" ; then
- AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
-
- if ! $have_expat ; then
- AC_MSG_ERROR([*** libexpat not found ***])
- fi
-fi
-AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
-
-#
-# GDBM
-#
-AC_ARG_ENABLE(gdbm,
- AS_HELP_STRING([--disable-gdbm],[Disable use of GDBM]),
- [case "${enableval}" in
- yes) HAVE_GDBM=yes ;;
- no) HAVE_GDBM=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbm) ;;
- esac],
- [HAVE_GDBM=yes])
-
-if test "x$HAVE_GDBM" = "xyes" ; then
- AC_CHECK_LIB(gdbm, gdbm_open, [ AC_CHECK_HEADERS(gdbm.h, have_gdbm=true, have_gdbm=false) ], have_gdbm=false)
-
- if ! $have_gdbm ; then
- AC_MSG_ERROR([*** libgdbm not found ***])
- fi
- AC_DEFINE([HAVE_GDBM],[],[Support for GDBM])
-fi
-AM_CONDITIONAL(HAVE_GDBM, test "x$HAVE_GDBM" = "xyes")
-
-#
-# libdaemon
-#
-AC_ARG_ENABLE(libdaemon,
- AS_HELP_STRING([--disable-libdaemon],[Disable use of libdaemon]),
- [case "${enableval}" in
- yes) HAVE_LIBDAEMON=yes ;;
- no) HAVE_LIBDAEMON=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
- esac],
- [HAVE_LIBDAEMON=yes])
-
-if test "x$HAVE_LIBDAEMON" = "xyes" ; then
- PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
- AC_SUBST(LIBDAEMON_CFLAGS)
- AC_SUBST(LIBDAEMON_LIBS)
-fi
-AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
-
-#
-# Python stuff
-#
-AC_ARG_ENABLE(python,
- AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
- [case "${enableval}" in
- yes) HAVE_PYTHON=yes ;;
- no) HAVE_PYTHON=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
- esac],[HAVE_PYTHON=yes])
-
-HAVE_PYTHON_DBUS=no
-HAVE_PYGTK=no
-
-if test "x$HAVE_PYTHON" = "xyes" ; then
- AM_PATH_PYTHON([2.4])
-
- AC_ARG_ENABLE(pygtk,
- AS_HELP_STRING([--disable-pygtk],[Disable use of GTK in Python]),
- [case "${enableval}" in
- yes) HAVE_PYGTK=yes ;;
- no) HAVE_PYGTK=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-pygtk) ;;
- esac],
- [HAVE_PYGTK=yes])
-
- if test "x$HAVE_PYGTK" = "xyes" ; then
- AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module gtk)])
- fi
-
-
- if test "x$HAVE_DBUS" = "xyes" ; then
- AC_ARG_ENABLE(python-dbus,
- AS_HELP_STRING([--disable-python-dbus],[Disable use of D-BUS in Python]),
- [case "${enableval}" in
- yes) HAVE_PYTHON_DBUS=yes ;;
- no) HAVE_PYTHON_DBUS=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-python-dbus) ;;
- esac],
- [HAVE_PYTHON_DBUS=yes])
-
- if test "x$HAVE_PYTHON_DBUS" = "xyes"; then
- AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
- fi
-
- AM_CHECK_PYMOD(socket,,,[AC_MSG_ERROR(Could not find Python module socket)])
- AM_CHECK_PYMOD(gdbm,,,[AC_MSG_ERROR(Could not find Python module gdbm)])
- fi
-fi
-AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
-AM_CONDITIONAL(HAVE_PYGTK, test "x$HAVE_PYGTK" = "xyes")
-AM_CONDITIONAL(HAVE_PYTHON_DBUS, test "x$HAVE_PYTHON_DBUS" = "xyes")
-
-#
-# Check for mono stuff
-#
-HAVE_MONO=no
-if test "x$HAVE_DBUS" = "xyes" ; then
- AC_ARG_ENABLE(mono,
- AS_HELP_STRING([--disable-mono],[Disable mono bindings]),
- [case "${enableval}" in
- yes) HAVE_MONO=yes ;;
- no) HAVE_MONO=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-mono) ;;
- esac],
- [HAVE_MONO=yes])
-
- if test "x$HAVE_MONO" = "xyes" ; then
- AC_PATH_PROG(MCS, mcs)
- if test "x$MCS" = "x" ; then
- AC_MSG_ERROR([Can not find "mcs" in your PATH])
- fi
-
- AC_PATH_PROG(GACUTIL, gacutil)
- if test "x$GACUTIL" = "x" ; then
- AC_MSG_ERROR([Can not find "gacutil" in your PATH])
- fi
-
- AC_SUBST(MCS)
- AC_SUBST(GACUTIL)
- fi
-fi
-AM_CONDITIONAL(HAVE_MONO, test "x$HAVE_MONO" = "xyes")
-
-#
-# Check for monodoc stuff
-#
-HAVE_MONODOC=no
-AC_ARG_ENABLE(monodoc,
- AS_HELP_STRING([--disable-monodoc],[Disable documentation for mono bindings]),
- [case "${enableval}" in
- yes) HAVE_MONODOC=yes ;;
- no) HAVE_MONODOC=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-monodoc) ;;
- esac],
- [HAVE_MONODOC=yes])
-
-if test "x$HAVE_MONO" = "xyes" && test "x$HAVE_MONODOC" = "xyes" ; then
- PKG_CHECK_MODULES(MONODOC, [monodoc >= 1.1.8])
- MONODOC_DIR=`$PKG_CONFIG --variable=sourcesdir monodoc`
-
- AC_PATH_PROG(MONODOCER, monodocer)
- AC_PATH_PROG(MDASSEMBLER, mdassembler)
-
- AC_SUBST(MONODOC_DIR)
- AC_SUBST(MONODOCER)
- AC_SUBST(MDASSEMBLER)
-fi
-AM_CONDITIONAL(HAVE_MONODOC, test "x$HAVE_MONODOC" = "xyes")
-
-#
-# Defining Avahi User and Group.
-#
-AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running the Avahi daemon (avahi)]))
-if test -z "$with_avahi_user" ; then
- AVAHI_USER=avahi
-else
- AVAHI_USER=$with_avahi_user
-fi
-AC_SUBST(AVAHI_USER)
-AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
-
-AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for Avahi (avahi)]))
-if test -z "$with_avahi_group" ; then
- AVAHI_GROUP=avahi
-else
- AVAHI_GROUP=$with_avahi_group
-fi
-AC_SUBST(AVAHI_GROUP)
-AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
-
-#
-# Avahi runtime dir
-#
-avahi_runtime_dir="${localstatedir}/run"
-avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
-AC_SUBST(avahi_runtime_dir)
-AC_SUBST(avahi_socket)
-
-#
-# Avahi interfaces dir
-#
-if test "x$HAVE_PYTHON_DBUS" = "xyes" -o "x$HAVE_GTK" = "xyes"; then
- interfacesdir="${datadir}/${PACKAGE}/interfaces/"
- AC_SUBST(interfacesdir)
-fi
-
-#
-# Doxygen
-#
-DX_HTML_FEATURE(ON)
-DX_CHM_FEATURE(OFF)
-DX_CHI_FEATURE(OFF)
-DX_MAN_FEATURE(OFF)
-DX_RTF_FEATURE(OFF)
-DX_XML_FEATURE(OFF)
-DX_PDF_FEATURE(OFF)
-DX_PS_FEATURE(OFF)
-DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
-
-#
-# Build and Install man pages
-#
-AC_ARG_ENABLE(manpages,
- AS_HELP_STRING([--disable-manpages],[Disable building and installation of man pages]),
-[case "${enableval}" in
- yes) manpages=yes ;;
- no) manpages=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-manpages]) ;;
-esac],[manpages=yes])
-
-if test x$manpages = xyes ; then
- #
- # XMLTOMAN manpage generation
- #
- AC_ARG_ENABLE(xmltoman,
- AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
- [case "${enableval}" in
- yes) xmltoman=yes ;;
- no) xmltoman=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
- esac],[xmltoman=yes])
-
- if test x$xmltoman = xyes ; then
- AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
- fi
-
- if test x$have_xmltoman = xno -o x$xmltoman = xno; then
- if ! test -e man/avahi-daemon.8 ; then
- AC_MSG_ERROR([*** xmltoman was not found or was disabled, it is required to build the manpages as they have not been pre-built, install xmltoman, pass --disable-manpages or dont pass --disable-xmltoman])
- exit 1
- fi
- AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
- xmltoman=no
- fi
-fi
-AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
-AM_CONDITIONAL([BUILD_MANPAGES], [test "x$manpages" = xyes])
-
-#
-# Conditionally compile test and example programs
-#
-AC_ARG_ENABLE(tests,
- AS_HELP_STRING([--enable-tests],[Enable building of tests and examples]),
- [case "${enableval}" in
- yes) ENABLE_TESTS=yes ;;
- no) ENABLE_TESTS=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
- esac],
- [ENABLE_TESTS=no])
-
-AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
-
-#
-# Optionally enable libdns_sd compatibility support
-#
-AC_ARG_ENABLE(compat-libdns_sd,
- AS_HELP_STRING([--enable-compat-libdns_sd],[Enable compatibility layer for libdns_sd]),
- [case "${enableval}" in
- yes) ENABLE_COMPAT_LIBDNS_SD=yes ;;
- no) ENABLE_COMPAT_LIBDNS_SD=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-libdns_sd) ;;
- esac],
- [ENABLE_COMPAT_LIBDNS_SD=no])
-
-AM_CONDITIONAL([ENABLE_COMPAT_LIBDNS_SD], [test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes"])
-
-#
-# Optionally enable HOWL compatibility support
-#
-AC_ARG_ENABLE(compat-howl,
- AS_HELP_STRING([--enable-compat-howl],[Enable compatibility layer for HOWL]),
- [case "${enableval}" in
- yes) ENABLE_COMPAT_HOWL=yes ;;
- no) ENABLE_COMPAT_HOWL=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-howl) ;;
- esac],
- [ENABLE_COMPAT_HOWL=no])
-
-AM_CONDITIONAL([ENABLE_COMPAT_HOWL], [test "x$ENABLE_COMPAT_HOWL" = "xyes"])
-
-
-# ==========================================================================
-AC_CONFIG_FILES([
-Makefile
-avahi-common/Makefile
-avahi-core/Makefile
-avahi-glib/Makefile
-avahi-qt/Makefile
-avahi-daemon/Makefile
-avahi-daemon/avahi-dbus.conf
-avahi-discover-standalone/Makefile
-avahi-client/Makefile
-initscript/Makefile
-initscript/debian/Makefile
-initscript/gentoo/Makefile
-initscript/archlinux/Makefile
-initscript/suse/Makefile
-initscript/fedora/Makefile
-initscript/mandriva/Makefile
-initscript/darwin/Makefile
-initscript/freebsd/Makefile
-initscript/slackware/Makefile
-avahi-dnsconfd/Makefile
-avahi-utils/Makefile
-avahi-python/Makefile
-avahi-python/avahi/Makefile
-examples/Makefile
-common/Makefile
-man/Makefile
-tests/Makefile
-service-type-database/Makefile
-avahi-sharp/Makefile
-avahi-compat-libdns_sd/Makefile
-avahi-compat-howl/Makefile
-avahi-compat-howl/samples/Makefile
-])
-AC_OUTPUT
-
-# ==========================================================================
-echo "
- ---{ $PACKAGE_NAME $VERSION }---
-
- prefix: ${prefix}
- sysconfdir: ${sysconfdir}
- localstatedir: ${localstatedir}
- avahi socket: ${avahi_socket}
- dbus-1 system.d dir: ${DBUS_SYS_DIR}
- dbus-1 version: ${DBUS_VERSION}
- dbus-1 system socket ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
- compiler: ${CC}
- cflags: ${CFLAGS}
- Enable GLIB: ${HAVE_GLIB}
- Enable GTK: ${HAVE_GTK}
- Enable D-BUS: ${HAVE_DBUS}
- Enable Expat: ${HAVE_EXPAT}
- Enable GDBM: ${HAVE_GDBM}
- Enable libdaemon: ${HAVE_LIBDAEMON}
- Enable Python: ${HAVE_PYTHON}
- Enable pygtk: ${HAVE_PYGTK}
- Enable python-dbus: ${HAVE_PYTHON_DBUS}
- Enable QT3: ${HAVE_QT3}
- Enable QT4: ${HAVE_QT4}
- Enable Mono: ${HAVE_MONO}
- Enable Monodoc: ${HAVE_MONODOC}
- Distribution/OS: ${with_distro}
- User for Avahi: ${AVAHI_USER}
- Group for Avahi: ${AVAHI_GROUP}
- Enable chroot(): ${enable_chroot}
-"
-
-BUILD_DAEMON="no (You need libdaemon and expat!)"
-
-if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
- BUILD_DAEMON=yes
-fi
-
-BUILD_PYTHON="no (You need python, pygtk and python-dbus!)"
-
-if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" -a "x$HAVE_PYTHON_DBUS" = "xyes" -a "x$HAVE_PYGTK" = "xyes" ; then
- BUILD_PYTHON=yes
-fi
-
-BUILD_CLIENT="no (You need avahi-daemon and dbus!)"
-
-if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" ; then
- BUILD_CLIENT=yes
-fi
-
-if test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
- ENABLE_COMPAT_LIBDNS_SD="no (You need libavahi-client!)"
-fi
-if test "x$ENABLE_COMPAT_HOWL" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
- ENABLE_COMPAT_HOWL="no (You need libavahi-client!)"
-fi
-
-
-echo "\
- Building libavahi-core yes
- Building avahi-daemon: ${BUILD_DAEMON}
- Building avahi-dnsconfd: ${BUILD_DAEMON}
- Building libavahi-client: ${BUILD_CLIENT}
- Building avahi-utils: ${BUILD_CLIENT}
- Building avahi-python: ${BUILD_PYTHON}
- Building libavahi-glib: ${HAVE_GLIB}
- Building avahi-discover-standalone: ${HAVE_GTK}
- Building libavahi-qt3: ${HAVE_QT3}
- Building libavahi-qt4: ${HAVE_QT4}
- Building avahi-sharp: ${HAVE_MONO}
- Building avahi-compat-libdns_sd: ${ENABLE_COMPAT_LIBDNS_SD}
- Building avahi-compat-howl: ${ENABLE_COMPAT_HOWL}
- Building tests: ${ENABLE_TESTS}
-"
diff --git a/release-0.6.9/docs/API-CHANGES-0.6 b/release-0.6.9/docs/API-CHANGES-0.6
deleted file mode 100644
index c29dd56..0000000
--- a/release-0.6.9/docs/API-CHANGES-0.6
+++ /dev/null
@@ -1,77 +0,0 @@
--*-text-*-
-
-
-A terse (and incomplete) list of API changes between 0.5.2 and 0.6:
-
- * Most browsing and registration functions and their callbacks gained
- new "flags" parameters. Passing 0 results in similar behaviour as
- in 0.5.2
-
- * avahi-client/client.h has been split into client.h, publish.h and lookup.h
-
- * avahi-core/core.h has been split into core.h publish.h lookup.h
-
- * avahi_client_is_service_local() has been removed. Use instead the special
- flags AVAHI_LOOKUP_RESULT_LOCAL and AVAHI_LOOKUP_RESULT_OUR_OWN which are
- set when resolving or browsing for services. AVAHI_LOOKUP_RESULT_OUR_OWN is
- what most people should use.
-
- * AVAHI_RESOLVER_TIMEOUT and AVAHI_RESOLVER_NOT_FOUND have been
- removed. Instead AVAHI_RESOLVER_FAILURE is used and the exact error
- code is available from avahi_client_errno()/avahi_server_errno()
-
- * The events AVAHI_BROWSER_CACHE_EXHAUSTED, AVAHI_BROWSER_ALL_FOR_NOW
- have been introduced. Failures during browsing are now passed as
- AVAHI_BROWSER_FAILURE and the error code is made available through
- avahi_client_errno()/avahi_server_errno().
-
- * The server gained a new state AVAHI_SERVER_FAILURE if some fatal
- error happens. The reason can be found in
- avahi_server_errno(). Clients can safely ignore this state.
-
- * You can now update existing records by setting the
- AVAHI_PUBLISH_UPDATE flags for add_service() and friends. Consider
- using avahi_server_update_service_txt_strlst() if you need to
- update only the TXT record for a service.
-
- * Proper support for service subtypes is now available. Use
- avahi_server_add_service_subtype() for that.
-
- * Entry groups gained the new state AVAHI_ENTRY_GROUP_FAILURE. The
- reason is available using
- avahi_server_errno()/avahi_client_errno().
-
- * Many superfluous functions have been removed from the public API or
- entirely.
-
- * avahi_simple_poll_iterate() has been split up into three
- functions. avahi_simple_poll_loop() has been introduced.
-
- * Some new limits have been introduced: AVAHI_ADDRESS_STR_MAX,
- AVAHI_DOMAIN_NAME_MAX, AVAHI_LABEL_MAX
-
- * The functions avahi_service_name_join() and
- avahi_service_name_split() have been introduced.
-
- * AVAHI_ERR_LOCAL_COLLISION has been renamed to AVAHI_ERR_COLLSION
-
- * The values of AVAHI_PROTO_xxx have changed, they are no longer
- identical to the BSD AF_xxx constants
-
- * avahi_client_new() now takes an additional flags parameter. Most
- interesting flag here is AVAHI_CLIENT_NO_FAIL, which can be used to
- create an AvahiClient object even when the daemon is not
- running. This is useful to deal with daemon restarts.
-
- * AvahiClient gained a new state AVAHI_CLIENT_FAILURE. (superseding
- AVAHI_CLIENT_DISCONNECTED). If this event happens,
- avahi_client_errno() will return the reason. If the error returned
- is AVAHI_ERR_DISCONNECTED, the situation where
- AVAHI_CLIENT_DISCONNECTED was previously thrown is entered. You may
- choose to reconnect in that case by freeing your AvahiClient new
- and create a new one with passing AVAHI_CLIENT_NO_FAIL.
-
- * There's now a client side AvahiRecordBrowser, and
- avahi_entry_group_add_record().
-
-$Id$
diff --git a/release-0.6.9/docs/AUTHORS b/release-0.6.9/docs/AUTHORS
deleted file mode 100644
index 69e56f2..0000000
--- a/release-0.6.9/docs/AUTHORS
+++ /dev/null
@@ -1,12 +0,0 @@
-If you wish to contact the developers, you can mail our mailing list
- avahi@freedesktop.org
-For more information and how to subscribe, see
- http://lists.freedesktop.org/mailman/listinfo/avahi
-
-Lennart Poettering
-Trent Lloyd <lathiat@bur.st>
-Sebastien Estienne <sebastien.estienne@gmail.com>
-Jakub Stachowski
-James Willcox <snorp@snorp.net>
-
-$Id$
diff --git a/release-0.6.9/docs/COMPAT-LAYERS b/release-0.6.9/docs/COMPAT-LAYERS
deleted file mode 100644
index 050c988..0000000
--- a/release-0.6.9/docs/COMPAT-LAYERS
+++ /dev/null
@@ -1,18 +0,0 @@
-Avahi 0.6.1 and above offer full API and ABI compatibility with HOWL
-and Bonjour out-of-the-box. To enable this you pass
---enable-compat-libdns_sd and/or --enable-compat-howl to the configure
-script. The build system installs both a shared library libdns_sd.so
-and one named libhowl.so. These files might overwrite the original
-implementations, so take care!
-
-Distributors that want full build system compatibility in addition to
-ABI/API compatibility should:
-
- 1) Symlink the pkg-config file avahi-compat-howl.pc to howl.pc
-
- 2) Symlink $(includedir)/avahi-compat-libdns_sd/dns_sd.h to
- $(includedir)/dns_sd.h
-
--- Lennart
-
-$Id$
diff --git a/release-0.6.9/docs/DBUS-API b/release-0.6.9/docs/DBUS-API
deleted file mode 100644
index 99e16da..0000000
--- a/release-0.6.9/docs/DBUS-API
+++ /dev/null
@@ -1,15 +0,0 @@
-$Id$
-
-* NOTE *
-This file used to contain an overview of the DBUS API for Avahi, however
-since it was no longer up to date you should now read the XML-formatted DBUS
-Introspection files, which are fairly easy to understand and kept up to date.
-
-You can see them in the avahi-daemon source directory, named *.introspect.
-
-Opening them in a web browser is a good way to view them as they are formatted
-nicely, you can also view our online copy under "Developing with Avahi" here:
-
-http://avahi.org/
-
- - Lathiat
diff --git a/release-0.6.9/docs/HACKING b/release-0.6.9/docs/HACKING
deleted file mode 100644
index eec7eb7..0000000
--- a/release-0.6.9/docs/HACKING
+++ /dev/null
@@ -1,91 +0,0 @@
-Please comply with the following rules when hacking on Avahi:
-
- * When you add a new textual file to the repository please enable SVN
- keyword expansion for it:
-
- svn ps svn:keywords Id foo.c
-
- * Before commiting check with "svn st" that all built files are ignored
- by svn. To change the list of ignored files use
-
- svn pe svn:ignore .
-
- This is similar to the ".cvsignore" file in CVS times.
-
- * Don't forget to add the autoconf config.h inclusion to all C source files:
-
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
-
- This needs to be placed in in .c files only. NOT IN HEADER FILES!
-
- * Don't hardcode any paths in source files. Either use the -D option of gcc
- for C sources or use "sed" to replace them based on a .in file.
-
- * Never forget that Avahi should be buildable without DBUS, GTK or python!
-
- * Before commiting, test your code! In case of C consider running it
- a few times through valgrind, to make sure that you got everything
- right. You have to call libtool explicitly when running valgrind
- on binaries that depend on shared objects. e.g:
-
- libtool --mode=execute valgrind ./avahi-daemon
-
- Please note that valgrind can't find you all bugs. Please check
- your code thrice with your brain before committing. Valgrind is
- only a final check.
-
- * Whenever you add a new Makefile.am, C (.c or .h) source file, shell or
- python script please add this legal blurb to its header:
-
- For Makefile.am, python and shell code:
-
-<snip>
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-</snip>
-
- For C source code:
-
-<snip>
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-</snip>
-
-
-$Id$
diff --git a/release-0.6.9/docs/INSTALL b/release-0.6.9/docs/INSTALL
deleted file mode 100644
index 387235c..0000000
--- a/release-0.6.9/docs/INSTALL
+++ /dev/null
@@ -1,52 +0,0 @@
-*** Quick install instructions (tested on Debian/Ubuntu only!) ***
-
-While "configure" and "make" may be run as normal user all other commands
-need to be run as root.
-
-Configure the build system:
- $ ./configure --sysconfdir=/etc --localstatedir=/var
-
-Some configure options available:
-
- --disable-gtk disable GTK+ tools (default: enabled)
- --disable-dbus disable DBUS support (default: enabled)
- --disable-python disable building python modules (default: enabled)
- --with-dbus-sys=<dir> where D-BUS system.d directory is
- --with-distro=<distro> the target Linux distribution (one of redhat,
- suse, gentoo, debian or slackware)
- --with-avahi-user=<user> User for running the Avahi daemon (avahi)
- --with-avahi-group=<grp> Group for Avahi (avahi)
-
- Please note that by disabling DBUS you lose the ability to publish and browse
- services from local applications.
-
- Please note that Avahi currently ships with a init scripts for only a few
- distributions. if yours is not supported right now, YMMV. Patches welcome.
-
- $ make
- # make install
- # ldconfig
-
-Add a user an a group for avahi. (Debian specific)
- # addgroup --system avahi
- # adduser --system --no-create-home --ingroup avahi avahi
-
-Ask DBUS to re-read its policies:
- # kill -HUP `cat /var/run/dbus/pid`
-
-Now start the Avahi daemon:
- # /etc/init.d/avahi-daemon start
-
-Optionally start the unicast DNS configuration daemon:
- # /etc/init.d/avahi-dnsconfd start
-
-To start the two daemons at boot time on Debian based distributions:
- with DBUS support:
- # ln -s /etc/init.d/avahi-daemon /etc/dbus-1/event.d/75avahi-daemon
- # ln -s /etc/init.d/avahi-dnsconfd /etc/dbus-1/event.d/76avahi-dnsconfd
-
- without DBUS support:
- # update-rc.d avahi-daemon defaults 25 15
- # update-rc.d avahi-dnsconfd defaults 26 14
-
-$Id$
diff --git a/release-0.6.9/docs/MALLOC b/release-0.6.9/docs/MALLOC
deleted file mode 100644
index 5c7db9e..0000000
--- a/release-0.6.9/docs/MALLOC
+++ /dev/null
@@ -1,10 +0,0 @@
-Avahi supports pluggable memory allocator implemenations. See
-<avahi-common/malloc.h> for more information.
-
-Currently, Avahi does not deal well with out-of-memory
-situations. Therefore we recommend the usage of memory allocators that
-abort() in case of OOM. The default allocator used by Avahi does this.
-
-Eventually we will improve Avahi to deal with these things better.
-
-$Id$
diff --git a/release-0.6.9/docs/NEWS b/release-0.6.9/docs/NEWS
deleted file mode 100644
index d140050..0000000
--- a/release-0.6.9/docs/NEWS
+++ /dev/null
@@ -1,372 +0,0 @@
-Avahi 0.6.9
-===========
-
-This release fixes some bugs and includes minor enhancements.
-
- * Don't allow registration of address records with invalid host names
- * Clean up argument validity checking for AvahiHostNameResolver and
- AvahiAddressResolver
- * Fix Avahi builds without DBUS
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7 and 0.6.8.
-
-Avahi 0.6.8
-===========
-
-This release fixes some bugs and adds a few new features. Users of 0.6.7,
-please update ASAP!
-
- * Fix broken parsing of static hosts file
- * Improve out-of-the-box Debian support
- * Add configuration option to allow mDNS over POINTOPOINT links.
- This is a potential security hole and YMMV. See man page for details.
- * Create $(localstatedir)/run on installation
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5, 0.6.6 and 0.6.7.
-
-Avahi 0.6.7
-===========
-
-This release fixes some bugs and adds a few new features
-
- * Add static hosts name mappings
- * Work around kernel bugs regarding multicast group membership
- * ia64 portability fixes
- * Don't require X11 to run avahi-bookmarks
- * API: Return AVAHI_ERR_IS_EMPTY when the user tries to commit an
- empty entry group.
- * Improved Slackware and Fedora suppport
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5 and 0.6.6.
-
-Avahi 0.6.6
-===========
-
-This release fixes some bugs and includes some documentation updates
-
- * Add a bunch of new types to the service type database
- * Return errors of avahi_entry_group_commit() properly
- * Many doxygen documentation improvements
- * Fix destruction of AvahiEntryGroup objects using
- avahi_entry_group_free().
- * Don't allow commiting of empty entry groups
- * Use a little less memory in avahi-qt
- * Don't accept empty TXT strings
- * Update example "client-publish-service.c" to show how to modify an
- existing service
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4 and 0.6.5.
-
-Avahi 0.6.5
-===========
-
-This release fixes some bugs and adds a new API function.
-
- * avahi-browse: properly show services that are removed from the
- network
- * fix build on bi-arch platforms, on GNU/kFreeBSD, on MIPS and
- for non-DBUS builds
- * add new API function avahi_nss_support() and DBUS function
- IsNSSSupportAvailable() which may be used to detect whether
- libc's gethostbyname() supports mDNS domain names.
- * patch avahi-bookmarks to make use of
- IsNSSSupportAvailable(). avahi-bookmarks will now generate links
- with real hostnames instead of numeric IP addresses if mDNS support
- is detected for gethostbyname().
- * add init script for Mandriva Linux
- * speed up avahi_client_free()
- * man page updates
- * install missing header thread-watch.h
- * fix avahi-bookmarks to work with certain twisted versions
- * fix record updating
- * Use pkg-config's Requires.private directive where it makes sense
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3 and 0.6.4.
-
-Avahi 0.6.4
-===========
-
-This is a bugfix release and adds a new event loop implementation to
-avahi-common's public interface.
-
- * avahi-common: add new AvahiThreadedPool event loop implementation
- * avahi-sharp: compatibility with newer mono versions
- * avahi-publish-service: don't ignore the port number specified
- * avahi-sharp: correct some flags definitions
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2 and
-0.6.3.
-
-A quick introduction how to use the new AvahiThreadedPool interface is
-available in our Wiki:
-
- http://avahi.org/wiki/RunningAvahiClientAsThread
-
-Avahi 0.6.3
-===========
-
-This is a bugfix release. Everyone should update ASAP!
-
- * avahi-sharp: make sure to append a trailing NUL byte to all C strings
- * avahi-core: fix a double free() which occurs when wide area lookups timeout
-
-This release is fully compatible with Avahi 0.6, 0.6.1 and 0.6.2.
-
-Avahi 0.6.2
-===========
-
-This is mostly a bugfix release.
-
- * Compatibility with DBUS 0.60 (Full compatibility with DBUS 0.3x and
- 0.5 is retained)
- * Fix introspection for some auxiliary DBUS objects
- * Miscellaneous documentation updates
- * Improve Autoconf support for detecting PTHREADS library
- * Fix avahi-publish --help
- * Workaround a DBUS limitation which might cause Avahi to die when a
- user sends an empty TXT entry over DBUS
- * Increase number of resolver/browser objects a DBUS client may create
- * Remove fprintf() call in avahi_client_new()
- * Other minor fixes
-
-This release is both up and downwards compatible with Avahi 0.6 and 0.6.1.
-
-Avahi now has its own Domain (http://avahi.org) and a new Website!
-
-And, most importantly, we now have a Logo:
- http://avahi.org/chrome/site/avahi-trac.png
-
-Avahi 0.6.1
-===========
-
-This is mostly a bugfix release.
-
- * Fix a segfault when shutting down the daemon. Please note that this
- issue was not security sensitive in any way but had the ugly side
- effect that the daemon's PID file was not removed properly.
- * Added init scripts for ArchLinux and FreeBSD
- * Add DBUS API versioning through the new method GetAPIVersion()
- * Build the HOWL compatibility library as "libhowl.so", instead of
- "libavahi-compat-howl.so". This will help distributors to ensure
- full API/ABI compatibility with HOWL out-of-the-box.
- * Same for the Bonjour compatibility library
- * Other fixes
-
-We encourage Linux users to update to libdaemon 0.10 since logging
-does not work from a chroot() environment with older versions.
-
-This release is fully API and ABI compatible with Avahi 0.6. This is
-true for both the C libraries and the DBUS interface.
-
-Packagers should read the new documentation file doc/COMPAT-LAYERS
-which contains some information about maintaining full build system
-compatibility in addition to ABI/API compatibility.
-
-Avahi 0.6, the "Goddag" release
-===============================
-
- * Support for (read-only) wide area support. (i.e. DNS-SD over unicast DNS)
- * Ported to FreeBSD, NetBSD, Darwin/MacOSX and to some extent OpenBSD
- * Portability fixes for ARM CPUs
- * Compatibility layers for the HOWL and Bonjour APIs
- * Support for registering/browsing arbitrary records
- * Proper support for DNS-SD service subtypes
- * Native C implementations of the client utilities
- * Now passes the Bonjour conformance test suite without any exceptions
- * "Passive observation of failures"
- * chroot() support
- * Many traffic reduction improvements
- * Bugfixes, cleanups
-
-This release is not API/ABI compatible with Avahi 0.5. Please see
-docs/API-CHANGES-0.6 for a rough overview over the changes.
-
-Avahi 0.5.2
-===========
-
- * Bug fix release.
- * Fix browing in QT applications (was totally broken)
- * Minor documentation update.
-
-Avahi 0.5.1
-===========
-
- * This is a bug fix release, before the big changes coming in 0.6
- * Fix reporting of the NO_DAEMON error
- * Fix commit throttling algorithm for entry groups
- * Fix counting of the number of resources in an entry group
-
-Avahi 0.5, the 'Bom Dia' release
-================================
-
- * New Mono bindings, allowing you to use Avahi from
- any CLI language such as C#
- * Attempt auto-detection of the D-BUS system bus address
- * Include a 'cookie' in all published records which allows us
- to reliably determine if a service is the same as another.
- * Add API to determine if services are local
- * Better support for threading with AvahiSimplePoll
- * Add some new StringList functions to help binding to it in
- other languages
- * Various build and run-time bug fixes
-
-Avahi 0.4, the 'Hyvää päivää' release
-=====================================
-
- * Renamed the include dirs for the Qt bindings to include the
- version number, as they may diverge in future.
- * Fix a critical bug in avahi-daemon triggered by configuring an interface
- with various DHCP clients when you have no other active addresses which
- caused avahi-daemon to abort.
- * Move to using python-gdbm exclusivly for the service type database.
- * Add support for SUSE
- * Various fixes to the build system
-
-Avahi 0.3, the 'Buenos Días' release
-====================================
-
- * New integration library for QT main-loop applications.
- * Fix a crash in avahi-dnsconfd
- * Documentation Updates
- * Fix building when you don't want Python DBUS or GTK
- * avahi-bookmarks
- - Add new help option
- - Fix handling of paths not starting with a /
- - You can now specify the port and IP to bind to
- - Add option to generate links with hostnames instead of IPs
-
-Avahi 0.2, the 'Dzień Dobry' release
-====================================
-
- * Unfortunately this release broke the API/ABI of libavahi-client
- with the following function removals
-
- Removal of these functions may affect users of the 0.1 API
- - avahi_service_resolver_block()
-
- The following functions were simply for debugging information
- and their removal should not affect anyone
- - avahi_entry_group_get_dbus_path()
- - avahi_domain_browser_get_dbus_path()
- - avahi_service_type_browser_get_dbus_path()
- - avahi_service_browser_get_dbus_path()
-
- Note that while the libavahi-client API changed slightly, the DBUS
- API itself has only had additions and no existing definitions
- have changed.
-
- * avahi-daemon will now ignore local IP addresses with the "link" scope
- unless it is the only IP address on the interface.
- * avahi-daemon will no longer fail to start if D-BUS is not
- available (if configured with enable-dbus=warn)
- * Fixed a potential crasher when resolving things in libavahi-core.
- * New example demonstrating integration into glib applications
- * Addtion of a set of convenience functions for AvahiStringList
- avahi_string_list_find()
- avahi_string_list_get_pair()
- avahi_string_list_add_pair()
- avahi_string_list_add_pair_arbitrary()
- * Fixed a typo in avahi-glib.pc that stopped programs using
- the GLIB api from compiling correctly
- * A critical bug in the reflector was fixed where it may go into a
- state of constantly flooding queries out to the network.
- * Introduced new asynchronous resolver API
- * libavahi-client gained an API for resolving HostNames and Addresses
- in addition to the ServiceResolver provided in 0.1
- * Added support for Arch and Gentoo linux distributions.
- * Allowed configuration on non-supported distributions
- * Fixed a critical bug where you cannot use more than one AvahiClient
- or use it in an application already using D-BUS
- * Fixed assembly of empty string lists to RFC compliant TXT records
- * Added a new service type description database with human
- understandable descriptions of services with translations.
- * Fixed various minor memory corruption bugs
- * Fixed an issue where Avahi might think it encountered a conflict
- if the process or machine has been suspended
- * Fixed compilation and runtime issues on 64-bit distributions
- * ...
- * PROFIT!!!
-
-Avahi 0.1, the "Guten Tag" release
-==================================
-
-The Avahi team would like to announce the immediate availability of
-Avahi 0.1 "Guten Tag".
-
-Avahi is a fully LGPL framework for Multicast DNS Service Discovery.
-It allows programs to publish and discover services and hosts
-running on a local network with no specific configuration. For
-example you can plug into a network and instantly find printers to
-print to, files to look at and people to talk to.
-
-Avahi is designed to be compatible with the mDNS/DNS-SD specification
-and boasts the following features
-
- * Fully open source and freely available under the LGPL
- * Full IPv4 and IPv6 support
- * An embeddable mDNS stack
- * Dynamic adjustment to network reconfiguration
- * Daemon with DBUS API for desktop applications
- * C library to interface with the DBUS API
- * Compatible with other mDNS/DNS-SD implementations such as
- Howl and Apple Bonjour (previously Rendezvous)
- * Ability to correctly "reflect" mDNS between two or more LAN segments
- * Ability to configure DNS servers based on mDNS/DNS-SD published
- information, a feature that is very usefull on IPv6
- which has no other mechanism for this.
- * Combined with nss-mdns, allows hostname lookup such as
- 'laptop.local' without the configuration of a DNS server.
- http://0pointer.de/lennart/projects/nss-mdns/
- * Easy integration into GLIB, GTK other mainloop applications.
- * Documentation and examples of both developer APIs and utilities.
-
-mDNS/DNS-SD is part of a larger set of specifications for easy
-configuration of networking known as "ZeroConf"
-(http://www.zeroconf.org/), with the aim of allowing you to plug into
-a network and instantly be able to interact with it's services.
-
-Avahi was designed to be a fully free implementation, and is
-available under the LGPL. Many other implementations of the mDNS/DNS-SD
-specification were previously non-free, restricting their use in many
-platforms such as the GNOME desktop and many distributions.
-
-While Avahi is a 0.1 release, we feel it is feature complete and
-available for immediate use, developers can make use of the Avahi
-client library to provide above mentioned functionality in their
-programs.
-
-We unfortunately do not have a logo yet! We would love if someone
-could suggest ideas for a logo or even design us one. If you think
-you can help us out, you can contact us on our mailing list or by
-emailing Trent Lloyd on lathiat@bur.st.
-
-If you would like more information or help, you can subscribe
-to our mailinglist, goto
- http://lists.freedesktop.org/mailman/listinfo/avahi
-
-You can download Avahi 0.1 here
- http://www.freedesktop.org/~lennart/avahi-0.1.tar.gz
-
-You can also find out more information from our homepage
- http://www.freedesktop.org/Software/Avahi
-
-We would like to thank the following people for their
-contribution to Avahi 0.1.
- Lennart Poeterring
- Trent Lloyd
- Sebastien Estienne
- Ross Burton
- Tommi Vainikainen
- Joe Shaw
- Ikke
- Steev
-
-Cheers,
-The Avahi Team
-
-$Id$
diff --git a/release-0.6.9/docs/README b/release-0.6.9/docs/README
deleted file mode 100644
index 4815ba2..0000000
--- a/release-0.6.9/docs/README
+++ /dev/null
@@ -1,50 +0,0 @@
-Avahi is a free, LGPL mDNS/DNS-SD implementation.
-
-Copyright 2004, 2005 by the Avahi developers.
-
- http://avahi.org/
-
-Avahi has a mailing list:
-
- http://lists.freedesktop.org/mailman/listinfo/avahi
-
-You have a chance to meet the developers on
-
- #avahi on irc.freenode.org
-
-Please report bugs to the freedesktop.org bugzilla:
-
- http://bugs.freedesktop.org/
-
-Avahi's SVN repository is freely accessible:
-
- svn checkout svn://svn.0pointer.de/avahi/trunk avahi
-
- http://0pointer.de/cgi-bin/viewcvs.cgi/?root=avahi
-
-Avahi has the following requirements:
- - glib2
- - expat
- - libdaemon (http://0pointer.de/lennart/projects/libdaemon/)
- - Linux 2.4 or 2.6
- - DBUS 0.3x (optional, if you disable this, the daemon is not
- accessible over IPC to other applications!)
- - gtk2 + glade (optional, needed for avahi-discover-standalone)
- - doxygen (optional, needed for he API documentaton)
- - Python 2.4, pygtk2 (optional, needed by all client tools)
- - python-twisted (optional, needed by avahi-bookmarks)
- - xmltoman (if building from SVN rather than a tarball)
- If you are not using debian or ubuntu, the upstream authors page has
- disappeared, but you can get the source from debian here
- http://ftp.debian.org/debian/pool/main/x/xmltoman/xmltoman_0.3.orig.tar.gz
-
-Please make sure to read the currently available documentation for avahi before
-asking for support on the mailing list:
-
- - INSTALL
- - Man pages
- - Homepage http://avahi.org/
- - Mailing list archive http://lists.freedesktop.org/archives/avahi/
-
-
-$Id$
diff --git a/release-0.6.9/docs/TODO b/release-0.6.9/docs/TODO
deleted file mode 100644
index 9907ec6..0000000
--- a/release-0.6.9/docs/TODO
+++ /dev/null
@@ -1,106 +0,0 @@
-later:
-* add simplification routine for adding services
-* support for special domain PTR records based on local IP subnet address
-* Changes resulting in updated RFC of 7th June 2005:
- * Defer responses to replies with TC bit set by 400-500msec
- * Defer unicast responses the same way as multicast responses
-* DNSSEC [federico]
-* Wide area DNS Update [federico]
-* long lived queries
-* libavahi-compat-libdns_sd: implement kDNSServiceFlagsNoAutoRename and missing functions
-* libavahi-compat-howl: implement missing functions
-* add API to allow user to tell the server that some service is not reachable
-
-done:
-* drop glib from avahi-daemon
-* doxygen updates
-* deal with no local interface
-* Probing/Conflict resolution
-* uniqueness
-* respect escaping in name serialization
-* really send goodbye packets
-* refresh subscribed records only
-* FLX_DNS_TYPE_ANY support
-* Known-Answer suppression client part
-* Known-Answer suppression server part
-* make flx_server_add_text() and flx_server_add_service() variadic functions
-* name compression
-* remove expression "rrset" from source files
-* defend our entries on incoming goodbye
-* allow NULL bytes in TXT records
-* add flx_server_add_service_strlst() and friends
-* change flx_* to avahi_*
-* Unicast responses/queries
-* Legacy unicast
-* no flush bit in known answer
-* always set AA
-* check: TC bit is valid for queries ONLY
-* add SRV and TXT records referenced from PTR records automatically to packet
-* add A and AAAA records referenced from SRV records automatically to packet
-* support known answer suppresion for incoming unicast queries
-* check wether RRsets are supported correctly (i.e. that all records of an
- RRset are really sent if it is requested) (rfc 2181)
-* case insensitve comparison
-* drop records from cache only one second after flush cache bit entry was received
-* either send entire RRSET or don't set flush cache bit!
-* mantain flush cache bit correctly in psched
-* Return to probing state on conflict
-* response job dependencies
-* enlarge packet in case a record/query is too large to fit in a normal packet
-* reflector
-* test against apple test suite
-* sensible logging
-* c++ support
-* drop trailing dot on avahi_normalize_name()
-* add entry_group::reset()
-* add internal error codes
-* finish DBUS stuff: allow NUL bytes in TXT records
-* allow srv port == 0
-* avahi-client:
- * service resolving
- * examples
-* publish IP addresses with scope "link" only, unless ther are the only one the interface
-* release 0.2!
-* add identical service detection cookie
-* add API to detect if a service is local
-* make AVAHI_PROTO_xxx well defined constants
-* if two local clients browse for the same RRs, only send out query series once
-* handle multicast/wide area resolving for reverse host name looups
-* add wide area support (i.e. DNS-SD over unicast DNS)
-* add a way to notify the user that all cache entries have been read when browsing
-* allow resolving of services without name
-* add sever version check to avahi-client
-* Passive observation of failures
-* add option to disable SO_REUSEADDR to disallow binding of multiple processes to port 5353
-* add flags argument to disable cookies-setting for local services
-* add API to add addresses without reverse PTR record
-* reset commit throttling for entry groups after a while
-* wrap subtype support for avahi-client
-* add subtype browsing
-* split linux specific parts from iface.c
-* consolidate browsing failure events and add an API to query the reason
-* Add sensible record updating API
-* rename AvahiAnnouncement to AvahiAnnouncer (to match AvahiQuerier)
-* implement avahi_client_add_address
-* remove AVAHI_PUBLISH_IS_PROXY
-* replace avahi_server_is_service_local() by AVAHI_PUBLISH flag
-* drop partially created created entries on failure
-* add error state for server and entry group
-* make sure that all limit definitions end with _MAX
-* generate local CNAME responses
-* remove irrelevant functions from pubic rr.h API
-* unify argument order of functions returning a string in a user supplied buffer
-* add support for subtypes in static services
-* wrap avahi_server_add_record() via DBUS and in avahi-client [lathiat]
-* add service type database support to avahi-browse
-* add domain browsing to avahi-browse
-* always set source address for outgoing packets
-* add support for defining browsing domains with an option in avahi-daemon.onf
-* return an error when the user tries to register a service in a domain != .local, for now
-* introduce AVAHI_CLIENT_FAILURE
-* remove outgoing queries from queue if the browse object they were issued from is destroyed
-* pass *all* Bonjour conformance tests
-* fix python scripts
-* Expose AvahiSRecordBrowser over D-BUS and implement in avahi-client
-* avahi-publish-* rewrites in C, update man pages
-* Add static host configuration like static services [lathiat]
diff --git a/release-0.6.9/docs/avahi-poll.dia b/release-0.6.9/docs/avahi-poll.dia
deleted file mode 100644
index eae82e2..0000000
--- a/release-0.6.9/docs/avahi-poll.dia
+++ /dev/null
@@ -1,1042 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
- <dia:diagramdata>
- <dia:attribute name="background">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="pagebreak">
- <dia:color val="#000099"/>
- </dia:attribute>
- <dia:attribute name="paper">
- <dia:composite type="paper">
- <dia:attribute name="name">
- <dia:string>#A4#</dia:string>
- </dia:attribute>
- <dia:attribute name="tmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="bmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="lmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="rmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="is_portrait">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="scaling">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="fitto">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="grid">
- <dia:composite type="grid">
- <dia:attribute name="width_x">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="width_y">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_x">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_y">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:composite type="color"/>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#d8e5e5"/>
- </dia:attribute>
- <dia:attribute name="guides">
- <dia:composite type="guides">
- <dia:attribute name="hguides"/>
- <dia:attribute name="vguides"/>
- </dia:composite>
- </dia:attribute>
- </dia:diagramdata>
- <dia:layer name="Background" visible="true">
- <dia:object type="Geometric - Perfect Square" version="0" id="O0">
- <dia:attribute name="obj_pos">
- <dia:point val="33,10.783"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="32.95,10.733;46.05,24.2663"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="33,10.783"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="12.999996185288101"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="13.433329391464369"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:group>
- <dia:object type="Standard - Ellipse" version="0" id="O1">
- <dia:attribute name="obj_pos">
- <dia:point val="17,13"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,12.95;26.05,22.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,13"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="9"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="9"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O2">
- <dia:attribute name="obj_pos">
- <dia:point val="21.5,16.4156"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.9,15.8156;23.1,19.1656"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#A
-main loop
-of
-some kind#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="21.5,16.4156"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O3">
- <dia:attribute name="obj_pos">
- <dia:point val="14,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="13.95,15.95;17.05,19.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="14,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O4">
- <dia:attribute name="obj_pos">
- <dia:point val="14.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="14.1164,17.075;16.8164,18.025"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="14.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O5">
- <dia:attribute name="obj_pos">
- <dia:point val="20,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,9.95;23.05,13.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,10"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O6">
- <dia:attribute name="obj_pos">
- <dia:point val="20.1164,11.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.1164,11.075;22.8164,12.025"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="20.1164,11.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O7">
- <dia:attribute name="obj_pos">
- <dia:point val="26,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="25.95,15.95;29.05,19.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="26,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O8">
- <dia:attribute name="obj_pos">
- <dia:point val="26.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.1164,17.075;28.8164,18.025"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O9">
- <dia:attribute name="obj_pos">
- <dia:point val="33,14"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="32.95,13.95;39.8242,21.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="33,14"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.7741787962376261"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="6.9999847561122124"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O10">
- <dia:attribute name="obj_pos">
- <dia:point val="33.5371,17.625"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="33.5371,17.025;39.2371,17.975"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiDBusAdapter#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="33.5371,17.625"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O11">
- <dia:attribute name="obj_pos">
- <dia:point val="29,17.55"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.9494,16.9994;33.0562,18.5751"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="29,17.55"/>
- <dia:point val="33,17.5"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O12">
- <dia:attribute name="obj_pos">
- <dia:point val="33,17.5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.9437,16.4749;33.0506,18.0506"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="33,17.5"/>
- <dia:point val="29,17.55"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O13">
- <dia:attribute name="obj_pos">
- <dia:point val="9.93231,17.5817"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.88192,17.0496;14.0539,18.6159"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="9.93231,17.5817"/>
- <dia:point val="14,17.55"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O14">
- <dia:attribute name="obj_pos">
- <dia:point val="14,17.55"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.87841,16.5158;14.0504,18.0821"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="14,17.55"/>
- <dia:point val="9.93231,17.5817"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O15">
- <dia:attribute name="obj_pos">
- <dia:point val="3,14"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="2.95,13.95;9.98231,21.2134"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="3,14"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.9323076131373904"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="7.1633845335753028"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O16">
- <dia:attribute name="obj_pos">
- <dia:point val="6.45678,17.3067"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="4.53178,16.7067;8.38178,18.4567"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Some other
-consumer#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="6.45678,17.3067"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O17">
- <dia:attribute name="obj_pos">
- <dia:point val="18.0795,-1"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.0295,-1.05;24.9028,6.04903"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="18.0795,-1"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.7732533131615504"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="6.9990284236002678"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O18">
- <dia:attribute name="obj_pos">
- <dia:point val="21.4568,2.30669"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.5318,1.70669;23.3818,3.45669"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Some other
-consumer#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="21.4568,2.30669"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O19">
- <dia:attribute name="obj_pos">
- <dia:point val="21.4662,5.99903"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.433,5.94861;22.0004,10.0542"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.4662,5.99903"/>
- <dia:point val="21.5,10"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="0.99999999999999922"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O20">
- <dia:attribute name="obj_pos">
- <dia:point val="21.5,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.9657,5.9448;22.5331,10.0504"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.5,10"/>
- <dia:point val="21.4662,5.99903"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O21">
- <dia:attribute name="obj_pos">
- <dia:point val="20,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,21.95;23.05,25.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,22"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O22">
- <dia:attribute name="obj_pos">
- <dia:point val="20.1164,23.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.1164,23.0562;22.8352,24.0625"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="20.1164,23.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O23">
- <dia:attribute name="obj_pos">
- <dia:point val="18,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.95,28.95;24.9532,36.1833"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="18,29"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.903225806451613"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="7.1333333333333329"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O24">
- <dia:attribute name="obj_pos">
- <dia:point val="19.6516,32.6823"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.6516,32.0635;23.2704,33.0698"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiServer#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="19.6516,32.6823"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O25">
- <dia:attribute name="obj_pos">
- <dia:point val="21.5,25.1"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.4257,25.0494;21.9522,29.0562"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.5,25.1"/>
- <dia:point val="21.4516,29"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="0.99999999999999922"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O26">
- <dia:attribute name="obj_pos">
- <dia:point val="21.4516,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.9994,25.0438;22.5259,29.0506"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.4516,29"/>
- <dia:point val="21.5,25.1"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="0.99999999999999833"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:object type="Standard - Text" version="0" id="O27">
- <dia:attribute name="obj_pos">
- <dia:point val="6,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="6,5.38125;14.0188,10.3875"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#If you chose
-GMainLoop as main event
-loop, you can use
-AvahiGLibPoll as
-implementation for
-AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="6,6"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O28">
- <dia:attribute name="obj_pos">
- <dia:point val="39,2"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="33.2,1.38125;39.0188,7.9875"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#If you don't have
-a main loop yet
-you can choose
-AvahiSimplePoll
-as implementation
-for the main loop.
-It provides
-*one* AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="39,2"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="2"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O29">
- <dia:attribute name="obj_pos">
- <dia:point val="41,17.6153"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="41,16.9965;44.3687,18.0028"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiClient#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="41,17.6153"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:layer>
-</dia:diagram>
diff --git a/release-0.6.9/docs/overview.dia b/release-0.6.9/docs/overview.dia
deleted file mode 100644
index 744f04c..0000000
--- a/release-0.6.9/docs/overview.dia
+++ /dev/null
@@ -1,1495 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
- <dia:diagramdata>
- <dia:attribute name="background">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="pagebreak">
- <dia:color val="#000099"/>
- </dia:attribute>
- <dia:attribute name="paper">
- <dia:composite type="paper">
- <dia:attribute name="name">
- <dia:string>#A4#</dia:string>
- </dia:attribute>
- <dia:attribute name="tmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="bmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="lmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="rmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="is_portrait">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="scaling">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="fitto">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="grid">
- <dia:composite type="grid">
- <dia:attribute name="width_x">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="width_y">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_x">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_y">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:composite type="color"/>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#d8e5e5"/>
- </dia:attribute>
- <dia:attribute name="guides">
- <dia:composite type="guides">
- <dia:attribute name="hguides"/>
- <dia:attribute name="vguides"/>
- </dia:composite>
- </dia:attribute>
- </dia:diagramdata>
- <dia:layer name="Background" visible="true">
- <dia:object type="Flowchart - Box" version="0" id="O0">
- <dia:attribute name="obj_pos">
- <dia:point val="20,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,5.95;33.05,7.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,6"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="13"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#libavahi-core#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26.5,7.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O1">
- <dia:attribute name="obj_pos">
- <dia:point val="10,12"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,11.95;29.05,16.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,12"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="19"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="4"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-daemon#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="19.5,14.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O2">
- <dia:attribute name="obj_pos">
- <dia:point val="10,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,15.95;16.05,18.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#DBUS protocol#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="13,17.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O3">
- <dia:attribute name="obj_pos">
- <dia:point val="16,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="15.95,15.95;23.05,18.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="16,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#simple protocol#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="19.5,17.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O4">
- <dia:attribute name="obj_pos">
- <dia:point val="21,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.95,21.95;26.05,23.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="21,22"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="5"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#nss-mdns#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="23.5,23.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O5">
- <dia:attribute name="obj_pos">
- <dia:point val="27,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.95,21.95;32.9,23.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="27,22"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="5.8499999999999996"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-dnsconfd#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="29.925,23.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O6">
- <dia:attribute name="obj_pos">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,19.95;16.05,22.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#DBUS#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="13,21.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O7">
- <dia:attribute name="obj_pos">
- <dia:point val="6,24"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="5.95,23.95;12.05,26.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="6,24"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#libavahi-client#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="9,25.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O8">
- <dia:attribute name="obj_pos">
- <dia:point val="10,2"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,1.95;23.05,3.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,2"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="13"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#libavahi-common#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="16.5,3.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O9">
- <dia:attribute name="obj_pos">
- <dia:point val="-5,28"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="-5.05,27.95;6.9,29.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="-5,28"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="11.85"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#C based tools: nautilus, rhythmbox, ...#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="0.925,29.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O10">
- <dia:attribute name="obj_pos">
- <dia:point val="16.5,3.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="14.2507,3.84057;16.5594,12.1545"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="16.5,3.9"/>
- <dia:point val="14.75,12"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O8" connection="13"/>
- <dia:connection handle="1" to="O1" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O11">
- <dia:attribute name="obj_pos">
- <dia:point val="23.25,7.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="23.1896,7.83958;24.7476,12.1671"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="23.25,7.9"/>
- <dia:point val="24.25,12"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O0" connection="12"/>
- <dia:connection handle="1" to="O1" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O12">
- <dia:attribute name="obj_pos">
- <dia:point val="13,18"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="12.5,17.95;13.5,20.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="13,18"/>
- <dia:point val="13,20"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O2" connection="13"/>
- <dia:connection handle="1" to="O6" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O13">
- <dia:attribute name="obj_pos">
- <dia:point val="13,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="10.1486,21.9297;13.0703,24.4217"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="13,22"/>
- <dia:point val="10.5,24"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O6" connection="13"/>
- <dia:connection handle="1" to="O7" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O14">
- <dia:attribute name="obj_pos">
- <dia:point val="17.75,18"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.6804,17.9304;23.8266,22.439"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="17.75,18"/>
- <dia:point val="23.5,22"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="12"/>
- <dia:connection handle="1" to="O4" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O15">
- <dia:attribute name="obj_pos">
- <dia:point val="21.25,18"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="21.1837,17.9337;30.1798,22.475"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.25,18"/>
- <dia:point val="29.925,22"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="14"/>
- <dia:connection handle="1" to="O5" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O16">
- <dia:attribute name="obj_pos">
- <dia:point val="6,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="0.69516,25.9351;6.06485,28.4835"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="6,26"/>
- <dia:point val="0.925,28"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="11"/>
- <dia:connection handle="1" to="O9" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O17">
- <dia:attribute name="obj_pos">
- <dia:point val="23,3.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="22.7476,3.84444;23.7524,6.10876"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="23,3.9"/>
- <dia:point val="23.25,6"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O8" connection="15"/>
- <dia:connection handle="1" to="O0" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O18">
- <dia:attribute name="obj_pos">
- <dia:point val="23,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="22.95,15.95;29.05,18.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="23,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#static services#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26,17.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O19">
- <dia:attribute name="obj_pos">
- <dia:point val="13.25,3.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="6.09937,3.83818;13.3118,24.1856"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="13.25,3.9"/>
- <dia:point val="7.5,24"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="3.7332171462404484"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O8" connection="12"/>
- <dia:connection handle="1" to="O7" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O20">
- <dia:attribute name="obj_pos">
- <dia:point val="17,25"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,24.95;35.05,27.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,25"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="18"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Python/other PL based tools#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26,26.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O21">
- <dia:attribute name="obj_pos">
- <dia:point val="14.5,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="14.4343,21.9343;21.7429,25.4793"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="14.5,22"/>
- <dia:point val="21.5,25"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O6" connection="14"/>
- <dia:connection handle="1" to="O20" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O22">
- <dia:attribute name="obj_pos">
- <dia:point val="7.5,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="7.43774,25.9377;9.49328,31.1916"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="7.5,26"/>
- <dia:point val="9,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="12"/>
- <dia:connection handle="1" to="O23" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O23">
- <dia:attribute name="obj_pos">
- <dia:point val="3,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="2.95,30.95;11.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="3,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="8"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-compat-libdns_sd#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="7,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O24">
- <dia:attribute name="obj_pos">
- <dia:point val="12,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="11.95,30.95;19.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="12,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-compat-howl#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="15.5,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O25">
- <dia:attribute name="obj_pos">
- <dia:point val="9,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="8.92988,25.9299;15.8445,31.4268"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="9,26"/>
- <dia:point val="15.5,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="13"/>
- <dia:connection handle="1" to="O24" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O26">
- <dia:attribute name="obj_pos">
- <dia:point val="29,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.95,30.95;40.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="29,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="11"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#kdnssd-avahi#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="34.5,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O27">
- <dia:attribute name="obj_pos">
- <dia:point val="12,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="11.9403,25.9403;34.6573,31.4989"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="12,26"/>
- <dia:point val="34.5,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="15"/>
- <dia:connection handle="1" to="O26" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O28">
- <dia:attribute name="obj_pos">
- <dia:point val="3,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="2.95,33.95;11,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="3,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7.9499999999999993"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Legacy Bonjour Apps#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="6.975,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O29">
- <dia:attribute name="obj_pos">
- <dia:point val="12,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="11.95,33.95;19.05,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="12,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Legacy HOWL Apps#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="15.5,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O30">
- <dia:attribute name="obj_pos">
- <dia:point val="29,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.95,33.95;40.05,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="29,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="11"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#KDE Applications using KDNSSD#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="34.5,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O31">
- <dia:attribute name="obj_pos">
- <dia:point val="7,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="6.47399,32.8489;7.47601,34.0613"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="7,32.9"/>
- <dia:point val="6.975,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O23" connection="13"/>
- <dia:connection handle="1" to="O28" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O32">
- <dia:attribute name="obj_pos">
- <dia:point val="15.5,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="15,32.85;16,34.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="15.5,32.9"/>
- <dia:point val="15.5,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O24" connection="13"/>
- <dia:connection handle="1" to="O29" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O33">
- <dia:attribute name="obj_pos">
- <dia:point val="34.5,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="34,32.85;35,34.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="34.5,32.9"/>
- <dia:point val="34.5,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O26" connection="13"/>
- <dia:connection handle="1" to="O30" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O34">
- <dia:attribute name="obj_pos">
- <dia:point val="20,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,30.95;28.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="8"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-sharp#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="24,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O35">
- <dia:attribute name="obj_pos">
- <dia:point val="20,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,33.95;28.05,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="8"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Mono/C# based Apps#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="24,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O36">
- <dia:attribute name="obj_pos">
- <dia:point val="10.5,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="10.4357,25.9357;24.2205,31.4862"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="10.5,26"/>
- <dia:point val="24,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="14"/>
- <dia:connection handle="1" to="O34" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O37">
- <dia:attribute name="obj_pos">
- <dia:point val="24,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="23.5,32.85;24.5,34.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="24,32.9"/>
- <dia:point val="24,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O34" connection="13"/>
- <dia:connection handle="1" to="O35" connection="2"/>
- </dia:connections>
- </dia:object>
- </dia:layer>
-</dia:diagram>
diff --git a/release-0.6.9/docs/server-states.dia b/release-0.6.9/docs/server-states.dia
deleted file mode 100644
index 35fe437..0000000
--- a/release-0.6.9/docs/server-states.dia
+++ /dev/null
@@ -1,975 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
- <dia:diagramdata>
- <dia:attribute name="background">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="pagebreak">
- <dia:color val="#000099"/>
- </dia:attribute>
- <dia:attribute name="paper">
- <dia:composite type="paper">
- <dia:attribute name="name">
- <dia:string>#A4#</dia:string>
- </dia:attribute>
- <dia:attribute name="tmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="bmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="lmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="rmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="is_portrait">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="scaling">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="fitto">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="grid">
- <dia:composite type="grid">
- <dia:attribute name="width_x">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="width_y">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_x">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_y">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:composite type="color"/>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#d8e5e5"/>
- </dia:attribute>
- <dia:attribute name="guides">
- <dia:composite type="guides">
- <dia:attribute name="hguides"/>
- <dia:attribute name="vguides"/>
- </dia:composite>
- </dia:attribute>
- </dia:diagramdata>
- <dia:layer name="Background" visible="true">
- <dia:object type="Geometric - Perfect Circle" version="0" id="O0">
- <dia:attribute name="obj_pos">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,3.95;19.05,6.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O1">
- <dia:attribute name="obj_pos">
- <dia:point val="25,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="24.95,4.95;27.05,7.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="25,5"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O2">
- <dia:attribute name="obj_pos">
- <dia:point val="42,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="41.95,9.95;44.05,12.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="42,10"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O3">
- <dia:attribute name="obj_pos">
- <dia:point val="17,19"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,18.95;19.05,21.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,19"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O4">
- <dia:attribute name="obj_pos">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="35.95,25.95;38.05,28.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.0000305175199173"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2.0000305175199173"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O5">
- <dia:attribute name="obj_pos">
- <dia:point val="19,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.9425,4.94246;25.1315,6.50142"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="19,5"/>
- <dia:point val="25,6"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O0" connection="3"/>
- <dia:connection handle="1" to="O1" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O6">
- <dia:attribute name="obj_pos">
- <dia:point val="42,11"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.7712,10.9352;42.0648,20.4838"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="42,11"/>
- <dia:point val="19,20"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O2" connection="2"/>
- <dia:connection handle="1" to="O3" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O7">
- <dia:attribute name="obj_pos">
- <dia:point val="18,19"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.9307,6.68105;26.4438,19.0693"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="18,19"/>
- <dia:point val="26,7"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="1"/>
- <dia:connection handle="1" to="O1" connection="0"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O8">
- <dia:attribute name="obj_pos">
- <dia:point val="26,7"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.5562,6.93066;26.0693,19.319"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="26,7"/>
- <dia:point val="18,19"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O1" connection="0"/>
- <dia:connection handle="1" to="O3" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O9">
- <dia:attribute name="obj_pos">
- <dia:point val="18,21"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.9368,20.9368;36.2055,27.4902"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="18,21"/>
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="0"/>
- <dia:connection handle="1" to="O4" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O10">
- <dia:attribute name="obj_pos">
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.7945,20.5098;36.0632,27.0632"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="36,27"/>
- <dia:point val="18,21"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O4" connection="2"/>
- <dia:connection handle="1" to="O3" connection="0"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O11">
- <dia:attribute name="obj_pos">
- <dia:point val="38,27"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="37.9368,11.7945;43.4902,27.0632"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="38,27"/>
- <dia:point val="43,12"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O4" connection="3"/>
- <dia:connection handle="1" to="O2" connection="0"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O12">
- <dia:attribute name="obj_pos">
- <dia:point val="43,12"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="37.5098,11.9368;43.0632,27.2055"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="43,12"/>
- <dia:point val="38,27"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O2" connection="0"/>
- <dia:connection handle="1" to="O4" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O13">
- <dia:attribute name="obj_pos">
- <dia:point val="37,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.5304,5.73167;37.0671,26.0671"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="37,26"/>
- <dia:point val="27,6"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O4" connection="1"/>
- <dia:connection handle="1" to="O1" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O14">
- <dia:attribute name="obj_pos">
- <dia:point val="27,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.9329,5.93292;37.4696,26.2683"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="27,6"/>
- <dia:point val="37,26"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O1" connection="3"/>
- <dia:connection handle="1" to="O4" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O15">
- <dia:attribute name="obj_pos">
- <dia:point val="26,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="25.9379,4.32084;43.1891,10.4938"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="26,5"/>
- <dia:point val="43,10"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="-2.5575097323624019"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O1" connection="1"/>
- <dia:connection handle="1" to="O2" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O16">
- <dia:attribute name="obj_pos">
- <dia:point val="12,4"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="12,3.4;16.9,4.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_INVALID#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="12,4"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O17">
- <dia:attribute name="obj_pos">
- <dia:point val="28,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28,5.4;34.65,6.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_REGISTERING#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="28,6"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O18">
- <dia:attribute name="obj_pos">
- <dia:point val="45,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="45,9.4;50.45,10.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_RUNNING#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="45,10"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O19">
- <dia:attribute name="obj_pos">
- <dia:point val="39,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="39,28.4;46.1,29.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#CLIENT_DISCONNECTED#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="39,29"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O20">
- <dia:attribute name="obj_pos">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="10,19.4;15.7,20.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_COLLISION#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O21">
- <dia:attribute name="obj_pos">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,3.95;18.0707,5.07071"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O22">
- <dia:attribute name="obj_pos">
- <dia:point val="17,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,4.92929;18.0707,6.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,5"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="true"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O23">
- <dia:attribute name="obj_pos">
- <dia:point val="19,28"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.9329,13.9329;47.0671,28.0671"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="19,28"/>
- <dia:point val="47,14"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="line_color">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="4"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O24">
- <dia:attribute name="obj_pos">
- <dia:point val="21,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="21,28.4;24.25,29.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Client side#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="21,29"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O25">
- <dia:attribute name="obj_pos">
- <dia:point val="18,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18,25.4;21.5,26.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Server side#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="18,26"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O26">
- <dia:attribute name="obj_pos">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="35.95,25.95;37.0707,27.0707"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O27">
- <dia:attribute name="obj_pos">
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="35.95,26.9293;37.0707,28.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="true"/>
- </dia:attribute>
- </dia:object>
- </dia:layer>
-</dia:diagram>
diff --git a/release-0.6.9/doxygen.cfg b/release-0.6.9/doxygen.cfg
deleted file mode 100644
index 39af374..0000000
--- a/release-0.6.9/doxygen.cfg
+++ /dev/null
@@ -1,213 +0,0 @@
-# Doxyfile 1.3.7
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = $(PROJECT)
-PROJECT_NUMBER = $(VERSION)
-OUTPUT_DIRECTORY = $(DOCDIR)
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-STRIP_FROM_INC_PATH = $(SRCDIR)
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH = $(SRCDIR)
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = YES
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 4
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = NO
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = $(INPUT)
-FILE_PATTERNS =
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH = $(EXAMPLE_PATH)
-EXAMPLE_PATTERNS = $(EXAMPLE_PATTERNS)
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX = Avahi AVAHI_ avahi_
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = $(GENERATE_HTML)
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = $(GENERATE_CHM)
-CHM_FILE = ../$(PROJECT).chm
-HHC_LOCATION = $(HHC_PATH)
-GENERATE_CHI = $(GENERATE_CHI)
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 1
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = $(GENERATE_LATEX)
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = $(PAPER_SIZE)
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = YES
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = $(GENERATE_RTF)
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = $(GENERATE_MAN)
-MAN_OUTPUT = man
-MAN_EXTENSION = .1
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = $(GENERATE_XML)
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = YES
-EXPAND_ONLY_PREDEF = YES
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED = "DOXYGEN_SHOULD_SKIP_THIS" "AVAHI_C_DECL_BEGIN=" "AVAHI_C_DECL_END="
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE = $(DOCDIR)/$(PROJECT).tag
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = $(PERL_PATH)
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = YES
-HIDE_UNDOC_RELATIONS = YES
-HAVE_DOT = $(HAVE_DOT)
-CLASS_GRAPH = YES
-COLLABORATION_GRAPH = YES
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = YES
-INCLUDED_BY_GRAPH = YES
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = YES
-DOT_IMAGE_FORMAT = png
-DOT_PATH = $(DOT_PATH)
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/release-0.6.9/examples/Makefile.am b/release-0.6.9/examples/Makefile.am
deleted file mode 100644
index e6e66f5..0000000
--- a/release-0.6.9/examples/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- core-publish-service \
- core-browse-services
-endif
-
-core_publish_service_SOURCES = core-publish-service.c
-core_publish_service_CFLAGS = $(AM_CFLAGS)
-core_publish_service_LDADD = $(AM_LDADD) ../avahi-core/libavahi-core.la ../avahi-common/libavahi-common.la
-
-core_browse_services_SOURCES = core-browse-services.c
-core_browse_services_CFLAGS = $(AM_CFLAGS)
-core_browse_services_LDADD = $(AM_LDADD) ../avahi-core/libavahi-core.la ../avahi-common/libavahi-common.la
-
-if HAVE_DBUS
-if ENABLE_TESTS
-
-noinst_PROGRAMS += \
- client-publish-service \
- client-browse-services
-endif
-
-client_publish_service_SOURCES = client-publish-service.c
-client_publish_service_CFLAGS = $(AM_CFLAGS)
-client_publish_service_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-client_browse_services_SOURCES = client-browse-services.c
-client_browse_services_CFLAGS = $(AM_CFLAGS)
-client_browse_services_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-if HAVE_GLIB
-
-if ENABLE_TESTS
-noinst_PROGRAMS += \
- glib-integration
-endif
-
-glib_integration_SOURCES = glib-integration.c
-glib_integration_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-glib_integration_LDADD = $(AM_LDADD) $(GLIB20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la ../avahi-glib/libavahi-glib.la
-
-endif
-
-endif
diff --git a/release-0.6.9/examples/client-browse-services.c b/release-0.6.9/examples/client-browse-services.c
deleted file mode 100644
index 37550ef..0000000
--- a/release-0.6.9/examples/client-browse-services.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-static AvahiSimplePoll *simple_poll = NULL;
-
-static void resolve_callback(
- AvahiServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *address,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- assert(r);
-
- /* Called whenever a service has been resolved successfully or timed out */
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
- fprintf(stderr, "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r))));
- break;
-
- case AVAHI_RESOLVER_FOUND: {
- char a[AVAHI_ADDRESS_STR_MAX], *t;
-
- fprintf(stderr, "Service '%s' of type '%s' in domain '%s':\n", name, type, domain);
-
- avahi_address_snprint(a, sizeof(a), address);
- t = avahi_string_list_to_string(txt);
- fprintf(stderr,
- "\t%s:%u (%s)\n"
- "\tTXT=%s\n"
- "\tcookie is %u\n"
- "\tis_local: %i\n"
- "\tour_own: %i\n"
- "\twide_area: %i\n"
- "\tmulticast: %i\n"
- "\tcached: %i\n",
- host_name, port, a,
- t,
- avahi_string_list_get_service_cookie(txt),
- !!(flags & AVAHI_LOOKUP_RESULT_LOCAL),
- !!(flags & AVAHI_LOOKUP_RESULT_OUR_OWN),
- !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA),
- !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST),
- !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
-
- avahi_free(t);
- }
- }
-
- avahi_service_resolver_free(r);
-}
-
-static void browse_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiClient *c = userdata;
- assert(b);
-
- /* Called whenever a new services becomes available on the LAN or is removed from the LAN */
-
- switch (event) {
- case AVAHI_BROWSER_FAILURE:
-
- fprintf(stderr, "(Browser) %s\n", avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))));
- avahi_simple_poll_quit(simple_poll);
- return;
-
- case AVAHI_BROWSER_NEW:
- fprintf(stderr, "(Browser) NEW: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
-
- /* We ignore the returned resolver object. In the callback
- function we free it. If the server is terminated before
- the callback function is called the server will free
- the resolver for us. */
-
- if (!(avahi_service_resolver_new(c, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, resolve_callback, c)))
- fprintf(stderr, "Failed to resolve service '%s': %s\n", name, avahi_strerror(avahi_client_errno(c)));
-
- break;
-
- case AVAHI_BROWSER_REMOVE:
- fprintf(stderr, "(Browser) REMOVE: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- fprintf(stderr, "(Browser) %s\n", event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW");
- break;
- }
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- assert(c);
-
- /* Called whenever the client or server state changes */
-
- if (state == AVAHI_CLIENT_FAILURE) {
- fprintf(stderr, "Server connection failre: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiClient *client = NULL;
- AvahiServiceBrowser *sb = NULL;
- int error;
- int ret = 1;
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- /* Allocate a new client */
- client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error);
-
- /* Check wether creating the client object succeeded */
- if (!client) {
- fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* Create the service browser */
- if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, browse_callback, client))) {
- fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
- if (sb)
- avahi_service_browser_free(sb);
-
- if (client)
- avahi_client_free(client);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return ret;
-}
diff --git a/release-0.6.9/examples/client-publish-service.c b/release-0.6.9/examples/client-publish-service.c
deleted file mode 100644
index 96afaf3..0000000
--- a/release-0.6.9/examples/client-publish-service.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-
-#include <avahi-common/alternative.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/timeval.h>
-
-static AvahiEntryGroup *group = NULL;
-static AvahiSimplePoll *simple_poll = NULL;
-static char *name = NULL;
-
-static void create_services(AvahiClient *c);
-
-static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) {
- assert(g == group);
-
- /* Called whenever the entry group state changes */
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED :
- /* The entry group has been established successfully */
- fprintf(stderr, "Service '%s' successfully established.\n", name);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION : {
- char *n;
-
- /* A service name collision happened. Let's pick a new name */
- n = avahi_alternative_service_name(name);
- avahi_free(name);
- name = n;
-
- fprintf(stderr, "Service name collision, renaming service to '%s'\n", name);
-
- /* And recreate the services */
- create_services(avahi_entry_group_get_client(g));
- break;
- }
-
- case AVAHI_ENTRY_GROUP_FAILURE :
-
- /* Some kind of failure happened while we were registering our services */
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void create_services(AvahiClient *c) {
- char r[128];
- int ret;
- assert(c);
-
- /* If this is the first time we're called, let's create a new entry group */
- if (!group)
- if (!(group = avahi_entry_group_new(c, entry_group_callback, NULL))) {
- fprintf(stderr, "avahi_entry_group_new() failed: %s\n", avahi_strerror(avahi_client_errno(c)));
- goto fail;
- }
-
- fprintf(stderr, "Adding service '%s'\n", name);
-
- /* Create some random TXT data */
- snprintf(r, sizeof(r), "random=%i", rand());
-
- /* Add the service for IPP */
- if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
- fprintf(stderr, "Failed to add _ipp._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add the same service for BSD LPR */
- if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
- fprintf(stderr, "Failed to add _printer._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add an additional (hypothetic) subtype */
- if ((ret = avahi_entry_group_add_service_subtype(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, "_magic._sub._printer._tcp") < 0)) {
- fprintf(stderr, "Failed to add subtype _magic._sub._printer._tcp: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Tell the server to register the service */
- if ((ret = avahi_entry_group_commit(group)) < 0) {
- fprintf(stderr, "Failed to commit entry_group: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- return;
-
-fail:
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- assert(c);
-
- /* Called whenever the client or server state changes */
-
- switch (state) {
- case AVAHI_CLIENT_S_RUNNING:
-
- /* The server has startup successfully and registered its host
- * name on the network, so it's time to create our services */
- if (!group)
- create_services(c);
- break;
-
- case AVAHI_CLIENT_S_COLLISION:
-
- /* Let's drop our registered services. When the server is back
- * in AVAHI_SERVER_RUNNING state we will register them
- * again with the new host name. */
- if (group)
- avahi_entry_group_reset(group);
- break;
-
- case AVAHI_CLIENT_FAILURE:
-
- fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
-
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- case AVAHI_CLIENT_S_REGISTERING:
- ;
- }
-}
-
-static void modify_callback(AVAHI_GCC_UNUSED AvahiTimeout *e, void *userdata) {
- AvahiClient *client = userdata;
-
- fprintf(stderr, "Doing some weird modification\n");
-
- avahi_free(name);
- name = avahi_strdup("Modified MegaPrinter");
-
- /* If the server is currently running, we need to remove our
- * service and create it anew */
- if (avahi_client_get_state(client) == AVAHI_CLIENT_S_RUNNING) {
-
- /* Remove the old services */
- if (group)
- avahi_entry_group_reset(group);
-
- /* And create them again with the new name */
- create_services(client);
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiClient *client = NULL;
- int error;
- int ret = 1;
- struct timeval tv;
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- name = avahi_strdup("MegaPrinter");
-
- /* Allocate a new client */
- client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error);
-
- /* Check wether creating the client object succeeded */
- if (!client) {
- fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* After 20s do some weird modification to the service */
- avahi_simple_poll_get(simple_poll)->timeout_new(
- avahi_simple_poll_get(simple_poll),
- avahi_elapse_time(&tv, 1000*10, 0),
- modify_callback,
- client);
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
-
- if (client)
- avahi_client_free(client);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(name);
-
- return ret;
-}
diff --git a/release-0.6.9/examples/core-browse-services.c b/release-0.6.9/examples/core-browse-services.c
deleted file mode 100644
index a34281e..0000000
--- a/release-0.6.9/examples/core-browse-services.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* $Id$ */
-
-/* PLEASE NOTE *
- * This file demonstrates how to use Avahi's core API, this is
- * the embeddable mDNS stack for embedded applications.
- *
- * End user applications should *not* use this API and should use
- * the DBUS or C APIs, please see
- * client-browse-services.c and glib-integration.c
- *
- * I repeat, you probably do *not* want to use this example.
- */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/lookup.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiServer *server = NULL;
-
-static void resolve_callback(
- AvahiSServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *address,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- assert(r);
-
- /* Called whenever a service has been resolved successfully or timed out */
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
- fprintf(stderr, "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_server_errno(server)));
- break;
-
- case AVAHI_RESOLVER_FOUND: {
- char a[AVAHI_ADDRESS_STR_MAX], *t;
-
- fprintf(stderr, "(Resolver) Service '%s' of type '%s' in domain '%s':\n", name, type, domain);
-
- avahi_address_snprint(a, sizeof(a), address);
- t = avahi_string_list_to_string(txt);
- fprintf(stderr,
- "\t%s:%u (%s)\n"
- "\tTXT=%s\n"
- "\tcookie is %u\n"
- "\tis_local: %i\n"
- "\twide_area: %i\n"
- "\tmulticast: %i\n"
- "\tcached: %i\n",
- host_name, port, a,
- t,
- avahi_string_list_get_service_cookie(txt),
- !!(flags & AVAHI_LOOKUP_RESULT_LOCAL),
- !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA),
- !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST),
- !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
- avahi_free(t);
- }
- }
-
- avahi_s_service_resolver_free(r);
-}
-
-static void browse_callback(
- AvahiSServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiServer *s = userdata;
- assert(b);
-
- /* Called whenever a new services becomes available on the LAN or is removed from the LAN */
-
- switch (event) {
-
- case AVAHI_BROWSER_FAILURE:
-
- fprintf(stderr, "(Browser) %s\n", avahi_strerror(avahi_server_errno(server)));
- avahi_simple_poll_quit(simple_poll);
- return;
-
- case AVAHI_BROWSER_NEW:
- fprintf(stderr, "(Browser) NEW: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
-
- /* We ignore the returned resolver object. In the callback
- function we free it. If the server is terminated before
- the callback function is called the server will free
- the resolver for us. */
-
- if (!(avahi_s_service_resolver_new(s, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, resolve_callback, s)))
- fprintf(stderr, "Failed to resolve service '%s': %s\n", name, avahi_strerror(avahi_server_errno(s)));
-
- break;
-
- case AVAHI_BROWSER_REMOVE:
- fprintf(stderr, "(Browser) REMOVE: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- fprintf(stderr, "(Browser) %s\n", event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW");
- break;
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiServerConfig config;
- AvahiSServiceBrowser *sb = NULL;
- int error;
- int ret = 1;
-
- /* Initialize the psuedo-RNG */
- srand(time(NULL));
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- /* Do not publish any local records */
- avahi_server_config_init(&config);
- config.publish_hinfo = 0;
- config.publish_addresses = 0;
- config.publish_workstation = 0;
- config.publish_domain = 0;
-
- /* Set a unicast DNS server for wide area DNS-SD */
- avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
- config.n_wide_area_servers = 1;
- config.enable_wide_area = 1;
-
- /* Allocate a new server */
- server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, NULL, NULL, &error);
-
- /* Free the configuration data */
- avahi_server_config_free(&config);
-
- /* Check wether creating the server object succeeded */
- if (!server) {
- fprintf(stderr, "Failed to create server: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* Create the service browser */
- if (!(sb = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, browse_callback, server))) {
- fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_server_errno(server)));
- goto fail;
- }
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
- if (sb)
- avahi_s_service_browser_free(sb);
-
- if (server)
- avahi_server_free(server);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return ret;
-}
diff --git a/release-0.6.9/examples/core-publish-service.c b/release-0.6.9/examples/core-publish-service.c
deleted file mode 100644
index 65dfe5d..0000000
--- a/release-0.6.9/examples/core-publish-service.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/error.h>
-
-static AvahiSEntryGroup *group = NULL;
-static AvahiSimplePoll *simple_poll = NULL;
-static char *name = NULL;
-
-static void create_services(AvahiServer *s);
-
-static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) {
- assert(s);
- assert(g == group);
-
- /* Called whenever the entry group state changes */
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
-
- /* The entry group has been established successfully */
- fprintf(stderr, "Service '%s' successfully established.\n", name);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
-
- /* A service name collision happened. Let's pick a new name */
- n = avahi_alternative_service_name(name);
- avahi_free(name);
- name = n;
-
- fprintf(stderr, "Service name collision, renaming service to '%s'\n", name);
-
- /* And recreate the services */
- create_services(s);
- break;
- }
-
- case AVAHI_ENTRY_GROUP_FAILURE :
-
- /* Some kind of failure happened while we were registering our services */
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void create_services(AvahiServer *s) {
- char r[128];
- int ret;
- assert(s);
-
- /* If this is the first time we're called, let's create a new entry group */
- if (!group)
- if (!(group = avahi_s_entry_group_new(s, entry_group_callback, NULL))) {
- fprintf(stderr, "avahi_entry_group_new() failed: %s\n", avahi_strerror(avahi_server_errno(s)));
- goto fail;
- }
-
- fprintf(stderr, "Adding service '%s'\n", name);
-
- /* Create some random TXT data */
- snprintf(r, sizeof(r), "random=%i", rand());
-
- /* Add the service for IPP */
- if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
- fprintf(stderr, "Failed to add _ipp._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add the same service for BSD LPR */
- if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
- fprintf(stderr, "Failed to add _printer._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add an additional (hypothetic) subtype */
- if ((ret = avahi_server_add_service_subtype(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, "_magic._sub._printer._tcp") < 0)) {
- fprintf(stderr, "Failed to add subtype _magic._sub._printer._tcp: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Tell the server to register the service */
- if ((ret = avahi_s_entry_group_commit(group)) < 0) {
- fprintf(stderr, "Failed to commit entry_group: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- return;
-
-fail:
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void * userdata) {
- assert(s);
-
- /* Called whenever the server state changes */
-
- switch (state) {
-
- case AVAHI_SERVER_RUNNING:
- /* The serve has startup successfully and registered its host
- * name on the network, so it's time to create our services */
-
- if (!group)
- create_services(s);
-
- break;
-
- case AVAHI_SERVER_COLLISION: {
- char *n;
- int r;
-
- /* A host name collision happened. Let's pick a new name for the server */
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
- fprintf(stderr, "Host name collision, retrying with '%s'\n", n);
- r = avahi_server_set_host_name(s, n);
- avahi_free(n);
-
- if (r < 0) {
- fprintf(stderr, "Failed to set new host name: %s\n", avahi_strerror(r));
-
- avahi_simple_poll_quit(simple_poll);
- return;
- }
-
- /* Let's drop our registered services. When the server is back
- * in AVAHI_SERVER_RUNNING state we will register them
- * again with the new host name. */
- if (group)
- avahi_s_entry_group_reset(group);
-
- break;
- }
-
- case AVAHI_SERVER_FAILURE:
-
- /* Terminate on failure */
-
- fprintf(stderr, "Server failure: %s\n", avahi_strerror(avahi_server_errno(s)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_SERVER_INVALID:
- case AVAHI_SERVER_REGISTERING:
- ;
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiServerConfig config;
- AvahiServer *server = NULL;
- int error;
- int ret = 1;
-
- /* Initialize the pseudo-RNG */
- srand(time(NULL));
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- name = avahi_strdup("MegaPrinter");
-
- /* Let's set the host name for this server. */
- avahi_server_config_init(&config);
- config.host_name = avahi_strdup("gurkiman");
- config.publish_workstation = 0;
-
- /* Allocate a new server */
- server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, server_callback, NULL, &error);
-
- /* Free the configuration data */
- avahi_server_config_free(&config);
-
- /* Check wether creating the server object succeeded */
- if (!server) {
- fprintf(stderr, "Failed to create server: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
-
- if (server)
- avahi_server_free(server);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(name);
-
- return ret;
-}
diff --git a/release-0.6.9/examples/glib-integration.c b/release-0.6.9/examples/glib-integration.c
deleted file mode 100644
index ab53687..0000000
--- a/release-0.6.9/examples/glib-integration.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/error.h>
-#include <avahi-common/timeval.h>
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
-
-/* Callback for Avahi API Timeout Event */
-static void
-avahi_timeout_event (AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata)
-{
- g_message ("Avahi API Timeout reached!");
-}
-
-/* Callback for GLIB API Timeout Event */
-static gboolean
-avahi_timeout_event_glib (void *userdata)
-{
- GMainLoop *loop = userdata;
-
- g_message ("GLIB API Timeout reached, quitting main loop!");
-
- /* Quit the application */
- g_main_loop_quit (loop);
-
- return FALSE; /* Don't re-schedule timeout event */
-}
-
-/* Callback for state changes on the Client */
-static void
-avahi_client_callback (AVAHI_GCC_UNUSED AvahiClient *client, AvahiClientState state, void *userdata)
-{
- GMainLoop *loop = userdata;
-
- g_message ("Avahi Client State Change: %d", state);
-
- if (state == AVAHI_CLIENT_FAILURE)
- {
- /* We we're disconnected from the Daemon */
- g_message ("Disconnected from the Avahi Daemon: %s", avahi_strerror(avahi_client_errno(client)));
-
- /* Quit the application */
- g_main_loop_quit (loop);
- }
-}
-
-int
-main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[])
-{
- GMainLoop *loop = NULL;
- const AvahiPoll *poll_api;
- AvahiGLibPoll *glib_poll;
- AvahiClient *client;
- struct timeval tv;
- const char *version;
- int error;
-
- /* Optional: Tell avahi to use g_malloc and g_free */
- avahi_set_allocator (avahi_glib_allocator ());
-
- /* Create the GLIB main loop */
- loop = g_main_loop_new (NULL, FALSE);
-
- /* Create the GLIB Adaptor */
- glib_poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
- poll_api = avahi_glib_poll_get (glib_poll);
-
- /* Example, schedule a timeout event with the Avahi API */
- avahi_elapse_time (&tv, /* timeval structure */
- 1000, /* 1 second */
- 0); /* "jitter" - Random additional delay from 0 to this value */
-
- poll_api->timeout_new (poll_api, /* The AvahiPoll object */
- &tv, /* struct timeval indicating when to go activate */
- avahi_timeout_event, /* Pointer to function to call */
- NULL); /* User data to pass to function */
-
- /* Schedule a timeout event with the glib api */
- g_timeout_add (5000, /* 5 seconds */
- avahi_timeout_event_glib, /* Pointer to function callback */
- loop); /* User data to pass to function */
-
- /* Create a new AvahiClient instance */
- client = avahi_client_new (poll_api, /* AvahiPoll object from above */
- 0,
- avahi_client_callback, /* Callback function for Client state changes */
- loop, /* User data */
- &error); /* Error return */
-
- /* Check the error return code */
- if (client == NULL)
- {
- /* Print out the error string */
- g_warning ("Error initializing Avahi: %s", avahi_strerror (error));
-
- goto fail;
- }
-
- /* Make a call to get the version string from the daemon */
- version = avahi_client_get_version_string (client);
-
- /* Check if the call suceeded */
- if (version == NULL)
- {
- g_warning ("Error getting version string: %s", avahi_strerror (avahi_client_errno (client)));
-
- goto fail;
- }
-
- g_message ("Avahi Server Version: %s", version);
-
- /* Start the GLIB Main Loop */
- g_main_loop_run (loop);
-
-fail:
- /* Clean up */
- g_main_loop_unref (loop);
- avahi_client_free (client);
- avahi_glib_poll_free (glib_poll);
-
- return 0;
-}
diff --git a/release-0.6.9/initscript/Makefile.am b/release-0.6.9/initscript/Makefile.am
deleted file mode 100644
index 7fcd15f..0000000
--- a/release-0.6.9/initscript/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-SUBDIRS =
-
-if TARGET_DEBIAN
-SUBDIRS += debian
-endif
-
-if TARGET_ARCHLINUX
-SUBDIRS += archlinux
-endif
-
-if TARGET_GENTOO
-SUBDIRS += gentoo
-endif
-
-if TARGET_SUSE
-SUBDIRS += suse
-endif
-
-if TARGET_FEDORA
-SUBDIRS += fedora
-endif
-
-if TARGET_MANDRIVA
-SUBDIRS += mandriva
-endif
-
-if TARGET_DARWIN
-SUBDIRS += darwin
-endif
-
-if TARGET_FREEBSD
-SUBDIRS += freebsd
-endif
-
-if TARGET_SLACKWARE
-SUBDIRS += slackware
-endif
diff --git a/release-0.6.9/initscript/archlinux/Makefile.am b/release-0.6.9/initscript/archlinux/Makefile.am
deleted file mode 100644
index 22096b4..0000000
--- a/release-0.6.9/initscript/archlinux/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-# $Id: Makefile.am 267 2005-08-08 10:19:22Z lennart $
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d
-
-EXTRA_DIST = \
- avahi-daemon.in \
- avahi-dnsconfd.in
-
-initd_SCRIPTS = \
- avahi-daemon \
- avahi-dnsconfd
-
-CLEANFILES = \
- avahi-daemon \
- avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/archlinux/avahi-daemon.in b/release-0.6.9/initscript/archlinux/avahi-daemon.in
deleted file mode 100644
index 1050cb0..0000000
--- a/release-0.6.9/initscript/archlinux/avahi-daemon.in
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# Authors: <lathiat@bur.st>
-#
-
-
-# general config
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD Daemon"
-NAME="avahi-daemon"
-DAEMON="@sbindir@/$NAME"
-
-case "$1" in
- start)
- stat_busy "Starting $DESC"
- $DAEMON -D > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon $NAME
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping $DESC"
- $DAEMON -k > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon $NAME
- stat_done
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- reload)
- stat_busy "Reloading services for $DESC"
- $DAEMON -r > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- stat_done
- fi
- ;;
- *)
- echo "usage: $0 {start|stop|restart|reload}"
- ;;
-esac
-exit 0
diff --git a/release-0.6.9/initscript/archlinux/avahi-dnsconfd.in b/release-0.6.9/initscript/archlinux/avahi-dnsconfd.in
deleted file mode 100755
index 667a0f6..0000000
--- a/release-0.6.9/initscript/archlinux/avahi-dnsconfd.in
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# Authors: <lathiat@bur.st>
-#
-
-
-# general config
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD DNS Server Configuration Daemon"
-NAME="avahi-dnsconfd"
-DAEMON="@sbindir@/$NAME"
-
-case "$1" in
- start)
- stat_busy "Starting $DESC"
- $DAEMON -D > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon $NAME
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping $DESC"
- $DAEMON -k > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon $NAME
- stat_done
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- reload)
- stat_busy "Reloading services for $DESC"
- $DAEMON -r > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- stat_done
- fi
- ;;
- *)
- echo "usage: $0 {start|stop|restart|reload}"
- ;;
-esac
-exit 0
diff --git a/release-0.6.9/initscript/darwin/Makefile.am b/release-0.6.9/initscript/darwin/Makefile.am
deleted file mode 100644
index facc9d5..0000000
--- a/release-0.6.9/initscript/darwin/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = /System/Library/LaunchDaemons/
-
-EXTRA_DIST = \
- org.freedesktop.avahi-daemon.plist.in \
- org.freedesktop.avahi-dnsconfd.plist.in
-
-initd_SCRIPTS = \
- org.freedesktop.avahi-daemon.plist \
- org.freedesktop.avahi-dnsconfd.plist
-
-CLEANFILES = \
- org.freedesktop.avahi-daemon.plist \
- org.freedesktop.avahi-dnsconfd.plist
-
-org.freedesktop.avahi-daemon.plist: org.freedesktop.avahi-daemon.plist.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-org.freedesktop.avahi-dnsconfd.plist: org.freedesktop.avahi-dnsconfd.plist.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/darwin/org.freedesktop.avahi-daemon.plist.in b/release-0.6.9/initscript/darwin/org.freedesktop.avahi-daemon.plist.in
deleted file mode 100644
index 135e40c..0000000
--- a/release-0.6.9/initscript/darwin/org.freedesktop.avahi-daemon.plist.in
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>org.freedesktop.avahi-daemon</string>
- <key>OnDemand</key>
- <false/>
- <key>ProgramArguments</key>
- <array>
- <string>@sbindir@/avahi-daemon</string>
- </array>
- <key>ServiceIPC</key>
- <false/>
-</dict>
-</plist>
diff --git a/release-0.6.9/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in b/release-0.6.9/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in
deleted file mode 100644
index 822a2c0..0000000
--- a/release-0.6.9/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>org.freedesktop.avahi-dnsconfd</string>
- <key>OnDemand</key>
- <false/>
- <key>ProgramArguments</key>
- <array>
- <string>@sbindir@/avahi-dnsconfd</string>
- </array>
- <key>ServiceIPC</key>
- <false/>
-</dict>
-</plist>
diff --git a/release-0.6.9/initscript/debian/Makefile.am b/release-0.6.9/initscript/debian/Makefile.am
deleted file mode 100644
index 7991ea6..0000000
--- a/release-0.6.9/initscript/debian/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = \
- avahi-daemon.in \
- avahi-dnsconfd.in
-
-initd_SCRIPTS = \
- avahi-daemon \
- avahi-dnsconfd
-
-CLEANFILES = \
- avahi-daemon \
- avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/debian/avahi-daemon.in b/release-0.6.9/initscript/debian/avahi-daemon.in
deleted file mode 100755
index 3145f3a..0000000
--- a/release-0.6.9/initscript/debian/avahi-daemon.in
+++ /dev/null
@@ -1,168 +0,0 @@
-#!/bin/sh
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# avahi avahi daemon
-# Daemon for ZeroConf
-#
-# Authors: <sebastien.estienne@gmail.com>
-#
-
-if [ -f /lib/lsb/init-functions ]
-then
- . /lib/lsb/init-functions
-else
- # int log_begin_message (char *message)
- log_begin_msg () {
- if [ -z "$1" ]; then
- return 1
- fi
- echo " * $@"
- }
-
- # int log_end_message (int exitstatus)
- log_end_msg () {
-
- # If no arguments were passed, return
- [ -z "$1" ] && return 1
-
- # Only do the fancy stuff if we have an appropriate terminal
- # and if /usr is already mounted
- TPUT=/usr/bin/tput
- EXPR=/usr/bin/expr
- if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
- COLS=`$TPUT cols`
- if [ -n "$COLS" ]; then
- COL=`$EXPR $COLS - 7`
- else
- COL=73
- fi
- UP=`$TPUT cuu1`
- END=`$TPUT hpa $COL`
- START=`$TPUT hpa 0`
- RED=`$TPUT setaf 1`
- NORMAL=`$TPUT op`
- if [ $1 -eq 0 ]; then
- echo "$UP$END[ ok ]"
- else
- echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
- fi
- else
- if [ $1 -eq 0 ]; then
- echo " ...done."
- else
- echo " ...fail!"
- fi
- fi
- return $1
- }
-
-fi
-
-#set -e
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD Daemon"
-NAME="avahi-daemon"
-DAEMON="@sbindir@/$NAME"
-
-# Gracefully exit if the package has been removed.
-test -x $DAEMON || exit 0
-
-#
-# Function that starts the daemon/service.
-#
-d_start() {
- modprobe capability >/dev/null 2>&1 || true
-
- $DAEMON -c
- [ $? = 0 ] && exit 0
-
- if [ -s /etc/localtime ]; then
- if [ ! -d /etc/avahi/etc ]; then
- mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi
- cp -fp /etc/localtime @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi;
-
- $DAEMON -D
-}
-
-#
-# Function that stops the daemon/service.
-#
-d_stop() {
- $DAEMON -c
- [ $? != 0 ] && exit 0
-
- $DAEMON -k
-}
-
-#
-# Function that reload the config file for the daemon/service.
-#
-d_reload() {
- $DAEMON -c
- [ $? != 0 ] && exit 0
-
- $DAEMON -r
-}
-
-#
-# Function that check the status of the daemon/service.
-#
-d_status() {
- $DAEMON -c
- [ $? = 0 ] && echo "$DESC is running" || echo "$DESC is not running"
-}
-
-case "$1" in
- start)
- log_begin_msg "Starting $DESC: $NAME"
- d_start
- log_end_msg $?
- ;;
- stop)
- log_begin_msg "Stopping $DESC: $NAME"
- d_stop
- log_end_msg $?
- ;;
- reload)
- log_begin_msg "Reloading services for $DESC: $NAME"
- d_reload
- log_end_msg $?
- ;;
- restart|force-reload)
- log_begin_msg "Restarting $DESC: $NAME"
- $DAEMON -c && d_stop
- d_start
- log_end_msg $?
- ;;
- status)
- d_status
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/release-0.6.9/initscript/debian/avahi-dnsconfd.in b/release-0.6.9/initscript/debian/avahi-dnsconfd.in
deleted file mode 100755
index c7cbf05..0000000
--- a/release-0.6.9/initscript/debian/avahi-dnsconfd.in
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/bin/sh
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# avahi-dnsconfd avahi dns configuration daemon
-# Daemon for ZeroConf
-#
-# Authors: <sebastien.estienne@gmail.com>
-#
-
-if [ -f /lib/lsb/init-functions ]
-then
- . /lib/lsb/init-functions
-else
- # int log_begin_message (char *message)
- log_begin_msg () {
- if [ -z "$1" ]; then
- return 1
- fi
- echo " * $@"
- }
-
- # int log_end_message (int exitstatus)
- log_end_msg () {
-
- # If no arguments were passed, return
- [ -z "$1" ] && return 1
-
- # Only do the fancy stuff if we have an appropriate terminal
- # and if /usr is already mounted
- TPUT=/usr/bin/tput
- EXPR=/usr/bin/expr
- if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
- COLS=`$TPUT cols`
- if [ -n "$COLS" ]; then
- COL=`$EXPR $COLS - 7`
- else
- COL=73
- fi
- UP=`$TPUT cuu1`
- END=`$TPUT hpa $COL`
- START=`$TPUT hpa 0`
- RED=`$TPUT setaf 1`
- NORMAL=`$TPUT op`
- if [ $1 -eq 0 ]; then
- echo "$UP$END[ ok ]"
- else
- echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
- fi
- else
- if [ $1 -eq 0 ]; then
- echo " ...done."
- else
- echo " ...fail!"
- fi
- fi
- return $1
- }
-
-fi
-
-#set -e
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi Unicast DNS Configuration Daemon"
-NAME="avahi-dnsconfd"
-DAEMON="@sbindir@/$NAME"
-
-# Gracefully exit if the package has been removed.
-test -x $DAEMON || exit 0
-
-#
-# Function that starts the daemon/service.
-#
-d_start() {
- $DAEMON -c
- [ $? = 0 ] && exit 0
-
- if [ -s /etc/localtime ]; then
- if [ ! -d /etc/avahi/etc ]; then
- mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi
- cp -fp /etc/localtime @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi;
-
- $DAEMON -D
-}
-
-#
-# Function that stops the daemon/service.
-#
-d_stop() {
- $DAEMON -c
- [ $? != 0 ] && exit 0
-
- $DAEMON -k
-}
-
-#
-# Function that reload the config file for the daemon/service.
-#
-d_refresh() {
- $DAEMON -c
- [ $? != 0 ] && exit 0
-
- $DAEMON -r
-}
-
-#
-# Function that check the status of the daemon/service.
-#
-d_status() {
- $DAEMON -c
- [ $? = 0 ] && echo "$DESC is running" || echo "$DESC is not running"
-}
-
-case "$1" in
- start)
- log_begin_msg "Starting $DESC: $NAME"
- d_start
- log_end_msg $?
- ;;
- stop)
- log_begin_msg "Stopping $DESC: $NAME"
- d_stop
- log_end_msg $?
- ;;
- refresh)
- log_begin_msg "Refreshing $DESC: $NAME"
- d_refresh
- log_end_msg $?
- ;;
- reload|restart|force-reload)
- log_begin_msg "Restarting $DESC: $NAME"
- $DAEMON -c && d_stop
- d_start
- log_end_msg $?
- ;;
- status)
- d_status
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/release-0.6.9/initscript/fedora/Makefile.am b/release-0.6.9/initscript/fedora/Makefile.am
deleted file mode 100644
index e18f0f6..0000000
--- a/release-0.6.9/initscript/fedora/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = avahi-daemon avahi-dnsconfd
-
-CLEANFILES = avahi-daemon avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/fedora/avahi-daemon.in b/release-0.6.9/initscript/fedora/avahi-daemon.in
deleted file mode 100644
index aead1be..0000000
--- a/release-0.6.9/initscript/fedora/avahi-daemon.in
+++ /dev/null
@@ -1,102 +0,0 @@
-#! /bin/sh
-#
-# avahi-daemon: Starts the Avahi Daemon
-#
-# chkconfig: 345 98 02
-# description: This is a daemon which runs on client machines to perform \
-# Zeroconf service discovery on a network. avahi-daemon must be \
-# running on systems that use Avahi for service discovery. \
-# Avahi-daemon should not be running otherwise.
-# processname: avahi-daemon
-# config:
-
-OTHER_AVAHI_OPTS=""
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-daemon
-test -x $AVAHI_BIN || exit 5
-
-LOCKFILE=/var/lock/subsys/avahi-daemon
-
-base=${0##*/}
-
-start() {
- echo -n $"Starting Avahi daemon... "
- if [ -s /etc/localtime ]; then
- cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
- fi;
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch $LOCKFILE
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n $"Shutting down Avahi daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
- rm -f $LOCKFILE
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n $"Reloading Avahi daemon... "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base reload" || failure $"$base reload"
- echo
- return $RETVAL
-}
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- if [ -f $LOCKFILE ]; then
- restart
- fi
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
-esac
-
-exit $?
-
diff --git a/release-0.6.9/initscript/fedora/avahi-dnsconfd.in b/release-0.6.9/initscript/fedora/avahi-dnsconfd.in
deleted file mode 100644
index deb81fb..0000000
--- a/release-0.6.9/initscript/fedora/avahi-dnsconfd.in
+++ /dev/null
@@ -1,99 +0,0 @@
-#! /bin/sh
-#
-# avahi-daemon: Starts the Avahi dns configuration daemon
-#
-# chkconfig: - 34 98 02
-# description: avahi-dnsconfd connects to a running avahi-daemon and runs the script
-# /etc/avahi/dnsconf.action for each unicast DNS server that is announced
-# on the local LAN. This is useful for configuring unicast DNS servers in
-# a DHCP-like fashion with mDNS.
-# processname: avahi-dnsconfd
-# config:
-
-OTHER_AVAHI_OPTS=""
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-dnsconfd
-test -x $AVAHI_BIN || exit 5
-
-LOCKFILE=/var/lock/subsys/avahi-daemon
-
-start() {
- echo -n $"Starting Avahi DNS daemon... "
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch $LOCKFILE
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n "Shutting down Avahi DNS daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
- rm -f $LOCKFILE
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n "Reloading Avahi DNS daemon... "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
- echo
- return $RETVAL
-}
-
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo "Avahi DNS daemon is running" || echo "Avahi DNS daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- if [ -f $LOCKFILE ]; then
- restart
- fi
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
- ;;
-esac
-
-exit $?
-
diff --git a/release-0.6.9/initscript/freebsd/Makefile.am b/release-0.6.9/initscript/freebsd/Makefile.am
deleted file mode 100644
index 0ee75d5..0000000
--- a/release-0.6.9/initscript/freebsd/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d
-
-EXTRA_DIST = \
- avahi-daemon.sh.in \
- avahi-dnsconfd.sh.in
-
-initd_SCRIPTS = \
- avahi-daemon.sh \
- avahi-dnsconfd.sh
-
-CLEANFILES = \
- avahi-daemon.sh \
- avahi-dnsconfd.sh
-
-avahi-daemon.sh: avahi-daemon.sh.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd.sh: avahi-dnsconfd.sh.in
- sed \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/freebsd/avahi-daemon.sh.in b/release-0.6.9/initscript/freebsd/avahi-daemon.sh.in
deleted file mode 100644
index f3da39f..0000000
--- a/release-0.6.9/initscript/freebsd/avahi-daemon.sh.in
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: /repoman/r/pcvs/ports/net/avahi/files/avahi-daemon.sh,v 1.2 2005/11/19 05:55:56 marcus Exp $
-#
-# PROVIDE: avahi_daemon
-# REQUIRE: DAEMON dbus
-# KEYWORD: FreeBSD
-#
-# Avahi's mDNSResponder, a Zeroconf (Bonjour) service advertisement daemon.
-#
-
-avahi_daemon_enable=${avahi_daemon_enable-"NO"}
-avahi_daemon_flags=${avahi_daemon_flags-"-D"}
-
-. /etc/rc.subr
-
-name=avahi_daemon
-rcvar=`set_rcvar`
-
-start_cmd=avahi_daemon_start
-stop_cmd=avahi_daemon_stop
-
-avahi_daemon_bin=@sbindir@/avahi-daemon
-
-avahi_daemon_start() {
- checkyesno avahi_daemon_enable && echo "Starting avahi-daemon." && \
- ${avahi_daemon_bin} ${avahi_daemon_flags}
-}
-
-avahi_daemon_stop() {
- checkyesno avahi_daemon_enable && echo "Stopping avahi-daemon." && \
- ${avahi_daemon_bin} -k
-}
-
-load_rc_config ${name}
-run_rc_command "$1"
diff --git a/release-0.6.9/initscript/freebsd/avahi-dnsconfd.sh.in b/release-0.6.9/initscript/freebsd/avahi-dnsconfd.sh.in
deleted file mode 100644
index ed01f06..0000000
--- a/release-0.6.9/initscript/freebsd/avahi-dnsconfd.sh.in
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: /repoman/r/pcvs/ports/net/avahi/files/avahi-dnsconfd.sh,v 1.4 2005/11/19 06:36:09 ahze Exp $
-#
-# PROVIDE: avahi_dnsconfd
-# REQUIRE: DAEMON dbus avahi_daemon
-# KEYWORD: FreeBSD
-#
-# avahi-dnsconfd connects to a running avahi-daemon and runs the script
-# @sysconfdir@/avahi/dnsconf.action for each unicast DNS server that
-# is announced on the local LAN. This is useful for configuring unicast
-# DNS servers in a DHCP-like fashion with mDNS.
-#
-
-avahi_dnsconfd_enable=${avahi_dnsconfd_enable-"NO"}
-avahi_dnsconfd_flags=${avahi_dnsconfd_flags-"-D"}
-
-. /etc/rc.subr
-
-name=avahi_dnsconfd
-rcvar=`set_rcvar`
-
-start_cmd=avahi_dnsconfd_start
-stop_cmd=avahi_dnsconfd_stop
-
-avahi_dnsconfd_bin=@sbindir@/avahi-dnsconfd
-
-avahi_dnsconfd_start() {
- checkyesno avahi_dnsconfd_enable && echo "Starting avahi-dnsconfd." && \
- ${avahi_dnsconfd_bin} ${avahi_dnsconfd_flags}
-}
-
-avahi_dnsconfd_stop() {
- checkyesno avahi_dnsconfd_enable && echo "Stopping avahi-dnsconfd." && \
- ${avahi_dnsconfd_bin} -k
-}
-
-load_rc_config ${name}
-run_rc_command "$1"
diff --git a/release-0.6.9/initscript/gentoo/Makefile.am b/release-0.6.9/initscript/gentoo/Makefile.am
deleted file mode 100644
index 398e345..0000000
--- a/release-0.6.9/initscript/gentoo/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-if !HAVE_DBUS
-NO_DBUS_DEPENDENCY=/need dbus/d
-endif
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = \
- avahi-daemon.in \
- avahi-dnsconfd.in
-
-initd_SCRIPTS = \
- avahi-daemon \
- avahi-dnsconfd
-
-CLEANFILES = \
- avahi-daemon \
- avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
-
- sed -e 's,@sbindir\@,$(sbindir),g; $(NO_DBUS_DEPENDENCY)' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/gentoo/avahi-daemon.in b/release-0.6.9/initscript/gentoo/avahi-daemon.in
deleted file mode 100644
index 1ceae13..0000000
--- a/release-0.6.9/initscript/gentoo/avahi-daemon.in
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/sbin/runscript
-# $Id$
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-opts="${opts} reload"
-
-depend() {
- use net
- need dbus
-}
-
-start() {
- ebegin "Starting avahi-daemon"
- @sbindir@/avahi-daemon -D
- eend $?
-}
-
-stop() {
- ebegin "Stopping avahi-daemon"
- @sbindir@/avahi-daemon -k
- eend $?
-}
-
-reload() {
- ebegin "Reloading avahi-daemon"
- @sbindir@/avahi-daemon -r
- eend $?
-}
diff --git a/release-0.6.9/initscript/gentoo/avahi-dnsconfd.in b/release-0.6.9/initscript/gentoo/avahi-dnsconfd.in
deleted file mode 100644
index 54c2aa6..0000000
--- a/release-0.6.9/initscript/gentoo/avahi-dnsconfd.in
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/sbin/runscript
-# $Id$
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-opts="${opts} reload"
-
-depend() {
- need avahi-daemon
- use net
-}
-
-start() {
- ebegin "Starting avahi-dnsconfd"
- @sbindir@/avahi-dnsconfd -D
- eend $?
-}
-
-stop() {
- ebegin "Stopping avahi-dnsconfd"
- @sbindir@/avahi-dnsconfd -k
- eend $?
-}
-
-reload() {
- ebegin "Reloading avahi-dnsconfd"
- @sbindir@/avahi-dnsconfd -r
- eend $?
-}
diff --git a/release-0.6.9/initscript/mandriva/Makefile.am b/release-0.6.9/initscript/mandriva/Makefile.am
deleted file mode 100644
index 10fd4cf..0000000
--- a/release-0.6.9/initscript/mandriva/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id: Makefile.am 838 2005-10-22 21:23:02Z lennart $
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d/init.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = avahi-daemon avahi-dnsconfd
-
-CLEANFILES = avahi-daemon avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/mandriva/avahi-daemon.in b/release-0.6.9/initscript/mandriva/avahi-daemon.in
deleted file mode 100644
index 2efbc6e..0000000
--- a/release-0.6.9/initscript/mandriva/avahi-daemon.in
+++ /dev/null
@@ -1,94 +0,0 @@
-#! /bin/sh
-#
-### BEGIN INIT INFO
-# Provides: avahi
-# Required-Start: $network messagebus
-# Required-Stop: $network messagebus
-# Default-Start: 3 5
-# Description: Avahi, a ZeroConf daemon whichs implements an mDNS stack
-### END INIT INFO
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-daemon
-test -x $AVAHI_BIN || exit 5
-
-start() {
- echo -n $"Starting Avahi daemon: "
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch /var/lock/subsys/avahi-daemon
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n "Shutting down Avahi daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- rm -f /var/lock/subsys/avahi-daemon
- success $"$base stop"
- else
- failure $"$base stop"
- fi
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n "Reloading Avahi daemon: "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
- echo
- return $RETVAL
-}
-
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo "Avahi daemon is running" || echo "Avahi daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- $AVAHI_BIN -c
- [ $? = 0 ] && restart || :
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
-esac
-
-exit $?
diff --git a/release-0.6.9/initscript/mandriva/avahi-dnsconfd.in b/release-0.6.9/initscript/mandriva/avahi-dnsconfd.in
deleted file mode 100644
index 3e8aaaf..0000000
--- a/release-0.6.9/initscript/mandriva/avahi-dnsconfd.in
+++ /dev/null
@@ -1,94 +0,0 @@
-#! /bin/sh
-#
-### BEGIN INIT INFO
-# Provides: avahi-dnsconfd
-# Required-Start: avahi
-# Required-Stop: avahi
-# Default-Start: 3 5
-# Description: A DNS configuration daemon using mDNS in a DHCP-like fashion
-### END INIT INFO
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-dnsconfd
-test -x $AVAHI_BIN || exit 5
-
-start() {
- echo -n $"Starting Avahi DNS daemon: "
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch /var/lock/subsys/avahi-dnsconfd
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n "Shutting down Avahi DNS daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- rm -f /var/lock/subsys/avahi-dnsconfd
- success $"$base stop"
- else
- failure $"$base stop"
- fi
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n "Reloading Avahi DNS daemon: "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
- echo
- return $RETVAL
-}
-
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo "Avahi DNS daemon is running" || echo "Avahi DNS daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- $AVAHI_BIN -c
- [ $? = 0 ] && restart || :
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
-esac
-
-exit $?
diff --git a/release-0.6.9/initscript/slackware/Makefile.am b/release-0.6.9/initscript/slackware/Makefile.am
deleted file mode 100644
index 3175a15..0000000
--- a/release-0.6.9/initscript/slackware/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = rc.avahidaemon rc.avahidnsconfd
-
-CLEANFILES = rc.avahidaemon rc.avahidnsconfd
-
-rc.avahidaemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-rc.avahidnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/slackware/avahi-daemon.in b/release-0.6.9/initscript/slackware/avahi-daemon.in
deleted file mode 100644
index acd377d..0000000
--- a/release-0.6.9/initscript/slackware/avahi-daemon.in
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Start/stop/restart the avahi daemon:
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD Daemon"
-NAME="avahi-daemon"
-DAEMON="@sbindir@/$NAME"
-
-avahid_start()
-{
- echo "Starting $DESC: $DAEMON -D"
- $DAEMON -D
-}
-
-avahid_status()
-{
- $DAEMON -c
- [ $? = 0 ]
-}
-
-avahid_stop()
-{
- echo -en "Stopping $DESC: "
- $DAEMON -c
- [ $? != 0 ]
- echo "stopped";
- $DAEMON -k 2>/dev/null
-}
-
-avahid_restart()
-{
- avahid_stop
- avahid_start
-}
-
-case "$1" in
-'start')
- if ( ! avahid_status ); then
- avahid_start
- else
- echo "$DESC is already running (will not start it twice)."
- fi
- ;;
-'stop')
- avahid_stop
- ;;
-'restart')
- avahid_restart
- ;;
-'status')
- if ( avahid_status ); then
- echo "$DESC is currently running"
- else
- echo "$DESC is not running."
- fi
- ;;
-*)
- echo "usage $0 start|stop|status|restart"
-esac
-
diff --git a/release-0.6.9/initscript/slackware/avahi-dnsconfd.in b/release-0.6.9/initscript/slackware/avahi-dnsconfd.in
deleted file mode 100644
index 4da14fa..0000000
--- a/release-0.6.9/initscript/slackware/avahi-dnsconfd.in
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Start/stop/restart the avahi dnsconfd daemon:
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD DNS Server Configuration Daemon"
-NAME="avahi-dnsconfd"
-DAEMON="@sbindir@/$NAME"
-
-avahidns_start()
-{
- echo "Starting $DESC: $DAEMON -D"
- $DAEMON -D
-}
-
-avahidns_status()
-{
- $DAEMON -c
- [ $? = 0 ]
-}
-
-avahidns_stop()
-{
- echo -en "Stopping $DESC: "
- $DAEMON -c
- [ $? != 0 ]
- echo "stopped";
- $DAEMON -k 2>/dev/null
-}
-
-avahidns_restart()
-{
- avahidns_stop
- avahidns_start
-}
-
-case "$1" in
-'start')
- if ( ! avahidns_status ); then
- avahidns_start
- else
- echo "$DESC is already running (will not start it twice)."
- fi
- ;;
-'stop')
- avahidns_stop
- ;;
-'restart')
- avahidns_restart
- ;;
-'status')
- if ( avahidns_status ); then
- echo "$DESC is currently running"
- else
- echo "$DESC is not running."
- fi
- ;;
-*)
- echo "usage $0 start|stop|status|restart"
-esac
-
diff --git a/release-0.6.9/initscript/suse/Makefile.am b/release-0.6.9/initscript/suse/Makefile.am
deleted file mode 100644
index e18f0f6..0000000
--- a/release-0.6.9/initscript/suse/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = avahi-daemon avahi-dnsconfd
-
-CLEANFILES = avahi-daemon avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/release-0.6.9/initscript/suse/avahi-daemon.in b/release-0.6.9/initscript/suse/avahi-daemon.in
deleted file mode 100644
index 1625464..0000000
--- a/release-0.6.9/initscript/suse/avahi-daemon.in
+++ /dev/null
@@ -1,47 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: avahi
-# Required-Start: $network dbus
-# Default-Start: 3 5
-# Default-Stop:
-# Description: Avahi, a ZeroConf daemon for mDNS and service registration
-### END INIT INFO
-
-AVAHI_BIN=@sbindir@/avahi-daemon
-test -x $AVAHI_BIN || exit 5
-
-. /etc/rc.status
-rc_reset
-
-case "$1" in
- start)
- echo -n "Starting Avahi daemon"
- /sbin/startproc $AVAHI_BIN -D
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down Avahi daemon"
- $AVAHI_BIN -k || /bin/true
- rc_status -v
- ;;
- restart)
- $0 stop
- $0 start
- rc_status
- ;;
- force-reload|reload)
- echo -n "Reloading Avahi daemon"
- $AVAHI_BIN -r
- rc_status -v
- ;;
- status)
- echo -n "Checking for Avahi daemon: "
- $AVAHI_BIN -c
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|force-reload|reload}"
- exit 1
- ;;
-esac
-
diff --git a/release-0.6.9/initscript/suse/avahi-dnsconfd.in b/release-0.6.9/initscript/suse/avahi-dnsconfd.in
deleted file mode 100644
index b9de808..0000000
--- a/release-0.6.9/initscript/suse/avahi-dnsconfd.in
+++ /dev/null
@@ -1,47 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: avahi-dnsconfd
-# Required-Start: avahi
-# Default-Start: 3 5
-# Default-Stop:
-# Description: Avahi, a ZeroConf daemon for mDNS and service registration
-### END INIT INFO
-
-AVAHI_BIN=@sbindir@/avahi-dnsconfd
-test -x $AVAHI_BIN || exit 5
-
-. /etc/rc.status
-rc_reset
-
-case "$1" in
- start)
- echo -n "Starting Avahi DNS Configuration daemon"
- /sbin/startproc $AVAHI_BIN -D
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down Avahi DNS Configuration daemon"
- $AVAHI_BIN -k || /bin/true
- rc_status -v
- ;;
- restart)
- $0 stop
- $0 start
- rc_status
- ;;
- force-reload|reload)
- echo -n "Reloading Avahi DNS Configuration daemon"
- $AVAHI_BIN -r
- rc_status -v
- ;;
- status)
- echo -n "Checking for Avahi DNS Configuration daemon: "
- $AVAHI_BIN -c
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|force-reload|reload}"
- exit 1
- ;;
-esac
-
diff --git a/release-0.6.9/man/Makefile.am b/release-0.6.9/man/Makefile.am
deleted file mode 100644
index 3b90835..0000000
--- a/release-0.6.9/man/Makefile.am
+++ /dev/null
@@ -1,191 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-pkgsysconfdir=$(sysconfdir)/avahi
-servicedir=$(pkgsysconfdir)/services
-
-if BUILD_MANPAGES
-
-man_MANS = \
- avahi-daemon.8 \
- avahi-dnsconfd.8 \
- avahi-daemon.conf.5 \
- avahi-dnsconfd.action.8 \
- avahi.service.5 \
- avahi.hosts.5
-
-noinst_DATA = \
- avahi-browse.1.xml \
- avahi-publish.1.xml \
- avahi-resolve.1.xml \
- avahi-daemon.8.xml \
- avahi-discover.1.xml \
- avahi-bookmarks.1.xml \
- avahi-dnsconfd.8.xml \
- avahi-daemon.conf.5.xml \
- avahi-dnsconfd.action.8.xml \
- avahi.service.5.xml \
- avahi.hosts.5.xml
-
-CLEANFILES = \
- $(noinst_DATA)
-
-if HAVE_DBUS
-
-man_MANS += \
- avahi-browse.1 \
- avahi-resolve.1 \
- avahi-publish.1
-
-if HAVE_PYTHON
-man_MANS += \
- avahi-discover.1 \
- avahi-bookmarks.1
-endif
-endif
-
-avahi-browse.1.xml: avahi-browse.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-publish.1.xml: avahi-publish.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-resolve.1.xml: avahi-resolve.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-daemon.8.xml: avahi-daemon.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@servicedir\@,$(servicedir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-discover.1.xml: avahi-discover.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-bookmarks.1.xml: avahi-bookmarks.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-dnsconfd.8.xml: avahi-dnsconfd.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-daemon.conf.5.xml: avahi-daemon.conf.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-dnsconfd.action.8.xml: avahi-dnsconfd.action.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi.service.5.xml: avahi.service.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@servicedir\@,$(servicedir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi.hosts.5.xml: avahi.hosts.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-if USE_XMLTOMAN
-
-CLEANFILES += $(man_MANS)
-
-avahi-browse.1: avahi-browse.1.xml Makefile
- xmltoman $< > $@
-
-avahi-publish.1: avahi-publish.1.xml Makefile
- xmltoman $< > $@
-
-avahi-resolve.1: avahi-resolve.1.xml Makefile
- xmltoman $< > $@
-
-avahi-daemon.8: avahi-daemon.8.xml Makefile
- xmltoman $< > $@
-
-avahi-discover.1: avahi-discover.1.xml Makefile
- xmltoman $< > $@
-
-avahi-bookmarks.1: avahi-bookmarks.1.xml Makefile
- xmltoman $< > $@
-
-avahi-dnsconfd.8: avahi-dnsconfd.8.xml Makefile
- xmltoman $< > $@
-
-avahi-daemon.conf.5: avahi-daemon.conf.5.xml Makefile
- xmltoman $< > $@
-
-avahi-dnsconfd.action.8: avahi-dnsconfd.action.8.xml Makefile
- xmltoman $< > $@
-
-avahi.service.5: avahi.service.5.xml Makefile
- xmltoman $< > $@
-
-avahi.hosts.5: avahi.hosts.5.xml Makefile
- xmltoman $< > $@
-
-xmllint: $(noinst_DATA)
- for f in $(noinst_DATA) ; do \
- xmllint --noout --valid "$$f" || exit 1 ; \
- done
-
-endif
-
-endif
-
-EXTRA_DIST = \
- $(man_MANS) \
- avahi-browse.1.xml.in \
- avahi-publish.1.xml.in \
- avahi-resolve.1.xml.in \
- avahi-daemon.8.xml.in \
- avahi-discover.1.xml.in \
- avahi-bookmarks.1.xml.in \
- avahi-dnsconfd.8.xml.in \
- avahi-daemon.conf.5.xml.in \
- avahi-dnsconfd.action.8.xml.in \
- avahi.service.5.xml.in \
- avahi.hosts.5.xml.in \
- xmltoman.css \
- xmltoman.xsl \
- xmltoman.dtd
-
-
-if HAVE_DBUS
-
-install-exec-local:
- mkdir -p $(DESTDIR)/$(mandir)/man1 && \
- cd $(DESTDIR)/$(mandir)/man1 && \
- rm -f avahi-resolve-host-name.1 avahi-resolve-address.1 avahi-browse-domains.1 avahi-publish-address.1 avahi-publish-service.1 && \
- $(LN_S) avahi-resolve.1 avahi-resolve-host-name.1 && \
- $(LN_S) avahi-resolve.1 avahi-resolve-address.1 && \
- $(LN_S) avahi-browse.1 avahi-browse-domains.1 && \
- $(LN_S) avahi-publish.1 avahi-publish-address.1 && \
- $(LN_S) avahi-publish.1 avahi-publish-service.1
-
-endif
diff --git a/release-0.6.9/man/avahi-bookmarks.1.xml.in b/release-0.6.9/man/avahi-bookmarks.1.xml.in
deleted file mode 100644
index 25661f6..0000000
--- a/release-0.6.9/man/avahi-bookmarks.1.xml.in
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-bookmarks" section="1" desc="Web service showing mDNS/DNS-SD announced HTTP services using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-bookmarks</cmd>
- </synopsis>
-
- <description>
- <p>A web service for listing HTTP services that are announced
- via mDNS/DNS-SD using the Avahi daemon. avahi-bookmarks opens a
- TCP socket on port 8080 and waits for incoming HTTP connections
- returning a dynamic web site containing links to all services of
- type _http._tcp on the LAN. Point your browser to
- http://localhost:8080/ to make use of avahi-bookmarks.</p>
-
- </description>
-
- <options>
- <option>
- <p><opt>-p | --port=</opt> <arg>PORT</arg></p>
- <optdesc><p>Specify a TCP port number to listen on. If omitted defaults to 8080.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-a | --address=</opt> <arg>address</arg></p>
- <optdesc><p>Specify an IP address to listen on. If omitted defaults to 127.0.0.1. Specify 0.0.0.0 if you want to allow remote access.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-H | --host-names</opt></p>
- <optdesc><p>Create links pointing to mDNS host names instead
- of resolved IP addreses. This is only compatible with your
- browser if you run some kind of local NSS module to resolve
- mDNS host names (e.g. nss-mdns). If both -A and -H are ommited
- avahi-bookmarks detects whether NSS support is available
- locally. This option conflicts with -A.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-A | --addresses</opt></p>
- <optdesc><p>Create links pointing to numeric IP addresses
- instead of mDNS host names. This will break access to hosts
- running virtual servers. If both -A and -H are ommited
- avahi-bookmarks detects whether NSS support is available
- locally. This option conflicts with -H.</p></optdesc>
- </option>
-
-
- <option>
- <p><opt>-d | --domain</opt>=<arg>DOMAIN</arg></p>
- <optdesc><p>The domain to browse for services in.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- </options>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-browse" section="1"/>, <manref name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-browse.1.xml.in b/release-0.6.9/man/avahi-browse.1.xml.in
deleted file mode 100644
index 306152d..0000000
--- a/release-0.6.9/man/avahi-browse.1.xml.in
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-browse" section="1" desc="Browse for mDNS/DNS-SD services using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-browse [<arg>options</arg>] <arg>service-type</arg></cmd>
- <cmd>avahi-browse [<arg>options</arg>] <opt>--all</opt></cmd>
- <cmd>avahi-browse [<arg>options</arg>] <opt>--browse-domains</opt></cmd>
- <cmd>avahi-browse-domains [<arg>options</arg>]</cmd>
- </synopsis>
-
- <description>
- <p>Browse for mDNS/DNS-SD network services and browsing domains using the Avahi daemon.</p>
-
- </description>
-
- <options>
-
- <p>Specify a DNS-SD service type (e.g. _http._tcp) to browse for
- on the command line, or <opt>-a</opt> to browse for all
- available service types. Items that appear on the network are prefixed with "+", items that disappear are prefixed with "-".</p>
-
- <option>
- <p><opt>-a | --all</opt></p>
- <optdesc><p>Browse for all service types registered on the LAN, not just the one specified on the command line.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-D | --browse-domains</opt></p>
- <optdesc><p>Browse for browsing domains instead for services. avahi-browse-domains is equivalent to avahi-browse --browse-domains</p></optdesc>
- </option>
-
- <option>
- <p><opt>-d | --domain=</opt> <arg>DOMAIN</arg></p>
- <optdesc><p>Browse in the specified domain. If omitted
- avahi-browse will browse in the default browsing domain
- (usually .local)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --verbose</opt></p>
- <optdesc><p>Enable verbose mode.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-t | --terminate</opt></p>
- <optdesc><p>Terminate after dumping a more or less complete list.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-c | --cache</opt></p>
- <optdesc><p>Terminate after dumping all entries available in the cache.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-l | --ignore-local</opt></p>
- <optdesc><p>Ignore local services, show only remote services.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-r | --resolve</opt></p>
- <optdesc><p>Automatically resolve services found.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-f | --no-fail</opt></p>
- <optdesc><p>Don't fail if the daemon is not found running. Instead, wait until it appears. If it disconnects, try to reconnect.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-k | --no-db-lookup</opt></p>
- <optdesc><p>Don't lookup services types in service type database.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-V | --version</opt></p>
- <optdesc><p>Show version information.</p></optdesc>
- </option>
-
- </options>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-publish" section="1"/>, <manref name="avahi-resolve" section="1"/>, <manref name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-daemon.8.xml.in b/release-0.6.9/man/avahi-daemon.8.xml.in
deleted file mode 100644
index 7d01a4b..0000000
--- a/release-0.6.9/man/avahi-daemon.8.xml.in
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-daemon" section="8" desc="The Avahi mDNS/DNS-SD daemon">
-
- <synopsis>
- <cmd>avahi-daemon [<arg>options</arg>]</cmd>
- <cmd>avahi-daemon <opt>--kill</opt></cmd>
- <cmd>avahi-daemon <opt>--reload</opt></cmd>
- <cmd>avahi-daemon <opt>--check</opt></cmd>
- </synopsis>
-
- <description>
- <p>The Avahi mDNS/DNS-SD daemon implementing Apple's ZeroConf
- architecture (also known as "Rendezvous" or "Bonjour"). The daemon
- registers local IP addresses and static services using
- mDNS/DNS-SD and provides two IPC APIs for local programs to make
- use of the mDNS record cache the avahi-daemon maintains. First
- there is the so called "simple protocol" which is used
- exclusively by avahi-dnsconfd (a daemon which configures unicast
- DNS servers using server info published via mDNS) and nss-mdns
- (a libc NSS plugin, providing name resolution via mDNS). Finally
- there is the DBUS interface which provides a rich object
- oriented interface to DBUS enabled applications.</p>
-
- <p>Upon startup avahi-daemon interprets its configuration file
- <file>@pkgsysconfdir@/avahi-daemon.conf</file> and reads XML
- fragments from <file>@servicedir@/*.service</file> which may
- define static DNS-SD services. If you enable
- <opt>publish-resolv-conf-dns-servers</opt> in
- <file>avahi-daemon.conf</file> the file
- <file>/etc/resolv.conf</file> will be read, too.</p>
- </description>
-
- <options>
-
- <option>
- <p><opt>-f | --file=</opt> <arg>FILE</arg></p>
- <optdesc><p>Specify the configuration file to read. (default: @pkgsysconfdir@/avahi-daemon.conf)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-D | --daemonize</opt></p>
- <optdesc><p>Daemonize after startup. Implies <opt>--syslog</opt></p></optdesc>
- </option>
-
- <option>
- <p><opt>-s | --syslog</opt></p>
- <optdesc><p>Log to syslog instead of STDERR. Implied by <opt>--daemonize</opt></p></optdesc>
- </option>
-
- <option>
- <p><opt>--debug</opt></p>
- <optdesc><p>Increase verbosity to debug level</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-rlimits</opt></p>
- <optdesc><p>Don't enforce resource limits as specified in the configuration file. (See <manref section="2" name="setrlimit"/> for more information)</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-drop-root</opt></p>
- <optdesc><p>Don't drop root priviliges after startup and don't require daemon to be started as root. We recommend not to use this option.</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-chroot</opt></p>
- <optdesc><p>Don't <manref section="2" name="chroot"/> the daemon. This option is only available when compiled with chroot() support.</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-proctitle</opt></p>
- <optdesc><p>Don't change the process name while
- running. Unless this option is specified avahi will reflect
- it's current state and selected host name in the process
- title.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-k | --kill</opt></p>
- <optdesc><p>Kill an already running avahi-daemon. (equivalent to sending a SIGTERM)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-r | --reload</opt></p>
- <optdesc><p>Tell an already running avahi-daemon to reread
- <file>/etc/resolv.conf</file> (in case you enabled
- <opt>publish-resolv-conf-dns-servers</opt> in
- <file>avahi-daemon.conf</file>) the files from
- <file>@servicedir@/</file>. Please note that this will not
- reload the
- <file>@pkgsysconfdir@/avahi-daemon.conf</file>. (equivalent to
- sending a SIGHUP)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-c | --check</opt></p>
- <optdesc><p>Return 0 as return code when avahi-daemon is already running.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --version</opt></p>
- <optdesc><p>Show version information </p></optdesc>
- </option>
-
- </options>
-
- <section name="Files">
-
- <p><file>@pkgsysconfdir@/avahi-daemon.conf</file>: the default configuration file for avahi-daemon, <manref name="avahi-daemon.conf" section="5"/> for more information.</p>
-
- <p><file>@pkgsysconfdir@/hosts</file>: additional static hostname mappings to publish in mDNS, see <manref name="avahi.hosts" section="5"/> for more information.</p>
-
- <p><file>@servicedir@/*.service</file>: static service definitions, see <manref name="avahi.service" section="5"/> for more information.</p>
-
- </section>
-
- <section name="Signals">
- <p><arg>SIGINT, SIGTERM, SIGQUIT</arg>: avahi-daemon will shutdown. This is issued by passing --kill to avahi-daemon.</p>
- <p><arg>SIGHUP</arg>: avahi-daemon will reload unicast DNS
- server data from <file>/etc/resolv.conf</file> and static
- service definitions from <file>@servicedir@/</file>.</p>
- <p><arg>SIGUSR1</arg>: avahi-daemon will dump local and remote cached resource record data to syslog.</p>
- </section>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon.conf" section="5"/>, <manref name="avahi.hosts" section="5"/>, <manref name="avahi.service" section="5"/>, <manref name="avahi-dnsconfd" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-daemon.conf.5.xml.in b/release-0.6.9/man/avahi-daemon.conf.5.xml.in
deleted file mode 100644
index 5f59f16..0000000
--- a/release-0.6.9/man/avahi-daemon.conf.5.xml.in
+++ /dev/null
@@ -1,303 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-daemon.conf" section="5" desc="avahi-daemon configuration file">
-
- <synopsis>
- <cmd>@pkgsysconfdir@/avahi-daemon.conf</cmd>
- </synopsis>
-
- <description>
- <p><file>avahi-daemon.conf</file> is the configuration file for avahi-daemon.</p>
- </description>
-
- <section name="Section [Server]">
-
- <option>
- <p><opt>host-name=</opt> Set the host name avahi-daemon tries
- to register on the LAN. If omited defaults to the system host
- name as set with the sethostname() system call.</p>
- </option>
-
- <option>
- <p><opt>domain-name=</opt> Set the default domain name avahi-daemon
- tries to register its host name and services on the LAN in. If
- omitted defaults to ".local".</p>
- </option>
-
- <option>
- <p><opt>browse-domains=</opt> Set a comma seperated list of
- browsing domains (in addition to the default one and those
- announced inside the default browsing domain). Please note
- that the user may specify additional browsing domains on the
- client side, either by setting $AVAHI_BROWSE_DOMAINS to a list
- of colon seperated domains or by adding them to the XDG config
- file <file>~/.config/avahi/browse-domains</file> (seperated by
- newlines).</p>
-
- </option>
-
- <option>
- <p><opt>use-ipv4=</opt> Takes a boolean value ("yes" or
- "no"). If set to "no" avahi-daemon will not use IPv4
- sockets. Default is "yes".</p>
- </option>
-
- <option>
- <p><opt>use-ipv6=</opt> Takes a boolean value ("yes" or
- "no"). If set to "no" avahi-daemon will not use IPv6
- sockets. Default is "yes".</p>
- </option>
-
- <option>
- <p><opt>check-response-ttl=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes", an additional security check is
- activated: incoming IP packets will be ignored unless the IP
- TTL is 255. Earlier mDNS specifications required this
- check. Since this feature may be incompatible with newer
- implementations of mDNS it defaults to "no". On the other hand
- it provides extra security.</p>
- </option>
-
- <option>
- <p><opt>use-iff-running=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" avahi-daemon monitors the IFF_RUNNING
- flag bit which is used by some (modern) network drivers to
- tell user space if a network cable is plugged in (in case of
- copper ethernet), or the network card is associated with some
- kind of network (in case of WLAN). If IFF_RUNNING is set
- avahi-daemon will automatically announce its services on that
- network. Unfortunately far too many network drivers do not
- support this flag or support it in a broken way. Therefore
- this option defaults to "no".</p>
- </option>
-
- <option>
- <p><opt>enable-dbus=</opt> Takes either "yes", "no" or
- "warn". If set to "yes" avahi-daemon connects to D-BUS,
- offering an object oriented client API. It is only available
- if avahi has been compiled with <opt>--enable-dbus</opt> in
- which case it defaults to "yes". "warn" behaves like "yes",
- but the daemon starts up even when it fails to connect to a
- D-BUS daemon.</p>
- </option>
-
- <option>
- <p><opt>disallow-other-stacks=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes" no other process is allowed
- to bind to UDP port 5353. This effectively impedes other mDNS
- stacks from running on the host. Use this as a security
- measure to make sure that only Avahi is responsible for mDNS
- traffic. Please note that we do no recommend running multiple
- mDNS stacks on the same host simultaneously. This hampers
- reliability and is a waste of resources. However, to not annoy
- people this option defaults to "no".</p>
- </option>
-
- <option>
- <p><opt>allow-point-to-point=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes" avahi-daemon will make use of
- interfaces with the POINTOPOINT flag set. This option defaults
- to "no" as it might make mDNS unreliable due to usually large
- latencies with such links and opens a potential security hole
- by allowing mDNS access from Internet connections. Use with
- care and YMMV!</p>
- </option>
-
- </section>
-
- <section name="Section [wide-area]">
- <option>
- <p><opt>enable-wide-area=</opt> Takes a boolean value
- ("yes" or "no"). Enable wide-area DNS-SD, aka
- DNS-SD over unicast DNS. If this is enabled only domains
- ending in .local will be resolved on mDNS, all other domains
- are resolved via unicast DNS. If you want to maintain multiple
- different multicast DNS domains even with this option enabled
- we encourage you to use subdomains of .local, such as
- "kitchen.local". This option defaults to "yes".</p>
- </option>
-
- </section>
-
- <section name="Section [publish]">
-
- <option><p><opt>disable-publishing=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes", no record will be published by
- Avahi, not even address records for the local host. Avahi will
- be started in a querying-only mode. Use this is a security
- measure. This option defaults to "no"</p></option>
-
- <option><p><opt>disable-user-service-publishing=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes", Avahi will still publish
- address records and suchlike but will not allow user
- applications to publish services. Use this is a security
- measure. This option defaults to "no"</p></option>
-
- <option>
- <p><opt>add-service-cookie=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes" an implicit TXT entry will be added
- to all locally registered services, containing a cookie value
- which is chosen randomly on daemon startup. This can be used
- to detect if two services on two different
- interfaces/protocols are actually identical. Defaults to
- "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-addresses=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes" avahi-daemon will register mDNS
- address records for all local IP addresses. Unless you want to
- use avahi-daemon exclusively for browsing it's recommended to
- enable this. If you plan to register local services you need
- to enable this option. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-hinfo=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" avahi-daemon will register an mDNS
- HINFO record on all interfaces which contains information
- about the local operating system and CPU, which might be
- useful for administrative purposes. This is recommended by the
- mDNS specification but not required. For the sake of privacy
- you might choose to disable this feature. Defaults to
- "yes."</p>
- </option>
-
- <option>
- <p><opt>publish-workstation=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes" avahi-daemon will register a
- service of type "_workstation._tcp" on the local LAN. This
- might be useful for administrative purposes (i.e. browse for
- all PCs on the LAN), but is not required or recommended by any
- specification. Newer MacOS X releases register a service of
- this type. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-domain=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" avahi-daemon will announce the locally
- used domain name (see above) for browsing by other
- hosts. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-dns-servers=</opt> Takes a comma seperated
- list of IP addresses for unicast DNS servers. You can use this
- to announce unicast DNS servers via mDNS. When used in
- conjunction with avahi-dnsconfd on the client
- side this allows DHCP-like configuration of unicast DNS
- servers.</p>
- </option>
-
- <option>
- <p><opt>publish-resolv-conf-dns-servers=</opt> Takes a boolean
- value ("yes" or "no"). If set to "yes" avahi-daemon will
- publish the unicast DNS servers specified in
- <file>/etc/resolv.conf</file> in addition to those specified
- with <opt>publish-dns-servers</opt>. Send avahi-daemon a
- SIGHUP to have it reload this file. Defaults to "no".</p>
- </option>
-
- </section>
-
- <section name="Section [reflector]">
- <option>
- <p><opt>enable-reflector=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes" avahi-daemon will reflect incoming
- mDNS requests to all local network interfaces, effectively
- allowing clients to browse mDNS/DNS-SD services on all
- networks connected to the gateway. The gateway is somewhat
- intelligent and should work with all kinds of mDNS traffic,
- though some functionality is lost (specifically the unicast
- reply bit, which is used rarely anyway). Make sure to not run
- multiple reflectors between the same networks, this might
- cause them to play Ping Pong with mDNS packets. Defaults to
- "no".</p>
- </option>
-
- <option>
- <p><opt>reflect-ipv=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" and <opt>enable-reflector</opt> is
- enabled, avahi-daemon will forward mDNS traffic between IPv4
- and IPv6, which is usually not recommended. Defaults to "no".</p>
- </option>
- </section>
-
- <section name="Section [rlimits]">
- <p>This section is used to define system resource limits for the
- daemon. See <manref section="2" name="setrlimit"/> for more
- information. If any of the options is not specified in the configuration
- file, avahi-daemon does not change it from the system
- defaults.</p>
-
-
- <option>
- <p><opt>rlimit-as=</opt> Value in bytes for RLIMIT_AS (maximum size of the process's virtual memory). Sensible values are heavily system dependent.</p>
- </option>
-
- <option>
- <p><opt>rlimit-core=</opt> Value in bytes for RLIMIT_CORE (maximum core file size). Unless you want to debug avahi-daemon, it is safe to set this to 0.</p>
- </option>
-
- <option>
- <p><opt>rlimit-data=</opt> Value in bytes for RLIMIT_DATA (maximum size of the process's data segment). Sensible values are heavily system dependent.</p>
- </option>
-
- <option>
- <p><opt>rlimit-fsize=</opt> Value for RLIMIT_FSIZE (maximum size of files the process may create). Since avahi-daemon shouldn't write any files to disk, it is safe to set this to 0.</p>
- </option>
-
- <option>
- <p><opt>rlimit-nofile=</opt> Value for RLIMIT_NOFILE (open file descriptors). avahi-daemon shouldn't need more than 15 to 20 open file descriptors concurrently.</p>
- </option>
-
- <option>
- <p><opt>rlimit-stack=</opt> Value in bytes for RLIMIT_STACK (maximum size of the process stack). Sensible values are heavily system dependent.</p>
- </option>
-
- <option>
- <p><opt>rlimit-nproc=</opt> Value for RLIMIT_NPROC (number of process of user). Since only a single avahi-daemon process is usually running you can set this safely to 1.</p>
- </option>
-
- </section>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi-dnsconfd" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-discover.1.xml.in b/release-0.6.9/man/avahi-discover.1.xml.in
deleted file mode 100644
index 43574f6..0000000
--- a/release-0.6.9/man/avahi-discover.1.xml.in
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-discover" section="1" desc="Browse for mDNS/DNS-SD services using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-discover</cmd>
- </synopsis>
-
- <description>
- <p>Show a real-time graphical browse list for mDNS/DNS-SD
- network services running on the local LAN using the Avahi
- daemon.</p>
-
- </description>
-
- <options>
-
- <p>avahi-discover takes no command line arguments at the moment.</p>
-
- </options>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi-browse" section="1"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-dnsconfd.8.xml.in b/release-0.6.9/man/avahi-dnsconfd.8.xml.in
deleted file mode 100644
index 14a9f4a..0000000
--- a/release-0.6.9/man/avahi-dnsconfd.8.xml.in
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-dnsconfd" section="8" desc="Unicast DNS server from mDNS/DNS-SD configuration daemon">
-
- <synopsis>
- <cmd>avahi-dnsconfd [<arg>options</arg>]</cmd>
- <cmd>avahi-dnsconfd <opt>--kill</opt></cmd>
- <cmd>avahi-dnsconfd <opt>--refresh</opt></cmd>
- <cmd>avahi-dnsconfd <opt>--check</opt></cmd>
- </synopsis>
-
- <description>
- <p>avahi-dnsconfd connects to a running avahi-daemon and runs
- the script <file>@pkgsysconfdir@/dnsconfd.action</file> for each unicast DNS
- server that is announced on the local LAN. This is useful for
- configuring unicast DNS servers in a DHCP-like fashion with
- mDNS.</p>
- </description>
-
- <options>
-
- <option>
- <p><opt>-D | --daemonize</opt></p>
- <optdesc><p>Daemonize after startup and redirect log messages to syslog.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-k | --kill</opt></p>
- <optdesc><p>Kill an already running avahi-dnsconfd. (equivalent to sending a SIGTERM)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-r | --refresh</opt></p>
- <optdesc><p>Tell an already running avahi-dnsconfd to refresh the DNS server data. (equivalent to sending a SIGHUP)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-c | --check</opt></p>
- <optdesc><p>Return 0 as return code when avahi-dnsconfd is already running.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --version</opt></p>
- <optdesc><p>Show version information </p></optdesc>
- </option>
-
- </options>
-
- <section name="Files">
-
- <p><file>@pkgsysconfdir@/dnsconfd.action</file>: the script to run when a DNS server is found or removed.</p>
-
- </section>
-
- <section name="Signals">
- <p><arg>SIGINT, SIGTERM, SIGQUIT</arg>: avahi-dnsconfd will shutdown. This is issued by passing --kill to avahi-daemon.</p>
- <p><arg>SIGHUP</arg>: avahi-dnsconfd will refresh the DNS server data.</p>
- </section>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="dnsconfd.action" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-dnsconfd.action.8.xml.in b/release-0.6.9/man/avahi-dnsconfd.action.8.xml.in
deleted file mode 100644
index da8b265..0000000
--- a/release-0.6.9/man/avahi-dnsconfd.action.8.xml.in
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-dnsconfd.action" section="8" desc="avahi-dnsconfd action script">
-
- <synopsis>
- <cmd>@pkgsysconfdir@/avahi-dnsconfd.action</cmd>
- </synopsis>
-
- <description>
- <p><file>avahi-dnsconfd.action</file> is the action script that
- is called whenever a new unicast DNS server is found or
- removed by avahi-dnsconfd. The default script as shipped
- with avahi patches <file>/etc/resolv.conf</file> to reflect the
- changed unicast DNS server configuration.</p>
- </description>
-
- <section name="Parameters">
-
- <option>
- <p><opt>argv[1]</opt> Contains the character "+" if the DNS server is new, "-" when it shall be removed from the DNS server list.</p>
- </option>
-
- <option>
- <p><opt>argv[2]</opt> The IP address of the DNS server.</p>
- </option>
-
- <option>
- <p><opt>argv[3]</opt> Numerical network interface number this DNS server was found on.</p>
- </option>
-
- <option>
- <p><opt>argv[4]</opt> Numerical protocol number this DNS server was found on. (usually 2 for IPv4 and 10 for IPv6) </p>
- </option>
-
- </section>
-
- <section name="Environment">
- <option>
- <p><opt>AVAHI_INTERFACE</opt> Contains the textual interface name the corresponds with argv[3]. (e.g. "eth0")</p>
- </option>
-
- <option><p><opt>AVAHI_INTERFACE_DNS_SERVERS</opt> Contains a
- list of all DNS servers that avahi-dnsconfd found on the
- interface <opt>$AVAHI_INTERFACE</opt>, separated by
- spaces.</p></option>
-
- <option><p><opt>AVAHI_DNS_SERVERS</opt> Contains a list of all
- DNS server that avahi-dnsconfd found on all interfaces,
- separated by spaces.</p></option>
-
- </section>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-dnsconfd" section="8"/>, <manref name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-publish.1.xml.in b/release-0.6.9/man/avahi-publish.1.xml.in
deleted file mode 100644
index cab5828..0000000
--- a/release-0.6.9/man/avahi-publish.1.xml.in
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-publish-service" section="1" desc="Register an mDNS/DNS-SD service or host name or address mapping using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-publish -s [<arg>options</arg>] <arg>name</arg> <arg>service-type</arg> <arg>port</arg> [<arg>TXT data</arg> ...]</cmd>
- <cmd>avahi-publish-service [<arg>options</arg>] <arg>name</arg> <arg>service-type</arg> <arg>port</arg> [<arg>TXT data</arg> ...]</cmd>
- <cmd>avahi-publish -a [<arg>options</arg>] <arg>host name</arg> <arg>address</arg></cmd>
- <cmd>avahi-publish-address [<arg>options</arg>] <arg>host name</arg> <arg>address</arg></cmd>
- </synopsis>
-
- <description>
- <p>Register an mDNS/DNS-SD service or host name/address mapping using the Avahi daemon.</p>
- </description>
-
- <options>
-
- <p>When calling in service registration mode, specify a DNS-SD
- service name (e.g. "Lennart's Files"), a service type
- (e.g. _http._tcp) and an IP port number for the service,
- optionally followed by any number of TXT record strings on the
- command line. When calling in address/host name registration
- mode specify a fully qualified host name and an address (IPv4 or
- IPv6).</p>
-
- <option>
- <p><opt>-s | --service</opt></p>
- <optdesc><p>Register a service. avahi-publish-service is equivalent to avahi-publish -s.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-a | --address</opt></p>
- <optdesc><p>Register an address/host name maping. avahi-publish-address is equivalent to avahi-publish -a.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --verbose</opt></p>
- <optdesc><p>Enable verbose mode.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-H | --host=</opt> <arg>HOSTNAME</arg></p>
- <optdesc><p>Specify a host name for this service, in case it
- doesn't reside on the local host. This host name needs to be
- fully qualified and resolvable using mDNS or unicast
- DNS.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-d | --domain=</opt> <arg>DOMAIN</arg></p>
- <optdesc><p>Publish the service in the specified domain. If
- omitted the Avahi daemon will publish it in its default domain
- (usually .local).</p></optdesc>
- </option>
-
- <option>
- <p><opt>--subtype=</opt> <arg>SUBTYPE</arg></p>
- <optdesc><p>Register the service with an additional subtype in
- addition to the main type. DNS-SD subtypes have the form
- _anon._sub._ftp._tcp, where _anon is the identifier of the
- subtype and _ftp._tcp is the main type. You may pass this
- option multiple times to register the service with multiple
- subtypes.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-f | --no-fail</opt></p>
- <optdesc><p>Don't fail if the daemon is not found running. Instead, wait until it appears. If it disconnects, try to reconnect.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- <option>
- <p><opt>-V | --version</opt></p>
- <optdesc><p>Show version information.</p></optdesc>
- </option>
-
- </options>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-resolve" section="1"/>, <manref
- name="avahi-browse" section="1"/>, <manref
- name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi-resolve.1.xml.in b/release-0.6.9/man/avahi-resolve.1.xml.in
deleted file mode 100644
index f3691b9..0000000
--- a/release-0.6.9/man/avahi-resolve.1.xml.in
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-resolve" section="1" desc="Resolve one or more mDNS/DNS host name(s) to IP address(es) (and vice versa) using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-resolve --name <arg>host-name ...</arg></cmd>
- <cmd>avahi-resolve-host-name <arg>host-name ...</arg></cmd>
- <cmd>avahi-resolve --address <arg>address ...</arg></cmd>
- <cmd>avahi-resolve-address <arg>address ...</arg></cmd>
- </synopsis>
-
- <description>
- <p>Resolve one or more mDNS/DNS host name(s) to IP address(es) (and vice versa) using the Avahi daemon.</p>
- </description>
-
- <options>
-
- <p>When passing -n, specify one or more fully qualified mDNS/DNS host name(s)
- (e.g. "foo.local") to resolve into IP addresses on the
- command line. When passing -a, specifiy one or more IP address
- to resolve into host names.</p>
-
- <p>avahi-resolve-host-name is equivalent to avahi-resolve --name.</p>
-
- <p>avahi-resolve-address is equivalent to avahi-resolve --address.</p>
-
- <option>
- <p><opt>-n | --name</opt></p>
- <optdesc><p>Translate one or more fully qualified host names into addresses.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-a | --address</opt></p>
- <optdesc><p>Translate one or more addresses into fully qualified host names.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --verbose</opt></p>
- <optdesc><p>Enable verbose mode.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-6</opt></p>
- <optdesc><p>When resolving a host name, look for IPv6 addresses exclusively.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-4</opt></p>
- <optdesc><p>When resolving a host name, look for IPv4 addresses exclusively.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help.</p></optdesc>
- </option>
-
-
- <option>
- <p><opt>-V | --version</opt></p>
- <optdesc><p>Show version information.</p></optdesc>
- </option>
-
-
- </options>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-publish-address" section="1"/>,
- <manref
- name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi.hosts.5.xml.in b/release-0.6.9/man/avahi.hosts.5.xml.in
deleted file mode 100644
index 5fe2271..0000000
--- a/release-0.6.9/man/avahi.hosts.5.xml.in
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi.hosts" section="5" desc="avahi-daemon static host name file">
-
- <synopsis>
- <cmd>@pkgsysconfdir@/hosts</cmd>
- </synopsis>
-
- <description>
- <p><file>@pkgsysconfdir@/hosts</file> is a file which may be used
- to define static host name to IP address mappings for multicast
- DNS. This is especially useful when publishing DNS-SD services
- on behalf of other hosts. See <manref name="avahi.service"
- section="5"/> for more information.</p>
-
- <p>The file format is similar to the one of
- <file>/etc/hosts</file>: on each line an IP address and the
- corresponding host name. The host names should be in FQDN form,
- i.e. with appended .local suffix.</p>
- </description>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi.service" section="5"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man"
- section="1" href="http://masqmail.cx/xml2man/"/> by Oliver
- Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/avahi.service.5.xml.in b/release-0.6.9/man/avahi.service.5.xml.in
deleted file mode 100644
index 2514f33..0000000
--- a/release-0.6.9/man/avahi.service.5.xml.in
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi.service" section="5" desc="avahi-daemon static service file">
-
- <synopsis>
- <cmd>@servicedir@/*.service</cmd>
- </synopsis>
-
- <description> <p><file>@servicedir@/*.service</file> are XML
- fragments containing static DNS-SD service data. Every service
- file can contain multiple service definitions which share the
- same name. This is useful for publishing service data for
- services which implement multiple protocols. (i.e. a printer
- implementing _ipp._tcp and _printer.tcp)</p> </description>
-
- <section name="XML Tags">
-
- <option>
- <p><opt>&lt;service-group&gt;</opt> The document tag of avahi
- service files. Should contain one <opt>&lt;name&gt;</opt> and one or more
- <opt>&lt;service&gt;</opt> elements.</p>
- </option>
-
- <option>
- <p><opt>&lt;name replace-wildcards="yes|no"&gt;</opt> The
- service name. If <opt>replace-wildcards</opt> is "yes", any
- occurence of the string "%h" will be replaced by the local
- host name. This can be used for service names like "Remote
- Terminal on %h". If <opt>replace-wildcards</opt> is not
- specified, defaults to "no".</p>
- </option>
-
- <option>
- <p><opt>&lt;service protocol="ipv4|ipv6|any"&gt;</opt>
- Contains the service information for exactly one service
- type. Should contain one <opt>&lt;type&gt;</opt> and one
- <opt>&lt;port&gt;</opt> element. Optionally it may contain one
- <opt>&lt;domain-name&gt;</opt>, one
- <opt>&lt;host-name&gt;</opt>, any number of
- <opt>&lt;subtype&gt;</opt> and any number of
- <opt>&lt;txt-record&gt;</opt> elements. The attribute
- <opt>protocol</opt> specifies the protocol to advertise the
- service on. If <opt>any</opt> is used (which is the default),
- the service will be advertised on both IPv4 and IPv6.</p>
- </option>
-
- <option>
- <p><opt>&lt;type&gt;</opt> Contains the DNS-SD service type for this service. e.g. "_http._tcp".</p>
- </option>
-
- <option>
- <p><opt>&lt;subtype&gt;</opt> Contains an additional DNS-SD service subtype for this service. e.g. "_anon._sub._ftp._tcp".</p>
- </option>
-
- <option>
- <p><opt>&lt;domain-name&gt;</opt> The domain name this service
- should be registered. If omited defaults to the default domain
- of the avahi daemon. (probably .local)</p>
- </option>
-
- <option>
- <p><opt>&lt;host-name&gt;</opt> The host name of the host that
- provides this service. This should be a host that is
- resolvable by multicast or unicast DNS. Please note that you
- need to specify a fully-qualified domain name (FQDN) here,
- i.e. .local is not appended implicitly! The host name doesn't
- need to be part of the domain specified in
- <opt>&lt;domain-name&gt;</opt>. See <manref name="avahi.hosts"
- section="5"/> for more information how to publish additional
- host name mappings.</p>
- </option>
-
- <option>
- <p><opt>&lt;port&gt;</opt> The IP port number the service listens on.</p>
- </option>
-
- <option>
- <p><opt>&lt;txt-record&gt;</opt> DNS-SD TXT record data.</p>
- </option>
-
-
- </section>
-
- <section name="Authors">
- <p>The avahi developers &lt;@PACKAGE_BUGREPORT@&gt;; avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi.hosts" section="5"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man"
- section="1" href="http://masqmail.cx/xml2man/"/> by Oliver
- Kurth.</p>
- </section>
-
- </manpage>
diff --git a/release-0.6.9/man/xmltoman.css b/release-0.6.9/man/xmltoman.css
deleted file mode 100644
index 4c80847..0000000
--- a/release-0.6.9/man/xmltoman.css
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-***/
-
-body { color: black; background-color: white; }
-a:link, a:visited { color: #900000; }
-h1 { text-transform:uppercase; font-size: 18pt; }
-p { margin-left:1cm; margin-right:1cm; }
-.cmd { font-family:monospace; }
-.file { font-family:monospace; }
-.arg { text-transform:uppercase; font-family:monospace; font-style: italic; }
-.opt { font-family:monospace; font-weight: bold; }
-.manref { font-family:monospace; }
-.option .optdesc { margin-left:2cm; }
diff --git a/release-0.6.9/man/xmltoman.dtd b/release-0.6.9/man/xmltoman.dtd
deleted file mode 100644
index 50158dc..0000000
--- a/release-0.6.9/man/xmltoman.dtd
+++ /dev/null
@@ -1,39 +0,0 @@
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
--->
-
-<!ELEMENT manpage (synopsis | description | section | options | seealso)*>
-<!ATTLIST manpage name CDATA #REQUIRED section CDATA #REQUIRED desc CDATA #IMPLIED>
-<!ELEMENT arg (#PCDATA)>
-<!ELEMENT p (#PCDATA | arg | url | manref | opt | file )*>
-<!ELEMENT synopsis (cmd | p)+>
-<!ELEMENT description (p)+>
-<!ELEMENT section (p | option)*>
-<!ATTLIST section name CDATA #REQUIRED>
-<!ELEMENT option (#PCDATA | p | optdesc)*>
-<!ELEMENT optdesc (#PCDATA | p )*>
-<!ELEMENT cmd (#PCDATA | arg | opt)*>
-<!ELEMENT options (p | option)*>
-<!ELEMENT seealso (p)*>
-<!ELEMENT opt (#PCDATA)>
-<!ELEMENT file (#PCDATA)>
-<!ELEMENT manref EMPTY>
-<!ATTLIST manref name CDATA #REQUIRED section CDATA #REQUIRED href CDATA #IMPLIED>
-<!ELEMENT url EMPTY>
-<!ATTLIST url href CDATA #REQUIRED>
diff --git a/release-0.6.9/man/xmltoman.xsl b/release-0.6.9/man/xmltoman.xsl
deleted file mode 100644
index 96c9d81..0000000
--- a/release-0.6.9/man/xmltoman.xsl
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-15"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
--->
-
-<!-- $Id$ -->
-
-<xsl:output method="xml" version="1.0" encoding="iso-8859-15" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
-
-<xsl:template match="/manpage">
-
- <html>
-
- <head>
- <title><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</title>
- <style type="text/css">
- body { color: black; background-color: white; }
- a:link, a:visited { color: #900000; }
- h1 { text-transform:uppercase; font-size: 18pt; }
- p { margin-left:1cm; margin-right:1cm; }
- .cmd { font-family:monospace; }
- .file { font-family:monospace; }
- .arg { text-transform:uppercase; font-family:monospace; font-style: italic; }
- .opt { font-family:monospace; font-weight: bold; }
- .manref { font-family:monospace; }
- .option .optdesc { margin-left:2cm; }
- </style>
- </head>
- <body>
- <h1>Name</h1>
- <p><xsl:value-of select="@name"/>
- <xsl:if test="string-length(@desc) &gt; 0"> - <xsl:value-of select="@desc"/></xsl:if>
- </p>
- <xsl:apply-templates />
- </body>
- </html>
-</xsl:template>
-
-<xsl:template match="p">
- <p>
- <xsl:apply-templates/>
- </p>
-</xsl:template>
-
-<xsl:template match="cmd">
- <p class="cmd">
- <xsl:apply-templates/>
- </p>
-</xsl:template>
-
-<xsl:template match="arg">
- <span class="arg"><xsl:apply-templates/></span>
-</xsl:template>
-
-<xsl:template match="opt">
- <span class="opt"><xsl:apply-templates/></span>
-</xsl:template>
-
-<xsl:template match="file">
- <span class="file"><xsl:apply-templates/></span>
-</xsl:template>
-
-<xsl:template match="optdesc">
- <div class="optdesc">
- <xsl:apply-templates/>
- </div>
-</xsl:template>
-
-<xsl:template match="synopsis">
- <h1>Synopsis</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="seealso">
- <h1>Synopsis</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="description">
- <h1>Description</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="options">
- <h1>Options</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="section">
- <h1><xsl:value-of select="@name"/></h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="option">
- <div class="option"><xsl:apply-templates/></div>
-</xsl:template>
-
-<xsl:template match="manref">
- <xsl:choose>
- <xsl:when test="string-length(@href) &gt; 0">
- <a class="manref"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</a>
- </xsl:when>
- <xsl:otherwise>
- <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="url">
- <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/release-0.6.9/service-type-database/build-db.in b/release-0.6.9/service-type-database/build-db.in
deleted file mode 100755
index 21d057d..0000000
--- a/release-0.6.9/service-type-database/build-db.in
+++ /dev/null
@@ -1,46 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import gdbm, sys
-
-if len(sys.argv) > 1:
- infn = sys.argv[1]
-else:
- infn = "service-types"
-
-if len(sys.argv) > 2:
- outfn = sys.argv[2]
-else:
- outfn = infn + ".db"
-
-db = gdbm.open(outfn, "n")
-
-for ln in file(infn, "r"):
- ln = ln.strip(" \r\n\t")
-
- if ln == "" or ln.startswith("#"):
- continue
-
- t, n = ln.split(":", 1)
-
- db[t.strip()] = n.strip()
-
-db.close()
diff --git a/release-0.6.9/service-type-database/service-types b/release-0.6.9/service-type-database/service-types
deleted file mode 100644
index c3cc6c7..0000000
--- a/release-0.6.9/service-type-database/service-types
+++ /dev/null
@@ -1,109 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Feel free to add more service types or translatons to this database.
-# Please refrain from copying bulk service type data from any publicly
-# available database unless its license is known and compatible with
-# our project! The database available on
-#
-# http://www.dns-sd.org/ServiceTypes.html
-#
-# is not a source that complies with the criterion!
-
-### This list is NOT intended to be used as developer
-### documentation. If you're looking for the correct service type to
-### use for your application please refer to the URL mentioned above.
-
-_http._tcp:Web Site
-_http._tcp[de]:Web-Angebot
-
-_https._tcp:Secure Web Site
-_https._tcp[de]:Sicheres Web-Angebot
-
-_ftp._tcp:FTP File Transfer
-_ftp._tcp[de]:FTP Dateifreigabe
-
-_h323._tcp:H.323 Telephony
-_h323._tcp[de]:H.323 Telefonie
-
-_sip._udp:SIP Telephony
-_sip._udp[de]:SIP Telefonie
-
-_ssh._tcp:SSH Remote Terminal
-_ssh._tcp[de]:SSH Fernzugriff
-
-_distcc._tcp:Distributed Compiler
-_distcc._tcp[de]:Verteilter Compiler
-
-_daap._tcp:iTunes Audio Access
-_daap._tcp[de]:iTunes Audio-Zugriff
-
-_domain._udp:DNS Server
-_domain._udp[de]: DNS Dienst
-
-_imap._tcp:IMAP Mail Access
-
-_pop3._tcp:POP3 Mail Access
-
-_rfb._tcp:VNC Remote Access
-
-_sftp-ssh._tcp:SFTP File Transfer
-
-_telnet._tcp:Telnet Remote Terminal
-
-_presence._tcp:iChat Presence
-
-_webdav._tcp:WebDAV File Share
-
-_webdavs._tcp:Secure WebDAV File Share
-
-_workstation._tcp:Workstation
-_workstation._tcp[de]:Arbeitsplatzrechner
-
-_printer._tcp:UNIX Printer
-
-_afpovertcp._tcp:Apple File Sharing
-
-_pdl-datastream._tcp:PDL Printer
-
-_ipp._tcp:Internet Printer
-
-_rss._tcp:Web Syndication RSS
-
-_dacp._tcp:iTunes Remote Control
-
-_realplayfavs._tcp:RealPlayer Shared Favorites
-
-_timbuktu._tcp:Timbuktu Remote Desktop Control
-
-_see._tcp:SubEthaEdit Collaborative Text Editor
-
-_postgresql._tcp:PostgreSQL Server
-
-_ksysguard._tcp:KDE System Guard
-
-_omni-bookmark._tcp:OmniWeb Bookmark Sharing
-
-_MacOSXDupSuppress._tcp:MacOS X Duplicate Machine Suppression
-
-_lobby._tcp:Gobby Collaborative Editor Session
-
-_dpap._tcp:Digital Photo Sharing
-
-_skype._tcp:Skype VoIP
diff --git a/release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-02.txt b/release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-02.txt
deleted file mode 100644
index bebc28d..0000000
--- a/release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-02.txt
+++ /dev/null
@@ -1,1798 +0,0 @@
-Document: draft-cheshire-dnsext-dns-sd-02.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 14th August 2004 Marc Krochmal
- Apple Computer, Inc.
- 14th February 2004
-
- DNS-Based Service Discovery
-
- <draft-cheshire-dnsext-dns-sd-02.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 1]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-Table of Contents
-
- 1. Introduction....................................................3
- 2. Conventions and Terminology Used in this Document...............3
- 3. Design Goals....................................................4
- 4. Service Instance Enumeration....................................5
- 4.1 Structured Instance Names.......................................5
- 4.2 User Interface Presentation.....................................7
- 4.3 Internal Handling of Names......................................7
- 4.4 What You See Is What You Get....................................7
- 4.5 Ordering of Service Instance Name Components....................9
- 5. Service Name Resolution........................................11
- 6. Data Syntax for DNS-SD TXT Records.............................12
- 6.1 General Format Rules for DNS TXT Records.......................12
- 6.2 DNS TXT Record Format Rules for use in DNS-SD..................12
- 6.3 DNS-SD TXT Record Size.........................................14
- 6.4 Rules for Names in DNS-SD Name/Value Pairs.....................14
- 6.5 Rules for Values in DNS-SD Name/Value Pairs....................16
- 6.6 Example TXT Record.............................................16
- 6.7 Version Tag....................................................17
- 7. Application Protocol Names.....................................18
- 8. Selective Instance Enumeration.................................19
- 9. Flagship Naming................................................10
- 10. Service Type Enumeration.......................................21
- 11. Populating the DNS with Information............................22
- 12. Relationship to Multicast DNS..................................22
- 13. Discovery of Browsing and Registration Domains.................23
- 14. DNS Additional Record Generation...............................24
- 15. Comparison with Alternative Service Discovery Protocols........25
- 16. Real Example...................................................27
- 17. IPv6 Considerations............................................28
- 18. Security Considerations........................................28
- 19. IANA Considerations............................................28
- 20. Acknowledgements...............................................29
- 21. Copyright......................................................29
- 22. Normative References...........................................30
- 23. Informative References.........................................30
- 24. Author's Addresses.............................................31
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 2]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-1. Introduction
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of a that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, resource record types,
- or any other new DNS protocol values. This document simply proposes
- a convention for how existing resource record types can be named and
- structured to facilitate service discovery.
-
- This proposal is entirely compatible with today's existing unicast
- DNS server and client software.
-
- Note that the DNS-SD service does NOT have to be provided by the same
- DNS server hardware that is currently providing an organization's
- conventional host name lookup service (the service we traditionally
- think of when we say "DNS"). By delegating the "_tcp" subdomain, all
- the workload related to DNS-SD can be offloaded to a different
- machine. This flexibility, to handle DNS-SD on the main DNS server,
- or not, at the network administrator's discretion, is one of the
- things that makes DNS-SD so compelling.
-
- Even when the DNS-SD functions are delegated to a different machine,
- the benefits of using DNS remain: It is mature technology, well
- understood, with multiple independent implementations from different
- vendors, a wide selection of books published on the subject, and an
- established workforce experienced in its operation. In contrast,
- adopting some other service discovery technology would require every
- site in the world to install, learn, configure, operate and maintain
- some entirely new and unfamiliar server software. Faced with these
- obstacles, it seems unlikely that any other service discovery
- technology could hope to compete with the ubiquitous deployment
- that DNS already enjoys.
-
- This proposal is also compatible with (but not dependent on) the
- proposal outlined in "Multicast DNS" [mDNS].
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 3]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-3. Design Goals
-
- A good service discovery protocol needs to have many properties,
- three of which are mentioned below:
-
- (i) The ability to query for services of a certain type in a certain
- logical domain and receive in response a list of named instances
- (network browsing, or "Service Instance Enumeration").
-
- (ii) Given a particular named instance, the ability to efficiently
- resolve that instance name to the required information a client needs
- to actually use the service, i.e. IP address and port number, at the
- very least (Service Name Resolution).
-
- (iii) Instance names should be relatively persistent. If a user
- selects their default printer from a list of available choices today,
- then tomorrow they should still be able to print on that printer --
- even if the IP address and/or port number where the service resides
- have changed -- without the user (or their software) having to repeat
- the network browsing step a second time.
-
- In addition, if it is to become successful, a service discovery
- protocol should be so simple to implement that virtually any
- device capable of implementing IP should not have any trouble
- implementing the service discovery software as well.
-
- These goals are discussed in more detail in the remainder of this
- document. A more thorough treatment of service discovery requirements
- may be found in "Requirements for a Protocol to Replace AppleTalk
- NBP" [NBP]. That document draws upon examples from two decades of
- operational experience with AppleTalk Name Binding Protocol to
- develop a list of universal requirements which are broadly applicable
- to any potential service discovery protocol.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 4]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-4. Service Instance Enumeration
-
- DNS SRV records [RFC 2782] are useful for locating instances of a
- particular type of service when all the instances are effectively
- indistinguishable and provide the same service to the client.
-
- For example, SRV records with the (hypothetical) name
- "_http._tcp.example.com." would allow a client to discover a list of
- all servers implementing the "_http._tcp" service (i.e. Web servers)
- for the "example.com." domain. The unstated assumption is that all
- these servers offer an identical set of Web pages, and it doesn't
- matter to the client which of the servers it uses, as long as it
- selects one at random according to the weight and priority rules laid
- out in RFC 2782.
-
- Instances of other kinds of service are less easily interchangeable.
- If a word processing application were to look up the (hypothetical)
- SRV record "_ipp._tcp.example.com." to find the list of IPP printers
- at Example Co., then picking one at random and printing on it would
- probably not be what the user wanted.
-
- The remainder of this section describes how SRV records may be used
- in a slightly different way to allow a user to discover the names
- of all available instances of a given type of service, in order to
- select the particular instance the user desires.
-
-
-4.1 Structured Instance Names
-
- This document borrows the logical service naming syntax and semantics
- from DNS SRV records, but adds one level of indirection. Instead of
- requesting records of type "SRV" with name "_ipp._tcp.example.com.",
- the client requests records of type "PTR" (pointer from one name to
- another in the DNS namespace).
-
- In effect, if one thinks of the domain name "_ipp._tcp.example.com."
- as being analogous to an absolute path to a directory in a file
- system then the PTR lookup is akin to performing a listing of that
- directory to find all the files it contains. (Remember that domain
- names are expressed in reverse order compared to path names: An
- absolute path name is read from left to right, beginning with a
- leading slash on the left, and then the top level directory, then the
- next level directory, and so on. A fully-qualified domain name is
- read from right to left, beginning with the dot on the right -- the
- root label -- and then the top level domain to the left of that, and
- the second level domain to the left of that, and so on. If the fully-
- qualified domain name "_ipp._tcp.example.com." were expressed as a
- file system path name, it would be "/com/example/_tcp/_ipp".)
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 5]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The result of this PTR lookup for the name "<Service>.<Domain>" is a
- list of zero or more PTR records giving Service Instance Names of the
- form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- The <Instance> portion of the Service Instance Name is a single DNS
- label, containing arbitrary UTF-8-encoded text [RFC 2279]. It is a
- user-friendly name, meaning that it is allowed to contain any
- characters, without restriction, including spaces, upper case, lower
- case, punctuation -- including dots -- accented characters, non-roman
- text, and anything else that may be represented using UTF-8.
- DNS recommends guidelines for allowable characters for host names
- [RFC 1033][RFC 1034][RFC 1035], but Service Instance Names are not
- host names. Service Instance Names are not intended to ever be typed
- in by a normal user; the user selects a Service Instance Name by
- selecting it from a list of choices presented on the screen.
-
- Note that just because this protocol supports arbitrary UTF-8-encoded
- names doesn't mean that any particular user or administrator is
- obliged to make use of that capability. Any user is free, if they
- wish, to continue naming their services using only letters, digits
- and hyphens, with no spaces, capital letters, or other punctuation.
-
- DNS labels are currently limited to 63 octets in length. UTF-8
- encoding can require up to four octets per Unicode character, which
- means that in the worst case, the <Instance> portion of a name could
- be limited to fifteen Unicode characters. However, the Unicode
- characters with longer UTF-8 encodings tend to be the more obscure
- ones, and tend to be the ones that convey greater meaning per
- character.
-
- Note that any character in the commonly-used 16-bit Unicode space can
- be encoded with no more than three octets of UTF-8 encoding. This
- means that an Instance name can contain up to 21 Kanji characters,
- which is a sufficiently expressive name for most purposes.
-
- The <Service> portion of the Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the service pair is the
- application protocol name, as recorded in the IANA list of assigned
- application protocol names and port numbers [ports]. The second label
- of the service pair is either "_tcp" or "_udp", depending on the
- transport protocol used by the application.
-
- The <Domain> portion of the Service Instance Name is a conventional
- DNS domain name, consisting of as many labels as appropriate. For
- example, "apple.com.", "cs.stanford.edu.", and "eng.us.ibm.com." are
- all valid domain names for the <Domain> portion of the Service
- Instance Name.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 6]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-4.2 User Interface Presentation
-
- The names resulting from the PTR lookup are presented to the user in
- a list for the user to select one (or more). Typically only the first
- label is shown (the user-friendly <Instance> portion of the name). In
- the common case, the <Service> and <Domain> are already known to the
- user, these having been provided by the user in the first place, by
- the act of indicating the service being sought, and the domain in
- which to look for it. Note: The software handling the response
- should be careful not to make invalid assumptions though, since it
- *is* possible, though rare, for a service enumeration in one domain
- to return the names of services in a different domain. Similarly,
- when using subtypes (see "Selective Instance Enumeration") the
- <Service> of the discovered instance my not be exactly the same as
- the <Service> that was requested.
-
- Having chosen the desired named instance, the Service Instance Name
- may then be used immediately, or saved away in some persistent
- user-preference data structure for future use, depending on what is
- appropriate for the application in question.
-
-
-4.3 Internal Handling of Names
-
- If the <Instance>, <Service> and <Domain> portions are internally
- concatenated together into a single string, then care must be taken
- with the <Instance> portion, since it is allowed to contain any
- characters, including dots.
-
- Any dots in the <Instance> portion should be escaped by preceeding
- them with a backslash ("." becomes "\."). Likewise, any backslashes
- in the <Instance> portion should also be escaped by preceeding them
- with a backslash ("\" becomes "\\"). Having done this, the three
- components of the name may be safely concatenated. The
- backslash-escaping allows literal dots in the name (escaped) to be
- distinguished from label-separator dots (not escaped).
-
- The resulting concatenated string may be safely passed to standard
- DNS APIs like res_query(), which will interpret the string correctly
- provided it has been escaped correctly, as described here.
-
-
-4.4 What You See Is What You Get
-
- Some service discovery protocols decouple the true service identifier
- from the name presented to the user. The true service identifier used
- by the protocol is an opaque unique id, often represented using a
- long string of hexadecimal digits, and should never be seen by the
- typical user. The name presented to the user is merely one of the
- ephemeral attributes attached to this opaque identifier.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 7]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The problem with this approach is that it decouples user perception
- from reality:
-
- * What happens if there are two service instances, with different
- unique ids, but they have inadvertently been given the same
- user-visible name? If two instances appear in an on-screen list
- with the same name, how does the user know which is which?
-
- * Suppose a printer breaks down, and the user replaces it with
- another printer of the same make and model, and configures the new
- printer with the exact same name as the one being replaced:
- "Stuart's Printer". Now, when the user tries to print, the
- on-screen print dialog tells them that their selected default
- printer is "Stuart's Printer". When they browse the network to see
- what is there, they see a printer called "Stuart's Printer", yet
- when the user tries to print, they are told that the printer
- "Stuart's Printer" can't be found. The hidden internal unique id
- that the software is trying to find on the network doesn't match
- the hidden internal unique id of the new printer, even though its
- apparent "name" and its logical purpose for being there are the
- same. To remedy this, the user typically has to delete the print
- queue they have created, and then create a new (apparently
- identical) queue for the new printer, so that the new queue will
- contain the right hidden internal unique id. Having all this hidden
- information that the user can't see makes for a confusing and
- frustrating user experience, and exposing long ugly hexadecimal
- strings to the user and forcing them to understand what they mean
- is even worse.
-
- * Suppose an existing printer is moved to a new department, and given
- a new name and a new function. Changing the user-visible name of
- that piece of hardware doesn't change its hidden internal unique
- id. Users who had previously created print queues for that printer
- will still be accessing the same hardware by its unique id, even
- though the logical service that used to be offered by that hardware
- has ceased to exist.
-
- To solve these problems requires the user or administrator to be
- aware of the supposedly hidden unique id, and to set its value
- correctly as hardware is moved around, repurposed, or replaced,
- thereby contradicting the notion that it is a hidden identifier that
- human users never need to deal with. Requiring the user to unserstand
- this expert behind-the-scenes knowledge of what is *really* going on
- is just one more burden placed on the user when they are trying to
- diagnose why their computers and network devices are not working as
- expected.
-
- These anomalies and counter-intuitive behaviours can be eliminated by
- maintaining a tight bidirectional one-to-one mapping between what the
- user sees on the screen and what is really happening "behind the
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 8]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- curtain". If something is configured incorrectly, then that is
- apparent in the familiar day-to-day user interface that everyone
- understands, not in some little-known rarely-used "expert" interface.
-
- In summary: The user-visible name is the primary identifier for a
- service. If the user-visible name is changed, then conceptually the
- service being offered is a different logical service -- even though
- the hardware offering the service stayed the same. If the
- user-visible name doesn't change, then conceptually the service being
- offered is the same logical service -- even if the hardware offering
- the service is new hardware brought in to replace some old equipment.
-
- There are certainly arguments on both sides of this debate.
- Nonetheless, the designers of any service discovery protocol have
- to make a choice between between having the primary identifiers be
- hidden, or having them be visible, and these are the reasons that we
- chose to make them visible. We're not claiming that there are no
- disadvantages of having primary identifiers be visible. We considered
- both alternatives, and we believe that the few disadvantages
- of visible identifiers are far outweighed by the many problems
- caused by use of hidden identifiers.
-
-
-4.5 Ordering of Service Instance Name Components
-
- There have been questions about why services are named using DNS
- Service Instance Names of the form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- instead of:
-
- Service Instance Name = <Service> . <Instance> . <Domain>
-
- There are three reasons why it is beneficial to name service
- instances with the parent domain as the most-significant (rightmost)
- part of the name, then the abstract service type as the nextmost
- significant, and then the specific instance name as the
- least-significant (leftmost) part of the name:
-
-
-4.5.1. Semantic Structure
-
- The facility being provided by browsing ("Service Instance
- Enumeration") is effectively enumerating the leaves of a tree
- structure. A given domain offers zero or more services. For each of
- those service types, there may be zero or more instances of that
- service.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 9]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The user knows what type of service they are seeking. (If they are
- running an FTP client, they are looking for FTP servers. If they have
- a document to print, they are looking for entities that speak some
- known printing protocol.) The user knows in which organizational or
- geographical domain they wish to search. (The user does not want a
- single flat list of every single printer on the planet, even if such
- a thing were possible.) What the user does not know in advance is
- whether the service they seek is offered in the given domain, or if
- so, how many instances are offered, and the names of those instances.
- Hence having the instance names be the leaves of the tree is
- consistent with this semantic model.
-
- Having the service types be the terminal leaves of the tree would
- imply that the user knows the domain name, and already knows the
- name of the service instance, but doesn't have any idea what the
- service does. We would argue that this is a less useful model.
-
-
-4.5.2. Network Efficiency
-
- When a DNS response contains multiple answers, name compression works
- more effectively if all the names contain a common suffix. If many
- answers in the packet have the same <Service> and <Domain>, then each
- occurrence of a Service Instance Name can be expressed using only the
- <Instance> part followed by a two-byte compression pointer
- referencing a previous appearance of "<Service>.<Domain>". This
- efficiency would not be possible if the <Service> component appeared
- first in each name.
-
-
-4.5.3. Operational Flexibility
-
- This name structure allows subdomains to be delegated along logical
- service boundaries. For example, the network administrator at Example
- Co. could choose to delegate the "_tcp.example.com." subdomain to a
- different machine, so that the machine handling service discovery
- doesn't have to be the same as the machine handling other day-to-day
- DNS operations. (It *can* be the same machine if the administrator so
- chooses, but the point is that the administrator is free to make that
- choice.) Furthermore, if the network administrator wishes to delegate
- all information related to IPP printers to a machine dedicated to
- that specific task, this is easily done by delegating the
- "_ipp._tcp.example.com." subdomain to the desired machine. It is also
- convenient to set security policies on a per-zone/per-subdomain
- basis. For example, the administrator may choose to enable DNS
- Dynamic Update [RFC 2136] [RFC 3007] for printers registering in the
- "_ipp._tcp.example.com." subdomain, but not for other
- zones/subdomains. This easy flexibility would not exist if the
- <Service> component appeared first in each name.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 10]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-5. Service Name Resolution
-
- Given a particular Service Instance Name, when a client needs to
- contact that service, it sends a DNS query for the SRV record of
- that name.
-
- The result of the DNS query is a SRV record giving the port number
- and target host where the service may be found.
-
- The use of SRV records is very important. There are only 65535 TCP
- port numbers available. These port numbers are being allocated
- one-per-application-protocol at an alarming rate. Some protocols like
- the X Window System have a block of 64 TCP ports allocated
- (6000-6063). If we start allocating blocks of 64 TCP ports at a time,
- we will run out even faster. Using a different TCP port for each
- different instance of a given service on a given machine is entirely
- sensible, but allocating large static ranges, as was done for X, is a
- very inefficient way to manage a limited resource. On any given host,
- most TCP ports are reserved for services that will never run on that
- particular host. This is very poor utilization of the limited port
- space. Using SRV records allows each host to allocate its available
- port numbers dynamically to those services running on that host that
- need them, and then advertise the allocated port numbers via SRV
- records. Allocating the available listening port numbers locally
- on a per-host basis as needed allows much better utilization of the
- available port space than today's centralized global allocation.
-
- In some environments there may be no compelling reason to assign
- managed names to every host, since every available service is
- accessible by name anyway, as a first-class entity in its own right.
- However, the DNS packet format and record format still require a host
- name to link the target host referenced in the SRV record to the
- address records giving the IPv4 and/or IPv6 addresses for that
- hardware. In the case where no natural host name is available, the
- SRV record may give its own name as the name of the target host, and
- then the requisite address records may be attached to that same name.
- It is perfectly permissible for a single name in the DNS hierarchy to
- have multiple records of different type attached. (The only
- restriction being that a given name may not have both a CNAME record
- and other records at the same time.)
-
- In the event that more than one SRV is returned, clients MUST
- correctly interpret the priority and weight fields -- i.e. Lower
- numbered priority servers should be used in preference to higher
- numbered priority servers, and servers with equal priority should be
- selected randomly in proportion to their relative weights.
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 11]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6. Data Syntax for DNS-SD TXT Records
-
- Some services discovered via Service Instance Enumeration may need
- more than just an IP address and port number to properly identify the
- service. For example, printing via the LPR protocol often specifies a
- queue name. This queue name is typically short and cryptic, and need
- not be shown to the user. It should be regarded the same way as the
- IP address and port number -- it is one component of the addressing
- information required to identify a specific instance of a service
- being offered by some piece of hardware. Similarly, a file server may
- have multiple volumes, each identified by its own volume name. A Web
- server typically has multiple pages, each identified by its own URL.
- In these cases, the necessary additional data is stored in a TXT
- record with the same name as the SRV record. The specific nature of
- that additional data, and how it is to be used, is service-dependent,
- but the overall syntax of the data in the TXT record is standardized,
- as described below.
-
-
-6.1 General Format Rules for DNS TXT Records
-
- A DNS TXT record can be up to 65535 (0xFFFF) bytes long. The total
- length is indicated by the length given in the resource record header
- in the DNS message. There is no way to tell directly from the data
- alone how long it is (e.g. there is no length count at the start, or
- terminating NULL byte at the end). (Note that when using Multicast
- DNS [mDNS] the maximum packet size is 9000 bytes, which imposes an
- upper limit on the size of TXT records of about 8800 bytes.)
-
- The format of the data within a DNS TXT record is zero or more
- strings, packed together in memory without any intervening gaps or
- padding bytes for word alignment.
-
- The format of each constituent string within the DNS TXT record is a
- single length byte, followed by 0-255 bytes of text data.
-
- These format rules are defined in Section 3.3.14 of RFC 1035, and are
- not specific to DNS-SD. DNS-SD simply specifies a usage convention
- for what data should be stored in those constituent strings.
-
-
-6.2 DNS TXT Record Format Rules for use in DNS-SD
-
- DNS-SD uses DNS TXT records to store arbitrary name/value pairs
- conveying additional information about the named service. Each
- name/value pair is encoded as its own constituent string within the
- DNS TXT record, in the form "name=value". Everything up to the first
- '=' character is the name. Everything after the first '=' character
- to the end of the string (including subsequent '=' characters, if
- any) is the value. Specific rules governing names and values are
- given below. Each author defining a DNS-SD profile for discovering
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 12]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- instances of a particular type of service should define the base set
- of name/value attributes that are valid for that type of service.
-
- Using this standardized name/value syntax within the TXT record makes
- it easier for these base definitions to be expanded later by defining
- additional named attributes. If an implementation sees unknown
- attribute names in a service TXT record, it MUST silently ignore them.
-
- The TCP (or UDP) port number of the service, and target host name,
- are given in the SRV record. This information -- target host name and
- port number -- MUST NOT be duplicated using name/value attributes in
- the TXT record.
-
- The intention of DNS-SD TXT records is to convey a small amount of
- useful additional information about a service. Ideally it SHOULD NOT
- be necessary for a client to retrieve this additional information
- before it can usefully establish a connection to the service. For a
- well-designed TCP-based application protocol, it should be possible,
- knowing only the host name and port number, to open a connection to
- that listening process, and then perform version- or feature-
- negotiation to determine the capabilities of the service instance.
- For example, when connecting to an AppleShare server over TCP, the
- client enters into a protocol exchange with the server to determine
- which version of the AppleShare protocol the server implements, and
- which optional features or capabilities (if any) are available. For a
- well-designed application protocol, clients should be able to connect
- and use the service even if there is no information at all in the TXT
- record. In this case, the information in the TXT record should be
- viewed as a performance optimization -- when a client discovers many
- instances of a service, the TXT record allows the client to know some
- rudimentary information about each instance without having to open a
- TCP connection to each one and interrogate every service instance
- separately. Extreme care should be taken when doing this to ensure
- that the information in the TXT record is in agreement with the
- information retrieved by a client connecting over TCP.
-
- There are legacy protocols which provide no feature negotiation
- capability, and in these cases it may be useful to convey necessary
- information in the TXT record. For example, when printing using the
- old Unix LPR (port 515) protocol, the LPR service provides no way for
- the client to determine whether a particular printer accepts
- PostScript, or what version of PostScript, etc. In this case it is
- appropriate to embed this information in the TXT record, because the
- alternative is worse -- passing around written instructions to the
- users, arcane manual configuration of "/etc/printcap" files, etc.
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 13]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6.3 DNS-SD TXT Record Size
-
- The total size of a typical DNS-SD TXT record is intended to be small
- -- 200 bytes or less.
-
- In cases where more data is justified (e.g. LPR printing), keeping
- the total size under 400 bytes should allow it to fit in a single
- standard 512-byte DNS message. (This standard DNS message size is
- defined in RFC 1035.)
-
- In extreme cases where even this is not enough, keeping the size of
- the TXT record under 1300 bytes should allow it to fit in a single
- 1500-byte Ethernet packet.
-
- Using TXT records larger than 1300 bytes is NOT RECOMMENDED at this
- time.
-
-
-6.4 Rules for Names in DNS-SD Name/Value Pairs
-
- The "Name" MUST be at least one character. Strings beginning with an
- '=' character (i.e. the name is missing) SHOULD be silently ignored.
-
- The characters of "Name" MUST be printable US-ASCII values
- (0x20-0x7E), excluding '=' (0x3D).
-
- Spaces in the name are significant, whether leading, trailing, or in
- the middle -- so don't include any spaces unless you really intend
- that!
-
- Case is ignored when interpreting a name, so "papersize=A4",
- "PAPERSIZE=A4" and "Papersize=A4" are all identical.
-
- If there is no '=', then it is a boolean attribute, and is simply
- identified as being present, with no value.
-
- Unless specified otherwise by a particular DNS-SD profile, a given
- attribute name may appear at most once in a TXT record. If a client
- receives a TXT record containing the same attribute name more than
- once, then the client SHOULD silently ignore all but the first
- occurrence of that attribute. For client implementations that process
- a DNS-SD TXT record from start to end, placing name/value pairs into
- a hash table, using the name as the hash table key, this means that
- if the implementation attempts to add a new name/value pair into the
- table and finds an entry with the same name already present, then the
- new entry being added should be silently discarded instead. For
- client implementations that retrieve name/value pairs by searching
- the TXT record for the requested name, they should search the TXT
- record from the start, and simply return the first matching name they
- find.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 14]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- When examining a TXT record for a given named attribute, there are
- therefore four broad categories of results which may be returned:
-
- * Attribute not present (Absent)
-
- * Attribute present, with no value
- (e.g. "Anon Allowed" -- server allows anonymous connections)
-
- * Attribute present, with empty value (e.g. "Installed PlugIns=" --
- server supports plugins, but none are presently installed)
-
- * Attribute present, with non-empty value
- (e.g. "Installed PlugIns=JPEG,MPEG2,MPEG4")
-
- Each author defining a DNS-SD profile for discovering instances of a
- particular type of service should define the interpretation of these
- different kinds of result. For example, for some keys, there may be
- a natural true/false boolean interpretation:
-
- * Present implies 'true'
- * Absent implies 'false'
-
- For other keys it may be sensible to define other semantics, such as
- value/no-value/unknown:
-
- * Present with value implies that value.
- E.g. "Color=4" for a four-color ink-jet printer,
- or "Color=6" for a six-color ink-jet printer.
-
- * Present with empty value implies 'false'. E.g. Not a color printer.
-
- * Absent implies 'Unknown'. E.g. A print server connected to some
- unknown printer where the print server doesn't actually know if the
- printer does color or not -- which gives a very bad user experience
- and should be avoided wherever possible.
-
- (Note that this is a hypothetical example, not an example of actual
- name/value keys used by DNS-SD network printers.)
-
- As a general rule, attribute names that contain no dots are defined
- as part of the open-standard definition written by the person or
- group defining the DNS-SD profile for discovering that particular
- service type. Vendor-specific extensions should be given names of the
- form "keyname.company.com=value", using a domain name legitimately
- registered to the person or organization creating the vendor-specific
- key. This reduces the risk of accidental conflict if different
- organizations each define their own vendor-specific keys.
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 15]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6.5 Rules for Values in DNS-SD Name/Value Pairs
-
- If there is an '=', then everything after the first '=' to the end of
- the string is the value. The value can contain any eight-bit values
- including '='. Leading or trailing spaces are part of the value, so
- don't put them there unless you intend them to be there. Any
- quotation marks around the value are part of the value, so don't put
- them there unless you intend them to be part of the value.
-
- The value is opaque binary data. Often the value for a particular
- attribute will be US-ASCII (or UTF-8) text, but it is legal for a
- value to be any binary data. For example, if the value of a key is an
- IPv4 address, that address should simply be stored as four bytes of
- binary data, not as a variable-length 7-15 byte ASCII string giving
- the address represented in textual dotted decimal notation.
-
- Generic debugging tools should generally display all attribute values
- as a hex dump, with accompanying text alongside displaying the UTF-8
- interpretation of those bytes, except for attributes where the
- debugging tool has embedded knowledge that the value is some other
- kind of data.
-
- Authors defining DNS-SD profiles SHOULD NOT convert binary attribute
- data types into printable text (e.g. using hexadecimal, Base64 or UU
- encoding) merely for the sake of making the data be printable text
- when seen in a generic debugging tool. Doing this simply bloats the
- size of the TXT record, without atually making the data any more
- understandable to someone looking at it in a generic debugging tool.
-
-
-6.6 Example TXT Record
-
- The TXT record below contains three syntactically valid name/value
- pairs. (The meaning of these name/value pairs, if any, would depend
- on the definitions pertaining to the service in question that is
- using them.)
-
- ---------------------------------------------------------------
- | 0x0A | name=value | 0x08 | paper=A4 | 0x0E | DNS-SD Is Cool |
- ---------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 16]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6.7 Version Tag
-
- It is recommended that authors defining DNS-SD profiles include an
- attribute of the form "txtvers=xxx" in their definition, and require
- it to be the first name/value pair in the TXT record. This
- information in the TXT record can be useful to help clients maintain
- backwards compatibility with older implementations if it becomes
- necessary to change or update the specification over time. Even if
- the profile author doesn't anticipate the need for any future
- incompatible changes, having a version number in the specification
- provides useful insurance should incompatible changes become
- unavoidable. Clients SHOULD ignore TXT records with a txtvers number
- higher (or lower) than the version(s) they know how to interpret.
-
- Note that the version number in the txtvers tag describes the version
- of the TXT record specification being used to create this TXT record,
- not the version of the application protocol that will be used if the
- client subsequently decides to contact that service. Ideally, every
- DNS-SD TXT record specification starts at txtvers=1 and stays that
- way forever. Improvements can be made by defining new keys that older
- clients silently ignore. The only reason to increment the version
- number is if the old specification is subsequently found to be so
- horribly broken that there's no way to do a compatible forward
- revision, so the txtvers number has to be incremented to tell all the
- old clients they should just not even try to understand this new TXT
- record.
-
- If there is a need to indicate which version number(s) of the
- application protocol the service implements, the recommended key
- name for this is "protovers".
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 17]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-7. Application Protocol Names
-
- The <Service> portion of a Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the pair is the Application
- Protocol Name, and the second label is either "_tcp" or "_udp".
-
- Wise selection of the Application Protocol Name is very important,
- and the choice is not always as obvious as it may appear.
-
- In some cases, the Application Protocol Name merely names and refers
- to the on-the-wire message format and semantics being used. FTP is
- "ftp", IPP printing is "ipp", and so on.
-
- However, it is common to "borrow" an existing protocol and repurpose
- it for a new task. This is entirely sensible and sound engineering
- practice, but that doesn't mean that the new protocol is providing
- the same semantic service as the old one, even if it borrows the same
- message formats. For example, the local network music playing
- protocol implemented by iTunes on Macintosh and Windows is little
- more than "HTTP GET" commands. However, that does *not* mean that it
- is sensible or useful to try to access one of these music servers by
- connecting to it with a standard web browser. Consequently, the
- DNS-SD service advertised (and browsed for) by iTunes is "_daap._tcp"
- (Digital Audio Access Procol), not "_http._tcp". Advertising
- "_http._tcp" service would cause iTunes servers to show up in
- conventional Web browsers (Safari, Camino, OmniWeb, Opera, Netscape,
- Internet Explorer, etc.) which is little use since it offers no pages
- containing human-readable content. Similarly, browsing for
- "_http._tcp" service would cause iTunes to find generic web servers,
- such as the embedded web servers in devices like printers, which is
- little use since printers generally don't have much music to offer.
-
- Similarly, NFS is built on top of SUN RPC, but that doesn't mean it
- makes sense for an NFS server to advertise that it provides "SUN RPC"
- service. Likewise, Microsoft SMB file service is built on top of
- Netbios running over IP, but that doesn't mean it makes sense for an
- SMB file server to advertise that it provides "Netbios-over-IP"
- service. The DNS-SD name of a service needs to encapsulate both the
- "what" (semantics) and the "how" (protocol implementation) of the
- service, since knowledge of both is necessary for a client to
- usefully use the service. Merely advertising that a service was built
- on top of SUN RPC is no use if the client has no idea what the
- service actually does.
-
- Another common mistake is to assume that the service type advertised
- by iTunes should be "_daap._http._tcp." This is also incorrect. Part
- of the confusion here is that the presence of "_tcp" or "_udp" in the
- <Service> portion of a Service Instance Name has led people to assume
- that the structure of a service name has to reflect the internal
- structure of how the protocol was implemented. This is not correct.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 18]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The "_tcp" or "_udp" should be regarded as little more than
- boilerplate text, and care should be taken not to attach too much
- importance to it. Some might argue that the "_tcp" or "_udp" should
- not be there at all, but this format is defined by RFC 2782, and
- that's not going to change. In addition, the presence of "_tcp" has
- the useful side-effect that it provides a convenient delegation point
- to hand off control to a different DNS server, if so desired.
-
-
-8. Selective Instance Enumeration
-
- This document does not attempt to define an arbitrary query language
- for service discovery, nor do we believe one is necessary.
-
- However, there are some circumstances where narrowing the list of
- results may be useful. A Web browser client that is able to retrieve
- HTML documents via HTTP and display them may also be able to retrieve
- HTML documents via FTP and display them, but only in the case of FTP
- servers that allow anonymous login. For that Web browser, discovering
- all FTP servers on the network is not useful. The Web browser only
- wants to discover FTP servers that it is able to talk to. In this
- case, a subtype of "_ftp._tcp" could be defined. Instead of issuing a
- query for "_ftp._tcp.<Domain>", the Web browser issues a query for
- "_anon._ftp._tcp.<Domain>", where "_anon" is a defined subtype of
- "_ftp._tcp". The response to this query only includes the names of
- SRV records for FTP servers that are willing to allow anonymous
- login.
-
- Note that the FTP server's Service Instance Name is unchanged -- it
- is still something of the form "The Server._ftp._tcp.example.com."
- The subdomain in which FTP server SRV records are registered defines
- the namespace within which FTP server names are unique. Additional
- subtypes (e.g. "_anon") of the basic service type (e.g. "_ftp._tcp")
- serve to narrow the list of results, not to create more namespace.
-
- As with the TXT record name/value pairs, the list of possible
- subtypes, if any, are defined and specified separately for each basic
- service type.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 19]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-9. Flagship Naming
-
- In some cases, there may be several network protocols available which
- all perform roughly the same logical function. For example, the
- printing world has the LPR protocol, and the Internet Printing
- Protocol (IPP), both of which cause printed sheets to be emitted from
- printers in much the same way. In addition, many printer vendors send
- their own proprietary page description language (PDL) data over a TCP
- connection to TCP port 9100, herein referred to as the
- "pdl-datastream" protocol. In an ideal world we would have only one
- network printing protocol, and it would be sufficiently good that no
- one felt a compelling need to invent a different one. However, in
- practice, multiple legacy protocols do exist, and a service discovery
- protocol has to accommodate that.
-
- Many printers implement all three printing protocols: LPR, IPP, and
- pdl-datastream. For the benefit of clients that may speak only one of
- those protocols, all three are advertised.
-
- However, some clients may implement two, or all three of those
- printing protocols. When a client looks for all three service types
- on the network, it will find three distinct services -- an LPR
- service, an IPP service, and a pdl-datastream service -- all of which
- cause printed sheets to be emitted from the same physical printer.
-
- In the case of multiple protocols like this that all perform
- effectively the same function, the client should suppress duplicate
- names and display each name only once. When the user prints to a
- given named printer, the printing client is responsible for choosing
- the protocol which will best achieve the desired effect, without, for
- example, requiring the user to make a manual choice between LPR and
- IPP.
-
- As described so far, this all works very well. However, consider some
- future printer that only supports IPP printing, and some other future
- printer that only supports pdl-datastream printing. The name spaces
- for different service types are intentionally disjoint -- it is
- acceptable and desirable to be able to have both a file server called
- "Sales Department" and a printer called "Sales Department". However,
- it is not desirable, in the common case, to have two different
- printers both called "Sales Department", just because those printers
- are implementing different protocols.
-
- To help guard against this, when there are two or more network
- protocols which perform roughly the same logical function, one of the
- protocols is declared the "flagship" of the fleet of related
- protocols. Typically the flagship protocol is the oldest and/or
- best-known protocol of the set.
-
- If a device does not implement the flagship protocol, then it instead
- creates a placeholder SRV record (priority=0, weight=0, port=0,
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 20]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- target host = hostname of device) with that name. If, when it
- attempts to create this SRV record, it finds that a record with the
- same name already exists, then it knows that this name is already
- taken by some entity implementing at least one of the protocols from
- the class, and it must choose another. If no SRV record already
- exists, then the act of creating it stakes a claim to that name so
- that future devices in the same class will detect a conflict when
- they try to use it. The SRV record needs to contain the target host
- name in order for the conflict detection rules to operate. If two
- different devices were to create placeholder SRV records both using a
- null target host name (just the root label), then the two SRV records
- would be seen to be in agreement so no conflict would be registered.
-
- By defining a common well-known flagship protocol for the class,
- future devices that may not even know about each other's protocols
- establish a common ground where they can coordinate to verify
- uniqueness of names.
-
- No PTR record is created advertising the presence of empty flagship
- SRV records, since they do not represent a real service being
- advertised.
-
-
-10. Service Type Enumeration
-
- In general, clients are not interested in finding *every* service on
- the network, just the services that the client knows how to talk to.
- (Software designers may *think* there's some value to finding *every*
- service on the network, but that's just wooly thinking.)
-
- However, for problem diagnosis and network management tools, it may
- be useful for network administrators to find the list of advertised
- service types on the network, even if those service names are just
- opaque identifiers and not particularly informative in isolation.
-
- For this reason, a special meta-query is defined. A DNS query for
- PTR records with the name "_services._dns-sd._udp.<Domain>" yields
- a list of PTR records, where the rdata of each PTR record is the
- name of a service type. A subsequent query for PTR records with
- one of those names yields a list of instances of that service type.
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 21]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-11. Populating the DNS with Information
-
- How the SRV and PTR records that describe services and allow them to
- be enumerated make their way into the DNS is outside the scope of
- this document. However, it can happen easily in any of a number of
- ways, for example:
-
- On some networks, the administrator might manually enter the records
- into the name server's configuration file.
-
- A network monitoring tool could output a standard zone file to be
- read into a conventional DNS server. For example, a tool that can
- find Apple LaserWriters using AppleTalk NBP could find the list of
- printers, communicate with each one to find its IP address,
- PostScript version, installed options, etc., and then write out a DNS
- zone file describing those printers and their capabilities using DNS
- resource records. That information would then be available to DNS-SD
- clients that don't implement AppleTalk NBP, and don't want to.
-
- Future IP printers could use Dynamic DNS Update [RFC 2136] to
- automatically register their own SRV and PTR records with the DNS
- server.
-
- A printer manager device which has knowledge of printers on the
- network through some other management protocol could also use Dynamic
- DNS Update [RFC 2136].
-
- Alternatively, a printer manager device could implement enough of the
- DNS protocol that it is able to answer DNS queries directly, and
- Example Co.'s main DNS server could delegate the
- _ipp._tcp.example.com subdomain to the printer manager device.
-
- Zeroconf printers answer Multicast DNS queries on the local link
- for appropriate PTR and SRV names ending with ".local." [mDNS]
-
-
-12. Relationship to Multicast DNS
-
- DNS-Based Service Discovery is only peripherally related to Multicast
- DNS, in that the standard unicast DNS queries used by DNS-SD may also
- be performed using multicast when appropriate, which is particularly
- beneficial in Zeroconf environments [ZC].
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 22]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-13. Discovery of Browsing and Registration Domains (Domain Enumeration)
-
- One of the main reasons for DNS-Based Service Discovery is so that
- when a visiting client (e.g. a laptop computer) arrives at a new
- network, it can discover what services are available on that network
- without manual configuration. This logic that applies to discovering
- services without manual configuration also applies to discovering the
- domains in which services are registered without requiring manual
- configuration.
-
- This discovery is performed recursively, using Unicast or Multicast
- DNS. Four special RR names are reserved for this purpose:
-
- _browse._dns-sd._udp.<domain>
- _default._browse._dns-sd._udp.<domain>
- _register._dns-sd._udp.<domain>
- _default._register._dns-sd._udp.<domain>
-
- By performing PTR queries for these names, a client can learn,
- respectively:
-
- o A list of domains recommended for browsing
-
- o A single recommended default domain for browsing
-
- o A list of domains recommended for registering services using
- Dynamic Update
-
- o A single recommended default domain for registering services.
-
- These domains are purely advisory. The client or user is free to
- browse and/or register services in any domains. The purpose of these
- special queries is to allow software to create a user-interface that
- displays a useful list of suggested choices to the user, from which
- they may make a suitable selection, or ignore the offered suggestions
- and manually enter their own choice.
-
- The <domain> part of the name may be ".local." (meaning "perform the
- query using link-local multicast) or it may be learned through some
- other mechanism, such as the DHCP "Domain" option (option code 15)
- [RFC 2132] or the DHCP "Domain Search" option (option code 119)
- [RFC 3397]. Sophisticated clients may perform these queries both in
- ".local." and in one or more unicast domains, and then present the
- user with an aggregate result, combining the information received
- from all sources.
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 23]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-14. DNS Additional Record Generation
-
- DNS has an efficiency feature whereby a DNS server may place
- additional records in the Additional Section of the DNS Message.
- These additional records are typically records that the client did
- not explicitly request, but the server has reasonable grounds to
- expect that the client might request them shortly.
-
- This section recommends which additional records should be generated
- to improve network efficiency for both unicast and multicast DNS-SD
- responses.
-
-
-14.1 PTR Records
-
- When including a PTR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o The SRV record(s) named in the PTR rdata.
- o The TXT record(s) named in the PTR rdata.
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-14.2 SRV Records
-
- When including an SVR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-14.3 TXT Records
-
- When including a TXT record in a response packet, no additional
- records are required.
-
-
-14.4 Other Record Types
-
- In response to address queries, or other record types, no additional
- records are required by this document.
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 24]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-15. Comparison with Alternative Service Discovery Protocols
-
- Over the years there have been many proposed ways to do network
- service discovery with IP, but none achieved ubiquity in the
- marketplace. Certainly none has achieved anything close to the
- ubiquity of today's deployment of DNS servers, clients, and other
- infrastructure.
-
- The advantage of using DNS as the basis for service discovery is that
- it makes use of those existing servers, clients, protocols,
- infrastructure, and expertise. Existing network analyser tools
- already know how to decode and display DNS packets for network
- debugging.
-
- For ad-hoc networks such as Zeroconf environments, peer-to-peer
- multicast protocols are appropriate. The Zeroconf host profile [ZCHP]
- requires the use of a DNS-like protocol over IP Multicast for host
- name resolution in the absence of DNS servers. Given that Zeroconf
- hosts will have to implement this Multicast-based DNS-like protocol
- anyway, it makes sense for them to also perform service discovery
- using that same Multicast-based DNS-like software, instead of also
- having to implement an entirely different service discovery protocol.
-
- In larger networks, a high volume of enterprise-wide IP multicast
- traffic may not be desirable, so any credible service discovery
- protocol intended for larger networks has to provide some facility to
- aggregate registrations and lookups at a central server (or servers)
- instead of working exclusively using multicast. This requires some
- service discovery aggregation server software to be written,
- debugged, deployed, and maintained. This also requires some service
- discovery registration protocol to be implemented and deployed for
- clients to register with the central aggregation server. Virtually
- every company with an IP network already runs a DNS server, and DNS
- already has a dynamic registration protocol [RFC 2136]. Given that
- virtually every company already has to operate and maintain a DNS
- server anyway, it makes sense to take advantage of this instead of
- also having to learn, operate and maintain a different service
- registration server. It should be stressed again that using the same
- software and protocols doesn't necessarily mean using the same
- physical piece of hardware. The DNS-SD service discovery functions
- do not have to be provided by the same piece of hardware that
- is currently providing the company's DNS name service. The
- "_tcp.<Domain>" subdomain may be delegated to a different piece of
- hardware. However, even when the DNS-SD service is being provided by
- a different piece of hardware, it is still the same familiar DNS
- server software that is running, with the same configuration file
- syntax, the same log file format, and so forth.
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 25]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- Service discovery needs to be able to provide appropriate security.
- DNS already has existing mechanisms for security [RFC 2535].
-
- In summary:
-
- Service discovery requires a central aggregation server.
- DNS already has one: It's called a DNS server.
-
- Service discovery requires a service registration protocol.
- DNS already has one: It's called DNS Dynamic Update.
-
- Service discovery requires a query protocol
- DNS already has one: It's called DNS.
-
- Service discovery requires security mechanisms.
- DNS already has security mechanisms: DNSSEC.
-
- Service discovery requires a multicast mode for ad-hoc networks.
- Zeroconf environments already require a multicast-based DNS-like
- name lookup protocol for mapping host names to addresses, so it
- makes sense to let one multicast-based protocol do both jobs.
-
- It makes more sense to use the existing software that every network
- needs already, instead of deploying an entire parallel system just
- for service discovery.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 26]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-16. Real Example
-
- The following examples were prepared using standard unmodified
- nslookup and standard unmodified BIND running on GNU/Linux.
-
- Note: In real products, this information is obtained and presented to
- the user using graphical network browser software, not command-line
- tools, but if you wish you can try these examples for yourself as you
- read along, using the command-line tools already available on your
- own Unix machine.
-
-
-16.1 Question: What FTP servers are being advertised from dns-sd.org?
-
- nslookup -q=ptr _ftp._tcp.dns-sd.org.
- _ftp._tcp.dns-sd.org name=Apple\032QuickTime\032Files.dns-sd.org
- _ftp._tcp.dns-sd.org name=Microsoft\032Developer\032Files.dns-sd.org
- _ftp._tcp.dns-sd.org name=Registered\032Users'\032Only.dns-sd.org
-
- Answer: There are three, called "Apple QuickTime Files",
- "Microsoft Developer Files" and "Registered Users' Only".
-
- Note that nslookup escapes spaces as "\032" for display purposes,
- but a graphical DNS-SD browser does not.
-
-
-16.2 Question: What FTP servers allow anonymous access?
-
- nslookup -q=ptr _anon._ftp._tcp.dns-sd.org
- _anon._ftp._tcp.dns-sd.org
- name=Apple\032QuickTime\032Files.dns-sd.org
- _anon._ftp._tcp.dns-sd.org
- name=Microsoft\032Developer\032Files.dns-sd.org
-
- Answer: Only "Apple QuickTime Files" and "Microsoft Developer Files"
- allow anonymous access.
-
-
-16.3 Question: How do I access "Apple QuickTime Files"?
-
- nslookup -q=any "Apple\032QuickTime\032Files.dns-sd.org."
- Apple\032QuickTime\032Files.dns-sd.org text = "path=/quicktime"
- Apple\032QuickTime\032Files.dns-sd.org
- priority = 0, weight = 0, port= 21 host = ftp.apple.com
- ftp.apple.com internet address = 17.254.0.27
- ftp.apple.com internet address = 17.254.0.31
- ftp.apple.com internet address = 17.254.0.26
-
- Answer: You need to connect to ftp.apple.com, port 21, path
- "/quicktime". The addresses for ftp.apple.com are also given.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 27]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-17. IPv6 Considerations
-
- IPv6 has no significant differences, except that the address of the
- SRV record's target host is given by the appropriate IPv6 address
- records instead of the IPv4 "A" record.
-
-
-18. Security Considerations
-
- DNSSEC [RFC 2535] should be used where the authenticity of
- information is important. Since DNS-SD is just a naming and usage
- convention for records in the existing DNS system, it has no specific
- additional security requirements over and above those that already
- apply to DNS queries and DNS updates.
-
-
-19. IANA Considerations
-
- This protocol builds on DNS SRV records [RFC 2782], and similarly
- requires IANA to assign unique application protocol names.
- Unfortunately, the "IANA Considerations" section of RFC 2782 says
- simply, "The IANA has assigned RR type value 33 to the SRV RR.
- No other IANA services are required by this document."
- Due to this oversight, IANA is currently prevented from carrying
- out the necessary function of assigning these unique identifiers.
-
- This document proposes the following IANA allocation policy for
- unique application protocol names:
-
- Allowable names:
- * Must be no more than fourteen characters long
- * Must consist only of:
- - lower-case letters 'a' - 'z'
- - digits '0' - '9'
- - the hyphen character '-'
- * Must begin and end with a lower-case letter or digit.
- * Must not already be assigned to some other protocol in the
- existing IANA "list of assigned application protocol names
- and port numbers" [ports].
-
- These identifiers are allocated on a First Come First Served basis.
- In the event of abuse (e.g. automatated mass registrations, etc.),
- the policy may be changed without notice to Expert Review [RFC 2434].
-
- The textual nature of service/protocol names means that there are
- almost infinitely many more of them available than the finite set of
- 65535 possible port numbers. This means that developers can produce
- experimental implementations using unregistered service names with
- little chance of accidental collision, providing service names are
- chosen with appropriate care. However, this document strongly
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 28]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- advocates that on or before the date a product ships, developers
- should properly register their service names.
-
- Some developers have expressed concern that publicly registering
- their service names (and port numbers today) with IANA before a
- product ships may give away clues about that product to competitors.
- For this reason, IANA should consider allowing service name
- applications to remain secret for some period of time, much as US
- patent applications remain secret for two years after the date of
- filing.
-
- This proposed IANA allocation policy is not in force until this
- document is published as an RFC. In the meantime, unique application
- protocol names may be registered according to the instructions at
- <http://www.dns-sd.org/ServiceNames.html>. As of January 2004, there
- are roughly 100 application protocols in currently shipping products
- that have been so registered as using DNS-SD for service discovery.
-
-
-20. Acknowledgements
-
- We would like to thank (in alphabetical order) Richard Brown, Josh
- Graessley, Erik Guttman, Paul Vixie, and Bill Woodcock, for their
- contributions.
-
-
-21. Copyright
-
- Copyright (C) The Internet Society 2004.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 29]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-22. Normative References
-
- [ports] IANA list of assigned application protocol names and port
- numbers <http://www.iana.org/assignments/port-numbers>
-
- [RFC 1033] Lottor, M., "Domain Administrators Operations Guide",
- RFC 1033, November 1987.
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
- [RFC 2782] Gulbrandsen, A., et al., "A DNS RR for specifying the
- location of services (DNS SRV)", RFC 2782, February 2000.
-
-
-23. Informative References
-
- [mDNS] Cheshire, S., and M. Krochmal, "Multicast DNS",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-multicastdns-04.txt, February 2004.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-03.txt, February 2004.
-
- [RFC 2132] Alexander, S., and Droms, R., "DHCP Options and BOOTP
- Vendor Extensions", RFC 2132, March 1997.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2434] Narten, T., and H. Alvestrand, "Guidelines for Writing
- an IANA Considerations Section in RFCs", RFC 2434,
- October 1998.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 30]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [RFC 3007] Wellington, B., et al., "Secure Domain Name System (DNS)
- Dynamic Update", RFC 3007, November 2000.
-
- [RFC 3397] Aboba, B., and Cheshire, S., "Dynamic Host Configuration
- Protocol (DHCP) Domain Search Option", RFC 3397, November
- 2002.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
- [ZCHP] Guttman, E., "Zeroconf Host Profile Applicability
- Statement", Internet-Draft (work in progress),
- draft-ietf-zeroconf-host-prof-01.txt, July 2001.
-
-
-24. Author's Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 31]
diff --git a/release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-03.txt b/release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-03.txt
deleted file mode 100644
index c412806..0000000
--- a/release-0.6.9/specs/draft-cheshire-dnsext-dns-sd-03.txt
+++ /dev/null
@@ -1,1856 +0,0 @@
-Document: draft-cheshire-dnsext-dns-sd-03.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 7th December 2005 Marc Krochmal
- Apple Computer, Inc.
- 7th June 2005
-
- DNS-Based Service Discovery
-
- <draft-cheshire-dnsext-dns-sd-03.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 1]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-Table of Contents
-
- 1. Introduction....................................................3
- 2. Conventions and Terminology Used in this Document...............3
- 3. Design Goals....................................................4
- 4. Service Instance Enumeration....................................5
- 4.1 Structured Instance Names.......................................5
- 4.2 User Interface Presentation.....................................7
- 4.3 Internal Handling of Names......................................7
- 4.4 What You See Is What You Get....................................7
- 4.5 Ordering of Service Instance Name Components....................9
- 5. Service Name Resolution........................................11
- 6. Data Syntax for DNS-SD TXT Records.............................12
- 6.1 General Format Rules for DNS TXT Records.......................12
- 6.2 DNS TXT Record Format Rules for use in DNS-SD..................13
- 6.3 DNS-SD TXT Record Size.........................................14
- 6.4 Rules for Names in DNS-SD Name/Value Pairs.....................14
- 6.5 Rules for Values in DNS-SD Name/Value Pairs....................16
- 6.6 Example TXT Record.............................................16
- 6.7 Version Tag....................................................17
- 7. Application Protocol Names.....................................17
- 7.1 Service Name Length Limits.....................................19
- 8. Selective Instance Enumeration.................................20
- 9. Flagship Naming................................................20
- 10. Service Type Enumeration.......................................22
- 11. Populating the DNS with Information............................23
- 12. Relationship to Multicast DNS..................................23
- 13. Discovery of Browsing and Registration Domains.................24
- 14. DNS Additional Record Generation...............................25
- 15. Comparison with Alternative Service Discovery Protocols........26
- 16. Real Example...................................................28
- 17. IPv6 Considerations............................................29
- 18. Security Considerations........................................29
- 19. IANA Considerations............................................29
- 20. Acknowledgments................................................30
- 21. Copyright......................................................30
- 22. Normative References...........................................31
- 23. Informative References.........................................31
- 24. Authors' Addresses.............................................32
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 2]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-1. Introduction
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of a that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, resource record types,
- or any other new DNS protocol values. This document simply proposes
- a convention for how existing resource record types can be named and
- structured to facilitate service discovery.
-
- This proposal is entirely compatible with today's existing unicast
- DNS server and client software.
-
- Note that the DNS-SD service does NOT have to be provided by the same
- DNS server hardware that is currently providing an organization's
- conventional host name lookup service (the service we traditionally
- think of when we say "DNS"). By delegating the "_tcp" subdomain, all
- the workload related to DNS-SD can be offloaded to a different
- machine. This flexibility, to handle DNS-SD on the main DNS server,
- or not, at the network administrator's discretion, is one of the
- things that makes DNS-SD so compelling.
-
- Even when the DNS-SD functions are delegated to a different machine,
- the benefits of using DNS remain: It is mature technology, well
- understood, with multiple independent implementations from different
- vendors, a wide selection of books published on the subject, and an
- established workforce experienced in its operation. In contrast,
- adopting some other service discovery technology would require every
- site in the world to install, learn, configure, operate and maintain
- some entirely new and unfamiliar server software. Faced with these
- obstacles, it seems unlikely that any other service discovery
- technology could hope to compete with the ubiquitous deployment
- that DNS already enjoys.
-
- This proposal is also compatible with (but not dependent on) the
- proposal outlined in "Multicast DNS" [mDNS].
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 3]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-3. Design Goals
-
- A good service discovery protocol needs to have many properties,
- three of which are mentioned below:
-
- (i) The ability to query for services of a certain type in a certain
- logical domain and receive in response a list of named instances
- (network browsing, or "Service Instance Enumeration").
-
- (ii) Given a particular named instance, the ability to efficiently
- resolve that instance name to the required information a client needs
- to actually use the service, i.e. IP address and port number, at the
- very least (Service Name Resolution).
-
- (iii) Instance names should be relatively persistent. If a user
- selects their default printer from a list of available choices today,
- then tomorrow they should still be able to print on that printer --
- even if the IP address and/or port number where the service resides
- have changed -- without the user (or their software) having to repeat
- the network browsing step a second time.
-
- In addition, if it is to become successful, a service discovery
- protocol should be so simple to implement that virtually any
- device capable of implementing IP should not have any trouble
- implementing the service discovery software as well.
-
- These goals are discussed in more detail in the remainder of this
- document. A more thorough treatment of service discovery requirements
- may be found in "Requirements for a Protocol to Replace AppleTalk
- NBP" [NBP]. That document draws upon examples from two decades of
- operational experience with AppleTalk Name Binding Protocol to
- develop a list of universal requirements which are broadly applicable
- to any potential service discovery protocol.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 4]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-4. Service Instance Enumeration
-
- DNS SRV records [RFC 2782] are useful for locating instances of a
- particular type of service when all the instances are effectively
- indistinguishable and provide the same service to the client.
-
- For example, SRV records with the (hypothetical) name
- "_http._tcp.example.com." would allow a client to discover a list of
- all servers implementing the "_http._tcp" service (i.e. Web servers)
- for the "example.com." domain. The unstated assumption is that all
- these servers offer an identical set of Web pages, and it doesn't
- matter to the client which of the servers it uses, as long as it
- selects one at random according to the weight and priority rules laid
- out in RFC 2782.
-
- Instances of other kinds of service are less easily interchangeable.
- If a word processing application were to look up the (hypothetical)
- SRV record "_ipp._tcp.example.com." to find the list of IPP printers
- at Example Co., then picking one at random and printing on it would
- probably not be what the user wanted.
-
- The remainder of this section describes how SRV records may be used
- in a slightly different way to allow a user to discover the names
- of all available instances of a given type of service, in order to
- select the particular instance the user desires.
-
-
-4.1 Structured Instance Names
-
- This document borrows the logical service naming syntax and semantics
- from DNS SRV records, but adds one level of indirection. Instead of
- requesting records of type "SRV" with name "_ipp._tcp.example.com.",
- the client requests records of type "PTR" (pointer from one name to
- another in the DNS namespace).
-
- In effect, if one thinks of the domain name "_ipp._tcp.example.com."
- as being analogous to an absolute path to a directory in a file
- system then the PTR lookup is akin to performing a listing of that
- directory to find all the files it contains. (Remember that domain
- names are expressed in reverse order compared to path names: An
- absolute path name is read from left to right, beginning with a
- leading slash on the left, and then the top level directory, then the
- next level directory, and so on. A fully-qualified domain name is
- read from right to left, beginning with the dot on the right -- the
- root label -- and then the top level domain to the left of that, and
- the second level domain to the left of that, and so on. If the fully-
- qualified domain name "_ipp._tcp.example.com." were expressed as a
- file system path name, it would be "/com/example/_tcp/_ipp".)
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 5]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The result of this PTR lookup for the name "<Service>.<Domain>" is a
- list of zero or more PTR records giving Service Instance Names of the
- form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- The <Instance> portion of the Service Instance Name is a single DNS
- label, containing arbitrary precomposed UTF-8-encoded text [RFC
- 2279]. It is a user-friendly name, meaning that it is allowed to
- contain any characters, without restriction, including spaces, upper
- case, lower case, punctuation -- including dots -- accented
- characters, non-roman text, and anything else that may be represented
- using UTF-8. DNS recommends guidelines for allowable characters for
- host names [RFC 1033][RFC 1034][RFC 1035], but Service Instance Names
- are not host names. Service Instance Names are not intended to ever
- be typed in by a normal user; the user selects a Service Instance
- Name by selecting it from a list of choices presented on the screen.
-
- Note that just because this protocol supports arbitrary UTF-8-encoded
- names doesn't mean that any particular user or administrator is
- obliged to make use of that capability. Any user is free, if they
- wish, to continue naming their services using only letters, digits
- and hyphens, with no spaces, capital letters, or other punctuation.
-
- DNS labels are currently limited to 63 octets in length. UTF-8
- encoding can require up to four octets per Unicode character, which
- means that in the worst case, the <Instance> portion of a name could
- be limited to fifteen Unicode characters. However, the Unicode
- characters with longer UTF-8 encodings tend to be the more obscure
- ones, and tend to be the ones that convey greater meaning per
- character.
-
- Note that any character in the commonly-used 16-bit Unicode space can
- be encoded with no more than three octets of UTF-8 encoding. This
- means that an Instance name can contain up to 21 Kanji characters,
- which is a sufficiently expressive name for most purposes.
-
- The <Service> portion of the Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the pair is the Application
- Protocol Name, and the second label is either "_tcp" or "_udp",
- depending on the transport protocol used by the application.
- More details are given in Section 7, "Application Protocol Names".
-
- The <Domain> portion of the Service Instance Name is a conventional
- DNS domain name, consisting of as many labels as appropriate. For
- example, "apple.com.", "cs.stanford.edu.", and "eng.us.ibm.com." are
- all valid domain names for the <Domain> portion of the Service
- Instance Name.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 6]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-4.2 User Interface Presentation
-
- The names resulting from the PTR lookup are presented to the user in
- a list for the user to select one (or more). Typically only the first
- label is shown (the user-friendly <Instance> portion of the name). In
- the common case, the <Service> and <Domain> are already known to the
- user, these having been provided by the user in the first place, by
- the act of indicating the service being sought, and the domain in
- which to look for it. Note: The software handling the response
- should be careful not to make invalid assumptions though, since it
- *is* possible, though rare, for a service enumeration in one domain
- to return the names of services in a different domain. Similarly,
- when using subtypes (see "Selective Instance Enumeration") the
- <Service> of the discovered instance my not be exactly the same as
- the <Service> that was requested.
-
- Having chosen the desired named instance, the Service Instance Name
- may then be used immediately, or saved away in some persistent
- user-preference data structure for future use, depending on what is
- appropriate for the application in question.
-
-
-4.3 Internal Handling of Names
-
- If the <Instance>, <Service> and <Domain> portions are internally
- concatenated together into a single string, then care must be taken
- with the <Instance> portion, since it is allowed to contain any
- characters, including dots.
-
- Any dots in the <Instance> portion should be escaped by preceding
- them with a backslash ("." becomes "\."). Likewise, any backslashes
- in the <Instance> portion should also be escaped by preceding them
- with a backslash ("\" becomes "\\"). Having done this, the three
- components of the name may be safely concatenated. The
- backslash-escaping allows literal dots in the name (escaped) to be
- distinguished from label-separator dots (not escaped).
-
- The resulting concatenated string may be safely passed to standard
- DNS APIs like res_query(), which will interpret the string correctly
- provided it has been escaped correctly, as described here.
-
-
-4.4 What You See Is What You Get
-
- Some service discovery protocols decouple the true service identifier
- from the name presented to the user. The true service identifier used
- by the protocol is an opaque unique id, often represented using a
- long string of hexadecimal digits, and should never be seen by the
- typical user. The name presented to the user is merely one of the
- ephemeral attributes attached to this opaque identifier.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 7]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The problem with this approach is that it decouples user perception
- from reality:
-
- * What happens if there are two service instances, with different
- unique ids, but they have inadvertently been given the same
- user-visible name? If two instances appear in an on-screen list
- with the same name, how does the user know which is which?
-
- * Suppose a printer breaks down, and the user replaces it with
- another printer of the same make and model, and configures the new
- printer with the exact same name as the one being replaced:
- "Stuart's Printer". Now, when the user tries to print, the
- on-screen print dialog tells them that their selected default
- printer is "Stuart's Printer". When they browse the network to see
- what is there, they see a printer called "Stuart's Printer", yet
- when the user tries to print, they are told that the printer
- "Stuart's Printer" can't be found. The hidden internal unique id
- that the software is trying to find on the network doesn't match
- the hidden internal unique id of the new printer, even though its
- apparent "name" and its logical purpose for being there are the
- same. To remedy this, the user typically has to delete the print
- queue they have created, and then create a new (apparently
- identical) queue for the new printer, so that the new queue will
- contain the right hidden internal unique id. Having all this hidden
- information that the user can't see makes for a confusing and
- frustrating user experience, and exposing long ugly hexadecimal
- strings to the user and forcing them to understand what they mean
- is even worse.
-
- * Suppose an existing printer is moved to a new department, and given
- a new name and a new function. Changing the user-visible name of
- that piece of hardware doesn't change its hidden internal unique
- id. Users who had previously created print queues for that printer
- will still be accessing the same hardware by its unique id, even
- though the logical service that used to be offered by that hardware
- has ceased to exist.
-
- To solve these problems requires the user or administrator to be
- aware of the supposedly hidden unique id, and to set its value
- correctly as hardware is moved around, repurposed, or replaced,
- thereby contradicting the notion that it is a hidden identifier that
- human users never need to deal with. Requiring the user to understand
- this expert behind-the-scenes knowledge of what is *really* going on
- is just one more burden placed on the user when they are trying to
- diagnose why their computers and network devices are not working as
- expected.
-
- These anomalies and counter-intuitive behaviors can be eliminated by
- maintaining a tight bidirectional one-to-one mapping between what the
- user sees on the screen and what is really happening "behind the
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 8]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- curtain". If something is configured incorrectly, then that is
- apparent in the familiar day-to-day user interface that everyone
- understands, not in some little-known rarely-used "expert" interface.
-
- In summary: The user-visible name is the primary identifier for a
- service. If the user-visible name is changed, then conceptually the
- service being offered is a different logical service -- even though
- the hardware offering the service stayed the same. If the
- user-visible name doesn't change, then conceptually the service being
- offered is the same logical service -- even if the hardware offering
- the service is new hardware brought in to replace some old equipment.
-
- There are certainly arguments on both sides of this debate.
- Nonetheless, the designers of any service discovery protocol have
- to make a choice between between having the primary identifiers be
- hidden, or having them be visible, and these are the reasons that we
- chose to make them visible. We're not claiming that there are no
- disadvantages of having primary identifiers be visible. We considered
- both alternatives, and we believe that the few disadvantages
- of visible identifiers are far outweighed by the many problems
- caused by use of hidden identifiers.
-
-
-4.5 Ordering of Service Instance Name Components
-
- There have been questions about why services are named using DNS
- Service Instance Names of the form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- instead of:
-
- Service Instance Name = <Service> . <Instance> . <Domain>
-
- There are three reasons why it is beneficial to name service
- instances with the parent domain as the most-significant (rightmost)
- part of the name, then the abstract service type as the next-most
- significant, and then the specific instance name as the
- least-significant (leftmost) part of the name:
-
-
-4.5.1. Semantic Structure
-
- The facility being provided by browsing ("Service Instance
- Enumeration") is effectively enumerating the leaves of a tree
- structure. A given domain offers zero or more services. For each of
- those service types, there may be zero or more instances of that
- service.
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 9]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The user knows what type of service they are seeking. (If they are
- running an FTP client, they are looking for FTP servers. If they have
- a document to print, they are looking for entities that speak some
- known printing protocol.) The user knows in which organizational or
- geographical domain they wish to search. (The user does not want a
- single flat list of every single printer on the planet, even if such
- a thing were possible.) What the user does not know in advance is
- whether the service they seek is offered in the given domain, or if
- so, how many instances are offered, and the names of those instances.
- Hence having the instance names be the leaves of the tree is
- consistent with this semantic model.
-
- Having the service types be the terminal leaves of the tree would
- imply that the user knows the domain name, and already knows the
- name of the service instance, but doesn't have any idea what the
- service does. We would argue that this is a less useful model.
-
-
-4.5.2. Network Efficiency
-
- When a DNS response contains multiple answers, name compression works
- more effectively if all the names contain a common suffix. If many
- answers in the packet have the same <Service> and <Domain>, then each
- occurrence of a Service Instance Name can be expressed using only the
- <Instance> part followed by a two-byte compression pointer
- referencing a previous appearance of "<Service>.<Domain>". This
- efficiency would not be possible if the <Service> component appeared
- first in each name.
-
-
-4.5.3. Operational Flexibility
-
- This name structure allows subdomains to be delegated along logical
- service boundaries. For example, the network administrator at Example
- Co. could choose to delegate the "_tcp.example.com." subdomain to a
- different machine, so that the machine handling service discovery
- doesn't have to be the same as the machine handling other day-to-day
- DNS operations. (It *can* be the same machine if the administrator so
- chooses, but the point is that the administrator is free to make that
- choice.) Furthermore, if the network administrator wishes to delegate
- all information related to IPP printers to a machine dedicated to
- that specific task, this is easily done by delegating the
- "_ipp._tcp.example.com." subdomain to the desired machine. It is also
- convenient to set security policies on a per-zone/per-subdomain
- basis. For example, the administrator may choose to enable DNS
- Dynamic Update [RFC 2136] [RFC 3007] for printers registering in the
- "_ipp._tcp.example.com." subdomain, but not for other
- zones/subdomains. This easy flexibility would not exist if the
- <Service> component appeared first in each name.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 10]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-5. Service Name Resolution
-
- Given a particular Service Instance Name, when a client needs to
- contact that service, it sends a DNS query for the SRV record of
- that name.
-
- The result of the DNS query is a SRV record giving the port number
- and target host where the service may be found.
-
- The use of SRV records is very important. There are only 65535 TCP
- port numbers available. These port numbers are being allocated
- one-per-application-protocol at an alarming rate. Some protocols like
- the X Window System have a block of 64 TCP ports allocated
- (6000-6063). If we start allocating blocks of 64 TCP ports at a time,
- we will run out even faster. Using a different TCP port for each
- different instance of a given service on a given machine is entirely
- sensible, but allocating large static ranges, as was done for X, is a
- very inefficient way to manage a limited resource. On any given host,
- most TCP ports are reserved for services that will never run on that
- particular host. This is very poor utilization of the limited port
- space. Using SRV records allows each host to allocate its available
- port numbers dynamically to those services running on that host that
- need them, and then advertise the allocated port numbers via SRV
- records. Allocating the available listening port numbers locally
- on a per-host basis as needed allows much better utilization of the
- available port space than today's centralized global allocation.
-
- In some environments there may be no compelling reason to assign
- managed names to every host, since every available service is
- accessible by name anyway, as a first-class entity in its own right.
- However, the DNS packet format and record format still require a host
- name to link the target host referenced in the SRV record to the
- address records giving the IPv4 and/or IPv6 addresses for that
- hardware. In the case where no natural host name is available, the
- SRV record may give its own name as the name of the target host, and
- then the requisite address records may be attached to that same name.
- It is perfectly permissible for a single name in the DNS hierarchy to
- have multiple records of different type attached. (The only
- restriction being that a given name may not have both a CNAME record
- and other records at the same time.)
-
- In the event that more than one SRV is returned, clients MUST
- correctly interpret the priority and weight fields -- i.e. Lower
- numbered priority servers should be used in preference to higher
- numbered priority servers, and servers with equal priority should be
- selected randomly in proportion to their relative weights. However,
- in the overwhelmingly common case, a single advertised DNS-SD service
- instance is described by exactly one SRV record, and in this common
- case the priority and weight fields of the SRV record SHOULD both be
- set to zero.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 11]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-6. Data Syntax for DNS-SD TXT Records
-
- Some services discovered via Service Instance Enumeration may need
- more than just an IP address and port number to properly identify the
- service. For example, printing via the LPR protocol often specifies a
- queue name. This queue name is typically short and cryptic, and need
- not be shown to the user. It should be regarded the same way as the
- IP address and port number -- it is one component of the addressing
- information required to identify a specific instance of a service
- being offered by some piece of hardware. Similarly, a file server may
- have multiple volumes, each identified by its own volume name. A Web
- server typically has multiple pages, each identified by its own URL.
- In these cases, the necessary additional data is stored in a TXT
- record with the same name as the SRV record. The specific nature of
- that additional data, and how it is to be used, is service-dependent,
- but the overall syntax of the data in the TXT record is standardized,
- as described below. Every DNS-SD service MUST have a TXT record in
- addition to its SRV record, with same name, even if the service has
- no additional data to store and the TXT record contains no more than
- a single zero byte.
-
-
-6.1 General Format Rules for DNS TXT Records
-
- A DNS TXT record can be up to 65535 (0xFFFF) bytes long. The total
- length is indicated by the length given in the resource record header
- in the DNS message. There is no way to tell directly from the data
- alone how long it is (e.g. there is no length count at the start, or
- terminating NULL byte at the end). (Note that when using Multicast
- DNS [mDNS] the maximum packet size is 9000 bytes, which imposes an
- upper limit on the size of TXT records of about 8800 bytes.)
-
- The format of the data within a DNS TXT record is one or more
- strings, packed together in memory without any intervening gaps or
- padding bytes for word alignment.
-
- The format of each constituent string within the DNS TXT record is a
- single length byte, followed by 0-255 bytes of text data.
-
- These format rules are defined in Section 3.3.14 of RFC 1035, and are
- not specific to DNS-SD. DNS-SD simply specifies a usage convention
- for what data should be stored in those constituent strings.
-
- An empty TXT record containing zero strings is disallowed by RFC
- 1035. DNS-SD implementations MUST NOT emit empty TXT records. DNS-SD
- implementations receiving empty TXT records MUST treat them as
- equivalent to a one-byte TXT record containing a single zero byte
- (i.e. a single empty string).
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 12]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-6.2 DNS TXT Record Format Rules for use in DNS-SD
-
- DNS-SD uses DNS TXT records to store arbitrary name/value pairs
- conveying additional information about the named service. Each
- name/value pair is encoded as its own constituent string within the
- DNS TXT record, in the form "name=value". Everything up to the first
- '=' character is the name. Everything after the first '=' character
- to the end of the string (including subsequent '=' characters, if
- any) is the value. Specific rules governing names and values are
- given below. Each author defining a DNS-SD profile for discovering
- instances of a particular type of service should define the base set
- of name/value attributes that are valid for that type of service.
-
- Using this standardized name/value syntax within the TXT record makes
- it easier for these base definitions to be expanded later by defining
- additional named attributes. If an implementation sees unknown
- attribute names in a service TXT record, it MUST silently ignore
- them.
-
- The TCP (or UDP) port number of the service, and target host name,
- are given in the SRV record. This information -- target host name and
- port number -- MUST NOT be duplicated using name/value attributes in
- the TXT record.
-
- The intention of DNS-SD TXT records is to convey a small amount of
- useful additional information about a service. Ideally it SHOULD NOT
- be necessary for a client to retrieve this additional information
- before it can usefully establish a connection to the service. For a
- well-designed TCP-based application protocol, it should be possible,
- knowing only the host name and port number, to open a connection to
- that listening process, and then perform version- or feature-
- negotiation to determine the capabilities of the service instance.
- For example, when connecting to an AppleShare server over TCP, the
- client enters into a protocol exchange with the server to determine
- which version of the AppleShare protocol the server implements, and
- which optional features or capabilities (if any) are available. For a
- well-designed application protocol, clients should be able to connect
- and use the service even if there is no information at all in the TXT
- record. In this case, the information in the TXT record should be
- viewed as a performance optimization -- when a client discovers many
- instances of a service, the TXT record allows the client to know some
- rudimentary information about each instance without having to open a
- TCP connection to each one and interrogate every service instance
- separately. Extreme care should be taken when doing this to ensure
- that the information in the TXT record is in agreement with the
- information retrieved by a client connecting over TCP.
-
- There are legacy protocols which provide no feature negotiation
- capability, and in these cases it may be useful to convey necessary
- information in the TXT record. For example, when printing using the
- old Unix LPR (port 515) protocol, the LPR service provides no way for
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 13]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- the client to determine whether a particular printer accepts
- PostScript, or what version of PostScript, etc. In this case it is
- appropriate to embed this information in the TXT record, because the
- alternative is worse -- passing around written instructions to the
- users, arcane manual configuration of "/etc/printcap" files, etc.
-
-
-6.3 DNS-SD TXT Record Size
-
- The total size of a typical DNS-SD TXT record is intended to be small
- -- 200 bytes or less.
-
- In cases where more data is justified (e.g. LPR printing), keeping
- the total size under 400 bytes should allow it to fit in a single
- standard 512-byte DNS message. (This standard DNS message size is
- defined in RFC 1035.)
-
- In extreme cases where even this is not enough, keeping the size of
- the TXT record under 1300 bytes should allow it to fit in a single
- 1500-byte Ethernet packet.
-
- Using TXT records larger than 1300 bytes is NOT RECOMMENDED at this
- time.
-
-
-6.4 Rules for Names in DNS-SD Name/Value Pairs
-
- The "Name" MUST be at least one character. Strings beginning with an
- '=' character (i.e. the name is missing) SHOULD be silently ignored.
-
- The characters of "Name" MUST be printable US-ASCII values
- (0x20-0x7E), excluding '=' (0x3D).
-
- Spaces in the name are significant, whether leading, trailing, or in
- the middle -- so don't include any spaces unless you really intend
- that!
-
- Case is ignored when interpreting a name, so "papersize=A4",
- "PAPERSIZE=A4" and "Papersize=A4" are all identical.
-
- If there is no '=', then it is a boolean attribute, and is simply
- identified as being present, with no value.
-
- A given attribute name may appear at most once in a TXT record. If a
- client receives a TXT record containing the same attribute name more
- than once, then the client MUST silently ignore all but the first
- occurrence of that attribute. For client implementations that process
- a DNS-SD TXT record from start to end, placing name/value pairs into
- a hash table, using the name as the hash table key, this means that
- if the implementation attempts to add a new name/value pair into the
- table and finds an entry with the same name already present, then the
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 14]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- new entry being added should be silently discarded instead. For
- client implementations that retrieve name/value pairs by searching
- the TXT record for the requested name, they should search the TXT
- record from the start, and simply return the first matching name they
- find. The reason for this simplifying rule is to facilitate the
- creation of client libraries that parse the TXT record into an
- internal data structure, such as a hash table or dictionary object
- that maps from names to values, and then make that abstraction
- available to client code.
-
- When examining a TXT record for a given named attribute, there are
- therefore four broad categories of results which may be returned:
-
- * Attribute not present (Absent)
-
- * Attribute present, with no value
- (e.g. "Anon Allowed" -- server allows anonymous connections)
-
- * Attribute present, with empty value (e.g. "Installed PlugIns=" --
- server supports plugins, but none are presently installed)
-
- * Attribute present, with non-empty value
- (e.g. "Installed PlugIns=JPEG,MPEG2,MPEG4")
-
- Each author defining a DNS-SD profile for discovering instances of a
- particular type of service should define the interpretation of these
- different kinds of result. For example, for some keys, there may be
- a natural true/false boolean interpretation:
-
- * Present implies 'true'
- * Absent implies 'false'
-
- For other keys it may be sensible to define other semantics, such as
- value/no-value/unknown:
-
- * Present with value implies that value.
- E.g. "Color=4" for a four-color ink-jet printer,
- or "Color=6" for a six-color ink-jet printer.
-
- * Present with empty value implies 'false'. E.g. Not a color printer.
-
- * Absent implies 'Unknown'. E.g. A print server connected to some
- unknown printer where the print server doesn't actually know if the
- printer does color or not -- which gives a very bad user experience
- and should be avoided wherever possible.
-
- (Note that this is a hypothetical example, not an example of actual
- name/value keys used by DNS-SD network printers.)
-
- As a general rule, attribute names that contain no dots are defined
- as part of the open-standard definition written by the person or
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 15]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- group defining the DNS-SD profile for discovering that particular
- service type. Vendor-specific extensions should be given names of the
- form "keyname.company.com=value", using a domain name legitimately
- registered to the person or organization creating the vendor-specific
- key. This reduces the risk of accidental conflict if different
- organizations each define their own vendor-specific keys.
-
-
-6.5 Rules for Values in DNS-SD Name/Value Pairs
-
- If there is an '=', then everything after the first '=' to the end of
- the string is the value. The value can contain any eight-bit values
- including '='. Leading or trailing spaces are part of the value, so
- don't put them there unless you intend them to be there. Any
- quotation marks around the value are part of the value, so don't put
- them there unless you intend them to be part of the value.
-
- The value is opaque binary data. Often the value for a particular
- attribute will be US-ASCII (or UTF-8) text, but it is legal for a
- value to be any binary data. For example, if the value of a key is an
- IPv4 address, that address should simply be stored as four bytes of
- binary data, not as a variable-length 7-15 byte ASCII string giving
- the address represented in textual dotted decimal notation.
-
- Generic debugging tools should generally display all attribute values
- as a hex dump, with accompanying text alongside displaying the UTF-8
- interpretation of those bytes, except for attributes where the
- debugging tool has embedded knowledge that the value is some other
- kind of data.
-
- Authors defining DNS-SD profiles SHOULD NOT convert binary attribute
- data types into printable text (e.g. using hexadecimal, Base-64 or UU
- encoding) merely for the sake of making the data be printable text
- when seen in a generic debugging tool. Doing this simply bloats the
- size of the TXT record, without actually making the data any more
- understandable to someone looking at it in a generic debugging tool.
-
-
-6.6 Example TXT Record
-
- The TXT record below contains three syntactically valid name/value
- pairs. (The meaning of these name/value pairs, if any, would depend
- on the definitions pertaining to the service in question that is
- using them.)
-
- ---------------------------------------------------------------
- | 0x0A | name=value | 0x08 | paper=A4 | 0x0E | DNS-SD Is Cool |
- ---------------------------------------------------------------
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 16]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-6.7 Version Tag
-
- It is recommended that authors defining DNS-SD profiles include an
- attribute of the form "txtvers=xxx" in their definition, and require
- it to be the first name/value pair in the TXT record. This
- information in the TXT record can be useful to help clients maintain
- backwards compatibility with older implementations if it becomes
- necessary to change or update the specification over time. Even if
- the profile author doesn't anticipate the need for any future
- incompatible changes, having a version number in the specification
- provides useful insurance should incompatible changes become
- unavoidable. Clients SHOULD ignore TXT records with a txtvers number
- higher (or lower) than the version(s) they know how to interpret.
-
- Note that the version number in the txtvers tag describes the version
- of the TXT record specification being used to create this TXT record,
- not the version of the application protocol that will be used if the
- client subsequently decides to contact that service. Ideally, every
- DNS-SD TXT record specification starts at txtvers=1 and stays that
- way forever. Improvements can be made by defining new keys that older
- clients silently ignore. The only reason to increment the version
- number is if the old specification is subsequently found to be so
- horribly broken that there's no way to do a compatible forward
- revision, so the txtvers number has to be incremented to tell all the
- old clients they should just not even try to understand this new TXT
- record.
-
- If there is a need to indicate which version number(s) of the
- application protocol the service implements, the recommended key
- name for this is "protovers".
-
-
-7. Application Protocol Names
-
- The <Service> portion of a Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the pair is the Application
- Protocol Name, and the second label is either "_tcp" or "_udp".
-
- Wise selection of the Application Protocol Name is very important,
- and the choice is not always as obvious as it may appear.
-
- Application Protocol Names may be no more than fourteen characters,
- conforming to normal DNS host name rules: Only lower-case letters,
- digits, and hyphens; must begin and end with lower-case letter or
- digit.
-
- In some cases, the Application Protocol Name merely names and refers
- to the on-the-wire message format and semantics being used. FTP is
- "ftp", IPP printing is "ipp", and so on.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 17]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- However, it is common to "borrow" an existing protocol and repurpose
- it for a new task. This is entirely sensible and sound engineering
- practice, but that doesn't mean that the new protocol is providing
- the same semantic service as the old one, even if it borrows the same
- message formats. For example, the local network music playing
- protocol implemented by iTunes on Macintosh and Windows is little
- more than "HTTP GET" commands. However, that does *not* mean that it
- is sensible or useful to try to access one of these music servers by
- connecting to it with a standard web browser. Consequently, the
- DNS-SD service advertised (and browsed for) by iTunes is "_daap._tcp"
- (Digital Audio Access Protocol), not "_http._tcp". Advertising
- "_http._tcp" service would cause iTunes servers to show up in
- conventional Web browsers (Safari, Camino, OmniWeb, Opera, Netscape,
- Internet Explorer, etc.) which is little use since it offers no pages
- containing human-readable content. Similarly, browsing for
- "_http._tcp" service would cause iTunes to find generic web servers,
- such as the embedded web servers in devices like printers, which is
- little use since printers generally don't have much music to offer.
-
- Similarly, NFS is built on top of SUN RPC, but that doesn't mean it
- makes sense for an NFS server to advertise that it provides "SUN RPC"
- service. Likewise, Microsoft SMB file service is built on top of
- Netbios running over IP, but that doesn't mean it makes sense for an
- SMB file server to advertise that it provides "Netbios-over-IP"
- service. The DNS-SD name of a service needs to encapsulate both the
- "what" (semantics) and the "how" (protocol implementation) of the
- service, since knowledge of both is necessary for a client to
- usefully use the service. Merely advertising that a service was built
- on top of SUN RPC is no use if the client has no idea what the
- service actually does.
-
- Another common mistake is to assume that the service type advertised
- by iTunes should be "_daap._http._tcp." This is also incorrect. Part
- of the confusion here is that the presence of "_tcp" or "_udp" in the
- <Service> portion of a Service Instance Name has led people to assume
- that the structure of a service name has to reflect the internal
- structure of how the protocol was implemented. This is not correct.
-
- The "_tcp" or "_udp" should be regarded as little more than
- boilerplate text, and care should be taken not to attach too much
- importance to it. Some might argue that the "_tcp" or "_udp" should
- not be there at all, but this format is defined by RFC 2782, and
- that's not going to change. In addition, the presence of "_tcp" has
- the useful side-effect that it provides a convenient delegation point
- to hand off control to a different DNS server, if so desired.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 18]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-7.1 Service Name Length Limits
-
- As described above, application protocol names are allowed to be up
- to fourteen characters long. The reason for this limit is to leave
- as many bytes of the domain name as possible available for use
- by both the network administrator (choosing service domain names)
- and the end user (choosing instance names).
-
- A domain name may be up to 255 bytes long, including the final
- terminating root label at the end. Domain names used by DNS-SD
- take the following forms:
-
- <Instance>.<app>._tcp.<servicedomain>.<parentdomain>.
- <sub>._sub.<app>._tcp.<servicedomain>.<parentdomain>.
-
- The first example shows a service instance name, i.e. the name of the
- service's SRV and TXT records. The second shows a subtype browsing
- name, i.e. the name of a PTR record pointing to service instance
- names.
-
- The instance name <Instance> may be up to 63 bytes. Including the
- length byte used by the DNS format when the name is stored in a
- packet, that makes 64 bytes.
-
- When using subtypes, the subtype identifier is allowed to be up to
- 63 bytes, plus the length byte, making 64. Including the "_sub"
- and its length byte, this makes 69 bytes.
-
- The application protocol name <app> may be up to 14 bytes, plus the
- underscore and length byte, making 16. Including the "_udp" or "_tcp"
- and its length byte, this makes 21 bytes.
-
- Typically, DNS-SD service records are placed into subdomains of their
- own beneath a company's existing domain name. Since these subdomains
- are intended to be accessed through graphical user interfaces, not
- typed on a command-line they are frequently long and descriptive.
- Including the length byte, the user-visible service domain may be up
- to 64 bytes.
-
- The terminating root label at the end counts as one byte.
-
- Of our available 255 bytes, we have now accounted for 69+21+64+1 =
- 155 bytes. This leaves 100 bytes to accommodate the organization's
- existing domain name <parentdomain>. When used with Multicast DNS,
- <parentdomain> is "local", which easily fits. When used with parent
- domains of 100 bytes or less, the full functionality of DNS-SD is
- available without restriction. When used with parent domains longer
- than 100 bytes, the protocol risks exceeding the maximum possible
- length of domain names, causing failures. In this case, careful
- choice of short <servicedomain> names can help avoid overflows. If
- the <servicedomain> and <parentdomain> are too long, then service
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 19]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- instances with long instance names will not be discoverable or
- resolvable, and applications making use of long subtype names may
- fail.
-
- Because of this constraint, we choose to limit Application Protocol
- Names to 14 characters or less. Allowing more characters would not
- add to the expressive power of the protocol, and would needlessly
- lower the limit on the maximum <parentdomain> length that may be
- safely used.
-
-
-8. Selective Instance Enumeration
-
- This document does not attempt to define an arbitrary query language
- for service discovery, nor do we believe one is necessary.
-
- However, there are some circumstances where narrowing the list of
- results may be useful. A Web browser client that is able to retrieve
- HTML documents via HTTP and display them may also be able to retrieve
- HTML documents via FTP and display them, but only in the case of FTP
- servers that allow anonymous login. For that Web browser, discovering
- all FTP servers on the network is not useful. The Web browser only
- wants to discover FTP servers that it is able to talk to. In this
- case, a subtype of "_ftp._tcp" could be defined. Instead of issuing a
- query for "_ftp._tcp.<Domain>", the Web browser issues a query for
- "_anon._sub._ftp._tcp.<Domain>", where "_anon" is a defined subtype
- of "_ftp._tcp". The response to this query only includes the names of
- SRV records for FTP servers that are willing to allow anonymous
- login.
-
- Note that the FTP server's Service Instance Name is unchanged -- it
- is still something of the form "The Server._ftp._tcp.example.com."
- The subdomain in which FTP server SRV records are registered defines
- the namespace within which FTP server names are unique. Additional
- subtypes (e.g. "_anon") of the basic service type (e.g. "_ftp._tcp")
- serve to narrow the list of results, not to create more namespace.
-
- As with the TXT record name/value pairs, the list of possible
- subtypes, if any, are defined and specified separately for each basic
- service type.
-
-
-9. Flagship Naming
-
- In some cases, there may be several network protocols available which
- all perform roughly the same logical function. For example, the
- printing world has the LPR protocol, and the Internet Printing
- Protocol (IPP), both of which cause printed sheets to be emitted from
- printers in much the same way. In addition, many printer vendors send
- their own proprietary page description language (PDL) data over a TCP
- connection to TCP port 9100, herein referred to as the
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 20]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- "pdl-datastream" protocol. In an ideal world we would have only one
- network printing protocol, and it would be sufficiently good that no
- one felt a compelling need to invent a different one. However, in
- practice, multiple legacy protocols do exist, and a service discovery
- protocol has to accommodate that.
-
- Many printers implement all three printing protocols: LPR, IPP, and
- pdl-datastream. For the benefit of clients that may speak only one of
- those protocols, all three are advertised.
-
- However, some clients may implement two, or all three of those
- printing protocols. When a client looks for all three service types
- on the network, it will find three distinct services -- an LPR
- service, an IPP service, and a pdl-datastream service -- all of which
- cause printed sheets to be emitted from the same physical printer.
-
- In the case of multiple protocols like this that all perform
- effectively the same function, the client should suppress duplicate
- names and display each name only once. When the user prints to a
- given named printer, the printing client is responsible for choosing
- the protocol which will best achieve the desired effect, without, for
- example, requiring the user to make a manual choice between LPR and
- IPP.
-
- As described so far, this all works very well. However, consider some
- future printer that only supports IPP printing, and some other future
- printer that only supports pdl-datastream printing. The name spaces
- for different service types are intentionally disjoint -- it is
- acceptable and desirable to be able to have both a file server called
- "Sales Department" and a printer called "Sales Department". However,
- it is not desirable, in the common case, to have two different
- printers both called "Sales Department", just because those printers
- are implementing different protocols.
-
- To help guard against this, when there are two or more network
- protocols which perform roughly the same logical function, one of the
- protocols is declared the "flagship" of the fleet of related
- protocols. Typically the flagship protocol is the oldest and/or
- best-known protocol of the set.
-
- If a device does not implement the flagship protocol, then it instead
- creates a placeholder SRV record (priority=0, weight=0, port=0,
- target host = hostname of device) with that name. If, when it
- attempts to create this SRV record, it finds that a record with the
- same name already exists, then it knows that this name is already
- taken by some entity implementing at least one of the protocols from
- the class, and it must choose another. If no SRV record already
- exists, then the act of creating it stakes a claim to that name so
- that future devices in the same class will detect a conflict when
- they try to use it. The SRV record needs to contain the target host
- name in order for the conflict detection rules to operate. If two
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 21]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- different devices were to create placeholder SRV records both using a
- null target host name (just the root label), then the two SRV records
- would be seen to be in agreement so no conflict would be registered.
-
- By defining a common well-known flagship protocol for the class,
- future devices that may not even know about each other's protocols
- establish a common ground where they can coordinate to verify
- uniqueness of names.
-
- No PTR record is created advertising the presence of empty flagship
- SRV records, since they do not represent a real service being
- advertised.
-
-
-10. Service Type Enumeration
-
- In general, clients are not interested in finding *every* service on
- the network, just the services that the client knows how to talk to.
- (Software designers may *think* there's some value to finding *every*
- service on the network, but that's just wooly thinking.)
-
- However, for problem diagnosis and network management tools, it may
- be useful for network administrators to find the list of advertised
- service types on the network, even if those service names are just
- opaque identifiers and not particularly informative in isolation.
-
- For this reason, a special meta-query is defined. A DNS query for
- PTR records with the name "_services._dns-sd._udp.<Domain>" yields
- a list of PTR records, where the rdata of each PTR record is the
- name of a service type. A subsequent query for PTR records with
- one of those names yields a list of instances of that service type.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 22]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-11. Populating the DNS with Information
-
- How the SRV and PTR records that describe services and allow them to
- be enumerated make their way into the DNS is outside the scope of
- this document. However, it can happen easily in any of a number of
- ways, for example:
-
- On some networks, the administrator might manually enter the records
- into the name server's configuration file.
-
- A network monitoring tool could output a standard zone file to be
- read into a conventional DNS server. For example, a tool that can
- find Apple LaserWriters using AppleTalk NBP could find the list of
- printers, communicate with each one to find its IP address,
- PostScript version, installed options, etc., and then write out a DNS
- zone file describing those printers and their capabilities using DNS
- resource records. That information would then be available to DNS-SD
- clients that don't implement AppleTalk NBP, and don't want to.
-
- Future IP printers could use Dynamic DNS Update [RFC 2136] to
- automatically register their own SRV and PTR records with the DNS
- server.
-
- A printer manager device which has knowledge of printers on the
- network through some other management protocol could also use Dynamic
- DNS Update [RFC 2136].
-
- Alternatively, a printer manager device could implement enough of the
- DNS protocol that it is able to answer DNS queries directly, and
- Example Co.'s main DNS server could delegate the
- _ipp._tcp.example.com subdomain to the printer manager device.
-
- Zeroconf printers answer Multicast DNS queries on the local link
- for appropriate PTR and SRV names ending with ".local." [mDNS]
-
-
-12. Relationship to Multicast DNS
-
- DNS-Based Service Discovery is only peripherally related to Multicast
- DNS, in that the standard unicast DNS queries used by DNS-SD may also
- be performed using multicast when appropriate, which is particularly
- beneficial in Zeroconf environments [ZC].
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 23]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-13. Discovery of Browsing and Registration Domains (Domain Enumeration)
-
- One of the main reasons for DNS-Based Service Discovery is so that
- when a visiting client (e.g. a laptop computer) arrives at a new
- network, it can discover what services are available on that network
- without manual configuration. This logic that applies to discovering
- services without manual configuration also applies to discovering the
- domains in which services are registered without requiring manual
- configuration.
-
- This discovery is performed recursively, using Unicast or Multicast
- DNS. Five special RR names are reserved for this purpose:
-
- b._dns-sd._udp.<domain>.
- db._dns-sd._udp.<domain>.
- r._dns-sd._udp.<domain>.
- dr._dns-sd._udp.<domain>.
- lb._dns-sd._udp.<domain>.
-
- By performing PTR queries for these names, a client can learn,
- respectively:
-
- o A list of domains recommended for browsing
-
- o A single recommended default domain for browsing
-
- o A list of domains recommended for registering services using
- Dynamic Update
-
- o A single recommended default domain for registering services.
-
- o The final query shown yields the "legacy browsing" domain.
- Sophisticated client applications that care to present choices of
- domain to the user, use the answers learned from the previous four
- queries to discover those domains to present. In contrast, many
- current applications browse without specifying an explicit domain,
- allowing the operating system to automatically select an
- appropriate domain on their behalf. It is for this class of
- application that the "legacy browsing" query is provided, to allow
- the network administrator to communicate to the client operating
- systems which domain should be used for these applications.
-
- These domains are purely advisory. The client or user is free to
- browse and/or register services in any domains. The purpose of these
- special queries is to allow software to create a user-interface that
- displays a useful list of suggested choices to the user, from which
- they may make a suitable selection, or ignore the offered suggestions
- and manually enter their own choice.
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 24]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The <domain> part of the name may be "local" (meaning "perform the
- query using link-local multicast) or it may be learned through some
- other mechanism, such as the DHCP "Domain" option (option code 15)
- [RFC 2132] or the DHCP "Domain Search" option (option code 119)
- [RFC 3397].
-
- The <domain> part of the name may also be derived from the host's IP
- address. The host takes its IP address, and calculates the logical
- AND of that address and its subnet mask, to derive the 'base' address
- of the subnet. It then constructs the conventional DNS "reverse
- mapping" name corresponding to that base address, and uses that as
- the <domain> part of the name for the queries described above.
- For example, if a host has address 192.168.12.34, with subnet mask
- 255.255.0.0, then the 'base' address of the subnet is 192.168.0.0,
- and to discover the recommended legacy browsing domain for devices
- on this subnet, the host issues a DNS PTR query for the name
- "lb._dns-sd._udp.0.0.168.192.in-addr.arpa."
-
- Sophisticated clients may perform domain enumeration queries both in
- "local" and in one or more unicast domains, and then present the user
- with an aggregate result, combining the information received from all
- sources.
-
-
-14. DNS Additional Record Generation
-
- DNS has an efficiency feature whereby a DNS server may place
- additional records in the Additional Section of the DNS Message.
- These additional records are typically records that the client did
- not explicitly request, but the server has reasonable grounds to
- expect that the client might request them shortly.
-
- This section recommends which additional records should be generated
- to improve network efficiency for both unicast and multicast DNS-SD
- responses.
-
-
-14.1 PTR Records
-
- When including a PTR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o The SRV record(s) named in the PTR rdata.
- o The TXT record(s) named in the PTR rdata.
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 25]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-14.2 SRV Records
-
- When including an SVR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-14.3 TXT Records
-
- When including a TXT record in a response packet, no additional
- records are required.
-
-
-14.4 Other Record Types
-
- In response to address queries, or other record types, no additional
- records are required by this document.
-
-
-15. Comparison with Alternative Service Discovery Protocols
-
- Over the years there have been many proposed ways to do network
- service discovery with IP, but none achieved ubiquity in the
- marketplace. Certainly none has achieved anything close to the
- ubiquity of today's deployment of DNS servers, clients, and other
- infrastructure.
-
- The advantage of using DNS as the basis for service discovery is that
- it makes use of those existing servers, clients, protocols,
- infrastructure, and expertise. Existing network analyzer tools
- already know how to decode and display DNS packets for network
- debugging.
-
- For ad-hoc networks such as Zeroconf environments, peer-to-peer
- multicast protocols are appropriate. The Zeroconf host profile [ZCHP]
- requires the use of a DNS-like protocol over IP Multicast for host
- name resolution in the absence of DNS servers. Given that Zeroconf
- hosts will have to implement this Multicast-based DNS-like protocol
- anyway, it makes sense for them to also perform service discovery
- using that same Multicast-based DNS-like software, instead of also
- having to implement an entirely different service discovery protocol.
-
- In larger networks, a high volume of enterprise-wide IP multicast
- traffic may not be desirable, so any credible service discovery
- protocol intended for larger networks has to provide some facility to
- aggregate registrations and lookups at a central server (or servers)
- instead of working exclusively using multicast. This requires some
- service discovery aggregation server software to be written,
- debugged, deployed, and maintained. This also requires some service
- discovery registration protocol to be implemented and deployed for
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 26]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- clients to register with the central aggregation server. Virtually
- every company with an IP network already runs a DNS server, and DNS
- already has a dynamic registration protocol [RFC 2136]. Given that
- virtually every company already has to operate and maintain a DNS
- server anyway, it makes sense to take advantage of this instead of
- also having to learn, operate and maintain a different service
- registration server. It should be stressed again that using the same
- software and protocols doesn't necessarily mean using the same
- physical piece of hardware. The DNS-SD service discovery functions
- do not have to be provided by the same piece of hardware that
- is currently providing the company's DNS name service. The
- "_tcp.<Domain>" subdomain may be delegated to a different piece of
- hardware. However, even when the DNS-SD service is being provided by
- a different piece of hardware, it is still the same familiar DNS
- server software that is running, with the same configuration file
- syntax, the same log file format, and so forth.
-
- Service discovery needs to be able to provide appropriate security.
- DNS already has existing mechanisms for security [RFC 2535].
-
- In summary:
-
- Service discovery requires a central aggregation server.
- DNS already has one: It's called a DNS server.
-
- Service discovery requires a service registration protocol.
- DNS already has one: It's called DNS Dynamic Update.
-
- Service discovery requires a query protocol
- DNS already has one: It's called DNS.
-
- Service discovery requires security mechanisms.
- DNS already has security mechanisms: DNSSEC.
-
- Service discovery requires a multicast mode for ad-hoc networks.
- Zeroconf environments already require a multicast-based DNS-like
- name lookup protocol for mapping host names to addresses, so it
- makes sense to let one multicast-based protocol do both jobs.
-
- It makes more sense to use the existing software that every network
- needs already, instead of deploying an entire parallel system just
- for service discovery.
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 27]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-16. Real Example
-
- The following examples were prepared using standard unmodified
- nslookup and standard unmodified BIND running on GNU/Linux.
-
- Note: In real products, this information is obtained and presented to
- the user using graphical network browser software, not command-line
- tools, but if you wish you can try these examples for yourself as you
- read along, using the command-line tools already available on your
- own Unix machine.
-
-16.1 Question: What FTP servers are being advertised from dns-sd.org?
-
- nslookup -q=ptr _ftp._tcp.dns-sd.org.
- _ftp._tcp.dns-sd.org
- name = Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- _ftp._tcp.dns-sd.org
- name = Microsoft\032Developer\032Files._ftp._tcp.dns-sd.org
- _ftp._tcp.dns-sd.org
- name = Registered\032Users'\032Only._ftp._tcp.dns-sd.org
-
- Answer: There are three, called "Apple QuickTime Files",
- "Microsoft Developer Files" and "Registered Users' Only".
-
- Note that nslookup escapes spaces as "\032" for display purposes,
- but a graphical DNS-SD browser does not.
-
-16.2 Question: What FTP servers allow anonymous access?
-
- nslookup -q=ptr _anon._sub._ftp._tcp.dns-sd.org
- _anon._sub._ftp._tcp.dns-sd.org
- name = Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- _anon._sub._ftp._tcp.dns-sd.org
- name = Microsoft\032Developer\032Files._ftp._tcp.dns-sd.org
-
- Answer: Only "Apple QuickTime Files" and "Microsoft Developer Files"
- allow anonymous access.
-
-16.3 Question: How do I access "Apple QuickTime Files"?
-
- nslookup -q=any "Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org."
- Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- text = "path=/quicktime"
- Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- priority = 0, weight = 0, port= 21 host = ftp.apple.com
- ftp.apple.com internet address = 17.254.0.27
- ftp.apple.com internet address = 17.254.0.31
- ftp.apple.com internet address = 17.254.0.26
-
- Answer: You need to connect to ftp.apple.com, port 21, path
- "/quicktime". The addresses for ftp.apple.com are also given.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 28]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-17. IPv6 Considerations
-
- IPv6 has no significant differences, except that the address of the
- SRV record's target host is given by the appropriate IPv6 address
- records instead of the IPv4 "A" record.
-
-
-18. Security Considerations
-
- DNSSEC [RFC 2535] should be used where the authenticity of
- information is important. Since DNS-SD is just a naming and usage
- convention for records in the existing DNS system, it has no specific
- additional security requirements over and above those that already
- apply to DNS queries and DNS updates.
-
-
-19. IANA Considerations
-
- This protocol builds on DNS SRV records [RFC 2782], and similarly
- requires IANA to assign unique application protocol names.
- Unfortunately, the "IANA Considerations" section of RFC 2782 says
- simply, "The IANA has assigned RR type value 33 to the SRV RR.
- No other IANA services are required by this document."
- Due to this oversight, IANA is currently prevented from carrying
- out the necessary function of assigning these unique identifiers.
-
- This document proposes the following IANA allocation policy for
- unique application protocol names:
-
- Allowable names:
- * Must be no more than fourteen characters long
- * Must consist only of:
- - lower-case letters 'a' - 'z'
- - digits '0' - '9'
- - the hyphen character '-'
- * Must begin and end with a lower-case letter or digit.
- * Must not already be assigned to some other protocol in the
- existing IANA "list of assigned application protocol names
- and port numbers" [ports].
-
- These identifiers are allocated on a First Come First Served basis.
- In the event of abuse (e.g. automated mass registrations, etc.),
- the policy may be changed without notice to Expert Review [RFC 2434].
-
- The textual nature of service/protocol names means that there are
- almost infinitely many more of them available than the finite set of
- 65535 possible port numbers. This means that developers can produce
- experimental implementations using unregistered service names with
- little chance of accidental collision, providing service names are
- chosen with appropriate care. However, this document strongly
- advocates that on or before the date a product ships, developers
- should properly register their service names.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 29]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- Some developers have expressed concern that publicly registering
- their service names (and port numbers today) with IANA before a
- product ships may give away clues about that product to competitors.
- For this reason, IANA should consider allowing service name
- applications to remain secret for some period of time, much as US
- patent applications remain secret for two years after the date of
- filing.
-
- This proposed IANA allocation policy is not in force until this
- document is published as an RFC. In the meantime, unique application
- protocol names may be registered according to the instructions at
- <http://www.dns-sd.org/ServiceTypes.html>. As of January 2004, there
- are roughly 100 application protocols in currently shipping products
- that have been so registered as using DNS-SD for service discovery.
-
-
-20. Acknowledgments
-
- The concepts described in this document have been explored, developed
- and implemented with help from Richard Brown, Erik Guttman, Paul
- Vixie, and Bill Woodcock.
-
- Special thanks go to Bob Bradley, Josh Graessley, Scott Herscher,
- Roger Pantos and Kiren Sekar for their significant contributions.
-
-
-21. Copyright
-
- Copyright (C) The Internet Society 2005.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 30]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-22. Normative References
-
- [ports] IANA list of assigned application protocol names and port
- numbers <http://www.iana.org/assignments/port-numbers>
-
- [RFC 1033] Lottor, M., "Domain Administrators Operations Guide",
- RFC 1033, November 1987.
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
- [RFC 2782] Gulbrandsen, A., et al., "A DNS RR for specifying the
- location of services (DNS SRV)", RFC 2782, February 2000.
-
-
-23. Informative References
-
- [mDNS] Cheshire, S., and M. Krochmal, "Multicast DNS",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-multicastdns-05.txt, June 2005.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-04.txt, June 2005.
-
- [RFC 2132] Alexander, S., and Droms, R., "DHCP Options and BOOTP
- Vendor Extensions", RFC 2132, March 1997.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2434] Narten, T., and H. Alvestrand, "Guidelines for Writing
- an IANA Considerations Section in RFCs", RFC 2434,
- October 1998.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 31]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [RFC 3007] Wellington, B., et al., "Secure Domain Name System (DNS)
- Dynamic Update", RFC 3007, November 2000.
-
- [RFC 3397] Aboba, B., and Cheshire, S., "Dynamic Host Configuration
- Protocol (DHCP) Domain Search Option", RFC 3397, November
- 2002.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
- [ZCHP] Guttman, E., "Zeroconf Host Profile Applicability
- Statement", Internet-Draft (work in progress),
- draft-ietf-zeroconf-host-prof-01.txt, July 2001.
-
-
-24. Authors' Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 32]
diff --git a/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-03.txt b/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-03.txt
deleted file mode 100644
index f9505d9..0000000
--- a/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-03.txt
+++ /dev/null
@@ -1,2494 +0,0 @@
-Document: draft-cheshire-dnsext-multicastdns-03.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 29th July 2004 Marc Krochmal
- Apple Computer, Inc.
- 29th January 2003
-
- Multicast DNS
-
- <draft-cheshire-dnsext-multicastdns-03.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- As networked devices become smaller, more portable, and more
- ubiquitous, the ability to operate with less configured
- infrastructure is increasingly important. In particular, the ability
- to look up DNS resource record data types (including, but not limited
- to, host names) in the absence of a conventional managed DNS server,
- is becoming essential.
-
- Multicast DNS (mDNS) provides the ability to do DNS-like operations
- on the local link in the absense of any conventional unicast DNS
- server. In addition, mDNS designates a portion of the DNS namespace
- to be free for local use, without the need to pay any annual fee, and
- without the need to set up delegations or otherwise configure a
- conventional DNS server to answer for those names.
-
- The primary benefits of mDNS names are that (i) they require little
- or no administration or configuration to set them up, (ii) they work
- when no infrastructure is present, and (iii) they work during
- infrastructure failures.
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 1]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-Table of Contents
-
- 1. Introduction...................................................3
- 2. Conventions and Terminology Used in this Document..............4
- 3. Multicast DNS Names............................................4
- 4. IP TTL Checks..................................................8
- 5. Reverse Address Mapping........................................8
- 6. Querying.......................................................9
- 7. Duplicate Suppression.........................................13
- 8. Responding....................................................15
- 9. Probing and Announcing on Startup.............................17
- 10. Conflict Resolution...........................................21
- 11. Special Characteristics of Multicast DNS Domains..............23
- 12. Multicast DNS for Service Discovery...........................24
- 13. Resource Record TTL Values and Cache Coherency................25
- 14. Enabling and Disabling Multicast DNS..........................30
- 15. Considerations for Multiple Interfaces........................30
- 16. Multicast DNS and Power Management............................31
- 17. Multicast DNS Character Set...................................32
- 18. Multicast DNS Message Size....................................33
- 19. Multicast DNS Message Format..................................33
- 20. Choice of UDP Port Number.....................................36
- 21. Summary of Differences Between Multicast DNS and Unicast DNS..37
- 22. Benefits of Multicast Responses...............................38
- 23. IPv6 Considerations...........................................39
- 24. Security Considerations.......................................40
- 25. IANA Considerations...........................................41
- 26. Acknowledgements..............................................41
- 27. Copyright.....................................................41
- 28. Normative References..........................................42
- 29. Informative References........................................42
- 30. Author's Addresses............................................43
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 2]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-1. Introduction
-
- When reading this document, familiarity with the concepts of Zero
- Configuration Networking [ZC] and automatic link-local addressing
- [v4LL] [RFC 2462] is helpful.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, or resource record types.
- This document simply discusses what needs to happen if DNS clients
- start sending DNS queries to a multicast address, and how a
- collection of hosts can cooperate to collectively answer those
- queries in a useful manner.
-
- There has been discussion of how much burden Multicast DNS might
- impose on a network. It should be remembered that whenever IPv4 hosts
- communicate, they broadcast ARP packets on the network on a regular
- basis, and this is not disastrous. The approximate amount of
- multicast traffic generated by hosts making conventional use of
- Multicast DNS is anticipated to be roughly the same order of
- magnitude as the amount of broadcast ARP traffic those hosts already
- generate.
-
- New applications making new use of Multicast DNS capabilities for
- unconventional purposes may generate more traffic. If some of those
- new applications are "chatty", then work will be needed to help them
- become less chatty. When performing any analysis, it is important to
- make a distinction between the application behavior and the
- underlying protocol behavior. If a chatty application uses UDP, that
- doesn't mean that UDP is chatty, or that IP is chatty, or that
- Ethernet is chatty. What it means is that the application is chatty.
- The same applies to any future applications that may decide to layer
- increasing portions of their functionality over Multicast DNS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 3]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
- This document uses the term "host name" in the strict sense to mean a
- fully qualified domain name that has an address record. It does not
- use the term "host name" in the commonly used but incorrect sense to
- mean just the first DNS label of a host's fully qualified domain
- name.
-
- A DNS (or mDNS) packet contains an IP TTL in the IP header, which
- is effectively a hop-count limit for the packet, to guard against
- routing loops. Each Resource Record also contains a TTL, which is
- the number of seconds for which the Resource Record may be cached.
-
- In any place where there may be potential confusion between these two
- types of TTL, the term "IP TTL" is used to refer to the IP header TTL
- (hop limit), and the term "RR TTL" is used to refer to the Resource
- Record TTL (cache lifetime).
-
- When this document uses the term "Multicast DNS", it should be taken
- to mean: Clients performing DNS-like queries for DNS-like resource
- records by sending DNS-like UDP query and response packets over IP
- Multicast to UDP port 5353."
-
-
-3. Multicast DNS Names
-
- This document proposes that the DNS top-level domain ".local." be
- designated a special domain with special semantics, namely that any
- fully-qualified name ending in ".local." is link-local, and names
- within this domain are meaningful only on the link where they
- originate. This is analogous to IPv4 addresses in the 169.254/16
- prefix, which are link-local and meaningful only on the link where
- they originate.
-
- Any DNS query for a name ending with ".local." MUST be sent
- to the mDNS multicast address (224.0.0.251 or its IPv6 equivalent
- FF02::FB).
-
- It is unimportant whether a name ending with ".local." occurred
- because the user explicitly typed in a fully qualified domain name
- ending in ".local.", or because the user entered an unqualified
- domain name and the host software appended the suffix ".local."
- because that suffix appears in the user's search list. The ".local."
- suffix could appear in the search list because the user manually
- configured it, or because it was received in a DHCP option, or via
- any other valid mechanism for configuring the DNS search list. In
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 4]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- this respect the ".local." suffix is treated no differently to any
- other search domain that might appear in the DNS search list.
-
- DNS queries for names that do not end with ".local." MAY be sent to
- the mDNS multicast address, if no other conventional DNS server is
- available. This can allow hosts on the same link to continue
- communicating using each other's globally unique DNS names during
- network outages which disrupt communication with the greater
- Internet. When resolving global names via local multicast, it is even
- more important to use DNSSEC or other security mechanisms to ensure
- that the response is trustworthy. Resolving global names via local
- multicast is a contentious issue, and this document does not discuss
- it in detail, instead concentrating on the issue of resolving local
- names using DNS packets sent to a multicast address.
-
- A host which belongs to an organization or individual who has control
- over some portion of the DNS namespace can be assigned a globally
- unique name within that portion of the DNS namespace, for example,
- "cheshire.apple.com." For those of us who have this luxury, this
- works very well. However, the majority of home customers do not have
- easy access to any portion of the global DNS namespace within which
- they have the authority to create names as they wish. This leaves the
- majority of home computers effectively anonymous for practical
- purposes.
-
- To remedy this problem, this document allows any computer user to
- elect to give their computers link-local Multicast DNS host names of
- the form: "single-dns-label.local." For example, my Titanium
- PowerBook laptop computer answers to the name "sctibook.local." Any
- computer user is granted the authority to name their computer this
- way, providing that the chosen host name is not already in use on
- that link. Having named their computer this way, the user has the
- authority to continue using that name until such time as a name
- conflict occurs on the link which is not resolved in the user's
- favour. If this happens, the computer (or its human user) SHOULD
- cease using the name, and may choose to attempt to allocate a new
- unique name for use on that link. Like law suits over global DNS
- names, these conflicts are expected to be relatively rare for people
- who choose reasonably imaginative names, but it is still important
- to have a mechanism in place to handle them when they happen.
-
- The point made in the previous paragraph is very important and bears
- repeating. It is easy for those of us in the IETF community who run
- our own name servers at home to forget that the majority of computer
- users do not run their own name server and have no easy way to create
- their own host names. When these users wish to transfer files between
- two laptop computers, they are frequently reduced to typing in
- dotted-decimal IP addresses because they simply have no other way for
- one host to refer to the other by name. This is a sorry state of
- affairs. What is worse, most users don't even bother trying to use
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 5]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- dotted-decimal IP addresses. Most users still move data between
- machines by copying it onto a floppy disk or similar removable media.
-
- In a world of gigabit Ethernet and ubiquitous wireless networking it
- is a sad indictment of the networking community that the preferred
- communication medium for most computer users is still the floppy
- disk.
-
- Allowing ad-hoc allocation of single-label names in a single flat
- ".local." namespace may seem to invite chaos. However, operational
- experience with AppleTalk NBP names, which on any given link are also
- effectively single-label names in a flat namespace, shows that in
- practice name collisions happen extremely rarely and are not a
- problem. Groups of computer users from disparate organizations bring
- Macintosh laptop computers to events such as IETF Meetings, the Mac
- Hack conference, the Apple World Wide Developer Conference, etc., and
- complaints at these events about users suffering conflicts and being
- forced to rename their machines have never been an issue.
-
- Enforcing uniqueness of host names (i.e. the names of DNS address
- records mapping names to IP addresses) is probably desirable in the
- common case, but this document does not mandate that. It is
- permissible for a collection of coordinated hosts to agree to
- maintain multiple DNS address records with the same name, possibly
- for load balancing or fault-tolerance reasons. This document does not
- take a position on whether that is sensible. It is important that
- both modes of operation are supported. The Multicast DNS protocol
- allows hosts to verify and maintain unique names for resource records
- where that behaviour is desired, and it also allows hosts to maintain
- multiple resource records with a single shared name where that
- behaviour is desired. This consideration applies to all resource
- records, not just address records (host names). In summary: It is
- required that the protocol have the ability to detect and handle name
- conflicts, but it is not required that this ability be used for every
- record.
-
-
-3.1 Governing Standards Body
-
- Note that this use of the ".local." suffix falls under IETF
- jurisdiction, not ICANN jurisdiction. DNS is an IETF network
- protocol, governed by protocol rules defined by the IETF. These IETF
- protocol rules dictate character set, maximum name length, packet
- format, etc. ICANN determines additional rules that apply when the
- IETF's DNS protocol is used on the public Internet. In contrast,
- private uses of the DNS protocol on isolated private networks are not
- governed by ICANN. Since this proposed change is a change to the core
- DNS protocol rules, it affects everyone, not just those machines
- using the ICANN-governed Internet. Hence this change falls into the
- category of an IETF protocol rule, not an ICANN usage rule.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 6]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-3.2 Private DNS Namespaces
-
- Note also that the special treatment of names ending in ".local." has
- been implemented in Macintosh computers since the days of Mac OS 9,
- and continues today in Mac OS X. There are also implementations for
- Linux and other platforms [dotlocal]. Operators setting up private
- internal networks ("intranets") are advised that their lives may be
- easier if they avoid using the suffix ".local." in names in their
- private internal DNS server. Alternative possibilities include:
-
- .intranet
- .internal
- .private
- .corp
- .home
-
- Another alternative naming scheme, advocated by Professor D. J.
- Bernstein, is to use a numerical suffix, such as ".6." [djbdl].
-
-
-3.3 Maximum Multicast DNS Name Length
-
- RFC 1034 says:
-
- "the total number of octets that represent a domain name (i.e.,
- the sum of all label octets and label lengths) is limited to 255."
-
- This text implies that the final root label at the end of every name
- is included in this count (a name can't be represented without it),
- but the text does not explicitly state that. Implementations of
- Multicast DNS MUST include the label length byte of the final root
- label at the end of every name when enforcing the rule that no name
- may be longer than 255 bytes. For example, the length of the name
- "apple.com." is considered to be 11, which is the number of bytes it
- takes to represent that name in a packet without using name
- compression:
-
- ------------------------------------------------------
- | 0x05 | a | p | p | l | e | 0x03 | c | o | m | 0x00 |
- ------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 7]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-4. IP TTL Checks
-
- All Multicast DNS responses (including responses sent via unicast)
- MUST be sent with IP TTL set to 255.
-
- A host sending Multicast DNS queries to a link-local destination
- address (including the 224.0.0.251 link-local multicast address) MUST
- verify that the IP TTL in response packets is 255, and silently
- discard any response packets where the IP TTL is not 255. Without
- this check, it could be possible for remote rogue hosts to send
- spoof answer packets (perhaps unicast to the victim host) which the
- receiving machine could misinterpret as having originated on the
- local link.
-
- The authors have heard complaints that some older network stack
- implementations do not implement the IP_RECVTTL socket option
- (or equivalent API) for obtaining the IP TTL of received packets.
- This is unfortunate, and these old network stacks would benefit
- from adding this API support so that they may benefit from this
- enhanced protection against spoof packets arriving from off-link.
-
- Note that Multicast DNS Responders SHOULD NOT discard queries with
- TTLs other than 255. There may be valid future applications of
- Multicast DNS where hosts issue unicast queries directed at Multicast
- DNS Responders more than one hop away, if Multicast DNS Responders
- were to discard queries where the TTL is not 255, they would not
- answer these queries.
-
-
-5. Reverse Address Mapping
-
- Like ".local.", the IPv4 and IPv6 reverse-mapping domains are also
- defined to be link-local.
-
- Any DNS query for a name ending with "254.169.in-addr.arpa." MUST
- be sent to the mDNS multicast address 224.0.0.251. Since names under
- this domain correspond to IPv4 link-local addresses, it is logical
- that the local link is the best place to find information pertaining
- to those names. As an optimization, these queries MAY be first
- unicast directly to the address in question, but if this query is not
- answered, the query MUST also be sent via multicast, to accommodate
- the case where the machine in question is not answering for itself
- (for example, because it is currently sleeping).
-
- Likewise, any DNS query for a name ending with "0.8.e.f.ip6.arpa."
- MUST be sent to the IPv6 mDNS link-local multicast address FF02::FB,
- with or without an optional initial query unicast directly to the
- address in question.
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 8]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-6. Querying
-
- There are three kinds of Multicast DNS Queries, one-shot queries of
- the kind made by today's conventional DNS clients, one-shot queries
- accumulating multiple responses made by multicast-aware DNS clients,
- and continuous ongoing Multicast DNS Queries used by IP network
- browser software.
-
- A Multicast DNS Responder that is offering records that are intended
- to be unique on the local link MUST also implement a Multicast DNS
- Querier so that it can first verify the uniqueness of those records
- before it begins answering queries for them.
-
-
-6.1 One-Shot Queries
-
- An unsophisticated DNS client may simply send its DNS queries
- blindly to the 224.0.0.251 multicast address, without necessarily
- even being aware what a multicast address is.
-
- Such an unsophisticated DNS client may not get ideal behaviour. Such
- a client may simply take the first response it receives and fail to
- wait to see if there are more, but in many instances this may not be
- a serious problem. If a user types "http://stu.local." into their Web
- browser and gets to see the page they were hoping for, then the
- protocol has met the user's needs in this case.
-
-
-6.2 One-Shot Queries, Accumulating Multiple Responses
-
- A more sophisticated DNS client should understand that Multicast DNS
- is not exactly the same as unicast DNS, and should modify its
- behaviour in some simple ways.
-
- As described above, there are some cases, such as looking up the
- address associated with a unique host name, where a single response
- is sufficient, and moreover may be all that is expected. However,
- there are other DNS queries where more than one response is
- possible, and for these queries a more sophisticated Multicast DNS
- client should include the ability to wait for an appropriate period
- of time to collect multiple responses.
-
- A naive DNS client retransmits its query only so long as it has
- received no response. A more sophisticated Multicast DNS client is
- aware that having received one response is not necessarily an
- indication that it might not receive others, and has the ability to
- retransmit its query an appropriate number of times at appropriate
- intervals until it is satisfied with the collection of responses it
- has gathered.
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 9]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- A more sophisticated Multicast DNS client that is retransmitting
- a query for which it has already received some responses, MUST
- implement Known Answer Suppression, as described below in Section
- 7.1. This indicates to responders who have already replied that their
- responses have been received, and they don't need to send them again
- in response to this repeated query. In addition, the interval between
- the first two queries MUST be at least one second, and the
- intervals between subsequent queries MUST double.
-
-
-6.3 Continuous Querying
-
- In One-Shot Queries, with either a single or multiple responses,
- the underlying assumption is that the transaction begins when the
- application issues a query, and ends when all the desired responses
- have been received. There is another type of operation which is more
- akin to continuous monitoring.
-
- Macintosh users are accustomed to opening the "Chooser" window,
- selecting a desired printer, and then closing the Chooser window.
- However, when the desired printer does not appear in the list, the
- user will typically leave the "Chooser" window open while they go and
- check to verify that the printer is plugged in, powered on, connected
- to the Ethernet, etc. While the user jiggles the wires, hits the
- Ethernet hub, and so forth, they keep an eye on the Chooser window,
- and when the printer name appears, they know they have fixed whatever
- the problem was. This can be a useful and intuitive troubleshooting
- technique, but a user who goes home for the weekend leaving the
- Chooser window open places a non-trivial burden on the network.
-
- With continuous querying, multiple queries are sent over a long
- period of time, until the user terminates the operation. It is
- important that an IP network browser window displaying live
- information from the network using Multicast DNS, if left running for
- an extended period of time, should generate significantly less
- multicast traffic on the network than the old AppleTalk Chooser.
- Therefore, the interval between the first two queries MUST be at
- least one second, the intervals between subsequent queries MUST
- double, and the querier MUST implement Known Answer Suppression, as
- described below in Section 7.1.
-
- When a Multicast DNS Querier receives an answer, the answer contains
- a TTL value that indicates for how many seconds this answer is valid.
- After this interval has passed, the answer will no longer be valid
- and should be deleted from the cache. Before this time is reached, a
- Multicast DNS Querier with an ongoing interest in that record SHOULD
- re-issue its query to determine whether the record is still valid,
- and if so update its expiry time.
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 10]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- To perform this cache maintenance, a Multicast DNS Querier should
- plan to issue a query at 80% of the record lifetime, and then if no
- answer is received, at 85%, 90% and 95%. If an answer is received,
- then the remaining TTL is reset to the value given in the answer, and
- this process repeats for as long as the Multicast DNS Querier has an
- ongoing interest in the record. If after four queries no answer is
- received, the record is deleted when it reaches 100% of its lifetime.
-
- To avoid the case where multiple Multicast DNS Queriers on a network
- all issue their queries simultaneously, a random variation of 2% of
- the record TTL should be added, so that queries are scheduled to be
- performed at 80-82%, 85-87%, 90-92% and then 95-97% of the TTL.
-
-
-6.4 Multiple Questions per Query
-
- Multicast DNS allows a querier to place multiple questions in the
- question section of a single Multicast DNS query packet.
-
- The semantics of a Multicast DNS query packet containing multiple
- questions is identical to a series of individual DNS query packets
- containing one question each. Combining multiple questions into a
- single packet is purely an efficiency optimization, and has no other
- semantic significance.
-
- A useful technique for adaptively combining multiple questions into a
- single query is to use a Nagle-style algorithm: When a client issues
- its first question, a Query packet is immediately built and sent,
- without delay. If the client then continues issuing a rapid series of
- questions they are held until either the first query receives at
- least one answer, or 100ms has passed, or there are enough questions
- to fill the question section of a Multicast DNS query packet. At this
- time, all the held questions are placed into a Multicast DNS query
- packet and sent.
-
-
-6.5 Questions Requesting Unicast Responses
-
- Sending Multicast DNS responses via multicast has the benefit that
- all the other hosts on the network get to see those responses, and
- can keep their caches up to date, and detect conflicting responses.
-
- However, there are situations where all the other hosts on the
- network don't need to see every response. One example is a laptop
- computer waking from sleep. At that instant it is a brand new
- participant on a new network. Its Multicast DNS cache is empty, and
- it has no knowledge of its surroundings. It may have a significant
- number of queries that it wants answered right away to discover
- information about its new surroundings and present that information
- to the user. As a new participant on the network, it has no idea
- whether the exact same questions may have been asked and answered
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 11]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- just seconds ago. In this case, trigging a large sudden flood of
- multicast responses may impose an unreasonable burden on the network.
- To avoid this, the Multicast DNS Querier SHOULD set the top bit in
- the class field of its DNS question(s), to indicate that it is
- willing to accept unicast responses instead of the usual multicast
- responses. These questions requesting unicast responses are referred
- to as "QU" questions, to distinguish them from the more usual
- questions requesting multicast responses ("QM" questions).
-
- When retransmitting a question more than once, the 'unicast response'
- bit SHOULD be set only for the first question of the series. After
- the first question has received its responses, the querier should
- have a large known-answer list (see "Known Answer Suppression" below)
- so that subsequent queries should elicit few, if any, further
- responses. Reverting to multicast responses as soon as possible is
- important because of the benefits that multicast responses provide
- (see "Benefits of Multicast Responses" below).
-
- When receiving a question with the 'unicast response' bit set, a
- responder SHOULD usually respond with a unicast packet directed back
- to the querier. If the responder has not multicast that record
- recently (within one quarter of its TTL), then the responder SHOULD
- instead multicast the response so as to keep all the peer caches up
- to date, and to permit passive conflict detection.
-
-
-6.6 Suppressing Initial Query
-
- If a query is issued for which there already exist one or more
- records in the local cache, and those record(s) were received with
- the cache flush bit set, indicating that they form a unique RRSet,
- then the host SHOULD suppress its initial "QU" query, and proceed to
- issue a "QM" query. To avoid the situation where a group of hosts
- are synchronized by some external event and all perform the same
- query simultaneously, a host suppressing its initial "QU" query
- SHOULD impose a random delay from 500-1000ms before transmitting its
- first "QM" query for this question. This means that when the first
- host (selected randomly by this algorithm) transmits its "QM" query,
- all the other hosts that were about to transmit the same query can
- suppress their superfluous query, as described in "Duplicate
- Question Suppression" below.
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 12]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-7. Duplicate Suppression
-
- A variety of techniques are used to reduce the amount of redundant
- traffic on the network.
-
-
-7.1 Known Answer Suppression
-
- When a Multicast DNS Querier sends a query to which it already knows
- some answers, it populates the Answer Section of the DNS message with
- those answers.
-
- A Multicast DNS Responder SHOULD NOT answer a Multicast DNS Query if
- the answer it would give is already included in the Answer Section
- with an RR TTL at least half the correct value. If the RR TTL of the
- answer as given in the Answer Section is less than half of the true
- RR TTL as known by the Multicast DNS Responder, the responder MUST
- send an answer so as to update the Querier's cache before the record
- becomes in danger of expiration.
-
- Because a Multicast DNS Responder will respond if the remaining TTL
- given in the known answer list is less than half the true TTL, it is
- superfluous for the Querier to include such records in the known
- answer list. Therefore a Multicast DNS Querier SHOULD NOT include
- records in the known answer list whose remaining TTL is less than
- half their original TTL. Doing so would simply consume space in the
- packet without achieving the goal of suppressing responses, and would
- therefore be a pointless waste of network bandwidth.
-
- A Multicast DNS Querier MUST NOT cache resource records observed in
- the Known Answer Section of other Multicast DNS Queries. The Answer
- Section of Multicast DNS Queries is not authoritative. By placing
- information in the Answer Section of a Multicast DNS Query the
- querier is stating that it *believes* the information to be true.
- It is not asserting that the information *is* true. Some of those
- records may have come from other hosts that are no longer on the
- network. Propagating that stale information to other Multicast DNS
- Queriers on the network would not be helpful.
-
-
-7.2 Multi-Packet Known Answer Suppression
-
- Sometimes a Multicast DNS Querier will already have too many answers
- to fit in the Known Answer section of its query packets. In this
- case, it should issue a Multicast DNS Query containing a question and
- as many Known Answer records as will fit. It should then set the TC
- (Truncated) bit in the header before sending the Query. It should
- then immediately follow the packet with another query containing no
- questions, and as many more Known Answer records as will fit. If
- there are still too many records remaining to fit in the packet, it
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 13]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- again sets the TC bit and continues until all the Known Answer
- records have been sent.
-
- A Multicast DNS Responder seeing a Multicast DNS Query with the TC
- bit set defers its response for a time period randomly selected in
- the interval 20-120ms. This gives the Multicast DNS Querier time to
- send additional Known Answer packets before the Responder responds.
- If the Responder sees any of its answers listed in the Known Answer
- lists of subsequent packets from the querying host, it should delete
- that answer from the list of answers it is planning to give, provided
- that no other host on the network is also waiting to receive the same
- answer record.
-
-
-7.3 Duplicate Question Suppression
-
- If a host is planning to send a query, and it sees another host on
- the network send a query containing the same question, and the Known
- Answer section of that query does not contain any records which this
- host would not also put in its own Known Answer section, then this
- host should treat its own query as having been sent. When multiple
- clients on the network are querying for the same resource records,
- there is no need for them to all be repeatedly asking the same
- question.
-
-
-7.4 Duplicate Answer Suppression
-
- If a host is planning to send an answer, and it sees another host on
- the network send a response packet containing the same answer record,
- and the TTL in that record is not less than the TTL this host would
- have given, then this host should treat its own answer as having been
- sent. When multiple responders on the network have the same data,
- there is no need for all of them to respond.
-
- This feature is particularly useful when multiple Sleep Proxy Servers
- are deployed (see Section 16. "Multicast DNS and Power Management").
- In the future it is possible that every general-purpose OS (Mac,
- Windows, Linux, etc.) will implement Sleep Proxy Service as a matter
- of course. In this case there could be a large number of Sleep Proxy
- Servers on any given network, which is good for reliability and
- fault-tolerance, but would be bad for the network if every Sleep
- Proxy Server were to answer every query.
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 14]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-8. Responding
-
- A Multicast DNS Responder MUST only respond when it has a positive
- non-null response to send. Error responses must never be sent. The
- non-existence of any name in a Multicast DNS Domain is ascertained by
- the failure of any machine to respond to the Multicast DNS query, not
- by NXDOMAIN errors.
-
- Multicast DNS Responses MUST NOT contain any questions in the
- Question Section. Any questions in the Question Section of a received
- Multicast DNS Response MUST be silently ignored. Multicast DNS
- Queriers receiving Multicast DNS Responses do not care what question
- elicited the response; they care only that the information in the
- response is true and accurate.
-
- A Multicast DNS Responder on Ethernet [IEEE802] and similar shared
- multiple access networks SHOULD delay its responses by a random
- amount of time selected with uniform random distribution in the range
- 20-120ms. If multiple Multicast DNS Responders were all to respond
- immediately to a particular query, a collision would be virtually
- guaranteed. By imposing a small random delay, the number of
- collisions is dramatically reduced. 120ms is a short enough time that
- it is almost imperceptible to a human user, but long enough to
- significantly reduce the risk of Ethernet collisions. On a full-sized
- Ethernet using the maximum cable lengths allowed and the maximum
- number of repeaters allowed, an Ethernet frame is vulnerable to
- collisions during the transmission of its first 256 bits. On 10Mb/s
- Ethernet, this equates to a vulnerable time window of 25.6us.
-
- In the case where a Multicast DNS Responder has good reason to
- believe that it will be the only responder on the link with a
- positive non-null response, it SHOULD NOT impose the random delay
- before responding, and SHOULD normally generate its response within
- 10ms. To do this safely, it MUST have previously verified that the
- requested name, type and class in the DNS query are unique on this
- link. Responding immediately without delay is appropriate for things
- like looking up the address record for a particular host name, when
- the host name has been previously verified unique. Responding
- immediately without delay is *not* appropriate for things like
- looking up PTR records used for DNS Service Discovery [DNS-SD], where
- a large number of responses may be anticipated.
-
- Except when a unicast reply has been explicitly requested via the
- "unicast reply" bit, Multicast DNS Responses MUST be sent to UDP port
- 5353 (the well-known port assigned to mDNS) on the 224.0.0.251
- multicast address (or its IPv6 equivalent FF02::FB). Operating in a
- Zeroconf environment requires constant vigilance. Just because a name
- has been previously verified unique does not mean it will continue to
- be so indefinitely. By allowing all Multicast DNS Responders to
- constantly monitor their peers' responses, conflicts arising out of
- network topology changes can be promptly detected and resolved.
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 15]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- Sending all responses by multicast also facilitates opportunistic
- caching by other hosts on the network.
-
- To protect the network against excessive packet flooding due to
- software bugs or malicious attack, a Multicast DNS Responder MUST NOT
- multicast a given record on a given interface if it has previously
- multicast that record on that interface within the last second. A
- legitimate client on the network should have seen the previous
- transmission and cached it. A client that did not receive and cache
- the previous transmission will retry its request and receive a
- subsequent response. Under no circumstances is there any legitimate
- reason for a Multicast DNS Responder to multicast a given record more
- than once per second on any given interface.
-
-
-8.1 Legacy Unicast Responses
-
- If the source UDP port in a received Multicast DNS Query is not port
- 5353, this indicates that the client originating the query is a
- simple client that does not fully implement all of Multicast DNS. In
- this case, the Multicast DNS Responder MUST send a UDP response
- directly back to the client, via unicast, to the query packet's
- source IP address and port. This unicast response MUST be a
- conventional unicast response as would be generated by a conventional
- unicast DNS server; for example, it must repeat the query ID and the
- question given in the query packet.
-
- The resource record TTL given in a unicast response SHOULD NOT be
- greater than ten seconds, even if the true TTL of the Multicast DNS
- resource record is higher. This is because Multicast DNS Responders
- that fully participate in the protocol use the cache coherency
- mechanisms described in Section 13 to update and invalidate stale
- data. Were unicast responses sent to legacy clients to use the same
- high TTLs, these legacy clients, which do not implement these cache
- coherency mechanisms, could retain stale cached resource record data
- long after it is no longer valid.
-
- Having sent this unicast response, if the Responder has not sent this
- record in any multicast response recently, it SHOULD schedule the
- record to be sent via multicast as well, to facilitate passive
- conflict detection. "Recently" in this context means "if the time
- since the record was last sent via multicast is less than one quarter
- of the record's TTL".
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 16]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-8.2 Multi-Question Queries
-
- Multicast DNS Responders MUST correctly handle DNS query packets
- containing more than one question, by answering any or all of the
- questions to which they have answers. Any answers generated
- in response to query packets containing more than one question
- MUST be randomly delayed in the range 20-120ms, as described above.
-
-
-8.3 Response Aggregation
-
- Having delayed one or more multicast responses by 20-120ms as
- described above in Section 8 "Responding", a Multicast DNS Responder
- SHOULD, for the sake of network efficiency, aggregate as many of its
- pending responses as possible into a single Multicast DNS response
- packet.
-
-
-9. Probing and Announcing on Startup
-
- Typically a Multicast DNS Responder should have, at the very least,
- address records for all of its active interfaces. Creating and
- advertising an HINFO record on each interface as well can be useful
- to network administrators.
-
- Whenever a Multicast DNS Responder starts up, wakes up from sleep,
- receives an indication of an Ethernet "Link Change" event, or has any
- other reason to believe that its network connectivity may have
- changed in some relevant way, it MUST perform the two startup steps
- below.
-
-
-9.1 Probing
-
- The first startup step is that for all those resource records that a
- Multicast DNS Responder desires to be unique on the local link, it
- MUST send a Multicast DNS Query asking for those resource records, to
- see if any of them are already in use. The primary example of this is
- its address record which maps its unique host name to its unique IP
- address. All Probe Queries SHOULD be done using the desired resource
- record name and query type T_ANY (255), to elicit answers for all
- types of records with that name. This allows a single question to be
- used in place of several questions, which is more efficient on the
- network. It also allows a host to verify exclusive ownership of a
- name, which is desirable in most cases. It would be confusing, for
- example, if one host owned the "A" record for "myhost.local.", but a
- different host owned the HINFO record for that name.
-
- The ability to place more than one question in a Multicast DNS Query
- is useful here, because it can allow a host to use a single packet
- for all of its resource records instead of needing a separate packet
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 17]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- for each. For example, a host can simultaneously probe for uniqueness
- of its "A" record and all its SRV records [DNS-SD] in the same query
- packet.
-
- When ready to send its mDNS probe packet(s) the host should first
- wait for a short random delay time, uniformly distributed in the
- range 0-250ms. This random delay is to guard against the case where a
- group of devices are powered on simultaneously, or a group of devices
- are connected to an Ethernet hub which is then powered on, or some
- other external event happens that might cause a group of hosts to all
- send synchronized probes.
-
- 250ms after the first query the host should send a second, then
- 250ms after that a third. If, by 250ms after the third probe, no
- conflicting Multicast DNS responses have been received, the host may
- move to the next step, announcing.
-
- If any conflicting Multicast DNS responses are received, then the
- probing host MUST defer to the existing host, and must choose new
- names for some or all of its resource records as appropriate, to
- avoid conflict with pre-existing hosts on the network. In the case
- of a host probing using query type T_ANY as recommended above, any
- answer containing a record with that name, of any type, MUST be
- considered a conflicting response and handled accordingly.
-
- If ten failures occur within any ten-second period, then the host
- MUST wait at least five seconds before each successive additional
- probe attempt. This is to help ensure that in the event of software
- bugs or other unanticipated problems, errant hosts do not flood the
- network with a continuous stream of multicast traffic. For very
- simple devices, a valid way to comply with this requirement is to
- always wait five seconds after any failed probe attempt.
-
-
-9.2 Simultaneous Probe Tie-Breaking
-
- The astute reader will observe that there is a race condition
- inherent in the previous description. If two hosts are probing for
- the same name simultaneously, neither will receive any response to
- the probe, and the hosts could incorrectly conclude that they may
- both proceed to use the name. To break this symmetry, each host
- populates the Authority Section of its queries with records giving
- the rdata that it would be proposing to use, should its probing be
- successful. The Authority Section is being used here in a way
- analogous to the Update section of a DNS Update packet [RFC 2136].
-
- When a host that is probing for a record sees another host issue a
- query for the same record, it consults the Authority Section of that
- query. If it finds any resource record there which answers the query,
- then it compares the data of that resource record with its own
- tentative data. The lexicographically later data wins. This means
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 18]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- that if the host finds that its own data is lexicographically later,
- it simply ignores the other host's probe. If the host finds that its
- own data is lexicographically earlier, then it treats this exactly
- as if it had received a positive answer to its query, and concludes
- that it may not use the desired name.
-
- The determination of 'lexicographically later' is performed by first
- comparing the record class, then the record type, then raw comparison
- of the binary content of the rdata without regard for meaning or
- structure. If the record classes differ, then the numerically greater
- class is considered 'lexicographically later'. Otherwise, if the
- record types differ, then the numerically greater type is considered
- 'lexicographically later'. If the type and class both match then the
- rdata is compared.
-
- In the case of resource records containing rdata that is subject to
- name compression, the names must be uncompressed before comparison.
- (The details of how a particular name is compressed is an artifact of
- how and where the record is written into the DNS message; it is not
- an intrinsic property of the resource record itself.)
-
- The bytes of the raw uncompressed rdata are compared in turn,
- interpreting the bytes as eight-bit UNSIGNED values, until a byte
- is found whose value is greater than that of its counterpart (in
- which case the rdata whose byte has the greater value is deemed
- lexicographically later) or one of the resource records runs out
- of rdata (in which case the resource record which still has
- remaining data first is deemed lexicographically later).
-
- The following is an example of a conflict:
-
- sctibook.local. A 196.254.100.200
- sctibook.local. A 196.254.200.100
-
- In this case 196.254.200.100 is lexicographically later, so it is
- deemed the winner.
-
- Note that it is vital that the bytes are interpreted as UNSIGNED
- values, or the wrong outcome may result. In the example above, if
- the byte with value 200 had been incorrectly interpreted as a
- signed value then it would be interpreted as value -56, and the
- wrong address record would be deemed the winner.
-
-
-9.3 Announcing
-
- The second startup step is that the Multicast DNS Responder MUST send
- a gratuitous Multicast DNS Response containing, in the Answer
- Section, all of its resource records. If there are too many resource
- records to fit in a single packet, multiple packets should be used.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 19]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- In the case of shared records (e.g. the PTR records used by DNS
- Service Discovery [DNS-SD]), the records are simply placed as-is
- into the answer section of the DNS Response.
-
- In the case of records that have been verified to be unique in the
- previous step, they are placed into the answer section of the DNS
- Response with the most significant bit of the rrclass set to one. The
- most significant bit of the rrclass is the mDNS "cache flush" bit and
- is discussed in more detail below in Section 13.3 "Announcements to
- Flush Outdated Cache Entries".
-
- The Multicast DNS Responder MUST send at least two gratuitous
- responses, one second apart. A Responder MAY send up to ten
- gratuitous Responses, providing that the interval between gratuitous
- responses doubles with every response sent.
-
- A Multicast DNS Responder SHOULD NOT continue sending gratuitous
- Responses for longer than the TTL of the record. The purpose of
- announcing new records via gratuitous Responses is to ensure that
- peer caches are up to date. After a time interval equal to the TTL of
- the record has passed, it is very likely that old stale copies of
- that record in peer caches will have expired naturally, so subsequent
- announcements serve little purpose.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the conflict MUST be resolved as described below in "Conflict
- Resolution".
-
- A Multicast DNS Responder MUST NOT send announcements in the absence
- of information that its network connectivity may have changed in some
- relevant way. In particular, a Multicast DNS Responder MUST NOT send
- regular periodic announcements as a matter of course.
-
-
-9.4 Updating
-
- At any time, if the rdata of any of a host's Multicast DNS records
- changes, the host MUST repeat the Announcing step described above to
- update neighbouring caches. For example, if any of a host's IP
- addresses change, it must re-announce those address records.
-
- A host may update the contents of any of its records at any time,
- though a host SHOULD NOT update records more frequently than ten
- times per minute. Frequent rapid updates impose a burden on the
- network. If a host has information to disseminate which changes more
- frequently than ten times per minute, then Multicast DNS may not be
- the appropriate protocol to disseminate that information.
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 20]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-10. Conflict Resolution
-
- A conflict occurs when two resource records with the same name, type
- and class have inconsistent rdata. What may be considered
- inconsistent is context sensitive, except that resource records with
- identical rdata are never considered inconsistent, even if they
- originate from different hosts. A common example of a resource record
- type that is intended to be unique, not shared between hosts, is the
- address record that maps a host's name to its IP address. Should a
- host witness another host announce an address record with the same
- name but a different IP address, then that is considered
- inconsistent, and that address record is considered to be in
- conflict.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the Multicast DNS Responder MUST immediately reset that
- record to probing state, and go through the startup steps described
- above in Section 9. "Probing and Announcing on Startup". The
- protocol used in the Probing phase will determine a winner and a
- loser, and the loser must cease using the name, and reconfigure.
-
- It is very important that any host that observes an apparent conflict
- MUST take action. In the case of two hosts using the same host name,
- where one has been configured to require a unique host name and the
- other has not, the one that has not been configured to require a
- unique host name will not perceive any conflict, and will not take
- any action. By reverting to Probing state, the host that desires a
- unique host name will go through the necessary steps to ensure that a
- unique host is obtained.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 21]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- The recommended course of action after probing and failing is as
- follows:
-
- o Programmatically change the resource record name in an attempt to
- find a new name that is unique. This could be done by adding some
- further identifying information (e.g. the model name of the
- hardware) if it is not already present in the name, appending the
- digit "2" to the name, or incrementing a number at the end of the
- name if one is already present.
-
- o Probe again, and repeat until a unique name is found.
-
- o Record this newly chosen name in persistent storage so that the
- device will use the same name the next time it is power-cycled.
-
- o Display a message to the user or operator informing them of the
- name change. For example:
-
- The name "Bob's Music" is in use by another iTunes music
- server on the network. Your music has been renamed to
- "Bob's Music (G4 Cube)". If you want to change this name,
- use [describe appropriate menu item or preference dialog].
-
- How the user or operator is informed depends on context. A desktop
- computer with a screen might put up a dialog box. A headless server
- in the closet may write a message to a log file, or use whatever
- mechanism (email, SNMP trap, etc.) it uses to inform the
- administrator of other error conditions. On the other hand a headless
- server in the closet may not inform the user at all -- if the user
- cares, they will notice the name has changed, and connect to the
- server in the usual way (e.g. via Web Browser) to configure a new
- name.
-
- The examples in this section focus on address records (i.e. host
- names), but the same considerations apply to all resource records
- where uniqueness (or maintenance of some other defined constraint) is
- desired.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 22]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-11. Special Characteristics of Multicast DNS Domains
-
- Unlike conventional DNS names, names that end in ".local.",
- "254.169.in-addr.arpa." or "0.8.e.f.ip6.arpa." have only local
- significance. Conventional DNS seeks to provide a single unified
- namespace, where a given DNS query yields the same answer no matter
- where on the planet it is performed or to which recursive DNS server
- the query is sent. (However, split views, firewalls, intranets and
- the like have somewhat interfered with this goal of DNS representing
- a single universal truth.) In contrast, each IP link has its own
- private ".local.", "254.169.in-addr.arpa." and "0.8.e.f.ip6.arpa."
- namespaces, and the answer to any query for a name within those
- domains depends on where that query is asked.
-
- Multicast DNS Domains are not delegated from their parent domain via
- use of NS records. There are no NS records anywhere in Multicast DNS
- Domains. Instead, all Multicast DNS Domains are delegated to the IP
- addresses 224.0.0.251 and FF02::FB by virtue of the individual
- organizations producing DNS client software deciding how to handle
- those names. It would be extremely valuable for the industry if this
- special handling were ratified and recorded by IANA, since otherwise
- the special handling provided by each vendor is likely to be
- inconsistent.
-
- The IPv4 name server for a Multicast DNS Domain is 224.0.0.251. The
- IPv6 name server for a Multicast DNS Domain is FF02::FB. These are
- multicast addresses; therefore they identify not a single host but a
- collection of hosts, working in cooperation to maintain some
- reasonable facsimile of a competently managed DNS zone. Conceptually
- a Multicast DNS Domain is a single DNS zone, however its server is
- implemented as a distributed process running on a cluster of loosely
- cooperating CPUs rather than as a single process running on a single
- CPU.
-
- No delegation is performed within Multicast DNS Domains. Because the
- cluster of loosely coordinated CPUs is cooperating to administer a
- single zone, delegation is neither necessary nor desirable. Just
- because a particular host on the network may answer queries for a
- particular record type with the name "example.local." does not imply
- anything about whether that host will answer for the name
- "child.example.local.", or indeed for other record types with the
- name "example.local."
-
- Multicast DNS Zones have no SOA record. A conventional DNS zone's
- SOA record contains information such as the email address of the zone
- administrator and the monotonically increasing serial number of the
- last zone modification. There is no single human administrator for
- any given Multicast DNS Zone, so there is no email address. Because
- the hosts managing any given Multicast DNS Zone are only loosely
- coordinated, there is no readily available monotonically increasing
- serial number to determine whether or not the zone contents have
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 23]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- changed. A host holding part of the shared zone could crash or be
- disconnected from the network at any time without informing the other
- hosts. There is no reliable way to provide a zone serial number that
- would, whenever such a crash or disconnection occurred, immediately
- change to indicate that the contents of the shared zone had changed.
-
- Zone transfers are not possible for any Multicast DNS Zone.
-
-
-12. Multicast DNS for Service Discovery
-
- This document does not describe using Multicast DNS for network
- browsing or service discovery. However, the mechanisms this document
- describes are compatible with (and support) the browsing and service
- discovery mechanisms proposed in "DNS-Based Service Discovery"
- [DNS-SD].
-
- This document places few limitations on what DNS record types may be
- looked up using local multicast. One particular kind of Multicast DNS
- query that might be useful is a query for the SRV record named
- "_domain._udp.local.", yielding the port number and IP address of a
- conventional DNS server willing to perform general recursive DNS
- lookups. This could solve a particular problem facing the IPv6
- community, which is that IPv6 is able to self-configure almost all of
- the information it needs to operate [RFC 2462], except for the
- address of the DNS server. Bringing in all of the mechanisms of DHCP
- just for that one little additional piece of information is not an
- attractive solution. Using DNS-format messages and DNS-format
- resource records to find the address of the DNS server has an elegant
- self-sufficiency about it. Any host that needs to know the address of
- the DNS server must already have code to generate and parse DNS
- packets, so using that same code and those same packets to find the
- DNS server in the first place is a simple self-reliant solution that
- avoids taking external dependencies on other protocols.
-
-
-13. Resource Record TTL Values and Cache Coherency
-
- The recommended TTL value for Multicast DNS resource records is
- 120 minutes.
-
- A client with an active outstanding query will issue a query packet
- when one or more of the resource record(s) in its cache is (are) 80%
- of the way to expiry. If the TTL on those records is 120 minutes,
- this ongoing cache maintenance process yields a steady-state query
- rate of one query every 96 minutes.
-
- Any distributed cache needs a cache coherency protocol. If Multicast
- DNS resource records follow the recommendation and have a TTL of 120
- minutes, that means that stale data could persist in the system for
- up to two hours. Making the default TTL significantly lower would
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 24]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- reduce the lifetime of stale data, but would produce too much extra
- traffic on the network. Various techniques are available to minimize
- the impact of such stale data.
-
-
-13.1 Cooperating Multicast DNS Responders
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, but different rdata, then:
-
- o If A's resource record is intended to be a shared resource record,
- then this is no conflict, and no action is required.
-
- o If A's resource record is intended to be a unique resource record
- then this is a conflict and MUST be handled as described in Section
- 10 "Conflict Resolution".
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, and identical rdata, then:
-
- o If the TTL of B's resource record given in the packet is at least
- half the true TTL from A's point of view, then no action is
- required.
-
- o If the TTL of B's resource record given in the packet is less than
- half the true TTL from A's point of view, then A MUST mark its
- record to be announced via multicast. Clients receiving the record
- from B would use the TTL given by B, and hence may delete the
- record sooner than A expects. By sending its own multicast response
- correcting the TTL, A ensures that the record will be retained for
- the desired time.
-
- These rules allow multiple Multicast DNS Responders to offer the same
- data on the network (perhaps for fault tolerance reasons) without
- conflicting with each other.
-
-
-13.2 Goodbye Packets
-
- In the case where a host knows that certain resource record data is
- about to become invalid (for example when the host is undergoing a
- clean shutdown) the host SHOULD send a gratuitous announcement mDNS
- response packet, giving the same resource record name, type, class
- and rdata, but an RR TTL of zero. This has the effect of updating the
- TTL stored in neighbouring hosts' cache entries to zero, causing that
- cache entry to be promptly deleted.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 25]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- Clients receiving a Multicast DNS Response with a TTL of zero SHOULD
- NOT immediately delete the record from the cache, but instead record
- a TTL of 1 and then delete the record one second later. In the case
- of multiple Multicast DNS Responders on the network described in
- Section 13.1 above, if one of the Responders shuts down and
- incorrectly sends goodbye packets for its records, it gives the other
- cooperating Responders one second to send out their own response to
- "rescue" the records before they expire and are deleted.
-
- Generally speaking, it is more important to send goodbye packets for
- shared records than unique records. A given shared record name (such
- as a PTR record used for DNS Service Discovery [DNS-SD]) by its
- nature often has many representatives from many different hosts, and
- tends to be the subject of long-lived ongoing queries. Those
- long-lived queries are often concerned not just about being informed
- when records appear, but also about being informed if those records
- vanish again. In contrast, a unique record set (such as an SRV
- record, or a host address record), by its nature, often has far fewer
- members than a shared record set, and is usually the subject of
- one-shot queries which simply retrieve the data and then cease
- querying once they have the answer they are seeking. Therefore,
- sending a goodbye packet for a unique record set is likely to offer
- less benefit, because it is likely at any given moment that no one
- has an active query running for that record set. One example where
- goodbye packets for SRV and address records are useful is when
- transferring control to a Sleep Proxy Server (see Section 16.
- "Multicast DNS and Power Management").
-
-
-13.3 Announcements to Flush Outdated Cache Entries
-
- Whenever a host has a resource record with potentially new data (e.g.
- after rebooting, waking from sleep, connecting to a new network link,
- changing IP address, etc.), the host MUST send a series of gratuitous
- announcements to update cache entries in its neighbour hosts. In
- these gratuitous announcements, if the record is one that is intended
- to be unique, the host sets the most significant bit of the rrclass
- field of the resource record. This bit, the "cache flush" bit, tells
- neighbouring hosts that this is not a shared record type. Instead of
- merging this new record additively into the cache in addition to any
- previous records with the same name, type and class, all old records
- with that name, type and class that were received more than one
- second ago are declared invalid, and marked to expire from the cache
- in one second.
-
- The semantics of the cache flush bit are as follows: Normally when a
- resource record appears in the answer section of the DNS Response, it
- means, "This is an assertion that this information is true." When a
- resource record appears in the answer section of the DNS Response
- with the "cache flush" bit set, it means, "This is an assertion that
- this information is the truth and the whole truth, and anything you
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 26]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- may have heard more than a second ago regarding records of this
- name/type/class is no longer valid".
-
- To accommodate the case where the set of records from one host
- constituting a single unique RRSet is too large to fit in a single
- packet, only cache records that are more than one second old are
- flushed. This allows the announcing host to generate a quick burst of
- packets back-to-back on the wire containing all the members
- of the RRSet. When receiving records with the "cache flush" bit set,
- all records older than one second are marked to be deleted one second
- in the future. One second after the end of the little packet burst,
- any records not represented within that packet burst will then be
- expired from all peer caches.
-
- Any time a host sends a response packet containing some members of a
- unique RRSet, it SHOULD send the entire RRSet, preferably in a single
- packet, or if the entire RRSet will not fit in a single packet, in a
- quick burst of packets sent as close together as possible. The host
- SHOULD set the cache flush bit on all members of the unique RRSet.
- In the event that for some reason the host chooses not to send the
- entire unique RRSet in a single packet or a rapid packet burst,
- it MUST NOT set the cache flush bit on any of those records.
-
- The reason for waiting one second before deleting stale records from
- the cache is to accommodate bridged networks. For example, a host's
- address record announcement on a wireless interface may be bridged
- onto a wired Ethernet, and cause that same host's Ethernet address
- records to be flushed from peer caches. The one-second delay gives
- the host the chance to see its own announcement arrive on the wired
- Ethernet, and immediately re-announce its Ethernet address records
- so that both sets remain valid and live in peer caches.
-
- These rules apply regardless of *why* the response packet is being
- generated. They apply to startup announcements as described in
- Section 9.3, and to responses generated as a result of receiving
- query packets.
-
- The "cache flush" bit is only set in Multicast DNS responses sent to
- UDP port 5353. The "cache flush" bit MUST NOT be set in any resource
- records in a response packet sent in legacy unicast responses to UDP
- ports other than 5353.
-
- The "cache flush" bit MUST NOT be set in any resource records in the
- known-answer list of any query packet.
-
- The "cache flush" bit MUST NOT ever be set in any shared resource
- record. To do so would cause all the other shared versions of this
- resource record with different rdata from different Responders to be
- immediately deleted from all the caches on the network.
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 27]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- Note that the "cache flush" bit is NOT part of the resource record
- class. The "cache flush" bit is the most significant bit of the
- second 16-bit word of a resource record in an mDNS packet (the field
- conventionally referred to as the rrclass field), and the actual
- resource record class is the least-significant fifteen bits of this
- field. There is no mDNS resource record class 0x8001. The value
- 0x8001 in the rrclass field of a resource record in an mDNS response
- packet indicates a resource record with class 1, with the "cache
- flush" bit set. When receiving a resource record with the "cache
- flush" bit set, implementations should take care to mask off that bit
- before storing the resource record in memory.
-
-
-13.4 Cache Flush on Topology change
-
- If the hardware on a given host is able to indicate physical changes
- of connectivity, then when the hardware indicates such a change, the
- host should take this information into account in its mDNS cache
- management strategy. For example, a host may choose to immediately
- flush all cache records received on a particular interface when that
- cable is disconnected. Alternatively, a host may choose to adjust the
- remaining TTL on all those records to a few seconds so that if the
- cable is not reconnected quickly, those records will expire from the
- cache.
-
- Likewise, when a host reboots, or wakes from sleep, or undergoes some
- other similar discontinuous state change, the cache management
- strategy should take that information into account.
-
-
-13.5 Cache Flush on Failure Indication
-
- Sometimes a cache record can be determined to be stale when a client
- attempts to use the rdata it contains, and finds that rdata to be
- incorrect.
-
- For example, the rdata in an address record can be determined to be
- incorrect if attempts to contact that host fail, either because
- ARP/ND requests for that address go unanswered (for an address on a
- local subnet) or because a router returns an ICMP "Host Unreachable"
- error (for an address on a remote subnet).
-
- The rdata in an SRV record can be determined to be incorrect if
- attempts to communicate with the indicated service at the host and
- port number indicated are not successful.
-
- The rdata in a DNS-SD PTR record can be determined to be incorrect if
- attempts to look up the SRV record it references are not successful.
-
- In any such case, the software implementing the mDNS resource record
- cache should provide a mechanism so that clients detecting stale
- rdata can inform the cache.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 28]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- When the cache receives this hint that it should reconfirm some
- record, it MUST issue two or more queries for the resource record in
- question. If no response is received in a reasonable amount of time,
- then, even though its TTL may indicate that it is not yet due to
- expire, that record SHOULD be promptly flushed from the cache.
-
- The end result of this is that if a printer suffers a sudden power
- failure or other abrupt disconnection from the network, its name may
- continue to appear in DNS-SD browser lists displayed on users'
- screens. Eventually that entry will expire from the cache naturally,
- but if a user tries to access the printer before that happens, the
- failure to successfully contact the printer will trigger the more
- hasty demise of its cache entries. This is a sensible trade-off
- between good user-experience and good network efficiency. If we were
- to insist that printers should disappear from the printer list within
- 30 seconds of becoming unavailable, for all failure modes, the only
- way to achieve this would be for the client to poll the printer at
- least every 30 seconds, or for the printer to announce its presence
- at least every 30 seconds, both of which would be an unreasonable
- burden on most networks.
-
-
-13.6 Passive Observation of Failures
-
- A host observes the multicast queries issued by the other hosts on
- the network. One of the major benefits of also sending responses
- using multicast is that it allows all hosts to see the responses (or
- lack thereof) to those queries.
-
- If a host sees queries, for which a record in its cache would be
- expected to be given as an answer in a multicast response, but no
- such answer is seen, then the host may take this as an indication
- that the record may no longer be valid.
-
- After seeing two or more of these queries, and seeing no multicast
- response containing the expected answer within a reasonable amount of
- time, then even though its TTL may indicate that it is not yet due to
- expire, that record MAY be flushed from the cache. The host SHOULD
- NOT perform its own queries to re-confirm that the record is truly
- gone. If every host on a large network were to do this, it would
- cause a lot of unnecessary multicast traffic. If host A sends
- multicast queries that remain unanswered, then there is no reason to
- suppose that host B or any other host is likely to be any more
- successful.
-
- The previous section, "Cache Flush on Failure Indication", describes
- a situation where a user trying to print discovers that the printer
- is no longer available. By implementing the passive observation
- described here, when one user fails to contact the printer, all hosts
- on the network observe that failure and update their caches
- accordingly.
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 29]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-14. Enabling and Disabling Multicast DNS
-
- The option to fail-over to Multicast DNS for names not ending in
- ".local." SHOULD be a user-configured option, and SHOULD
- be disabled by default because of the possible security issues
- related to unintended local resolution of apparently global names.
-
- The option to lookup unqualified (relative) names by appending
- ".local." (or not) is controlled by whether ".local." appears
- (or not) in the client's DNS search list.
-
- No special control is needed for enabling and disabling Multicast DNS
- for names explicitly ending with ".local." as entered by the user.
- The user doesn't need a way to disable Multicast DNS for names ending
- with ".local.", because if the user doesn't want to use Multicast
- DNS, they can achieve this by simply not using those names. If a user
- *does* enter a name ending in ".local.", then we can safely assume
- the user's intention was probably that it should work. Having user
- configuration options that can be (intentionally or unintentionally)
- set so that local names don't work is just one more way of
- frustrating the user's ability to perform the tasks they want,
- perpetuating the view that, "IP networking is too complicated to
- configure and too hard to use." This in turn perpetuates the
- continued use of protocols like AppleTalk. If we want to retire
- AppleTalk, NetBIOS, etc., we need to offer users equivalent IP
- functionality that they can rely on to, "always work, like
- AppleTalk." A little Multicast DNS traffic may be a burden on the
- network, but it is an insignificant burden compared to continued
- widespread use of AppleTalk.
-
-
-15. Considerations for Multiple Interfaces
-
- A host should defend its host name (FQDN) on all active interfaces on
- which it is answering Multicast DNS queries.
-
- In the event of a name conflict on *any* interface, a host should
- configure a new host name, if it wishes to maintain uniqueness of its
- host name.
-
- When answering a Multicast DNS query, a multi-homed host with a
- link-local address (or addresses) should take care to ensure that
- any address going out in a Multicast DNS response is valid for use
- on the interface on which the response is going out.
-
- Just as the same link-local IP address may validly be in use
- simultaneously on different links by different hosts, the same
- link-local host name may validly be in use simultaneously on
- different links, and this is not an error. A multi-homed host with
- connections to two different links may be able to communicate with
- two different hosts that are validly using the same name. While this
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 30]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- kind of name duplication should be rare, it means that a host that
- wants to fully support this case needs network programming APIs that
- allow applications to specify on what interface to perform a
- link-local Multicast DNS query, and to discover on what interface a
- Multicast DNS response was received.
-
-
-16. Multicast DNS and Power Management
-
- Many modern network devices have the ability to go into a low-power
- mode where only a small part of the Ethernet hardware remains
- powered, and the device can be woken up by sending a specially
- formatted Ethernet frame which the device's power-management hardware
- recognizes.
-
- To make use of this in conjunction with Multicast DNS, the device
- first uses DNS-SD to determine if Sleep Proxy Service is available on
- the local network. In some networks there may be more than one piece
- of hardware implementing Sleep Proxy Service, for fault-tolerance
- reasons.
-
- If the device finds the network has Sleep Proxy Service, the device
- transmits two or more gratuitous mDNS announcements setting the TTL
- of its relevant resource records to zero, to delete them from
- neighbouring caches. The relevant resource records include address
- records and SRV records, and other resource records as may apply to a
- particular device. The device then communicates all of its remaining
- active records, plus the names, types and classes of the deleted
- records, to the Sleep Proxy Service(s), along with a copy of the
- specific "magic packet" required to wake the device up.
-
- When a Sleep Proxy Service sees an mDNS query for one of the
- device's active records (e.g. a DNS-SD PTR record), it answers on
- behalf of the device without waking it up. When a Sleep Proxy Service
- sees an mDNS query for one of the device's deleted resource
- records, it deduces that some client on the network needs to make an
- active connection to the device, and sends the specified "magic
- packet" to wake the device up. The device then wakes up, reactivates
- its deleted resource records, and re-announces them to the network.
- The client waiting to connect sees the announcements, learns the
- current IP address and port number of the desired service on the
- device, and proceeds to connect to it.
-
- The connecting client does not need to be aware of how Sleep Proxy
- Service works. Only devices that implement low power mode and wish to
- make use of Sleep Proxy Service need to be aware of how that protocol
- works.
-
- The reason that a device using a Sleep Proxy Service should send more
- than one goodbye packet is that the wakeup message is caused by the
- Sleep Proxy Service seeing queries for the device's SRV and/or
- address records, and those queries are in turn caused by the records
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 31]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- being absent from peer caches. If the records are not deleted from
- peer caches, then those peers may use the cached value directly
- without querying, and no wakeup message would be generated.
-
- The full specification of mDNS / DNS-SD Sleep Proxy Service
- is described in another document [not yet published].
-
-
-17. Multicast DNS Character Set
-
- Unicast DNS has been plagued by the lack of any support for non-US
- characters. Indeed, conventional DNS is usually limited to just
- letters, digits and hyphens, with no spaces or other punctuation.
- Attempts to remedy this have made slow progress because of the need
- to accommodate old buggy legacy implementations.
-
- Multicast DNS is a new protocol and doesn't (yet) have old buggy
- legacy implementations to constrain the design choices. Accordingly,
- it adopts the obvious simple solution: all names in Multicast DNS are
- encoded using UTF-8 [RFC 2279]. For names that are restricted to
- letters, digits and hyphens, the UTF-8 encoding is identical to the
- US-ASCII encoding, so this is entirely compatible with existing host
- names. For characters outside the US-ASCII range, UTF-8 encoding is
- used.
-
- Multicast DNS implementations MUST NOT use any other encodings apart
- from UTF-8 (US-ASCII being considered a compatible subset of UTF-8).
-
- This point bears repeating: There are various baroque representations
- of international text being proposed for Unicast DNS. None of these
- representations may be used in Multicast DNS packets. Any text being
- represented internally in some other representation MUST be converted
- to canonical UTF-8 before being placed in any Multicast DNS packet.
-
- The simple rules for case-insensitivity in Unicast DNS also apply in
- Multicast DNS; that is to say, in name comparisons, the lower-case
- letters "a" to "z" match their upper-case equivalents "A" to "Z".
- Hence, if a client issues a query for an address record with the name
- "stuartcheshire.local", then a responder having an address record
- with the name "StuartCheshire.local" should issue a response.
-
- No other automatic character equivalence is defined in Multicast DNS.
- For example, accented characters are not defined to be automatically
- equivalent to their unaccented counterparts. Where automatic
- equivalences are desired, this may be achieved through the use of
- programmatically-generated CNAME records. For example, if a responder
- has an address record for an accented name Y, and a client issues a
- query for a name X, where X is the same as Y with all the accents
- removed, then the responder may issue a response containing two
- resource records: A CNAME record "X CNAME Y", asserting that the
- requested name X (unaccented) is an alias for the true (accented)
- name Y, followed by the address record for Y.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 32]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-18. Multicast DNS Message Size
-
- RFC 1035 restricts DNS Messages carried by UDP to no more than 512
- bytes (not counting the IP or UDP headers). For UDP packets carried
- over the wide-area Internet in 1987, this was appropriate. For
- link-local multicast packets on today's networks, there is no reason
- to retain this restriction. Given that the packets are by definition
- link-local, there are no Path MTU issues to consider.
-
- Multicast DNS Messages carried by UDP may be up to the IP MTU of the
- physical interface, less the space required for the IP header (20
- bytes for IPv4; 40 bytes for IPv6) and the UDP header (8 bytes).
-
- In the case of a single mDNS Resource Record which is too large to
- fit in a single MTU-sized multicast response packet, a Multicast DNS
- Responder SHOULD send the Resource Record alone, in a single IP
- datagram, sent using multiple IP fragments. Resource Records this
- large SHOULD be avoided, except in the very rare cases where they
- really are the appropriate solution to the problem at hand.
- Implementers should be aware that many simple devices do not
- re-assemble fragmented IP datagrams, so large Resource Records SHOULD
- only be used in specialized cases where the implementer knows that
- all receivers implement reassembly.
-
- A Multicast DNS packet larger than the interface MTU, which is sent
- using fragments, MUST NOT contain more than one Resource Record.
-
- Even when fragmentation is used, a Multicast DNS packet, including IP
- and UDP headers, MUST NOT exceed 9000 bytes.
-
-
-19. Multicast DNS Message Format
-
- This section describes specific restrictions on the allowable
- values for the header fields of a Multicast DNS message.
-
-19.1. ID (Query Identifier)
-
- Multicast DNS clients SHOULD listen for gratuitous responses
- issued by hosts booting up (or waking up from sleep or otherwise
- joining the network). Since these gratuitous responses may contain a
- useful answer to a question for which the client is currently
- awaiting an answer, Multicast DNS clients SHOULD examine all received
- Multicast DNS response messages for useful answers, without regard to
- the contents of the ID field or the question section. In Multicast
- DNS, knowing which particular query message (if any) is responsible
- for eliciting a particular response message is less interesting than
- knowing whether the response message contains useful information.
-
- Multicast DNS clients MAY cache any or all Multicast DNS response
- messages they receive, for possible future use, providing of course
- that normal TTL aging is performed on these cashed resource records.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 33]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- In multicast query messages, the Query ID SHOULD be set to zero on
- transmission.
-
- In multicast responses, including gratuitous multicast responses, the
- Query ID MUST be set to zero on transmission, and MUST be ignored on
- reception.
-
- In unicast response messages generated specifically in response to a
- particular (unicast or multicast) query, the Query ID MUST match the
- ID from the query message.
-
-
-19.2. QR (Query/Response) Bit
-
- In query messages, MUST be zero.
-
- In response messages, MUST be one.
-
-
-19.3. OPCODE
-
- In both multicast query and multicast response messages, MUST be zero
- (only standard queries are currently supported over multicast, unless
- other queries are allowed by future IETF Standards Action).
-
-
-19.4. AA (Authoritative Answer) Bit
-
- In query messages, the Authoritative Answer bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages for Multicast Domains, the Authoritative Answer
- bit MUST be set to one (not setting this bit implies there's some
- other place where "better" information may be found) and MUST be
- ignored on reception.
-
-
-19.5. TC (Truncated) Bit
-
- In query messages, if the TC bit is set, it means that additional
- Known Answer records may be following shortly. A responder MAY choose
- to record this fact, and wait for those additional Known Answer
- records, before deciding whether to respond. If the TC bit is clear,
- it means that the querying host has no additional Known Answers.
-
- In multicast response messages, the TC bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In legacy unicast response messages, the TC bit has the same meaning
- as in conventional unicast DNS: it means that the response was too
- large to fit in a single packet, so the client SHOULD re-issue its
- query using TCP in order to receive the larger response.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 34]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-19.6. RD (Recursion Desired) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Desired bit SHOULD be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.7. RA (Recursion Available) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Available bit MUST be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.8. Z (Zero) Bit
-
- In both query and response messages, the Zero bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.9. AD (Authentic Data) Bit [RFC 2535]
-
- In query messages the Authentic Data bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages, the Authentic Data bit MAY be set. Resolvers
- receiving response messages with the AD bit set MUST NOT trust the AD
- bit unless they trust the source of the message and either have a
- secure path to it or use DNS transaction security.
-
-
-19.10. CD (Checking Disabled) Bit [RFC 2535]
-
- In query messages, a resolver willing to do cryptography SHOULD set
- the Checking Disabled bit to permit it to impose its own policies.
-
- In response messages, the Checking Disabled bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.11. RCODE (Response Code)
-
- In both multicast query and multicast response messages, the Response
- Code MUST be zero on transmission. Multicast DNS messages received
- with non-zero Response Codes MUST be silently ignored.
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 35]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-20. Choice of UDP Port Number
-
- Arguments were made for and against using Multicast on UDP port 53.
- The final decision was to use UDP port 5353. Some of the arguments
- for and against are given below.
-
-
-20.1 Arguments for using UDP port 53:
-
- * This is "just DNS", so it should be the same port.
-
- * There is less work to be done updating old clients to do simple
- mDNS queries. Only the destination address need be changed.
- In some cases, this can be achieved without any code changes,
- just by adding the address 224.0.0.251 to a configuration file.
-
-
-20.2 Arguments for using a different port (UDP port 5353):
-
- * This is not "just DNS". This is a DNS-like protocol, but different.
-
- * Changing client code to use a different port number is not hard.
-
- * Using the same port number makes it hard to run an mDNS Responder
- and a conventional unicast DNS server on the same machine. If a
- conventional unicast DNS server wishes to implement mDNS as well,
- it can still do that, by opening two sockets. Having two different
- port numbers is important to allow this flexibility.
-
- * Some VPN software hijacks all outgoing traffic to port 53 and
- redirects it to a special DNS server set up to serve those VPN
- clients while they are connected to the corporate network. It is
- questionable whether this is the right thing to do, but it is
- common, and redirecting link-local multicast DNS packets to a
- remote server rarely produces any useful results. It does mean, for
- example, that the user becomes unable to access their local network
- printer sitting on their desk right next to their computer. Using
- a different UDP port eliminates this particular problem.
-
- * On many operating systems, unprivileged clients may not send or
- receive packets on low-numbered ports. This means that any client
- sending or receiving mDNS packets on port 53 would have to run as
- "root", which is an undesirable security risk. Using a higher-
- numbered UDP port eliminates this particular problem.
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 36]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-21. Summary of Differences Between Multicast DNS and Unicast DNS
-
- The value of Multicast DNS is that it shares, as much as possible,
- the familiar APIs, naming syntax, resource record types, etc., of
- Unicast DNS. There are of course necessary differences by virtue of
- it using Multicast, and by virtue of it operating in a community of
- cooperating peers, rather than a precisely defined authoritarian
- hierarchy controlled by a strict chain of formal delegations from the
- top. These differences are listed below:
-
- Multicast DNS...
- * uses multicast
- * uses UDP port 5353 instead of port 53
- * operates in well-defined parts of the DNS namespace
- * uses UTF-8, and only UTF-8, to encode resource record names
- * defines a clear limit on the maximum legal domain name (255 bytes)
- * allows larger UDP packets
- * allows more than one question in a query packet
- * uses the Answer Section of a query to list Known Answers
- * uses the TC bit in a query to indicate additional Known Answers
- * uses the Authority Section of a query for probe tie-breaking
- * ignores the Query ID field (except for generating legacy responses)
- * doesn't require the question to be repeated in the response packet
- * uses gratuitous responses to announce new records to the peer group
- * defines a "unicast response" bit in the rrclass of query questions
- * defines a "cache flush" bit in the rrclass of responses
- * uses DNS TTL 0 to indicate that a record has been deleted
- * uses IP TTL 255 to verify that answers originated on the local link
- * monitors queries to perform Duplicate Question Suppression
- * monitors responses to perform Duplicate Answer Suppression...
- * ... and Ongoing Conflict Detection
- * ... and Opportunistic Caching
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 37]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-22. Benefits of Multicast Responses
-
- Some people have argued that sending responses via multicast is
- inefficient on the network. In fact the benefits of using multicast
- responses result in a net lowering of overall multicast traffic, for
- a variety of reasons.
-
- * One multicast response can update the cache on all machines on the
- network. If another machine later wants to issue the same query, it
- already has the answer in its cache, so it may not need to even
- transmit that multicast query on the network at all.
-
- * When more than one machine has the same ongoing long-lived query
- running, every machine does not have to transmit its own
- independent query. When one machine transmits a query, all the
- other hosts see the answers, so they can suppress their own
- queries.
-
- * When a host sees a multicast query, but does not see the
- corresponding multicast response, it can use this information to
- promptly delete stale data from its cache. To achieve the same
- level of user-interface quality and responsiveness without
- multicast responses would require lower cache lifetimes and more
- frequent network polling, resulting in a significantly higher
- packet rate.
-
- * Multicast responses allow passive conflict detection. Without this
- ability, some other conflict detection mechanism would be needed,
- imposing its own additional burden on the network.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 38]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-23. IPv6 Considerations
-
- An IPv4-only host and an IPv6-only host behave as "ships that pass in
- the night". Even if they are on the same Ethernet, neither is aware
- of the other's traffic. For this reason, each physical link may have
- *two* unrelated ".local." zones, one for IPv4 and one for IPv6.
- Since for practical purposes, a group of IPv4-only hosts and a group
- of IPv6-only hosts on the same Ethernet act as if they were on two
- entirely separate Ethernet segments, it is unsurprising that their
- use of the ".local." zone should occur exactly as it would if
- they really were on two entirely separate Ethernet segments.
-
- A dual-stack (v4/v6) host can participate in both ".local."
- zones, and should register its name(s) and perform its lookups both
- using IPv4 and IPv6. This enables it to reach, and be reached by,
- both IPv4-only and IPv6-only hosts. In effect this acts like a
- multi-homed host, with one connection to the logical "IPv4 Ethernet
- segment", and a connection to the logical "IPv6 Ethernet segment".
-
-23.1 IPv6 Multicast Addresses by Hashing
-
- Some discovery protocols use a range of multicast addresses, and
- determine the address to be used by a hash function of the name being
- sought. Queries are sent via multicast to the address as indicated by
- the hash function, and responses are returned to the querier via
- unicast. Particularly in IPv6, where multicast addresses are
- extremely plentiful, this approach is frequently advocated.
-
- There are some problems with this:
-
- * When a host has a large number of records with different names, the
- host may have to join a large number of multicast groups. This can
- place undue burden on the Ethernet hardware, which typically
- supports a limited number of multicast addresses efficiently. When
- this number is exceeded, the Ethernet hardware may have to resort
- to receiving all multicasts and passing them up to the host
- software for filtering, thereby defeating the point of using a
- multicast address range in the first place.
-
- * Multiple questions cannot be placed in one packet if they don't all
- hash to the same multicast address.
-
- * Duplicate Question Suppression doesn't work if queriers are not
- seeing each other's queries.
-
- * Duplicate Answer Suppression doesn't work if responders are not
- seeing each other's responses.
-
- * Opportunistic Caching doesn't work.
-
- * Ongoing Conflict Detection doesn't work.
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 39]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-24. Security Considerations
-
- The algorithm for detecting and resolving name conflicts is, by its
- very nature, an algorithm that assumes cooperating participants. Its
- purpose is to allow a group of hosts to arrive at a mutually disjoint
- set of host names and other DNS resource record names, in the absence
- of any central authority to coordinate this or mediate disputes. In
- the absence of any higher authority to resolve disputes, the only
- alternative is that the participants must work together cooperatively
- to arrive at a resolution.
-
- In an environment where the participants are mutually antagonistic
- and unwilling to cooperate, other mechanisms are appropriate, like
- manually administered DNS.
-
- In an environment where there is a group of cooperating participants,
- but there may be other antagonistic participants on the same physical
- link, the cooperating participants need to use IPSEC signatures
- and/or DNSSEC [RFC 2535] signatures so that they can distinguish mDNS
- messages from trusted participants (which they process as usual) from
- mDNS messages from untrusted participants (which they silently
- discard).
-
- When DNS queries for *global* DNS names are sent to the mDNS
- multicast address (during network outages which disrupt communication
- with the greater Internet) it is *especially* important to use
- DNSSEC, because the user may have the impression that he or she is
- communicating with some authentic host, when in fact he or she is
- really communicating with some local host that is merely masquerading
- as that name. This is less critical for names ending with ".local.",
- because the user should be aware that those names have only local
- significance and no global authority is implied.
-
- Most computer users neglect to type the trailing dot at the end of a
- fully qualified domain name, making it a relative domain name (e.g.
- "www.example.com"). In the event of network outage, attempts to
- positively resolve the name as entered will fail, resulting in
- application of the search list, including ".local.", if present.
- A malicious host could masquerade as "www.example.com" by answering
- the resulting Multicast DNS query for "www.example.com.local."
- To avoid this, a host MUST NOT append the search suffix
- ".local.", if present, to any relative (partially qualified)
- domain name containing two or more labels. Appending ".local." to
- single-label relative domain names is acceptable, since the user
- should have no expectation that a single-label domain name will
- resolve as-is.
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 40]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-25. IANA Considerations
-
- The IANA has allocated the IPv4 link-local multicast address
- 224.0.0.251 for the use described in this document.
-
- The IANA has allocated the IPv6 multicast address set FF0X::FB
- for the use described in this document.
-
- When this document is published, IANA should designate a list
- of domains which are deemed to have only link-local significance,
- as described in this document.
-
- No other IANA services are required by this document.
-
-
-26. Acknowledgements
-
- The concepts described in this document have been explored and
- developed with help from Erik Guttman, Paul Vixie, Bill Woodcock,
- and others.
-
-
-27. Copyright
-
- Copyright (C) The Internet Society January 2004.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 41]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-28. Normative References
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
-
-29. Informative References
-
- [dotlocal] <http://www.dotlocal.org/>
-
- [djbdl] <http://cr.yp.to/djbdns/dot-local.html>
-
- [IEEE802] IEEE Standards for Local and Metropolitan Area Networks:
- Overview and Architecture.
- Institute of Electrical and Electronic Engineers,
- IEEE Standard 802, 1990.
-
- [DNS-SD] Cheshire, S., and M. Krochmal, "DNS-Based Service
- Discovery", Internet-Draft (work in progress),
- draft-cheshire-dnsext-dns-sd-03.txt, January 2004.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2462] S. Thomson and T. Narten, "IPv6 Stateless Address
- Autoconfiguration", RFC 2462, December 1998.
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [v4LL] Cheshire, S., B. Aboba, and E. Guttman, "Dynamic
- Configuration of IPv4 Link-Local Addresses",
- Internet-Draft (work in progress),
- draft-ietf-zeroconf-ipv4-linklocal-11.txt, January 2004.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 42]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-30. Author's Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 43]
diff --git a/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-04.txt b/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-04.txt
deleted file mode 100644
index 8750583..0000000
--- a/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-04.txt
+++ /dev/null
@@ -1,2494 +0,0 @@
-Document: draft-cheshire-dnsext-multicastdns-04.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 14th August 2004 Marc Krochmal
- Apple Computer, Inc.
- 14th February 2004
-
- Multicast DNS
-
- <draft-cheshire-dnsext-multicastdns-04.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- As networked devices become smaller, more portable, and more
- ubiquitous, the ability to operate with less configured
- infrastructure is increasingly important. In particular, the ability
- to look up DNS resource record data types (including, but not limited
- to, host names) in the absence of a conventional managed DNS server,
- is becoming essential.
-
- Multicast DNS (mDNS) provides the ability to do DNS-like operations
- on the local link in the absense of any conventional unicast DNS
- server. In addition, mDNS designates a portion of the DNS namespace
- to be free for local use, without the need to pay any annual fee, and
- without the need to set up delegations or otherwise configure a
- conventional DNS server to answer for those names.
-
- The primary benefits of mDNS names are that (i) they require little
- or no administration or configuration to set them up, (ii) they work
- when no infrastructure is present, and (iii) they work during
- infrastructure failures.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 1]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-Table of Contents
-
- 1. Introduction...................................................3
- 2. Conventions and Terminology Used in this Document..............4
- 3. Multicast DNS Names............................................4
- 4. IP TTL Checks..................................................8
- 5. Reverse Address Mapping........................................8
- 6. Querying.......................................................9
- 7. Duplicate Suppression.........................................13
- 8. Responding....................................................15
- 9. Probing and Announcing on Startup.............................17
- 10. Conflict Resolution...........................................21
- 11. Special Characteristics of Multicast DNS Domains..............23
- 12. Multicast DNS for Service Discovery...........................24
- 13. Resource Record TTL Values and Cache Coherency................25
- 14. Enabling and Disabling Multicast DNS..........................30
- 15. Considerations for Multiple Interfaces........................30
- 16. Multicast DNS and Power Management............................31
- 17. Multicast DNS Character Set...................................32
- 18. Multicast DNS Message Size....................................33
- 19. Multicast DNS Message Format..................................33
- 20. Choice of UDP Port Number.....................................36
- 21. Summary of Differences Between Multicast DNS and Unicast DNS..37
- 22. Benefits of Multicast Responses...............................38
- 23. IPv6 Considerations...........................................39
- 24. Security Considerations.......................................40
- 25. IANA Considerations...........................................41
- 26. Acknowledgements..............................................41
- 27. Copyright.....................................................41
- 28. Normative References..........................................42
- 29. Informative References........................................42
- 30. Author's Addresses............................................43
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 2]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-1. Introduction
-
- When reading this document, familiarity with the concepts of Zero
- Configuration Networking [ZC] and automatic link-local addressing
- [v4LL] [RFC 2462] is helpful.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, or resource record types.
- This document simply discusses what needs to happen if DNS clients
- start sending DNS queries to a multicast address, and how a
- collection of hosts can cooperate to collectively answer those
- queries in a useful manner.
-
- There has been discussion of how much burden Multicast DNS might
- impose on a network. It should be remembered that whenever IPv4 hosts
- communicate, they broadcast ARP packets on the network on a regular
- basis, and this is not disastrous. The approximate amount of
- multicast traffic generated by hosts making conventional use of
- Multicast DNS is anticipated to be roughly the same order of
- magnitude as the amount of broadcast ARP traffic those hosts already
- generate.
-
- New applications making new use of Multicast DNS capabilities for
- unconventional purposes may generate more traffic. If some of those
- new applications are "chatty", then work will be needed to help them
- become less chatty. When performing any analysis, it is important to
- make a distinction between the application behavior and the
- underlying protocol behavior. If a chatty application uses UDP, that
- doesn't mean that UDP is chatty, or that IP is chatty, or that
- Ethernet is chatty. What it means is that the application is chatty.
- The same applies to any future applications that may decide to layer
- increasing portions of their functionality over Multicast DNS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 3]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
- This document uses the term "host name" in the strict sense to mean a
- fully qualified domain name that has an address record. It does not
- use the term "host name" in the commonly used but incorrect sense to
- mean just the first DNS label of a host's fully qualified domain
- name.
-
- A DNS (or mDNS) packet contains an IP TTL in the IP header, which
- is effectively a hop-count limit for the packet, to guard against
- routing loops. Each Resource Record also contains a TTL, which is
- the number of seconds for which the Resource Record may be cached.
-
- In any place where there may be potential confusion between these two
- types of TTL, the term "IP TTL" is used to refer to the IP header TTL
- (hop limit), and the term "RR TTL" is used to refer to the Resource
- Record TTL (cache lifetime).
-
- When this document uses the term "Multicast DNS", it should be taken
- to mean: Clients performing DNS-like queries for DNS-like resource
- records by sending DNS-like UDP query and response packets over IP
- Multicast to UDP port 5353."
-
-
-3. Multicast DNS Names
-
- This document proposes that the DNS top-level domain ".local." be
- designated a special domain with special semantics, namely that any
- fully-qualified name ending in ".local." is link-local, and names
- within this domain are meaningful only on the link where they
- originate. This is analogous to IPv4 addresses in the 169.254/16
- prefix, which are link-local and meaningful only on the link where
- they originate.
-
- Any DNS query for a name ending with ".local." MUST be sent
- to the mDNS multicast address (224.0.0.251 or its IPv6 equivalent
- FF02::FB).
-
- It is unimportant whether a name ending with ".local." occurred
- because the user explicitly typed in a fully qualified domain name
- ending in ".local.", or because the user entered an unqualified
- domain name and the host software appended the suffix ".local."
- because that suffix appears in the user's search list. The ".local."
- suffix could appear in the search list because the user manually
- configured it, or because it was received in a DHCP option, or via
- any other valid mechanism for configuring the DNS search list. In
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 4]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- this respect the ".local." suffix is treated no differently to any
- other search domain that might appear in the DNS search list.
-
- DNS queries for names that do not end with ".local." MAY be sent to
- the mDNS multicast address, if no other conventional DNS server is
- available. This can allow hosts on the same link to continue
- communicating using each other's globally unique DNS names during
- network outages which disrupt communication with the greater
- Internet. When resolving global names via local multicast, it is even
- more important to use DNSSEC or other security mechanisms to ensure
- that the response is trustworthy. Resolving global names via local
- multicast is a contentious issue, and this document does not discuss
- it in detail, instead concentrating on the issue of resolving local
- names using DNS packets sent to a multicast address.
-
- A host which belongs to an organization or individual who has control
- over some portion of the DNS namespace can be assigned a globally
- unique name within that portion of the DNS namespace, for example,
- "cheshire.apple.com." For those of us who have this luxury, this
- works very well. However, the majority of home customers do not have
- easy access to any portion of the global DNS namespace within which
- they have the authority to create names as they wish. This leaves the
- majority of home computers effectively anonymous for practical
- purposes.
-
- To remedy this problem, this document allows any computer user to
- elect to give their computers link-local Multicast DNS host names of
- the form: "single-dns-label.local." For example, my Titanium
- PowerBook laptop computer answers to the name "sctibook.local." Any
- computer user is granted the authority to name their computer this
- way, providing that the chosen host name is not already in use on
- that link. Having named their computer this way, the user has the
- authority to continue using that name until such time as a name
- conflict occurs on the link which is not resolved in the user's
- favour. If this happens, the computer (or its human user) SHOULD
- cease using the name, and may choose to attempt to allocate a new
- unique name for use on that link. Like law suits over global DNS
- names, these conflicts are expected to be relatively rare for people
- who choose reasonably imaginative names, but it is still important
- to have a mechanism in place to handle them when they happen.
-
- The point made in the previous paragraph is very important and bears
- repeating. It is easy for those of us in the IETF community who run
- our own name servers at home to forget that the majority of computer
- users do not run their own name server and have no easy way to create
- their own host names. When these users wish to transfer files between
- two laptop computers, they are frequently reduced to typing in
- dotted-decimal IP addresses because they simply have no other way for
- one host to refer to the other by name. This is a sorry state of
- affairs. What is worse, most users don't even bother trying to use
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 5]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- dotted-decimal IP addresses. Most users still move data between
- machines by copying it onto a floppy disk or similar removable media.
-
- In a world of gigabit Ethernet and ubiquitous wireless networking it
- is a sad indictment of the networking community that the preferred
- communication medium for most computer users is still the floppy
- disk.
-
- Allowing ad-hoc allocation of single-label names in a single flat
- ".local." namespace may seem to invite chaos. However, operational
- experience with AppleTalk NBP names [NBP], which on any given link
- are also effectively single-label names in a flat namespace, shows
- that in practice name collisions happen extremely rarely and are not
- a problem. Groups of computer users from disparate organizations
- bring Macintosh laptop computers to events such as IETF Meetings, the
- Mac Hack conference, the Apple World Wide Developer Conference, etc.,
- and complaints at these events about users suffering conflicts and
- being forced to rename their machines have never been an issue.
-
- Enforcing uniqueness of host names (i.e. the names of DNS address
- records mapping names to IP addresses) is probably desirable in the
- common case, but this document does not mandate that. It is
- permissible for a collection of coordinated hosts to agree to
- maintain multiple DNS address records with the same name, possibly
- for load balancing or fault-tolerance reasons. This document does not
- take a position on whether that is sensible. It is important that
- both modes of operation are supported. The Multicast DNS protocol
- allows hosts to verify and maintain unique names for resource records
- where that behaviour is desired, and it also allows hosts to maintain
- multiple resource records with a single shared name where that
- behaviour is desired. This consideration applies to all resource
- records, not just address records (host names). In summary: It is
- required that the protocol have the ability to detect and handle name
- conflicts, but it is not required that this ability be used for every
- record.
-
-
-3.1 Governing Standards Body
-
- Note that this use of the ".local." suffix falls under IETF
- jurisdiction, not ICANN jurisdiction. DNS is an IETF network
- protocol, governed by protocol rules defined by the IETF. These IETF
- protocol rules dictate character set, maximum name length, packet
- format, etc. ICANN determines additional rules that apply when the
- IETF's DNS protocol is used on the public Internet. In contrast,
- private uses of the DNS protocol on isolated private networks are not
- governed by ICANN. Since this proposed change is a change to the core
- DNS protocol rules, it affects everyone, not just those machines
- using the ICANN-governed Internet. Hence this change falls into the
- category of an IETF protocol rule, not an ICANN usage rule.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 6]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-3.2 Private DNS Namespaces
-
- Note also that the special treatment of names ending in ".local." has
- been implemented in Macintosh computers since the days of Mac OS 9,
- and continues today in Mac OS X. There are also implementations for
- Linux and other platforms [dotlocal]. Operators setting up private
- internal networks ("intranets") are advised that their lives may be
- easier if they avoid using the suffix ".local." in names in their
- private internal DNS server. Alternative possibilities include:
-
- .intranet
- .internal
- .private
- .corp
- .home
-
- Another alternative naming scheme, advocated by Professor D. J.
- Bernstein, is to use a numerical suffix, such as ".6." [djbdl].
-
-
-3.3 Maximum Multicast DNS Name Length
-
- RFC 1034 says:
-
- "the total number of octets that represent a domain name (i.e.,
- the sum of all label octets and label lengths) is limited to 255."
-
- This text implies that the final root label at the end of every name
- is included in this count (a name can't be represented without it),
- but the text does not explicitly state that. Implementations of
- Multicast DNS MUST include the label length byte of the final root
- label at the end of every name when enforcing the rule that no name
- may be longer than 255 bytes. For example, the length of the name
- "apple.com." is considered to be 11, which is the number of bytes it
- takes to represent that name in a packet without using name
- compression:
-
- ------------------------------------------------------
- | 0x05 | a | p | p | l | e | 0x03 | c | o | m | 0x00 |
- ------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 7]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-4. IP TTL Checks
-
- All Multicast DNS responses (including responses sent via unicast)
- MUST be sent with IP TTL set to 255.
-
- A host sending Multicast DNS queries to a link-local destination
- address (including the 224.0.0.251 link-local multicast address) MUST
- verify that the IP TTL in response packets is 255, and silently
- discard any response packets where the IP TTL is not 255. Without
- this check, it could be possible for remote rogue hosts to send
- spoof answer packets (perhaps unicast to the victim host) which the
- receiving machine could misinterpret as having originated on the
- local link.
-
- The authors have heard complaints that some older network stack
- implementations do not implement the IP_RECVTTL socket option
- (or equivalent API) for obtaining the IP TTL of received packets.
- This is unfortunate, and these old network stacks would benefit
- from adding this API support so that they may benefit from this
- enhanced protection against spoof packets arriving from off-link.
-
- Note that Multicast DNS Responders SHOULD NOT discard queries with
- TTLs other than 255. There may be valid future applications of
- Multicast DNS where hosts issue unicast queries directed at Multicast
- DNS Responders more than one hop away, if Multicast DNS Responders
- were to discard queries where the TTL is not 255, they would not
- answer these queries.
-
-
-5. Reverse Address Mapping
-
- Like ".local.", the IPv4 and IPv6 reverse-mapping domains are also
- defined to be link-local.
-
- Any DNS query for a name ending with "254.169.in-addr.arpa." MUST
- be sent to the mDNS multicast address 224.0.0.251. Since names under
- this domain correspond to IPv4 link-local addresses, it is logical
- that the local link is the best place to find information pertaining
- to those names. As an optimization, these queries MAY be first
- unicast directly to the address in question, but if this query is not
- answered, the query MUST also be sent via multicast, to accommodate
- the case where the machine in question is not answering for itself
- (for example, because it is currently sleeping).
-
- Likewise, any DNS query for a name ending with "0.8.e.f.ip6.arpa."
- MUST be sent to the IPv6 mDNS link-local multicast address FF02::FB,
- with or without an optional initial query unicast directly to the
- address in question.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 8]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-6. Querying
-
- There are three kinds of Multicast DNS Queries, one-shot queries of
- the kind made by today's conventional DNS clients, one-shot queries
- accumulating multiple responses made by multicast-aware DNS clients,
- and continuous ongoing Multicast DNS Queries used by IP network
- browser software.
-
- A Multicast DNS Responder that is offering records that are intended
- to be unique on the local link MUST also implement a Multicast DNS
- Querier so that it can first verify the uniqueness of those records
- before it begins answering queries for them.
-
-
-6.1 One-Shot Queries
-
- An unsophisticated DNS client may simply send its DNS queries
- blindly to the 224.0.0.251 multicast address, without necessarily
- even being aware what a multicast address is.
-
- Such an unsophisticated DNS client may not get ideal behaviour. Such
- a client may simply take the first response it receives and fail to
- wait to see if there are more, but in many instances this may not be
- a serious problem. If a user types "http://stu.local." into their Web
- browser and gets to see the page they were hoping for, then the
- protocol has met the user's needs in this case.
-
-
-6.2 One-Shot Queries, Accumulating Multiple Responses
-
- A more sophisticated DNS client should understand that Multicast DNS
- is not exactly the same as unicast DNS, and should modify its
- behaviour in some simple ways.
-
- As described above, there are some cases, such as looking up the
- address associated with a unique host name, where a single response
- is sufficient, and moreover may be all that is expected. However,
- there are other DNS queries where more than one response is
- possible, and for these queries a more sophisticated Multicast DNS
- client should include the ability to wait for an appropriate period
- of time to collect multiple responses.
-
- A naive DNS client retransmits its query only so long as it has
- received no response. A more sophisticated Multicast DNS client is
- aware that having received one response is not necessarily an
- indication that it might not receive others, and has the ability to
- retransmit its query an appropriate number of times at appropriate
- intervals until it is satisfied with the collection of responses it
- has gathered.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 9]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- A more sophisticated Multicast DNS client that is retransmitting
- a query for which it has already received some responses, MUST
- implement Known Answer Suppression, as described below in Section
- 7.1. This indicates to responders who have already replied that their
- responses have been received, and they don't need to send them again
- in response to this repeated query. In addition, the interval between
- the first two queries MUST be at least one second, and the
- intervals between subsequent queries MUST double.
-
-
-6.3 Continuous Querying
-
- In One-Shot Queries, with either a single or multiple responses,
- the underlying assumption is that the transaction begins when the
- application issues a query, and ends when all the desired responses
- have been received. There is another type of operation which is more
- akin to continuous monitoring.
-
- Macintosh users are accustomed to opening the "Chooser" window,
- selecting a desired printer, and then closing the Chooser window.
- However, when the desired printer does not appear in the list, the
- user will typically leave the "Chooser" window open while they go and
- check to verify that the printer is plugged in, powered on, connected
- to the Ethernet, etc. While the user jiggles the wires, hits the
- Ethernet hub, and so forth, they keep an eye on the Chooser window,
- and when the printer name appears, they know they have fixed whatever
- the problem was. This can be a useful and intuitive troubleshooting
- technique, but a user who goes home for the weekend leaving the
- Chooser window open places a non-trivial burden on the network.
-
- With continuous querying, multiple queries are sent over a long
- period of time, until the user terminates the operation. It is
- important that an IP network browser window displaying live
- information from the network using Multicast DNS, if left running for
- an extended period of time, should generate significantly less
- multicast traffic on the network than the old AppleTalk Chooser.
- Therefore, the interval between the first two queries MUST be at
- least one second, the intervals between subsequent queries MUST
- double, and the querier MUST implement Known Answer Suppression, as
- described below in Section 7.1.
-
- When a Multicast DNS Querier receives an answer, the answer contains
- a TTL value that indicates for how many seconds this answer is valid.
- After this interval has passed, the answer will no longer be valid
- and should be deleted from the cache. Before this time is reached, a
- Multicast DNS Querier with an ongoing interest in that record SHOULD
- re-issue its query to determine whether the record is still valid,
- and if so update its expiry time.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 10]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- To perform this cache maintenance, a Multicast DNS Querier should
- plan to issue a query at 80% of the record lifetime, and then if no
- answer is received, at 85%, 90% and 95%. If an answer is received,
- then the remaining TTL is reset to the value given in the answer, and
- this process repeats for as long as the Multicast DNS Querier has an
- ongoing interest in the record. If after four queries no answer is
- received, the record is deleted when it reaches 100% of its lifetime.
-
- To avoid the case where multiple Multicast DNS Queriers on a network
- all issue their queries simultaneously, a random variation of 2% of
- the record TTL should be added, so that queries are scheduled to be
- performed at 80-82%, 85-87%, 90-92% and then 95-97% of the TTL.
-
-
-6.4 Multiple Questions per Query
-
- Multicast DNS allows a querier to place multiple questions in the
- question section of a single Multicast DNS query packet.
-
- The semantics of a Multicast DNS query packet containing multiple
- questions is identical to a series of individual DNS query packets
- containing one question each. Combining multiple questions into a
- single packet is purely an efficiency optimization, and has no other
- semantic significance.
-
- A useful technique for adaptively combining multiple questions into a
- single query is to use a Nagle-style algorithm: When a client issues
- its first question, a Query packet is immediately built and sent,
- without delay. If the client then continues issuing a rapid series of
- questions they are held until either the first query receives at
- least one answer, or 100ms has passed, or there are enough questions
- to fill the question section of a Multicast DNS query packet. At this
- time, all the held questions are placed into a Multicast DNS query
- packet and sent.
-
-
-6.5 Questions Requesting Unicast Responses
-
- Sending Multicast DNS responses via multicast has the benefit that
- all the other hosts on the network get to see those responses, and
- can keep their caches up to date, and detect conflicting responses.
-
- However, there are situations where all the other hosts on the
- network don't need to see every response. One example is a laptop
- computer waking from sleep. At that instant it is a brand new
- participant on a new network. Its Multicast DNS cache is empty, and
- it has no knowledge of its surroundings. It may have a significant
- number of queries that it wants answered right away to discover
- information about its new surroundings and present that information
- to the user. As a new participant on the network, it has no idea
- whether the exact same questions may have been asked and answered
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 11]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- just seconds ago. In this case, trigging a large sudden flood of
- multicast responses may impose an unreasonable burden on the network.
- To avoid this, the Multicast DNS Querier SHOULD set the top bit in
- the class field of its DNS question(s), to indicate that it is
- willing to accept unicast responses instead of the usual multicast
- responses. These questions requesting unicast responses are referred
- to as "QU" questions, to distinguish them from the more usual
- questions requesting multicast responses ("QM" questions).
-
- When retransmitting a question more than once, the 'unicast response'
- bit SHOULD be set only for the first question of the series. After
- the first question has received its responses, the querier should
- have a large known-answer list (see "Known Answer Suppression" below)
- so that subsequent queries should elicit few, if any, further
- responses. Reverting to multicast responses as soon as possible is
- important because of the benefits that multicast responses provide
- (see "Benefits of Multicast Responses" below).
-
- When receiving a question with the 'unicast response' bit set, a
- responder SHOULD usually respond with a unicast packet directed back
- to the querier. If the responder has not multicast that record
- recently (within one quarter of its TTL), then the responder SHOULD
- instead multicast the response so as to keep all the peer caches up
- to date, and to permit passive conflict detection.
-
-
-6.6 Suppressing Initial Query
-
- If a query is issued for which there already exist one or more
- records in the local cache, and those record(s) were received with
- the cache flush bit set, indicating that they form a unique RRSet,
- then the host SHOULD suppress its initial "QU" query, and proceed to
- issue a "QM" query. To avoid the situation where a group of hosts
- are synchronized by some external event and all perform the same
- query simultaneously, a host suppressing its initial "QU" query
- SHOULD impose a random delay from 500-1000ms before transmitting its
- first "QM" query for this question. This means that when the first
- host (selected randomly by this algorithm) transmits its "QM" query,
- all the other hosts that were about to transmit the same query can
- suppress their superfluous query, as described in "Duplicate
- Question Suppression" below.
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 12]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-7. Duplicate Suppression
-
- A variety of techniques are used to reduce the amount of redundant
- traffic on the network.
-
-
-7.1 Known Answer Suppression
-
- When a Multicast DNS Querier sends a query to which it already knows
- some answers, it populates the Answer Section of the DNS message with
- those answers.
-
- A Multicast DNS Responder SHOULD NOT answer a Multicast DNS Query if
- the answer it would give is already included in the Answer Section
- with an RR TTL at least half the correct value. If the RR TTL of the
- answer as given in the Answer Section is less than half of the true
- RR TTL as known by the Multicast DNS Responder, the responder MUST
- send an answer so as to update the Querier's cache before the record
- becomes in danger of expiration.
-
- Because a Multicast DNS Responder will respond if the remaining TTL
- given in the known answer list is less than half the true TTL, it is
- superfluous for the Querier to include such records in the known
- answer list. Therefore a Multicast DNS Querier SHOULD NOT include
- records in the known answer list whose remaining TTL is less than
- half their original TTL. Doing so would simply consume space in the
- packet without achieving the goal of suppressing responses, and would
- therefore be a pointless waste of network bandwidth.
-
- A Multicast DNS Querier MUST NOT cache resource records observed in
- the Known Answer Section of other Multicast DNS Queries. The Answer
- Section of Multicast DNS Queries is not authoritative. By placing
- information in the Answer Section of a Multicast DNS Query the
- querier is stating that it *believes* the information to be true.
- It is not asserting that the information *is* true. Some of those
- records may have come from other hosts that are no longer on the
- network. Propagating that stale information to other Multicast DNS
- Queriers on the network would not be helpful.
-
-
-7.2 Multi-Packet Known Answer Suppression
-
- Sometimes a Multicast DNS Querier will already have too many answers
- to fit in the Known Answer section of its query packets. In this
- case, it should issue a Multicast DNS Query containing a question and
- as many Known Answer records as will fit. It should then set the TC
- (Truncated) bit in the header before sending the Query. It should
- then immediately follow the packet with another query containing no
- questions, and as many more Known Answer records as will fit. If
- there are still too many records remaining to fit in the packet, it
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 13]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- again sets the TC bit and continues until all the Known Answer
- records have been sent.
-
- A Multicast DNS Responder seeing a Multicast DNS Query with the TC
- bit set defers its response for a time period randomly selected in
- the interval 20-120ms. This gives the Multicast DNS Querier time to
- send additional Known Answer packets before the Responder responds.
- If the Responder sees any of its answers listed in the Known Answer
- lists of subsequent packets from the querying host, it should delete
- that answer from the list of answers it is planning to give, provided
- that no other host on the network is also waiting to receive the same
- answer record.
-
-
-7.3 Duplicate Question Suppression
-
- If a host is planning to send a query, and it sees another host on
- the network send a query containing the same question, and the Known
- Answer section of that query does not contain any records which this
- host would not also put in its own Known Answer section, then this
- host should treat its own query as having been sent. When multiple
- clients on the network are querying for the same resource records,
- there is no need for them to all be repeatedly asking the same
- question.
-
-
-7.4 Duplicate Answer Suppression
-
- If a host is planning to send an answer, and it sees another host on
- the network send a response packet containing the same answer record,
- and the TTL in that record is not less than the TTL this host would
- have given, then this host should treat its own answer as having been
- sent. When multiple responders on the network have the same data,
- there is no need for all of them to respond.
-
- This feature is particularly useful when multiple Sleep Proxy Servers
- are deployed (see Section 16. "Multicast DNS and Power Management").
- In the future it is possible that every general-purpose OS (Mac,
- Windows, Linux, etc.) will implement Sleep Proxy Service as a matter
- of course. In this case there could be a large number of Sleep Proxy
- Servers on any given network, which is good for reliability and
- fault-tolerance, but would be bad for the network if every Sleep
- Proxy Server were to answer every query.
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 14]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-8. Responding
-
- A Multicast DNS Responder MUST only respond when it has a positive
- non-null response to send. Error responses must never be sent. The
- non-existence of any name in a Multicast DNS Domain is ascertained by
- the failure of any machine to respond to the Multicast DNS query, not
- by NXDOMAIN errors.
-
- Multicast DNS Responses MUST NOT contain any questions in the
- Question Section. Any questions in the Question Section of a received
- Multicast DNS Response MUST be silently ignored. Multicast DNS
- Queriers receiving Multicast DNS Responses do not care what question
- elicited the response; they care only that the information in the
- response is true and accurate.
-
- A Multicast DNS Responder on Ethernet [IEEE802] and similar shared
- multiple access networks SHOULD delay its responses by a random
- amount of time selected with uniform random distribution in the range
- 20-120ms. If multiple Multicast DNS Responders were all to respond
- immediately to a particular query, a collision would be virtually
- guaranteed. By imposing a small random delay, the number of
- collisions is dramatically reduced. 120ms is a short enough time that
- it is almost imperceptible to a human user, but long enough to
- significantly reduce the risk of Ethernet collisions. On a full-sized
- Ethernet using the maximum cable lengths allowed and the maximum
- number of repeaters allowed, an Ethernet frame is vulnerable to
- collisions during the transmission of its first 256 bits. On 10Mb/s
- Ethernet, this equates to a vulnerable time window of 25.6us.
-
- In the case where a Multicast DNS Responder has good reason to
- believe that it will be the only responder on the link with a
- positive non-null response, it SHOULD NOT impose the random delay
- before responding, and SHOULD normally generate its response within
- 10ms. To do this safely, it MUST have previously verified that the
- requested name, type and class in the DNS query are unique on this
- link. Responding immediately without delay is appropriate for things
- like looking up the address record for a particular host name, when
- the host name has been previously verified unique. Responding
- immediately without delay is *not* appropriate for things like
- looking up PTR records used for DNS Service Discovery [DNS-SD], where
- a large number of responses may be anticipated.
-
- Except when a unicast reply has been explicitly requested via the
- "unicast reply" bit, Multicast DNS Responses MUST be sent to UDP port
- 5353 (the well-known port assigned to mDNS) on the 224.0.0.251
- multicast address (or its IPv6 equivalent FF02::FB). Operating in a
- Zeroconf environment requires constant vigilance. Just because a name
- has been previously verified unique does not mean it will continue to
- be so indefinitely. By allowing all Multicast DNS Responders to
- constantly monitor their peers' responses, conflicts arising out of
- network topology changes can be promptly detected and resolved.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 15]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- Sending all responses by multicast also facilitates opportunistic
- caching by other hosts on the network.
-
- To protect the network against excessive packet flooding due to
- software bugs or malicious attack, a Multicast DNS Responder MUST NOT
- multicast a given record on a given interface if it has previously
- multicast that record on that interface within the last second. A
- legitimate client on the network should have seen the previous
- transmission and cached it. A client that did not receive and cache
- the previous transmission will retry its request and receive a
- subsequent response. Under no circumstances is there any legitimate
- reason for a Multicast DNS Responder to multicast a given record more
- than once per second on any given interface.
-
-
-8.1 Legacy Unicast Responses
-
- If the source UDP port in a received Multicast DNS Query is not port
- 5353, this indicates that the client originating the query is a
- simple client that does not fully implement all of Multicast DNS. In
- this case, the Multicast DNS Responder MUST send a UDP response
- directly back to the client, via unicast, to the query packet's
- source IP address and port. This unicast response MUST be a
- conventional unicast response as would be generated by a conventional
- unicast DNS server; for example, it must repeat the query ID and the
- question given in the query packet.
-
- The resource record TTL given in a unicast response SHOULD NOT be
- greater than ten seconds, even if the true TTL of the Multicast DNS
- resource record is higher. This is because Multicast DNS Responders
- that fully participate in the protocol use the cache coherency
- mechanisms described in Section 13 to update and invalidate stale
- data. Were unicast responses sent to legacy clients to use the same
- high TTLs, these legacy clients, which do not implement these cache
- coherency mechanisms, could retain stale cached resource record data
- long after it is no longer valid.
-
- Having sent this unicast response, if the Responder has not sent this
- record in any multicast response recently, it SHOULD schedule the
- record to be sent via multicast as well, to facilitate passive
- conflict detection. "Recently" in this context means "if the time
- since the record was last sent via multicast is less than one quarter
- of the record's TTL".
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 16]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-8.2 Multi-Question Queries
-
- Multicast DNS Responders MUST correctly handle DNS query packets
- containing more than one question, by answering any or all of the
- questions to which they have answers. Any answers generated
- in response to query packets containing more than one question
- MUST be randomly delayed in the range 20-120ms, as described above.
-
-
-8.3 Response Aggregation
-
- Having delayed one or more multicast responses by 20-120ms as
- described above in Section 8 "Responding", a Multicast DNS Responder
- SHOULD, for the sake of network efficiency, aggregate as many of its
- pending responses as possible into a single Multicast DNS response
- packet.
-
-
-9. Probing and Announcing on Startup
-
- Typically a Multicast DNS Responder should have, at the very least,
- address records for all of its active interfaces. Creating and
- advertising an HINFO record on each interface as well can be useful
- to network administrators.
-
- Whenever a Multicast DNS Responder starts up, wakes up from sleep,
- receives an indication of an Ethernet "Link Change" event, or has any
- other reason to believe that its network connectivity may have
- changed in some relevant way, it MUST perform the two startup steps
- below.
-
-
-9.1 Probing
-
- The first startup step is that for all those resource records that a
- Multicast DNS Responder desires to be unique on the local link, it
- MUST send a Multicast DNS Query asking for those resource records, to
- see if any of them are already in use. The primary example of this is
- its address record which maps its unique host name to its unique IP
- address. All Probe Queries SHOULD be done using the desired resource
- record name and query type T_ANY (255), to elicit answers for all
- types of records with that name. This allows a single question to be
- used in place of several questions, which is more efficient on the
- network. It also allows a host to verify exclusive ownership of a
- name, which is desirable in most cases. It would be confusing, for
- example, if one host owned the "A" record for "myhost.local.", but a
- different host owned the HINFO record for that name.
-
- The ability to place more than one question in a Multicast DNS Query
- is useful here, because it can allow a host to use a single packet
- for all of its resource records instead of needing a separate packet
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 17]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- for each. For example, a host can simultaneously probe for uniqueness
- of its "A" record and all its SRV records [DNS-SD] in the same query
- packet.
-
- When ready to send its mDNS probe packet(s) the host should first
- wait for a short random delay time, uniformly distributed in the
- range 0-250ms. This random delay is to guard against the case where a
- group of devices are powered on simultaneously, or a group of devices
- are connected to an Ethernet hub which is then powered on, or some
- other external event happens that might cause a group of hosts to all
- send synchronized probes.
-
- 250ms after the first query the host should send a second, then
- 250ms after that a third. If, by 250ms after the third probe, no
- conflicting Multicast DNS responses have been received, the host may
- move to the next step, announcing.
-
- If any conflicting Multicast DNS responses are received, then the
- probing host MUST defer to the existing host, and must choose new
- names for some or all of its resource records as appropriate, to
- avoid conflict with pre-existing hosts on the network. In the case
- of a host probing using query type T_ANY as recommended above, any
- answer containing a record with that name, of any type, MUST be
- considered a conflicting response and handled accordingly.
-
- If ten failures occur within any ten-second period, then the host
- MUST wait at least five seconds before each successive additional
- probe attempt. This is to help ensure that in the event of software
- bugs or other unanticipated problems, errant hosts do not flood the
- network with a continuous stream of multicast traffic. For very
- simple devices, a valid way to comply with this requirement is to
- always wait five seconds after any failed probe attempt.
-
-
-9.2 Simultaneous Probe Tie-Breaking
-
- The astute reader will observe that there is a race condition
- inherent in the previous description. If two hosts are probing for
- the same name simultaneously, neither will receive any response to
- the probe, and the hosts could incorrectly conclude that they may
- both proceed to use the name. To break this symmetry, each host
- populates the Authority Section of its queries with records giving
- the rdata that it would be proposing to use, should its probing be
- successful. The Authority Section is being used here in a way
- analogous to the Update section of a DNS Update packet [RFC 2136].
-
- When a host that is probing for a record sees another host issue a
- query for the same record, it consults the Authority Section of that
- query. If it finds any resource record there which answers the query,
- then it compares the data of that resource record with its own
- tentative data. The lexicographically later data wins. This means
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 18]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- that if the host finds that its own data is lexicographically later,
- it simply ignores the other host's probe. If the host finds that its
- own data is lexicographically earlier, then it treats this exactly
- as if it had received a positive answer to its query, and concludes
- that it may not use the desired name.
-
- The determination of 'lexicographically later' is performed by first
- comparing the record class, then the record type, then raw comparison
- of the binary content of the rdata without regard for meaning or
- structure. If the record classes differ, then the numerically greater
- class is considered 'lexicographically later'. Otherwise, if the
- record types differ, then the numerically greater type is considered
- 'lexicographically later'. If the type and class both match then the
- rdata is compared.
-
- In the case of resource records containing rdata that is subject to
- name compression, the names must be uncompressed before comparison.
- (The details of how a particular name is compressed is an artifact of
- how and where the record is written into the DNS message; it is not
- an intrinsic property of the resource record itself.)
-
- The bytes of the raw uncompressed rdata are compared in turn,
- interpreting the bytes as eight-bit UNSIGNED values, until a byte
- is found whose value is greater than that of its counterpart (in
- which case the rdata whose byte has the greater value is deemed
- lexicographically later) or one of the resource records runs out
- of rdata (in which case the resource record which still has
- remaining data first is deemed lexicographically later).
-
- The following is an example of a conflict:
-
- sctibook.local. A 196.254.100.200
- sctibook.local. A 196.254.200.100
-
- In this case 196.254.200.100 is lexicographically later, so it is
- deemed the winner.
-
- Note that it is vital that the bytes are interpreted as UNSIGNED
- values, or the wrong outcome may result. In the example above, if
- the byte with value 200 had been incorrectly interpreted as a
- signed value then it would be interpreted as value -56, and the
- wrong address record would be deemed the winner.
-
-
-9.3 Announcing
-
- The second startup step is that the Multicast DNS Responder MUST send
- a gratuitous Multicast DNS Response containing, in the Answer
- Section, all of its resource records. If there are too many resource
- records to fit in a single packet, multiple packets should be used.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 19]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- In the case of shared records (e.g. the PTR records used by DNS
- Service Discovery [DNS-SD]), the records are simply placed as-is
- into the answer section of the DNS Response.
-
- In the case of records that have been verified to be unique in the
- previous step, they are placed into the answer section of the DNS
- Response with the most significant bit of the rrclass set to one. The
- most significant bit of the rrclass is the mDNS "cache flush" bit and
- is discussed in more detail below in Section 13.3 "Announcements to
- Flush Outdated Cache Entries".
-
- The Multicast DNS Responder MUST send at least two gratuitous
- responses, one second apart. A Responder MAY send up to ten
- gratuitous Responses, providing that the interval between gratuitous
- responses doubles with every response sent.
-
- A Multicast DNS Responder SHOULD NOT continue sending gratuitous
- Responses for longer than the TTL of the record. The purpose of
- announcing new records via gratuitous Responses is to ensure that
- peer caches are up to date. After a time interval equal to the TTL of
- the record has passed, it is very likely that old stale copies of
- that record in peer caches will have expired naturally, so subsequent
- announcements serve little purpose.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the conflict MUST be resolved as described below in "Conflict
- Resolution".
-
- A Multicast DNS Responder MUST NOT send announcements in the absence
- of information that its network connectivity may have changed in some
- relevant way. In particular, a Multicast DNS Responder MUST NOT send
- regular periodic announcements as a matter of course.
-
-
-9.4 Updating
-
- At any time, if the rdata of any of a host's Multicast DNS records
- changes, the host MUST repeat the Announcing step described above to
- update neighbouring caches. For example, if any of a host's IP
- addresses change, it must re-announce those address records.
-
- A host may update the contents of any of its records at any time,
- though a host SHOULD NOT update records more frequently than ten
- times per minute. Frequent rapid updates impose a burden on the
- network. If a host has information to disseminate which changes more
- frequently than ten times per minute, then Multicast DNS may not be
- the appropriate protocol to disseminate that information.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 20]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-10. Conflict Resolution
-
- A conflict occurs when two resource records with the same name, type
- and class have inconsistent rdata. What may be considered
- inconsistent is context sensitive, except that resource records with
- identical rdata are never considered inconsistent, even if they
- originate from different hosts. A common example of a resource record
- type that is intended to be unique, not shared between hosts, is the
- address record that maps a host's name to its IP address. Should a
- host witness another host announce an address record with the same
- name but a different IP address, then that is considered
- inconsistent, and that address record is considered to be in
- conflict.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the Multicast DNS Responder MUST immediately reset that
- record to probing state, and go through the startup steps described
- above in Section 9. "Probing and Announcing on Startup". The
- protocol used in the Probing phase will determine a winner and a
- loser, and the loser must cease using the name, and reconfigure.
-
- It is very important that any host that observes an apparent conflict
- MUST take action. In the case of two hosts using the same host name,
- where one has been configured to require a unique host name and the
- other has not, the one that has not been configured to require a
- unique host name will not perceive any conflict, and will not take
- any action. By reverting to Probing state, the host that desires a
- unique host name will go through the necessary steps to ensure that a
- unique host is obtained.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 21]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- The recommended course of action after probing and failing is as
- follows:
-
- o Programmatically change the resource record name in an attempt to
- find a new name that is unique. This could be done by adding some
- further identifying information (e.g. the model name of the
- hardware) if it is not already present in the name, appending the
- digit "2" to the name, or incrementing a number at the end of the
- name if one is already present.
-
- o Probe again, and repeat until a unique name is found.
-
- o Record this newly chosen name in persistent storage so that the
- device will use the same name the next time it is power-cycled.
-
- o Display a message to the user or operator informing them of the
- name change. For example:
-
- The name "Bob's Music" is in use by another iTunes music
- server on the network. Your music has been renamed to
- "Bob's Music (G4 Cube)". If you want to change this name,
- use [describe appropriate menu item or preference dialog].
-
- How the user or operator is informed depends on context. A desktop
- computer with a screen might put up a dialog box. A headless server
- in the closet may write a message to a log file, or use whatever
- mechanism (email, SNMP trap, etc.) it uses to inform the
- administrator of other error conditions. On the other hand a headless
- server in the closet may not inform the user at all -- if the user
- cares, they will notice the name has changed, and connect to the
- server in the usual way (e.g. via Web Browser) to configure a new
- name.
-
- The examples in this section focus on address records (i.e. host
- names), but the same considerations apply to all resource records
- where uniqueness (or maintenance of some other defined constraint) is
- desired.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 22]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-11. Special Characteristics of Multicast DNS Domains
-
- Unlike conventional DNS names, names that end in ".local.",
- "254.169.in-addr.arpa." or "0.8.e.f.ip6.arpa." have only local
- significance. Conventional DNS seeks to provide a single unified
- namespace, where a given DNS query yields the same answer no matter
- where on the planet it is performed or to which recursive DNS server
- the query is sent. (However, split views, firewalls, intranets and
- the like have somewhat interfered with this goal of DNS representing
- a single universal truth.) In contrast, each IP link has its own
- private ".local.", "254.169.in-addr.arpa." and "0.8.e.f.ip6.arpa."
- namespaces, and the answer to any query for a name within those
- domains depends on where that query is asked.
-
- Multicast DNS Domains are not delegated from their parent domain via
- use of NS records. There are no NS records anywhere in Multicast DNS
- Domains. Instead, all Multicast DNS Domains are delegated to the IP
- addresses 224.0.0.251 and FF02::FB by virtue of the individual
- organizations producing DNS client software deciding how to handle
- those names. It would be extremely valuable for the industry if this
- special handling were ratified and recorded by IANA, since otherwise
- the special handling provided by each vendor is likely to be
- inconsistent.
-
- The IPv4 name server for a Multicast DNS Domain is 224.0.0.251. The
- IPv6 name server for a Multicast DNS Domain is FF02::FB. These are
- multicast addresses; therefore they identify not a single host but a
- collection of hosts, working in cooperation to maintain some
- reasonable facsimile of a competently managed DNS zone. Conceptually
- a Multicast DNS Domain is a single DNS zone, however its server is
- implemented as a distributed process running on a cluster of loosely
- cooperating CPUs rather than as a single process running on a single
- CPU.
-
- No delegation is performed within Multicast DNS Domains. Because the
- cluster of loosely coordinated CPUs is cooperating to administer a
- single zone, delegation is neither necessary nor desirable. Just
- because a particular host on the network may answer queries for a
- particular record type with the name "example.local." does not imply
- anything about whether that host will answer for the name
- "child.example.local.", or indeed for other record types with the
- name "example.local."
-
- Multicast DNS Zones have no SOA record. A conventional DNS zone's
- SOA record contains information such as the email address of the zone
- administrator and the monotonically increasing serial number of the
- last zone modification. There is no single human administrator for
- any given Multicast DNS Zone, so there is no email address. Because
- the hosts managing any given Multicast DNS Zone are only loosely
- coordinated, there is no readily available monotonically increasing
- serial number to determine whether or not the zone contents have
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 23]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- changed. A host holding part of the shared zone could crash or be
- disconnected from the network at any time without informing the other
- hosts. There is no reliable way to provide a zone serial number that
- would, whenever such a crash or disconnection occurred, immediately
- change to indicate that the contents of the shared zone had changed.
-
- Zone transfers are not possible for any Multicast DNS Zone.
-
-
-12. Multicast DNS for Service Discovery
-
- This document does not describe using Multicast DNS for network
- browsing or service discovery. However, the mechanisms this document
- describes are compatible with (and support) the browsing and service
- discovery mechanisms proposed in "DNS-Based Service Discovery"
- [DNS-SD].
-
- This document places few limitations on what DNS record types may be
- looked up using local multicast. One particular kind of Multicast DNS
- query that might be useful is a query for the SRV record named
- "_domain._udp.local.", yielding the port number and IP address of a
- conventional DNS server willing to perform general recursive DNS
- lookups. This could solve a particular problem facing the IPv6
- community, which is that IPv6 is able to self-configure almost all of
- the information it needs to operate [RFC 2462], except for the
- address of the DNS server. Bringing in all of the mechanisms of DHCP
- just for that one little additional piece of information is not an
- attractive solution. Using DNS-format messages and DNS-format
- resource records to find the address of the DNS server has an elegant
- self-sufficiency about it. Any host that needs to know the address of
- the DNS server must already have code to generate and parse DNS
- packets, so using that same code and those same packets to find the
- DNS server in the first place is a simple self-reliant solution that
- avoids taking external dependencies on other protocols.
-
-
-13. Resource Record TTL Values and Cache Coherency
-
- The recommended TTL value for Multicast DNS resource records is
- 120 minutes.
-
- A client with an active outstanding query will issue a query packet
- when one or more of the resource record(s) in its cache is (are) 80%
- of the way to expiry. If the TTL on those records is 120 minutes,
- this ongoing cache maintenance process yields a steady-state query
- rate of one query every 96 minutes.
-
- Any distributed cache needs a cache coherency protocol. If Multicast
- DNS resource records follow the recommendation and have a TTL of 120
- minutes, that means that stale data could persist in the system for
- up to two hours. Making the default TTL significantly lower would
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 24]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- reduce the lifetime of stale data, but would produce too much extra
- traffic on the network. Various techniques are available to minimize
- the impact of such stale data.
-
-
-13.1 Cooperating Multicast DNS Responders
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, but different rdata, then:
-
- o If A's resource record is intended to be a shared resource record,
- then this is no conflict, and no action is required.
-
- o If A's resource record is intended to be a unique resource record
- then this is a conflict and MUST be handled as described in Section
- 10 "Conflict Resolution".
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, and identical rdata, then:
-
- o If the TTL of B's resource record given in the packet is at least
- half the true TTL from A's point of view, then no action is
- required.
-
- o If the TTL of B's resource record given in the packet is less than
- half the true TTL from A's point of view, then A MUST mark its
- record to be announced via multicast. Clients receiving the record
- from B would use the TTL given by B, and hence may delete the
- record sooner than A expects. By sending its own multicast response
- correcting the TTL, A ensures that the record will be retained for
- the desired time.
-
- These rules allow multiple Multicast DNS Responders to offer the same
- data on the network (perhaps for fault tolerance reasons) without
- conflicting with each other.
-
-
-13.2 Goodbye Packets
-
- In the case where a host knows that certain resource record data is
- about to become invalid (for example when the host is undergoing a
- clean shutdown) the host SHOULD send a gratuitous announcement mDNS
- response packet, giving the same resource record name, type, class
- and rdata, but an RR TTL of zero. This has the effect of updating the
- TTL stored in neighbouring hosts' cache entries to zero, causing that
- cache entry to be promptly deleted.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 25]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- Clients receiving a Multicast DNS Response with a TTL of zero SHOULD
- NOT immediately delete the record from the cache, but instead record
- a TTL of 1 and then delete the record one second later. In the case
- of multiple Multicast DNS Responders on the network described in
- Section 13.1 above, if one of the Responders shuts down and
- incorrectly sends goodbye packets for its records, it gives the other
- cooperating Responders one second to send out their own response to
- "rescue" the records before they expire and are deleted.
-
- Generally speaking, it is more important to send goodbye packets for
- shared records than unique records. A given shared record name (such
- as a PTR record used for DNS Service Discovery [DNS-SD]) by its
- nature often has many representatives from many different hosts, and
- tends to be the subject of long-lived ongoing queries. Those
- long-lived queries are often concerned not just about being informed
- when records appear, but also about being informed if those records
- vanish again. In contrast, a unique record set (such as an SRV
- record, or a host address record), by its nature, often has far fewer
- members than a shared record set, and is usually the subject of
- one-shot queries which simply retrieve the data and then cease
- querying once they have the answer they are seeking. Therefore,
- sending a goodbye packet for a unique record set is likely to offer
- less benefit, because it is likely at any given moment that no one
- has an active query running for that record set. One example where
- goodbye packets for SRV and address records are useful is when
- transferring control to a Sleep Proxy Server (see Section 16.
- "Multicast DNS and Power Management").
-
-
-13.3 Announcements to Flush Outdated Cache Entries
-
- Whenever a host has a resource record with potentially new data (e.g.
- after rebooting, waking from sleep, connecting to a new network link,
- changing IP address, etc.), the host MUST send a series of gratuitous
- announcements to update cache entries in its neighbour hosts. In
- these gratuitous announcements, if the record is one that is intended
- to be unique, the host sets the most significant bit of the rrclass
- field of the resource record. This bit, the "cache flush" bit, tells
- neighbouring hosts that this is not a shared record type. Instead of
- merging this new record additively into the cache in addition to any
- previous records with the same name, type and class, all old records
- with that name, type and class that were received more than one
- second ago are declared invalid, and marked to expire from the cache
- in one second.
-
- The semantics of the cache flush bit are as follows: Normally when a
- resource record appears in the answer section of the DNS Response, it
- means, "This is an assertion that this information is true." When a
- resource record appears in the answer section of the DNS Response
- with the "cache flush" bit set, it means, "This is an assertion that
- this information is the truth and the whole truth, and anything you
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 26]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- may have heard more than a second ago regarding records of this
- name/type/class is no longer valid".
-
- To accommodate the case where the set of records from one host
- constituting a single unique RRSet is too large to fit in a single
- packet, only cache records that are more than one second old are
- flushed. This allows the announcing host to generate a quick burst of
- packets back-to-back on the wire containing all the members
- of the RRSet. When receiving records with the "cache flush" bit set,
- all records older than one second are marked to be deleted one second
- in the future. One second after the end of the little packet burst,
- any records not represented within that packet burst will then be
- expired from all peer caches.
-
- Any time a host sends a response packet containing some members of a
- unique RRSet, it SHOULD send the entire RRSet, preferably in a single
- packet, or if the entire RRSet will not fit in a single packet, in a
- quick burst of packets sent as close together as possible. The host
- SHOULD set the cache flush bit on all members of the unique RRSet.
- In the event that for some reason the host chooses not to send the
- entire unique RRSet in a single packet or a rapid packet burst,
- it MUST NOT set the cache flush bit on any of those records.
-
- The reason for waiting one second before deleting stale records from
- the cache is to accommodate bridged networks. For example, a host's
- address record announcement on a wireless interface may be bridged
- onto a wired Ethernet, and cause that same host's Ethernet address
- records to be flushed from peer caches. The one-second delay gives
- the host the chance to see its own announcement arrive on the wired
- Ethernet, and immediately re-announce its Ethernet address records
- so that both sets remain valid and live in peer caches.
-
- These rules apply regardless of *why* the response packet is being
- generated. They apply to startup announcements as described in
- Section 9.3, and to responses generated as a result of receiving
- query packets.
-
- The "cache flush" bit is only set in Multicast DNS responses sent to
- UDP port 5353. The "cache flush" bit MUST NOT be set in any resource
- records in a response packet sent in legacy unicast responses to UDP
- ports other than 5353.
-
- The "cache flush" bit MUST NOT be set in any resource records in the
- known-answer list of any query packet.
-
- The "cache flush" bit MUST NOT ever be set in any shared resource
- record. To do so would cause all the other shared versions of this
- resource record with different rdata from different Responders to be
- immediately deleted from all the caches on the network.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 27]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- Note that the "cache flush" bit is NOT part of the resource record
- class. The "cache flush" bit is the most significant bit of the
- second 16-bit word of a resource record in an mDNS packet (the field
- conventionally referred to as the rrclass field), and the actual
- resource record class is the least-significant fifteen bits of this
- field. There is no mDNS resource record class 0x8001. The value
- 0x8001 in the rrclass field of a resource record in an mDNS response
- packet indicates a resource record with class 1, with the "cache
- flush" bit set. When receiving a resource record with the "cache
- flush" bit set, implementations should take care to mask off that bit
- before storing the resource record in memory.
-
-
-13.4 Cache Flush on Topology change
-
- If the hardware on a given host is able to indicate physical changes
- of connectivity, then when the hardware indicates such a change, the
- host should take this information into account in its mDNS cache
- management strategy. For example, a host may choose to immediately
- flush all cache records received on a particular interface when that
- cable is disconnected. Alternatively, a host may choose to adjust the
- remaining TTL on all those records to a few seconds so that if the
- cable is not reconnected quickly, those records will expire from the
- cache.
-
- Likewise, when a host reboots, or wakes from sleep, or undergoes some
- other similar discontinuous state change, the cache management
- strategy should take that information into account.
-
-
-13.5 Cache Flush on Failure Indication
-
- Sometimes a cache record can be determined to be stale when a client
- attempts to use the rdata it contains, and finds that rdata to be
- incorrect.
-
- For example, the rdata in an address record can be determined to be
- incorrect if attempts to contact that host fail, either because
- ARP/ND requests for that address go unanswered (for an address on a
- local subnet) or because a router returns an ICMP "Host Unreachable"
- error (for an address on a remote subnet).
-
- The rdata in an SRV record can be determined to be incorrect if
- attempts to communicate with the indicated service at the host and
- port number indicated are not successful.
-
- The rdata in a DNS-SD PTR record can be determined to be incorrect if
- attempts to look up the SRV record it references are not successful.
-
- In any such case, the software implementing the mDNS resource record
- cache should provide a mechanism so that clients detecting stale
- rdata can inform the cache.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 28]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- When the cache receives this hint that it should reconfirm some
- record, it MUST issue two or more queries for the resource record in
- question. If no response is received in a reasonable amount of time,
- then, even though its TTL may indicate that it is not yet due to
- expire, that record SHOULD be promptly flushed from the cache.
-
- The end result of this is that if a printer suffers a sudden power
- failure or other abrupt disconnection from the network, its name may
- continue to appear in DNS-SD browser lists displayed on users'
- screens. Eventually that entry will expire from the cache naturally,
- but if a user tries to access the printer before that happens, the
- failure to successfully contact the printer will trigger the more
- hasty demise of its cache entries. This is a sensible trade-off
- between good user-experience and good network efficiency. If we were
- to insist that printers should disappear from the printer list within
- 30 seconds of becoming unavailable, for all failure modes, the only
- way to achieve this would be for the client to poll the printer at
- least every 30 seconds, or for the printer to announce its presence
- at least every 30 seconds, both of which would be an unreasonable
- burden on most networks.
-
-
-13.6 Passive Observation of Failures
-
- A host observes the multicast queries issued by the other hosts on
- the network. One of the major benefits of also sending responses
- using multicast is that it allows all hosts to see the responses (or
- lack thereof) to those queries.
-
- If a host sees queries, for which a record in its cache would be
- expected to be given as an answer in a multicast response, but no
- such answer is seen, then the host may take this as an indication
- that the record may no longer be valid.
-
- After seeing two or more of these queries, and seeing no multicast
- response containing the expected answer within a reasonable amount of
- time, then even though its TTL may indicate that it is not yet due to
- expire, that record MAY be flushed from the cache. The host SHOULD
- NOT perform its own queries to re-confirm that the record is truly
- gone. If every host on a large network were to do this, it would
- cause a lot of unnecessary multicast traffic. If host A sends
- multicast queries that remain unanswered, then there is no reason to
- suppose that host B or any other host is likely to be any more
- successful.
-
- The previous section, "Cache Flush on Failure Indication", describes
- a situation where a user trying to print discovers that the printer
- is no longer available. By implementing the passive observation
- described here, when one user fails to contact the printer, all hosts
- on the network observe that failure and update their caches
- accordingly.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 29]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-14. Enabling and Disabling Multicast DNS
-
- The option to fail-over to Multicast DNS for names not ending in
- ".local." SHOULD be a user-configured option, and SHOULD
- be disabled by default because of the possible security issues
- related to unintended local resolution of apparently global names.
-
- The option to lookup unqualified (relative) names by appending
- ".local." (or not) is controlled by whether ".local." appears
- (or not) in the client's DNS search list.
-
- No special control is needed for enabling and disabling Multicast DNS
- for names explicitly ending with ".local." as entered by the user.
- The user doesn't need a way to disable Multicast DNS for names ending
- with ".local.", because if the user doesn't want to use Multicast
- DNS, they can achieve this by simply not using those names. If a user
- *does* enter a name ending in ".local.", then we can safely assume
- the user's intention was probably that it should work. Having user
- configuration options that can be (intentionally or unintentionally)
- set so that local names don't work is just one more way of
- frustrating the user's ability to perform the tasks they want,
- perpetuating the view that, "IP networking is too complicated to
- configure and too hard to use." This in turn perpetuates the
- continued use of protocols like AppleTalk. If we want to retire
- AppleTalk, NetBIOS, etc., we need to offer users equivalent IP
- functionality that they can rely on to, "always work, like
- AppleTalk." A little Multicast DNS traffic may be a burden on the
- network, but it is an insignificant burden compared to continued
- widespread use of AppleTalk.
-
-
-15. Considerations for Multiple Interfaces
-
- A host should defend its host name (FQDN) on all active interfaces on
- which it is answering Multicast DNS queries.
-
- In the event of a name conflict on *any* interface, a host should
- configure a new host name, if it wishes to maintain uniqueness of its
- host name.
-
- When answering a Multicast DNS query, a multi-homed host with a
- link-local address (or addresses) should take care to ensure that
- any address going out in a Multicast DNS response is valid for use
- on the interface on which the response is going out.
-
- Just as the same link-local IP address may validly be in use
- simultaneously on different links by different hosts, the same
- link-local host name may validly be in use simultaneously on
- different links, and this is not an error. A multi-homed host with
- connections to two different links may be able to communicate with
- two different hosts that are validly using the same name. While this
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 30]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- kind of name duplication should be rare, it means that a host that
- wants to fully support this case needs network programming APIs that
- allow applications to specify on what interface to perform a
- link-local Multicast DNS query, and to discover on what interface a
- Multicast DNS response was received.
-
-
-16. Multicast DNS and Power Management
-
- Many modern network devices have the ability to go into a low-power
- mode where only a small part of the Ethernet hardware remains
- powered, and the device can be woken up by sending a specially
- formatted Ethernet frame which the device's power-management hardware
- recognizes.
-
- To make use of this in conjunction with Multicast DNS, the device
- first uses DNS-SD to determine if Sleep Proxy Service is available on
- the local network. In some networks there may be more than one piece
- of hardware implementing Sleep Proxy Service, for fault-tolerance
- reasons.
-
- If the device finds the network has Sleep Proxy Service, the device
- transmits two or more gratuitous mDNS announcements setting the TTL
- of its relevant resource records to zero, to delete them from
- neighbouring caches. The relevant resource records include address
- records and SRV records, and other resource records as may apply to a
- particular device. The device then communicates all of its remaining
- active records, plus the names, types and classes of the deleted
- records, to the Sleep Proxy Service(s), along with a copy of the
- specific "magic packet" required to wake the device up.
-
- When a Sleep Proxy Service sees an mDNS query for one of the
- device's active records (e.g. a DNS-SD PTR record), it answers on
- behalf of the device without waking it up. When a Sleep Proxy Service
- sees an mDNS query for one of the device's deleted resource
- records, it deduces that some client on the network needs to make an
- active connection to the device, and sends the specified "magic
- packet" to wake the device up. The device then wakes up, reactivates
- its deleted resource records, and re-announces them to the network.
- The client waiting to connect sees the announcements, learns the
- current IP address and port number of the desired service on the
- device, and proceeds to connect to it.
-
- The connecting client does not need to be aware of how Sleep Proxy
- Service works. Only devices that implement low power mode and wish to
- make use of Sleep Proxy Service need to be aware of how that protocol
- works.
-
- The reason that a device using a Sleep Proxy Service should send more
- than one goodbye packet is that the wakeup message is caused by the
- Sleep Proxy Service seeing queries for the device's SRV and/or
- address records, and those queries are in turn caused by the records
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 31]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- being absent from peer caches. If the records are not deleted from
- peer caches, then those peers may use the cached value directly
- without querying, and no wakeup message would be generated.
-
- The full specification of mDNS / DNS-SD Sleep Proxy Service
- is described in another document [not yet published].
-
-
-17. Multicast DNS Character Set
-
- Unicast DNS has been plagued by the lack of any support for non-US
- characters. Indeed, conventional DNS is usually limited to just
- letters, digits and hyphens, with no spaces or other punctuation.
- Attempts to remedy this have made slow progress because of the need
- to accommodate old buggy legacy implementations.
-
- Multicast DNS is a new protocol and doesn't (yet) have old buggy
- legacy implementations to constrain the design choices. Accordingly,
- it adopts the obvious simple solution: all names in Multicast DNS are
- encoded using UTF-8 [RFC 2279]. For names that are restricted to
- letters, digits and hyphens, the UTF-8 encoding is identical to the
- US-ASCII encoding, so this is entirely compatible with existing host
- names. For characters outside the US-ASCII range, UTF-8 encoding is
- used.
-
- Multicast DNS implementations MUST NOT use any other encodings apart
- from UTF-8 (US-ASCII being considered a compatible subset of UTF-8).
-
- This point bears repeating: There are various baroque representations
- of international text being proposed for Unicast DNS. None of these
- representations may be used in Multicast DNS packets. Any text being
- represented internally in some other representation MUST be converted
- to canonical UTF-8 before being placed in any Multicast DNS packet.
-
- The simple rules for case-insensitivity in Unicast DNS also apply in
- Multicast DNS; that is to say, in name comparisons, the lower-case
- letters "a" to "z" match their upper-case equivalents "A" to "Z".
- Hence, if a client issues a query for an address record with the name
- "stuartcheshire.local", then a responder having an address record
- with the name "StuartCheshire.local" should issue a response.
-
- No other automatic character equivalence is defined in Multicast DNS.
- For example, accented characters are not defined to be automatically
- equivalent to their unaccented counterparts. Where automatic
- equivalences are desired, this may be achieved through the use of
- programmatically-generated CNAME records. For example, if a responder
- has an address record for an accented name Y, and a client issues a
- query for a name X, where X is the same as Y with all the accents
- removed, then the responder may issue a response containing two
- resource records: A CNAME record "X CNAME Y", asserting that the
- requested name X (unaccented) is an alias for the true (accented)
- name Y, followed by the address record for Y.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 32]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-18. Multicast DNS Message Size
-
- RFC 1035 restricts DNS Messages carried by UDP to no more than 512
- bytes (not counting the IP or UDP headers). For UDP packets carried
- over the wide-area Internet in 1987, this was appropriate. For
- link-local multicast packets on today's networks, there is no reason
- to retain this restriction. Given that the packets are by definition
- link-local, there are no Path MTU issues to consider.
-
- Multicast DNS Messages carried by UDP may be up to the IP MTU of the
- physical interface, less the space required for the IP header (20
- bytes for IPv4; 40 bytes for IPv6) and the UDP header (8 bytes).
-
- In the case of a single mDNS Resource Record which is too large to
- fit in a single MTU-sized multicast response packet, a Multicast DNS
- Responder SHOULD send the Resource Record alone, in a single IP
- datagram, sent using multiple IP fragments. Resource Records this
- large SHOULD be avoided, except in the very rare cases where they
- really are the appropriate solution to the problem at hand.
- Implementers should be aware that many simple devices do not
- re-assemble fragmented IP datagrams, so large Resource Records SHOULD
- only be used in specialized cases where the implementer knows that
- all receivers implement reassembly.
-
- A Multicast DNS packet larger than the interface MTU, which is sent
- using fragments, MUST NOT contain more than one Resource Record.
-
- Even when fragmentation is used, a Multicast DNS packet, including IP
- and UDP headers, MUST NOT exceed 9000 bytes.
-
-
-19. Multicast DNS Message Format
-
- This section describes specific restrictions on the allowable
- values for the header fields of a Multicast DNS message.
-
-19.1. ID (Query Identifier)
-
- Multicast DNS clients SHOULD listen for gratuitous responses
- issued by hosts booting up (or waking up from sleep or otherwise
- joining the network). Since these gratuitous responses may contain a
- useful answer to a question for which the client is currently
- awaiting an answer, Multicast DNS clients SHOULD examine all received
- Multicast DNS response messages for useful answers, without regard to
- the contents of the ID field or the question section. In Multicast
- DNS, knowing which particular query message (if any) is responsible
- for eliciting a particular response message is less interesting than
- knowing whether the response message contains useful information.
-
- Multicast DNS clients MAY cache any or all Multicast DNS response
- messages they receive, for possible future use, providing of course
- that normal TTL aging is performed on these cashed resource records.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 33]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- In multicast query messages, the Query ID SHOULD be set to zero on
- transmission.
-
- In multicast responses, including gratuitous multicast responses, the
- Query ID MUST be set to zero on transmission, and MUST be ignored on
- reception.
-
- In unicast response messages generated specifically in response to a
- particular (unicast or multicast) query, the Query ID MUST match the
- ID from the query message.
-
-
-19.2. QR (Query/Response) Bit
-
- In query messages, MUST be zero.
-
- In response messages, MUST be one.
-
-
-19.3. OPCODE
-
- In both multicast query and multicast response messages, MUST be zero
- (only standard queries are currently supported over multicast, unless
- other queries are allowed by future IETF Standards Action).
-
-
-19.4. AA (Authoritative Answer) Bit
-
- In query messages, the Authoritative Answer bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages for Multicast Domains, the Authoritative Answer
- bit MUST be set to one (not setting this bit implies there's some
- other place where "better" information may be found) and MUST be
- ignored on reception.
-
-
-19.5. TC (Truncated) Bit
-
- In query messages, if the TC bit is set, it means that additional
- Known Answer records may be following shortly. A responder MAY choose
- to record this fact, and wait for those additional Known Answer
- records, before deciding whether to respond. If the TC bit is clear,
- it means that the querying host has no additional Known Answers.
-
- In multicast response messages, the TC bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In legacy unicast response messages, the TC bit has the same meaning
- as in conventional unicast DNS: it means that the response was too
- large to fit in a single packet, so the client SHOULD re-issue its
- query using TCP in order to receive the larger response.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 34]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-19.6. RD (Recursion Desired) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Desired bit SHOULD be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.7. RA (Recursion Available) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Available bit MUST be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.8. Z (Zero) Bit
-
- In both query and response messages, the Zero bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.9. AD (Authentic Data) Bit [RFC 2535]
-
- In query messages the Authentic Data bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages, the Authentic Data bit MAY be set. Resolvers
- receiving response messages with the AD bit set MUST NOT trust the AD
- bit unless they trust the source of the message and either have a
- secure path to it or use DNS transaction security.
-
-
-19.10. CD (Checking Disabled) Bit [RFC 2535]
-
- In query messages, a resolver willing to do cryptography SHOULD set
- the Checking Disabled bit to permit it to impose its own policies.
-
- In response messages, the Checking Disabled bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.11. RCODE (Response Code)
-
- In both multicast query and multicast response messages, the Response
- Code MUST be zero on transmission. Multicast DNS messages received
- with non-zero Response Codes MUST be silently ignored.
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 35]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-20. Choice of UDP Port Number
-
- Arguments were made for and against using Multicast on UDP port 53.
- The final decision was to use UDP port 5353. Some of the arguments
- for and against are given below.
-
-
-20.1 Arguments for using UDP port 53:
-
- * This is "just DNS", so it should be the same port.
-
- * There is less work to be done updating old clients to do simple
- mDNS queries. Only the destination address need be changed.
- In some cases, this can be achieved without any code changes,
- just by adding the address 224.0.0.251 to a configuration file.
-
-
-20.2 Arguments for using a different port (UDP port 5353):
-
- * This is not "just DNS". This is a DNS-like protocol, but different.
-
- * Changing client code to use a different port number is not hard.
-
- * Using the same port number makes it hard to run an mDNS Responder
- and a conventional unicast DNS server on the same machine. If a
- conventional unicast DNS server wishes to implement mDNS as well,
- it can still do that, by opening two sockets. Having two different
- port numbers is important to allow this flexibility.
-
- * Some VPN software hijacks all outgoing traffic to port 53 and
- redirects it to a special DNS server set up to serve those VPN
- clients while they are connected to the corporate network. It is
- questionable whether this is the right thing to do, but it is
- common, and redirecting link-local multicast DNS packets to a
- remote server rarely produces any useful results. It does mean, for
- example, that the user becomes unable to access their local network
- printer sitting on their desk right next to their computer. Using
- a different UDP port eliminates this particular problem.
-
- * On many operating systems, unprivileged clients may not send or
- receive packets on low-numbered ports. This means that any client
- sending or receiving mDNS packets on port 53 would have to run as
- "root", which is an undesirable security risk. Using a higher-
- numbered UDP port eliminates this particular problem.
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 36]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-21. Summary of Differences Between Multicast DNS and Unicast DNS
-
- The value of Multicast DNS is that it shares, as much as possible,
- the familiar APIs, naming syntax, resource record types, etc., of
- Unicast DNS. There are of course necessary differences by virtue of
- it using Multicast, and by virtue of it operating in a community of
- cooperating peers, rather than a precisely defined authoritarian
- hierarchy controlled by a strict chain of formal delegations from the
- top. These differences are listed below:
-
- Multicast DNS...
- * uses multicast
- * uses UDP port 5353 instead of port 53
- * operates in well-defined parts of the DNS namespace
- * uses UTF-8, and only UTF-8, to encode resource record names
- * defines a clear limit on the maximum legal domain name (255 bytes)
- * allows larger UDP packets
- * allows more than one question in a query packet
- * uses the Answer Section of a query to list Known Answers
- * uses the TC bit in a query to indicate additional Known Answers
- * uses the Authority Section of a query for probe tie-breaking
- * ignores the Query ID field (except for generating legacy responses)
- * doesn't require the question to be repeated in the response packet
- * uses gratuitous responses to announce new records to the peer group
- * defines a "unicast response" bit in the rrclass of query questions
- * defines a "cache flush" bit in the rrclass of responses
- * uses DNS TTL 0 to indicate that a record has been deleted
- * uses IP TTL 255 to verify that answers originated on the local link
- * monitors queries to perform Duplicate Question Suppression
- * monitors responses to perform Duplicate Answer Suppression...
- * ... and Ongoing Conflict Detection
- * ... and Opportunistic Caching
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 37]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-22. Benefits of Multicast Responses
-
- Some people have argued that sending responses via multicast is
- inefficient on the network. In fact the benefits of using multicast
- responses result in a net lowering of overall multicast traffic, for
- a variety of reasons.
-
- * One multicast response can update the cache on all machines on the
- network. If another machine later wants to issue the same query, it
- already has the answer in its cache, so it may not need to even
- transmit that multicast query on the network at all.
-
- * When more than one machine has the same ongoing long-lived query
- running, every machine does not have to transmit its own
- independent query. When one machine transmits a query, all the
- other hosts see the answers, so they can suppress their own
- queries.
-
- * When a host sees a multicast query, but does not see the
- corresponding multicast response, it can use this information to
- promptly delete stale data from its cache. To achieve the same
- level of user-interface quality and responsiveness without
- multicast responses would require lower cache lifetimes and more
- frequent network polling, resulting in a significantly higher
- packet rate.
-
- * Multicast responses allow passive conflict detection. Without this
- ability, some other conflict detection mechanism would be needed,
- imposing its own additional burden on the network.
-
- * When using delayed responses to reduce network collisions, clients
- need to maintain a list recording to whom each answer should be
- sent. The option of multicast responses allows clients with limited
- storage, which cannot store an arbitrarily long list of response
- addresses, to choose to fail-over to a single multicast response in
- place of multiple unicast respones, when appropriate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 38]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-23. IPv6 Considerations
-
- An IPv4-only host and an IPv6-only host behave as "ships that pass in
- the night". Even if they are on the same Ethernet, neither is aware
- of the other's traffic. For this reason, each physical link may have
- *two* unrelated ".local." zones, one for IPv4 and one for IPv6.
- Since for practical purposes, a group of IPv4-only hosts and a group
- of IPv6-only hosts on the same Ethernet act as if they were on two
- entirely separate Ethernet segments, it is unsurprising that their
- use of the ".local." zone should occur exactly as it would if
- they really were on two entirely separate Ethernet segments.
-
- A dual-stack (v4/v6) host can participate in both ".local."
- zones, and should register its name(s) and perform its lookups both
- using IPv4 and IPv6. This enables it to reach, and be reached by,
- both IPv4-only and IPv6-only hosts. In effect this acts like a
- multi-homed host, with one connection to the logical "IPv4 Ethernet
- segment", and a connection to the logical "IPv6 Ethernet segment".
-
-23.1 IPv6 Multicast Addresses by Hashing
-
- Some discovery protocols use a range of multicast addresses, and
- determine the address to be used by a hash function of the name being
- sought. Queries are sent via multicast to the address as indicated by
- the hash function, and responses are returned to the querier via
- unicast. Particularly in IPv6, where multicast addresses are
- extremely plentiful, this approach is frequently advocated.
-
- There are some problems with this:
-
- * When a host has a large number of records with different names, the
- host may have to join a large number of multicast groups. This can
- place undue burden on the Ethernet hardware, which typically
- supports a limited number of multicast addresses efficiently. When
- this number is exceeded, the Ethernet hardware may have to resort
- to receiving all multicasts and passing them up to the host
- software for filtering, thereby defeating the point of using a
- multicast address range in the first place.
-
- * Multiple questions cannot be placed in one packet if they don't all
- hash to the same multicast address.
-
- * Duplicate Question Suppression doesn't work if queriers are not
- seeing each other's queries.
-
- * Duplicate Answer Suppression doesn't work if responders are not
- seeing each other's responses.
-
- * Opportunistic Caching doesn't work.
-
- * Ongoing Conflict Detection doesn't work.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 39]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-24. Security Considerations
-
- The algorithm for detecting and resolving name conflicts is, by its
- very nature, an algorithm that assumes cooperating participants. Its
- purpose is to allow a group of hosts to arrive at a mutually disjoint
- set of host names and other DNS resource record names, in the absence
- of any central authority to coordinate this or mediate disputes. In
- the absence of any higher authority to resolve disputes, the only
- alternative is that the participants must work together cooperatively
- to arrive at a resolution.
-
- In an environment where the participants are mutually antagonistic
- and unwilling to cooperate, other mechanisms are appropriate, like
- manually administered DNS.
-
- In an environment where there is a group of cooperating participants,
- but there may be other antagonistic participants on the same physical
- link, the cooperating participants need to use IPSEC signatures
- and/or DNSSEC [RFC 2535] signatures so that they can distinguish mDNS
- messages from trusted participants (which they process as usual) from
- mDNS messages from untrusted participants (which they silently
- discard).
-
- When DNS queries for *global* DNS names are sent to the mDNS
- multicast address (during network outages which disrupt communication
- with the greater Internet) it is *especially* important to use
- DNSSEC, because the user may have the impression that he or she is
- communicating with some authentic host, when in fact he or she is
- really communicating with some local host that is merely masquerading
- as that name. This is less critical for names ending with ".local.",
- because the user should be aware that those names have only local
- significance and no global authority is implied.
-
- Most computer users neglect to type the trailing dot at the end of a
- fully qualified domain name, making it a relative domain name (e.g.
- "www.example.com"). In the event of network outage, attempts to
- positively resolve the name as entered will fail, resulting in
- application of the search list, including ".local.", if present.
- A malicious host could masquerade as "www.example.com" by answering
- the resulting Multicast DNS query for "www.example.com.local."
- To avoid this, a host MUST NOT append the search suffix
- ".local.", if present, to any relative (partially qualified)
- domain name containing two or more labels. Appending ".local." to
- single-label relative domain names is acceptable, since the user
- should have no expectation that a single-label domain name will
- resolve as-is.
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 40]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-25. IANA Considerations
-
- The IANA has allocated the IPv4 link-local multicast address
- 224.0.0.251 for the use described in this document.
-
- The IANA has allocated the IPv6 multicast address set FF0X::FB
- for the use described in this document.
-
- When this document is published, IANA should designate a list
- of domains which are deemed to have only link-local significance,
- as described in this document.
-
- No other IANA services are required by this document.
-
-
-26. Acknowledgements
-
- The concepts described in this document have been explored and
- developed with help from Erik Guttman, Paul Vixie, Bill Woodcock,
- and others.
-
-
-27. Copyright
-
- Copyright (C) The Internet Society January 2004.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 41]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-28. Normative References
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
-
-29. Informative References
-
- [dotlocal] <http://www.dotlocal.org/>
-
- [djbdl] <http://cr.yp.to/djbdns/dot-local.html>
-
- [DNS-SD] Cheshire, S., and M. Krochmal, "DNS-Based Service
- Discovery", Internet-Draft (work in progress),
- draft-cheshire-dnsext-dns-sd-02.txt, February 2004.
-
- [IEEE802] IEEE Standards for Local and Metropolitan Area Networks:
- Overview and Architecture.
- Institute of Electrical and Electronic Engineers,
- IEEE Standard 802, 1990.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-03.txt, February 2004.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2462] S. Thomson and T. Narten, "IPv6 Stateless Address
- Autoconfiguration", RFC 2462, December 1998.
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [v4LL] Cheshire, S., B. Aboba, and E. Guttman, "Dynamic
- Configuration of IPv4 Link-Local Addresses",
- Internet-Draft (work in progress),
- draft-ietf-zeroconf-ipv4-linklocal-11.txt, January 2004.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 42]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-30. Author's Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 43] \ No newline at end of file
diff --git a/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-05.txt b/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-05.txt
deleted file mode 100644
index 0e2be99..0000000
--- a/release-0.6.9/specs/draft-cheshire-dnsext-multicastdns-05.txt
+++ /dev/null
@@ -1,2640 +0,0 @@
-Document: draft-cheshire-dnsext-multicastdns-05.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 7th December 2005 Marc Krochmal
- Apple Computer, Inc.
- 7th June 2005
-
- Multicast DNS
-
- <draft-cheshire-dnsext-multicastdns-05.txt>
-
-
-Status of this Memo
-
- By submitting this Internet-Draft, each author represents
- that any applicable patent or other IPR claims of which he or she is
- aware have been or will be disclosed, and any of which he or she
- become aware will be disclosed, in accordance with RFC 3979.
-
- Internet-Drafts are working documents of the Internet Engineering
- Task Force (IETF), its areas, and its working groups. Note that
- other groups may also distribute working documents as
- Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six months
- and may be updated, replaced, or obsoleted by other documents at any
- time. It is inappropriate to use Internet-Drafts as reference
- material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt.
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html.
-
-
-Abstract
-
- As networked devices become smaller, more portable, and more
- ubiquitous, the ability to operate with less configured
- infrastructure is increasingly important. In particular, the ability
- to look up DNS resource record data types (including, but not limited
- to, host names) in the absence of a conventional managed DNS server,
- is becoming essential.
-
- Multicast DNS (mDNS) provides the ability to do DNS-like operations
- on the local link in the absence of any conventional unicast DNS
- server. In addition, mDNS designates a portion of the DNS namespace
- to be free for local use, without the need to pay any annual fee, and
- without the need to set up delegations or otherwise configure a
- conventional DNS server to answer for those names.
-
- The primary benefits of mDNS names are that (i) they require little
- or no administration or configuration to set them up, (ii) they work
- when no infrastructure is present, and (iii) they work during
- infrastructure failures.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 1]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-Table of Contents
-
- 1. Introduction...................................................3
- 2. Conventions and Terminology Used in this Document..............4
- 3. Multicast DNS Names............................................5
- 4. Source Address Check...........................................8
- 5. Reverse Address Mapping........................................9
- 6. Querying.......................................................9
- 7. Duplicate Suppression.........................................13
- 8. Responding....................................................15
- 9. Probing and Announcing on Startup.............................18
- 10. Conflict Resolution...........................................22
- 11. Resource Record TTL Values and Cache Coherency................23
- 12. Special Characteristics of Multicast DNS Domains..............28
- 13. Multicast DNS for Service Discovery...........................30
- 14. Enabling and Disabling Multicast DNS..........................30
- 15. Considerations for Multiple Interfaces........................30
- 16. Multicast DNS and Power Management............................31
- 17. Multicast DNS Character Set...................................32
- 18. Multicast DNS Message Size....................................34
- 19. Multicast DNS Message Format..................................34
- 20. Choice of UDP Port Number.....................................37
- 21. Summary of Differences Between Multicast DNS and Unicast DNS..38
- 22. Benefits of Multicast Responses...............................38
- 23. IPv6 Considerations...........................................39
- 24. Security Considerations.......................................40
- 25. IANA Considerations...........................................41
- 26. Acknowledgments...............................................42
- 27. Copyright.....................................................42
- 28. Normative References..........................................42
- 29. Informative References........................................43
- 30. Authors' Addresses............................................44
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 2]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-1. Introduction
-
- When reading this document, familiarity with the concepts of Zero
- Configuration Networking [ZC] and automatic link-local addressing
- [RFC 2462] [RFC 3927] is helpful.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, or resource record types.
- This document simply discusses what needs to happen if DNS clients
- start sending DNS queries to a multicast address, and how a
- collection of hosts can cooperate to collectively answer those
- queries in a useful manner.
-
- There has been discussion of how much burden Multicast DNS might
- impose on a network. It should be remembered that whenever IPv4 hosts
- communicate, they broadcast ARP packets on the network on a regular
- basis, and this is not disastrous. The approximate amount of
- multicast traffic generated by hosts making conventional use of
- Multicast DNS is anticipated to be roughly the same order of
- magnitude as the amount of broadcast ARP traffic those hosts already
- generate.
-
- New applications making new use of Multicast DNS capabilities for
- unconventional purposes may generate more traffic. If some of those
- new applications are "chatty", then work will be needed to help them
- become less chatty. When performing any analysis, it is important to
- make a distinction between the application behavior and the
- underlying protocol behavior. If a chatty application uses UDP, that
- doesn't mean that UDP is chatty, or that IP is chatty, or that
- Ethernet is chatty. What it means is that the application is chatty.
- The same applies to any future applications that may decide to layer
- increasing portions of their functionality over Multicast DNS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 3]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
- This document uses the term "host name" in the strict sense to mean a
- fully qualified domain name that has an address record. It does not
- use the term "host name" in the commonly used but incorrect sense to
- mean just the first DNS label of a host's fully qualified domain
- name.
-
- A DNS (or mDNS) packet contains an IP TTL in the IP header, which
- is effectively a hop-count limit for the packet, to guard against
- routing loops. Each Resource Record also contains a TTL, which is
- the number of seconds for which the Resource Record may be cached.
-
- In any place where there may be potential confusion between these two
- types of TTL, the term "IP TTL" is used to refer to the IP header TTL
- (hop limit), and the term "RR TTL" is used to refer to the Resource
- Record TTL (cache lifetime).
-
- When this document uses the term "Multicast DNS", it should be taken
- to mean: "Clients performing DNS-like queries for DNS-like resource
- records by sending DNS-like UDP query and response packets over IP
- Multicast to UDP port 5353."
-
- This document uses the terms "shared" and "unique" when referring to
- resource record sets.
-
- A "shared" resource record set is one where several Multicast DNS
- responders may have records with that name, rrtype, and rrclass, and
- several responders may respond to a particular query.
-
- A "unique" resource record set is one where all the records with that
- name, rrtype, and rrclass are under the control or ownership of a
- single responder, and at most one responder should respond to any
- given query. Before claiming ownership of a unique resource record
- set, a responder MUST probe to verify that no other responder
- already claims ownership of that set, as described in Section 9.1
- "Probing".
-
- Strictly speaking the terms "shared" and "unique" apply to resource
- record sets, not to individual resource records, but it is sometimes
- convenient to talk of "shared resource records" and "unique resource
- records". When used this way, the terms should be understood to mean
- a record that is a member of a "shared" or "unique" resource record
- set, respectively.
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 4]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-3. Multicast DNS Names
-
- This document proposes that the DNS top-level domain ".local." be
- designated a special domain with special semantics, namely that any
- fully-qualified name ending in ".local." is link-local, and names
- within this domain are meaningful only on the link where they
- originate. This is analogous to IPv4 addresses in the 169.254/16
- prefix, which are link-local and meaningful only on the link where
- they originate.
-
- Any DNS query for a name ending with ".local." MUST be sent
- to the mDNS multicast address (224.0.0.251 or its IPv6 equivalent
- FF02::FB).
-
- It is unimportant whether a name ending with ".local." occurred
- because the user explicitly typed in a fully qualified domain name
- ending in ".local.", or because the user entered an unqualified
- domain name and the host software appended the suffix ".local."
- because that suffix appears in the user's search list. The ".local."
- suffix could appear in the search list because the user manually
- configured it, or because it was received in a DHCP option, or via
- any other valid mechanism for configuring the DNS search list. In
- this respect the ".local." suffix is treated no differently to any
- other search domain that might appear in the DNS search list.
-
- DNS queries for names that do not end with ".local." MAY be sent to
- the mDNS multicast address, if no other conventional DNS server is
- available. This can allow hosts on the same link to continue
- communicating using each other's globally unique DNS names during
- network outages which disrupt communication with the greater
- Internet. When resolving global names via local multicast, it is even
- more important to use DNSSEC or other security mechanisms to ensure
- that the response is trustworthy. Resolving global names via local
- multicast is a contentious issue, and this document does not discuss
- it in detail, instead concentrating on the issue of resolving local
- names using DNS packets sent to a multicast address.
-
- A host which belongs to an organization or individual who has control
- over some portion of the DNS namespace can be assigned a globally
- unique name within that portion of the DNS namespace, for example,
- "cheshire.apple.com." For those of us who have this luxury, this
- works very well. However, the majority of home customers do not have
- easy access to any portion of the global DNS namespace within which
- they have the authority to create names as they wish. This leaves the
- majority of home computers effectively anonymous for practical
- purposes.
-
- To remedy this problem, this document allows any computer user to
- elect to give their computers link-local Multicast DNS host names of
- the form: "single-dns-label.local." For example, a laptop computer
- may answer to the name "cheshire.local." Any computer user is granted
- the authority to name their computer this way, provided that the
- chosen host name is not already in use on that link. Having named
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 5]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- their computer this way, the user has the authority to continue using
- that name until such time as a name conflict occurs on the link which
- is not resolved in the user's favour. If this happens, the computer
- (or its human user) SHOULD cease using the name, and may choose to
- attempt to allocate a new unique name for use on that link. These
- conflicts are expected to be relatively rare for people who choose
- reasonably imaginative names, but it is still important to have a
- mechanism in place to handle them when they happen.
-
- The point made in the previous paragraph is very important and bears
- repeating. It is easy for those of us in the IETF community who run
- our own name servers at home to forget that the majority of computer
- users do not run their own name server and have no easy way to create
- their own host names. When these users wish to transfer files between
- two laptop computers, they are frequently reduced to typing in
- dotted-decimal IP addresses because they simply have no other way for
- one host to refer to the other by name. This is a sorry state of
- affairs. What is worse, most users don't even bother trying to use
- dotted-decimal IP addresses. Most users still move data between
- machines by copying it onto a floppy disk or similar removable media.
-
- In a world of gigabit Ethernet and ubiquitous wireless networking it
- is a sad indictment of the networking community that the preferred
- communication medium for most computer users is still the floppy
- disk.
-
- Allowing ad-hoc allocation of single-label names in a single flat
- ".local." namespace may seem to invite chaos. However, operational
- experience with AppleTalk NBP names [NBP], which on any given link
- are also effectively single-label names in a flat namespace, shows
- that in practice name collisions happen extremely rarely and are not
- a problem. Groups of computer users from disparate organizations
- bring Macintosh laptop computers to events such as IETF Meetings, the
- Mac Hack conference, the Apple World Wide Developer Conference, etc.,
- and complaints at these events about users suffering conflicts and
- being forced to rename their machines have never been an issue.
-
- Enforcing uniqueness of host names (i.e. the names of DNS address
- records mapping names to IP addresses) is probably desirable in the
- common case, but this document does not mandate that. It is
- permissible for a collection of coordinated hosts to agree to
- maintain multiple DNS address records with the same name, possibly
- for load balancing or fault-tolerance reasons. This document does not
- take a position on whether that is sensible. It is important that
- both modes of operation are supported. The Multicast DNS protocol
- allows hosts to verify and maintain unique names for resource records
- where that behavior is desired, and it also allows hosts to maintain
- multiple resource records with a single shared name where that
- behavior is desired. This consideration applies to all resource
- records, not just address records (host names). In summary: It is
- required that the protocol have the ability to detect and handle name
- conflicts, but it is not required that this ability be used for every
- record.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 6]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-3.1 Governing Standards Body
-
- Note that this use of the ".local." suffix falls under IETF
- jurisdiction, not ICANN jurisdiction. DNS is an IETF network
- protocol, governed by protocol rules defined by the IETF. These IETF
- protocol rules dictate character set, maximum name length, packet
- format, etc. ICANN determines additional rules that apply when the
- IETF's DNS protocol is used on the public Internet. In contrast,
- private uses of the DNS protocol on isolated private networks are not
- governed by ICANN. Since this proposed change is a change to the core
- DNS protocol rules, it affects everyone, not just those machines
- using the ICANN-governed Internet. Hence this change falls into the
- category of an IETF protocol rule, not an ICANN usage rule.
-
-3.2 Private DNS Namespaces
-
- Note also that the special treatment of names ending in ".local." has
- been implemented in Macintosh computers since the days of Mac OS 9,
- and continues today in Mac OS X. There are also implementations for
- Linux and other platforms [dotlocal]. Operators setting up private
- internal networks ("intranets") are advised that their lives may be
- easier if they avoid using the suffix ".local." in names in their
- private internal DNS server. Alternative possibilities include:
-
- .intranet
- .internal
- .private
- .corp
- .home
-
- Another alternative naming scheme, advocated by Professor D. J.
- Bernstein, is to use a numerical suffix, such as ".6." [djbdl].
-
-3.3 Maximum Multicast DNS Name Length
-
- RFC 1034 says:
-
- "the total number of octets that represent a domain name (i.e.,
- the sum of all label octets and label lengths) is limited to 255."
-
- This text implies that the final root label at the end of every name
- is included in this count (a name can't be represented without it),
- but the text does not explicitly state that. Implementations of
- Multicast DNS MUST include the label length byte of the final root
- label at the end of every name when enforcing the rule that no name
- may be longer than 255 bytes. For example, the length of the name
- "apple.com." is considered to be 11, which is the number of bytes it
- takes to represent that name in a packet without using name
- compression:
-
- ------------------------------------------------------
- | 0x05 | a | p | p | l | e | 0x03 | c | o | m | 0x00 |
- ------------------------------------------------------
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 7]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-4. Source Address Check
-
- All Multicast DNS responses (including responses sent via unicast)
- SHOULD be sent with IP TTL set to 255. This is recommended to provide
- backwards-compatibility with older Multicast DNS clients that check
- the IP TTL on reception to determine whether the packet originated
- on the local link. These older clients discard all packets with TTLs
- other than 255.
-
- A host sending Multicast DNS queries to a link-local destination
- address (including the 224.0.0.251 link-local multicast address)
- MUST only accept responses to that query that originate from the
- local link, and silently discard any other response packets. Without
- this check, it could be possible for remote rogue hosts to send
- spoof answer packets (perhaps unicast to the victim host) which the
- receiving machine could misinterpret as having originated on the
- local link.
-
- The test for whether a response originated on the local link
- is done in two ways:
-
- * All responses sent to the link-local multicast address 224.0.0.251
- are necessarily deemed to have originated on the local link,
- regardless of source IP address. This is essential to allow devices
- to work correctly and reliably in unusual configurations, such as
- multiple logical IP subnets overlayed on a single link, or in cases
- of severe misconfiguration, where devices are physically connected
- to the same link, but are currently misconfigured with completely
- unrelated IP addresses and subnet masks.
-
- * For responses sent to a unicast destination address, the source IP
- address in the packet is checked to see if it is an address on a
- local subnet. An address is determined to be on a local subnet if,
- for (one of) the address(es) configured on the interface receiving
- the packet, (I & M) == (P & M), where I and M are the interface
- address and subnet mask respectively, P is the source IP address
- from the packet, '&' represents the bitwise logical 'and'
- operation, and '==' represents a bitwise equality test.
-
- Since queriers will ignore responses apparently originating outside
- the local subnet, responders SHOULD avoid generating responses that
- it can reasonably predict will be ignored. This applies particularly
- in the case of overlayed subnets. If a responder receives a query
- addressed to the link-local multicast address 224.0.0.251, from a
- source address not apparently on the same subnet as the responder,
- then even if the query indicates that a unicast response is preferred
- (see Section 6.5, "Questions Requesting Unicast Responses"), the
- responder SHOULD elect to respond by multicast anyway, since it can
- reasonably predict that a unicast response with an apparently
- non-local source address will probably be ignored.
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 8]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-5. Reverse Address Mapping
-
- Like ".local.", the IPv4 and IPv6 reverse-mapping domains are also
- defined to be link-local.
-
- Any DNS query for a name ending with "254.169.in-addr.arpa." MUST
- be sent to the mDNS multicast address 224.0.0.251. Since names under
- this domain correspond to IPv4 link-local addresses, it is logical
- that the local link is the best place to find information pertaining
- to those names. As an optimization, these queries MAY be first
- unicast directly to the address in question, but if this query is not
- answered, the query MUST also be sent via multicast, to accommodate
- the case where the machine in question is not answering for itself
- (for example, because it is currently sleeping).
-
- Likewise, any DNS query for a name ending with "0.8.e.f.ip6.arpa."
- MUST be sent to the IPv6 mDNS link-local multicast address FF02::FB,
- with or without an optional initial query unicast directly to the
- address in question.
-
-
-6. Querying
-
- There are three kinds of Multicast DNS Queries, one-shot queries of
- the kind made by today's conventional DNS clients, one-shot queries
- accumulating multiple responses made by multicast-aware DNS clients,
- and continuous ongoing Multicast DNS Queries used by IP network
- browser software.
-
- A Multicast DNS Responder that is offering records that are intended
- to be unique on the local link MUST also implement a Multicast DNS
- Querier so that it can first verify the uniqueness of those records
- before it begins answering queries for them.
-
-
-6.1 One-Shot Queries
-
- An unsophisticated DNS client may simply send its DNS queries
- blindly to the 224.0.0.251 multicast address, without necessarily
- even being aware what a multicast address is.
-
- Such an unsophisticated DNS client may not get ideal behavior. Such
- a client may simply take the first response it receives and fail to
- wait to see if there are more, but in many instances this may not be
- a serious problem. If a user types "http://cheshire.local." into
- their Web browser and gets to see the page they were hoping for,
- then the protocol has met the user's needs in this case.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 9]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-6.2 One-Shot Queries, Accumulating Multiple Responses
-
- A more sophisticated DNS client should understand that Multicast DNS
- is not exactly the same as unicast DNS, and should modify its
- behavior in some simple ways.
-
- As described above, there are some cases, such as looking up the
- address associated with a unique host name, where a single response
- is sufficient, and moreover may be all that is expected. However,
- there are other DNS queries where more than one response is
- possible, and for these queries a more sophisticated Multicast DNS
- client should include the ability to wait for an appropriate period
- of time to collect multiple responses.
-
- A naive DNS client retransmits its query only so long as it has
- received no response. A more sophisticated Multicast DNS client is
- aware that having received one response is not necessarily an
- indication that it might not receive others, and has the ability to
- retransmit its query an appropriate number of times at appropriate
- intervals until it is satisfied with the collection of responses it
- has gathered.
-
- A more sophisticated Multicast DNS client that is retransmitting
- a query for which it has already received some responses, MUST
- implement Known Answer Suppression, as described below in Section
- 7.1. This indicates to responders who have already replied that their
- responses have been received, and they don't need to send them again
- in response to this repeated query. In addition, the interval between
- the first two queries SHOULD be one second, and the intervals between
- subsequent queries SHOULD double.
-
-
-6.3 Continuous Querying
-
- In One-Shot Queries, with either a single or multiple responses,
- the underlying assumption is that the transaction begins when the
- application issues a query, and ends when all the desired responses
- have been received. There is another type of operation which is more
- akin to continuous monitoring.
-
- Macintosh users are accustomed to opening the "Chooser" window,
- selecting a desired printer, and then closing the Chooser window.
- However, when the desired printer does not appear in the list, the
- user will typically leave the "Chooser" window open while they go and
- check to verify that the printer is plugged in, powered on, connected
- to the Ethernet, etc. While the user jiggles the wires, hits the
- Ethernet hub, and so forth, they keep an eye on the Chooser window,
- and when the printer name appears, they know they have fixed whatever
- the problem was. This can be a useful and intuitive troubleshooting
- technique, but a user who goes home for the weekend leaving the
- Chooser window open places a non-trivial burden on the network.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 10]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- With continuous querying, multiple queries are sent over a long
- period of time, until the user terminates the operation. It is
- important that an IP network browser window displaying live
- information from the network using Multicast DNS, if left running
- for an extended period of time, should generate significantly less
- multicast traffic on the network than the old AppleTalk Chooser.
- Therefore, the interval between the first two queries SHOULD be one
- second, the intervals between subsequent queries SHOULD double, and
- the querier MUST implement Known Answer Suppression, as described
- below in Section 7.1. When the interval between queries reaches or
- exceeds 60 minutes, a querier MAY cap the interval to a maximum of 60
- minutes, and perform subsequent queries at a steady-state rate of one
- query per hour.
-
- When a Multicast DNS Querier receives an answer, the answer contains
- a TTL value that indicates for how many seconds this answer is valid.
- After this interval has passed, the answer will no longer be valid
- and SHOULD be deleted from the cache. Before this time is reached, a
- Multicast DNS Querier with an ongoing interest in that record SHOULD
- re-issue its query to determine whether the record is still valid,
- and if so update its expiry time.
-
- To perform this cache maintenance, a Multicast DNS Querier should
- plan to re-query for records after at least 50% of the record
- lifetime has elapsed. This document recommends the following
- specific strategy:
-
- The Querier should plan to issue a query at 80% of the record
- lifetime, and then if no answer is received, at 85%, 90% and 95%. If
- an answer is received, then the remaining TTL is reset to the value
- given in the answer, and this process repeats for as long as the
- Multicast DNS Querier has an ongoing interest in the record. If after
- four queries no answer is received, the record is deleted when it
- reaches 100% of its lifetime.
-
- To avoid the case where multiple Multicast DNS Queriers on a network
- all issue their queries simultaneously, a random variation of 2% of
- the record TTL should be added, so that queries are scheduled to be
- performed at 80-82%, 85-87%, 90-92% and then 95-97% of the TTL.
-
-
-6.4 Multiple Questions per Query
-
- Multicast DNS allows a querier to place multiple questions in the
- Question Section of a single Multicast DNS query packet.
-
- The semantics of a Multicast DNS query packet containing multiple
- questions is identical to a series of individual DNS query packets
- containing one question each. Combining multiple questions into a
- single packet is purely an efficiency optimization, and has no other
- semantic significance.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 11]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- A useful technique for adaptively combining multiple questions into a
- single query is to use a Nagle-style algorithm: When a client issues
- its first question, a Query packet is immediately built and sent,
- without delay. If the client then continues issuing a rapid series of
- questions they are held until either the first query receives at
- least one answer, or 100ms has passed, or there are enough questions
- to fill the Question Section of a Multicast DNS query packet. At this
- time, all the held questions are placed into a Multicast DNS query
- packet and sent.
-
-6.5 Questions Requesting Unicast Responses
-
- Sending Multicast DNS responses via multicast has the benefit that
- all the other hosts on the network get to see those responses, and
- can keep their caches up to date, and detect conflicting responses.
-
- However, there are situations where all the other hosts on the
- network don't need to see every response. One example is a laptop
- computer waking from sleep. At that instant it is a brand new
- participant on a new network. Its Multicast DNS cache is empty, and
- it has no knowledge of its surroundings. It may have a significant
- number of queries that it wants answered right away to discover
- information about its new surroundings and present that information
- to the user. As a new participant on the network, it has no idea
- whether the exact same questions may have been asked and answered
- just seconds ago. In this case, trigging a large sudden flood of
- multicast responses may impose an unreasonable burden on the network.
- To avoid this, the Multicast DNS Querier SHOULD set the top bit in
- the class field of its DNS question(s), to indicate that it is
- willing to accept unicast responses instead of the usual multicast
- responses. These questions requesting unicast responses are referred
- to as "QU" questions, to distinguish them from the more usual
- questions requesting multicast responses ("QM" questions).
-
- When retransmitting a question more than once, the 'unicast response'
- bit SHOULD be set only for the first question of the series. After
- the first question has received its responses, the querier should
- have a large known-answer list (see "Known Answer Suppression" below)
- so that subsequent queries should elicit few, if any, further
- responses. Reverting to multicast responses as soon as possible is
- important because of the benefits that multicast responses provide
- (see "Benefits of Multicast Responses" below).
-
- When receiving a question with the 'unicast response' bit set, a
- responder SHOULD usually respond with a unicast packet directed back
- to the querier. If the responder has not multicast that record
- recently (within one quarter of its TTL), then the responder SHOULD
- instead multicast the response so as to keep all the peer caches up
- to date, and to permit passive conflict detection.
-
- Unicast replies are subject to all the same packet generation rules
- as multicast replies, including the cache flush bit (see Section
- 11.3, "Announcements to Flush Outdated Cache Entries") and randomized
- delays to reduce network collisions (see Section 8, "Responding").
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 12]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-6.6 Suppressing Initial Query
-
- If a query is issued for which there already exist one or more
- records in the local cache, and those record(s) were received with
- the cache flush bit set (see Section 11.3, "Announcements to Flush
- Outdated Cache Entries"), indicating that they form a unique RRSet,
- then the host SHOULD suppress its initial "QU" query, and proceed to
- issue a "QM" query. To avoid the situation where a group of hosts
- are synchronized by some external event and all perform the same
- query simultaneously, a host suppressing its initial "QU" query
- SHOULD impose a random delay from 500-1000ms before transmitting its
- first "QM" query for this question. This means that when the first
- host (selected randomly by this algorithm) transmits its "QM" query,
- all the other hosts that were about to transmit the same query can
- suppress their superfluous query, as described in "Duplicate
- Question Suppression" below.
-
-7. Duplicate Suppression
-
- A variety of techniques are used to reduce the amount of redundant
- traffic on the network.
-
-7.1 Known Answer Suppression
-
- When a Multicast DNS Querier sends a query to which it already knows
- some answers, it populates the Answer Section of the DNS message with
- those answers.
-
- A Multicast DNS Responder SHOULD NOT answer a Multicast DNS Query if
- the answer it would give is already included in the Answer Section
- with an RR TTL at least half the correct value. If the RR TTL of the
- answer as given in the Answer Section is less than half of the true
- RR TTL as known by the Multicast DNS Responder, the responder MUST
- send an answer so as to update the Querier's cache before the record
- becomes in danger of expiration.
-
- Because a Multicast DNS Responder will respond if the remaining TTL
- given in the known answer list is less than half the true TTL, it is
- superfluous for the Querier to include such records in the known
- answer list. Therefore a Multicast DNS Querier SHOULD NOT include
- records in the known answer list whose remaining TTL is less than
- half their original TTL. Doing so would simply consume space in the
- packet without achieving the goal of suppressing responses, and would
- therefore be a pointless waste of network bandwidth.
-
- A Multicast DNS Querier MUST NOT cache resource records observed in
- the Known Answer Section of other Multicast DNS Queries. The Answer
- Section of Multicast DNS Queries is not authoritative. By placing
- information in the Answer Section of a Multicast DNS Query the
- querier is stating that it *believes* the information to be true.
- It is not asserting that the information *is* true. Some of those
- records may have come from other hosts that are no longer on the
- network. Propagating that stale information to other Multicast DNS
- Queriers on the network would not be helpful.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 13]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-7.2 Multi-Packet Known Answer Suppression
-
- Sometimes a Multicast DNS Querier will already have too many answers
- to fit in the Known Answer Section of its query packets. In this
- case, it should issue a Multicast DNS Query containing a question and
- as many Known Answer records as will fit. It MUST then set the TC
- (Truncated) bit in the header before sending the Query. It MUST then
- immediately follow the packet with another query packet containing no
- questions, and as many more Known Answer records as will fit. If
- there are still too many records remaining to fit in the packet, it
- again sets the TC bit and continues until all the Known Answer
- records have been sent.
-
- A Multicast DNS Responder seeing a Multicast DNS Query with the TC
- bit set defers its response for a time period randomly selected in
- the interval 400-500ms. This gives the Multicast DNS Querier time to
- send additional Known Answer packets before the Responder responds.
- If the Responder sees any of its answers listed in the Known Answer
- lists of subsequent packets from the querying host, it SHOULD delete
- that answer from the list of answers it is planning to give, provided
- that no other host on the network is also waiting to receive the same
- answer record.
-
- Previous versions of this draft specified a delay of 20-120ms before
- answering queries with multi-packet Known Answer lists. However,
- operational experience showed that, while this works well on
- Ethernet, on very busy 802.11 networks, it is not uncommon to observe
- consecutively sent packets arriving separated by as much as
- 200-400ms.
-
-
-7.3 Duplicate Question Suppression
-
- If a host is planning to send a query, and it sees another host on
- the network send a query containing the same question, and the Known
- Answer Section of that query does not contain any records which this
- host would not also put in its own Known Answer Section, then this
- host should treat its own query as having been sent. When multiple
- clients on the network are querying for the same resource records,
- there is no need for them to all be repeatedly asking the same
- question.
-
-
-7.4 Duplicate Answer Suppression
-
- If a host is planning to send an answer, and it sees another host on
- the network send a response packet containing the same answer record,
- and the TTL in that record is not less than the TTL this host would
- have given, then this host should treat its own answer as having been
- sent. When multiple responders on the network have the same data,
- there is no need for all of them to respond.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 14]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- This feature is particularly useful when multiple Sleep Proxy Servers
- are deployed (see Section 16, "Multicast DNS and Power Management").
- In the future it is possible that every general-purpose OS (Mac,
- Windows, Linux, etc.) will implement Sleep Proxy Service as a matter
- of course. In this case there could be a large number of Sleep Proxy
- Servers on any given network, which is good for reliability and
- fault-tolerance, but would be bad for the network if every Sleep
- Proxy Server were to answer every query.
-
-
-8. Responding
-
- When a Multicast DNS Responder constructs and sends a Multicast DNS
- response packet, the Answer Section of that packet must contain only
- records for which that Responder is explicitly authoritative. These
- answers may be generated because the record answers a question
- received in a Multicast DNS query packet, or at certain other times
- that the responder determines than an unsolicited announcement is
- warranted. A Multicast DNS Responder MUST NOT place records from its
- cache, which have been learned from other responders on the network,
- in the Answer Section of outgoing response packets. Only an
- authoritative source for a given record is allowed to issue responses
- containing that record.
-
- The determination of whether a given record answers a given question
- is done using the standard DNS rules: The record name must match the
- question name, the record rrtype must match the question qtype
- (unless the qtype is "ANY"), and the record rrclass must match the
- question qclass (unless the qclass is "ANY").
-
- A Multicast DNS Responder MUST only respond when it has a positive
- non-null response to send. Error responses must never be sent. The
- non-existence of any name in a Multicast DNS Domain is ascertained by
- the failure of any machine to respond to the Multicast DNS query, not
- by NXDOMAIN errors.
-
- Multicast DNS Responses MUST NOT contain any questions in the
- Question Section. Any questions in the Question Section of a received
- Multicast DNS Response MUST be silently ignored. Multicast DNS
- Queriers receiving Multicast DNS Responses do not care what question
- elicited the response; they care only that the information in the
- response is true and accurate.
-
- A Multicast DNS Responder on Ethernet [IEEE802] and similar shared
- multiple access networks SHOULD have the capability of delaying its
- responses by up to 500ms, as determined by the rules described below.
- If multiple Multicast DNS Responders were all to respond immediately
- to a particular query, a collision would be virtually guaranteed. By
- imposing a small random delay, the number of collisions is
- dramatically reduced. On a full-sized Ethernet using the maximum
- cable lengths allowed and the maximum number of repeaters allowed, an
- Ethernet frame is vulnerable to collisions during the transmission of
- its first 256 bits. On 10Mb/s Ethernet, this equates to a vulnerable
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 15]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- time window of 25.6us. On higher-speed variants of Ethernet, the
- vulnerable time window is shorter.
-
- In the case where a Multicast DNS Responder has good reason to
- believe that it will be the only responder on the link with a
- positive non-null response, it SHOULD NOT impose any random delay
- before responding, and SHOULD normally generate its response within
- at most 10ms. In particular, this applies to responding to probe
- queries. Since receiving a probe query gives a clear indication that
- some other Responder is planning to start using this name in the very
- near future, answering such probe queries to defend a unique record
- is a high priority and needs to be done immediately, without delay. A
- probe query can be distinguished from a normal query by the fact that
- a probe query contains a proposed record in the Authority Section
- which answers the question in the Question Section (for more details,
- see Section 9.1, "Probing").
-
- To generate immediate responses safely, it MUST have previously
- verified that the requested name, rrtype and rrclass in the DNS query
- are unique on this link. Responding immediately without delay is
- appropriate for things like looking up the address record for a
- particular host name, when the host name has been previously verified
- unique. Responding immediately without delay is *not* appropriate for
- things like looking up PTR records used for DNS Service Discovery
- [DNS-SD], where a large number of responses may be anticipated.
-
- In any case where there may be multiple responses, such as queries
- where the answer is a member of a shared resource record set, each
- responder SHOULD delay its response by a random amount of time
- selected with uniform random distribution in the range 20-120ms.
-
- In the case where the query has the TC (truncated) bit set,
- indicating that subsequent known answer packets will follow,
- responders SHOULD delay their responses by a random amount of time
- selected with uniform random distribution in the range 400-500ms,
- to allow enough time for all the known answer packets to arrive.
-
- Except when a unicast reply has been explicitly requested via the
- "unicast reply" bit, Multicast DNS Responses MUST be sent to UDP port
- 5353 (the well-known port assigned to mDNS) on the 224.0.0.251
- multicast address (or its IPv6 equivalent FF02::FB). Operating in a
- Zeroconf environment requires constant vigilance. Just because a name
- has been previously verified unique does not mean it will continue to
- be so indefinitely. By allowing all Multicast DNS Responders to
- constantly monitor their peers' responses, conflicts arising out of
- network topology changes can be promptly detected and resolved.
-
- Sending all responses by multicast also facilitates opportunistic
- caching by other hosts on the network.
-
- To protect the network against excessive packet flooding due to
- software bugs or malicious attack, a Multicast DNS Responder MUST NOT
- multicast a given record on a given interface if it has previously
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 16]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- multicast that record on that interface within the last second. A
- legitimate client on the network should have seen the previous
- transmission and cached it. A client that did not receive and cache
- the previous transmission will retry its request and receive a
- subsequent response. Under no circumstances is there any legitimate
- reason for a Multicast DNS Responder to multicast a given record more
- than once per second on any given interface.
-
-
-8.1 Legacy Unicast Responses
-
- If the source UDP port in a received Multicast DNS Query is not port
- 5353, this indicates that the client originating the query is a
- simple client that does not fully implement all of Multicast DNS. In
- this case, the Multicast DNS Responder MUST send a UDP response
- directly back to the client, via unicast, to the query packet's
- source IP address and port. This unicast response MUST be a
- conventional unicast response as would be generated by a conventional
- unicast DNS server; for example, it MUST repeat the query ID and the
- question given in the query packet.
-
- The resource record TTL given in a legacy unicast response SHOULD NOT
- be greater than ten seconds, even if the true TTL of the Multicast
- DNS resource record is higher. This is because Multicast DNS
- Responders that fully participate in the protocol use the cache
- coherency mechanisms described in Section 13 to update and invalidate
- stale data. Were unicast responses sent to legacy clients to use the
- same high TTLs, these legacy clients, which do not implement these
- cache coherency mechanisms, could retain stale cached resource record
- data long after it is no longer valid.
-
- Having sent this unicast response, if the Responder has not sent this
- record in any multicast response recently, it SHOULD schedule the
- record to be sent via multicast as well, to facilitate passive
- conflict detection. "Recently" in this context means "if the time
- since the record was last sent via multicast is less than one quarter
- of the record's TTL".
-
-
-8.2 Multi-Question Queries
-
- Multicast DNS Responders MUST correctly handle DNS query packets
- containing more than one question, by answering any or all of the
- questions to which they have answers. Any (non-defensive) answers
- generated in response to query packets containing more than one
- question SHOULD be randomly delayed in the range 20-120ms, or
- 400-500ms if the TC (truncated) bit is set, as described above.
- (Answers defending a name, in response to a probe for that name,
- are not subject to this delay rule and are still sent immediately.)
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 17]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-8.3 Response Aggregation
-
- When possible, a responder SHOULD, for the sake of network
- efficiency, aggregate as many responses as possible into a single
- Multicast DNS response packet. For example, when a responder has
- several responses it plans to send, each delayed by a different
- interval, then earlier responses SHOULD be delayed by up to an
- additional 500ms if that will permit them to be aggregated with
- other responses scheduled to go out a little later.
-
-
-9. Probing and Announcing on Startup
-
- Typically a Multicast DNS Responder should have, at the very least,
- address records for all of its active interfaces. Creating and
- advertising an HINFO record on each interface as well can be useful
- to network administrators.
-
- Whenever a Multicast DNS Responder starts up, wakes up from sleep,
- receives an indication of an Ethernet "Link Change" event, or has any
- other reason to believe that its network connectivity may have
- changed in some relevant way, it MUST perform the two startup steps
- below.
-
-
-9.1 Probing
-
- The first startup step is that for all those resource records that a
- Multicast DNS Responder desires to be unique on the local link, it
- MUST send a Multicast DNS Query asking for those resource records, to
- see if any of them are already in use. The primary example of this is
- its address record which maps its unique host name to its unique IP
- address. All Probe Queries SHOULD be done using the desired resource
- record name and query type T_ANY (255), to elicit answers for all
- types of records with that name. This allows a single question to be
- used in place of several questions, which is more efficient on the
- network. It also allows a host to verify exclusive ownership of a
- name, which is desirable in most cases. It would be confusing, for
- example, if one host owned the "A" record for "myhost.local.", but a
- different host owned the HINFO record for that name.
-
- The ability to place more than one question in a Multicast DNS Query
- is useful here, because it can allow a host to use a single packet
- for all of its resource records instead of needing a separate packet
- for each. For example, a host can simultaneously probe for uniqueness
- of its "A" record and all its SRV records [DNS-SD] in the same query
- packet.
-
- When ready to send its mDNS probe packet(s) the host should first
- wait for a short random delay time, uniformly distributed in the
- range 0-250ms. This random delay is to guard against the case where a
- group of devices are powered on simultaneously, or a group of devices
- are connected to an Ethernet hub which is then powered on, or some
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 18]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- other external event happens that might cause a group of hosts to all
- send synchronized probes.
-
- 250ms after the first query the host should send a second, then
- 250ms after that a third. If, by 250ms after the third probe, no
- conflicting Multicast DNS responses have been received, the host may
- move to the next step, announcing. (Note that this is the one
- exception from the normal rule that there should be at least one
- second between repetitions of the same question, and the interval
- between subsequent repetitions should double.)
-
- If any conflicting Multicast DNS responses are received, then the
- probing host MUST defer to the existing host, and MUST choose new
- names for some or all of its resource records as appropriate, to
- avoid conflict with pre-existing hosts on the network. In the case
- of a host probing using query type T_ANY as recommended above, any
- answer containing a record with that name, of any type, MUST be
- considered a conflicting response and handled accordingly.
-
- If fifteen failures occur within any ten-second period, then the host
- MUST wait at least five seconds before each successive additional
- probe attempt. This is to help ensure that in the event of software
- bugs or other unanticipated problems, errant hosts do not flood the
- network with a continuous stream of multicast traffic. For very
- simple devices, a valid way to comply with this requirement is to
- always wait five seconds after any failed probe attempt.
-
- If a responder knows by other means, with absolute certainty, that
- its unique resource record set name, rrtype and rrclass cannot
- already be in use by any other responder on the network, then it MAY
- skip the probing step for that resource record set. For example, when
- creating the reverse address mapping PTR records, the host can
- reasonably assume that no other host will be trying to create those
- same PTR records, since that would imply that the two hosts were
- trying to use the same IP address, and if that were the case, the two
- hosts would be suffering communication problems beyond the scope of
- what Multicast DNS is designed to solve.
-
-
-9.2 Simultaneous Probe Tie-Breaking
-
- The astute reader will observe that there is a race condition
- inherent in the previous description. If two hosts are probing for
- the same name simultaneously, neither will receive any response to
- the probe, and the hosts could incorrectly conclude that they may
- both proceed to use the name. To break this symmetry, each host
- populates the Authority Section of its queries with records giving
- the rdata that it would be proposing to use, should its probing be
- successful. The Authority Section is being used here in a way
- analogous to the Update Section of a DNS Update packet [RFC 2136].
-
- When a host that is probing for a record sees another host issue a
- query for the same record, it consults the Authority Section of that
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 19]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- query. If it finds any resource record there which answers the query,
- then it compares the data of that resource record with its own
- tentative data. The lexicographically later data wins. This means
- that if the host finds that its own data is lexicographically later,
- it simply ignores the other host's probe. If the host finds that its
- own data is lexicographically earlier, then it treats this exactly
- as if it had received a positive answer to its query, and concludes
- that it may not use the desired name.
-
- The determination of 'lexicographically later' is performed by first
- comparing the record class, then the record type, then raw comparison
- of the binary content of the rdata without regard for meaning or
- structure. If the record classes differ, then the numerically greater
- class is considered 'lexicographically later'. Otherwise, if the
- record types differ, then the numerically greater type is considered
- 'lexicographically later'. If the rrtype and rrclass both match then
- the rdata is compared.
-
- In the case of resource records containing rdata that is subject to
- name compression, the names MUST be uncompressed before comparison.
- (The details of how a particular name is compressed is an artifact of
- how and where the record is written into the DNS message; it is not
- an intrinsic property of the resource record itself.)
-
- The bytes of the raw uncompressed rdata are compared in turn,
- interpreting the bytes as eight-bit UNSIGNED values, until a byte
- is found whose value is greater than that of its counterpart (in
- which case the rdata whose byte has the greater value is deemed
- lexicographically later) or one of the resource records runs out
- of rdata (in which case the resource record which still has
- remaining data first is deemed lexicographically later).
-
- The following is an example of a conflict:
-
- cheshire.local. A 169.254.99.200
- cheshire.local. A 169.254.200.50
-
- In this case 169.254.200.50 is lexicographically later (the third
- byte, with value 200, is greater than its counterpart with value 99),
- so it is deemed the winner.
-
- Note that it is vital that the bytes are interpreted as UNSIGNED
- values, or the wrong outcome may result. In the example above, if
- the byte with value 200 had been incorrectly interpreted as a
- signed value then it would be interpreted as value -56, and the
- wrong address record would be deemed the winner.
-
-
-9.3 Announcing
-
- The second startup step is that the Multicast DNS Responder MUST send
- a gratuitous Multicast DNS Response containing, in the Answer
- Section, all of its resource records (both shared records, and unique
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 20]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- records that have completed the probing step). If there are too many
- resource records to fit in a single packet, multiple packets should
- be used.
-
- In the case of shared records (e.g. the PTR records used by DNS
- Service Discovery [DNS-SD]), the records are simply placed as-is
- into the Answer Section of the DNS Response.
-
- In the case of records that have been verified to be unique in the
- previous step, they are placed into the Answer Section of the DNS
- Response with the most significant bit of the rrclass set to one.
- The most significant bit of the rrclass for a record in the Answer
- Section of a response packet is the mDNS "cache flush" bit and is
- discussed in more detail below in Section 11.3 "Announcements to
- Flush Outdated Cache Entries".
-
- The Multicast DNS Responder MUST send at least two gratuitous
- responses, one second apart. A Responder MAY send up to ten
- gratuitous Responses, provided that the interval between gratuitous
- responses doubles with every response sent.
-
- A Multicast DNS Responder SHOULD NOT continue sending gratuitous
- Responses for longer than the TTL of the record. The purpose of
- announcing new records via gratuitous Responses is to ensure that
- peer caches are up to date. After a time interval equal to the TTL of
- the record has passed, it is very likely that old stale copies of
- that record in peer caches will have expired naturally, so subsequent
- announcements serve little purpose.
-
- A Multicast DNS Responder MUST NOT send announcements in the absence
- of information that its network connectivity may have changed in some
- relevant way. In particular, a Multicast DNS Responder MUST NOT send
- regular periodic announcements as a matter of course.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the conflict MUST be resolved as described below in "Conflict
- Resolution".
-
-9.4 Updating
-
- At any time, if the rdata of any of a host's Multicast DNS records
- changes, the host MUST repeat the Announcing step described above to
- update neighboring caches. For example, if any of a host's IP
- addresses change, it MUST re-announce those address records.
-
- In the case of shared records, a host MUST send a 'goodbye'
- announcement with TTL zero (see Section 11.2 "Goodbye Packets")
- for the old rdata, to cause it to be deleted from peer caches,
- before announcing the new rdata. In the case of unique records,
- a host SHOULD omit the 'goodbye' announcement, since the cache
- flush bit on the newly announced records will cause old rdata
- to be flushed from peer caches anyway.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 21]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- A host may update the contents of any of its records at any time,
- though a host SHOULD NOT update records more frequently than ten
- times per minute. Frequent rapid updates impose a burden on the
- network. If a host has information to disseminate which changes more
- frequently than ten times per minute, then it may be more appropriate
- to design a protocol for that specific purpose.
-
-
-10. Conflict Resolution
-
- A conflict occurs when a Multicast DNS Responder has a unique record
- for which it is authoritative, and it receives, in the Answer Section
- of a Multicast DNS response another record with the same name, rrtype
- and rrclass, but inconsistent rdata. What may be considered
- inconsistent is context sensitive, except that resource records with
- identical rdata are never considered inconsistent, even if they
- originate from different hosts. This is to permit use of proxies and
- other fault-tolerance mechanisms that may cause more than one
- responder to be capable of issuing identical answers on the network.
-
- A common example of a resource record type that is intended to be
- unique, not shared between hosts, is the address record that maps a
- host's name to its IP address. Should a host witness another host
- announce an address record with the same name but a different IP
- address, then that is considered inconsistent, and that address
- record is considered to be in conflict.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record in the Answer Section, the Multicast DNS Responder MUST
- immediately reset its conflicted unique record to probing state, and
- go through the startup steps described above in Section 9. "Probing
- and Announcing on Startup". The protocol used in the Probing phase
- will determine a winner and a loser, and the loser MUST cease using
- the name, and reconfigure.
-
- It is very important that any host receiving a resource record that
- conflicts with one of its own MUST take action as described above.
- In the case of two hosts using the same host name, where one has been
- configured to require a unique host name and the other has not, the
- one that has not been configured to require a unique host name will
- not perceive any conflict, and will not take any action. By reverting
- to Probing state, the host that desires a unique host name will go
- through the necessary steps to ensure that a unique host is obtained.
-
- The recommended course of action after probing and failing is as
- follows:
-
- o Programmatically change the resource record name in an attempt to
- find a new name that is unique. This could be done by adding some
- further identifying information (e.g. the model name of the
- hardware) if it is not already present in the name, appending the
- digit "2" to the name, or incrementing a number at the end of the
- name if one is already present.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 22]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- o Probe again, and repeat until a unique name is found.
-
- o Record this newly chosen name in persistent storage so that the
- device will use the same name the next time it is power-cycled.
-
- o Display a message to the user or operator informing them of the
- name change. For example:
-
- The name "Bob's Music" is in use by another iTunes music
- server on the network. Your music has been renamed to
- "Bob's Music (G4 Cube)". If you want to change this name,
- use [describe appropriate menu item or preference dialog].
-
- How the user or operator is informed depends on context. A desktop
- computer with a screen might put up a dialog box. A headless server
- in the closet may write a message to a log file, or use whatever
- mechanism (email, SNMP trap, etc.) it uses to inform the
- administrator of other error conditions. On the other hand a headless
- server in the closet may not inform the user at all -- if the user
- cares, they will notice the name has changed, and connect to the
- server in the usual way (e.g. via Web Browser) to configure a new
- name.
-
- The examples in this section focus on address records (i.e. host
- names), but the same considerations apply to all resource records
- where uniqueness (or maintenance of some other defined constraint)
- is desired.
-
-
-
-11. Resource Record TTL Values and Cache Coherency
-
- As a general rule, the recommended TTL value for Multicast DNS
- resource records with a host name as the resource record's name
- (e.g. A, AAAA, HINFO, etc.) or contained within the resource record's
- rdata (e.g. SRV, reverse mapping PTR record, etc.) is 120 seconds.
-
- The recommended TTL value for other Multicast DNS resource records
- is 75 minutes.
-
- A client with an active outstanding query will issue a query packet
- when one or more of the resource record(s) in its cache is (are) 80%
- of the way to expiry. If the TTL on those records is 75 minutes,
- this ongoing cache maintenance process yields a steady-state query
- rate of one query every 60 minutes.
-
- Any distributed cache needs a cache coherency protocol. If Multicast
- DNS resource records follow the recommendation and have a TTL of 75
- minutes, that means that stale data could persist in the system for
- a little over an hour. Making the default TTL significantly lower
- would reduce the lifetime of stale data, but would produce too much
- extra traffic on the network. Various techniques are available to
- minimize the impact of such stale data.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 23]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-11.1 Cooperating Multicast DNS Responders
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name, rrtype and rrclass as one of A's
- resource records, but different rdata, then:
-
- o If A's resource record is intended to be a shared resource record,
- then this is no conflict, and no action is required.
-
- o If A's resource record is intended to be a member of a unique
- resource record set owned solely by that responder, then this
- is a conflict and MUST be handled as described in Section 10
- "Conflict Resolution".
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name, rrtype and rrclass as one of A's
- resource records, and identical rdata, then:
-
- o If the TTL of B's resource record given in the packet is at least
- half the true TTL from A's point of view, then no action is
- required.
-
- o If the TTL of B's resource record given in the packet is less than
- half the true TTL from A's point of view, then A MUST mark its
- record to be announced via multicast. Clients receiving the record
- from B would use the TTL given by B, and hence may delete the
- record sooner than A expects. By sending its own multicast response
- correcting the TTL, A ensures that the record will be retained for
- the desired time.
-
- These rules allow multiple Multicast DNS Responders to offer the same
- data on the network (perhaps for fault tolerance reasons) without
- conflicting with each other.
-
-
-11.2 Goodbye Packets
-
- In the case where a host knows that certain resource record data is
- about to become invalid (for example when the host is undergoing a
- clean shutdown) the host SHOULD send a gratuitous announcement mDNS
- response packet, giving the same resource record name, rrtype,
- rrclass and rdata, but an RR TTL of zero. This has the effect of
- updating the TTL stored in neighboring hosts' cache entries to zero,
- causing that cache entry to be promptly deleted.
-
- Clients receiving a Multicast DNS Response with a TTL of zero SHOULD
- NOT immediately delete the record from the cache, but instead record
- a TTL of 1 and then delete the record one second later. In the case
- of multiple Multicast DNS Responders on the network described in
- Section 11.1 above, if one of the Responders shuts down and
- incorrectly sends goodbye packets for its records, it gives the other
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 24]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- cooperating Responders one second to send out their own response to
- "rescue" the records before they expire and are deleted.
-
- Generally speaking, it is more important to send goodbye packets for
- shared records than unique records. A given shared record name (such
- as a PTR record used for DNS Service Discovery [DNS-SD]) by its
- nature often has many representatives from many different hosts, and
- tends to be the subject of long-lived ongoing queries. Those
- long-lived queries are often concerned not just about being informed
- when records appear, but also about being informed if those records
- vanish again. In contrast, a unique record set (such as an SRV
- record, or a host address record), by its nature, often has far fewer
- members than a shared record set, and is usually the subject of
- one-shot queries which simply retrieve the data and then cease
- querying once they have the answer they are seeking. Therefore,
- sending a goodbye packet for a unique record set is likely to offer
- less benefit, because it is likely at any given moment that no one
- has an active query running for that record set. One example where
- goodbye packets for SRV and address records are useful is when
- transferring control to a Sleep Proxy Server (see Section 16,
- "Multicast DNS and Power Management").
-
-
-11.3 Announcements to Flush Outdated Cache Entries
-
- Whenever a host has a resource record with potentially new data (e.g.
- after rebooting, waking from sleep, connecting to a new network link,
- changing IP address, etc.), the host MUST send a series of gratuitous
- announcements to update cache entries in its neighbor hosts. In
- these gratuitous announcements, if the record is one that is intended
- to be unique, the host sets the most significant bit of the rrclass
- field of the resource record. This bit, the "cache flush" bit, tells
- neighboring hosts that this is not a shared record type. Instead of
- merging this new record additively into the cache in addition to any
- previous records with the same name, rrtype and rrclass, all old
- records with that name, type and class that were received more than
- one second ago are declared invalid, and marked to expire from the
- cache in one second.
-
- The semantics of the cache flush bit are as follows: Normally when a
- resource record appears in the Answer Section of the DNS Response, it
- means, "This is an assertion that this information is true." When a
- resource record appears in the Answer Section of the DNS Response
- with the "cache flush" bit set, it means, "This is an assertion that
- this information is the truth and the whole truth, and anything you
- may have heard more than a second ago regarding records of this
- name/rrtype/rrclass is no longer valid".
-
- To accommodate the case where the set of records from one host
- constituting a single unique RRSet is too large to fit in a single
- packet, only cache records that are more than one second old are
- flushed. This allows the announcing host to generate a quick burst of
- packets back-to-back on the wire containing all the members
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 25]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- of the RRSet. When receiving records with the "cache flush" bit set,
- all records older than one second are marked to be deleted one second
- in the future. One second after the end of the little packet burst,
- any records not represented within that packet burst will then be
- expired from all peer caches.
-
- Any time a host sends a response packet containing some members of a
- unique RRSet, it SHOULD send the entire RRSet, preferably in a single
- packet, or if the entire RRSet will not fit in a single packet, in a
- quick burst of packets sent as close together as possible. The host
- SHOULD set the cache flush bit on all members of the unique RRSet.
- In the event that for some reason the host chooses not to send the
- entire unique RRSet in a single packet or a rapid packet burst,
- it MUST NOT set the cache flush bit on any of those records.
-
- The reason for waiting one second before deleting stale records from
- the cache is to accommodate bridged networks. For example, a host's
- address record announcement on a wireless interface may be bridged
- onto a wired Ethernet, and cause that same host's Ethernet address
- records to be flushed from peer caches. The one-second delay gives
- the host the chance to see its own announcement arrive on the wired
- Ethernet, and immediately re-announce its Ethernet interface's
- address records so that both sets remain valid and live in peer
- caches.
-
- These rules apply regardless of *why* the response packet is being
- generated. They apply to startup announcements as described in
- Section 9.3, and to responses generated as a result of receiving
- query packets.
-
- The "cache flush" bit is only set in records in the Answer Section of
- Multicast DNS responses sent to UDP port 5353. The "cache flush" bit
- MUST NOT be set in any resource records in a response packet sent in
- legacy unicast responses to UDP ports other than 5353.
-
- The "cache flush" bit MUST NOT be set in any resource records in the
- known-answer list of any query packet.
-
- The "cache flush" bit MUST NOT ever be set in any shared resource
- record. To do so would cause all the other shared versions of this
- resource record with different rdata from different Responders to be
- immediately deleted from all the caches on the network.
-
- The "cache flush" bit does apply to questions listed in the Question
- Section of a Multicast DNS packet. The top bit of the rrclass field
- in questions is used for an entirely different purpose (see Section
- 6.5, "Questions Requesting Unicast Responses").
-
- Note that the "cache flush" bit is NOT part of the resource record
- class. The "cache flush" bit is the most significant bit of the
- second 16-bit word of a resource record in the Answer Section of
- an mDNS packet (the field conventionally referred to as the rrclass
- field), and the actual resource record class is the least-significant
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 26]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- fifteen bits of this field. There is no mDNS resource record class
- 0x8001. The value 0x8001 in the rrclass field of a resource record in
- an mDNS response packet indicates a resource record with class 1,
- with the "cache flush" bit set. When receiving a resource record with
- the "cache flush" bit set, implementations should take care to mask
- off that bit before storing the resource record in memory.
-
-
-11.4 Cache Flush on Topology change
-
- If the hardware on a given host is able to indicate physical changes
- of connectivity, then when the hardware indicates such a change, the
- host should take this information into account in its mDNS cache
- management strategy. For example, a host may choose to immediately
- flush all cache records received on a particular interface when that
- cable is disconnected. Alternatively, a host may choose to adjust the
- remaining TTL on all those records to a few seconds so that if the
- cable is not reconnected quickly, those records will expire from the
- cache.
-
- Likewise, when a host reboots, or wakes from sleep, or undergoes some
- other similar discontinuous state change, the cache management
- strategy should take that information into account.
-
-
-11.5 Cache Flush on Failure Indication
-
- Sometimes a cache record can be determined to be stale when a client
- attempts to use the rdata it contains, and finds that rdata to be
- incorrect.
-
- For example, the rdata in an address record can be determined to be
- incorrect if attempts to contact that host fail, either because
- ARP/ND requests for that address go unanswered (for an address on a
- local subnet) or because a router returns an ICMP "Host Unreachable"
- error (for an address on a remote subnet).
-
- The rdata in an SRV record can be determined to be incorrect if
- attempts to communicate with the indicated service at the host and
- port number indicated are not successful.
-
- The rdata in a DNS-SD PTR record can be determined to be incorrect if
- attempts to look up the SRV record it references are not successful.
-
- In any such case, the software implementing the mDNS resource record
- cache should provide a mechanism so that clients detecting stale
- rdata can inform the cache.
-
- When the cache receives this hint that it should reconfirm some
- record, it MUST issue two or more queries for the resource record in
- question. If no response is received in a reasonable amount of time,
- then, even though its TTL may indicate that it is not yet due to
- expire, that record SHOULD be promptly flushed from the cache.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 27]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- The end result of this is that if a printer suffers a sudden power
- failure or other abrupt disconnection from the network, its name may
- continue to appear in DNS-SD browser lists displayed on users'
- screens. Eventually that entry will expire from the cache naturally,
- but if a user tries to access the printer before that happens, the
- failure to successfully contact the printer will trigger the more
- hasty demise of its cache entries. This is a sensible trade-off
- between good user-experience and good network efficiency. If we were
- to insist that printers should disappear from the printer list within
- 30 seconds of becoming unavailable, for all failure modes, the only
- way to achieve this would be for the client to poll the printer at
- least every 30 seconds, or for the printer to announce its presence
- at least every 30 seconds, both of which would be an unreasonable
- burden on most networks.
-
-
-11.6 Passive Observation of Failures
-
- A host observes the multicast queries issued by the other hosts on
- the network. One of the major benefits of also sending responses
- using multicast is that it allows all hosts to see the responses (or
- lack thereof) to those queries.
-
- If a host sees queries, for which a record in its cache would be
- expected to be given as an answer in a multicast response, but no
- such answer is seen, then the host may take this as an indication
- that the record may no longer be valid.
-
- After seeing two or more of these queries, and seeing no multicast
- response containing the expected answer within a reasonable amount of
- time, then even though its TTL may indicate that it is not yet due to
- expire, that record MAY be flushed from the cache. The host SHOULD
- NOT perform its own queries to re-confirm that the record is truly
- gone. If every host on a large network were to do this, it would
- cause a lot of unnecessary multicast traffic. If host A sends
- multicast queries that remain unanswered, then there is no reason to
- suppose that host B or any other host is likely to be any more
- successful.
-
- The previous section, "Cache Flush on Failure Indication", describes
- a situation where a user trying to print discovers that the printer
- is no longer available. By implementing the passive observation
- described here, when one user fails to contact the printer, all hosts
- on the network observe that failure and update their caches
- accordingly.
-
-
-12. Special Characteristics of Multicast DNS Domains
-
- Unlike conventional DNS names, names that end in ".local.",
- "254.169.in-addr.arpa." or "0.8.e.f.ip6.arpa." have only local
- significance. Conventional DNS seeks to provide a single unified
- namespace, where a given DNS query yields the same answer no matter
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 28]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- where on the planet it is performed or to which recursive DNS server
- the query is sent. (However, split views, firewalls, intranets and
- the like have somewhat interfered with this goal of DNS representing
- a single universal truth.) In contrast, each IP link has its own
- private ".local.", "254.169.in-addr.arpa." and "0.8.e.f.ip6.arpa."
- namespaces, and the answer to any query for a name within those
- domains depends on where that query is asked.
-
- Multicast DNS Domains are not delegated from their parent domain via
- use of NS records. There are no NS records anywhere in Multicast DNS
- Domains. Instead, all Multicast DNS Domains are delegated to the IP
- addresses 224.0.0.251 and FF02::FB by virtue of the individual
- organizations producing DNS client software deciding how to handle
- those names. It would be extremely valuable for the industry if this
- special handling were ratified and recorded by IANA, since otherwise
- the special handling provided by each vendor is likely to be
- inconsistent.
-
- The IPv4 name server for a Multicast DNS Domain is 224.0.0.251. The
- IPv6 name server for a Multicast DNS Domain is FF02::FB. These are
- multicast addresses; therefore they identify not a single host but a
- collection of hosts, working in cooperation to maintain some
- reasonable facsimile of a competently managed DNS zone. Conceptually
- a Multicast DNS Domain is a single DNS zone, however its server is
- implemented as a distributed process running on a cluster of loosely
- cooperating CPUs rather than as a single process running on a single
- CPU.
-
- No delegation is performed within Multicast DNS Domains. Because the
- cluster of loosely coordinated CPUs is cooperating to administer a
- single zone, delegation is neither necessary nor desirable. Just
- because a particular host on the network may answer queries for a
- particular record type with the name "example.local." does not imply
- anything about whether that host will answer for the name
- "child.example.local.", or indeed for other record types with the
- name "example.local."
-
- Multicast DNS Zones have no SOA record. A conventional DNS zone's
- SOA record contains information such as the email address of the zone
- administrator and the monotonically increasing serial number of the
- last zone modification. There is no single human administrator for
- any given Multicast DNS Zone, so there is no email address. Because
- the hosts managing any given Multicast DNS Zone are only loosely
- coordinated, there is no readily available monotonically increasing
- serial number to determine whether or not the zone contents have
- changed. A host holding part of the shared zone could crash or be
- disconnected from the network at any time without informing the other
- hosts. There is no reliable way to provide a zone serial number that
- would, whenever such a crash or disconnection occurred, immediately
- change to indicate that the contents of the shared zone had changed.
-
- Zone transfers are not possible for any Multicast DNS Zone.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 29]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-13. Multicast DNS for Service Discovery
-
- This document does not describe using Multicast DNS for network
- browsing or service discovery. However, the mechanisms this document
- describes are compatible with (and support) the browsing and service
- discovery mechanisms proposed in "DNS-Based Service Discovery"
- [DNS-SD].
-
-
-14. Enabling and Disabling Multicast DNS
-
- The option to fail-over to Multicast DNS for names not ending in
- ".local." SHOULD be a user-configured option, and SHOULD
- be disabled by default because of the possible security issues
- related to unintended local resolution of apparently global names.
-
- The option to lookup unqualified (relative) names by appending
- ".local." (or not) is controlled by whether ".local." appears
- (or not) in the client's DNS search list.
-
- No special control is needed for enabling and disabling Multicast DNS
- for names explicitly ending with ".local." as entered by the user.
- The user doesn't need a way to disable Multicast DNS for names ending
- with ".local.", because if the user doesn't want to use Multicast
- DNS, they can achieve this by simply not using those names. If a user
- *does* enter a name ending in ".local.", then we can safely assume
- the user's intention was probably that it should work. Having user
- configuration options that can be (intentionally or unintentionally)
- set so that local names don't work is just one more way of
- frustrating the user's ability to perform the tasks they want,
- perpetuating the view that, "IP networking is too complicated to
- configure and too hard to use." This in turn perpetuates the
- continued use of protocols like AppleTalk. If we want to retire
- AppleTalk, NetBIOS, etc., we need to offer users equivalent IP
- functionality that they can rely on to, "always work, like
- AppleTalk." A little Multicast DNS traffic may be a burden on the
- network, but it is an insignificant burden compared to continued
- widespread use of AppleTalk.
-
-
-15. Considerations for Multiple Interfaces
-
- A host should defend its host name (FQDN) on all active interfaces on
- which it is answering Multicast DNS queries.
-
- In the event of a name conflict on *any* interface, a host should
- configure a new host name, if it wishes to maintain uniqueness of its
- host name.
-
- A host may choose to use the same name for all of its address records
- on all interfaces, or it may choose to manage its Multicast DNS host
- name(s) independently on each interface, potentially answering to
- different names on different interfaces.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 30]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- When answering a Multicast DNS query, a multi-homed host with a
- link-local address (or addresses) should take care to ensure that
- any address going out in a Multicast DNS response is valid for use
- on the interface on which the response is going out.
-
- Just as the same link-local IP address may validly be in use
- simultaneously on different links by different hosts, the same
- link-local host name may validly be in use simultaneously on
- different links, and this is not an error. A multi-homed host with
- connections to two different links may be able to communicate with
- two different hosts that are validly using the same name. While this
- kind of name duplication should be rare, it means that a host that
- wants to fully support this case needs network programming APIs that
- allow applications to specify on what interface to perform a
- link-local Multicast DNS query, and to discover on what interface a
- Multicast DNS response was received.
-
-
-16. Multicast DNS and Power Management
-
- Many modern network devices have the ability to go into a low-power
- mode where only a small part of the Ethernet hardware remains
- powered, and the device can be woken up by sending a specially
- formatted Ethernet frame which the device's power-management hardware
- recognizes.
-
- To make use of this in conjunction with Multicast DNS, we propose a
- network power management service called Sleep Proxy Service. A device
- that wishes to enter low-power mode first uses DNS-SD to determine if
- Sleep Proxy Service is available on the local network. In some
- networks there may be more than one piece of hardware implementing
- Sleep Proxy Service, for fault-tolerance reasons.
-
- If the device finds the network has Sleep Proxy Service, the device
- transmits two or more gratuitous mDNS announcements setting the TTL
- of its relevant resource records to zero, to delete them from
- neighboring caches. The relevant resource records include address
- records and SRV records, and other resource records as may apply to a
- particular device. The device then communicates all of its remaining
- active records, plus the names, rrtypes and rrclasses of the deleted
- records, to the Sleep Proxy Service(s), along with a copy of the
- specific "magic packet" required to wake the device up.
-
- When a Sleep Proxy Service sees an mDNS query for one of the
- device's active records (e.g. a DNS-SD PTR record), it answers on
- behalf of the device without waking it up. When a Sleep Proxy Service
- sees an mDNS query for one of the device's deleted resource
- records, it deduces that some client on the network needs to make an
- active connection to the device, and sends the specified "magic
- packet" to wake the device up. The device then wakes up, reactivates
- its deleted resource records, and re-announces them to the network.
- The client waiting to connect sees the announcements, learns the
- current IP address and port number of the desired service on the
- device, and proceeds to connect to it.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 31]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- The connecting client does not need to be aware of how Sleep Proxy
- Service works. Only devices that implement low power mode and wish to
- make use of Sleep Proxy Service need to be aware of how that protocol
- works.
-
- The reason that a device using a Sleep Proxy Service should send more
- than one goodbye packet is to ensure deletion of the resource records
- from all peer caches. If resource records were to inadvertently
- remain in some peer caches, then those peers may not issue any query
- packets for those records when attempting to access the sleeping
- device, so the Sleep Proxy Service would not receive any queries for
- the device's SRV and/or address records, and the necessary wake-up
- message would not be triggered.
-
- The full specification of mDNS / DNS-SD Sleep Proxy Service
- is described in another document [not yet published].
-
-
-17. Multicast DNS Character Set
-
- Unicast DNS has been plagued by the lack of any support for non-US
- characters. Indeed, conventional DNS is usually limited to just
- letters, digits and hyphens, with no spaces or other punctuation.
- Attempts to remedy this for unicast DNS have been badly constrained
- by the need to accommodate old buggy legacy DNS implementations.
- In reality, the DNS specification actually imposes no limits on what
- characters may be used in names, and good DNS implementations handle
- any arbitrary eight-bit data without trouble. However, the old rules
- for ARPANET host names back in the 1980s required names to be just
- letters, digits, and hyphens [RFC 1034], and since the predominant
- use of DNS is to store host address records, many have assumed that
- the DNS protocol itself suffers from the same limitation. It would be
- more accurate to say that certain bad implementations may not handle
- eight-bit data correctly, not that the protocol doesn't support it.
-
- Multicast DNS is a new protocol and doesn't (yet) have old buggy
- legacy implementations to constrain the design choices. Accordingly,
- it adopts the simple obvious elegant solution: all names in Multicast
- DNS are encoded using precomposed UTF-8 [RFC 3629]. The
- characters SHOULD conform to Unicode Normalization Form C (NFC): Use
- precomposed characters instead of combining sequences where possible,
- e.g. use U+00C4 ("Latin capital letter A with diaeresis") instead of
- U+0041 U+0308 ("Latin capital letter A", "combining diaeresis").
-
- For names that are restricted to letters, digits and hyphens, the
- UTF-8 encoding is identical to the US-ASCII encoding, so this is
- entirely compatible with existing host names. For characters outside
- the US-ASCII range, UTF-8 encoding is used.
-
- Multicast DNS implementations MUST NOT use any other encodings apart
- from precomposed UTF-8 (US-ASCII being considered a compatible subset
- of UTF-8).
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 32]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- This point bears repeating: After many years of debate, as a result
- of the need to accommodate certain DNS implementations that
- apparently couldn't handle any character that's not a letter, digit
- or hyphen (and apparently never will be updated to remedy this
- limitation) the unicast DNS community settled on an extremely baroque
- encoding called "Punycode" [RFC 3492]. Punycode is a remarkably
- ingenious encoding solution, but it is complicated, hard to
- understand, and hard to implement, using sophisticated techniques
- including insertion unsort coding, generalized variable-length
- integers, and bias adaptation. The resulting encoding is remarkably
- compact given the constraints, but it's still not as good as simple
- straightforward UTF-8, and it's hard even to predict whether a given
- input string will encode to a Punycode string that fits within DNS's
- 63-byte limit, except by simply trying the encoding and seeing
- whether it fits. Indeed, the encoded size depends not only on the
- input characters, but on the order they appear, so the same set of
- characters may or may not encode to a legal Punycode string that fits
- within DNS's 63-byte limit, depending on the order the characters
- appear. This is extremely hard to present in a user interface that
- explains to users why one name is allowed, but another name
- containing the exact same characters is not. Neither Punycode nor any
- other of the "Ascii Compatible Encodings" proposed for Unicast DNS
- may be used in Multicast DNS packets. Any text being represented
- internally in some other representation MUST be converted to
- canonical precomposed UTF-8 before being placed in any Multicast DNS
- packet.
-
- The simple rules for case-insensitivity in Unicast DNS also apply in
- Multicast DNS; that is to say, in name comparisons, the lower-case
- letters "a" to "z" (0x61 to 0x7A) match their upper-case equivalents
- "A" to "Z" (0x41 to 0x5A). Hence, if a client issues a query for an
- address record with the name "cheshire.local", then a responder
- having an address record with the name "Cheshire.local" should
- issue a response. No other automatic equivalences should be assumed.
- In particular all UTF-8 multi-byte characters (codes 0x80 and higher)
- are compared by simple binary comparison of the raw byte values.
-
- No other automatic character equivalence is defined in Multicast DNS.
- For example, accented characters are not defined to be automatically
- equivalent to their unaccented counterparts. Where automatic
- equivalences are desired, this may be achieved through the use of
- programmatically-generated CNAME records. For example, if a responder
- has an address record for an accented name Y, and a client issues a
- query for a name X, where X is the same as Y with all the accents
- removed, then the responder may issue a response containing two
- resource records: A CNAME record "X CNAME Y", asserting that the
- requested name X (unaccented) is an alias for the true (accented)
- name Y, followed by the address record for Y.
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 33]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-18. Multicast DNS Message Size
-
- RFC 1035 restricts DNS Messages carried by UDP to no more than 512
- bytes (not counting the IP or UDP headers). For UDP packets carried
- over the wide-area Internet in 1987, this was appropriate. For
- link-local multicast packets on today's networks, there is no reason
- to retain this restriction. Given that the packets are by definition
- link-local, there are no Path MTU issues to consider.
-
- Multicast DNS Messages carried by UDP may be up to the IP MTU of the
- physical interface, less the space required for the IP header (20
- bytes for IPv4; 40 bytes for IPv6) and the UDP header (8 bytes).
-
- In the case of a single mDNS Resource Record which is too large to
- fit in a single MTU-sized multicast response packet, a Multicast DNS
- Responder SHOULD send the Resource Record alone, in a single IP
- datagram, sent using multiple IP fragments. Resource Records this
- large SHOULD be avoided, except in the very rare cases where they
- really are the appropriate solution to the problem at hand.
- Implementers should be aware that many simple devices do not
- re-assemble fragmented IP datagrams, so large Resource Records SHOULD
- NOT be used except in specialized cases where the implementer knows
- that all receivers implement reassembly.
-
- A Multicast DNS packet larger than the interface MTU, which is sent
- using fragments, MUST NOT contain more than one Resource Record.
-
- Even when fragmentation is used, a Multicast DNS packet, including IP
- and UDP headers, MUST NOT exceed 9000 bytes.
-
-
-19. Multicast DNS Message Format
-
- This section describes specific restrictions on the allowable
- values for the header fields of a Multicast DNS message.
-
-19.1. ID (Query Identifier)
-
- Multicast DNS clients SHOULD listen for gratuitous responses
- issued by hosts booting up (or waking up from sleep or otherwise
- joining the network). Since these gratuitous responses may contain a
- useful answer to a question for which the client is currently
- awaiting an answer, Multicast DNS clients SHOULD examine all received
- Multicast DNS response messages for useful answers, without regard to
- the contents of the ID field or the Question Section. In Multicast
- DNS, knowing which particular query message (if any) is responsible
- for eliciting a particular response message is less interesting than
- knowing whether the response message contains useful information.
-
- Multicast DNS clients MAY cache any or all Multicast DNS response
- messages they receive, for possible future use, provided of course
- that normal TTL aging is performed on these cached resource records.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 34]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- In multicast query messages, the Query ID SHOULD be set to zero on
- transmission.
-
- In multicast responses, including gratuitous multicast responses, the
- Query ID MUST be set to zero on transmission, and MUST be ignored on
- reception.
-
- In unicast response messages generated specifically in response to a
- particular (unicast or multicast) query, the Query ID MUST match the
- ID from the query message.
-
-
-19.2. QR (Query/Response) Bit
-
- In query messages, MUST be zero.
-
- In response messages, MUST be one.
-
-
-19.3. OPCODE
-
- In both multicast query and multicast response messages, MUST be zero
- (only standard queries are currently supported over multicast, unless
- other queries are allowed by future IETF Standards Action).
-
-
-19.4. AA (Authoritative Answer) Bit
-
- In query messages, the Authoritative Answer bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages for Multicast Domains, the Authoritative Answer
- bit MUST be set to one (not setting this bit implies there's some
- other place where "better" information may be found) and MUST be
- ignored on reception.
-
-
-19.5. TC (Truncated) Bit
-
- In query messages, if the TC bit is set, it means that additional
- Known Answer records may be following shortly. A responder MAY choose
- to record this fact, and wait for those additional Known Answer
- records, before deciding whether to respond. If the TC bit is clear,
- it means that the querying host has no additional Known Answers.
-
- In multicast response messages, the TC bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In legacy unicast response messages, the TC bit has the same meaning
- as in conventional unicast DNS: it means that the response was too
- large to fit in a single packet, so the client SHOULD re-issue its
- query using TCP in order to receive the larger response.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 35]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-19.6. RD (Recursion Desired) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Desired bit SHOULD be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.7. RA (Recursion Available) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Available bit MUST be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.8. Z (Zero) Bit
-
- In both query and response messages, the Zero bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.9. AD (Authentic Data) Bit [RFC 2535]
-
- In query messages the Authentic Data bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages, the Authentic Data bit MAY be set. Resolvers
- receiving response messages with the AD bit set MUST NOT trust the AD
- bit unless they trust the source of the message and either have a
- secure path to it or use DNS transaction security.
-
-
-19.10. CD (Checking Disabled) Bit [RFC 2535]
-
- In query messages, a resolver willing to do cryptography SHOULD set
- the Checking Disabled bit to permit it to impose its own policies.
-
- In response messages, the Checking Disabled bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.11. RCODE (Response Code)
-
- In both multicast query and multicast response messages, the Response
- Code MUST be zero on transmission. Multicast DNS messages received
- with non-zero Response Codes MUST be silently ignored.
-
-
-19.12. Repurposing of top bit of qclass in Question Section
-
- In the Question Section of a Multicast DNS Query, the top bit of the
- qclass field is used to indicate that unicast responses are preferred
- for this particular question.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 36]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-19.12. Repurposing of top bit of rrclass in Answer Section
-
- In the Answer Section of a Multicast DNS Response, the top bit of the
- rrclass field is used to indicate that the record is a member of a
- unique RRSet, and the entire RRSet has been sent together (in the
- same packet, or in consecutive packets if there are too many records
- to fit in a single packet).
-
-
-20. Choice of UDP Port Number
-
- Arguments were made for and against using Multicast on UDP port 53.
- The final decision was to use UDP port 5353. Some of the arguments
- for and against are given below.
-
-
-20.1 Arguments for using UDP port 53:
-
- * This is "just DNS", so it should be the same port.
-
- * There is less work to be done updating old clients to do simple
- mDNS queries. Only the destination address need be changed.
- In some cases, this can be achieved without any code changes,
- just by adding the address 224.0.0.251 to a configuration file.
-
-
-20.2 Arguments for using a different port (UDP port 5353):
-
- * This is not "just DNS". This is a DNS-like protocol, but different.
-
- * Changing client code to use a different port number is not hard.
-
- * Using the same port number makes it hard to run an mDNS Responder
- and a conventional unicast DNS server on the same machine. If a
- conventional unicast DNS server wishes to implement mDNS as well,
- it can still do that, by opening two sockets. Having two different
- port numbers is important to allow this flexibility.
-
- * Some VPN software hijacks all outgoing traffic to port 53 and
- redirects it to a special DNS server set up to serve those VPN
- clients while they are connected to the corporate network. It is
- questionable whether this is the right thing to do, but it is
- common, and redirecting link-local multicast DNS packets to a
- remote server rarely produces any useful results. It does mean, for
- example, that the user becomes unable to access their local network
- printer sitting on their desk right next to their computer. Using
- a different UDP port eliminates this particular problem.
-
- * On many operating systems, unprivileged clients may not send or
- receive packets on low-numbered ports. This means that any client
- sending or receiving mDNS packets on port 53 would have to run as
- "root", which is an undesirable security risk. Using a higher-
- numbered UDP port eliminates this particular problem.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 37]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- Continuing the previous point, since using an unprivileged port
- allows normal user-level code to bind, a given machine may have more
- than one such user-level application running at a time. Because of
- this, any code binding to UDP port 5353 MUST use the SO_REUSEPORT
- option, so as to be a good citizen and not block other clients on the
- machine from also binding to that port.
-
-
-21. Summary of Differences Between Multicast DNS and Unicast DNS
-
- The value of Multicast DNS is that it shares, as much as possible,
- the familiar APIs, naming syntax, resource record types, etc., of
- Unicast DNS. There are of course necessary differences by virtue of
- it using Multicast, and by virtue of it operating in a community of
- cooperating peers, rather than a precisely defined authoritarian
- hierarchy controlled by a strict chain of formal delegations from the
- top. These differences are listed below:
-
- Multicast DNS...
- * uses multicast
- * uses UDP port 5353 instead of port 53
- * operates in well-defined parts of the DNS namespace
- * uses UTF-8, and only UTF-8, to encode resource record names
- * defines a clear limit on the maximum legal domain name (255 bytes)
- * allows larger UDP packets
- * allows more than one question in a query packet
- * uses the Answer Section of a query to list Known Answers
- * uses the TC bit in a query to indicate additional Known Answers
- * uses the Authority Section of a query for probe tie-breaking
- * ignores the Query ID field (except for generating legacy responses)
- * doesn't require the question to be repeated in the response packet
- * uses gratuitous responses to announce new records to the peer group
- * defines a "unicast response" bit in the rrclass of query questions
- * defines a "cache flush" bit in the rrclass of response answers
- * uses DNS TTL 0 to indicate that a record has been deleted
- * monitors queries to perform Duplicate Question Suppression
- * monitors responses to perform Duplicate Answer Suppression...
- * ... and Ongoing Conflict Detection
- * ... and Opportunistic Caching
-
-
-22. Benefits of Multicast Responses
-
- Some people have argued that sending responses via multicast is
- inefficient on the network. In fact the benefits of using multicast
- responses result in a net lowering of overall multicast traffic, for
- a variety of reasons.
-
- * One multicast response can update the cache on all machines on the
- network. If another machine later wants to issue the same query, it
- already has the answer in its cache, so it may not need to even
- transmit that multicast query on the network at all.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 38]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- * When more than one machine has the same ongoing long-lived query
- running, every machine does not have to transmit its own
- independent query. When one machine transmits a query, all the
- other hosts see the answers, so they can suppress their own
- queries.
-
- * When a host sees a multicast query, but does not see the
- corresponding multicast response, it can use this information to
- promptly delete stale data from its cache. To achieve the same
- level of user-interface quality and responsiveness without
- multicast responses would require lower cache lifetimes and more
- frequent network polling, resulting in a significantly higher
- packet rate.
-
- * Multicast responses allow passive conflict detection. Without this
- ability, some other conflict detection mechanism would be needed,
- imposing its own additional burden on the network.
-
- * When using delayed responses to reduce network collisions, clients
- need to maintain a list recording to whom each answer should be
- sent. The option of multicast responses allows clients with limited
- storage, which cannot store an arbitrarily long list of response
- addresses, to choose to fail-over to a single multicast response in
- place of multiple unicast responses, when appropriate.
-
- * In the case of overlayed subnets and other misconfigurations,
- multicast responses allow a receiver to know with certainty that
- a response originated on the local link, even when its source
- address may apparently suggest otherwise. This can be extremely
- helpful when diagnosing and rectifying network problems, since
- it facilitates a direct communication channel between client and
- server that works without reliance on ARP, IP routing tables, etc.
- Being able to discover what IP address a device has (or thinks it
- has) is frequently a very valuable first step in diagnosing why
- it unable to communicate on the local network.
-
-
-23. IPv6 Considerations
-
- An IPv4-only host and an IPv6-only host behave as "ships that pass in
- the night". Even if they are on the same Ethernet, neither is aware
- of the other's traffic. For this reason, each physical link may have
- *two* unrelated ".local." zones, one for IPv4 and one for IPv6.
- Since for practical purposes, a group of IPv4-only hosts and a group
- of IPv6-only hosts on the same Ethernet act as if they were on two
- entirely separate Ethernet segments, it is unsurprising that their
- use of the ".local." zone should occur exactly as it would if
- they really were on two entirely separate Ethernet segments.
-
- A dual-stack (v4/v6) host can participate in both ".local."
- zones, and should register its name(s) and perform its lookups both
- using IPv4 and IPv6. This enables it to reach, and be reached by,
- both IPv4-only and IPv6-only hosts. In effect this acts like a
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 39]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- multi-homed host, with one connection to the logical "IPv4 Ethernet
- segment", and a connection to the logical "IPv6 Ethernet segment".
-
-23.1 IPv6 Multicast Addresses by Hashing
-
- Some discovery protocols use a range of multicast addresses, and
- determine the address to be used by a hash function of the name being
- sought. Queries are sent via multicast to the address as indicated by
- the hash function, and responses are returned to the querier via
- unicast. Particularly in IPv6, where multicast addresses are
- extremely plentiful, this approach is frequently advocated.
-
- There are some problems with this:
-
- * When a host has a large number of records with different names, the
- host may have to join a large number of multicast groups. This can
- place undue burden on the Ethernet hardware, which typically
- supports a limited number of multicast addresses efficiently. When
- this number is exceeded, the Ethernet hardware may have to resort
- to receiving all multicasts and passing them up to the host
- software for filtering, thereby defeating the point of using a
- multicast address range in the first place.
-
- * Multiple questions cannot be placed in one packet if they don't all
- hash to the same multicast address.
-
- * Duplicate Question Suppression doesn't work if queriers are not
- seeing each other's queries.
-
- * Duplicate Answer Suppression doesn't work if responders are not
- seeing each other's responses.
-
- * Opportunistic Caching doesn't work.
-
- * Ongoing Conflict Detection doesn't work.
-
-
-24. Security Considerations
-
- The algorithm for detecting and resolving name conflicts is, by its
- very nature, an algorithm that assumes cooperating participants. Its
- purpose is to allow a group of hosts to arrive at a mutually disjoint
- set of host names and other DNS resource record names, in the absence
- of any central authority to coordinate this or mediate disputes. In
- the absence of any higher authority to resolve disputes, the only
- alternative is that the participants must work together cooperatively
- to arrive at a resolution.
-
- In an environment where the participants are mutually antagonistic
- and unwilling to cooperate, other mechanisms are appropriate, like
- manually administered DNS.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 40]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- In an environment where there is a group of cooperating participants,
- but there may be other antagonistic participants on the same physical
- link, the cooperating participants need to use IPSEC signatures
- and/or DNSSEC [RFC 2535] signatures so that they can distinguish mDNS
- messages from trusted participants (which they process as usual) from
- mDNS messages from untrusted participants (which they silently
- discard).
-
- When DNS queries for *global* DNS names are sent to the mDNS
- multicast address (during network outages which disrupt communication
- with the greater Internet) it is *especially* important to use
- DNSSEC, because the user may have the impression that he or she is
- communicating with some authentic host, when in fact he or she is
- really communicating with some local host that is merely masquerading
- as that name. This is less critical for names ending with ".local.",
- because the user should be aware that those names have only local
- significance and no global authority is implied.
-
- Most computer users neglect to type the trailing dot at the end of a
- fully qualified domain name, making it a relative domain name (e.g.
- "www.example.com"). In the event of network outage, attempts to
- positively resolve the name as entered will fail, resulting in
- application of the search list, including ".local.", if present.
- A malicious host could masquerade as "www.example.com" by answering
- the resulting Multicast DNS query for "www.example.com.local."
- To avoid this, a host MUST NOT append the search suffix
- ".local.", if present, to any relative (partially qualified)
- domain name containing two or more labels. Appending ".local." to
- single-label relative domain names is acceptable, since the user
- should have no expectation that a single-label domain name will
- resolve as-is.
-
-
-25. IANA Considerations
-
- IANA has allocated the IPv4 link-local multicast address 224.0.0.251
- for the use described in this document.
-
- IANA has allocated the IPv6 multicast address set FF0X::FB for the
- use described in this document. Only address FF02::FB (Link-Local
- Scope) is currently in use by deployed software, but it is possible
- that in future implementers may experiment with Multicast DNS using
- larger-scoped addresses, such as FF05::FB (Site-Local Scope).
-
- When this document is published, IANA should designate a list of
- domains which are deemed to have only link-local significance, as
- described in Section 12 of this document ("Special Characteristics of
- Multicast DNS Domains").
-
- The re-use of the top bit of the rrclass field in the Question and
- Answer Sections means that Multicast DNS can only carry DNS records
- with classes in the range 0-32767. Classes in the range 32768 to
- 65535 are incompatible with Multicast DNS. However, since to-date
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 41]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- only three DNS classes have been assigned by IANA (1, 3 and 4),
- and only one (1, "Internet") is actually in widespread use, this
- limitation is likely to remain a purely theoretical one.
-
- No other IANA services are required by this document.
-
-
-26. Acknowledgments
-
- The concepts described in this document have been explored, developed
- and implemented with help from Freek Dijkstra, Erik Guttman, Paul
- Vixie, Bill Woodcock, and others.
-
- Special thanks go to Bob Bradley, Josh Graessley, Scott Herscher,
- Roger Pantos and Kiren Sekar for their significant contributions.
-
-
-27. Copyright
-
- Copyright (C) The Internet Society 2005.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-28. Normative References
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 42]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 3629] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 3629, November 2003.
-
-
-29. Informative References
-
- [dotlocal] <http://www.dotlocal.org/>
-
- [djbdl] <http://cr.yp.to/djbdns/dot-local.html>
-
- [DNS-SD] Cheshire, S., and M. Krochmal, "DNS-Based Service
- Discovery", Internet-Draft (work in progress),
- draft-cheshire-dnsext-dns-sd-03.txt, June 2005.
-
- [IEEE802] IEEE Standards for Local and Metropolitan Area Networks:
- Overview and Architecture.
- Institute of Electrical and Electronic Engineers,
- IEEE Standard 802, 1990.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-04.txt, June 2005.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2462] S. Thomson and T. Narten, "IPv6 Stateless Address
- Autoconfiguration", RFC 2462, December 1998.
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [RFC 3492] Costello, A., "Punycode: A Bootstring encoding of
- Unicode for use with Internationalized Domain Names
- in Applications (IDNA)", RFC 3492, March 2003.
-
- [RFC 3927] Cheshire, S., B. Aboba, and E. Guttman,
- "Dynamic Configuration of IPv4 Link-Local Addresses",
- RFC 3927, May 2005.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 43]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-30. Authors' Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 44]
diff --git a/release-0.6.9/tests/Makefile.am b/release-0.6.9/tests/Makefile.am
deleted file mode 100644
index c91cea4..0000000
--- a/release-0.6.9/tests/Makefile.am
+++ /dev/null
@@ -1,55 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS= \
- -I$(top_srcdir)
-
-if HAVE_GLIB
-if HAVE_DBUS
-if HAVE_NETLINK
-
-if ENABLE_TESTS
-noinst_PROGRAMS = c-plus-plus-test
-endif
-
-c_plus_plus_test_SOURCES = c-plus-plus-test.cc
-
-c_plus_plus_test_CXXFLAGS = \
- $(AM_CFLAGS) \
- $(GLIB20_CFLAGS) \
- $(DBUS_CFLAGS)
-
-c_plus_plus_test_LDADD = \
- $(AM_LDADD) \
- ../avahi-common/libavahi-common.la \
- ../avahi-core/libavahi-core.la \
- ../avahi-client/libavahi-client.la \
- ../avahi-glib/libavahi-glib.la \
- $(GLIB20_LIBS) \
- $(DBUS_LIBS)
-
-endif
-endif
-endif
-
-EXTRA_DIST=c-plus-plus-test-gen.py
-
-gen:
- python ./c-plus-plus-test-gen.py avahi-common avahi-core avahi-client avahi-glib > c-plus-plus-test.cc
-
diff --git a/release-0.6.9/tests/c-plus-plus-test-gen.py b/release-0.6.9/tests/c-plus-plus-test-gen.py
deleted file mode 100755
index 46d6762..0000000
--- a/release-0.6.9/tests/c-plus-plus-test-gen.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python
-
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import os, sys
-
-def print_includes(dir):
-
- files = os.listdir("../%s" % dir)
- files = filter(lambda fn: fn.endswith(".h") and not fn.startswith("."), files)
- files.sort()
-
- for f in files:
- print "#include <%s/%s>" % (dir, f)
-
-
-print """/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-"""
-
-for f in sys.argv[1:]:
- print_includes(f)
-
-print """
-int main(int argc, char*argv[]) {
- return 0;
-}
-"""
diff --git a/release-0.6.9/tests/c-plus-plus-test.cc b/release-0.6.9/tests/c-plus-plus-test.cc
deleted file mode 100644
index 947aa44..0000000
--- a/release-0.6.9/tests/c-plus-plus-test.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <avahi-common/address.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/cdecl.h>
-#include <avahi-common/dbus-watch-glue.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/error.h>
-#include <avahi-common/gccmacro.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/rlist.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/watch.h>
-#include <avahi-core/addr-util.h>
-#include <avahi-core/announce.h>
-#include <avahi-core/browse.h>
-#include <avahi-core/cache.h>
-#include <avahi-core/core.h>
-#include <avahi-core/dns-srv-rr.h>
-#include <avahi-core/dns.h>
-#include <avahi-core/domain-util.h>
-#include <avahi-core/fdutil.h>
-#include <avahi-core/hashmap.h>
-#include <avahi-core/iface-linux.h>
-#include <avahi-core/iface.h>
-#include <avahi-core/internal.h>
-#include <avahi-core/log.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/multicast-lookup.h>
-#include <avahi-core/netlink.h>
-#include <avahi-core/prioq.h>
-#include <avahi-core/probe-sched.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/querier.h>
-#include <avahi-core/query-sched.h>
-#include <avahi-core/response-sched.h>
-#include <avahi-core/rr-util.h>
-#include <avahi-core/rr.h>
-#include <avahi-core/rrlist.h>
-#include <avahi-core/socket.h>
-#include <avahi-core/timeeventq.h>
-#include <avahi-core/util.h>
-#include <avahi-core/wide-area.h>
-#include <avahi-client/client.h>
-#include <avahi-client/internal.h>
-#include <avahi-client/lookup.h>
-#include <avahi-client/publish.h>
-#include <avahi-client/xdg-config.h>
-#include <avahi-glib/glib-malloc.h>
-#include <avahi-glib/glib-watch.h>
-
-int main(int argc, char*argv[]) {
- return 0;
-}
-
diff --git a/release-0.6.9/tests/fuzz-mdns.py b/release-0.6.9/tests/fuzz-mdns.py
deleted file mode 100755
index aeea295..0000000
--- a/release-0.6.9/tests/fuzz-mdns.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/python
-
-from scapy import *
-
-
-sendp(Ether(type=0x800, dst="ff:ff:ff:ff:ff:ff")/IP(dst="224.0.0.251")/fuzz(UDP(dport = 5353, sport = 5353)/DNS(qd = fuzz(DNSQR()))),loop=1, iface="realtek0")
-
-
diff --git a/service-type-database/Makefile.am b/service-type-database/Makefile.am
index 3250e94..c41dc70 100644
--- a/service-type-database/Makefile.am
+++ b/service-type-database/Makefile.am
@@ -28,13 +28,36 @@ noinst_SCRIPTS=build-db
pkgdata_DATA+=service-types.db
build-db: build-db.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' $< > $@
+ sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,gdbm,g' $< > $@
chmod +x $@
service-types.db: service-types build-db
- $(PYTHON) build-db $(srcdir)/$< $@
+ $(PYTHON) build-db $< $@.coming
+ mv $@.coming $@
CLEANFILES = service-types.db build-db
endif
+if HAVE_DBM
+
+noinst_SCRIPTS=build-db
+pkgdata_DATA+=service-types.db.pag service-types.db.dir
+
+build-db: build-db.in
+ sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,dbm,g' $< > $@
+ chmod +x $@
+
+service-types.db.pag: service-types.db
+ mv service-types.db.coming.pag service-types.db.pag
+service-types.db.dir: service-types.db
+ mv service-types.db.coming.dir service-types.db.dir
+service-types.db: service-types build-db
+ $(PYTHON) build-db $< $@.coming
+ if test -f "$@.coming"; then mv $@.coming $@; fi
+
+CLEANFILES = service-types.db* build-db
+
+endif
endif
diff --git a/service-type-database/build-db.in b/service-type-database/build-db.in
index 21d057d..44f6068 100755
--- a/service-type-database/build-db.in
+++ b/service-type-database/build-db.in
@@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-import gdbm, sys
+import @DBM@, sys
if len(sys.argv) > 1:
infn = sys.argv[1]
@@ -31,7 +31,7 @@ if len(sys.argv) > 2:
else:
outfn = infn + ".db"
-db = gdbm.open(outfn, "n")
+db = @DBM@.open(outfn, "n")
for ln in file(infn, "r"):
ln = ln.strip(" \r\n\t")
diff --git a/service-type-database/service-types b/service-type-database/service-types
index 24f4d6a..6ede09d 100644
--- a/service-type-database/service-types
+++ b/service-type-database/service-types
@@ -30,32 +30,56 @@
### documentation. If you're looking for the correct service type to
### use for your application please refer to the URL mentioned above.
+
+# Devices
+
+_workstation._tcp:Workstation
+_workstation._tcp[de]:Arbeitsplatzrechner
+
+
+# Web
+
_http._tcp:Web Site
_http._tcp[de]:Web-Angebot
_https._tcp:Secure Web Site
_https._tcp[de]:Sicheres Web-Angebot
+_rss._tcp:Web Syndication RSS
+
+
+# Network
+
+_domain._udp:DNS Server
+_domain._udp[de]: DNS-Dienst
+
+_ntp._udp:NTP Time Server
+
+_smb._tcp:Microsoft Windows Network
+
+_airport._tcp:Apple AirPort
+
+
+# File and data access
+
_ftp._tcp:FTP File Transfer
-_ftp._tcp[de]:FTP Dateifreigabe
+_ftp._tcp[de]:FTP-Dateifreigabe
-_h323._tcp:H.323 Telephony
-_h323._tcp[de]:H.323 Telefonie
+_webdav._tcp:WebDAV File Share
-_sip._udp:SIP Telephony
-_sip._udp[de]:SIP Telefonie
+_webdavs._tcp:Secure WebDAV File Share
-_ssh._tcp:SSH Remote Terminal
-_ssh._tcp[de]:SSH Fernzugriff
+_afpovertcp._tcp:Apple File Sharing
-_distcc._tcp:Distributed Compiler
-_distcc._tcp[de]:Verteilter Compiler
+_nfs._tcp:Network File System
-_daap._tcp:iTunes Audio Access
-_daap._tcp[de]:iTunes Audio-Zugriff
+_apt._tcp:APT Package Repository
-_domain._udp:DNS Server
-_domain._udp[de]: DNS Dienst
+
+# Remote access
+
+_ssh._tcp:SSH Remote Terminal
+_ssh._tcp[de]:SSH-Fernzugriff
_imap._tcp:IMAP Mail Access
@@ -67,45 +91,86 @@ _sftp-ssh._tcp:SFTP File Transfer
_telnet._tcp:Telnet Remote Terminal
-_presence._tcp:iChat Presence
-
-_webdav._tcp:WebDAV File Share
+_timbuktu._tcp:Timbuktu Remote Desktop Control
-_webdavs._tcp:Secure WebDAV File Share
-_workstation._tcp:Workstation
-_workstation._tcp[de]:Arbeitsplatzrechner
+# Printing
_printer._tcp:UNIX Printer
-_afpovertcp._tcp:Apple File Sharing
-
_pdl-datastream._tcp:PDL Printer
_ipp._tcp:Internet Printer
-_rss._tcp:Web Syndication RSS
+
+# Multimedia
+
+_daap._tcp:iTunes Audio Access
+_daap._tcp[de]:iTunes Audio-Zugriff
_dacp._tcp:iTunes Remote Control
_realplayfavs._tcp:RealPlayer Shared Favorites
-_timbuktu._tcp:Timbuktu Remote Desktop Control
+_raop._tcp:AirTunes Remote Audio
+
+_rtsp._tcp:RTSP Realtime Streaming Server
+_rtp._udp:RTP Realtime Streaming Server
+
+_dpap._tcp:Digital Photo Sharing
+
+_pulse-server._tcp:PulseAudio Sound Server
+_pulse-sink._tcp:PulseAudio Sound Sink
+_pulse-source._tcp:PulseAudio Sound Source
+
+_mpd._tcp:Music Player Daemon
+
+
+# Communication, presence, working together
+
+_presence._tcp:iChat Presence
+
+_sip._udp:SIP Telephony
+_sip._udp[de]:SIP-Telefonie
+
+_h323._tcp:H.323 Telephony
+_h323._tcp[de]:H.323-Telefonie
+
+_presence_olpc._tcp:OLPC Presence
+
+_iax._udp:Asterisk Exchange
+
+_skype._tcp:Skype VoIP
_see._tcp:SubEthaEdit Collaborative Text Editor
+_lobby._tcp:Gobby Collaborative Editor Session
+
+
+# Databases
+
_postgresql._tcp:PostgreSQL Server
-_ksysguard._tcp:KDE System Guard
-_omni-bookmark._tcp:OmniWeb Bookmark Sharing
+# Development
+
+_svn._tcp:Subversion Revision Control
+
+_distcc._tcp:Distributed Compiler
+_distcc._tcp[de]:Verteilter Compiler
+
+
+# Vendor specific
_MacOSXDupSuppress._tcp:MacOS X Duplicate Machine Suppression
-_lobby._tcp:Gobby Collaborative Editor Session
+_ksysguard._tcp:KDE System Guard
-_dpap._tcp:Digital Photo Sharing
+_omni-bookmark._tcp:OmniWeb Bookmark Sharing
-_skype._tcp:Skype VoIP
-_airport._tcp:Apple AirPort
+# Other
+
+_pgpkey-hkp._tcp:GnuPG/PGP HKP Key Server
+
+_ldap._tcp:LDAP Directory Server
diff --git a/trunk/specs/draft-cheshire-dnsext-dns-sd-04.txt b/specs/draft-cheshire-dnsext-dns-sd-04.txt
index 3179028..3179028 100644
--- a/trunk/specs/draft-cheshire-dnsext-dns-sd-04.txt
+++ b/specs/draft-cheshire-dnsext-dns-sd-04.txt
diff --git a/trunk/specs/draft-cheshire-dnsext-multicastdns-06.txt b/specs/draft-cheshire-dnsext-multicastdns-06.txt
index 1dbe8b6..1dbe8b6 100644
--- a/trunk/specs/draft-cheshire-dnsext-multicastdns-06.txt
+++ b/specs/draft-cheshire-dnsext-multicastdns-06.txt
diff --git a/trunk/LICENSE b/trunk/LICENSE
deleted file mode 100644
index 2d2d780..0000000
--- a/trunk/LICENSE
+++ /dev/null
@@ -1,510 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/trunk/Makefile.am b/trunk/Makefile.am
deleted file mode 100644
index 1b8e350..0000000
--- a/trunk/Makefile.am
+++ /dev/null
@@ -1,236 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-ACLOCAL_AMFLAGS = -I common
-
-include $(srcdir)/common/doxygen.mk
-
-EXTRA_DIST = \
- autogen.sh \
- bootstrap.sh \
- LICENSE \
- $(DX_CONFIG) \
- docs/INSTALL \
- docs/TODO \
- docs/NEWS \
- docs/README \
- docs/DBUS-API \
- docs/AUTHORS \
- docs/HACKING \
- docs/API-CHANGES-0.6 \
- docs/COMPAT-LAYERS \
- docs/MALLOC \
- docs/overview.dia \
- docs/server-states.dia \
- docs/avahi-poll.dia \
- avahi-core.pc.in \
- avahi-client.pc.in \
- avahi-glib.pc.in \
- avahi-qt3.pc.in \
- avahi-qt4.pc.in \
- avahi-sharp.pc.in \
- avahi-compat-libdns_sd.pc.in \
- avahi-compat-howl.pc.in
-
-SUBDIRS = \
- common \
- avahi-common \
- avahi-glib \
- avahi-core \
- avahi-discover-standalone \
- avahi-qt \
- avahi-client \
- avahi-daemon \
- avahi-sharp \
- initscript \
- avahi-dnsconfd \
- avahi-utils \
- avahi-python \
- examples \
- man \
- tests \
- service-type-database \
- avahi-compat-libdns_sd \
- avahi-compat-howl \
- avahi-autoipd
-
-DX_INPUT = \
- $(srcdir)/avahi-common/address.h \
- $(srcdir)/avahi-common/strlst.h \
- $(srcdir)/avahi-common/alternative.h \
- $(srcdir)/avahi-common/defs.h \
- $(srcdir)/avahi-common/error.h \
- $(srcdir)/avahi-common/malloc.h \
- $(srcdir)/avahi-common/domain.h \
- $(srcdir)/avahi-common/watch.h \
- $(srcdir)/avahi-common/simple-watch.h \
- $(srcdir)/avahi-common/thread-watch.h \
- $(srcdir)/avahi-common/timeval.h
-
-DX_EXAMPLE_PATH = $(srcdir)/examples
-DX_EXAMPLE_PATTERNS = *.c
-
-if HAVE_QT3
-DX_INPUT += \
- $(srcdir)/avahi-qt/qt-watch.h
-else
-if HAVE_QT4
-DX_INPUT += \
- $(srcdir)/avahi-qt/qt-watch.h
-endif
-endif
-
-if HAVE_GLIB
-DX_INPUT += \
- $(srcdir)/avahi-glib/glib-watch.h \
- $(srcdir)/avahi-glib/glib-malloc.h
-endif
-
-if HAVE_DBUS
-DX_INPUT += \
- $(srcdir)/avahi-client/client.h \
- $(srcdir)/avahi-client/lookup.h \
- $(srcdir)/avahi-client/publish.h
-endif
-
-if ENABLE_CORE_DOCS
-DX_INPUT += \
- $(srcdir)/avahi-core/core.h \
- $(srcdir)/avahi-core/lookup.h \
- $(srcdir)/avahi-core/publish.h \
- $(srcdir)/avahi-core/rr.h \
- $(srcdir)/avahi-core/log.h
-endif
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = avahi-core.pc
-
-avahi-core.pc: avahi-core.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES = avahi-core.pc
-
-if HAVE_DBUS
-
-pkgconfig_DATA += avahi-client.pc
-
-avahi-client.pc: avahi-client.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-client.pc
-
-if ENABLE_COMPAT_HOWL
-
-pkgconfig_DATA += avahi-compat-howl.pc
-
-avahi-compat-howl.pc: avahi-compat-howl.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@HOWL_COMPAT_VERSION\@,$(HOWL_COMPAT_VERSION),g' $< > $@
-
-CLEANFILES += avahi-compat-howl.pc
-
-endif
-
-if ENABLE_COMPAT_LIBDNS_SD
-
-pkgconfig_DATA += avahi-compat-libdns_sd.pc
-
-avahi-compat-libdns_sd.pc: avahi-compat-libdns_sd.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-compat-libdns_sd.pc
-
-endif
-
-if HAVE_MONO
-
-pkgconfig_DATA += avahi-sharp.pc
-
-avahi-sharp.pc: avahi-sharp.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
- -e 's,@libdir\@,$(libdir),g' $< > $@
-
-CLEANFILES += avahi-sharp.pc
-
-endif
-
-endif
-
-if HAVE_GLIB
-
-pkgconfig_DATA += avahi-glib.pc
-
-avahi-glib.pc: avahi-glib.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-glib.pc
-
-endif
-
-if HAVE_QT3
-
-pkgconfig_DATA += avahi-qt3.pc
-
-avahi-qt3.pc: avahi-qt3.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-qt3.pc
-
-endif
-
-if HAVE_QT4
-
-pkgconfig_DATA += avahi-qt4.pc
-
-avahi-qt4.pc: avahi-qt4.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
-CLEANFILES += avahi-qt4.pc
-
-endif
-
-MOSTLYCLEANFILES = $(DX_CLEANFILES)
-
-DISTCHECK_CONFIGURE_FLAGS = \
- --disable-monodoc
-
-homepage:
- $(MAKE) -C man
- scp avahi-daemon/*.introspect avahi-daemon/introspect.dtd avahi-daemon/introspect.xsl\
- man/*.xml man/xmltoman.dtd man/xmltoman.xsl \
- tango:www/avahi.org/tree/download/
- scp avahi-$(PACKAGE_VERSION).tar.gz tango:www/avahi.org/tree/download/
- rm -rf doxygen
- $(MAKE) doxygen-run
- ssh tango rm -rf www/avahi.org/tree/download/doxygen
- scp -r doxygen/html tango:www/avahi.org/tree/download/doxygen
diff --git a/trunk/acinclude.m4 b/trunk/acinclude.m4
deleted file mode 100644
index 4d07999..0000000
--- a/trunk/acinclude.m4
+++ /dev/null
@@ -1 +0,0 @@
-sinclude(common/doxygen.m4) \ No newline at end of file
diff --git a/trunk/autogen.sh b/trunk/autogen.sh
deleted file mode 100755
index f75ad60..0000000
--- a/trunk/autogen.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/bin/sh
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-VERSION=1.9
-
-run_versioned() {
- local P
- local V
-
- V=$(echo "$2" | sed -e 's,\.,,g')
-
- if [ -e "`which $1$V`" ] ; then
- P="$1$V"
- else
- if [ -e "`which $1-$2`" ] ; then
- P="$1-$2"
- else
- P="$1"
- fi
- fi
-
- shift 2
- "$P" "$@"
-}
-
-set -ex
-
-if [ "x$1" = "xam" ] ; then
- run_versioned automake "$VERSION" -a -c --foreign
- ./config.status
-else
- rm -rf autom4te.cache
- rm -f config.cache
-
- test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize
-
- "$LIBTOOLIZE" -c --force
- run_versioned aclocal "$VERSION" -I common
- run_versioned autoconf 2.59 -Wall
- run_versioned autoheader 2.59
- run_versioned automake "$VERSION" -a -c --foreign
-
- if test "x$NOCONFIGURE" = "x"; then
- ./configure "$@"
- make clean
- fi
-fi
diff --git a/trunk/avahi-client.pc.in b/trunk/avahi-client.pc.in
deleted file mode 100644
index 65ee8d8..0000000
--- a/trunk/avahi-client.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-client
-Description: Avahi Multicast DNS Responder (Client Support)
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lavahi-common -lavahi-client
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/trunk/avahi-client/Makefile.am b/trunk/avahi-client/Makefile.am
deleted file mode 100644
index f45f58d..0000000
--- a/trunk/avahi-client/Makefile.am
+++ /dev/null
@@ -1,85 +0,0 @@
-# $Id: Makefile.am 90 2005-05-23 16:15:12Z lennart $
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-
-avahi_clientincludedir=$(includedir)/avahi-client
-avahi_clientinclude_HEADERS = client.h lookup.h publish.h
-
-noinst_HEADERS = internal.h
-
-if ENABLE_TESTS
-
-noinst_PROGRAMS = \
- client-test \
- srv-test \
- xdg-config-test \
- rr-test \
- check-nss-test
-
-endif
-
-lib_LTLIBRARIES = libavahi-client.la
-
-libavahi_client_la_SOURCES = \
- client.c client.h \
- entrygroup.c \
- browser.c \
- resolver.c \
- publish.h lookup.h \
- xdg-config.c xdg-config.h \
- check-nss.c \
- ../avahi-common/dbus.c ../avahi-common/dbus.h \
- ../avahi-common/dbus-watch-glue.c ../avahi-common/dbus-watch-glue.h
-
-libavahi_client_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) -DDBUS_SYSTEM_BUS_DEFAULT_ADDRESS=\"$(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)\"
-libavahi_client_la_LIBADD = $(AM_LDADD) $(DBUS_LIBS) ../avahi-common/libavahi-common.la
-libavahi_client_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_CLIENT_VERSION_INFO)
-
-client_test_SOURCES = client-test.c
-client_test_CFLAGS = $(AM_CFLAGS)
-client_test_LDADD = $(AM_LDADD) libavahi-client.la ../avahi-common/libavahi-common.la
-
-srv_test_SOURCES = srv-test.c
-srv_test_CFLAGS = $(AM_CFLAGS)
-srv_test_LDADD = $(AM_LDADD) libavahi-client.la ../avahi-common/libavahi-common.la
-
-rr_test_SOURCES = rr-test.c
-rr_test_CFLAGS = $(AM_CFLAGS)
-rr_test_LDADD = $(AM_LDADD) libavahi-client.la ../avahi-common/libavahi-common.la
-
-xdg_config_test_SOURCES = xdg-config-test.c xdg-config.c xdg-config.h
-xdg_config_test_CFLAGS = $(AM_CFLAGS)
-xdg_config_test_LDADD = $(AM_LDADD)
-
-check_nss_test_SOURCES = check-nss.c check-nss-test.c client.h
-check_nss_test_CFLAGS = $(AM_CFLAGS)
-check_nss_test_LDADD = $(AM_LDADD)
-
-if HAVE_DLOPEN
-check_nss_test_LDADD += -ldl
-libavahi_client_la_LIBADD += -ldl
-endif
-
-endif
diff --git a/trunk/avahi-client/browser.c b/trunk/avahi-client/browser.c
deleted file mode 100644
index 24393b8..0000000
--- a/trunk/avahi-client/browser.c
+++ /dev/null
@@ -1,1028 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-
-#include "client.h"
-#include "internal.h"
-#include "xdg-config.h"
-
-static void parse_environment(AvahiDomainBrowser *b) {
- char buf[AVAHI_DOMAIN_NAME_MAX*3], *e, *t, *p;
-
- assert(b);
-
- if (!(e = getenv("AVAHI_BROWSE_DOMAINS")))
- return;
-
- snprintf(buf, sizeof(buf), "%s", e);
-
- for (t = strtok_r(buf, ":", &p); t; t = strtok_r(NULL, ":", &p)) {
- char domain[AVAHI_DOMAIN_NAME_MAX];
- if (avahi_normalize_name(t, domain, sizeof(domain)))
- b->static_browse_domains = avahi_string_list_add(b->static_browse_domains, domain);
- }
-}
-
-static void parse_domain_file(AvahiDomainBrowser *b) {
- FILE *f;
- char buf[AVAHI_DOMAIN_NAME_MAX];
-
- assert(b);
-
- if (!(f = avahi_xdg_config_open("avahi/browse-domains")))
- return;
-
-
- while (fgets(buf, sizeof(buf)-1, f)) {
- char domain[AVAHI_DOMAIN_NAME_MAX];
- buf[strcspn(buf, "\n\r")] = 0;
-
- if (avahi_normalize_name(buf, domain, sizeof(domain)))
- b->static_browse_domains = avahi_string_list_add(b->static_browse_domains, domain);
- }
-}
-
-static void domain_browser_ref(AvahiDomainBrowser *db) {
- assert(db);
- assert(db->ref >= 1);
- db->ref++;
-}
-
-static void defer_timeout_callback(AvahiTimeout *t, void *userdata) {
- AvahiDomainBrowser *db = userdata;
- AvahiStringList *l;
- assert(t);
-
- db->client->poll_api->timeout_free(db->defer_timeout);
- db->defer_timeout = NULL;
-
- domain_browser_ref(db);
-
- for (l = db->static_browse_domains; l; l = l->next) {
-
- if (db->ref <= 1)
- break;
-
- db->callback(db, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_NEW, (char*) l->text, AVAHI_LOOKUP_RESULT_STATIC, db->userdata);
- }
-
- avahi_domain_browser_free(db);
-}
-
-AvahiDomainBrowser* avahi_domain_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType btype,
- AvahiLookupFlags flags,
- AvahiDomainBrowserCallback callback,
- void *userdata) {
-
- AvahiDomainBrowser *db = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_interface, i_protocol, bt;
- uint32_t u_flags;
-
- assert(client);
- assert(callback);
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!domain)
- domain = "";
-
- if (!(db = avahi_new (AvahiDomainBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- db->ref = 1;
- db->client = client;
- db->callback = callback;
- db->userdata = userdata;
- db->path = NULL;
- db->interface = interface;
- db->protocol = protocol;
- db->static_browse_domains = NULL;
- db->defer_timeout = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiDomainBrowser, domain_browsers, client->domain_browsers, db);
-
- if (!(client->flags & AVAHI_CLIENT_IGNORE_USER_CONFIG)) {
- parse_environment(db);
- parse_domain_file(db);
- }
-
- db->static_browse_domains = avahi_string_list_reverse(db->static_browse_domains);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "DomainBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
- bt = btype;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &bt,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(db->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (db->static_browse_domains && btype == AVAHI_DOMAIN_BROWSER_BROWSE) {
- struct timeval tv = { 0, 0 };
-
- if (!(db->defer_timeout = client->poll_api->timeout_new(client->poll_api, &tv, defer_timeout_callback, db))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return db;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (db)
- avahi_domain_browser_free(db);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_domain_browser_free (AvahiDomainBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- assert(b->ref >= 1);
-
- if (--(b->ref) >= 1)
- return AVAHI_OK;
-
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiDomainBrowser, domain_browsers, client->domain_browsers, b);
-
- if (b->defer_timeout)
- b->client->poll_api->timeout_free(b->defer_timeout);
-
- avahi_string_list_free(b->static_browse_domains);
- avahi_free(b->path);
- avahi_free(b);
-
- return r;
-}
-
-DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiDomainBrowser *db = NULL;
- DBusError error;
- const char *path;
- char *domain = NULL;
- int32_t interface, protocol;
- uint32_t flags = 0;
- AvahiStringList *l;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (db = client->domain_browsers; db; db = db->domain_browsers_next)
- if (strcmp (db->path, path) == 0)
- break;
-
- if (!db)
- goto fail;
-
- interface = db->interface;
- protocol = db->protocol;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(db->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- if (domain)
- for (l = db->static_browse_domains; l; l = l->next)
- if (avahi_domain_equal((char*) l->text, domain)) {
- /* We had this entry already in the static entries */
- return DBUS_HANDLER_RESULT_HANDLED;
- }
-
- db->callback(db, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, domain, (AvahiLookupResultFlags) flags, db->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-/* AvahiServiceTypeBrowser */
-
-AvahiServiceTypeBrowser* avahi_service_type_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceTypeBrowserCallback callback,
- void *userdata) {
-
- AvahiServiceTypeBrowser *b = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(client);
- assert(callback);
-
- dbus_error_init(&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!domain)
- domain = "";
-
- if (!(b = avahi_new(AvahiServiceTypeBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- b->client = client;
- b->callback = callback;
- b->userdata = userdata;
- b->path = NULL;
- b->domain = NULL;
- b->interface = interface;
- b->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiServiceTypeBrowser, service_type_browsers, client->service_type_browsers, b);
-
- if (domain[0])
- if (!(b->domain = avahi_strdup(domain))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceTypeBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID)) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(b->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return b;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (b)
- avahi_service_type_browser_free(b);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_service_type_browser_free (AvahiServiceTypeBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiServiceTypeBrowser, service_type_browsers, b->client->service_type_browsers, b);
-
- avahi_free(b->path);
- avahi_free(b->domain);
- avahi_free(b);
- return r;
-}
-
-DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiServiceTypeBrowser *b = NULL;
- DBusError error;
- const char *path;
- char *domain, *type = NULL;
- int32_t interface, protocol;
- uint32_t flags = 0;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (b = client->service_type_browsers; b; b = b->service_type_browsers_next)
- if (strcmp (b->path, path) == 0)
- break;
-
- if (!b)
- goto fail;
-
- domain = b->domain;
- interface = b->interface;
- protocol = b->protocol;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, type, domain, (AvahiLookupResultFlags) flags, b->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-/* AvahiServiceBrowser */
-
-AvahiServiceBrowser* avahi_service_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *type,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceBrowserCallback callback,
- void *userdata) {
-
- AvahiServiceBrowser *b = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_protocol, i_interface;
- uint32_t u_flags;
-
- assert(client);
- assert(type);
- assert(callback);
-
- dbus_error_init(&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!domain)
- domain = "";
-
- if (!(b = avahi_new(AvahiServiceBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- b->client = client;
- b->callback = callback;
- b->userdata = userdata;
- b->path = NULL;
- b->type = b->domain = NULL;
- b->interface = interface;
- b->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiServiceBrowser, service_browsers, client->service_browsers, b);
-
- if (!(b->type = avahi_strdup(type))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (domain && domain[0])
- if (!(b->domain = avahi_strdup(domain))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID)) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(b->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return b;
-
-fail:
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (b)
- avahi_service_browser_free(b);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_service_browser_free (AvahiServiceBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiServiceBrowser, service_browsers, b->client->service_browsers, b);
-
- avahi_free(b->path);
- avahi_free(b->type);
- avahi_free(b->domain);
- avahi_free(b);
- return r;
-}
-
-DBusHandlerResult avahi_service_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiServiceBrowser *b = NULL;
- DBusError error;
- const char *path;
- char *name = NULL, *type, *domain;
- int32_t interface, protocol;
- uint32_t flags = 0;
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (b = client->service_browsers; b; b = b->service_browsers_next)
- if (strcmp (b->path, path) == 0)
- break;
-
- if (!b)
- goto fail;
-
- type = b->type;
- domain = b->domain;
- interface = b->interface;
- protocol = b->protocol;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
-
- if (!dbus_message_get_args (
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, name, type, domain, (AvahiLookupResultFlags) flags, b->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-/* AvahiRecordBrowser */
-
-AvahiRecordBrowser* avahi_record_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- AvahiLookupFlags flags,
- AvahiRecordBrowserCallback callback,
- void *userdata) {
-
- AvahiRecordBrowser *b = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int32_t i_protocol, i_interface;
- uint32_t u_flags;
-
- assert(client);
- assert(name);
- assert(callback);
-
- dbus_error_init(&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(b = avahi_new(AvahiRecordBrowser, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- b->client = client;
- b->callback = callback;
- b->userdata = userdata;
- b->path = NULL;
- b->name = NULL;
- b->clazz = clazz;
- b->type = type;
- b->interface = interface;
- b->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiRecordBrowser, record_browsers, client->record_browsers, b);
-
- if (!(b->name = avahi_strdup(name))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "RecordBrowserNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID)) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(b->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return b;
-
-fail:
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (b)
- avahi_record_browser_free(b);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-AvahiClient* avahi_record_browser_get_client (AvahiRecordBrowser *b) {
- assert(b);
- return b->client;
-}
-
-int avahi_record_browser_free (AvahiRecordBrowser *b) {
- AvahiClient *client;
- int r = AVAHI_OK;
-
- assert(b);
- client = b->client;
-
- if (b->path && avahi_client_is_connected(b->client))
- r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiRecordBrowser, record_browsers, b->client->record_browsers, b);
-
- avahi_free(b->path);
- avahi_free(b->name);
- avahi_free(b);
- return r;
-}
-
-DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message) {
- AvahiRecordBrowser *b = NULL;
- DBusError error;
- const char *path;
- char *name;
- int32_t interface, protocol;
- uint32_t flags = 0;
- uint16_t clazz, type;
- void *rdata = NULL;
- int rdata_size = 0;
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (b = client->record_browsers; b; b = b->record_browsers_next)
- if (strcmp (b->path, path) == 0)
- break;
-
- if (!b)
- goto fail;
-
- interface = b->interface;
- protocol = b->protocol;
- clazz = b->clazz;
- type = b->type;
- name = b->name;
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE: {
- DBusMessageIter iter, sub;
- int j;
-
- if (!dbus_message_get_args (
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
-
- dbus_message_iter_init(message, &iter);
-
- for (j = 0; j < 5; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE)
- goto fail;
-
- dbus_message_iter_recurse(&iter, &sub);
- dbus_message_iter_get_fixed_array(&sub, &rdata, &rdata_size);
-
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32)
- goto fail;
-
- dbus_message_iter_get_basic(&iter, &flags);
-
- break;
- }
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse browser event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
- break;
- }
- }
-
- b->callback(b, (AvahiIfIndex) interface, (AvahiProtocol) protocol, event, name, clazz, type, rdata, (size_t) rdata_size, (AvahiLookupResultFlags) flags, b->userdata);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
diff --git a/trunk/avahi-client/check-nss-test.c b/trunk/avahi-client/check-nss-test.c
deleted file mode 100644
index 172b4fa..0000000
--- a/trunk/avahi-client/check-nss-test.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include <avahi-client/client.h>
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- printf("NSS Support available: %s\n", avahi_nss_support() ? "yes" : "no");
-}
diff --git a/trunk/avahi-client/check-nss.c b/trunk/avahi-client/check-nss.c
deleted file mode 100644
index 0a933fa..0000000
--- a/trunk/avahi-client/check-nss.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_DLOPEN
-#include <dlfcn.h>
-#endif
-#include <stdlib.h>
-
-#include "client.h"
-
-int avahi_nss_support(void) {
- int b = 0;
-
-#ifdef HAVE_DLOPEN
- static const char * const libs[] = {
- "libnss_mdns.so.2",
- "libnss_mdns4.so.2",
- "libnss_mdns6.so.2",
- NULL };
-
- const char * const *l;
-
- for (l = libs; *l; l++) {
- void *dl;
-
- if ((dl = dlopen(*l, RTLD_LAZY))) {
- b = 1;
- dlclose(dl);
- break;
- }
- }
-#endif
-
- return b;
-}
diff --git a/trunk/avahi-client/client-test.c b/trunk/avahi-client/client-test.c
deleted file mode 100644
index 7d30651..0000000
--- a/trunk/avahi-client/client-test.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-#include <avahi-client/publish.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/timeval.h>
-
-static const AvahiPoll *poll_api = NULL;
-static AvahiSimplePoll *simple_poll = NULL;
-
-static void avahi_client_callback (AvahiClient *c, AvahiClientState state, void *userdata) {
- printf ("CLIENT: Callback on %p, state -> %d, data -> %s\n", (void*) c, state, (char*)userdata);
-}
-
-static void avahi_entry_group_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- printf ("ENTRY-GROUP: Callback on %p, state -> %d, data -> %s\n", (void*) g, state, (char*)userdata);
-}
-
-static void avahi_entry_group2_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- printf ("ENTRY-GROUP2: Callback on %p, state -> %d, data -> %s\n", (void*) g, state, (char*)userdata);
-}
-
-static void avahi_domain_browser_callback(
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- printf ("DOMAIN-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, domain ? domain : "NULL", (char*)userdata);
-}
-
-static void avahi_service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- char addr[64];
- char *txtr;
- if (event == AVAHI_RESOLVER_FAILURE) {
- printf ("SERVICE-RESOLVER: ServiceResolver %p timed out (%s %s)\n", (void*) r, name, type);
- return;
- }
- avahi_address_snprint (addr, sizeof (addr), a);
- txtr = avahi_string_list_to_string (txt);
- printf ("SERVICE-RESOLVER: Callback on ServiceResolver, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), host_name (%s), address (%s), port (%d), txtdata (%s), data(%s)\n", interface, protocol, event, name, type, domain, host_name, addr, port, txtr, (char*)userdata);
- avahi_free(txtr);
-}
-
-static void avahi_service_browser_callback (
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- AvahiServiceResolver *sr;
-
- printf ("SERVICE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, name ? name : "NULL", type, domain ? domain : "NULL", (char*)userdata);
-
- if (b && name)
- {
- sr = avahi_service_resolver_new (avahi_service_browser_get_client (b), interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, avahi_service_resolver_callback, "xxXXxx");
- printf("New service resolver %p\n", (void*) sr);
- }
-}
-
-static void avahi_service_type_browser_callback (
- AvahiServiceTypeBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- printf ("SERVICE-TYPE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, type ? type : "NULL", domain ? domain : "NULL", (char*)userdata);
-}
-
-static void avahi_address_resolver_callback (
- AVAHI_GCC_UNUSED AvahiAddressResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *address,
- const char *name,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- char addr[64];
- if (event == AVAHI_RESOLVER_FAILURE) {
- printf ("ADDRESS-RESOLVER: Callback on AddressResolver, timed out.\n");
- return;
- }
- avahi_address_snprint (addr, sizeof (addr), address);
- printf ("ADDRESS-RESOLVER: Callback on AddressResolver, interface (%d), protocol (%d), even (%d), address (%s), name (%s), data(%s)\n", interface, protocol, event, addr, name, (char*) userdata);
-}
-
-static void avahi_host_name_resolver_callback (
- AvahiHostNameResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- AvahiClient *client;
- AvahiAddressResolver *ar;
- char addr[64];
-
- if (event == AVAHI_RESOLVER_FAILURE) {
- printf ("HOST-NAME-RESOLVER: Callback on HostNameResolver, timed out.\n");
- return;
- }
- client = avahi_host_name_resolver_get_client (r);
- ar = avahi_address_resolver_new(client, interface, protocol, a, 0, avahi_address_resolver_callback, "omghai6u");
- if (ar)
- {
- printf ("Succesfully created address resolver object\n");
- } else {
- printf ("Failed to create AddressResolver\n");
- }
- avahi_address_snprint (addr, sizeof (addr), a);
- printf ("HOST-NAME-RESOLVER: Callback on HostNameResolver, interface (%d), protocol (%d), event (%d), name (%s), address (%s), data (%s)\n", interface, protocol, event, name, addr, (char*)userdata);
-}
-static void test_free_domain_browser(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata)
-{
- AvahiServiceBrowser *b = userdata;
- printf ("Freeing domain browser\n");
- avahi_service_browser_free (b);
-}
-
-static void test_free_entry_group (AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata)
-{
- AvahiEntryGroup *g = userdata;
- printf ("Freeing entry group\n");
- avahi_entry_group_free (g);
-}
-
-static void test_entry_group_reset (AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata)
-{
- AvahiEntryGroup *g = userdata;
-
- printf ("Resetting entry group\n");
- avahi_entry_group_reset (g);
-
- avahi_entry_group_add_service (g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar2", NULL);
-
- avahi_entry_group_commit (g);
-}
-
-static void test_entry_group_update(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata) {
- AvahiEntryGroup *g = userdata;
-
- printf ("Updating entry group\n");
-
- avahi_entry_group_update_service_txt(g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, "foo=bar3", NULL);
-}
-
-static void terminate(AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
-
- avahi_simple_poll_quit(simple_poll);
-}
-
-int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiClient *avahi;
- AvahiEntryGroup *group, *group2;
- AvahiDomainBrowser *domain;
- AvahiServiceBrowser *sb;
- AvahiServiceTypeBrowser *st;
- AvahiHostNameResolver *hnr;
- AvahiAddress *aar;
- const char *ret;
- int error;
- uint32_t cookie;
- struct timeval tv;
- AvahiAddress a;
-
- simple_poll = avahi_simple_poll_new();
- poll_api = avahi_simple_poll_get(simple_poll);
-
- if (!(avahi = avahi_client_new(poll_api, 0, avahi_client_callback, "omghai2u", &error))) {
- fprintf(stderr, "Client failed: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- printf("State: %i\n", avahi_client_get_state(avahi));
-
- ret = avahi_client_get_version_string (avahi);
- printf("Avahi Server Version: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- ret = avahi_client_get_host_name (avahi);
- printf("Host Name: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- ret = avahi_client_get_domain_name (avahi);
- printf("Domain Name: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- ret = avahi_client_get_host_name_fqdn (avahi);
- printf("FQDN: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- cookie = avahi_client_get_local_service_cookie(avahi);
- printf("Local service cookie: %u (Error Return: %s)\n", cookie, cookie != AVAHI_SERVICE_COOKIE_INVALID ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
- group = avahi_entry_group_new(avahi, avahi_entry_group_callback, "omghai");
- printf("Creating entry group: %s\n", group ? "OK" : avahi_strerror(avahi_client_errno (avahi)));
-
- assert(group);
-
- printf("Sucessfully created entry group %p\n", (void*) group);
-
- printf("%s\n", avahi_strerror(avahi_entry_group_add_service (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar", NULL)));
- printf("add_record: %d\n", avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", 0x01, 0x10, 120, "\5booya", 6));
-
- avahi_entry_group_commit (group);
-
- domain = avahi_domain_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, avahi_domain_browser_callback, "omghai3u");
-
- if (domain == NULL)
- printf ("Failed to create domain browser object\n");
- else
- printf ("Sucessfully created domain browser %p\n", (void*) domain);
-
- st = avahi_service_type_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, 0, avahi_service_type_browser_callback, "omghai3u");
- if (st == NULL)
- printf ("Failed to create service type browser object\n");
- else
- printf ("Sucessfully created service type browser %p\n", (void*) st);
-
- sb = avahi_service_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, avahi_service_browser_callback, "omghai3u");
- if (sb == NULL)
- printf ("Failed to create service browser object\n");
- else
- printf ("Sucessfully created service browser %p\n", (void*) sb);
-
- hnr = avahi_host_name_resolver_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "ecstasy.local", AVAHI_PROTO_UNSPEC, 0, avahi_host_name_resolver_callback, "omghai4u");
- if (hnr == NULL)
- printf ("Failed to create hostname resolver object\n");
- else
- printf ("Successfully created hostname resolver object\n");
-
- aar = avahi_address_parse ("224.0.0.251", AVAHI_PROTO_UNSPEC, &a);
- if (aar == NULL) {
- printf ("failed to create address object\n");
- } else {
- group2 = avahi_entry_group_new (avahi, avahi_entry_group2_callback, "omghai222");
- if ((error = avahi_entry_group_add_address (group2, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "test-mdns.local.", aar)) < 0)
- {
- printf ("*** failed to add address to entry group: %s\n", avahi_strerror (error));
- avahi_entry_group_free (group2);
- } else {
- printf ("*** success, added address\n");
- avahi_entry_group_commit (group2);
- }
- }
-
- avahi_elapse_time(&tv, 8000, 0);
- poll_api->timeout_new(poll_api, &tv, test_entry_group_reset, group);
- avahi_elapse_time(&tv, 15000, 0);
- poll_api->timeout_new(poll_api, &tv, test_entry_group_update, group);
- avahi_elapse_time(&tv, 20000, 0);
- poll_api->timeout_new(poll_api, &tv, test_free_entry_group, group);
- avahi_elapse_time(&tv, 25000, 0);
- poll_api->timeout_new(poll_api, &tv, test_free_domain_browser, sb);
-
- avahi_elapse_time(&tv, 30000, 0);
- poll_api->timeout_new(poll_api, &tv, terminate, NULL);
-
- avahi_simple_poll_loop(simple_poll);
-
- printf("terminating...\n");
-
-fail:
-
- if (avahi)
- avahi_client_free (avahi);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/trunk/avahi-client/client.c b/trunk/avahi-client/client.c
deleted file mode 100644
index f665613..0000000
--- a/trunk/avahi-client/client.c
+++ /dev/null
@@ -1,943 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus-watch-glue.h>
-
-#include "client.h"
-#include "internal.h"
-
-#define AVAHI_CLIENT_DBUS_API_SUPPORTED ((uint32_t) 0x0201)
-
-static int init_server(AvahiClient *client, int *ret_error);
-
-int avahi_client_set_errno (AvahiClient *client, int error) {
- assert(client);
-
- return client->error = error;
-}
-
-int avahi_client_set_dbus_error(AvahiClient *client, DBusError *error) {
- assert(client);
- assert(error);
-
- return avahi_client_set_errno(client, avahi_error_dbus_to_number(error->name));
-}
-
-static void client_set_state (AvahiClient *client, AvahiServerState state) {
- assert(client);
-
- if (client->state == state)
- return;
-
- client->state = state;
-
- switch (client->state) {
- case AVAHI_CLIENT_FAILURE:
- if (client->bus) {
-#ifdef HAVE_DBUS_CONNECTION_CLOSE
- dbus_connection_close(client->bus);
-#else
- dbus_connection_disconnect(client->bus);
-#endif
- dbus_connection_unref(client->bus);
- client->bus = NULL;
- }
-
- /* Fall through */
-
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_S_REGISTERING:
-
- /* Clear cached strings */
- avahi_free(client->host_name);
- avahi_free(client->host_name_fqdn);
- avahi_free(client->domain_name);
-
- client->host_name = NULL;
- client->host_name_fqdn = NULL;
- client->domain_name = NULL;
- break;
-
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_CONNECTING:
- break;
-
- }
-
- if (client->callback)
- client->callback (client, state, client->userdata);
-}
-
-static DBusHandlerResult filter_func(DBusConnection *bus, DBusMessage *message, void *userdata) {
- AvahiClient *client = userdata;
- DBusError error;
-
- assert(bus);
- assert(message);
-
- dbus_error_init(&error);
-
-/* fprintf(stderr, "dbus: interface=%s, path=%s, member=%s\n", */
-/* dbus_message_get_interface (message), */
-/* dbus_message_get_path (message), */
-/* dbus_message_get_member (message)); */
-
- if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
-
- /* The DBUS server died or kicked us */
- avahi_client_set_errno(client, AVAHI_ERR_DISCONNECTED);
- goto fail;
-
- } else if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameAcquired")) {
-
- /* Ignore this message */
-
- } else if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
- char *name, *old, *new;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &old,
- DBUS_TYPE_STRING, &new,
- DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
-
- fprintf(stderr, "WARNING: Failed to parse NameOwnerChanged signal: %s\n", error.message);
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (strcmp(name, AVAHI_DBUS_NAME) == 0) {
-
- if (avahi_client_is_connected(client)) {
-
- /* Regardless if the server lost or acquired its name or
- * if the name was transfered: our services are no longer
- * available, so we disconnect ourselves */
- avahi_client_set_errno(client, AVAHI_ERR_DISCONNECTED);
- goto fail;
-
- } else if (client->state == AVAHI_CLIENT_CONNECTING && (!old || *old == 0)) {
- int ret;
-
- /* Server appeared */
-
- if ((ret = init_server(client, NULL)) < 0) {
- avahi_client_set_errno(client, ret);
- goto fail;
- }
- }
- }
-
- } else if (!avahi_client_is_connected(client)) {
-
- /* Ignore messages we get in unconnected state */
-
- } else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_SERVER, "StateChanged")) {
- int32_t state;
- char *e = NULL;
- int c;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &state,
- DBUS_TYPE_STRING, &e,
- DBUS_TYPE_INVALID) || dbus_error_is_set (&error)) {
-
- fprintf(stderr, "WARNING: Failed to parse Server.StateChanged signal: %s\n", error.message);
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if ((c = avahi_error_dbus_to_number(e)) != AVAHI_OK)
- avahi_client_set_errno(client, c);
-
- client_set_state(client, (AvahiClientState) state);
-
- } else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "StateChanged")) {
- const char *path;
- AvahiEntryGroup *g;
- path = dbus_message_get_path(message);
-
- for (g = client->groups; g; g = g->groups_next)
- if (strcmp(g->path, path) == 0)
- break;
-
- if (g) {
- int32_t state;
- char *e;
- int c;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &state,
- DBUS_TYPE_STRING, &e,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error)) {
-
- fprintf(stderr, "WARNING: Failed to parse EntryGroup.StateChanged signal: %s\n", error.message);
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if ((c = avahi_error_dbus_to_number(e)) != AVAHI_OK)
- avahi_client_set_errno(client, c);
-
- avahi_entry_group_set_state(g, state);
- }
-
- } else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "ItemNew"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "ItemRemove"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "CacheExhausted"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "AllForNow"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Failure"))
- return avahi_domain_browser_event(client, AVAHI_BROWSER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "ItemNew"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "ItemRemove"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "CacheExhausted"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "AllForNow"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Failure"))
- return avahi_service_type_browser_event (client, AVAHI_BROWSER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "ItemNew"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "ItemRemove"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "CacheExhausted"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "AllForNow"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Failure"))
- return avahi_service_browser_event (client, AVAHI_BROWSER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Found"))
- return avahi_service_resolver_event (client, AVAHI_RESOLVER_FOUND, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Failure"))
- return avahi_service_resolver_event (client, AVAHI_RESOLVER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Found"))
- return avahi_host_name_resolver_event (client, AVAHI_RESOLVER_FOUND, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Failure"))
- return avahi_host_name_resolver_event (client, AVAHI_RESOLVER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Found"))
- return avahi_address_resolver_event (client, AVAHI_RESOLVER_FOUND, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Failure"))
- return avahi_address_resolver_event (client, AVAHI_RESOLVER_FAILURE, message);
-
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "ItemNew"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_NEW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "ItemRemove"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_REMOVE, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "CacheExhausted"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_CACHE_EXHAUSTED, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "AllForNow"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_ALL_FOR_NOW, message);
- else if (dbus_message_is_signal(message, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Failure"))
- return avahi_record_browser_event (client, AVAHI_BROWSER_FAILURE, message);
-
- else {
-
- fprintf(stderr, "WARNING: Unhandled message: interface=%s, path=%s, member=%s\n",
- dbus_message_get_interface(message),
- dbus_message_get_path(message),
- dbus_message_get_member(message));
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, avahi_error_dbus_to_number(error.name));
- dbus_error_free(&error);
- }
-
- client_set_state(client, AVAHI_CLIENT_FAILURE);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static int get_server_state(AvahiClient *client, int *ret_error) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int32_t state;
- int e = AVAHI_ERR_NO_MEMORY;
-
- assert(client);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetState")))
- goto fail;
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- client_set_state(client, (AvahiServerState) state);
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- e = avahi_error_dbus_to_number (error.name);
- dbus_error_free(&error);
- }
-
- if (ret_error)
- *ret_error = e;
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- return e;
-}
-
-static int check_version(AvahiClient *client, int *ret_error) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- uint32_t version;
- int e = AVAHI_ERR_NO_MEMORY;
-
- assert(client);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetAPIVersion")))
- goto fail;
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error)) {
- char *version_str;
-
- if (!dbus_error_is_set(&error) || strcmp(error.name, DBUS_ERROR_UNKNOWN_METHOD))
- goto fail;
-
- /* If the method GetAPIVersion is not known, we look if
- * GetVersionString matches "avahi 0.6" which is the only
- * version we support which doesn't have GetAPIVersion() .*/
-
- dbus_message_unref(message);
- if (reply) dbus_message_unref(reply);
- dbus_error_free(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetVersionString")))
- goto fail;
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &version_str, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- version = strcmp(version_str, "avahi 0.6") == 0 ? 0x0201 : 0x0000;
-
- } else {
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &version, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error))
- goto fail;
- }
-
- /*fprintf(stderr, "API Version 0x%04x\n", version);*/
-
- if ((version & 0xFF00) != (AVAHI_CLIENT_DBUS_API_SUPPORTED & 0xFF00) ||
- (version & 0x00FF) < (AVAHI_CLIENT_DBUS_API_SUPPORTED & 0x00FF)) {
- e = AVAHI_ERR_VERSION_MISMATCH;
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- e = avahi_error_dbus_to_number (error.name);
- dbus_error_free(&error);
- }
-
- if (ret_error)
- *ret_error = e;
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- return e;
-}
-
-static int init_server(AvahiClient *client, int *ret_error) {
- int r;
-
- if ((r = check_version(client, ret_error)) < 0)
- return r;
-
- if ((r = get_server_state(client, ret_error)) < 0)
- return r;
-
- return AVAHI_OK;
-}
-
-/* This function acts like dbus_bus_get but creates a private
- * connection instead. */
-static DBusConnection* avahi_dbus_bus_get(DBusError *error) {
- DBusConnection *c;
-
-#ifdef HAVE_DBUS_BUS_GET_PRIVATE
- if (!(c = dbus_bus_get_private(DBUS_BUS_SYSTEM, error)))
- return NULL;
-
- dbus_connection_set_exit_on_disconnect(c, FALSE);
-#else
- const char *a;
-
- if (!(a = getenv("DBUS_SYSTEM_BUS_ADDRESS")) || !*a)
- a = DBUS_SYSTEM_BUS_DEFAULT_ADDRESS;
-
- if (!(c = dbus_connection_open_private(a, error)))
- return NULL;
-
- dbus_connection_set_exit_on_disconnect(c, FALSE);
-
- if (!dbus_bus_register(c, error)) {
-#ifdef HAVE_DBUS_CONNECTION_CLOSE
- dbus_connection_close(c);
-#else
- dbus_connection_disconnect(c);
-#endif
- dbus_connection_unref(c);
- return NULL;
- }
-#endif
-
- return c;
-}
-
-AvahiClient *avahi_client_new(const AvahiPoll *poll_api, AvahiClientFlags flags, AvahiClientCallback callback, void *userdata, int *ret_error) {
- AvahiClient *client = NULL;
- DBusError error;
-
- dbus_error_init(&error);
-
- if (!(client = avahi_new(AvahiClient, 1))) {
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_MEMORY;
- goto fail;
- }
-
- client->poll_api = poll_api;
- client->error = AVAHI_OK;
- client->callback = callback;
- client->userdata = userdata;
- client->state = (AvahiClientState) -1;
- client->flags = flags;
-
- client->host_name = NULL;
- client->host_name_fqdn = NULL;
- client->domain_name = NULL;
- client->version_string = NULL;
- client->local_service_cookie_valid = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiEntryGroup, client->groups);
- AVAHI_LLIST_HEAD_INIT(AvahiDomainBrowser, client->domain_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiServiceBrowser, client->service_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiServiceTypeBrowser, client->service_type_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiServiceResolver, client->service_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiHostNameResolver, client->host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiAddressResolver, client->address_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiRecordBrowser, client->record_browsers);
-
- if (!(client->bus = avahi_dbus_bus_get(&error)) || dbus_error_is_set(&error)) {
- if (ret_error)
- *ret_error = AVAHI_ERR_DBUS_ERROR;
- goto fail;
- }
-
- if (avahi_dbus_connection_glue(client->bus, poll_api) < 0) {
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_MEMORY; /* Not optimal */
- goto fail;
- }
-
- if (!dbus_connection_add_filter (client->bus, filter_func, client, NULL)) {
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_MEMORY;
- goto fail;
- }
-
- dbus_bus_add_match(
- client->bus,
- "type='signal', "
- "interface='" AVAHI_DBUS_INTERFACE_SERVER "', "
- "sender='" AVAHI_DBUS_NAME "', "
- "path='" AVAHI_DBUS_PATH_SERVER "'",
- &error);
-
- if (dbus_error_is_set(&error))
- goto fail;
-
- dbus_bus_add_match (
- client->bus,
- "type='signal', "
- "interface='" DBUS_INTERFACE_DBUS "', "
- "sender='" DBUS_SERVICE_DBUS "', "
- "path='" DBUS_PATH_DBUS "'",
- &error);
-
- if (dbus_error_is_set(&error))
- goto fail;
-
- dbus_bus_add_match (
- client->bus,
- "type='signal', "
- "interface='" DBUS_INTERFACE_LOCAL "'",
- &error);
-
- if (dbus_error_is_set(&error))
- goto fail;
-
-
- if (!(dbus_bus_name_has_owner(client->bus, AVAHI_DBUS_NAME, &error)) ||
- dbus_error_is_set(&error)) {
-
- /* We free the error so its not set, that way the fail target
- * will return the NO_DAEMON error rather than a DBUS error */
- dbus_error_free(&error);
-
- if (!(flags & AVAHI_CLIENT_NO_FAIL)) {
-
- if (ret_error)
- *ret_error = AVAHI_ERR_NO_DAEMON;
-
- goto fail;
- }
-
- /* The user doesn't want this call to fail if the daemon is not
- * available, so let's return succesfully */
- client_set_state(client, AVAHI_CLIENT_CONNECTING);
-
- } else {
-
- if (init_server(client, ret_error) < 0)
- goto fail;
- }
-
- return client;
-
-fail:
-
- if (client)
- avahi_client_free(client);
-
- if (dbus_error_is_set(&error)) {
-
- if (ret_error) {
- if (strcmp(error.name, DBUS_ERROR_FILE_NOT_FOUND) == 0)
- /* DBUS returns this error when the DBUS daemon is not running */
- *ret_error = AVAHI_ERR_NO_DAEMON;
- else
- *ret_error = avahi_error_dbus_to_number(error.name);
- }
-
- dbus_error_free(&error);
- }
-
- return NULL;
-}
-
-void avahi_client_free(AvahiClient *client) {
- assert(client);
-
- if (client->bus)
- /* Disconnect in advance, so that the free() functions won't
- * issue needless server calls */
-#ifdef HAVE_DBUS_CONNECTION_CLOSE
- dbus_connection_close(client->bus);
-#else
- dbus_connection_disconnect(client->bus);
-#endif
-
- while (client->groups)
- avahi_entry_group_free(client->groups);
-
- while (client->domain_browsers)
- avahi_domain_browser_free(client->domain_browsers);
-
- while (client->service_browsers)
- avahi_service_browser_free(client->service_browsers);
-
- while (client->service_type_browsers)
- avahi_service_type_browser_free(client->service_type_browsers);
-
- while (client->service_resolvers)
- avahi_service_resolver_free(client->service_resolvers);
-
- while (client->host_name_resolvers)
- avahi_host_name_resolver_free(client->host_name_resolvers);
-
- while (client->address_resolvers)
- avahi_address_resolver_free(client->address_resolvers);
-
- while (client->record_browsers)
- avahi_record_browser_free(client->record_browsers);
-
- if (client->bus)
- dbus_connection_unref(client->bus);
-
- avahi_free(client->version_string);
- avahi_free(client->host_name);
- avahi_free(client->host_name_fqdn);
- avahi_free(client->domain_name);
-
- avahi_free(client);
-}
-
-static char* avahi_client_get_string_reply_and_block (AvahiClient *client, const char *method, const char *param) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *ret, *n;
-
- assert(client);
- assert(method);
-
- dbus_error_init (&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, method))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (param) {
- if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &param, DBUS_TYPE_INVALID)) {
- avahi_client_set_errno (client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
- }
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_STRING, &ret, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- if (!(n = avahi_strdup(ret))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return n;
-
-fail:
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- return NULL;
-}
-
-const char* avahi_client_get_version_string(AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->version_string)
- client->version_string = avahi_client_get_string_reply_and_block(client, "GetVersionString", NULL);
-
- return client->version_string;
-}
-
-const char* avahi_client_get_domain_name(AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->domain_name)
- client->domain_name = avahi_client_get_string_reply_and_block(client, "GetDomainName", NULL);
-
- return client->domain_name;
-}
-
-const char* avahi_client_get_host_name(AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->host_name)
- client->host_name = avahi_client_get_string_reply_and_block(client, "GetHostName", NULL);
-
- return client->host_name;
-}
-
-const char* avahi_client_get_host_name_fqdn (AvahiClient *client) {
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return NULL;
- }
-
- if (!client->host_name_fqdn)
- client->host_name_fqdn = avahi_client_get_string_reply_and_block(client, "GetHostNameFqdn", NULL);
-
- return client->host_name_fqdn;
-}
-
-AvahiClientState avahi_client_get_state(AvahiClient *client) {
- assert(client);
-
- return client->state;
-}
-
-int avahi_client_errno(AvahiClient *client) {
- assert(client);
-
- return client->error;
-}
-
-/* Just for internal use */
-int avahi_client_simple_method_call(AvahiClient *client, const char *path, const char *interface, const char *method) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
-
- dbus_error_init(&error);
-
- assert(client);
- assert(path);
- assert(interface);
- assert(method);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, path, interface, method))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-uint32_t avahi_client_get_local_service_cookie(AvahiClient *client) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- assert(client);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- return AVAHI_SERVICE_COOKIE_INVALID;
- }
-
- if (client->local_service_cookie_valid)
- return client->local_service_cookie;
-
- dbus_error_init (&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "GetLocalServiceCookie"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_UINT32, &client->local_service_cookie, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- client->local_service_cookie_valid = 1;
- return client->local_service_cookie;
-
-fail:
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- return AVAHI_SERVICE_COOKIE_INVALID;
-}
-
-int avahi_client_is_connected(AvahiClient *client) {
- assert(client);
-
- return
- client->bus &&
- dbus_connection_get_is_connected(client->bus) &&
- (client->state == AVAHI_CLIENT_S_RUNNING || client->state == AVAHI_CLIENT_S_REGISTERING || client->state == AVAHI_CLIENT_S_COLLISION);
-}
-
-int avahi_client_set_host_name(AvahiClient* client, const char *name) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
-
- assert(client);
-
- if (!avahi_client_is_connected(client))
- return avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
-
- dbus_error_init (&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "SetHostName"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
- avahi_client_set_errno (client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error);
-
- if (!reply || dbus_error_is_set (&error))
- goto fail;
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error))
- goto fail;
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- avahi_free(client->host_name);
- client->host_name = NULL;
- avahi_free(client->host_name_fqdn);
- client->host_name_fqdn = NULL;
-
- return 0;
-
-fail:
-
- if (message)
- dbus_message_unref(message);
- if (reply)
- dbus_message_unref(reply);
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- return client->error;
-}
diff --git a/trunk/avahi-client/client.h b/trunk/avahi-client/client.h
deleted file mode 100644
index f102f05..0000000
--- a/trunk/avahi-client/client.h
+++ /dev/null
@@ -1,103 +0,0 @@
-#ifndef fooclienthfoo
-#define fooclienthfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/gccmacro.h>
-
-/** \file client.h Definitions and functions for the client API over D-Bus */
-
-AVAHI_C_DECL_BEGIN
-
-/** A connection context */
-typedef struct AvahiClient AvahiClient;
-
-/** States of a client object, a superset of AvahiServerState */
-typedef enum {
- AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING, /**< Server state: REGISTERING */
- AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING, /**< Server state: RUNNING */
- AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION, /**< Server state: COLLISION */
- AVAHI_CLIENT_FAILURE = 100, /**< Some kind of error happened on the client side */
- AVAHI_CLIENT_CONNECTING = 101 /**< We're still connecting. This state is only entered when AVAHI_CLIENT_NO_FAIL has been passed to avahi_client_new() and the daemon is not yet available. */
-} AvahiClientState;
-
-typedef enum {
- AVAHI_CLIENT_IGNORE_USER_CONFIG = 1, /**< Don't read user configuration */
- AVAHI_CLIENT_NO_FAIL = 2 /**< Don't fail if the daemon is not available when avahi_client_new() is called, instead enter AVAHI_CLIENT_CONNECTING state and wait for the daemon to appear */
-} AvahiClientFlags;
-
-/** The function prototype for the callback of an AvahiClient */
-typedef void (*AvahiClientCallback) (
- AvahiClient *s,
- AvahiClientState state /**< The new state of the client */,
- void* userdata /**< The user data that was passed to avahi_client_new() */);
-
-/** Creates a new client instance */
-AvahiClient* avahi_client_new (
- const AvahiPoll *poll_api /**< The abstract event loop API to use */,
- AvahiClientFlags flags /**< Some flags to modify the behaviour of the client library */,
- AvahiClientCallback callback /**< A callback that is called whenever the state of the client changes. This may be NULL */,
- void *userdata /**< Some arbitrary user data pointer that will be passed to the callback function */,
- int *error /**< If creation of the client fails, this integer will contain the error cause. May be NULL if you aren't interested in the reason why avahi_client_new() failed. */);
-
-/** Free a client instance. This will automatically free all
- * associated browser, resolve and entry group objects. All pointers
- * to such objects become invalid! */
-void avahi_client_free(AvahiClient *client);
-
-/** Get the version of the server */
-const char* avahi_client_get_version_string (AvahiClient*);
-
-/** Get host name */
-const char* avahi_client_get_host_name (AvahiClient*);
-
-/** Set host name. \since 0.6.13 */
-int avahi_client_set_host_name(AvahiClient*, const char *name);
-
-/** Get domain name */
-const char* avahi_client_get_domain_name (AvahiClient*);
-
-/** Get FQDN domain name */
-const char* avahi_client_get_host_name_fqdn (AvahiClient*);
-
-/** Get state */
-AvahiClientState avahi_client_get_state(AvahiClient *client);
-
-/** Get the last error number */
-int avahi_client_errno (AvahiClient*);
-
-/** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
-uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
-
-/** Return 1 if gethostbyname() supports mDNS lookups, 0 otherwise. \since 0.6.5 */
-int avahi_nss_support(void);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-client/entrygroup.c b/trunk/avahi-client/entrygroup.c
deleted file mode 100644
index e2fc3b9..0000000
--- a/trunk/avahi-client/entrygroup.c
+++ /dev/null
@@ -1,892 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-
-#include "client.h"
-#include "internal.h"
-
-void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state) {
- assert(group);
-
- if (group->state_valid && group->state == state)
- return;
-
- group->state = state;
- group->state_valid = 1;
-
- if (group->callback)
- group->callback(group, state, group->userdata);
-}
-
-static int retrieve_state(AvahiEntryGroup *group) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
- int32_t state;
- AvahiClient *client;
-
- dbus_error_init(&error);
-
- assert(group);
- client = group->client;
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "GetState"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return state;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCallback callback, void *userdata) {
- AvahiEntryGroup *group = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- char *path;
- int state;
-
- assert(client);
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(group = avahi_new(AvahiEntryGroup, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- group->client = client;
- group->callback = callback;
- group->userdata = userdata;
- group->state_valid = 0;
- group->path = NULL;
- AVAHI_LLIST_PREPEND(AvahiEntryGroup, groups, client->groups, group);
-
- if (!(message = dbus_message_new_method_call(
- AVAHI_DBUS_NAME,
- AVAHI_DBUS_PATH_SERVER,
- AVAHI_DBUS_INTERFACE_SERVER,
- "EntryGroupNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- avahi_client_set_errno (client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- avahi_client_set_errno (client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(group->path = avahi_strdup (path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if ((state = retrieve_state(group)) < 0) {
- avahi_client_set_errno(client, state);
- goto fail;
- }
-
- avahi_entry_group_set_state(group, (AvahiEntryGroupState) state);
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return group;
-
-fail:
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (group)
- avahi_entry_group_free(group);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-}
-
-static int entry_group_simple_method_call(AvahiEntryGroup *group, const char *method) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
- AvahiClient *client;
-
- dbus_error_init(&error);
-
- assert(group);
- client = group->client;
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, method))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-int avahi_entry_group_free(AvahiEntryGroup *group) {
- AvahiClient *client = group->client;
- int r = AVAHI_OK;
-
- assert(group);
-
- if (group->path && avahi_client_is_connected(client))
- r = entry_group_simple_method_call(group, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, client->groups, group);
-
- avahi_free(group->path);
- avahi_free(group);
-
- return r;
-}
-
-int avahi_entry_group_commit(AvahiEntryGroup *group) {
- int ret;
- assert(group);
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if ((ret = entry_group_simple_method_call(group, "Commit")) < 0)
- return ret;
-
- group->state_valid = 0;
- return ret;
-}
-
-int avahi_entry_group_reset(AvahiEntryGroup *group) {
- int ret;
- assert(group);
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if ((ret = entry_group_simple_method_call(group, "Reset")) < 0)
- return ret;
-
- group->state_valid = 0;
- return ret;
-}
-
-int avahi_entry_group_get_state (AvahiEntryGroup *group) {
- assert (group);
-
- if (group->state_valid)
- return group->state;
-
- return retrieve_state(group);
-}
-
-AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup *group) {
- assert(group);
-
- return group->client;
-}
-
-int avahi_entry_group_is_empty (AvahiEntryGroup *group) {
- DBusMessage *message = NULL, *reply = NULL;
- DBusError error;
- int r = AVAHI_OK;
- int b;
- AvahiClient *client;
-
- assert(group);
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "IsEmpty"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_BOOLEAN, &b, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return !!b;
-
-fail:
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-static int append_rdata(DBusMessage *message, const void *rdata, size_t size) {
- DBusMessageIter iter, sub;
-
- assert(message);
-
- dbus_message_iter_init_append(message, &iter);
-
- if (!(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &sub)) ||
- !(dbus_message_iter_append_fixed_array(&sub, DBUS_TYPE_BYTE, &rdata, size)) ||
- !(dbus_message_iter_close_container(&iter, &sub)))
- return -1;
-
- return 0;
-}
-
-static int append_string_list(DBusMessage *message, AvahiStringList *txt) {
- DBusMessageIter iter, sub;
- int r = -1;
- AvahiStringList *p;
-
- assert(message);
-
- dbus_message_iter_init_append(message, &iter);
-
- /* Reverse the string list, so that we can pass it in-order to the server */
- txt = avahi_string_list_reverse(txt);
-
- if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "ay", &sub))
- goto fail;
-
- /* Assemble the AvahiStringList into an Array of Array of Bytes to send over dbus */
- for (p = txt; p != NULL; p = p->next) {
- DBusMessageIter sub2;
- const uint8_t *data = p->text;
-
- if (!(dbus_message_iter_open_container(&sub, DBUS_TYPE_ARRAY, "y", &sub2)) ||
- !(dbus_message_iter_append_fixed_array(&sub2, DBUS_TYPE_BYTE, &data, p->size)) ||
- !(dbus_message_iter_close_container(&sub, &sub2)))
- goto fail;
- }
-
- if (!dbus_message_iter_close_container(&iter, &sub))
- goto fail;
-
- r = 0;
-
-fail:
-
- /* Reverse the string list to the original state */
- txt = avahi_string_list_reverse(txt);
-
- return r;
-}
-
-int avahi_entry_group_add_service_strlst(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *txt) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(group);
- assert(name);
- assert(type);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if (!domain)
- domain = "";
-
- if (!host)
- host = "";
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddService"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID) ||
- append_string_list(message, txt) < 0) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-int avahi_entry_group_add_service(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- ...) {
-
- va_list va;
- int r;
- AvahiStringList *txt;
-
- assert(group);
-
- va_start(va, port);
- txt = avahi_string_list_new_va(va);
- r = avahi_entry_group_add_service_strlst(group, interface, protocol, flags, name, type, domain, host, port, txt);
- avahi_string_list_free(txt);
- va_end(va);
- return r;
-}
-
-int avahi_entry_group_add_service_subtype(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *subtype) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(group);
- assert(name);
- assert(type);
- assert(subtype);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if (!domain)
- domain = "";
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddServiceSubtype"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &subtype,
- DBUS_TYPE_INVALID)) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-
-}
-
-int avahi_entry_group_update_service_txt(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- ...) {
-
- va_list va;
- int r;
- AvahiStringList *txt;
-
- va_start(va, domain);
- txt = avahi_string_list_new_va(va);
- r = avahi_entry_group_update_service_txt_strlst(group, interface, protocol, flags, name, type, domain, txt);
- avahi_string_list_free(txt);
- va_end(va);
- return r;
-}
-
-int avahi_entry_group_update_service_txt_strlst(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *txt) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(group);
- assert(name);
- assert(type);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- if (!domain)
- domain = "";
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "UpdateServiceTxt"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INVALID) ||
- append_string_list(message, txt) < 0) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-/** Add a host/address pair */
-int avahi_entry_group_add_address(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const AvahiAddress *a) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
- char s_address[AVAHI_ADDRESS_STR_MAX];
- char *p_address = s_address;
-
- assert(name);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddAddress"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!avahi_address_snprint (s_address, sizeof (s_address), a))
- {
- r = avahi_client_set_errno(client, AVAHI_ERR_INVALID_ADDRESS);
- goto fail;
- }
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &p_address,
- DBUS_TYPE_INVALID)) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
-
-/** Add an arbitrary record */
-int avahi_entry_group_add_record(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- uint32_t ttl,
- const void *rdata,
- size_t size) {
-
- DBusMessage *message = NULL, *reply = NULL;
- int r = AVAHI_OK;
- DBusError error;
- AvahiClient *client;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(name);
-
- client = group->client;
-
- if (!group->path || !avahi_client_is_connected(group->client))
- return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
-
- dbus_error_init(&error);
-
- if (!(message = dbus_message_new_method_call (AVAHI_DBUS_NAME, group->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddRecord"))) {
- r = avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &ttl,
- DBUS_TYPE_INVALID) || append_rdata(message, rdata, size) < 0) {
- r = avahi_client_set_errno(group->client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args(reply, &error, DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- r = avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return AVAHI_OK;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- r = avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return r;
-}
diff --git a/trunk/avahi-client/internal.h b/trunk/avahi-client/internal.h
deleted file mode 100644
index e49dd15..0000000
--- a/trunk/avahi-client/internal.h
+++ /dev/null
@@ -1,174 +0,0 @@
-#ifndef foointernalhfoo
-#define foointernalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <dbus/dbus.h>
-
-#include "client.h"
-#include "lookup.h"
-#include "publish.h"
-
-struct AvahiClient {
- const AvahiPoll *poll_api;
- DBusConnection *bus;
- int error;
- AvahiClientState state;
- AvahiClientFlags flags;
-
- /* Cache for some seldom changing server data */
- char *version_string, *host_name, *host_name_fqdn, *domain_name;
- uint32_t local_service_cookie;
- int local_service_cookie_valid;
-
- AvahiClientCallback callback;
- void *userdata;
-
- AVAHI_LLIST_HEAD(AvahiEntryGroup, groups);
- AVAHI_LLIST_HEAD(AvahiDomainBrowser, domain_browsers);
- AVAHI_LLIST_HEAD(AvahiServiceBrowser, service_browsers);
- AVAHI_LLIST_HEAD(AvahiServiceTypeBrowser, service_type_browsers);
- AVAHI_LLIST_HEAD(AvahiServiceResolver, service_resolvers);
- AVAHI_LLIST_HEAD(AvahiHostNameResolver, host_name_resolvers);
- AVAHI_LLIST_HEAD(AvahiAddressResolver, address_resolvers);
- AVAHI_LLIST_HEAD(AvahiRecordBrowser, record_browsers);
-};
-
-struct AvahiEntryGroup {
- char *path;
- AvahiEntryGroupState state;
- int state_valid;
- AvahiClient *client;
- AvahiEntryGroupCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiEntryGroup, groups);
-};
-
-struct AvahiDomainBrowser {
- int ref;
-
- char *path;
- AvahiClient *client;
- AvahiDomainBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiDomainBrowser, domain_browsers);
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- AvahiTimeout *defer_timeout;
-
- AvahiStringList *static_browse_domains;
-};
-
-struct AvahiServiceBrowser {
- char *path;
- AvahiClient *client;
- AvahiServiceBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiServiceBrowser, service_browsers);
-
- char *type, *domain;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiServiceTypeBrowser {
- char *path;
- AvahiClient *client;
- AvahiServiceTypeBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiServiceTypeBrowser, service_type_browsers);
-
- char *domain;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiServiceResolver {
- char *path;
- AvahiClient *client;
- AvahiServiceResolverCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiServiceResolver, service_resolvers);
-
- char *name, *type, *domain;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiHostNameResolver {
- char *path;
- AvahiClient *client;
- AvahiHostNameResolverCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiHostNameResolver, host_name_resolvers);
-
- char *host_name;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiAddressResolver {
- char *path;
- AvahiClient *client;
- AvahiAddressResolverCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiAddressResolver, address_resolvers);
-
- AvahiAddress address;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-struct AvahiRecordBrowser {
- char *path;
- AvahiClient *client;
- AvahiRecordBrowserCallback callback;
- void *userdata;
- AVAHI_LLIST_FIELDS(AvahiRecordBrowser, record_browsers);
-
- char *name;
- uint16_t clazz, type;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-};
-
-int avahi_client_set_errno (AvahiClient *client, int error);
-int avahi_client_set_dbus_error(AvahiClient *client, DBusError *error);
-
-void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState state);
-
-DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-DBusHandlerResult avahi_service_browser_event (AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEvent event, DBusMessage *message);
-
-DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
-DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
-DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message);
-
-int avahi_client_simple_method_call(AvahiClient *client, const char *path, const char *interface, const char *method);
-
-int avahi_client_is_connected(AvahiClient *client);
-
-#endif
diff --git a/trunk/avahi-client/lookup.h b/trunk/avahi-client/lookup.h
deleted file mode 100644
index 89d1fb2..0000000
--- a/trunk/avahi-client/lookup.h
+++ /dev/null
@@ -1,271 +0,0 @@
-#ifndef fooclientlookuphfoo
-#define fooclientlookuphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/gccmacro.h>
-
-#include <avahi-client/client.h>
-
-/** \file avahi-client/lookup.h Lookup Client API */
-
-/** \example client-browse-services.c Example how to browse for DNS-SD
- * services using the client interface to avahi-daemon. */
-
-AVAHI_C_DECL_BEGIN
-
-/** A domain browser object */
-typedef struct AvahiDomainBrowser AvahiDomainBrowser;
-
-/** A service browser object */
-typedef struct AvahiServiceBrowser AvahiServiceBrowser;
-
-/** A service type browser object */
-typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
-
-/** A service resolver object */
-typedef struct AvahiServiceResolver AvahiServiceResolver;
-
-/** A service resolver object */
-typedef struct AvahiHostNameResolver AvahiHostNameResolver;
-
-/** An address resolver object */
-typedef struct AvahiAddressResolver AvahiAddressResolver;
-
-/** A record browser object */
-typedef struct AvahiRecordBrowser AvahiRecordBrowser;
-
-/** The function prototype for the callback of an AvahiDomainBrowser */
-typedef void (*AvahiDomainBrowserCallback) (
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiServiceBrowser */
-typedef void (*AvahiServiceBrowserCallback) (
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiServiceTypeBrowser */
-typedef void (*AvahiServiceTypeBrowserCallback) (
- AvahiServiceTypeBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiServiceResolver */
-typedef void (*AvahiServiceResolverCallback) (
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiHostNameResolver */
-typedef void (*AvahiHostNameResolverCallback) (
- AvahiHostNameResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const AvahiAddress *a,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiAddressResolver */
-typedef void (*AvahiAddressResolverCallback) (
- AvahiAddressResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *name,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** The function prototype for the callback of an AvahiRecordBrowser */
-typedef void (*AvahiRecordBrowserCallback) (
- AvahiRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- const void *rdata,
- size_t size,
- AvahiLookupResultFlags flags,
- void *userdata);
-
-/** Browse for domains on the local network */
-AvahiDomainBrowser* avahi_domain_browser_new (
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType btype,
- AvahiLookupFlags flags,
- AvahiDomainBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiDomainBrowser object */
-AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *);
-
-/** Cleans up and frees an AvahiDomainBrowser object */
-int avahi_domain_browser_free (AvahiDomainBrowser *);
-
-/** Browse for service types on the local network */
-AvahiServiceTypeBrowser* avahi_service_type_browser_new (
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceTypeBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiServiceTypeBrowser object */
-AvahiClient* avahi_service_type_browser_get_client (AvahiServiceTypeBrowser *);
-
-/** Cleans up and frees an AvahiServiceTypeBrowser object */
-int avahi_service_type_browser_free (AvahiServiceTypeBrowser *);
-
-/** Browse for services of a type on the local network */
-AvahiServiceBrowser* avahi_service_browser_new (
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *type,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiServiceBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiServiceBrowser object */
-AvahiClient* avahi_service_browser_get_client (AvahiServiceBrowser *);
-
-/** Cleans up and frees an AvahiServiceBrowser object */
-int avahi_service_browser_free (AvahiServiceBrowser *);
-
-/** Create a new service resolver object */
-AvahiServiceResolver * avahi_service_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiServiceResolverCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiServiceResolver object */
-AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *);
-
-/** Free a service resolver object */
-int avahi_service_resolver_free(AvahiServiceResolver *r);
-
-/** Create a new hostname resolver object */
-AvahiHostNameResolver * avahi_host_name_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiHostNameResolverCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiHostNameResolver object */
-AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *);
-
-/** Free a hostname resolver object */
-int avahi_host_name_resolver_free(AvahiHostNameResolver *r);
-
-/** Create a new address resolver object from an AvahiAddress object */
-AvahiAddressResolver* avahi_address_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *a,
- AvahiLookupFlags flags,
- AvahiAddressResolverCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiAddressResolver object */
-AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *);
-
-/** Free a AvahiAddressResolver resolver object */
-int avahi_address_resolver_free(AvahiAddressResolver *r);
-
-/** Browse for records of a type on the local network */
-AvahiRecordBrowser* avahi_record_browser_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- AvahiLookupFlags flags,
- AvahiRecordBrowserCallback callback,
- void *userdata);
-
-/** Get the parent client of an AvahiRecordBrowser object */
-AvahiClient* avahi_record_browser_get_client(AvahiRecordBrowser *);
-
-/** Cleans up and frees an AvahiRecordBrowser object */
-int avahi_record_browser_free(AvahiRecordBrowser *);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-client/publish.h b/trunk/avahi-client/publish.h
deleted file mode 100644
index 053ea88..0000000
--- a/trunk/avahi-client/publish.h
+++ /dev/null
@@ -1,160 +0,0 @@
-#ifndef fooclientpublishhfoo
-#define fooclientpublishhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/gccmacro.h>
-
-#include <avahi-client/client.h>
-
-/** \file avahi-client/publish.h Publishing Client API */
-
-/** \example client-publish-service.c Example how to register a DNS-SD
- * service using the client interface to avahi-daemon. It behaves like a network
- * printer registering both an IPP and a BSD LPR service. */
-
-AVAHI_C_DECL_BEGIN
-
-/** An entry group object */
-typedef struct AvahiEntryGroup AvahiEntryGroup;
-
-/** The function prototype for the callback of an AvahiEntryGroup */
-typedef void (*AvahiEntryGroupCallback) (
- AvahiEntryGroup *g,
- AvahiEntryGroupState state /**< The new state of the entry group */,
- void* userdata /* The arbitrary user data pointer originally passed to avahi_entry_group_new()*/);
-
-/** Create a new AvahiEntryGroup object */
-AvahiEntryGroup* avahi_entry_group_new(
- AvahiClient* c,
- AvahiEntryGroupCallback callback /**< This callback is called whenever the state of this entry group changes. May not be NULL. */,
- void *userdata /**< This arbitrary user data pointer will be passed to the callback functon */);
-
-/** Clean up and free an AvahiEntryGroup object */
-int avahi_entry_group_free (AvahiEntryGroup *);
-
-/** Commit an AvahiEntryGroup. The entries in the entry group are now registered on the network. Commiting empty entry groups is considered an error. */
-int avahi_entry_group_commit (AvahiEntryGroup*);
-
-/** Reset an AvahiEntryGroup. This takes effect immediately. */
-int avahi_entry_group_reset (AvahiEntryGroup*);
-
-/** Get an AvahiEntryGroup's state */
-int avahi_entry_group_get_state (AvahiEntryGroup*);
-
-/** Check if an AvahiEntryGroup is empty */
-int avahi_entry_group_is_empty (AvahiEntryGroup*);
-
-/** Get an AvahiEntryGroup's owning client instance */
-AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup*);
-
-/** Add a service. Takes a variable NULL terminated list of TXT record strings as last arguments. Please note that this service is not announced on the network before avahi_entry_group_commit() is called. */
-int avahi_entry_group_add_service(
- AvahiEntryGroup *group,
- AvahiIfIndex interface /**< The interface this service shall be announced on. We recommend to pass AVAHI_IF_UNSPEC here, to announce on all interfaces. */,
- AvahiProtocol protocol /**< The protocol this service shall be announced with, i.e. MDNS over IPV4 or MDNS over IPV6. We recommend to pass AVAHI_PROTO_UNSPEC here, to announce this service on all protocols the daemon supports. */,
- AvahiPublishFlags flags /**< Usually 0, unless you know what you do */,
- const char *name /**< The name for the new service. May not be NULL. */,
- const char *type /**< The service type for the new service, such as _http._tcp. May not be NULL. */,
- const char *domain /**< The domain to register this domain in. We recommend to pass NULL here, to let the daemon decide */,
- const char *host /**< The host this services is residing on. We recommend to pass NULL here, the daemon will than automatically insert the local host name in that case */,
- uint16_t port /**< The IP port number of this service */,
- ...) AVAHI_GCC_SENTINEL;
-
-/** Add a service, takes an AvahiStringList for TXT records. Arguments have the same meaning as for avahi_entry_group_add_service(). */
-int avahi_entry_group_add_service_strlst(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *txt /**< The TXT data for this service. You may free this object after calling this function, it is not referenced any further */);
-
-/** Add a subtype for a service. The service should already be existent in the entry group. You may add as many subtypes for a service as you wish. */
-int avahi_entry_group_add_service_subtype(
- AvahiEntryGroup *group,
- AvahiIfIndex interface /**< The interface this subtype shall be announced on. This should match the value passed for the original avahi_entry_group_add_service() call. */,
- AvahiProtocol protocol /**< The protocol this subtype shall be announced with. This should match the value passed for the original avahi_entry_group_add_service() call. */,
- AvahiPublishFlags flags /**< Only != 0 if you really know what you do */,
- const char *name /**< The name of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *type /**< The type of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *domain /**< The domain this service resides is, as passed to avahi_entry_group_add_service(). May be NULL. */,
- const char *subtype /**< The new subtype to register for the specified service. May not be NULL. */);
-
-/** Update a TXT record for an existing service. The service should already be existent in the entry group. */
-int avahi_entry_group_update_service_txt(
- AvahiEntryGroup *g,
- AvahiIfIndex interface /**< The interface this service is announced on. This should match the value passed to the original avahi_entry_group_add_service() call. */,
- AvahiProtocol protocol /**< The protocol this service is announced with. This should match the value passed to the original avahi_entry_group_add_service() call. */,
- AvahiPublishFlags flags /**< Only != 0 if you really know what you do */,
- const char *name /**< The name of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *type /**< The type of the service, as passed to avahi_entry_group_add_service(). May not be NULL. */,
- const char *domain /**< The domain this service resides is, as passed to avahi_entry_group_add_service(). May be NULL. */,
- ...) AVAHI_GCC_SENTINEL;
-
-/** Update a TXT record for an existing service. Similar to avahi_entry_group_update_service_txt() but takes an AvahiStringList for the TXT strings, instead of a NULL terminated list of arguments. */
-int avahi_entry_group_update_service_txt_strlst(
- AvahiEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst);
-
-/** Add a host/address pair */
-int avahi_entry_group_add_address(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name /**< The FDQN of the new hostname to register */,
- const AvahiAddress *a /**< The address this host name shall map to */);
-
-/** Add an arbitrary record. I hope you know what you do. */
-int avahi_entry_group_add_record(
- AvahiEntryGroup *group,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- uint32_t ttl,
- const void *rdata,
- size_t size);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-client/resolver.c b/trunk/avahi-client/resolver.c
deleted file mode 100644
index 2d9f808..0000000
--- a/trunk/avahi-client/resolver.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-
-#include "client.h"
-#include "internal.h"
-
-/* AvahiServiceResolver implementation */
-
-DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message) {
- AvahiServiceResolver *r = NULL;
- DBusError error;
- const char *path;
- AvahiStringList *strlst = NULL;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (r = client->service_resolvers; r; r = r->service_resolvers_next)
- if (strcmp (r->path, path) == 0)
- break;
-
- if (!r)
- goto fail;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- int j;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *type, *domain, *host, *address;
- uint16_t port;
- DBusMessageIter iter, sub;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
-
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- dbus_message_iter_init(message, &iter);
-
- for (j = 0; j < 9; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_ARRAY) {
- fprintf(stderr, "Error parsing service resolving message\n");
- goto fail;
- }
-
- strlst = NULL;
- dbus_message_iter_recurse(&iter, &sub);
-
- for (;;) {
- DBusMessageIter sub2;
- int at;
-
- if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
- break;
-
- assert(at == DBUS_TYPE_ARRAY);
-
- if (dbus_message_iter_get_element_type(&sub) != DBUS_TYPE_BYTE) {
- fprintf(stderr, "Error parsing service resolving message\n");
- goto fail;
- }
-
- dbus_message_iter_recurse(&sub, &sub2);
-
- if (dbus_message_iter_get_array_len(&sub2) > 0) {
- uint8_t *k;
- int n;
-
- dbus_message_iter_get_fixed_array(&sub2, &k, &n);
- strlst = avahi_string_list_add_arbitrary(strlst, k, n);
- }
-
- dbus_message_iter_next(&sub);
- }
-
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- dbus_message_iter_get_basic(&iter, &flags);
-
- assert(address);
-
- if (address[0] == 0)
- address = NULL;
- else
- avahi_address_parse(address, (AvahiProtocol) aprotocol, &a);
-
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, name, type, domain, host, address ? &a : NULL, port, strlst, (AvahiLookupResultFlags) flags, r->userdata);
-
- avahi_string_list_free(strlst);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(r->client, avahi_error_dbus_to_number(etxt));
- r->callback(r, r->interface, r->protocol, event, r->name, r->type, r->domain, NULL, NULL, 0, NULL, 0, r->userdata);
- break;
- }
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-
-fail:
- dbus_error_free (&error);
- avahi_string_list_free(strlst);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-AvahiServiceResolver * avahi_service_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiServiceResolverCallback callback,
- void *userdata) {
-
- DBusError error;
- AvahiServiceResolver *r = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- char *path;
-
- assert(client);
- assert(type);
-
- if (!domain)
- domain = "";
-
- if (!name)
- name = "";
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(r = avahi_new(AvahiServiceResolver, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->client = client;
- r->callback = callback;
- r->userdata = userdata;
- r->path = NULL;
- r->name = r->type = r->domain = NULL;
- r->interface = interface;
- r->protocol = protocol;
-
- AVAHI_LLIST_PREPEND(AvahiServiceResolver, service_resolvers, client->service_resolvers, r);
-
- if (name && name[0])
- if (!(r->name = avahi_strdup(name))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(r->type = avahi_strdup(type))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (domain && domain[0])
- if (!(r->domain = avahi_strdup(domain))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "ServiceResolverNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) aprotocol;
- u_flags = (uint32_t) flags;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(r->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return r;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (r)
- avahi_service_resolver_free(r);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-
-}
-
-AvahiClient* avahi_service_resolver_get_client (AvahiServiceResolver *r) {
- assert (r);
-
- return r->client;
-}
-
-int avahi_service_resolver_free(AvahiServiceResolver *r) {
- AvahiClient *client;
- int ret = AVAHI_OK;
-
- assert(r);
- client = r->client;
-
- if (r->path && avahi_client_is_connected(client))
- ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiServiceResolver, service_resolvers, client->service_resolvers, r);
-
- avahi_free(r->path);
- avahi_free(r->name);
- avahi_free(r->type);
- avahi_free(r->domain);
- avahi_free(r);
-
- return ret;
-}
-
-/* AvahiHostNameResolver implementation */
-
-DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message) {
- AvahiHostNameResolver *r = NULL;
- DBusError error;
- const char *path;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (r = client->host_name_resolvers; r; r = r->host_name_resolvers_next)
- if (strcmp (r->path, path) == 0)
- break;
-
- if (!r)
- goto fail;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *address;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- assert(address);
- if (!avahi_address_parse(address, (AvahiProtocol) aprotocol, &a)) {
- fprintf(stderr, "Failed to parse address\n");
- goto fail;
- }
-
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, name, &a, (AvahiLookupResultFlags) flags, r->userdata);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(r->client, avahi_error_dbus_to_number(etxt));
- r->callback(r, r->interface, r->protocol, event, r->host_name, NULL, 0, r->userdata);
- break;
- }
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-AvahiHostNameResolver * avahi_host_name_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiHostNameResolverCallback callback,
- void *userdata) {
-
- DBusError error;
- AvahiHostNameResolver *r = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- char *path;
-
- assert(client);
- assert(name);
-
- dbus_error_init (&error);
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(r = avahi_new(AvahiHostNameResolver, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->client = client;
- r->callback = callback;
- r->userdata = userdata;
- r->path = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->host_name = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiHostNameResolver, host_name_resolvers, client->host_name_resolvers, r);
-
- if (!(r->host_name = avahi_strdup(name))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "HostNameResolverNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) aprotocol;
- u_flags = (uint32_t) flags;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(r->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return r;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (r)
- avahi_host_name_resolver_free(r);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-
-}
-
-int avahi_host_name_resolver_free(AvahiHostNameResolver *r) {
- int ret = AVAHI_OK;
- AvahiClient *client;
-
- assert(r);
- client = r->client;
-
- if (r->path && avahi_client_is_connected(client))
- ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiHostNameResolver, host_name_resolvers, client->host_name_resolvers, r);
-
- avahi_free(r->path);
- avahi_free(r->host_name);
- avahi_free(r);
-
- return ret;
-}
-
-AvahiClient* avahi_host_name_resolver_get_client (AvahiHostNameResolver *r) {
- assert (r);
-
- return r->client;
-}
-
-/* AvahiAddressResolver implementation */
-
-DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolverEvent event, DBusMessage *message) {
- AvahiAddressResolver *r = NULL;
- DBusError error;
- const char *path;
-
- assert(client);
- assert(message);
-
- dbus_error_init (&error);
-
- if (!(path = dbus_message_get_path(message)))
- goto fail;
-
- for (r = client->address_resolvers; r; r = r->address_resolvers_next)
- if (strcmp (r->path, path) == 0)
- break;
-
- if (!r)
- goto fail;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *address;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- assert(address);
- if (!avahi_address_parse(address, (AvahiProtocol) aprotocol, &a)) {
- fprintf(stderr, "Failed to parse address\n");
- goto fail;
- }
-
- r->callback(r, (AvahiIfIndex) interface, (AvahiProtocol) protocol, AVAHI_RESOLVER_FOUND, &a, name, (AvahiLookupResultFlags) flags, r->userdata);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE: {
- char *etxt;
-
- if (!dbus_message_get_args(
- message, &error,
- DBUS_TYPE_STRING, &etxt,
- DBUS_TYPE_INVALID) ||
- dbus_error_is_set (&error)) {
- fprintf(stderr, "Failed to parse resolver event.\n");
- goto fail;
- }
-
- avahi_client_set_errno(r->client, avahi_error_dbus_to_number(etxt));
- r->callback(r, r->interface, r->protocol, event, &r->address, NULL, 0, r->userdata);
- break;
- }
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- dbus_error_free (&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-AvahiAddressResolver * avahi_address_resolver_new(
- AvahiClient *client,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *a,
- AvahiLookupFlags flags,
- AvahiAddressResolverCallback callback,
- void *userdata) {
-
- DBusError error;
- AvahiAddressResolver *r = NULL;
- DBusMessage *message = NULL, *reply = NULL;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
- char *path;
- char addr[AVAHI_ADDRESS_STR_MAX], *address = addr;
-
- assert(client);
- assert(a);
-
- dbus_error_init (&error);
-
- if (!avahi_address_snprint (addr, sizeof(addr), a)) {
- avahi_client_set_errno(client, AVAHI_ERR_INVALID_ADDRESS);
- return NULL;
- }
-
- if (!avahi_client_is_connected(client)) {
- avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE);
- goto fail;
- }
-
- if (!(r = avahi_new(AvahiAddressResolver, 1))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->client = client;
- r->callback = callback;
- r->userdata = userdata;
- r->path = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->address = *a;
-
- AVAHI_LLIST_PREPEND(AvahiAddressResolver, address_resolvers, client->address_resolvers, r);
-
- if (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "AddressResolverNew"))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (!(dbus_message_append_args(
- message,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID))) {
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(reply = dbus_connection_send_with_reply_and_block(client->bus, message, -1, &error)) ||
- dbus_error_is_set(&error)) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!dbus_message_get_args (reply, &error, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID) ||
- dbus_error_is_set(&error) ||
- !path) {
- avahi_client_set_errno(client, AVAHI_ERR_DBUS_ERROR);
- goto fail;
- }
-
- if (!(r->path = avahi_strdup(path))) {
-
- /* FIXME: We don't remove the object on the server side */
-
- avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- dbus_message_unref(message);
- dbus_message_unref(reply);
-
- return r;
-
-fail:
-
- if (dbus_error_is_set(&error)) {
- avahi_client_set_dbus_error(client, &error);
- dbus_error_free(&error);
- }
-
- if (r)
- avahi_address_resolver_free(r);
-
- if (message)
- dbus_message_unref(message);
-
- if (reply)
- dbus_message_unref(reply);
-
- return NULL;
-
-}
-
-AvahiClient* avahi_address_resolver_get_client (AvahiAddressResolver *r) {
- assert (r);
-
- return r->client;
-}
-
-int avahi_address_resolver_free(AvahiAddressResolver *r) {
- AvahiClient *client;
- int ret = AVAHI_OK;
-
- assert(r);
- client = r->client;
-
- if (r->path && avahi_client_is_connected(client))
- ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Free");
-
- AVAHI_LLIST_REMOVE(AvahiAddressResolver, address_resolvers, client->address_resolvers, r);
-
- avahi_free(r->path);
- avahi_free(r);
-
- return ret;
-}
-
diff --git a/trunk/avahi-client/rr-test.c b/trunk/avahi-client/rr-test.c
deleted file mode 100644
index 9fffa5d..0000000
--- a/trunk/avahi-client/rr-test.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-#include <avahi-common/error.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-
-static void hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-static void callback(
- AVAHI_GCC_UNUSED AvahiRecordBrowser *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- uint16_t clazz,
- uint16_t type,
- const void *rdata,
- size_t rdata_size,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- fprintf(stderr, "%i name=%s class=%u type=%u\n", event, name, clazz, type);
-
- if (rdata)
- hexdump(rdata, rdata_size);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- AvahiSimplePoll *simple_poll;
- const AvahiPoll *poll_api;
- AvahiClient *client;
- AvahiRecordBrowser *r;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- client = avahi_client_new(poll_api, 0, NULL, NULL, NULL);
- assert(client);
-
- r = avahi_record_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "ecstasy.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, 0, callback, simple_poll);
- assert(r);
-
- avahi_simple_poll_loop(simple_poll);
-
- avahi_client_free(client);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/trunk/avahi-client/srv-test.c b/trunk/avahi-client/srv-test.c
deleted file mode 100644
index 5242947..0000000
--- a/trunk/avahi-client/srv-test.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-#include <avahi-common/error.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-
-static void callback(
- AVAHI_GCC_UNUSED AvahiServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- AVAHI_GCC_UNUSED const AvahiAddress *a,
- AVAHI_GCC_UNUSED uint16_t port,
- AVAHI_GCC_UNUSED AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- fprintf(stderr, "%i name=%s type=%s domain=%s host=%s\n", event, name, type, domain, host_name);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- AvahiSimplePoll *simple_poll;
- const AvahiPoll *poll_api;
- AvahiClient *client;
- AvahiServiceResolver *r;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- client = avahi_client_new(poll_api, 0, NULL, NULL, NULL);
- assert(client);
-
- r = avahi_service_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, "_domain._udp", "0pointer.de", AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_NO_TXT, callback, simple_poll);
- assert(r);
-
- avahi_simple_poll_loop(simple_poll);
-
- avahi_client_free(client);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/trunk/avahi-client/xdg-config-test.c b/trunk/avahi-client/xdg-config-test.c
deleted file mode 100644
index fe267f2..0000000
--- a/trunk/avahi-client/xdg-config-test.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/gccmacro.h>
-
-#include "xdg-config.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- FILE *f;
-
- f = avahi_xdg_config_open("foo");
-
- if (f)
- fclose(f);
-}
diff --git a/trunk/avahi-client/xdg-config.c b/trunk/avahi-client/xdg-config.c
deleted file mode 100644
index ea4bb98..0000000
--- a/trunk/avahi-client/xdg-config.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-
-#include "xdg-config.h"
-
-FILE *avahi_xdg_config_open(const char *filename) {
- FILE *f;
- const char *e, *d;
- char fn[PATH_MAX], *p = NULL, buf[2048], *s = NULL;
-
- assert(filename);
-
- if ((e = getenv("XDG_CONFIG_HOME")) && *e)
- snprintf(p = fn, sizeof(fn), "%s/%s", e, filename);
- else if ((e = getenv("HOME")) && *e)
- snprintf(p = fn, sizeof(fn), "%s/.config/%s", e, filename);
-
- if (p) {
- if ((f = fopen(p, "r")))
- return f;
- else if (errno != ENOENT)
- return NULL;
- }
-
- if (!(d = getenv("XDG_CONFIG_DIRS")) || !*d)
- d = "/etc/xdg";
-
- snprintf(buf, sizeof(buf), "%s", d);
-
- for (e = strtok_r(buf, ":", &s); e; e = strtok_r(NULL, ":", &s)) {
- snprintf(fn, sizeof(fn), "%s/%s", e, filename);
-
- if ((f = fopen(fn, "r")))
- return f;
- }
-
- return NULL;
-}
diff --git a/trunk/avahi-client/xdg-config.h b/trunk/avahi-client/xdg-config.h
deleted file mode 100644
index 88f66a8..0000000
--- a/trunk/avahi-client/xdg-config.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef fooxdgconfighfoo
-#define fooxdgconfighfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-
-FILE *avahi_xdg_config_open(const char *filename);
-
-#endif
diff --git a/trunk/avahi-common/Makefile.am b/trunk/avahi-common/Makefile.am
deleted file mode 100644
index cd21c11..0000000
--- a/trunk/avahi-common/Makefile.am
+++ /dev/null
@@ -1,131 +0,0 @@
-# $Id: Makefile.am 90 2005-05-23 16:15:12Z lennart $
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-avahi_commonincludedir=$(includedir)/avahi-common
-
-avahi_commoninclude_HEADERS = \
- strlst.h \
- address.h \
- alternative.h \
- domain.h \
- cdecl.h \
- defs.h \
- malloc.h \
- watch.h \
- timeval.h \
- simple-watch.h \
- thread-watch.h \
- gccmacro.h \
- error.h \
- llist.h \
- rlist.h
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- strlst-test \
- domain-test \
- alternative-test \
- timeval-test \
- watch-test \
- watch-test-thread \
- utf8-test
-endif
-
-lib_LTLIBRARIES = \
- libavahi-common.la
-
-libavahi_common_la_SOURCES = \
- malloc.c malloc.h \
- address.c address.h \
- alternative.c alternative.h \
- error.c error.h \
- strlst.c strlst.h \
- domain.c domain.h \
- timeval.c timeval.h \
- simple-watch.c simple-watch.h \
- thread-watch.c thread-watch.h \
- watch.h gccmacro.h \
- rlist.h rlist.c \
- utf8.c utf8.h
-
-libavahi_common_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-libavahi_common_la_LIBADD = $(AM_LDADD) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
-libavahi_common_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_COMMON_VERSION_INFO)
-
-strlst_test_SOURCES = \
- strlst.c strlst.h \
- malloc.c malloc.h \
- strlst-test.c
-strlst_test_CFLAGS = $(AM_CFLAGS)
-
-alternative_test_SOURCES = \
- alternative.c alternative.h \
- malloc.c malloc.h \
- domain.c domain.h \
- address.c address.h \
- alternative-test.c \
- utf8.c utf8.h
-alternative_test_CFLAGS = $(AM_CFLAGS)
-
-domain_test_SOURCES = \
- domain.c domain.h \
- malloc.c malloc.h \
- address.c address.h \
- domain-test.c \
- utf8.c utf8.h
-domain_test_CFLAGS = $(AM_CFLAGS)
-
-watch_test_SOURCES = \
- timeval.c timeval.h \
- simple-watch.c simple-watch.h \
- watch.h \
- malloc.c malloc.h \
- watch-test.c
-watch_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-watch_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS)
-
-watch_test_thread_SOURCES = $(watch_test_SOURCES) thread-watch.c thread-watch.h
-watch_test_thread_CFLAGS = $(watch_test_CFLAGS) -DUSE_THREAD
-watch_test_thread_LDADD = $(watch_test_LDADD)
-
-timeval_test_SOURCES = \
- timeval.c timeval.h \
- timeval-test.c
-timeval_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-timeval_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS)
-
-utf8_test_SOURCES = \
- utf8-test.c \
- utf8.c utf8.h
-utf8_test_CFLAGS = $(AM_CFLAGS)
-utf8_test_LDADD = $(AM_LDADD)
-
-if HAVE_DBUS
-
-noinst_HEADERS = \
- dbus.h \
- dbus-watch-glue.h
-
-endif
-
diff --git a/trunk/avahi-common/address.c b/trunk/avahi-common/address.c
deleted file mode 100644
index c8ddf7f..0000000
--- a/trunk/avahi-common/address.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include "address.h"
-#include "malloc.h"
-
-static size_t address_get_size(const AvahiAddress *a) {
- assert(a);
-
- if (a->proto == AVAHI_PROTO_INET)
- return 4;
- else if (a->proto == AVAHI_PROTO_INET6)
- return 16;
-
- return 0;
-}
-
-int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b) {
- assert(a);
- assert(b);
-
- if (a->proto != b->proto)
- return -1;
-
- return memcmp(a->data.data, b->data.data, address_get_size(a));
-}
-
-char *avahi_address_snprint(char *s, size_t length, const AvahiAddress *a) {
- assert(s);
- assert(length);
- assert(a);
-
- if (!(inet_ntop(avahi_proto_to_af(a->proto), a->data.data, s, length)))
- return NULL;
-
- return s;
-}
-
-char* avahi_reverse_lookup_name(const AvahiAddress *a, char *ret_s, size_t length) {
- assert(ret_s);
- assert(length > 0);
- assert(a);
-
- if (a->proto == AVAHI_PROTO_INET) {
- uint32_t n = ntohl(a->data.ipv4.address);
- snprintf(
- ret_s, length,
- "%u.%u.%u.%u.in-addr.arpa",
- n & 0xFF, (n >> 8) & 0xFF, (n >> 16) & 0xFF, n >> 24);
- } else {
- assert(a->proto == AVAHI_PROTO_INET6);
-
- snprintf(
- ret_s, length,
- "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
- a->data.ipv6.address[15] & 0xF, a->data.ipv6.address[15] >> 4,
- a->data.ipv6.address[14] & 0xF, a->data.ipv6.address[14] >> 4,
- a->data.ipv6.address[13] & 0xF, a->data.ipv6.address[13] >> 4,
- a->data.ipv6.address[12] & 0xF, a->data.ipv6.address[12] >> 4,
- a->data.ipv6.address[11] & 0xF, a->data.ipv6.address[11] >> 4,
- a->data.ipv6.address[10] & 0xF, a->data.ipv6.address[10] >> 4,
- a->data.ipv6.address[ 9] & 0xF, a->data.ipv6.address[ 9] >> 4,
- a->data.ipv6.address[ 8] & 0xF, a->data.ipv6.address[ 8] >> 4,
- a->data.ipv6.address[ 7] & 0xF, a->data.ipv6.address[ 7] >> 4,
- a->data.ipv6.address[ 6] & 0xF, a->data.ipv6.address[ 6] >> 4,
- a->data.ipv6.address[ 5] & 0xF, a->data.ipv6.address[ 5] >> 4,
- a->data.ipv6.address[ 4] & 0xF, a->data.ipv6.address[ 4] >> 4,
- a->data.ipv6.address[ 3] & 0xF, a->data.ipv6.address[ 3] >> 4,
- a->data.ipv6.address[ 2] & 0xF, a->data.ipv6.address[ 2] >> 4,
- a->data.ipv6.address[ 1] & 0xF, a->data.ipv6.address[ 1] >> 4,
- a->data.ipv6.address[ 0] & 0xF, a->data.ipv6.address[ 0] >> 4);
- }
-
- return ret_s;
-}
-
-AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol proto, AvahiAddress *ret_addr) {
- assert(ret_addr);
- assert(s);
-
- if (proto == AVAHI_PROTO_UNSPEC) {
- if (inet_pton(AF_INET, s, ret_addr->data.data) <= 0) {
- if (inet_pton(AF_INET6, s, ret_addr->data.data) <= 0)
- return NULL;
- else
- ret_addr->proto = AVAHI_PROTO_INET6;
- } else
- ret_addr->proto = AVAHI_PROTO_INET;
- } else {
- if (inet_pton(avahi_proto_to_af(proto), s, ret_addr->data.data) <= 0)
- return NULL;
-
- ret_addr->proto = proto;
- }
-
- return ret_addr;
-}
-
-int avahi_proto_to_af(AvahiProtocol proto) {
- if (proto == AVAHI_PROTO_INET)
- return AF_INET;
- if (proto == AVAHI_PROTO_INET6)
- return AF_INET6;
-
- assert(proto == AVAHI_PROTO_UNSPEC);
- return AF_UNSPEC;
-}
-
-AvahiProtocol avahi_af_to_proto(int af) {
- if (af == AF_INET)
- return AVAHI_PROTO_INET;
- if (af == AF_INET6)
- return AVAHI_PROTO_INET6;
-
- assert(af == AF_UNSPEC);
- return AVAHI_PROTO_UNSPEC;
-}
-
-const char* avahi_proto_to_string(AvahiProtocol proto) {
- if (proto == AVAHI_PROTO_INET)
- return "IPv4";
- if (proto == AVAHI_PROTO_INET6)
- return "IPv6";
-
- assert(proto == AVAHI_PROTO_UNSPEC);
- return "UNSPEC";
-}
diff --git a/trunk/avahi-common/address.h b/trunk/avahi-common/address.h
deleted file mode 100644
index 58e6414..0000000
--- a/trunk/avahi-common/address.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifndef fooaddresshfoo
-#define fooaddresshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file address.h Definitions and functions to manipulate IP addresses. */
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Protocol family specification, takes the values AVAHI_PROTO_INET, AVAHI_PROTO_INET6, AVAHI_PROTO_UNSPEC */
-typedef int AvahiProtocol;
-
-/** Numeric network interface index. Takes OS dependent values and the special constant AVAHI_IF_UNSPEC */
-typedef int AvahiIfIndex;
-
-/** Values for AvahiProtocol */
-enum {
- AVAHI_PROTO_INET = 0, /**< IPv4 */
- AVAHI_PROTO_INET6 = 1, /**< IPv6 */
- AVAHI_PROTO_UNSPEC = -1 /**< Unspecified/all protocol(s) */
-};
-
-/** Special values for AvahiIfIndex */
-enum {
- AVAHI_IF_UNSPEC = -1 /**< Unspecified/all interface(s) */
-};
-
-/** Maximum size of an address in string form */
-#define AVAHI_ADDRESS_STR_MAX 40 /* IPv6 Max = 4*8 + 7 + 1 for NUL */
-
-/** Return TRUE if the specified interface index is valid */
-#define AVAHI_IF_VALID(ifindex) (((ifindex) >= 0) || ((ifindex) == AVAHI_PROTO_UNSPEC))
-
-/** Return TRUE if the specified protocol is valid */
-#define AVAHI_PROTO_VALID(protocol) (((protocol) == AVAHI_PROTO_INET) || ((protocol) == AVAHI_PROTO_INET6) || ((protocol) == AVAHI_PROTO_UNSPEC))
-
-/** An IPv4 address */
-typedef struct AvahiIPv4Address {
- uint32_t address; /**< Address data in network byte order. */
-} AvahiIPv4Address;
-
-/** An IPv6 address */
-typedef struct AvahiIPv6Address {
- uint8_t address[16]; /**< Address data */
-} AvahiIPv6Address;
-
-/** Protocol (address family) independent address structure */
-typedef struct AvahiAddress {
- AvahiProtocol proto; /**< Address family */
-
- union {
- AvahiIPv6Address ipv6; /**< Address when IPv6 */
- AvahiIPv4Address ipv4; /**< Address when IPv4 */
- uint8_t data[1]; /**< Type independant data field */
- } data;
-} AvahiAddress;
-
-/** Compare two addresses. Returns 0 when equal, a negative value when a < b, a positive value when a > b. */
-int avahi_address_cmp(const AvahiAddress *a, const AvahiAddress *b);
-
-/** Convert the specified address *a to a human readable character string, use AVAHI_ADDRESS_STR_MAX to allocate an array of the right size */
-char *avahi_address_snprint(char *ret_s, size_t length, const AvahiAddress *a);
-
-/** Convert the specifeid human readable character string to an
- * address structure. Set af to AVAHI_UNSPEC for automatic address
- * family detection. */
-AvahiAddress *avahi_address_parse(const char *s, AvahiProtocol af, AvahiAddress *ret_addr);
-
-/** Generate the DNS reverse lookup name for an IPv4 or IPv6 address. */
-char* avahi_reverse_lookup_name(const AvahiAddress *a, char *ret_s, size_t length);
-
-/** Map AVAHI_PROTO_xxx constants to Unix AF_xxx constants */
-int avahi_proto_to_af(AvahiProtocol proto);
-
-/** Map Unix AF_xxx constants to AVAHI_PROTO_xxx constants */
-AvahiProtocol avahi_af_to_proto(int af);
-
-/** Return a textual representation of the specified protocol number. i.e. "IPv4", "IPv6" or "UNSPEC" */
-const char* avahi_proto_to_string(AvahiProtocol proto);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/alternative-test.c b/trunk/avahi-common/alternative-test.c
deleted file mode 100644
index b3ee4e9..0000000
--- a/trunk/avahi-common/alternative-test.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include "alternative.h"
-#include "malloc.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- const char* const test_strings[] = {
- "gurke",
- "",
- "-",
- " #",
- "1",
- "#0",
- " #0",
- " #1",
- "#-1",
- " #-1",
- "-0",
- "--0",
- "-1",
- "--1",
- "-2",
- "gurke1",
- "gurke0",
- "gurke-2",
- "gurke #0",
- "gurke #1",
- "gurke #",
- "gurke#1",
- "gurke-",
- "gurke---",
- "gurke #",
- "gurke ###",
- NULL
- };
-
- char *r = NULL;
- int i, j, k;
-
- for (k = 0; test_strings[k]; k++) {
-
- printf(">>>>>%s<<<<\n", test_strings[k]);
-
- for (j = 0; j < 2; j++) {
-
- for (i = 0; i < 20; i++) {
- char *n;
-
- n = i == 0 ? avahi_strdup(test_strings[k]) : (j ? avahi_alternative_service_name(r) : avahi_alternative_host_name(r));
- avahi_free(r);
- r = n;
-
- printf("%s\n", r);
- }
- }
- }
-
- avahi_free(r);
- return 0;
-}
diff --git a/trunk/avahi-common/alternative.c b/trunk/avahi-common/alternative.c
deleted file mode 100644
index 77470ba..0000000
--- a/trunk/avahi-common/alternative.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-
-#include "alternative.h"
-#include "malloc.h"
-
-char * avahi_alternative_host_name(const char *s) {
- const char *e;
- char *r;
-
- assert(s);
-
- e = strrchr(s, '-');
-
- if (e) {
- const char *p;
-
- for (p = e+1; *p; p++)
- if (!isdigit(*p)) {
- e = NULL;
- break;
- }
-
- if (e && (*(e+1) == '0' || (*(e+1) == 0)))
- e = NULL;
- }
-
- if (e) {
- char *c;
-
- e++;
-
- if (!(c = avahi_strndup(s, e-s)))
- return NULL;
-
- r = avahi_strdup_printf("%s%i", c, atoi(e)+1);
- avahi_free(c);
-
- } else
- r = avahi_strdup_printf("%s-2", s);
-
- return r;
-}
-
-char *avahi_alternative_service_name(const char *s) {
- const char *e;
- char *r;
-
- assert(s);
-
- if ((e = strstr(s, " #"))) {
- const char *n, *p;
- e += 2;
-
- while ((n = strstr(e, " #")))
- e = n + 2;
-
- for (p = e; *p; p++)
- if (!isdigit(*p)) {
- e = NULL;
- break;
- }
-
- if (e && (*e == '0' || *e == 0))
- e = NULL;
- }
-
- if (e) {
- char *c;
-
- if (!(c = avahi_strndup(s, e-s)))
- return NULL;
-
- r = avahi_strdup_printf("%s%i", c, atoi(e)+1);
- avahi_free(c);
- } else
- r = avahi_strdup_printf("%s #2", s);
-
- return r;
-}
diff --git a/trunk/avahi-common/alternative.h b/trunk/avahi-common/alternative.h
deleted file mode 100644
index d171540..0000000
--- a/trunk/avahi-common/alternative.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef fooalternativehfoo
-#define fooalternativehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file alternative.h Functions to find alternative names for hosts and services in the case of name collision */
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Find an alternative for the specified host name. If called with an
- * original host name, "2" is appended, Afterwards the number is
- * increased on each call. (i.e. "foo" becomes "foo2" becomes "foo3"
- * and so on.) avahi_free() the result. */
-char *avahi_alternative_host_name(const char *s);
-
-/** Find an alternative for the specified service name. If called with
- * an original service name, " #2" is appended. Afterwards the number
- * is increased on each call (i.e. "foo" becomes "foo #2" becomes "foo
- * #3" and so on.) avahi_free() the result. */
-char *avahi_alternative_service_name(const char *s);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/cdecl.h b/trunk/avahi-common/cdecl.h
deleted file mode 100644
index b08e2a0..0000000
--- a/trunk/avahi-common/cdecl.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef foocdeclhfoo
-#define foocdeclhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file cdecl.h C++ compatibility */
-#ifdef __cplusplus
-/** If using C++ this macro enables C mode, otherwise does nothing */
-#define AVAHI_C_DECL_BEGIN extern "C" {
-/** If using C++ this macros switches back to C++ mode, otherwise does nothing */
-#define AVAHI_C_DECL_END }
-
-#else
-/** If using C++ this macro enables C mode, otherwise does nothing */
-#define AVAHI_C_DECL_BEGIN
-/** If using C++ this macros switches back to C++ mode, otherwise does nothing */
-#define AVAHI_C_DECL_END
-
-#endif
-
-#endif
diff --git a/trunk/avahi-common/dbus-watch-glue.c b/trunk/avahi-common/dbus-watch-glue.c
deleted file mode 100644
index a8779d5..0000000
--- a/trunk/avahi-common/dbus-watch-glue.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "malloc.h"
-#include "timeval.h"
-#include "dbus-watch-glue.h"
-
-static AvahiWatchEvent translate_dbus_to_avahi(unsigned int f) {
- AvahiWatchEvent e = 0;
-
- if (f & DBUS_WATCH_READABLE)
- e |= AVAHI_WATCH_IN;
- if (f & DBUS_WATCH_WRITABLE)
- e |= AVAHI_WATCH_OUT;
- if (f & DBUS_WATCH_ERROR)
- e |= AVAHI_WATCH_ERR;
- if (f & DBUS_WATCH_HANGUP)
- e |= AVAHI_WATCH_HUP;
-
- return e;
-}
-
-static unsigned int translate_avahi_to_dbus(AvahiWatchEvent e) {
- unsigned int f = 0;
-
- if (e & AVAHI_WATCH_IN)
- f |= DBUS_WATCH_READABLE;
- if (e & AVAHI_WATCH_OUT)
- f |= DBUS_WATCH_WRITABLE;
- if (e & AVAHI_WATCH_ERR)
- f |= DBUS_WATCH_ERROR;
- if (e & AVAHI_WATCH_HUP)
- f |= DBUS_WATCH_HANGUP;
-
- return f;
-}
-
-typedef struct {
- DBusConnection *connection;
- const AvahiPoll *poll_api;
- AvahiTimeout *dispatch_timeout;
- int ref;
-} ConnectionData;
-
-static ConnectionData *connection_data_ref(ConnectionData *d) {
- assert(d);
- assert(d->ref >= 1);
-
- d->ref++;
- return d;
-}
-
-static void connection_data_unref(ConnectionData *d) {
- assert(d);
- assert(d->ref >= 1);
-
- if (--d->ref <= 0) {
- d->poll_api->timeout_free(d->dispatch_timeout);
- avahi_free(d);
- }
-}
-
-static void request_dispatch(ConnectionData *d, int enable) {
- static const struct timeval tv = { 0, 0 };
- assert(d);
-
- if (enable) {
- assert(dbus_connection_get_dispatch_status(d->connection) == DBUS_DISPATCH_DATA_REMAINS);
- d->poll_api->timeout_update(d->dispatch_timeout, &tv);
- } else
- d->poll_api->timeout_update(d->dispatch_timeout, NULL);
-}
-
-static void dispatch_timeout_callback(AvahiTimeout *t, void *userdata) {
- ConnectionData *d = userdata;
- assert(t);
- assert(d);
-
- connection_data_ref(d);
- dbus_connection_ref(d->connection);
-
- if (dbus_connection_dispatch(d->connection) == DBUS_DISPATCH_DATA_REMAINS)
- /* If there's still data, request that this handler is called again */
- request_dispatch(d, 1);
- else
- request_dispatch(d, 0);
-
- dbus_connection_unref(d->connection);
- connection_data_unref(d);
-}
-
-static void watch_callback(AvahiWatch *avahi_watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEvent events, void *userdata) {
- DBusWatch *dbus_watch = userdata;
-
- assert(avahi_watch);
- assert(dbus_watch);
-
- dbus_watch_handle(dbus_watch, translate_avahi_to_dbus(events));
- /* Ignore the return value */
-}
-
-static dbus_bool_t update_watch(const AvahiPoll *poll_api, DBusWatch *dbus_watch) {
- AvahiWatch *avahi_watch;
- dbus_bool_t b;
-
- assert(dbus_watch);
-
- avahi_watch = dbus_watch_get_data(dbus_watch);
-
- b = dbus_watch_get_enabled(dbus_watch);
-
- if (b && !avahi_watch) {
-
- if (!(avahi_watch = poll_api->watch_new(
- poll_api,
- dbus_watch_get_fd(dbus_watch),
- translate_dbus_to_avahi(dbus_watch_get_flags(dbus_watch)),
- watch_callback,
- dbus_watch)))
- return FALSE;
-
- dbus_watch_set_data(dbus_watch, avahi_watch, NULL);
-
- } else if (!b && avahi_watch) {
-
- poll_api->watch_free(avahi_watch);
- dbus_watch_set_data(dbus_watch, NULL, NULL);
-
- } else if (avahi_watch) {
-
- /* Update flags */
- poll_api->watch_update(avahi_watch, dbus_watch_get_flags(dbus_watch));
- }
-
- return TRUE;
-}
-
-static dbus_bool_t add_watch(DBusWatch *dbus_watch, void *userdata) {
- ConnectionData *d = userdata;
-
- assert(dbus_watch);
- assert(d);
-
- return update_watch(d->poll_api, dbus_watch);
-}
-
-static void remove_watch(DBusWatch *dbus_watch, void *userdata) {
- ConnectionData *d = userdata;
- AvahiWatch *avahi_watch;
-
- assert(dbus_watch);
- assert(d);
-
- if ((avahi_watch = dbus_watch_get_data(dbus_watch))) {
- d->poll_api->watch_free(avahi_watch);
- dbus_watch_set_data(dbus_watch, NULL, NULL);
- }
-}
-
-static void watch_toggled(DBusWatch *dbus_watch, void *userdata) {
- ConnectionData *d = userdata;
-
- assert(dbus_watch);
- assert(d);
-
- update_watch(d->poll_api, dbus_watch);
-}
-
-typedef struct TimeoutData {
- const AvahiPoll *poll_api;
- AvahiTimeout *avahi_timeout;
- DBusTimeout *dbus_timeout;
- int ref;
-} TimeoutData;
-
-static TimeoutData* timeout_data_ref(TimeoutData *t) {
- assert(t);
- assert(t->ref >= 1);
-
- t->ref++;
- return t;
-}
-
-static void timeout_data_unref(TimeoutData *t) {
- assert(t);
- assert(t->ref >= 1);
-
- if (--t->ref <= 0) {
- if (t->avahi_timeout)
- t->poll_api->timeout_free(t->avahi_timeout);
-
- avahi_free(t);
- }
-}
-
-static void update_timeout(TimeoutData *timeout) {
- assert(timeout);
- assert(timeout->ref >= 1);
-
- if (dbus_timeout_get_enabled(timeout->dbus_timeout)) {
- struct timeval tv;
- avahi_elapse_time(&tv, dbus_timeout_get_interval(timeout->dbus_timeout), 0);
- timeout->poll_api->timeout_update(timeout->
- avahi_timeout, &tv);
- } else
- timeout->poll_api->timeout_update(timeout->avahi_timeout, NULL);
-
-}
-
-static void timeout_callback(AvahiTimeout *avahi_timeout, void *userdata) {
- TimeoutData *timeout = userdata;
-
- assert(avahi_timeout);
- assert(timeout);
-
- timeout_data_ref(timeout);
-
- dbus_timeout_handle(timeout->dbus_timeout);
- /* Ignore the return value */
-
- if (timeout->avahi_timeout)
- update_timeout(timeout);
-
- timeout_data_unref(timeout);
-}
-
-static dbus_bool_t add_timeout(DBusTimeout *dbus_timeout, void *userdata) {
- TimeoutData *timeout;
- ConnectionData *d = userdata;
- struct timeval tv;
- dbus_bool_t b;
-
- assert(dbus_timeout);
- assert(d);
-
- if (!(timeout = avahi_new(TimeoutData, 1)))
- return FALSE;
-
- timeout->dbus_timeout = dbus_timeout;
- timeout->poll_api = d->poll_api;
- timeout->ref = 1;
-
- if ((b = dbus_timeout_get_enabled(dbus_timeout)))
- avahi_elapse_time(&tv, dbus_timeout_get_interval(dbus_timeout), 0);
-
- if (!(timeout->avahi_timeout = d->poll_api->timeout_new(
- d->poll_api,
- b ? &tv : NULL,
- timeout_callback,
- timeout))) {
- avahi_free(timeout);
- return FALSE;
- }
-
- dbus_timeout_set_data(dbus_timeout, timeout, (DBusFreeFunction) timeout_data_unref);
- return TRUE;
-}
-
-static void remove_timeout(DBusTimeout *dbus_timeout, void *userdata) {
- ConnectionData *d = userdata;
- TimeoutData *timeout;
-
- assert(dbus_timeout);
- assert(d);
-
- timeout = dbus_timeout_get_data(dbus_timeout);
- assert(timeout);
-
- d->poll_api->timeout_free(timeout->avahi_timeout);
- timeout->avahi_timeout = NULL;
-}
-
-static void timeout_toggled(DBusTimeout *dbus_timeout, AVAHI_GCC_UNUSED void *userdata) {
- TimeoutData *timeout;
-
- assert(dbus_timeout);
- timeout = dbus_timeout_get_data(dbus_timeout);
- assert(timeout);
-
- update_timeout(timeout);
-}
-
-static void dispatch_status(AVAHI_GCC_UNUSED DBusConnection *connection, DBusDispatchStatus new_status, void *userdata) {
- ConnectionData *d = userdata;
-
- if (new_status == DBUS_DISPATCH_DATA_REMAINS)
- request_dispatch(d, 1);
- }
-
-int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
- ConnectionData *d = NULL;
-
- assert(c);
- assert(poll_api);
-
- if (!(d = avahi_new(ConnectionData, 1)))
- goto fail;;
-
- d->poll_api = poll_api;
- d->connection = c;
- d->ref = 1;
-
- if (!(d->dispatch_timeout = poll_api->timeout_new(poll_api, NULL, dispatch_timeout_callback, d)))
- goto fail;
-
- if (!(dbus_connection_set_watch_functions(c, add_watch, remove_watch, watch_toggled, connection_data_ref(d), (DBusFreeFunction)connection_data_unref)))
- goto fail;
-
- if (!(dbus_connection_set_timeout_functions(c, add_timeout, remove_timeout, timeout_toggled, connection_data_ref(d), (DBusFreeFunction)connection_data_unref)))
- goto fail;
-
- dbus_connection_set_dispatch_status_function(c, dispatch_status, connection_data_ref(d), (DBusFreeFunction)connection_data_unref);
-
- if (dbus_connection_get_dispatch_status(c) == DBUS_DISPATCH_DATA_REMAINS)
- request_dispatch(d, 1);
-
- connection_data_unref(d);
-
- return 0;
-
-fail:
-
- if (d) {
- d->poll_api->timeout_free(d->dispatch_timeout);
-
- avahi_free(d);
- }
-
- return -1;
-}
diff --git a/trunk/avahi-common/dbus-watch-glue.h b/trunk/avahi-common/dbus-watch-glue.h
deleted file mode 100644
index 101fa3f..0000000
--- a/trunk/avahi-common/dbus-watch-glue.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef foodbuswatchgluehfoo
-#define foodbuswatchgluehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/dbus.c b/trunk/avahi-common/dbus.c
deleted file mode 100644
index ac54848..0000000
--- a/trunk/avahi-common/dbus.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/dbus.h>
-
-static const char * const table[- AVAHI_ERR_MAX] = {
- AVAHI_DBUS_ERR_OK,
- AVAHI_DBUS_ERR_FAILURE,
- AVAHI_DBUS_ERR_BAD_STATE,
- AVAHI_DBUS_ERR_INVALID_HOST_NAME,
- AVAHI_DBUS_ERR_INVALID_DOMAIN_NAME,
- AVAHI_DBUS_ERR_NO_NETWORK,
- AVAHI_DBUS_ERR_INVALID_TTL,
- AVAHI_DBUS_ERR_IS_PATTERN,
- AVAHI_DBUS_ERR_COLLISION,
- AVAHI_DBUS_ERR_INVALID_RECORD,
-
- AVAHI_DBUS_ERR_INVALID_SERVICE_NAME,
- AVAHI_DBUS_ERR_INVALID_SERVICE_TYPE,
- AVAHI_DBUS_ERR_INVALID_PORT,
- AVAHI_DBUS_ERR_INVALID_KEY,
- AVAHI_DBUS_ERR_INVALID_ADDRESS,
- AVAHI_DBUS_ERR_TIMEOUT,
- AVAHI_DBUS_ERR_TOO_MANY_CLIENTS,
- AVAHI_DBUS_ERR_TOO_MANY_OBJECTS,
- AVAHI_DBUS_ERR_TOO_MANY_ENTRIES,
- AVAHI_DBUS_ERR_OS,
-
- AVAHI_DBUS_ERR_ACCESS_DENIED,
- AVAHI_DBUS_ERR_INVALID_OPERATION,
- AVAHI_DBUS_ERR_DBUS_ERROR,
- AVAHI_DBUS_ERR_DISCONNECTED,
- AVAHI_DBUS_ERR_NO_MEMORY,
- AVAHI_DBUS_ERR_INVALID_OBJECT,
- AVAHI_DBUS_ERR_NO_DAEMON,
- AVAHI_DBUS_ERR_INVALID_INTERFACE,
- AVAHI_DBUS_ERR_INVALID_PROTOCOL,
- AVAHI_DBUS_ERR_INVALID_FLAGS,
-
- AVAHI_DBUS_ERR_NOT_FOUND,
- AVAHI_DBUS_ERR_INVALID_CONFIG,
- AVAHI_DBUS_ERR_VERSION_MISMATCH,
- AVAHI_DBUS_ERR_INVALID_SERVICE_SUBTYPE,
- AVAHI_DBUS_ERR_INVALID_PACKET,
- AVAHI_DBUS_ERR_INVALID_DNS_ERROR,
- AVAHI_DBUS_ERR_DNS_FORMERR,
- AVAHI_DBUS_ERR_DNS_SERVFAIL,
- AVAHI_DBUS_ERR_DNS_NXDOMAIN,
- AVAHI_DBUS_ERR_DNS_NOTIMP,
-
- AVAHI_DBUS_ERR_DNS_REFUSED,
- AVAHI_DBUS_ERR_DNS_YXDOMAIN,
- AVAHI_DBUS_ERR_DNS_YXRRSET,
- AVAHI_DBUS_ERR_DNS_NXRRSET,
- AVAHI_DBUS_ERR_DNS_NOTAUTH,
- AVAHI_DBUS_ERR_DNS_NOTZONE,
- AVAHI_DBUS_ERR_INVALID_RDATA,
- AVAHI_DBUS_ERR_INVALID_DNS_CLASS,
- AVAHI_DBUS_ERR_INVALID_DNS_TYPE,
- AVAHI_DBUS_ERR_NOT_SUPPORTED,
-
- AVAHI_DBUS_ERR_NOT_PERMITTED,
- AVAHI_DBUS_ERR_INVALID_ARGUMENT,
- AVAHI_DBUS_ERR_IS_EMPTY,
- AVAHI_DBUS_ERR_NO_CHANGE
-};
-
-struct error_map {
- const char *dbus_error;
- int avahi_error;
-};
-
-static struct error_map error_map[] = {
- { DBUS_ERROR_FAILED, AVAHI_ERR_FAILURE },
- { DBUS_ERROR_NO_MEMORY, AVAHI_ERR_NO_MEMORY },
- { DBUS_ERROR_SERVICE_UNKNOWN, AVAHI_ERR_NO_DAEMON },
- { DBUS_ERROR_BAD_ADDRESS, AVAHI_ERR_NO_DAEMON },
- { DBUS_ERROR_NOT_SUPPORTED, AVAHI_ERR_NOT_SUPPORTED },
- { DBUS_ERROR_LIMITS_EXCEEDED, AVAHI_ERR_TOO_MANY_OBJECTS },
- { DBUS_ERROR_ACCESS_DENIED, AVAHI_ERR_ACCESS_DENIED },
- { DBUS_ERROR_AUTH_FAILED, AVAHI_ERR_ACCESS_DENIED },
- { DBUS_ERROR_NO_SERVER, AVAHI_ERR_NO_DAEMON },
- { DBUS_ERROR_TIMEOUT, AVAHI_ERR_TIMEOUT },
- { DBUS_ERROR_NO_NETWORK, AVAHI_ERR_NO_NETWORK },
- { DBUS_ERROR_DISCONNECTED, AVAHI_ERR_DISCONNECTED },
- { DBUS_ERROR_INVALID_ARGS, AVAHI_ERR_INVALID_ARGUMENT },
- { DBUS_ERROR_TIMED_OUT, AVAHI_ERR_TIMEOUT },
- { NULL, 0 }
-};
-
-int avahi_error_dbus_to_number(const char *s) {
- int e;
- const struct error_map *m;
-
- assert(s);
-
- for (e = -1; e > AVAHI_ERR_MAX; e--)
- if (strcmp(s, table[-e]) == 0)
- return e;
-
- for (m = error_map; m->dbus_error; m++)
- if (strcmp(m->dbus_error, s) == 0)
- return m->avahi_error;
-
- return AVAHI_ERR_DBUS_ERROR;
-}
-
-const char *avahi_error_number_to_dbus(int error) {
- assert(error > AVAHI_ERR_MAX);
- assert(error < 1);
-
- return table[-error];
-}
diff --git a/trunk/avahi-common/dbus.h b/trunk/avahi-common/dbus.h
deleted file mode 100644
index a93988d..0000000
--- a/trunk/avahi-common/dbus.h
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef foodbushfoo
-#define foodbushfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file dbus.h Some definitions for the D-Bus interface */
-
-#include <avahi-common/cdecl.h>
-#include <dbus/dbus.h>
-
-AVAHI_C_DECL_BEGIN
-
-#define AVAHI_DBUS_NAME "org.freedesktop.Avahi"
-#define AVAHI_DBUS_INTERFACE_SERVER AVAHI_DBUS_NAME".Server"
-#define AVAHI_DBUS_PATH_SERVER "/"
-#define AVAHI_DBUS_INTERFACE_ENTRY_GROUP AVAHI_DBUS_NAME".EntryGroup"
-#define AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER AVAHI_DBUS_NAME".DomainBrowser"
-#define AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER AVAHI_DBUS_NAME".ServiceTypeBrowser"
-#define AVAHI_DBUS_INTERFACE_SERVICE_BROWSER AVAHI_DBUS_NAME".ServiceBrowser"
-#define AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER AVAHI_DBUS_NAME".AddressResolver"
-#define AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER AVAHI_DBUS_NAME".HostNameResolver"
-#define AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER AVAHI_DBUS_NAME".ServiceResolver"
-#define AVAHI_DBUS_INTERFACE_RECORD_BROWSER AVAHI_DBUS_NAME".RecordBrowser"
-
-/** The D-Bus API version identifier. The first byte specifies the API
-release, the second byte specifies the revision. If the revision
-number is increased the API has been extended but is downwards
-compatible. If the release changes compatibility is lost.
-
-Avahi 0.6 implements API version 0x0201;
-Avahi 0.6.1 implements API version 0x0202 */
-#define AVAHI_DBUS_API_VERSION ((uint32_t) 0x0203)
-
-#define AVAHI_DBUS_ERR_OK "org.freedesktop.Avahi.Success"
-#define AVAHI_DBUS_ERR_FAILURE "org.freedesktop.Avahi.Failure"
-#define AVAHI_DBUS_ERR_BAD_STATE "org.freedesktop.Avahi.BadStateError"
-#define AVAHI_DBUS_ERR_INVALID_HOST_NAME "org.freedesktop.Avahi.InvalidHostNameError"
-#define AVAHI_DBUS_ERR_INVALID_DOMAIN_NAME "org.freedesktop.Avahi.InvalidDomainNameError"
-#define AVAHI_DBUS_ERR_NO_NETWORK "org.freedesktop.Avahi.NoNetworkError"
-#define AVAHI_DBUS_ERR_INVALID_TTL "org.freedesktop.Avahi.InvalidTTLError"
-#define AVAHI_DBUS_ERR_IS_PATTERN "org.freedesktop.Avahi.IsPatternError"
-#define AVAHI_DBUS_ERR_COLLISION "org.freedesktop.Avahi.CollisionError"
-#define AVAHI_DBUS_ERR_INVALID_RECORD "org.freedesktop.Avahi.InvalidRecordError"
-
-#define AVAHI_DBUS_ERR_INVALID_SERVICE_NAME "org.freedesktop.Avahi.InvalidServiceNameError"
-#define AVAHI_DBUS_ERR_INVALID_SERVICE_TYPE "org.freedesktop.Avahi.InvalidServiceTypeError"
-#define AVAHI_DBUS_ERR_INVALID_PORT "org.freedesktop.Avahi.InvalidPortError"
-#define AVAHI_DBUS_ERR_INVALID_KEY "org.freedesktop.Avahi.InvalidKeyError"
-#define AVAHI_DBUS_ERR_INVALID_ADDRESS "org.freedesktop.Avahi.InvalidAddressError"
-#define AVAHI_DBUS_ERR_TIMEOUT "org.freedesktop.Avahi.TimeoutError"
-#define AVAHI_DBUS_ERR_TOO_MANY_CLIENTS "org.freedesktop.Avahi.TooManyClientsError"
-#define AVAHI_DBUS_ERR_TOO_MANY_OBJECTS "org.freedesktop.Avahi.TooManyObjectsError"
-#define AVAHI_DBUS_ERR_TOO_MANY_ENTRIES "org.freedesktop.Avahi.TooManyEntriesError"
-#define AVAHI_DBUS_ERR_OS "org.freedesktop.Avahi.OSError"
-
-#define AVAHI_DBUS_ERR_ACCESS_DENIED DBUS_ERROR_ACCESS_DENIED
-#define AVAHI_DBUS_ERR_INVALID_OPERATION "org.freedesktop.Avahi.InvalidOperationError"
-#define AVAHI_DBUS_ERR_DBUS_ERROR "org.freedesktop.Avahi.DBusError"
-#define AVAHI_DBUS_ERR_DISCONNECTED "org.freedesktop.Avahi.DisconnectedError"
-#define AVAHI_DBUS_ERR_NO_MEMORY "org.freedesktop.Avahi.NoMemoryError"
-#define AVAHI_DBUS_ERR_INVALID_OBJECT "org.freedesktop.Avahi.InvalidObjectError"
-#define AVAHI_DBUS_ERR_NO_DAEMON "org.freedesktop.Avahi.NoDaemonError"
-#define AVAHI_DBUS_ERR_INVALID_INTERFACE "org.freedesktop.Avahi.InvalidInterfaceError"
-#define AVAHI_DBUS_ERR_INVALID_PROTOCOL "org.freedesktop.Avahi.InvalidInterfaceProtocolError"
-#define AVAHI_DBUS_ERR_INVALID_FLAGS "org.freedesktop.Avahi.InvalidFlagsError"
-
-#define AVAHI_DBUS_ERR_NOT_FOUND "org.freedesktop.Avahi.NotFoundError"
-#define AVAHI_DBUS_ERR_INVALID_CONFIG "org.freedesktop.Avahi.InvalidConfigurationError"
-#define AVAHI_DBUS_ERR_VERSION_MISMATCH "org.freedesktop.Avahi.VersionMismatchError"
-#define AVAHI_DBUS_ERR_INVALID_SERVICE_SUBTYPE "org.freedesktop.Avahi.InvalidServiceSubtypeError"
-#define AVAHI_DBUS_ERR_INVALID_PACKET "org.freedesktop.Avahi.InvalidPacketError"
-#define AVAHI_DBUS_ERR_INVALID_DNS_ERROR "org.freedesktop.Avahi.InvalidDNSErrorError"
-#define AVAHI_DBUS_ERR_DNS_FORMERR "org.freedesktop.Avahi.DNSFORMERR"
-#define AVAHI_DBUS_ERR_DNS_SERVFAIL "org.freedesktop.Avahi.DNSSERVFAIL"
-#define AVAHI_DBUS_ERR_DNS_NXDOMAIN "org.freedesktop.Avahi.DNSNXDOMAIN"
-#define AVAHI_DBUS_ERR_DNS_NOTIMP "org.freedesktop.Avahi.DNSNOTIMP"
-
-#define AVAHI_DBUS_ERR_DNS_REFUSED "org.freedesktop.Avahi.DNSREFUSED"
-#define AVAHI_DBUS_ERR_DNS_YXDOMAIN "org.freedesktop.Avahi.DNSYXDOMAIN"
-#define AVAHI_DBUS_ERR_DNS_YXRRSET "org.freedesktop.Avahi.DNSYXRRSET"
-#define AVAHI_DBUS_ERR_DNS_NXRRSET "org.freedesktop.Avahi.DNSNXRRSET"
-#define AVAHI_DBUS_ERR_DNS_NOTAUTH "org.freedesktop.Avahi.DNSNOTAUTH"
-#define AVAHI_DBUS_ERR_DNS_NOTZONE "org.freedesktop.Avahi.DNSNOTZONE"
-#define AVAHI_DBUS_ERR_INVALID_RDATA "org.freedesktop.Avahi.InvalidRDataError"
-#define AVAHI_DBUS_ERR_INVALID_DNS_CLASS "org.freedesktop.Avahi.InvalidDNSClassError"
-#define AVAHI_DBUS_ERR_INVALID_DNS_TYPE "org.freedesktop.Avahi.InvalidDNSTypeError"
-#define AVAHI_DBUS_ERR_NOT_SUPPORTED "org.freedesktop.Avahi.NotSupportedError"
-
-#define AVAHI_DBUS_ERR_NOT_PERMITTED "org.freedesktop.Avahi.NotPermittedError"
-#define AVAHI_DBUS_ERR_INVALID_ARGUMENT "org.freedesktop.Avahi.InvalidArgumentError"
-#define AVAHI_DBUS_ERR_IS_EMPTY "org.freedesktop.Avahi.IsEmptyError"
-#define AVAHI_DBUS_ERR_NO_CHANGE "org.freedesktop.Avahi.NoChangeError"
-
-/** Convert a DBus error string into an Avahi error number */
-int avahi_error_dbus_to_number(const char *s);
-
-/** Convert an Avahi error number into a DBus error string. Result should not be freed */
-const char * avahi_error_number_to_dbus(int error);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/defs.h b/trunk/avahi-common/defs.h
deleted file mode 100644
index 4efa5ad..0000000
--- a/trunk/avahi-common/defs.h
+++ /dev/null
@@ -1,307 +0,0 @@
-#ifndef foodefshfoo
-#define foodefshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file defs.h Some common definitions */
-
-#include <avahi-common/cdecl.h>
-
-/** \mainpage
- *
- * \section choose_api Choosing an API
- *
- * Avahi provides three programming APIs for integration of
- * mDNS/DNS-SD features into your progams:
- *
- * \li <b>avahi-core</b>: an API for embedding a complete mDNS/DNS-SD stack
- * into your software. This is intended for developers of embedded
- * ampliances only. We dissuade from using this API in normal desktop
- * applications since it is not a good idea to run multiple mDNS
- * stacks simultaneously on the same host.
- * \li <b>the D-Bus API</b>: an extensive D-Bus interface for browsing and
- * registering mDNS/DNS-SD services using avahi-daemon. We recommend
- * to use this API for software written in any language but
- * C. (i.e. Python)
- * \li <b>avahi-client</b>: a simplifying C wrapper around the D-Bus API. We
- * recommend to use this API in C or C++ progams. The D-Bus internals
- * are hidden completely.
- *
- * All three APIs are very similar, however avahi-core is the most powerful.
- *
- * In addition to the three APIs described above Avahi supports two
- * compatibility libraries:
- *
- * \li avahi-compat-libdns_sd: the original Bonjour API as documented
- * in the header file "dns_sd.h" by Apple Computer, Inc.
- *
- * \li avahi-compat-howl: the HOWL API as released with HOWL 0.9.8 by
- * Porchdog Software.
- *
- * Please note that these compatibility layers are incomplete and
- * generally a waste of resources. We strongly encourage everyone to
- * use our native APIs for newly written programs and to port older
- * programs to avahi-client!
- *
- * \section error_reporting Error Reporting
- *
- * Some notes on the Avahi error handling:
- *
- * - Error codes are negative integers and defined as AVAHI_ERR_xx
- * - If a function returns some kind of non-negative integer value on
- * success, a failure is indicated by returning the error code
- * directly.
- * - If a function returns a pointer of some kind on success, a
- * failure is indicated by returning NULL
- * - The last error number may be retrieved by calling
- * avahi_client_errno()
- * - Just like the libc errno variable the Avahi errno is NOT reset to
- * AVAHI_OK if a function call succeeds.
- * - You may convert a numeric error code into a human readable string
- * using avahi_strerror()
- * - The constructor function avahi_client_new() returns the error
- * code in a call-by-reference argument
- *
- * \section event_loop Event Loop Abstraction
- *
- * Avahi uses a simple event loop abstraction laye. A table AvahiPoll
- * which contains function pointers for user defined timeout and I/O
- * condition event source implementations needs to be passed to
- * avahi_client_new(). An adapter for this abstraction layer is
- * available for the GLib main loop in the object AvahiGLibPoll. A
- * simple stand-alone implementation is available under the name
- * AvahiSimplePoll. An adpater for the Qt main loop is available from
- * avahi_qt_poll_get().
- *
- * \section good_publish How to Register Services
- *
- * - Subscribe to server state changes. Pass a callback function
- * pointer to avahi_client_new(). It will be called
- * whenever the server state changes.
- * - Only register your services when the server is in state
- * AVAHI_SERVER_RUNNING. If you register your services in other server
- * states they might not be accessible since the local host name is
- * not established.
- * - Remove your services when the server enters
- * AVAHI_SERVER_COLLISION or AVAHI_SERVER_REGISTERING state. Your
- * services may no be reachable anymore since the local host name is
- * no longer established or is currently in the process of being
- * established.
- * - When registering services, use the following algorithm:
- * - Create a new entry group (i.e. avahi_entry_group_new())
- * - Add your service(s)/additional host names (i.e. avahi_entry_group_add_service())
- * - Commit the entry group (i.e. avahi_entry_group_commit())
- * - Subscribe to entry group state changes.
- * - If the entry group enters AVAHI_ENTRY_GROUP_COLLISION state the
- * services of the entry group are automatically removed from the
- * server. You may immediately add your services back to the entry
- * group (but with new names, perhaps using
- * avahi_alternative_service_name()) and commit again. Please do not
- * free the entry group and create a new one. This would inhibit some
- * traffic limiting algorithms in mDNS.
- * - When you need to modify your services (i.e. change the TXT data
- * or the port number), use the AVAHI_PUBLISH_UPDATE flag. Please do
- * not free the entry group and create a new one. This would inhibit
- * some traffic limiting algorithms in mDNS. When changing just the
- * TXT data avahi_entry_group_update_txt() is a shortcut for
- * AVAHI_PUBLISH_UPDATE. Please note that you cannot use
- * AVAHI_PUBLISH_UPDATE when changing the service name! Renaming a
- * DNS-SD service is identical to deleting and creating a new one, and
- * that's exactly what you should do in that case. First call
- * avahi_entry_group_reset() to remove it and than readd it normally.
- *
- * \section good_browse How to Browse for Services
- *
- * - For normal applications you need to call avahi_service_browser_new()
- * for the service type you want to browse for. Use
- * avahi_client_resolve_service() to acquire service data for a a service
- * name.
- * - You can use avahi_domain_browser_new() to get a list of announced
- * browsing domains. Please note that not all domains whith services
- * on the LAN are mandatorily announced.
- * - Network monitor software may use avahi_service_type_browser_new()
- * to browse for the list of available service types on the LAN. This
- * API should NOT be used in normal software since it increases
- * traffic immensly. In addition not all DNS-SD implementations
- * announce their services in away that they can be found with
- * avahi_server_type_browser_new().
- * - There is no need to subscribe to server state changes.
- *
- * \section daemon_dies How to Write a Client That Can Deal with Daemon Restarts
- *
- * With Avahi it is possible to write client applications that can
- * deal with Avahi daemon restarts. To accomplish that make sure to
- * pass AVAHI_CLIENT_NO_FAIL to avahi_client_new()'s flags
- * parameter. That way avahi_client_new() will succeed even when the
- * daemon is not running. In that case the object will enter
- * AVAHI_CLIENT_CONNECTING state. As soon as the daemon becomes
- * available the object will enter one of the AVAHI_CLIENT_S_xxx
- * states. Make sure to not create browsers or entry groups before the
- * client object has entered one of those states. As usual you will be
- * informed about state changes with the callback function supplied to
- * avahi_client_new(). If the client is forced to disconnect from the
- * server it will enter AVAHI_CLIENT_FAILURE state with
- * avahi_client_errno() == AVAHI_ERR_DISCONNECTED. Free the
- * AvahiClient object in that case and reconnect to the server anew -
- * again with passing AVAHI_CLIENT_NO_FAIL to avahi_client_new().
- *
- * We encourage to implement this in all software where service
- * discovery is not an integral part of application. e.g. use it in
- * all kinds of background daemons, but not in software like iChat
- * compatible IM software.
- *
- * For now AVAHI_CLIENT_NO_FAIL cannot deal with D-Bus daemon restarts.
- *
- * \section domains How to Deal Properly with Browsing Domains
- *
- * Due to the introduction of wide-area DNS-SD the correct handling of
- * domains becomes more important for Avahi enabled applications. All
- * applications that offer the user a list of services discovered with
- * Avahi should offer some kind of editable drop down box where the
- * user can either enter his own domain or select one of those offered
- * by AvahiDomainBrowser. The default domain to browse should be the
- * one returned by avahi_client_get_domain_name(). The list of domains
- * returned by AvahiDomainBrowser is assembled by the browsing domains
- * configured in the daemon's configuration file, the domains
- * announced inside the default domain, the domains set with the
- * environment variable $AVAHI_BROWSE_DOMAINS (colon-seperated) on the
- * client side and the domains set in the XDG configuration file
- * ~/.config/avahi/browse-domains on the client side (seperated by
- * newlines). File managers offering some kind of "Network
- * Neighborhood" folder should show the entries of the default domain
- * right inside that and offer subfolders for the browsing domains
- * returned by AvahiDomainBrowser.
- */
-
-AVAHI_C_DECL_BEGIN
-
-/** States of an entry group object */
-typedef enum {
- AVAHI_ENTRY_GROUP_UNCOMMITED, /**< The group has not yet been commited, the user must still call avahi_entry_group_commit() */
- AVAHI_ENTRY_GROUP_REGISTERING, /**< The entries of the group are currently being registered */
- AVAHI_ENTRY_GROUP_ESTABLISHED, /**< The entries have successfully been established */
- AVAHI_ENTRY_GROUP_COLLISION, /**< A name collision for one of the entries in the group has been detected, the entries have been withdrawn */
- AVAHI_ENTRY_GROUP_FAILURE /**< Some kind of failure happened, the entries have been withdrawn */
-} AvahiEntryGroupState;
-
-/** The type of domain to browse for */
-typedef enum {
- AVAHI_DOMAIN_BROWSER_BROWSE, /**< Browse for a list of available browsing domains */
- AVAHI_DOMAIN_BROWSER_BROWSE_DEFAULT, /**< Browse for the default browsing domain */
- AVAHI_DOMAIN_BROWSER_REGISTER, /**< Browse for a list of available registering domains */
- AVAHI_DOMAIN_BROWSER_REGISTER_DEFAULT, /**< Browse for the default registering domain */
- AVAHI_DOMAIN_BROWSER_BROWSE_LEGACY, /**< Legacy browse domain - see DNS-SD spec for more information */
- AVAHI_DOMAIN_BROWSER_MAX
-} AvahiDomainBrowserType;
-
-/** Some flags for publishing functions */
-typedef enum {
- AVAHI_PUBLISH_UNIQUE = 1, /**< For raw records: The RRset is intended to be unique */
- AVAHI_PUBLISH_NO_PROBE = 2, /**< For raw records: Though the RRset is intended to be unique no probes shall be sent */
- AVAHI_PUBLISH_NO_ANNOUNCE = 4, /**< For raw records: Do not announce this RR to other hosts */
- AVAHI_PUBLISH_ALLOW_MULTIPLE = 8, /**< For raw records: Allow multiple local records of this type, even if they are intended to be unique */
- AVAHI_PUBLISH_NO_REVERSE = 16, /**< For address records: don't create a reverse (PTR) entry */
- AVAHI_PUBLISH_NO_COOKIE = 32, /**< For service records: do not implicitly add the local service cookie to TXT data */
- AVAHI_PUBLISH_UPDATE = 64, /**< Update existing records instead of adding new ones */
- AVAHI_PUBLISH_USE_WIDE_AREA = 128, /**< Register the record using wide area DNS (i.e. unicast DNS update) */
- AVAHI_PUBLISH_USE_MULTICAST = 256 /**< Register the record using multicast DNS */
-} AvahiPublishFlags;
-
-/** Some flags for lookup functions */
-typedef enum {
- AVAHI_LOOKUP_USE_WIDE_AREA = 1, /**< Force lookup via wide area DNS */
- AVAHI_LOOKUP_USE_MULTICAST = 2, /**< Force lookup via multicast DNS */
- AVAHI_LOOKUP_NO_TXT = 4, /**< When doing service resolving, don't lookup TXT record */
- AVAHI_LOOKUP_NO_ADDRESS = 8 /**< When doing service resolving, don't lookup A/AAAA record */
-} AvahiLookupFlags;
-
-/** Some flags for lookup callback functions */
-typedef enum {
- AVAHI_LOOKUP_RESULT_CACHED = 1, /**< This response originates from the cache */
- AVAHI_LOOKUP_RESULT_WIDE_AREA = 2, /**< This response originates from wide area DNS */
- AVAHI_LOOKUP_RESULT_MULTICAST = 4, /**< This response originates from multicast DNS */
- AVAHI_LOOKUP_RESULT_LOCAL = 8, /**< This record/service resides on and was announced by the local host. Only available in service and record browsers and only on AVAHI_BROWSER_NEW. */
- AVAHI_LOOKUP_RESULT_OUR_OWN = 16, /**< This service belongs to the same local client as the browser object. Only available in avahi-client, and only for service browsers and only on AVAHI_BROWSER_NEW. */
- AVAHI_LOOKUP_RESULT_STATIC = 32 /**< The returned data has been defined statically by some configuration option */
-} AvahiLookupResultFlags;
-
-/** Type of callback event when browsing */
-typedef enum {
- AVAHI_BROWSER_NEW, /**< The object is new on the network */
- AVAHI_BROWSER_REMOVE, /**< The object has been removed from the network */
- AVAHI_BROWSER_CACHE_EXHAUSTED, /**< One-time event, to notify the user that all entries from the caches have been send */
- AVAHI_BROWSER_ALL_FOR_NOW, /**< One-time event, to notify the user that more records will probably not show up in the near future, i.e. all cache entries have been read and all static servers been queried */
- AVAHI_BROWSER_FAILURE /**< Browsing failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
-} AvahiBrowserEvent;
-
-/** Type of callback event when resolving */
-typedef enum {
- AVAHI_RESOLVER_FOUND, /**< RR found, resolving successful */
- AVAHI_RESOLVER_FAILURE /**< Resolving failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
-} AvahiResolverEvent;
-
-/** States of a server object */
-typedef enum {
- AVAHI_SERVER_INVALID, /**< Invalid state (initial) */
- AVAHI_SERVER_REGISTERING, /**< Host RRs are being registered */
- AVAHI_SERVER_RUNNING, /**< All host RRs have been established */
- AVAHI_SERVER_COLLISION, /**< There is a collision with a host RR. All host RRs have been withdrawn, the user should set a new host name via avahi_server_set_host_name() */
- AVAHI_SERVER_FAILURE /**< Some fatal failure happened, the server is unable to proceed */
-} AvahiServerState;
-
-/** For every service a special TXT item is implicitly added, which
- * contains a random cookie which is private to the local daemon. This
- * can be used by clients to determine if two services on two
- * different subnets are effectively the same. */
-#define AVAHI_SERVICE_COOKIE "org.freedesktop.Avahi.cookie"
-
-/** In invalid cookie as special value */
-#define AVAHI_SERVICE_COOKIE_INVALID (0)
-
-/** DNS record types, see RFC 1035 */
-enum {
- AVAHI_DNS_TYPE_A = 0x01,
- AVAHI_DNS_TYPE_NS = 0x02,
- AVAHI_DNS_TYPE_CNAME = 0x05,
- AVAHI_DNS_TYPE_SOA = 0x06,
- AVAHI_DNS_TYPE_PTR = 0x0C,
- AVAHI_DNS_TYPE_HINFO = 0x0D,
- AVAHI_DNS_TYPE_MX = 0x0F,
- AVAHI_DNS_TYPE_TXT = 0x10,
- AVAHI_DNS_TYPE_AAAA = 0x1C,
- AVAHI_DNS_TYPE_SRV = 0x21,
-};
-
-/** DNS record classes, see RFC 1035 */
-enum {
- AVAHI_DNS_CLASS_IN = 0x01, /**< Probably the only class we will ever use */
-};
-
-/** The default TTL for RRs which contain a host name of some kind. */
-#define AVAHI_DEFAULT_TTL_HOST_NAME (120)
-
-/** The default TTL for all other records. */
-#define AVAHI_DEFAULT_TTL (75*60)
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/domain-test.c b/trunk/avahi-common/domain-test.c
deleted file mode 100644
index 0f7d851..0000000
--- a/trunk/avahi-common/domain-test.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-#include "domain.h"
-#include "malloc.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- char *s;
- char t[256], r[256];
- const char *p;
- size_t size;
- char name[64], type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
-
- printf("%s\n", s = avahi_normalize_name_strdup("foo.foo\\046."));
- avahi_free(s);
-
- printf("%s\n", s = avahi_normalize_name_strdup("foo.foo\\.foo."));
- avahi_free(s);
-
-
- printf("%s\n", s = avahi_normalize_name_strdup("fo\\\\o\\..f oo."));
- avahi_free(s);
-
- printf("%i\n", avahi_domain_equal("\\065aa bbb\\.\\046cc.cc\\\\.dee.fff.", "Aaa BBB\\.\\.cc.cc\\\\.dee.fff"));
- printf("%i\n", avahi_domain_equal("A", "a"));
-
- printf("%i\n", avahi_domain_equal("a", "aaa"));
-
- printf("%u = %u\n", avahi_domain_hash("ccc\\065aa.aa\\.b\\\\."), avahi_domain_hash("cccAaa.aa\\.b\\\\"));
-
-
- avahi_service_name_join(t, sizeof(t), "foo.foo.foo \\.", "_http._tcp", "test.local");
- printf("<%s>\n", t);
-
- avahi_service_name_split(t, name, sizeof(name), type, sizeof(type), domain, sizeof(domain));
- printf("name: <%s>; type: <%s>; domain <%s>\n", name, type, domain);
-
- avahi_service_name_join(t, sizeof(t), NULL, "_http._tcp", "one.two\\. .local");
- printf("<%s>\n", t);
-
- avahi_service_name_split(t, NULL, 0, type, sizeof(type), domain, sizeof(domain));
- printf("name: <>; type: <%s>; domain <%s>\n", type, domain);
-
-
- p = "--:---\\\\\\123\\065_äöü\\064\\.\\\\sjöödfhh.sdfjhskjdf";
- printf("unescaped: <%s>, rest: %s\n", avahi_unescape_label(&p, t, sizeof(t)), p);
-
- size = sizeof(r);
- s = r;
-
- printf("escaped: <%s>\n", avahi_escape_label(t, strlen(t), &s, &size));
-
- p = r;
- printf("unescaped: <%s>\n", avahi_unescape_label(&p, t, sizeof(t)));
-
- assert(avahi_is_valid_service_type_generic("_foo._bar._waldo"));
- assert(!avahi_is_valid_service_type_strict("_foo._bar._waldo"));
- assert(!avahi_is_valid_service_subtype("_foo._bar._waldo"));
-
- assert(avahi_is_valid_service_type_generic("_foo._tcp"));
- assert(avahi_is_valid_service_type_strict("_foo._tcp"));
- assert(!avahi_is_valid_service_subtype("_foo._tcp"));
-
- assert(!avahi_is_valid_service_type_generic("_foo._bar.waldo"));
- assert(!avahi_is_valid_service_type_strict("_foo._bar.waldo"));
- assert(!avahi_is_valid_service_subtype("_foo._bar.waldo"));
-
- assert(!avahi_is_valid_service_type_generic(""));
- assert(!avahi_is_valid_service_type_strict(""));
- assert(!avahi_is_valid_service_subtype(""));
-
- assert(avahi_is_valid_service_type_generic("_foo._sub._bar._tcp"));
- assert(!avahi_is_valid_service_type_strict("_foo._sub._bar._tcp"));
- assert(avahi_is_valid_service_subtype("_foo._sub._bar._tcp"));
-
- printf("%s\n", avahi_get_type_from_subtype("_foo._sub._bar._tcp"));
-
- assert(!avahi_is_valid_host_name("sf.ooo."));
- assert(avahi_is_valid_host_name("sfooo."));
- assert(avahi_is_valid_host_name("sfooo"));
-
- assert(avahi_is_valid_domain_name("."));
- assert(avahi_is_valid_domain_name(""));
-
- assert(avahi_normalize_name(".", t, sizeof(t)));
- assert(avahi_normalize_name("", t, sizeof(t)));
-
- assert(!avahi_is_valid_fqdn("."));
- assert(!avahi_is_valid_fqdn(""));
- assert(!avahi_is_valid_fqdn("foo"));
- assert(avahi_is_valid_fqdn("foo.bar"));
- assert(avahi_is_valid_fqdn("foo.bar."));
- assert(avahi_is_valid_fqdn("gnurz.foo.bar."));
- assert(!avahi_is_valid_fqdn("192.168.50.1"));
- assert(!avahi_is_valid_fqdn("::1"));
- assert(!avahi_is_valid_fqdn(".192.168.50.1."));
-
- return 0;
-}
diff --git a/trunk/avahi-common/domain.c b/trunk/avahi-common/domain.c
deleted file mode 100644
index 8d339c7..0000000
--- a/trunk/avahi-common/domain.c
+++ /dev/null
@@ -1,611 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "domain.h"
-#include "malloc.h"
-#include "error.h"
-#include "address.h"
-#include "utf8.h"
-
-/* Read the first label from string *name, unescape "\" and write it to dest */
-char *avahi_unescape_label(const char **name, char *dest, size_t size) {
- unsigned i = 0;
- char *d;
-
- assert(dest);
- assert(size > 0);
- assert(name);
-
- d = dest;
-
- for (;;) {
- if (i >= size)
- return NULL;
-
- if (**name == '.') {
- (*name)++;
- break;
- }
-
- if (**name == 0)
- break;
-
- if (**name == '\\') {
- /* Escaped character */
-
- (*name) ++;
-
- if (**name == 0)
- /* Ending NUL */
- return NULL;
-
- else if (**name == '\\' || **name == '.') {
- /* Escaped backslash or dot */
- *(d++) = *((*name) ++);
- i++;
- } else if (isdigit(**name)) {
- int n;
-
- /* Escaped literal ASCII character */
-
- if (!isdigit(*(*name+1)) || !isdigit(*(*name+2)))
- return NULL;
-
- n = ((uint8_t) (**name - '0') * 100) + ((uint8_t) (*(*name+1) - '0') * 10) + ((uint8_t) (*(*name +2) - '0'));
-
- if (n > 255 || n == 0)
- return NULL;
-
- *(d++) = (char) n;
- i++;
-
- (*name) += 3;
- } else
- return NULL;
-
- } else {
-
- /* Normal character */
-
- *(d++) = *((*name) ++);
- i++;
- }
- }
-
- assert(i < size);
-
- *d = 0;
-
- if (!avahi_utf8_valid(dest))
- return NULL;
-
- return dest;
-}
-
-/* Escape "\" and ".", append \0 */
-char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, size_t *ret_size) {
- char *r;
-
- assert(src);
- assert(ret_name);
- assert(*ret_name);
- assert(ret_size);
- assert(*ret_size > 0);
-
- r = *ret_name;
-
- while (src_length > 0) {
- if (*src == '.' || *src == '\\') {
-
- /* Dot or backslash */
-
- if (*ret_size < 3)
- return NULL;
-
- *((*ret_name) ++) = '\\';
- *((*ret_name) ++) = *src;
- (*ret_size) -= 2;
-
- } else if (
- *src == '_' ||
- *src == '-' ||
- (*src >= '0' && *src <= '9') ||
- (*src >= 'a' && *src <= 'z') ||
- (*src >= 'A' && *src <= 'Z')) {
-
- /* Proper character */
-
- if (*ret_size < 2)
- return NULL;
-
- *((*ret_name)++) = *src;
- (*ret_size) --;
-
- } else {
-
- /* Everything else */
-
- if (*ret_size < 5)
- return NULL;
-
- *((*ret_name) ++) = '\\';
- *((*ret_name) ++) = '0' + (char) ((uint8_t) *src / 100);
- *((*ret_name) ++) = '0' + (char) (((uint8_t) *src / 10) % 10);
- *((*ret_name) ++) = '0' + (char) ((uint8_t) *src % 10);
-
- (*ret_size) -= 4;
- }
-
- src_length --;
- src++;
- }
-
- **ret_name = 0;
-
- return r;
-}
-
-char *avahi_normalize_name(const char *s, char *ret_s, size_t size) {
- int empty = 1;
- char *r;
-
- assert(s);
- assert(ret_s);
- assert(size > 0);
-
- r = ret_s;
- *ret_s = 0;
-
- while (*s) {
- char label[AVAHI_LABEL_MAX];
-
- if (!(avahi_unescape_label(&s, label, sizeof(label))))
- return NULL;
-
- if (label[0] == 0) {
-
- if (*s == 0 && empty)
- return ret_s;
-
- return NULL;
- }
-
- if (!empty) {
- if (size < 1)
- return NULL;
-
- *(r++) = '.';
- size--;
-
- } else
- empty = 0;
-
- avahi_escape_label(label, strlen(label), &r, &size);
- }
-
- return ret_s;
-}
-
-char *avahi_normalize_name_strdup(const char *s) {
- char t[AVAHI_DOMAIN_NAME_MAX];
- assert(s);
-
- if (!(avahi_normalize_name(s, t, sizeof(t))))
- return NULL;
-
- return avahi_strdup(t);
-}
-
-int avahi_domain_equal(const char *a, const char *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 1;
-
- for (;;) {
- char ca[AVAHI_LABEL_MAX], cb[AVAHI_LABEL_MAX], *r;
-
- r = avahi_unescape_label(&a, ca, sizeof(ca));
- assert(r);
- r = avahi_unescape_label(&b, cb, sizeof(cb));
- assert(r);
-
- if (strcasecmp(ca, cb))
- return 0;
-
- if (!*a && !*b)
- return 1;
- }
-
- return 1;
-}
-
-int avahi_is_valid_service_type_generic(const char *t) {
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return 0;
-
- do {
- char label[AVAHI_LABEL_MAX];
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return 0;
-
- } while (*t);
-
- return 1;
-}
-
-int avahi_is_valid_service_type_strict(const char *t) {
- char label[AVAHI_LABEL_MAX];
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return 0;
-
- /* Application name */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return 0;
-
- if (!*t)
- return 0;
-
- /* _tcp or _udp boilerplate */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strcasecmp(label, "_tcp") && strcasecmp(label, "_udp"))
- return 0;
-
- if (*t)
- return 0;
-
- return 1;
-}
-
-const char *avahi_get_type_from_subtype(const char *t) {
- char label[AVAHI_LABEL_MAX];
- const char *ret;
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return NULL;
-
- /* Subtype name */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return NULL;
-
- if (!*t)
- return NULL;
-
- /* String "_sub" */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strcasecmp(label, "_sub"))
- return NULL;
-
- if (!*t)
- return NULL;
-
- ret = t;
-
- /* Application name */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strlen(label) <= 2 || label[0] != '_')
- return NULL;
-
- if (!*t)
- return NULL;
-
- /* _tcp or _udp boilerplate */
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return NULL;
-
- if (strcasecmp(label, "_tcp") && strcasecmp(label, "_udp"))
- return NULL;
-
- if (*t)
- return NULL;
-
- return ret;
-}
-
-int avahi_is_valid_service_subtype(const char *t) {
- assert(t);
-
- return !!avahi_get_type_from_subtype(t);
-}
-
-int avahi_is_valid_domain_name(const char *t) {
- int is_first = 1;
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX)
- return 0;
-
- do {
- char label[AVAHI_LABEL_MAX];
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- /* Explicitly allow the root domain name */
- if (is_first && label[0] == 0 && *t == 0)
- return 1;
-
- is_first = 0;
-
- if (label[0] == 0)
- return 0;
-
- } while (*t);
-
- return 1;
-}
-
-int avahi_is_valid_service_name(const char *t) {
- assert(t);
-
- if (strlen(t) >= AVAHI_LABEL_MAX || !*t)
- return 0;
-
- return 1;
-}
-
-int avahi_is_valid_host_name(const char *t) {
- char label[AVAHI_LABEL_MAX];
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX || !*t)
- return 0;
-
- if (!(avahi_unescape_label(&t, label, sizeof(label))))
- return 0;
-
- if (strlen(label) < 1)
- return 0;
-
- if (*t)
- return 0;
-
- return 1;
-}
-
-unsigned avahi_domain_hash(const char *s) {
- unsigned hash = 0;
-
- while (*s) {
- char c[AVAHI_LABEL_MAX], *p, *r;
-
- r = avahi_unescape_label(&s, c, sizeof(c));
- assert(r);
-
- for (p = c; *p; p++)
- hash = 31 * hash + tolower(*p);
- }
-
- return hash;
-}
-
-int avahi_service_name_join(char *p, size_t size, const char *name, const char *type, const char *domain) {
- char escaped_name[AVAHI_LABEL_MAX*4];
- char normalized_type[AVAHI_DOMAIN_NAME_MAX];
- char normalized_domain[AVAHI_DOMAIN_NAME_MAX];
-
- assert(p);
-
- /* Validity checks */
-
- if ((name && !avahi_is_valid_service_name(name)))
- return AVAHI_ERR_INVALID_SERVICE_NAME;
-
- if (!avahi_is_valid_service_type_generic(type))
- return AVAHI_ERR_INVALID_SERVICE_TYPE;
-
- if (!avahi_is_valid_domain_name(domain))
- return AVAHI_ERR_INVALID_DOMAIN_NAME;
-
- /* Preparation */
-
- if (name) {
- size_t l = sizeof(escaped_name);
- char *e = escaped_name, *r;
- r = avahi_escape_label(name, strlen(name), &e, &l);
- assert(r);
- }
-
- if (!(avahi_normalize_name(type, normalized_type, sizeof(normalized_type))))
- return AVAHI_ERR_INVALID_SERVICE_TYPE;
-
- if (!(avahi_normalize_name(domain, normalized_domain, sizeof(normalized_domain))))
- return AVAHI_ERR_INVALID_DOMAIN_NAME;
-
- /* Concatenation */
-
- snprintf(p, size, "%s%s%s.%s", name ? escaped_name : "", name ? "." : "", normalized_type, normalized_domain);
-
- return AVAHI_OK;
-}
-
-#ifndef HAVE_STRLCPY
-
-static size_t strlcpy(char *dest, const char *src, size_t n) {
- assert(dest);
- assert(src);
-
- if (n > 0) {
- strncpy(dest, src, n-1);
- dest[n-1] = 0;
- }
-
- return strlen(src);
-}
-
-#endif
-
-int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size) {
- enum {
- NAME,
- TYPE,
- DOMAIN
- } state;
- int type_empty = 1, domain_empty = 1;
-
- assert(p);
- assert(type);
- assert(type_size > 0);
- assert(domain);
- assert(domain_size > 0);
-
- if (name) {
- assert(name_size > 0);
- *name = 0;
- state = NAME;
- } else
- state = TYPE;
-
- *type = *domain = 0;
-
- while (*p) {
- char buf[64];
-
- if (!(avahi_unescape_label(&p, buf, sizeof(buf))))
- return -1;
-
- switch (state) {
- case NAME:
- strlcpy(name, buf, name_size);
- state = TYPE;
- break;
-
- case TYPE:
-
- if (buf[0] == '_') {
-
- if (!type_empty) {
- if (!type_size)
- return AVAHI_ERR_NO_MEMORY;
-
- *(type++) = '.';
- type_size --;
-
- } else
- type_empty = 0;
-
- if (!(avahi_escape_label(buf, strlen(buf), &type, &type_size)))
- return AVAHI_ERR_NO_MEMORY;
-
- break;
- }
-
- state = DOMAIN;
- /* fall through */
-
- case DOMAIN:
-
- if (!domain_empty) {
- if (!domain_size)
- return AVAHI_ERR_NO_MEMORY;
-
- *(domain++) = '.';
- domain_size --;
- } else
- domain_empty = 0;
-
- if (!(avahi_escape_label(buf, strlen(buf), &domain, &domain_size)))
- return AVAHI_ERR_NO_MEMORY;
-
- break;
- }
- }
-
- return 0;
-}
-
-int avahi_is_valid_fqdn(const char *t) {
- char label[AVAHI_LABEL_MAX];
- char normalized[AVAHI_DOMAIN_NAME_MAX];
- const char *k = t;
- AvahiAddress a;
- assert(t);
-
- if (strlen(t) >= AVAHI_DOMAIN_NAME_MAX)
- return 0;
-
- if (!avahi_is_valid_domain_name(t))
- return 0;
-
- /* Check if there are at least two labels*/
- if (!(avahi_unescape_label(&k, label, sizeof(label))))
- return 0;
-
- if (label[0] == 0 || !k)
- return 0;
-
- if (!(avahi_unescape_label(&k, label, sizeof(label))))
- return 0;
-
- if (label[0] == 0 || !k)
- return 0;
-
- /* Make sure that the name is not an IP address */
- if (!(avahi_normalize_name(t, normalized, sizeof(normalized))))
- return 0;
-
- if (avahi_address_parse(normalized, AVAHI_PROTO_UNSPEC, &a))
- return 0;
-
- return 1;
-}
diff --git a/trunk/avahi-common/domain.h b/trunk/avahi-common/domain.h
deleted file mode 100644
index 7073e1c..0000000
--- a/trunk/avahi-common/domain.h
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef foodomainhfoo
-#define foodomainhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file domain.h Domain name handling functions */
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** The maximum length of a a fully escaped domain name C string. This
- * is calculated like this: RFC1034 mandates maximum length of FQDNs
- * is 255. The maximum label length is 63. To minimize the number of
- * (non-escaped) dots, we comprise our maximum-length domain name of
- * four labels á 63 characters plus three inner dots. Escaping the
- * four labels quadruples their length at maximum. An escaped domain
- * name has the therefore the maximum length of 63*4*4+3=1011. A
- * trailing NUL and perhaps two unnecessary dots leading and trailing
- * the string brings us to 1014. */
-#define AVAHI_DOMAIN_NAME_MAX 1014
-
-/** Maximum size of an unescaped label */
-#define AVAHI_LABEL_MAX 64
-
-/** Normalize a domain name into canonical form. This drops trailing
- * dots and removes useless backslash escapes. */
-char *avahi_normalize_name(const char *s, char *ret_s, size_t size);
-
-/** Normalize a domain name into canonical form. This drops trailing
- * dots and removes useless backslash escapes. avahi_free() the
- * result! */
-char *avahi_normalize_name_strdup(const char *s);
-
-/** Return 1 when the specified domain names are equal, 0 otherwise */
-int avahi_domain_equal(const char *a, const char *b);
-
-/** Read the first label from the textual domain name *name, unescape
- * it and write it to dest, *name is changed to point to the next label*/
-char *avahi_unescape_label(const char **name, char *dest, size_t size);
-
-/** Escape the domain name in *src and write it to *ret_name */
-char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, size_t *ret_size);
-
-/** Return a pointer to the type section of a subtype i.e. _foo._sub._bar._tcp => _bar._tcp */
-const char *avahi_get_type_from_subtype(const char *t);
-
-/** Return 1 when the specified string contains a valid generic
- * service type (i.e. a series of words starting with "_"), 0
- * otherwise */
-int avahi_is_valid_service_type_generic(const char *t);
-
-/** Return 1 when the specified string contains a valid strict service
- * type (i.e. consisting of only two words, the latter being either
- * _udp or _tcp), 0 otherwise */
-int avahi_is_valid_service_type_strict(const char *t);
-
-/** Return 1 when the specified string contains a valid service subtype, 0 otherwise */
-int avahi_is_valid_service_subtype(const char *t);
-
-/** Return 1 when the specified string contains a valid domain name, 0 otherwise */
-int avahi_is_valid_domain_name(const char *t);
-
-/** Return 1 when the specified string contains a valid service name, 0 otherwise */
-int avahi_is_valid_service_name(const char *t);
-
-/** Return 1 when the specified string contains a valid non-FQDN host name (i.e. without dots), 0 otherwise */
-int avahi_is_valid_host_name(const char *t);
-
-/** Return 1 when the specified string contains a valid FQDN host name (i.e. with more than one label and non-numerical), 0 otherwise. \since 0.6.9 */
-int avahi_is_valid_fqdn(const char *t);
-
-/** Return some kind of hash value for the domain, useful for using domains as hash table keys. */
-unsigned avahi_domain_hash(const char *name);
-
-/** Construct a valid complete service name from a name, a type and a domain */
-int avahi_service_name_join(char *p, size_t size, const char *name, const char *type, const char *domain);
-
-/** Split a full service name into name, type and domain */
-int avahi_service_name_split(const char *p, char *name, size_t name_size, char *type, size_t type_size, char *domain, size_t domain_size);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/error.c b/trunk/avahi-common/error.c
deleted file mode 100644
index 92a2234..0000000
--- a/trunk/avahi-common/error.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
- ***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "error.h"
-
-const char *avahi_strerror(int error) {
-
- const char * const msg[- AVAHI_ERR_MAX] = {
- "OK",
- "Operation failed",
- "Bad state",
- "Invalid host name",
- "Invalid domain name",
- "No suitable network protocol available",
- "Invalid DNS TTL",
- "Resource record key is pattern",
- "Local name collision",
- "Invalid record",
-
- "Invalid service name",
- "Invalid service type",
- "Invalid port number",
- "Invalid record key",
- "Invalid address",
- "Timeout reached",
- "Too many clients",
- "Too many objects",
- "Too many entries",
- "OS Error",
-
- "Access denied",
- "Invalid operation",
- "An unexpected D-Bus error occured",
- "Daemon connection failed",
- "Memory exhausted",
- "The object passed in was not valid",
- "Daemon not running",
- "Invalid interface index",
- "Invalid protocol specification",
- "Invalid flags",
-
- "Not found",
- "Invalid configuration",
- "Version mismatch",
- "Invalid service subtype",
- "Invalid packet",
- "Invalid DNS return code",
- "DNS failure: FORMERR",
- "DNS failure: SERVFAIL",
- "DNS failure: NXDOMAIN",
- "DNS failure: NOTIMP",
-
- "DNS failure: REFUSED",
- "DNS failure: YXDOMAIN",
- "DNS failure: YXRRSET",
- "DNS failure: NXRRSET",
- "DNS failure: NOTAUTH",
- "DNS failure: NOTZONE",
- "Invalid RDATA",
- "Invalid DNS type",
- "Invalid DNS class",
- "Not supported",
-
- "Not permitted",
- "Invalid argument",
- "Is empty",
- "The requested operation is invalid because redundant"
- };
-
- if (-error < 0 || -error >= -AVAHI_ERR_MAX)
- return "Invalid Error Code";
-
- return msg[-error];
-}
diff --git a/trunk/avahi-common/error.h b/trunk/avahi-common/error.h
deleted file mode 100644
index 3e014c2..0000000
--- a/trunk/avahi-common/error.h
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifndef fooerrorhfoo
-#define fooerrorhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file error.h Error codes and auxiliary functions */
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Error codes used by avahi */
-enum {
- AVAHI_OK = 0, /**< OK */
- AVAHI_ERR_FAILURE = -1, /**< Generic error code */
- AVAHI_ERR_BAD_STATE = -2, /**< Object was in a bad state */
- AVAHI_ERR_INVALID_HOST_NAME = -3, /**< Invalid host name */
- AVAHI_ERR_INVALID_DOMAIN_NAME = -4, /**< Invalid domain name */
- AVAHI_ERR_NO_NETWORK = -5, /**< No suitable network protocol available */
- AVAHI_ERR_INVALID_TTL = -6, /**< Invalid DNS TTL */
- AVAHI_ERR_IS_PATTERN = -7, /**< RR key is pattern */
- AVAHI_ERR_COLLISION = -8, /**< Name collision */
- AVAHI_ERR_INVALID_RECORD = -9, /**< Invalid RR */
-
- AVAHI_ERR_INVALID_SERVICE_NAME = -10, /**< Invalid service name */
- AVAHI_ERR_INVALID_SERVICE_TYPE = -11, /**< Invalid service type */
- AVAHI_ERR_INVALID_PORT = -12, /**< Invalid port number */
- AVAHI_ERR_INVALID_KEY = -13, /**< Invalid key */
- AVAHI_ERR_INVALID_ADDRESS = -14, /**< Invalid address */
- AVAHI_ERR_TIMEOUT = -15, /**< Timeout reached */
- AVAHI_ERR_TOO_MANY_CLIENTS = -16, /**< Too many clients */
- AVAHI_ERR_TOO_MANY_OBJECTS = -17, /**< Too many objects */
- AVAHI_ERR_TOO_MANY_ENTRIES = -18, /**< Too many entries */
- AVAHI_ERR_OS = -19, /**< OS error */
-
- AVAHI_ERR_ACCESS_DENIED = -20, /**< Access denied */
- AVAHI_ERR_INVALID_OPERATION = -21, /**< Invalid operation */
- AVAHI_ERR_DBUS_ERROR = -22, /**< An unexpected D-Bus error occured */
- AVAHI_ERR_DISCONNECTED = -23, /**< Daemon connection failed */
- AVAHI_ERR_NO_MEMORY = -24, /**< Memory exhausted */
- AVAHI_ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */
- AVAHI_ERR_NO_DAEMON = -26, /**< Daemon not running */
- AVAHI_ERR_INVALID_INTERFACE = -27, /**< Invalid interface */
- AVAHI_ERR_INVALID_PROTOCOL = -28, /**< Invalid protocol */
- AVAHI_ERR_INVALID_FLAGS = -29, /**< Invalid flags */
-
- AVAHI_ERR_NOT_FOUND = -30, /**< Not found */
- AVAHI_ERR_INVALID_CONFIG = -31, /**< Configuration error */
- AVAHI_ERR_VERSION_MISMATCH = -32, /**< Verson mismatch */
- AVAHI_ERR_INVALID_SERVICE_SUBTYPE = -33, /**< Invalid service subtype */
- AVAHI_ERR_INVALID_PACKET = -34, /**< Invalid packet */
- AVAHI_ERR_INVALID_DNS_ERROR = -35, /**< Invlaid DNS return code */
- AVAHI_ERR_DNS_FORMERR = -36, /**< DNS Error: Form error */
- AVAHI_ERR_DNS_SERVFAIL = -37, /**< DNS Error: Server Failure */
- AVAHI_ERR_DNS_NXDOMAIN = -38, /**< DNS Error: No such domain */
- AVAHI_ERR_DNS_NOTIMP = -39, /**< DNS Error: Not implemented */
-
- AVAHI_ERR_DNS_REFUSED = -40, /**< DNS Error: Operation refused */
- AVAHI_ERR_DNS_YXDOMAIN = -41,
- AVAHI_ERR_DNS_YXRRSET = -42,
- AVAHI_ERR_DNS_NXRRSET = -43,
- AVAHI_ERR_DNS_NOTAUTH = -44, /**< DNS Error: Not authorized */
- AVAHI_ERR_DNS_NOTZONE = -45,
- AVAHI_ERR_INVALID_RDATA = -46, /**< Invalid RDATA */
- AVAHI_ERR_INVALID_DNS_CLASS = -47, /**< Invalid DNS class */
- AVAHI_ERR_INVALID_DNS_TYPE = -48, /**< Invalid DNS type */
- AVAHI_ERR_NOT_SUPPORTED = -49, /**< Not supported */
-
- AVAHI_ERR_NOT_PERMITTED = -50, /**< Operation not permitted */
- AVAHI_ERR_INVALID_ARGUMENT = -51, /**< Invalid argument */
- AVAHI_ERR_IS_EMPTY = -52, /**< Is empty */
- AVAHI_ERR_NO_CHANGE = -53, /**< The requested operation is invalid because redundant */
-
- /****
- **** IF YOU ADD A NEW ERROR CODE HERE, PLEASE DON'T FORGET TO ADD
- **** IT TO THE STRING ARRAY IN avahi_strerror() IN error.c AND
- **** TO THE ARRAY IN dbus.c AND FINALLY TO dbus.h!
- ****
- **** Also remember to update the MAX value below.
- ****/
-
- AVAHI_ERR_MAX = -54
-};
-
-/** Return a human readable error string for the specified error code */
-const char *avahi_strerror(int error);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/gccmacro.h b/trunk/avahi-common/gccmacro.h
deleted file mode 100644
index 78a09a7..0000000
--- a/trunk/avahi-common/gccmacro.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef foogccmacrohfoo
-#define foogccmacrohfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file gccmacro.h Defines some macros for GCC extensions */
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-#if defined(__GNUC__) && (__GNUC__ >= 4)
-#define AVAHI_GCC_SENTINEL __attribute__ ((sentinel))
-#else
-/** Macro for usage of GCC's sentinel compilation warnings */
-#define AVAHI_GCC_SENTINEL
-#endif
-
-#ifdef __GNUC__
-#define AVAHI_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
-#else
-/** Macro for usage of GCC's printf compilation warnings */
-#define AVAHI_GCC_PRINTF_ATTR(a,b)
-#endif
-
-/** Same as AVAHI_GCC_PRINTF_ATTR but hard coded to arguments 1 and 2 */
-#define AVAHI_GCC_PRINTF_ATTR12 AVAHI_GCC_PRINTF_ATTR(1,2)
-
-/** Same as AVAHI_GCC_PRINTF_ATTR but hard coded to arguments 2 and 3 */
-#define AVAHI_GCC_PRINTF_ATTR23 AVAHI_GCC_PRINTF_ATTR(2,3)
-
-#ifdef __GNUC__
-#define AVAHI_GCC_NORETURN __attribute__((noreturn))
-#else
-/** Macro for no-return functions */
-#define AVAHI_GCC_NORETURN
-#endif
-
-#ifdef __GNUC__
-#define AVAHI_GCC_UNUSED __attribute__ ((unused))
-#else
-/** Macro for not used parameter */
-#define AVAHI_GCC_UNUSED
-#endif
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/llist.h b/trunk/avahi-common/llist.h
deleted file mode 100644
index 37474e1..0000000
--- a/trunk/avahi-common/llist.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef foollistfoo
-#define foollistfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file llist.h A simple macro based linked list implementation */
-
-#include <assert.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** The head of the linked list. Use this in the structure that shall
- * contain the head of the linked list */
-#define AVAHI_LLIST_HEAD(t,name) t *name
-
-/** The pointers in the linked list's items. Use this in the item structure */
-#define AVAHI_LLIST_FIELDS(t,name) t *name##_next, *name##_prev
-
-/** Initialize the list's head */
-#define AVAHI_LLIST_HEAD_INIT(t,head) do { (head) = NULL; } while(0)
-
-/** Initialize a list item */
-#define AVAHI_LLIST_INIT(t,name,item) do { \
- t *_item = (item); \
- assert(_item); \
- _item->name##_prev = _item->name##_next = NULL; \
- } while(0)
-
-/** Prepend an item to the list */
-#define AVAHI_LLIST_PREPEND(t,name,head,item) do { \
- t **_head = &(head), *_item = (item); \
- assert(_item); \
- if ((_item->name##_next = *_head)) \
- _item->name##_next->name##_prev = _item; \
- _item->name##_prev = NULL; \
- *_head = _item; \
- } while (0)
-
-/** Remove an item from the list */
-#define AVAHI_LLIST_REMOVE(t,name,head,item) do { \
- t **_head = &(head), *_item = (item); \
- assert(_item); \
- if (_item->name##_next) \
- _item->name##_next->name##_prev = _item->name##_prev; \
- if (_item->name##_prev) \
- _item->name##_prev->name##_next = _item->name##_next; \
- else {\
- assert(*_head == _item); \
- *_head = _item->name##_next; \
- } \
- _item->name##_next = _item->name##_prev = NULL; \
- } while(0)
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/malloc.c b/trunk/avahi-common/malloc.c
deleted file mode 100644
index 51b8ff6..0000000
--- a/trunk/avahi-common/malloc.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "malloc.h"
-
-#ifndef va_copy
-#ifdef __va_copy
-#define va_copy(DEST,SRC) __va_copy((DEST),(SRC))
-#else
-#define va_copy(DEST,SRC) memcpy(&(DEST), &(SRC), sizeof(va_list))
-#endif
-#endif
-
-static const AvahiAllocator *allocator = NULL;
-
-static void oom(void) AVAHI_GCC_NORETURN;
-
-static void oom(void) {
-
- static const char msg[] = "Out of memory, aborting ...\n";
- const char *n = msg;
-
- while (strlen(n) > 0) {
- ssize_t r;
-
- if ((r = write(2, n, strlen(n))) < 0)
- break;
-
- n += r;
- }
-
- abort();
-}
-
-/* Default implementation for avahi_malloc() */
-static void* xmalloc(size_t size) {
- void *p;
-
- if (size == 0)
- return NULL;
-
- if (!(p = malloc(size)))
- oom();
-
- return p;
-}
-
-/* Default implementation for avahi_realloc() */
-static void *xrealloc(void *p, size_t size) {
-
- if (size == 0) {
- free(p);
- return NULL;
- }
-
- if (!(p = realloc(p, size)))
- oom();
-
- return p;
-}
-
-/* Default implementation for avahi_calloc() */
-static void *xcalloc(size_t nmemb, size_t size) {
- void *p;
-
- if (size == 0 || nmemb == 0)
- return NULL;
-
- if (!(p = calloc(nmemb, size)))
- oom();
-
- return p;
-}
-
-void *avahi_malloc(size_t size) {
-
- if (size <= 0)
- return NULL;
-
- if (!allocator)
- return xmalloc(size);
-
- assert(allocator->malloc);
- return allocator->malloc(size);
-}
-
-void *avahi_malloc0(size_t size) {
- void *p;
-
- if (size <= 0)
- return NULL;
-
- if (!allocator)
- return xcalloc(1, size);
-
- if (allocator->calloc)
- return allocator->calloc(1, size);
-
- assert(allocator->malloc);
- if ((p = allocator->malloc(size)))
- memset(p, 0, size);
-
- return p;
-}
-
-void avahi_free(void *p) {
-
- if (!p)
- return;
-
- if (!allocator) {
- free(p);
- return;
- }
-
- assert(allocator->free);
- allocator->free(p);
-}
-
-void *avahi_realloc(void *p, size_t size) {
-
- if (size == 0) {
- avahi_free(p);
- return NULL;
- }
-
- if (!allocator)
- return xrealloc(p, size);
-
- assert(allocator->realloc);
- return allocator->realloc(p, size);
-}
-
-char *avahi_strdup(const char *s) {
- char *r;
- size_t size;
-
- if (!s)
- return NULL;
-
- size = strlen(s);
- if (!(r = avahi_malloc(size+1)))
- return NULL;
-
- memcpy(r, s, size+1);
- return r;
-}
-
-char *avahi_strndup(const char *s, size_t max) {
- char *r;
- size_t size;
- const char *p;
-
- if (!s)
- return NULL;
-
- for (p = s, size = 0;
- size < max && *p;
- p++, size++);
-
- if (!(r = avahi_new(char, size+1)))
- return NULL;
-
- memcpy(r, s, size);
- r[size] = 0;
- return r;
-}
-
-/* Change the allocator */
-void avahi_set_allocator(const AvahiAllocator *a) {
- allocator = a;
-}
-
-char *avahi_strdup_vprintf(const char *fmt, va_list ap) {
- size_t len = 80;
- char *buf;
-
- assert(fmt);
-
- if (!(buf = avahi_malloc(len)))
- return NULL;
-
- for (;;) {
- int n;
- char *nbuf;
- va_list ap2;
-
- va_copy (ap2, ap);
- n = vsnprintf(buf, len, fmt, ap2);
- va_end (ap2);
-
- if (n >= 0 && n < (int) len)
- return buf;
-
- if (n >= 0)
- len = n+1;
- else
- len *= 2;
-
- if (!(nbuf = avahi_realloc(buf, len))) {
- avahi_free(buf);
- return NULL;
- }
-
- buf = nbuf;
- }
-}
-
-char *avahi_strdup_printf(const char *fmt, ... ) {
- char *s;
- va_list ap;
-
- assert(fmt);
-
- va_start(ap, fmt);
- s = avahi_strdup_vprintf(fmt, ap);
- va_end(ap);
-
- return s;
-}
-
-void *avahi_memdup(const void *s, size_t l) {
- void *p;
- assert(s);
-
- if (!(p = avahi_malloc(l)))
- return NULL;
-
- memcpy(p, s, l);
- return p;
-}
diff --git a/trunk/avahi-common/malloc.h b/trunk/avahi-common/malloc.h
deleted file mode 100644
index 40b6272..0000000
--- a/trunk/avahi-common/malloc.h
+++ /dev/null
@@ -1,96 +0,0 @@
-#ifndef foomallochfoo
-#define foomallochfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file malloc.h Memory allocation */
-
-#include <sys/types.h>
-#include <stdarg.h>
-#include <limits.h>
-#include <assert.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/gccmacro.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Allocate some memory, just like the libc malloc() */
-void *avahi_malloc(size_t size);
-
-/** Similar to avahi_malloc() but set the memory to zero */
-void *avahi_malloc0(size_t size);
-
-/** Free some memory */
-void avahi_free(void *p);
-
-/** Similar to libc's realloc() */
-void *avahi_realloc(void *p, size_t size);
-
-/** Internal helper for avahi_new() */
-static inline void* avahi_new_internal(unsigned n, size_t k) {
- assert(n < INT_MAX/k);
- return avahi_malloc(n*k);
-}
-
-/** Allocate n new structures of the specified type. */
-#define avahi_new(type, n) ((type*) avahi_new_internal((n), sizeof(type)))
-
-/** Internal helper for avahi_new0() */
-static inline void* avahi_new0_internal(unsigned n, size_t k) {
- assert(n < INT_MAX/k);
- return avahi_malloc0(n*k);
-}
-
-/** Same as avahi_new() but set the memory to zero */
-#define avahi_new0(type, n) ((type*) avahi_new0_internal((n), sizeof(type)))
-
-/** Just like libc's strdup() */
-char *avahi_strdup(const char *s);
-
-/** Just like libc's strndup() */
-char *avahi_strndup(const char *s, size_t l);
-
-/** Duplicate the given memory block into a new one allocated with avahi_malloc() */
-void *avahi_memdup(const void *s, size_t l);
-
-/** Wraps allocator functions */
-typedef struct AvahiAllocator {
- void* (*malloc)(size_t size);
- void (*free)(void *p);
- void* (*realloc)(void *p, size_t size);
- void* (*calloc)(size_t nmemb, size_t size); /**< May be NULL */
-} AvahiAllocator;
-
-/** Change the allocator. May be NULL to return to default (libc)
- * allocators. The structure is not copied! */
-void avahi_set_allocator(const AvahiAllocator *a);
-
-/** Like sprintf() but store the result in a freshly allocated buffer. Free this with avahi_free() */
-char *avahi_strdup_printf(const char *fmt, ... ) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Same as avahi_strdup_printf() but take a va_list instead of varargs */
-char *avahi_strdup_vprintf(const char *fmt, va_list ap);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/rlist.c b/trunk/avahi-common/rlist.c
deleted file mode 100644
index f24ab03..0000000
--- a/trunk/avahi-common/rlist.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "rlist.h"
-#include "malloc.h"
-
-AvahiRList* avahi_rlist_prepend(AvahiRList *r, void *data) {
- AvahiRList *n;
-
- if (!(n = avahi_new(AvahiRList, 1)))
- return NULL;
-
- n->data = data;
-
- AVAHI_LLIST_PREPEND(AvahiRList, rlist, r, n);
- return r;
-}
-
-AvahiRList* avahi_rlist_remove(AvahiRList *r, void *data) {
- AvahiRList *n;
-
- for (n = r; n; n = n->rlist_next)
-
- if (n->data == data) {
- AVAHI_LLIST_REMOVE(AvahiRList, rlist, r, n);
- avahi_free(n);
- break;
- }
-
- return r;
-}
-
-AvahiRList* avahi_rlist_remove_by_link(AvahiRList *r, AvahiRList *n) {
- assert(n);
-
- AVAHI_LLIST_REMOVE(AvahiRList, rlist, r, n);
- avahi_free(n);
-
- return r;
-}
diff --git a/trunk/avahi-common/rlist.h b/trunk/avahi-common/rlist.h
deleted file mode 100644
index 0b88955..0000000
--- a/trunk/avahi-common/rlist.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef foorlistfoo
-#define foorlistfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file rlist.h A simple linked list implementation */
-
-#include "llist.h"
-
-AVAHI_C_DECL_BEGIN
-
-/** A doubly linked list type */
-typedef struct AvahiRList AvahiRList;
-
-/** A doubly linked list type */
-struct AvahiRList {
- AVAHI_LLIST_FIELDS(AvahiRList, rlist);
- void *data;
-};
-
-/** Prepend a new item to the beginning of the list and return the new beginning */
-AvahiRList* avahi_rlist_prepend(AvahiRList *r, void *data);
-
-/** Remove the first occurence of the specified item from the list and return the new beginning */
-AvahiRList* avahi_rlist_remove(AvahiRList *r, void *data);
-
-/** Remove the specified item from the list and return the new beginning */
-AvahiRList* avahi_rlist_remove_by_link(AvahiRList *r, AvahiRList *n);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/simple-watch.c b/trunk/avahi-common/simple-watch.c
deleted file mode 100644
index 65d9d18..0000000
--- a/trunk/avahi-common/simple-watch.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/poll.h>
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#include "llist.h"
-#include "malloc.h"
-#include "timeval.h"
-#include "simple-watch.h"
-
-struct AvahiWatch {
- AvahiSimplePoll *simple_poll;
- int dead;
-
- int idx;
- struct pollfd pollfd;
-
- AvahiWatchCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiWatch, watches);
-};
-
-struct AvahiTimeout {
- AvahiSimplePoll *simple_poll;
- int dead;
-
- int enabled;
- struct timeval expiry;
-
- AvahiTimeoutCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiTimeout, timeouts);
-};
-
-struct AvahiSimplePoll {
- AvahiPoll api;
- AvahiPollFunc poll_func;
- void *poll_func_userdata;
-
- struct pollfd* pollfds;
- int n_pollfds, max_pollfds, rebuild_pollfds;
-
- int watch_req_cleanup, timeout_req_cleanup;
- int quit;
- int events_valid;
-
- int n_watches;
- AVAHI_LLIST_HEAD(AvahiWatch, watches);
- AVAHI_LLIST_HEAD(AvahiTimeout, timeouts);
-
- int wakeup_pipe[2];
- int wakeup_issued;
-
- int prepared_timeout;
-
- enum {
- STATE_INIT,
- STATE_PREPARING,
- STATE_PREPARED,
- STATE_RUNNING,
- STATE_RAN,
- STATE_DISPATCHING,
- STATE_DISPATCHED,
- STATE_QUIT,
- STATE_FAILURE
- } state;
-};
-
-void avahi_simple_poll_wakeup(AvahiSimplePoll *s) {
- char c = 'W';
- assert(s);
-
- write(s->wakeup_pipe[1], &c, sizeof(c));
- s->wakeup_issued = 1;
-}
-
-static void clear_wakeup(AvahiSimplePoll *s) {
- char c[10]; /* Read ten at a time */
-
- if (!s->wakeup_issued)
- return;
-
- s->wakeup_issued = 0;
-
- for(;;)
- if (read(s->wakeup_pipe[0], &c, sizeof(c)) != sizeof(c))
- break;
-}
-
-static int set_nonblock(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFL)) < 0)
- return -1;
-
- if (n & O_NONBLOCK)
- return 0;
-
- return fcntl(fd, F_SETFL, n|O_NONBLOCK);
-}
-
-static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata) {
- AvahiWatch *w;
- AvahiSimplePoll *s;
-
- assert(api);
- assert(fd >= 0);
- assert(callback);
-
- s = api->userdata;
- assert(s);
-
- if (!(w = avahi_new(AvahiWatch, 1)))
- return NULL;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-
- w->simple_poll = s;
- w->dead = 0;
-
- w->pollfd.fd = fd;
- w->pollfd.events = event;
- w->pollfd.revents = 0;
-
- w->callback = callback;
- w->userdata = userdata;
-
- w->idx = -1;
- s->rebuild_pollfds = 1;
-
- AVAHI_LLIST_PREPEND(AvahiWatch, watches, s->watches, w);
- s->n_watches++;
-
- return w;
-}
-
-static void watch_update(AvahiWatch *w, AvahiWatchEvent events) {
- assert(w);
- assert(!w->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(w->simple_poll);
-
- w->pollfd.events = events;
-
- if (w->idx != -1) {
- assert(w->simple_poll);
- w->simple_poll->pollfds[w->idx] = w->pollfd;
- } else
- w->simple_poll->rebuild_pollfds = 1;
-}
-
-static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
- assert(w);
- assert(!w->dead);
-
- if (w->idx != -1 && w->simple_poll->events_valid)
- return w->simple_poll->pollfds[w->idx].revents;
-
- return 0;
-}
-
-static void remove_pollfd(AvahiWatch *w) {
- assert(w);
-
- if (w->idx == -1)
- return;
-
- w->simple_poll->rebuild_pollfds = 1;
-}
-
-static void watch_free(AvahiWatch *w) {
- assert(w);
-
- assert(!w->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(w->simple_poll);
-
- remove_pollfd(w);
-
- w->dead = 1;
- w->simple_poll->n_watches --;
- w->simple_poll->watch_req_cleanup = 1;
-}
-
-static void destroy_watch(AvahiWatch *w) {
- assert(w);
-
- remove_pollfd(w);
- AVAHI_LLIST_REMOVE(AvahiWatch, watches, w->simple_poll->watches, w);
-
- if (!w->dead)
- w->simple_poll->n_watches --;
-
- avahi_free(w);
-}
-
-static void cleanup_watches(AvahiSimplePoll *s, int all) {
- AvahiWatch *w, *next;
- assert(s);
-
- for (w = s->watches; w; w = next) {
- next = w->watches_next;
-
- if (all || w->dead)
- destroy_watch(w);
- }
-
- s->timeout_req_cleanup = 0;
-}
-
-static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
- AvahiTimeout *t;
- AvahiSimplePoll *s;
-
- assert(api);
- assert(callback);
-
- s = api->userdata;
- assert(s);
-
- if (!(t = avahi_new(AvahiTimeout, 1)))
- return NULL;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-
- t->simple_poll = s;
- t->dead = 0;
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-
- t->callback = callback;
- t->userdata = userdata;
-
- AVAHI_LLIST_PREPEND(AvahiTimeout, timeouts, s->timeouts, t);
- return t;
-}
-
-static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
- assert(t);
- assert(!t->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(t->simple_poll);
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-}
-
-static void timeout_free(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(t->simple_poll);
-
- t->dead = 1;
- t->simple_poll->timeout_req_cleanup = 1;
-}
-
-
-static void destroy_timeout(AvahiTimeout *t) {
- assert(t);
-
- AVAHI_LLIST_REMOVE(AvahiTimeout, timeouts, t->simple_poll->timeouts, t);
-
- avahi_free(t);
-}
-
-static void cleanup_timeouts(AvahiSimplePoll *s, int all) {
- AvahiTimeout *t, *next;
- assert(s);
-
- for (t = s->timeouts; t; t = next) {
- next = t->timeouts_next;
-
- if (all || t->dead)
- destroy_timeout(t);
- }
-
- s->timeout_req_cleanup = 0;
-}
-
-AvahiSimplePoll *avahi_simple_poll_new(void) {
- AvahiSimplePoll *s;
-
- if (!(s = avahi_new(AvahiSimplePoll, 1)))
- return NULL;
-
- if (pipe(s->wakeup_pipe) < 0) {
- avahi_free(s);
- return NULL;
- }
-
- set_nonblock(s->wakeup_pipe[0]);
- set_nonblock(s->wakeup_pipe[1]);
-
- s->api.userdata = s;
-
- s->api.watch_new = watch_new;
- s->api.watch_free = watch_free;
- s->api.watch_update = watch_update;
- s->api.watch_get_events = watch_get_events;
-
- s->api.timeout_new = timeout_new;
- s->api.timeout_free = timeout_free;
- s->api.timeout_update = timeout_update;
-
- s->pollfds = NULL;
- s->max_pollfds = s->n_pollfds = 0;
- s->rebuild_pollfds = 1;
- s->quit = 0;
- s->n_watches = 0;
- s->events_valid = 0;
-
- s->watch_req_cleanup = 0;
- s->timeout_req_cleanup = 0;
-
- s->prepared_timeout = 0;
-
- s->state = STATE_INIT;
-
- s->wakeup_issued = 0;
-
- avahi_simple_poll_set_func(s, NULL, NULL);
-
- AVAHI_LLIST_HEAD_INIT(AvahiWatch, s->watches);
- AVAHI_LLIST_HEAD_INIT(AvahiTimeout, s->timeouts);
-
- return s;
-}
-
-void avahi_simple_poll_free(AvahiSimplePoll *s) {
- assert(s);
-
- cleanup_timeouts(s, 1);
- cleanup_watches(s, 1);
- assert(s->n_watches == 0);
-
- avahi_free(s->pollfds);
-
- if (s->wakeup_pipe[0] >= 0)
- close(s->wakeup_pipe[0]);
-
- if (s->wakeup_pipe[1] >= 0)
- close(s->wakeup_pipe[1]);
-
- avahi_free(s);
-}
-
-static int rebuild(AvahiSimplePoll *s) {
- AvahiWatch *w;
- int idx;
-
- assert(s);
-
- if (s->n_watches+1 > s->max_pollfds) {
- struct pollfd *n;
-
- s->max_pollfds = s->n_watches + 10;
-
- if (!(n = avahi_realloc(s->pollfds, sizeof(struct pollfd) * s->max_pollfds)))
- return -1;
-
- s->pollfds = n;
- }
-
-
- s->pollfds[0].fd = s->wakeup_pipe[0];
- s->pollfds[0].events = POLLIN;
- s->pollfds[0].revents = 0;
-
- idx = 1;
-
- for (w = s->watches; w; w = w->watches_next) {
-
- if(w->dead)
- continue;
-
- assert(w->idx < s->max_pollfds);
- s->pollfds[w->idx = idx++] = w->pollfd;
- }
-
- s->n_pollfds = idx;
- s->events_valid = 0;
- s->rebuild_pollfds = 0;
-
- return 0;
-}
-
-static AvahiTimeout* find_next_timeout(AvahiSimplePoll *s) {
- AvahiTimeout *t, *n = NULL;
- assert(s);
-
- for (t = s->timeouts; t; t = t->timeouts_next) {
-
- if (t->dead || !t->enabled)
- continue;
-
- if (!n || avahi_timeval_compare(&t->expiry, &n->expiry) < 0)
- n = t;
- }
-
- return n;
-}
-
-static void timeout_callback(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
- assert(t->enabled);
-
- t->enabled = 0;
- t->callback(t, t->userdata);
-}
-
-int avahi_simple_poll_prepare(AvahiSimplePoll *s, int timeout) {
- AvahiTimeout *next_timeout;
-
- assert(s);
- assert(s->state == STATE_INIT || s->state == STATE_DISPATCHED || s->state == STATE_FAILURE);
- s->state = STATE_PREPARING;
-
- /* Clear pending wakeup requests */
- clear_wakeup(s);
-
- /* Cleanup things first */
- if (s->watch_req_cleanup)
- cleanup_watches(s, 0);
-
- if (s->timeout_req_cleanup)
- cleanup_timeouts(s, 0);
-
- /* Check whether a quit was requested */
- if (s->quit) {
- s->state = STATE_QUIT;
- return 1;
- }
-
- /* Do we need to rebuild our array of pollfds? */
- if (s->rebuild_pollfds)
- if (rebuild(s) < 0) {
- s->state = STATE_FAILURE;
- return -1;
- }
-
- /* Calculate the wakeup time */
- if ((next_timeout = find_next_timeout(s))) {
- struct timeval now;
- int t;
- AvahiUsec usec;
-
- if (next_timeout->expiry.tv_sec == 0 &&
- next_timeout->expiry.tv_usec == 0) {
-
- /* Just a shortcut so that we don't need to call gettimeofday() */
- timeout = 0;
- goto finish;
- }
-
- gettimeofday(&now, NULL);
- usec = avahi_timeval_diff(&next_timeout->expiry, &now);
-
- if (usec <= 0) {
- /* Timeout elapsed */
-
- timeout = 0;
- goto finish;
- }
-
- /* Calculate sleep time. We add 1ms because otherwise we'd
- * wake up too early most of the time */
- t = (int) (usec / 1000) + 1;
-
- if (timeout < 0 || timeout > t)
- timeout = t;
- }
-
-finish:
- s->prepared_timeout = timeout;
- s->state = STATE_PREPARED;
- return 0;
-}
-
-int avahi_simple_poll_run(AvahiSimplePoll *s) {
- assert(s);
- assert(s->state == STATE_PREPARED || s->state == STATE_FAILURE);
-
- s->state = STATE_RUNNING;
-
- if (s->prepared_timeout != 0) {
-
- if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) {
- s->state = STATE_FAILURE;
- return -1;
- }
-
- /* The poll events are now valid again */
- s->events_valid = 1;
- } else
- s->events_valid = 0;
-
- /* Update state */
- s->state = STATE_RAN;
- return 0;
-}
-
-int avahi_simple_poll_dispatch(AvahiSimplePoll *s) {
- AvahiTimeout *next_timeout;
- AvahiWatch *w;
-
- assert(s);
- assert(s->state == STATE_RAN);
- s->state = STATE_DISPATCHING;
-
- /* We execute only on callback in every iteration */
-
- /* Check whether the wakeup time has been reached now */
- if ((next_timeout = find_next_timeout(s))) {
-
- if (next_timeout->expiry.tv_sec == 0 && next_timeout->expiry.tv_usec == 0) {
-
- /* Just a shortcut so that we don't need to call gettimeofday() */
- timeout_callback(next_timeout);
- goto finish;
- }
-
- if (avahi_age(&next_timeout->expiry) >= 0) {
-
- /* Timeout elapsed */
- timeout_callback(next_timeout);
- goto finish;
- }
- }
-
- /* Look for some kind of I/O event */
- for (w = s->watches; w; w = w->watches_next) {
-
- if (w->dead)
- continue;
-
- assert(w->idx >= 0);
- assert(w->idx < s->n_pollfds);
-
- if (s->pollfds[w->idx].revents != 0) {
- w->callback(w, w->pollfd.fd, s->pollfds[w->idx].revents, w->userdata);
- goto finish;
- }
- }
-
-finish:
-
- s->state = STATE_DISPATCHED;
- return 0;
-}
-
-int avahi_simple_poll_iterate(AvahiSimplePoll *s, int timeout) {
- int r;
-
- if ((r = avahi_simple_poll_prepare(s, timeout)) != 0)
- return r;
-
- if ((r = avahi_simple_poll_run(s)) != 0)
- return r;
-
- if ((r = avahi_simple_poll_dispatch(s)) != 0)
- return r;
-
- return 0;
-}
-
-void avahi_simple_poll_quit(AvahiSimplePoll *s) {
- assert(s);
-
- s->quit = 1;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-}
-
-const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s) {
- assert(s);
-
- return &s->api;
-}
-
-static int system_poll(struct pollfd *ufds, unsigned int nfds, int timeout, AVAHI_GCC_UNUSED void *userdata) {
- return poll(ufds, nfds, timeout);
-}
-
-void avahi_simple_poll_set_func(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata) {
- assert(s);
-
- s->poll_func = func ? func : system_poll;
- s->poll_func_userdata = func ? userdata : NULL;
-
- /* If there is a background thread running the poll() for us, tell it to exit the poll() */
- avahi_simple_poll_wakeup(s);
-}
-
-int avahi_simple_poll_loop(AvahiSimplePoll *s) {
- int r;
-
- assert(s);
-
- for (;;)
- if ((r = avahi_simple_poll_iterate(s, -1)) != 0)
- if (r >= 0 || errno != EINTR)
- return r;
-}
diff --git a/trunk/avahi-common/simple-watch.h b/trunk/avahi-common/simple-watch.h
deleted file mode 100644
index 7c83db3..0000000
--- a/trunk/avahi-common/simple-watch.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef foosimplewatchhfoo
-#define foosimplewatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file simple-watch.h Simple poll() based main loop implementation */
-
-#include <sys/poll.h>
-#include <avahi-common/cdecl.h>
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** A main loop object. Main loops of this type aren't very flexible
- * since they only support a single wakeup type. Nevertheless it
- * should suffice for small test and example applications. */
-typedef struct AvahiSimplePoll AvahiSimplePoll;
-
-/** Create a new main loop object */
-AvahiSimplePoll *avahi_simple_poll_new(void);
-
-/** Free a main loop object */
-void avahi_simple_poll_free(AvahiSimplePoll *s);
-
-/** Return the abstracted poll API object for this main loop
- * object. The is will return the same pointer each time it is
- * called. */
-const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s);
-
-/** Run a single main loop iteration of this main loop. If sleep_time
-is < 0 this will block until any of the registered events happens,
-then it will execute the attached callback function. If sleep_time is
-0 the routine just checks if any event is pending. If yes the attached
-callback function is called, otherwise the function returns
-immediately. If sleep_time > 0 the function will block for at most the
-specified time in msecs. Returns -1 on error, 0 on success and 1 if a
-quit request has been scheduled. Usually this function should be called
-in a loop until it returns a non-zero value*/
-int avahi_simple_poll_iterate(AvahiSimplePoll *s, int sleep_time);
-
-/** Request that the main loop quits. If this is called the next
- call to avahi_simple_poll_iterate() will return 1 */
-void avahi_simple_poll_quit(AvahiSimplePoll *s);
-
-/** Prototype for a poll() type function */
-typedef int (*AvahiPollFunc)(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata);
-
-/** Replace the internally used poll() function. By default the system's poll() will be used */
-void avahi_simple_poll_set_func(AvahiSimplePoll *s, AvahiPollFunc func, void *userdata);
-
-/** The first stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
-int avahi_simple_poll_prepare(AvahiSimplePoll *s, int timeout);
-
-/** The second stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
-int avahi_simple_poll_run(AvahiSimplePoll *s);
-
-/** The third and final stage of avahi_simple_poll_iterate(), use this function only if you know what you do */
-int avahi_simple_poll_dispatch(AvahiSimplePoll *s);
-
-/** Call avahi_simple_poll_iterate() in a loop and return if it returns non-zero */
-int avahi_simple_poll_loop(AvahiSimplePoll *s);
-
-/** Wakeup the main loop. (for threaded environments) */
-void avahi_simple_poll_wakeup(AvahiSimplePoll *s);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/strlst-test.c b/trunk/avahi-common/strlst-test.c
deleted file mode 100644
index 71f748d..0000000
--- a/trunk/avahi-common/strlst-test.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-
-#include "strlst.h"
-#include "malloc.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- char *t, *v;
- uint8_t data[1024];
- AvahiStringList *a = NULL, *b, *p;
- size_t size, n;
- int r;
-
- a = avahi_string_list_new("prefix", "a", "b", NULL);
-
- a = avahi_string_list_add(a, "start");
- a = avahi_string_list_add(a, "foo=99");
- a = avahi_string_list_add(a, "bar");
- a = avahi_string_list_add(a, "");
- a = avahi_string_list_add(a, "");
- a = avahi_string_list_add(a, "quux");
- a = avahi_string_list_add(a, "");
- a = avahi_string_list_add_arbitrary(a, (const uint8_t*) "null\0null", 9);
- a = avahi_string_list_add_printf(a, "seven=%i %c", 7, 'x');
- a = avahi_string_list_add_pair(a, "blubb", "blaa");
- a = avahi_string_list_add_pair(a, "uxknurz", NULL);
- a = avahi_string_list_add_pair_arbitrary(a, "uxknurz2", (const uint8_t*) "blafasel\0oerks", 14);
-
- a = avahi_string_list_add(a, "end");
-
- t = avahi_string_list_to_string(a);
- printf("--%s--\n", t);
- avahi_free(t);
-
- n = avahi_string_list_serialize(a, NULL, 0);
- size = avahi_string_list_serialize(a, data, sizeof(data));
- assert(size == n);
-
- printf("%u\n", size);
-
- for (t = (char*) data, n = 0; n < size; n++, t++) {
- if (*t <= 32)
- printf("(%u)", *t);
- else
- printf("%c", *t);
- }
-
- printf("\n");
-
- assert(avahi_string_list_parse(data, size, &b) == 0);
-
- printf("equal: %i\n", avahi_string_list_equal(a, b));
-
- t = avahi_string_list_to_string(b);
- printf("--%s--\n", t);
- avahi_free(t);
-
- avahi_string_list_free(b);
-
- b = avahi_string_list_copy(a);
-
- assert(avahi_string_list_equal(a, b));
-
- t = avahi_string_list_to_string(b);
- printf("--%s--\n", t);
- avahi_free(t);
-
- p = avahi_string_list_find(a, "seven");
- assert(p);
-
- r = avahi_string_list_get_pair(p, &t, &v, NULL);
- assert(r >= 0);
- assert(t);
- assert(v);
-
- printf("<%s>=<%s>\n", t, v);
- avahi_free(t);
- avahi_free(v);
-
- p = avahi_string_list_find(a, "quux");
- assert(p);
-
- r = avahi_string_list_get_pair(p, &t, &v, NULL);
- assert(r >= 0);
- assert(t);
- assert(!v);
-
- printf("<%s>=<%s>\n", t, v);
- avahi_free(t);
- avahi_free(v);
-
- avahi_string_list_free(a);
- avahi_string_list_free(b);
-
- n = avahi_string_list_serialize(NULL, NULL, 0);
- size = avahi_string_list_serialize(NULL, data, sizeof(data));
- assert(size == 1);
- assert(size == n);
-
- assert(avahi_string_list_parse(data, size, &a) == 0);
- assert(!a);
-
- return 0;
-}
diff --git a/trunk/avahi-common/strlst.c b/trunk/avahi-common/strlst.c
deleted file mode 100644
index c6ceb0f..0000000
--- a/trunk/avahi-common/strlst.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "strlst.h"
-#include "malloc.h"
-#include "defs.h"
-
-AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size) {
- AvahiStringList *n;
-
- if (!(n = avahi_malloc(sizeof(AvahiStringList) + size)))
- return NULL;
-
- n->next = l;
- n->size = size;
-
- /* NUL terminate strings, just to make sure */
- n->text[size] = 0;
-
- return n;
-}
-
-AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t*text, size_t size) {
- AvahiStringList *n;
-
- assert(text);
-
- if (!(n = avahi_string_list_add_anonymous(l, size)))
- return NULL;
-
- if (size > 0)
- memcpy(n->text, text, size);
-
- return n;
-}
-
-AvahiStringList *avahi_string_list_add(AvahiStringList *l, const char *text) {
- assert(text);
-
- return avahi_string_list_add_arbitrary(l, (const uint8_t*) text, strlen(text));
-}
-
-int avahi_string_list_parse(const void* data, size_t size, AvahiStringList **ret) {
- const uint8_t *c;
- AvahiStringList *r = NULL;
-
- assert(data);
- assert(ret);
-
- c = data;
- while (size > 0) {
- size_t k;
-
- k = *(c++);
- size--;
-
- if (k > size)
- goto fail; /* Overflow */
-
- if (k > 0) { /* Ignore empty strings */
- AvahiStringList *n;
-
- if (!(n = avahi_string_list_add_arbitrary(r, c, k)))
- goto fail; /* OOM */
-
- r = n;
- }
-
- c += k;
- size -= k;
- }
-
- *ret = r;
-
- return 0;
-
-fail:
- avahi_string_list_free(r);
- return -1;
-}
-
-void avahi_string_list_free(AvahiStringList *l) {
- AvahiStringList *n;
-
- while (l) {
- n = l->next;
- avahi_free(l);
- l = n;
- }
-}
-
-AvahiStringList* avahi_string_list_reverse(AvahiStringList *l) {
- AvahiStringList *r = NULL, *n;
-
- while (l) {
- n = l->next;
- l->next = r;
- r = l;
- l = n;
- }
-
- return r;
-}
-
-char* avahi_string_list_to_string(AvahiStringList *l) {
- AvahiStringList *n;
- size_t s = 0;
- char *t, *e;
-
- for (n = l; n; n = n->next) {
- if (n != l)
- s ++;
-
- s += n->size+2;
- }
-
- if (!(t = e = avahi_new(char, s+1)))
- return NULL;
-
- l = avahi_string_list_reverse(l);
-
- for (n = l; n; n = n->next) {
- if (n != l)
- *(e++) = ' ';
-
- *(e++) = '"';
- strncpy(e, (char*) n->text, n->size);
- e[n->size] = 0;
- e = strchr(e, 0);
- *(e++) = '"';
-
- assert(e);
- }
-
- l = avahi_string_list_reverse(l);
-
- *e = 0;
-
- return t;
-}
-
-size_t avahi_string_list_serialize(AvahiStringList *l, void *data, size_t size) {
- size_t used = 0;
-
- if (data) {
- AvahiStringList *n;
- uint8_t *c;
-
- l = avahi_string_list_reverse(l);
- c = data;
-
- for (n = l; size > 1 && n; n = n->next) {
- size_t k;
-
- if ((k = n->size) == 0)
- /* Skip empty strings */
- continue;
-
- if (k > 255)
- /* Truncate strings at 255 characters */
- k = 255;
-
- if (k > size-1)
- /* Make sure this string fits in */
- k = size-1;
-
- *(c++) = (uint8_t) k;
- memcpy(c, n->text, k);
- c += k;
-
- used += 1 + k;
- size -= 1 + k;
- }
-
- l = avahi_string_list_reverse(l);
-
- if (used == 0 && size > 0) {
-
- /* Empty lists are treated specially. To comply with
- * section 6.1 of the DNS-SD spec, we return a single
- * empty string (i.e. a NUL byte)*/
-
- *(uint8_t*) data = 0;
- used = 1;
- }
-
- } else {
- AvahiStringList *n;
-
- for (n = l; n; n = n->next) {
- size_t k;
-
- if ((k = n->size) == 0)
- continue;
-
- if (k > 255)
- k = 255;
-
- used += 1+k;
- }
-
- if (used == 0)
- used = 1;
- }
-
- return used;
-}
-
-int avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList *b) {
-
- for (;;) {
- if (!a && !b)
- return 1;
-
- if (!a || !b)
- return 0;
-
- if (a->size != b->size)
- return 0;
-
- if (a->size != 0 && memcmp(a->text, b->text, a->size) != 0)
- return 0;
-
- a = a->next;
- b = b->next;
- }
-}
-
-AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...) {
- va_list va;
-
- va_start(va, r);
- r = avahi_string_list_add_many_va(r, va);
- va_end(va);
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_add_many_va(AvahiStringList *r, va_list va) {
- const char *txt;
-
- while ((txt = va_arg(va, const char*)))
- r = avahi_string_list_add(r, txt);
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_new(const char *txt, ...) {
- va_list va;
- AvahiStringList *r = NULL;
-
- if (txt) {
- r = avahi_string_list_add(r, txt);
-
- va_start(va, txt);
- r = avahi_string_list_add_many_va(r, va);
- va_end(va);
- }
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_new_va(va_list va) {
- return avahi_string_list_add_many_va(NULL, va);
-}
-
-AvahiStringList *avahi_string_list_copy(const AvahiStringList *l) {
- AvahiStringList *r = NULL;
-
- for (; l; l = l->next)
- if (!(r = avahi_string_list_add_arbitrary(r, l->text, l->size))) {
- avahi_string_list_free(r);
- return NULL;
- }
-
- return avahi_string_list_reverse(r);
-}
-
-AvahiStringList *avahi_string_list_new_from_array(const char *array[], int length) {
- AvahiStringList *r = NULL;
- int i;
-
- assert(array);
-
- for (i = 0; length >= 0 ? i < length : !!array[i]; i++)
- r = avahi_string_list_add(r, array[i]);
-
- return r;
-}
-
-unsigned avahi_string_list_length(const AvahiStringList *l) {
- unsigned n = 0;
-
- for (; l; l = l->next)
- n++;
-
- return n;
-}
-
-AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *format, va_list va) {
- size_t len = 80;
- AvahiStringList *r;
-
- assert(format);
-
- if (!(r = avahi_malloc(sizeof(AvahiStringList) + len)))
- return NULL;
-
- for (;;) {
- int n;
- AvahiStringList *nr;
-
- n = vsnprintf((char*) r->text, len+1, format, va);
-
- if (n >= 0 && n < (int) len)
- break;
-
- if (n >= 0)
- len = n+1;
- else
- len *= 2;
-
- if (!(nr = avahi_realloc(r, sizeof(AvahiStringList) + len))) {
- avahi_free(r);
- return NULL;
- }
-
- r = nr;
- }
-
-
- r->next = l;
- r->size = strlen((char*) r->text);
-
- return r;
-}
-
-AvahiStringList *avahi_string_list_add_printf(AvahiStringList *l, const char *format, ...) {
- va_list va;
-
- assert(format);
-
- va_start(va, format);
- l = avahi_string_list_add_vprintf(l, format, va);
- va_end(va);
-
- return l;
-}
-
-AvahiStringList *avahi_string_list_find(AvahiStringList *l, const char *key) {
- size_t n;
-
- assert(key);
- n = strlen(key);
-
- for (; l; l = l->next) {
- if (strcasecmp((char*) l->text, key) == 0)
- return l;
-
- if (strncasecmp((char*) l->text, key, n) == 0 && l->text[n] == '=')
- return l;
- }
-
- return NULL;
-}
-
-AvahiStringList *avahi_string_list_add_pair(AvahiStringList *l, const char *key, const char *value) {
- assert(key);
-
- if (value)
- return avahi_string_list_add_printf(l, "%s=%s", key, value);
- else
- return avahi_string_list_add(l, key);
-}
-
-AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const char *key, const uint8_t *value, size_t size) {
- size_t n;
- assert(key);
-
- if (!value)
- return avahi_string_list_add(l, key);
-
- n = strlen(key);
-
- if (!(l = avahi_string_list_add_anonymous(l, n + 1 + size)))
- return NULL;
-
- memcpy(l->text, key, n);
- l->text[n] = '=';
- memcpy(l->text + n + 1, value, size);
-
- return l;
-}
-
-int avahi_string_list_get_pair(AvahiStringList *l, char **key, char **value, size_t *size) {
- char *e;
-
- assert(l);
-
- if (!(e = memchr(l->text, '=', l->size))) {
-
- if (key)
- if (!(*key = avahi_strdup((char*) l->text)))
- return -1;
-
- if (value)
- *value = NULL;
-
- if (size)
- *size = 0;
-
- } else {
- size_t n;
-
- if (key)
- if (!(*key = avahi_strndup((char*) l->text, e - (char *) l->text)))
- return -1;
-
- e++; /* Advance after '=' */
-
- n = l->size - (e - (char*) l->text);
-
- if (value) {
-
- if (!(*value = avahi_memdup(e, n+1))) {
- if (key)
- avahi_free(*key);
- return -1;
- }
-
- (*value)[n] = 0;
- }
-
- if (size)
- *size = n;
- }
-
- return 0;
-}
-
-AvahiStringList *avahi_string_list_get_next(AvahiStringList *l) {
- assert(l);
- return l->next;
-}
-
-uint8_t *avahi_string_list_get_text(AvahiStringList *l) {
- assert(l);
- return l->text;
-}
-
-size_t avahi_string_list_get_size(AvahiStringList *l) {
- assert(l);
- return l->size;
-}
-
-uint32_t avahi_string_list_get_service_cookie(AvahiStringList *l) {
- AvahiStringList *f;
- char *value = NULL, *end = NULL;
- uint32_t ret;
-
- if (!(f = avahi_string_list_find(l, AVAHI_SERVICE_COOKIE)))
- return AVAHI_SERVICE_COOKIE_INVALID;
-
- if (avahi_string_list_get_pair(f, NULL, &value, NULL) < 0 || !value)
- return AVAHI_SERVICE_COOKIE_INVALID;
-
- ret = (uint32_t) strtoll(value, &end, 0);
-
- if (*value && end && *end != 0) {
- avahi_free(value);
- return AVAHI_SERVICE_COOKIE_INVALID;
- }
-
- avahi_free(value);
-
- return ret;
-}
diff --git a/trunk/avahi-common/strlst.h b/trunk/avahi-common/strlst.h
deleted file mode 100644
index 26708a5..0000000
--- a/trunk/avahi-common/strlst.h
+++ /dev/null
@@ -1,152 +0,0 @@
-#ifndef footxtlisthfoo
-#define footxtlisthfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file strlst.h Implementation of a data type to store lists of strings */
-
-#include <sys/types.h>
-#include <inttypes.h>
-#include <stdarg.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/gccmacro.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Linked list of strings that can contain any number of binary
- * characters, including NUL bytes. An empty list is created by
- * assigning a NULL to a pointer to AvahiStringList. The string list
- * is stored in reverse order, so that appending to the string list is
- * effectively a prepending to the linked list. This object is used
- * primarily for storing DNS TXT record data. */
-typedef struct AvahiStringList {
- struct AvahiStringList *next; /**< Pointer to the next linked list element */
- size_t size; /**< Size of text[] */
- uint8_t text[1]; /**< Character data */
-} AvahiStringList;
-
-/** Create a new string list by taking a variable list of NUL
- * terminated strings. The strings are copied using g_strdup(). The
- * argument list must be terminated by a NULL pointer. */
-AvahiStringList *avahi_string_list_new(const char *txt, ...) AVAHI_GCC_SENTINEL;
-
-/** Same as avahi_string_list_new() but pass a va_list structure */
-AvahiStringList *avahi_string_list_new_va(va_list va);
-
-/** Create a new string list from a string array. The strings are
- * copied using g_strdup(). length should contain the length of the
- * array, or -1 if the array is NULL terminated*/
-AvahiStringList *avahi_string_list_new_from_array(const char **array, int length);
-
-/** Free a string list */
-void avahi_string_list_free(AvahiStringList *l);
-
-/** Append a NUL terminated string to the specified string list. The
- * passed string is copied using g_strdup(). Returns the new list
- * start. */
-AvahiStringList *avahi_string_list_add(AvahiStringList *l, const char *text);
-
-/** Append a new NUL terminated formatted string to the specified string list */
-AvahiStringList *avahi_string_list_add_printf(AvahiStringList *l, const char *format, ...) AVAHI_GCC_PRINTF_ATTR23;
-
-/** Append a new NUL terminated formatted string to the specified string list */
-AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *format, va_list va);
-
-/** Append an arbitrary length byte string to the list. Returns the
- * new list start. */
-AvahiStringList *avahi_string_list_add_arbitrary(AvahiStringList *l, const uint8_t *text, size_t size);
-
-/** Append a new entry to the string list. The string is not filled
-with data. The caller should fill in string data afterwards by writing
-it to l->text, where l is the pointer returned by this function. This
-function exists solely to optimize a few operations where otherwise
-superfluous string copying would be necessary. */
-AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size);
-
-/** Same as avahi_string_list_add(), but takes a variable number of
- * NUL terminated strings. The argument list must be terminated by a
- * NULL pointer. Returns the new list start. */
-AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...) AVAHI_GCC_SENTINEL;
-
-/** Same as avahi_string_list_add_many(), but use a va_list
- * structure. Returns the new list start. */
-AvahiStringList *avahi_string_list_add_many_va(AvahiStringList *r, va_list va);
-
-/** Convert the string list object to a single character string,
- * seperated by spaces and enclosed in "". avahi_free() the result! This
- * function doesn't work well with string that contain NUL bytes. */
-char* avahi_string_list_to_string(AvahiStringList *l);
-
-/** Serialize the string list object in a way that is compatible with
- * the storing of DNS TXT records. Strings longer than 255 bytes are truncated. */
-size_t avahi_string_list_serialize(AvahiStringList *l, void * data, size_t size);
-
-/** Inverse of avahi_string_list_serialize() */
-int avahi_string_list_parse(const void *data, size_t size, AvahiStringList **ret);
-
-/** Compare to string lists */
-int avahi_string_list_equal(const AvahiStringList *a, const AvahiStringList *b);
-
-/** Copy a string list */
-AvahiStringList *avahi_string_list_copy(const AvahiStringList *l);
-
-/** Reverse the string list. */
-AvahiStringList* avahi_string_list_reverse(AvahiStringList *l);
-
-/** Return the number of elements in the string list */
-unsigned avahi_string_list_length(const AvahiStringList *l);
-
-/** Find the string list entry for the given DNS-SD TXT key */
-AvahiStringList *avahi_string_list_find(AvahiStringList *l, const char *key);
-
-/** Return the DNS-SD TXT key and value for the specified string list
- * item. If size is not NULL it will be filled with the length of
- * value. (for strings containing NUL bytes). If the entry doesn't
- * contain a value *value will be set to NULL. You need to
- * avahi_free() the strings returned in *key and *value. */
-int avahi_string_list_get_pair(AvahiStringList *l, char **key, char **value, size_t *size);
-
-/** Add a new DNS-SD TXT key value pair to the string list. value may
- * be NULL in case you want to specify a key without a value */
-AvahiStringList *avahi_string_list_add_pair(AvahiStringList *l, const char *key, const char *value);
-
-/** Same as avahi_string_list_add_pair() but allow strings containing NUL bytes in *value. */
-AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const char *key, const uint8_t *value, size_t size);
-
-/** Returns the next item in the string list */
-AvahiStringList *avahi_string_list_get_next(AvahiStringList *l);
-
-/** Returns the text for the current item */
-uint8_t *avahi_string_list_get_text(AvahiStringList *l);
-
-/** Returns the size of the current text */
-size_t avahi_string_list_get_size(AvahiStringList *l);
-
-/** Try to find a magic service cookie in the specified DNS-SD string
- * list. Or return AVAHI_SERVICE_COOKIE_INVALID if none is found. */
-uint32_t avahi_string_list_get_service_cookie(AvahiStringList *l);
-
-AVAHI_C_DECL_END
-
-#endif
-
diff --git a/trunk/avahi-common/thread-watch.c b/trunk/avahi-common/thread-watch.c
deleted file mode 100644
index 1a5d9d2..0000000
--- a/trunk/avahi-common/thread-watch.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/poll.h>
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <pthread.h>
-#include <signal.h>
-
-#include "llist.h"
-#include "malloc.h"
-#include "timeval.h"
-#include "simple-watch.h"
-#include "thread-watch.h"
-
-struct AvahiThreadedPoll {
- AvahiSimplePoll *simple_poll;
- pthread_t thread_id;
- pthread_mutex_t mutex;
- int thread_running;
- int retval;
-};
-
-static int poll_func(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
- pthread_mutex_t *mutex = userdata;
- int r;
-
- /* Before entering poll() we unlock the mutex, so that
- * avahi_simple_poll_quit() can succeed from another thread. */
-
- pthread_mutex_unlock(mutex);
- r = poll(ufds, nfds, timeout);
- pthread_mutex_lock(mutex);
-
- return r;
-}
-
-static void* thread(void *userdata){
- AvahiThreadedPoll *p = userdata;
- sigset_t mask;
-
- /* Make sure that signals are delivered to the main thread */
- sigfillset(&mask);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
- pthread_mutex_lock(&p->mutex);
- p->retval = avahi_simple_poll_loop(p->simple_poll);
- pthread_mutex_unlock(&p->mutex);
-
- return NULL;
-}
-
-AvahiThreadedPoll *avahi_threaded_poll_new(void) {
- AvahiThreadedPoll *p;
-
- if (!(p = avahi_new(AvahiThreadedPoll, 1)))
- goto fail; /* OOM */
-
- if (!(p->simple_poll = avahi_simple_poll_new()))
- goto fail;
-
- pthread_mutex_init(&p->mutex, NULL);
-
- avahi_simple_poll_set_func(p->simple_poll, poll_func, &p->mutex);
-
- p->thread_running = 0;
-
- return p;
-
-fail:
- if (p) {
- if (p->simple_poll) {
- avahi_simple_poll_free(p->simple_poll);
- pthread_mutex_destroy(&p->mutex);
- }
-
- avahi_free(p);
- }
-
- return NULL;
-}
-
-void avahi_threaded_poll_free(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is not called from the helper thread */
- assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
-
- if (p->thread_running)
- avahi_threaded_poll_stop(p);
-
- if (p->simple_poll)
- avahi_simple_poll_free(p->simple_poll);
-
- pthread_mutex_destroy(&p->mutex);
- avahi_free(p);
-}
-
-const AvahiPoll* avahi_threaded_poll_get(AvahiThreadedPoll *p) {
- assert(p);
-
- return avahi_simple_poll_get(p->simple_poll);
-}
-
-int avahi_threaded_poll_start(AvahiThreadedPoll *p) {
- assert(p);
-
- assert(!p->thread_running);
-
- if (pthread_create(&p->thread_id, NULL, thread, p) < 0)
- return -1;
-
- return 0;
-}
-
-int avahi_threaded_poll_stop(AvahiThreadedPoll *p) {
- assert(p);
-
- if (!p->thread_running)
- return -1;
-
- /* Make sure that this function is not called from the helper thread */
- assert(!pthread_equal(pthread_self(), p->thread_id));
-
- pthread_mutex_lock(&p->mutex);
- avahi_simple_poll_quit(p->simple_poll);
- pthread_mutex_unlock(&p->mutex);
-
- pthread_join(p->thread_id, NULL);
- p->thread_running = 0;
-
- return p->retval;
-}
-
-void avahi_threaded_poll_quit(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is called from the helper thread */
- assert(pthread_equal(pthread_self(), p->thread_id));
-
- avahi_simple_poll_quit(p->simple_poll);
-}
-
-void avahi_threaded_poll_lock(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is not called from the helper thread */
- assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
-
- pthread_mutex_lock(&p->mutex);
-}
-
-void avahi_threaded_poll_unlock(AvahiThreadedPoll *p) {
- assert(p);
-
- /* Make sure that this function is not called from the helper thread */
- assert(!p->thread_running || !pthread_equal(pthread_self(), p->thread_id));
-
- pthread_mutex_unlock(&p->mutex);
-}
diff --git a/trunk/avahi-common/thread-watch.h b/trunk/avahi-common/thread-watch.h
deleted file mode 100644
index e603293..0000000
--- a/trunk/avahi-common/thread-watch.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef foothreadedwatchhfoo
-#define foothreadedwatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file thread-watch.h Threaded poll() based main loop implementation */
-
-#include <sys/poll.h>
-#include <avahi-common/cdecl.h>
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** A main loop object that runs an AvahiSimplePoll in its own thread. \since 0.6.4 */
-typedef struct AvahiThreadedPoll AvahiThreadedPoll;
-
-/** Create a new event loop object. This will allocate the internal
- * AvahiSimplePoll, but will not start the helper thread. \since 0.6.4 */
-AvahiThreadedPoll *avahi_threaded_poll_new(void);
-
-/** Free an event loop object. Ths will stop the associated evet loop
- * thread (if it is running). \since 0.6.4 */
-void avahi_threaded_poll_free(AvahiThreadedPoll *p);
-
-/** Return the abstracted poll API object for this event loop
- * object. The will return the same pointer each time it is
- * called. \since 0.6.4 */
-const AvahiPoll* avahi_threaded_poll_get(AvahiThreadedPoll *p);
-
-/** Start the event loop helper thread. After the thread has started
- * you must make sure to access the event loop object
- * (AvahiThreadedPoll, AvahiPoll and all its associated objects)
- * synchronized, i.e. with proper locking. You may want to use
- * avahi_threaded_poll_lock()/avahi_threaded_poll_unlock() for this,
- * which will lock the the entire event loop. Please note that event
- * loop callback functions are called from the event loop helper thread
- * with that lock held, i.e. avahi_threaded_poll_lock() calls are not
- * required from event callbacks. \since 0.6.4 */
-int avahi_threaded_poll_start(AvahiThreadedPoll *p);
-
-/** Request that the event loop quits and the associated thread
- stops. Call this from outside the helper thread if you want to shut
- it down. \since 0.6.4 */
-int avahi_threaded_poll_stop(AvahiThreadedPoll *p);
-
-/** Request that the event loop quits and the associated thread
- stops. Call this from inside the helper thread if you want to shut it
- down. \since 0.6.4 */
-void avahi_threaded_poll_quit(AvahiThreadedPoll *p);
-
-/** Lock the main loop object. Use this if you want to access the event
- * loop objects (such as creating a new event source) from anything
- * else but the event loop helper thread, i.e. from anything else but event
- * loop callbacks \since 0.6.4 */
-void avahi_threaded_poll_lock(AvahiThreadedPoll *p);
-
-/** Unlock the event loop object, use this as counterpart to
- * avahi_threaded_poll_lock() \since 0.6.4 */
-void avahi_threaded_poll_unlock(AvahiThreadedPoll *p);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/timeval-test.c b/trunk/avahi-common/timeval-test.c
deleted file mode 100644
index 92fcab2..0000000
--- a/trunk/avahi-common/timeval-test.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include "gccmacro.h"
-#include "timeval.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- struct timeval a = { 5, 5 }, b;
-
- b = a;
-
- printf("%li.%li\n", a.tv_sec, a.tv_usec);
- avahi_timeval_add(&a, -50);
-
- printf("%li.%li\n", a.tv_sec, a.tv_usec);
-
- printf("%lli\n", avahi_timeval_diff(&a, &b));
-
- return 0;
-}
diff --git a/trunk/avahi-common/timeval.c b/trunk/avahi-common/timeval.c
deleted file mode 100644
index 2d0d693..0000000
--- a/trunk/avahi-common/timeval.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "timeval.h"
-
-int avahi_timeval_compare(const struct timeval *a, const struct timeval *b) {
- assert(a);
- assert(b);
-
- if (a->tv_sec < b->tv_sec)
- return -1;
-
- if (a->tv_sec > b->tv_sec)
- return 1;
-
- if (a->tv_usec < b->tv_usec)
- return -1;
-
- if (a->tv_usec > b->tv_usec)
- return 1;
-
- return 0;
-}
-
-AvahiUsec avahi_timeval_diff(const struct timeval *a, const struct timeval *b) {
- assert(a);
- assert(b);
-
- if (avahi_timeval_compare(a, b) < 0)
- return - avahi_timeval_diff(b, a);
-
- return ((AvahiUsec) a->tv_sec - b->tv_sec)*1000000 + a->tv_usec - b->tv_usec;
-}
-
-struct timeval* avahi_timeval_add(struct timeval *a, AvahiUsec usec) {
- AvahiUsec u;
- assert(a);
-
- u = usec + a->tv_usec;
-
- if (u < 0) {
- a->tv_usec = (long) (1000000 + (u % 1000000));
- a->tv_sec += (long) (-1 + (u / 1000000));
- } else {
- a->tv_usec = (long) (u % 1000000);
- a->tv_sec += (long) (u / 1000000);
- }
-
- return a;
-}
-
-AvahiUsec avahi_age(const struct timeval *a) {
- struct timeval now;
-
- assert(a);
-
- gettimeofday(&now, NULL);
-
- return avahi_timeval_diff(&now, a);
-}
-
-struct timeval *avahi_elapse_time(struct timeval *tv, unsigned msec, unsigned jitter) {
- assert(tv);
-
- gettimeofday(tv, NULL);
-
- if (msec)
- avahi_timeval_add(tv, (AvahiUsec) msec*1000);
-
- if (jitter) {
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- static int last_rand;
- static time_t timestamp = 0;
-
- time_t now;
- int r;
-
- now = time(NULL);
-
- pthread_mutex_lock(&mutex);
- if (now >= timestamp + 10) {
- timestamp = now;
- last_rand = rand();
- }
-
- r = last_rand;
-
- pthread_mutex_unlock(&mutex);
-
- /* We use the same jitter for 10 seconds. That way our
- * time events elapse in bursts which has the advantage that
- * packet data can be aggegrated better */
-
- avahi_timeval_add(tv, (AvahiUsec) (jitter*1000.0*r/(RAND_MAX+1.0)));
- }
-
- return tv;
-}
-
diff --git a/trunk/avahi-common/timeval.h b/trunk/avahi-common/timeval.h
deleted file mode 100644
index a441c08..0000000
--- a/trunk/avahi-common/timeval.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef footimevalhfoo
-#define footimevalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file timeval.h Functions to facilitate timeval handling */
-
-#include <inttypes.h>
-#include <sys/time.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** A numeric data type for storing microsecond values. (signed 64bit integer) */
-typedef int64_t AvahiUsec;
-
-/** Compare two timeval structures and return a negative value when a < b, 0 when a == b and a positive value otherwise */
-int avahi_timeval_compare(const struct timeval *a, const struct timeval *b);
-
-/** Calculate the difference between two timeval structures as microsecond value */
-AvahiUsec avahi_timeval_diff(const struct timeval *a, const struct timeval *b);
-
-/** Add a number of microseconds to the specified timeval structure and return it. *a is modified. */
-struct timeval* avahi_timeval_add(struct timeval *a, AvahiUsec usec);
-
-/** Return the difference between the current time and *a. Positive if *a was earlier */
-AvahiUsec avahi_age(const struct timeval *a);
-
-/** Fill *tv with the current time plus "ms" milliseconds plus an
- * extra jitter of "j" milliseconds. Pass 0 for j if you don't want
- * the jitter */
-struct timeval *avahi_elapse_time(struct timeval *tv, unsigned ms, unsigned j);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/utf8-test.c b/trunk/avahi-common/utf8-test.c
deleted file mode 100644
index ce7a984..0000000
--- a/trunk/avahi-common/utf8-test.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-
-#include <avahi-common/gccmacro.h>
-
-#include "utf8.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- assert(avahi_utf8_valid("hallo"));
- assert(!avahi_utf8_valid("üxknürz"));
- assert(avahi_utf8_valid("üxknürz"));
-}
diff --git a/trunk/avahi-common/utf8.c b/trunk/avahi-common/utf8.c
deleted file mode 100644
index f52ce55..0000000
--- a/trunk/avahi-common/utf8.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $Id */
-
-/* This file is based on the GLIB utf8 validation functions. The
- * original license text follows. */
-
-/* gutf8.c - Operations on UTF-8 strings.
- *
- * Copyright (C) 1999 Tom Tromey
- * Copyright (C) 2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include "utf8.h"
-
-#define UNICODE_VALID(Char) \
- ((Char) < 0x110000 && \
- (((Char) & 0xFFFFF800) != 0xD800) && \
- ((Char) < 0xFDD0 || (Char) > 0xFDEF) && \
- ((Char) & 0xFFFE) != 0xFFFE)
-
-
-#define CONTINUATION_CHAR \
- do { \
- if ((*(const unsigned char *)p & 0xc0) != 0x80) /* 10xxxxxx */ \
- goto error; \
- val <<= 6; \
- val |= (*(const unsigned char *)p) & 0x3f; \
- } while(0)
-
-
-const char *
-avahi_utf8_valid (const char *str)
-
-{
- unsigned val = 0;
- unsigned min = 0;
- const char *p;
-
- for (p = str; *p; p++)
- {
- if (*(const unsigned char *)p < 128)
- /* done */;
- else
- {
- const char *last;
-
- last = p;
- if ((*(const unsigned char *)p & 0xe0) == 0xc0) /* 110xxxxx */
- {
- if ( ((*(const unsigned char *)p & 0x1e) == 0))
- goto error;
- p++;
- if ( ((*(const unsigned char *)p & 0xc0) != 0x80)) /* 10xxxxxx */
- goto error;
- }
- else
- {
- if ((*(const unsigned char *)p & 0xf0) == 0xe0) /* 1110xxxx */
- {
- min = (1 << 11);
- val = *(const unsigned char *)p & 0x0f;
- goto TWO_REMAINING;
- }
- else if ((*(const unsigned char *)p & 0xf8) == 0xf0) /* 11110xxx */
- {
- min = (1 << 16);
- val = *(const unsigned char *)p & 0x07;
- }
- else
- goto error;
-
- p++;
- CONTINUATION_CHAR;
- TWO_REMAINING:
- p++;
- CONTINUATION_CHAR;
- p++;
- CONTINUATION_CHAR;
-
- if ( (val < min))
- goto error;
-
- if ( (!UNICODE_VALID(val)))
- goto error;
- }
-
- continue;
-
- error:
- return NULL;
- }
- }
-
- return str;
-}
diff --git a/trunk/avahi-common/utf8.h b/trunk/avahi-common/utf8.h
deleted file mode 100644
index 93c9b59..0000000
--- a/trunk/avahi-common/utf8.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef fooutf8hfoo
-#define fooutf8hfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-const char *avahi_utf8_valid(const char *str);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-common/watch-test.c b/trunk/avahi-common/watch-test.c
deleted file mode 100644
index 870045d..0000000
--- a/trunk/avahi-common/watch-test.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-
-#include "watch.h"
-#include "timeval.h"
-#include "gccmacro.h"
-
-static const AvahiPoll *api = NULL;
-
-#ifndef USE_THREAD
-#include "simple-watch.h"
-static AvahiSimplePoll *simple_poll = NULL;
-#else
-#include "thread-watch.h"
-static AvahiThreadedPoll *threaded_poll = NULL;
-#endif
-
-static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
-
- if (event & AVAHI_WATCH_IN) {
- ssize_t r;
- char c;
-
- if ((r = read(fd, &c, 1)) <= 0) {
- fprintf(stderr, "read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- api->watch_free(w);
- return;
- }
-
- printf("Read: %c\n", c >= 32 && c < 127 ? c : '.');
- }
-}
-
-static void wakeup(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) {
- static int i = 0;
- struct timeval tv;
-
- printf("Wakeup #%i\n", i++);
-
- if (i > 10) {
-#ifndef USE_THREAD
- avahi_simple_poll_quit(simple_poll);
-#else
- avahi_threaded_poll_quit(threaded_poll);
-#endif
- } else {
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_update(t, &tv);
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- struct timeval tv;
-
-#ifndef USE_THREAD
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
- api = avahi_simple_poll_get(simple_poll);
- assert(api);
-#else
- threaded_poll = avahi_threaded_poll_new();
- assert(threaded_poll);
- api = avahi_threaded_poll_get(threaded_poll);
- assert(api);
-#endif
-
- api->watch_new(api, 0, AVAHI_WATCH_IN, callback, NULL);
-
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_new(api, &tv, wakeup, NULL);
-
-#ifndef USE_THREAD
- /* Our main loop */
- avahi_simple_poll_loop(simple_poll);
- avahi_simple_poll_free(simple_poll);
-
-#else
- avahi_threaded_poll_start(threaded_poll);
-
- fprintf(stderr, "Now doing some stupid stuff ...\n");
- sleep(20);
- fprintf(stderr, "... stupid stuff is done.\n");
-
- avahi_threaded_poll_free(threaded_poll);
-
-#endif
-
- return 0;
-}
diff --git a/trunk/avahi-common/watch.h b/trunk/avahi-common/watch.h
deleted file mode 100644
index 80ed888..0000000
--- a/trunk/avahi-common/watch.h
+++ /dev/null
@@ -1,99 +0,0 @@
-#ifndef foowatchhfoo
-#define foowatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file watch.h Simplistic main loop abstraction */
-
-#include <sys/poll.h>
-#include <sys/time.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** An I/O watch object */
-typedef struct AvahiWatch AvahiWatch;
-
-/** A timeout watch object */
-typedef struct AvahiTimeout AvahiTimeout;
-
-/** An event polling abstraction object */
-typedef struct AvahiPoll AvahiPoll;
-
-/** Type of watch events */
-typedef enum {
- AVAHI_WATCH_IN = POLLIN, /**< Input event */
- AVAHI_WATCH_OUT = POLLOUT, /**< Output event */
- AVAHI_WATCH_ERR = POLLERR, /**< Error event */
- AVAHI_WATCH_HUP = POLLHUP /**< Hangup event */
-} AvahiWatchEvent;
-
-/** Called whenever an I/O event happens on an I/O watch */
-typedef void (*AvahiWatchCallback)(AvahiWatch *w, int fd, AvahiWatchEvent event, void *userdata);
-
-/** Called when the timeout is reached */
-typedef void (*AvahiTimeoutCallback)(AvahiTimeout *t, void *userdata);
-
-/** Defines an abstracted event polling API. This may be used to
- connect Avahi to other main loops. This is losely based on Unix
- poll(2). A consumer will call watch_new() for all file descriptors it
- wants to listen for events on. In addition he can call timeout_new()
- to define time based events .*/
-struct AvahiPoll {
-
- /** Some abstract user data usable by the provider of the API */
- void* userdata;
-
- /** Create a new watch for the specified file descriptor and for
- * the specified events. The API will call the callback function
- * whenever any of the events happens. */
- AvahiWatch* (*watch_new)(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void *userdata);
-
- /** Update the events to wait for. It is safe to call this function from an AvahiWatchCallback */
- void (*watch_update)(AvahiWatch *w, AvahiWatchEvent event);
-
- /** Return the events that happened. It is safe to call this function from an AvahiWatchCallback */
- AvahiWatchEvent (*watch_get_events)(AvahiWatch *w);
-
- /** Free a watch. It is safe to call this function from an AvahiWatchCallback */
- void (*watch_free)(AvahiWatch *w);
-
- /** Set a wakeup time for the polling loop. The API will call the
- callback function when the absolute time *tv is reached. If tv is
- NULL, the timeout is disabled. After the timeout expired the
- callback function will be called and the timeout is disabled. You
- can reenable it by calling timeout_update() */
- AvahiTimeout* (*timeout_new)(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata);
-
- /** Update the absolute expiration time for a timeout, If tv is
- * null, the timeout is disabled. It is safe to call this function from an AvahiTimeoutCallback */
- void (*timeout_update)(AvahiTimeout *, const struct timeval *tv);
-
- /** Free a timeout. It is safe to call this function from an AvahiTimeoutCallback */
- void (*timeout_free)(AvahiTimeout *t);
-};
-
-AVAHI_C_DECL_END
-
-#endif
-
diff --git a/trunk/avahi-compat-howl.pc.in b/trunk/avahi-compat-howl.pc.in
deleted file mode 100644
index b3cd02a..0000000
--- a/trunk/avahi-compat-howl.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include/avahi-compat-howl/
-
-Name: avahi-compat-howl
-Description: Avahi Multicast DNS Responder (HOWL Compatibility)
-Version: @HOWL_COMPAT_VERSION@
-Libs: -L${libdir} -lhowl
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/trunk/avahi-compat-howl/Makefile.am b/trunk/avahi-compat-howl/Makefile.am
deleted file mode 100644
index 961be64..0000000
--- a/trunk/avahi-compat-howl/Makefile.am
+++ /dev/null
@@ -1,111 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-SUBDIRS = . samples
-
-if HAVE_DBUS
-if ENABLE_COMPAT_HOWL
-
-avahi_compat_howldir=$(includedir)/avahi-compat-howl
-avahi_compat_howl_rendezvousdir=$(avahi_compat_howldir)/rendezvous
-avahi_compat_howl_corbydir=$(avahi_compat_howldir)/corby
-avahi_compat_howl_discoverydir=$(avahi_compat_howldir)/discovery
-avahi_compat_howl_saltdir=$(avahi_compat_howldir)/salt
-
-avahi_compat_howl_HEADERS = \
- include/howl.h
-
-avahi_compat_howl_rendezvous_HEADERS = \
- include/rendezvous/rendezvous.h \
- include/rendezvous/text_record.h
-
-avahi_compat_howl_corby_HEADERS = \
- include/corby/message.h \
- include/corby/object.h \
- include/corby/orb.h \
- include/corby/corby.h \
- include/corby/channel.h \
- include/corby/buffer.h
-
-avahi_compat_howl_discovery_HEADERS = \
- include/discovery/discovery.h \
- include/discovery/text_record.h
-
-avahi_compat_howl_salt_HEADERS = \
- include/salt/socket.h \
- include/salt/address.h \
- include/salt/platform.h \
- include/salt/signal.h \
- include/salt/interface.h \
- include/salt/salt.h \
- include/salt/time.h \
- include/salt/debug.h
-
-HOWLHEADERS = \
- $(avahi_compat_howl_HEADERS) \
- $(avahi_compat_howl_rendezvous_HEADERS) \
- $(avahi_compat_howl_corby_HEADERS) \
- $(avahi_compat_howl_discovery_HEADERS) \
- $(avahi_compat_howl_salt_HEADERS)
-
-lib_LTLIBRARIES = libhowl.la
-
-if ENABLE_TESTS
-noinst_PROGRAMS = address-test text-test browse-domain-test
-endif
-
-libhowl_la_SOURCES = \
- $(HOWLHEADERS) \
- warn.c warn.h \
- unsupported.c \
- address.c \
- text.c \
- compat.c
-libhowl_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-libhowl_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_COMPAT_HOWL_VERSION_INFO) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la
-
-address_test_SOURCES = \
- $(HOWLHEADERS) \
- address.c \
- address-test.c \
- warn.c warn.h
-address_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-address_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la
-
-text_test_SOURCES = \
- $(HOWLHEADERS) \
- text.c \
- text-test.c \
- warn.c warn.h
-text_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-text_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la
-
-browse_domain_test_SOURCES = \
- $(HOWLHEADERS) \
- browse-domain-test.c
-browse_domain_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-browse_domain_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) libhowl.la
-
-endif
-endif
diff --git a/trunk/avahi-compat-howl/address-test.c b/trunk/avahi-compat-howl/address-test.c
deleted file mode 100644
index 05276aa..0000000
--- a/trunk/avahi-compat-howl/address-test.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-
-#include "howl.h"
-
-#define ASSERT_SW_OKAY(t) { sw_result r; r = (t); assert(r == SW_OKAY); }
-#define ASSERT_NOT_NULL(t) { const void* r; r = (t); assert(r); }
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- sw_ipv4_address a;
- char t[256];
- uint8_t a1, a2, a3, a4;
-
- ASSERT_SW_OKAY(sw_ipv4_address_init_from_name(&a, "heise.de"));
- ASSERT_NOT_NULL(sw_ipv4_address_name(a, t, sizeof(t)));
- printf("%s\n", t);
-
- ASSERT_SW_OKAY(sw_ipv4_address_init_from_this_host(&a));
- ASSERT_NOT_NULL(sw_ipv4_address_name(a, t, sizeof(t)));
- printf("%s\n", t);
-
- ASSERT_SW_OKAY(sw_ipv4_address_decompose(a, &a1, &a2, &a3, &a4));
- printf("%i.%i.%i.%i\n", a1, a2, a3, a4);
-
- return 0;
-}
diff --git a/trunk/avahi-compat-howl/address.c b/trunk/avahi-compat-howl/address.c
deleted file mode 100644
index 1d9fbbe..0000000
--- a/trunk/avahi-compat-howl/address.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-
-#include <avahi-common/gccmacro.h>
-
-#include "howl.h"
-#include "warn.h"
-
-sw_ipv4_address sw_ipv4_address_any(void) {
- sw_ipv4_address a;
-
- AVAHI_WARN_LINKAGE;
-
- a.m_addr = htonl(INADDR_ANY);
- return a;
-}
-
-sw_ipv4_address sw_ipv4_address_loopback(void) {
- sw_ipv4_address a;
-
- AVAHI_WARN_LINKAGE;
-
- a.m_addr = htonl(INADDR_LOOPBACK);
- return a;
-}
-
-sw_result sw_ipv4_address_init(sw_ipv4_address * self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- self->m_addr = htonl(INADDR_ANY);
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_saddr(
- sw_ipv4_address *self,
- sw_saddr addr) {
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- self->m_addr = addr;
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_name(
- sw_ipv4_address *self,
- sw_const_string name) {
-
- struct hostent *he;
-
- assert(self);
- assert(name);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(he = gethostbyname(name)))
- return SW_E_UNKNOWN;
-
- self->m_addr = *(uint32_t*) he->h_addr;
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_address(
- sw_ipv4_address *self,
- sw_ipv4_address addr) {
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- self->m_addr = addr.m_addr;
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_init_from_this_host(sw_ipv4_address *self) {
- struct sockaddr_in sa;
- int fd;
- socklen_t l = sizeof(sa);
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- /* This is so fucked up ... */
-
- memset(&sa, 0, sizeof(sa));
- sa.sin_family = AF_INET;
- sa.sin_addr.s_addr = inet_addr("192.168.1.1"); /* Ouch */
- sa.sin_port = htons(5555);
-
- if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0 ||
- connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0 ||
- getsockname(fd, (struct sockaddr*) &sa, &l) < 0) {
- if (fd >= 0)
- close(fd);
-
- perror("fuck");
- return SW_E_UNKNOWN;
- }
-
- assert(l == sizeof(sa));
- close(fd);
-
- self->m_addr = sa.sin_addr.s_addr;
-
- return SW_OKAY;
-}
-
-sw_result sw_ipv4_address_fina(AVAHI_GCC_UNUSED sw_ipv4_address self) {
-
- AVAHI_WARN_LINKAGE;
-
- /* This is ridiculous ... */
-
- return SW_OKAY;
-}
-
-sw_bool sw_ipv4_address_is_any(sw_ipv4_address self) {
- AVAHI_WARN_LINKAGE;
- return self.m_addr == htonl(INADDR_ANY);
-}
-
-sw_saddr sw_ipv4_address_saddr(sw_ipv4_address self) {
- AVAHI_WARN_LINKAGE;
- return self.m_addr;
-}
-
-sw_string sw_ipv4_address_name(
- sw_ipv4_address self,
- sw_string name,
- sw_uint32 len) {
-
- assert(name);
- assert(len > 0);
-
- AVAHI_WARN_LINKAGE;
-
- if (len < INET_ADDRSTRLEN)
- return NULL;
-
- if (!(inet_ntop(AF_INET, &self.m_addr, name, len)))
- return NULL;
-
- return name;
-}
-
-sw_result sw_ipv4_address_decompose(
- sw_ipv4_address self,
- sw_uint8 * a1,
- sw_uint8 * a2,
- sw_uint8 * a3,
- sw_uint8 * a4) {
-
- uint32_t a;
-
- AVAHI_WARN_LINKAGE;
-
- a = ntohl(self.m_addr);
-
- assert(a1);
- assert(a2);
- assert(a3);
- assert(a4);
-
- *a1 = (uint8_t) (a >> 24);
- *a2 = (uint8_t) (a >> 16);
- *a3 = (uint8_t) (a >> 8);
- *a4 = (uint8_t) (a);
-
- return SW_OKAY;
-}
-
-sw_bool sw_ipv4_address_equals(
- sw_ipv4_address self,
- sw_ipv4_address addr) {
-
- AVAHI_WARN_LINKAGE;
-
- return self.m_addr == addr.m_addr;
-}
-
diff --git a/trunk/avahi-compat-howl/browse-domain-test.c b/trunk/avahi-compat-howl/browse-domain-test.c
deleted file mode 100644
index be99d92..0000000
--- a/trunk/avahi-compat-howl/browse-domain-test.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include "howl.h"
-
-#define ASSERT_SW_OKAY(t) { sw_result _r; _r = (t); assert(_r == SW_OKAY); }
-#define ASSERT_NOT_NULL(t) { const void* _r; r = (t); assert(_r); }
-
-static sw_result reply(
- AVAHI_GCC_UNUSED sw_discovery discovery,
- AVAHI_GCC_UNUSED sw_discovery_oid oid,
- sw_discovery_browse_status status,
- AVAHI_GCC_UNUSED sw_uint32 interface_index,
- AVAHI_GCC_UNUSED sw_const_string name,
- AVAHI_GCC_UNUSED sw_const_string type,
- sw_const_string domain,
- AVAHI_GCC_UNUSED sw_opaque extra) {
-
- switch (status) {
- case SW_DISCOVERY_BROWSE_ADD_DOMAIN:
- fprintf(stderr, "new domain %s\n", domain);
- break;
-
- case SW_DISCOVERY_BROWSE_REMOVE_DOMAIN:
- fprintf(stderr, "removed domain %s\n", domain);
- break;
-
- case SW_DISCOVERY_BROWSE_INVALID:
- fprintf(stderr, "some kind of failure happened: %s\n", domain);
- break;
-
- default:
- abort();
- }
-
- return SW_OKAY;
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- sw_discovery discovery;
- sw_discovery_oid oid;
-
- ASSERT_SW_OKAY(sw_discovery_init(&discovery));
-
- ASSERT_SW_OKAY(sw_discovery_browse_domains(discovery, 0, reply, NULL, &oid));
-
- ASSERT_SW_OKAY(sw_discovery_run(discovery));
-
- return 0;
-}
diff --git a/trunk/avahi-compat-howl/compat.c b/trunk/avahi-compat-howl/compat.c
deleted file mode 100644
index e436208..0000000
--- a/trunk/avahi-compat-howl/compat.c
+++ /dev/null
@@ -1,1184 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-
-#include <pthread.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/llist.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-#include <avahi-client/lookup.h>
-
-#include "howl.h"
-#include "warn.h"
-
-#define OID_MAX 50
-
-enum {
- COMMAND_POLL = 'p',
- COMMAND_QUIT = 'q',
- COMMAND_POLL_DONE = 'P',
- COMMAND_POLL_FAILED = 'F'
-};
-
-typedef enum {
- OID_UNUSED = 0,
- OID_SERVICE_BROWSER,
- OID_SERVICE_RESOLVER,
- OID_DOMAIN_BROWSER,
- OID_ENTRY_GROUP
-} oid_type;
-
-typedef struct service_data service_data;
-
-typedef struct oid_data {
- oid_type type;
- sw_opaque extra;
- sw_discovery discovery;
- void *object;
- sw_result (*reply)(void);
- service_data *service_data;
-} oid_data;
-
-
-struct service_data {
- char *name, *regtype, *domain, *host;
- uint16_t port;
- AvahiIfIndex interface;
- AvahiStringList *txt;
- AVAHI_LLIST_FIELDS(service_data, services);
-};
-
-struct _sw_discovery {
- int n_ref;
- AvahiSimplePoll *simple_poll;
- AvahiClient *client;
-
- oid_data oid_table[OID_MAX];
- sw_discovery_oid oid_index;
-
- int thread_fd, main_fd;
-
- pthread_t thread;
- int thread_running;
-
- pthread_mutex_t mutex, salt_mutex;
-
- AVAHI_LLIST_HEAD(service_data, services);
-};
-
-#define ASSERT_SUCCESS(r) { int __ret = (r); assert(__ret == 0); }
-
-#define OID_GET_INDEX(data) ((sw_discovery_oid) (((data) - ((data)->discovery->oid_table))))
-
-static sw_discovery discovery_ref(sw_discovery self);
-static void discovery_unref(sw_discovery self);
-
-static const char *add_trailing_dot(const char *s, char *buf, size_t buf_len) {
- if (!s)
- return NULL;
-
- if (*s == 0)
- return s;
-
- if (s[strlen(s)-1] == '.')
- return s;
-
- snprintf(buf, buf_len, "%s.", s);
- return buf;
-}
-
-static sw_result map_error(int error) {
- switch (error) {
- case AVAHI_OK:
- return SW_OKAY;
-
- case AVAHI_ERR_NO_MEMORY:
- return SW_E_MEM;
- }
-
- return SW_E_UNKNOWN;
-}
-
-static int read_command(int fd) {
- ssize_t r;
- char command;
-
- assert(fd >= 0);
-
- if ((r = read(fd, &command, 1)) != 1) {
- fprintf(stderr, __FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- return -1;
- }
-
- return command;
-}
-
-static int write_command(int fd, char reply) {
- assert(fd >= 0);
-
- if (write(fd, &reply, 1) != 1) {
- fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int poll_func(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
- sw_discovery self = userdata;
- int ret;
-
- assert(self);
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
- ret = poll(ufds, nfds, timeout);
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- return ret;
-}
-
-static void * thread_func(void *data) {
- sw_discovery self = data;
- sigset_t mask;
-
- sigfillset(&mask);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
- self->thread = pthread_self();
- self->thread_running = 1;
-
- for (;;) {
- char command;
-
- if ((command = read_command(self->thread_fd)) < 0)
- break;
-
-/* fprintf(stderr, "Command: %c\n", command); */
-
- switch (command) {
-
- case COMMAND_POLL: {
- int ret;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- for (;;) {
- errno = 0;
-
- if ((ret = avahi_simple_poll_run(self->simple_poll)) < 0) {
-
- if (errno == EINTR)
- continue;
-
- fprintf(stderr, __FILE__": avahi_simple_poll_run() failed: %s\n", strerror(errno));
- }
-
- break;
- }
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (write_command(self->thread_fd, ret < 0 ? COMMAND_POLL_FAILED : COMMAND_POLL_DONE) < 0)
- break;
-
- break;
- }
-
- case COMMAND_QUIT:
- return NULL;
- }
-
- }
-
- return NULL;
-}
-
-static int oid_alloc(sw_discovery self, oid_type type) {
- sw_discovery_oid i;
- assert(self);
-
- for (i = 0; i < OID_MAX; i++) {
-
- while (self->oid_index >= OID_MAX)
- self->oid_index -= OID_MAX;
-
- if (self->oid_table[self->oid_index].type == OID_UNUSED) {
- self->oid_table[self->oid_index].type = type;
- self->oid_table[self->oid_index].discovery = self;
-
- assert(OID_GET_INDEX(&self->oid_table[self->oid_index]) == self->oid_index);
-
- return self->oid_index ++;
- }
-
- self->oid_index ++;
- }
-
- /* No free entry found */
-
- return (sw_discovery_oid) -1;
-}
-
-static void oid_release(sw_discovery self, sw_discovery_oid oid) {
- assert(self);
- assert(oid < OID_MAX);
-
- assert(self->oid_table[oid].type != OID_UNUSED);
-
- self->oid_table[oid].type = OID_UNUSED;
- self->oid_table[oid].discovery = NULL;
- self->oid_table[oid].reply = NULL;
- self->oid_table[oid].object = NULL;
- self->oid_table[oid].extra = NULL;
- self->oid_table[oid].service_data = NULL;
-}
-
-static oid_data* oid_get(sw_discovery self, sw_discovery_oid oid) {
- assert(self);
-
- if (oid >= OID_MAX)
- return NULL;
-
- if (self->oid_table[oid].type == OID_UNUSED)
- return NULL;
-
- return &self->oid_table[oid];
-}
-
-static service_data* service_data_new(sw_discovery self) {
- service_data *sdata;
-
- assert(self);
-
- if (!(sdata = avahi_new0(service_data, 1)))
- return NULL;
-
- AVAHI_LLIST_PREPEND(service_data, services, self->services, sdata);
-
- return sdata;
-
-}
-
-static void service_data_free(sw_discovery self, service_data* sdata) {
- assert(self);
- assert(sdata);
-
- AVAHI_LLIST_REMOVE(service_data, services, self->services, sdata);
-
- avahi_free(sdata->name);
- avahi_free(sdata->regtype);
- avahi_free(sdata->domain);
- avahi_free(sdata->host);
- avahi_string_list_free(sdata->txt);
- avahi_free(sdata);
-}
-
-static void reg_client_callback(oid_data *data, AvahiClientState state);
-
-static void client_callback(AvahiClient *s, AvahiClientState state, void* userdata) {
- sw_discovery self = userdata;
- sw_discovery_oid oid;
-
- assert(s);
- assert(self);
-
- discovery_ref(self);
-
- for (oid = 0; oid < OID_MAX; oid++) {
-
- switch (self->oid_table[oid].type) {
-
- case OID_ENTRY_GROUP:
- reg_client_callback(&self->oid_table[oid], state);
- break;
-
- case OID_DOMAIN_BROWSER:
- case OID_SERVICE_BROWSER:
- ((sw_discovery_browse_reply) self->oid_table[oid].reply)(self, oid, SW_DISCOVERY_BROWSE_INVALID, 0, NULL, NULL, NULL, self->oid_table[oid].extra);
- break;
-
- case OID_SERVICE_RESOLVER:
- case OID_UNUSED:
- ;
- }
- }
-
- discovery_unref(self);
-}
-
-sw_result sw_discovery_init(sw_discovery * self) {
- int fd[2] = { -1, -1};
- sw_result result = SW_E_UNKNOWN;
- pthread_mutexattr_t mutex_attr;
- int error;
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- *self = NULL;
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0)
- goto fail;
-
- if (!(*self = avahi_new(struct _sw_discovery, 1))) {
- result = SW_E_MEM;
- goto fail;
- }
-
- (*self)->n_ref = 1;
- (*self)->thread_fd = fd[0];
- (*self)->main_fd = fd[1];
-
- (*self)->client = NULL;
- (*self)->simple_poll = NULL;
-
- memset((*self)->oid_table, 0, sizeof((*self)->oid_table));
- (*self)->oid_index = 0;
-
- (*self)->thread_running = 0;
-
- AVAHI_LLIST_HEAD_INIT(service_info, (*self)->services);
-
- ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
- pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
- ASSERT_SUCCESS(pthread_mutex_init(&(*self)->mutex, &mutex_attr));
- ASSERT_SUCCESS(pthread_mutex_init(&(*self)->salt_mutex, &mutex_attr));
-
- if (!((*self)->simple_poll = avahi_simple_poll_new()))
- goto fail;
-
- avahi_simple_poll_set_func((*self)->simple_poll, poll_func, *self);
-
- if (!((*self)->client = avahi_client_new(avahi_simple_poll_get((*self)->simple_poll), 0, client_callback, *self, &error))) {
- result = map_error(error);
- goto fail;
- }
-
- /* Start simple poll */
- if (avahi_simple_poll_prepare((*self)->simple_poll, -1) < 0)
- goto fail;
-
- /* Queue an initial POLL command for the thread */
- if (write_command((*self)->main_fd, COMMAND_POLL) < 0)
- goto fail;
-
- if (pthread_create(&(*self)->thread, NULL, thread_func, *self) != 0)
- goto fail;
-
- (*self)->thread_running = 1;
-
- return SW_OKAY;
-
-fail:
-
- if (*self)
- sw_discovery_fina(*self);
-
- return result;
-}
-
-static int stop_thread(sw_discovery self) {
- assert(self);
-
- if (!self->thread_running)
- return 0;
-
- if (write_command(self->main_fd, COMMAND_QUIT) < 0)
- return -1;
-
- avahi_simple_poll_wakeup(self->simple_poll);
-
- ASSERT_SUCCESS(pthread_join(self->thread, NULL));
- self->thread_running = 0;
- return 0;
-}
-
-static sw_discovery discovery_ref(sw_discovery self) {
- assert(self);
- assert(self->n_ref >= 1);
-
- self->n_ref++;
-
- return self;
-}
-
-static void discovery_unref(sw_discovery self) {
- assert(self);
- assert(self->n_ref >= 1);
-
- if (--self->n_ref > 0)
- return;
-
- stop_thread(self);
-
- if (self->client)
- avahi_client_free(self->client);
-
- if (self->simple_poll)
- avahi_simple_poll_free(self->simple_poll);
-
- if (self->thread_fd >= 0)
- close(self->thread_fd);
-
- if (self->main_fd >= 0)
- close(self->main_fd);
-
- ASSERT_SUCCESS(pthread_mutex_destroy(&self->mutex));
- ASSERT_SUCCESS(pthread_mutex_destroy(&self->salt_mutex));
-
- while (self->services)
- service_data_free(self, self->services);
-
- avahi_free(self);
-}
-
-sw_result sw_discovery_fina(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- stop_thread(self);
- discovery_unref(self);
-
- return SW_OKAY;
-}
-
-sw_result sw_discovery_run(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- return sw_salt_run((sw_salt) self);
-}
-
-sw_result sw_discovery_stop_run(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- return sw_salt_stop_run((sw_salt) self);
-}
-
-int sw_discovery_socket(sw_discovery self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- return self->main_fd;
-}
-
-sw_result sw_discovery_read_socket(sw_discovery self) {
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
-
- discovery_ref(self);
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- /* Cleanup notification socket */
- if (read_command(self->main_fd) != COMMAND_POLL_DONE)
- goto finish;
-
- if (avahi_simple_poll_dispatch(self->simple_poll) < 0)
- goto finish;
-
- if (self->n_ref > 1) /* Perhaps we should die */
-
- /* Dispatch events */
- if (avahi_simple_poll_prepare(self->simple_poll, -1) < 0)
- goto finish;
-
- if (self->n_ref > 1)
-
- /* Request the poll */
- if (write_command(self->main_fd, COMMAND_POLL) < 0)
- goto finish;
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- discovery_unref(self);
-
- return result;
-}
-
-sw_result sw_discovery_salt(sw_discovery self, sw_salt *salt) {
- assert(self);
- assert(salt);
-
- AVAHI_WARN_LINKAGE;
-
- *salt = (sw_salt) self;
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_step(sw_salt self, sw_uint32 * msec) {
- struct pollfd p;
- int r;
- sw_result result;
-
- AVAHI_WARN_LINKAGE;
-
- if (!((sw_discovery) self)->thread_running)
- return SW_E_UNKNOWN;
-
- memset(&p, 0, sizeof(p));
- p.fd = ((sw_discovery) self)->main_fd;
- p.events = POLLIN;
-
- if ((r = poll(&p, 1, msec ? (int) *msec : -1)) < 0) {
-
- /* Don't treat EINTR as error */
- if (errno == EINTR)
- return SW_OKAY;
-
- return SW_E_UNKNOWN;
-
- } else if (r == 0) {
-
- /* Timeoout */
- return SW_OKAY;
-
- } else {
- /* Success */
-
- if (p.revents != POLLIN)
- return SW_E_UNKNOWN;
-
- if ((result = sw_discovery_read_socket((sw_discovery) self)) != SW_OKAY)
- return result;
- }
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_run(sw_salt self) {
- sw_result ret;
-
- AVAHI_WARN_LINKAGE;
-
- assert(self);
-
- for (;;)
- if ((ret = sw_salt_step(self, NULL)) != SW_OKAY)
- return ret;
-}
-
-sw_result sw_salt_stop_run(sw_salt self) {
- AVAHI_WARN_LINKAGE;
-
- assert(self);
-
- if (stop_thread((sw_discovery) self) < 0)
- return SW_E_UNKNOWN;
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_lock(sw_salt self) {
- AVAHI_WARN_LINKAGE;
-
- assert(self);
- ASSERT_SUCCESS(pthread_mutex_lock(&((sw_discovery) self)->salt_mutex));
-
- return SW_OKAY;
-}
-
-sw_result sw_salt_unlock(sw_salt self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&((sw_discovery) self)->salt_mutex));
-
- return SW_OKAY;
-}
-
-static void reg_report_status(oid_data *data, sw_discovery_publish_status status) {
- sw_discovery_publish_reply reply;
-
- assert(data);
-
- reply = (sw_discovery_publish_reply) data->reply;
-
- reply(data->discovery,
- OID_GET_INDEX(data),
- status,
- data->extra);
-}
-
-static int reg_create_service(oid_data *data) {
- int ret;
- const char *real_type;
-
- assert(data);
-
- real_type = avahi_get_type_from_subtype(data->service_data->regtype);
-
- if ((ret = avahi_entry_group_add_service_strlst(
- data->object,
- data->service_data->interface,
- AVAHI_PROTO_INET,
- 0,
- data->service_data->name,
- real_type ? real_type : data->service_data->regtype,
- data->service_data->domain,
- data->service_data->host,
- data->service_data->port,
- data->service_data->txt)) < 0)
- return ret;
-
- if (real_type) {
- /* Create a subtype entry */
-
- if (avahi_entry_group_add_service_subtype(
- data->object,
- data->service_data->interface,
- AVAHI_PROTO_INET,
- 0,
- data->service_data->name,
- real_type,
- data->service_data->domain,
- data->service_data->regtype) < 0)
- return ret;
-
- }
-
- if ((ret = avahi_entry_group_commit(data->object)) < 0)
- return ret;
-
- return 0;
-}
-
-static void reg_client_callback(oid_data *data, AvahiClientState state) {
- assert(data);
-
- /* We've not been setup completely */
- if (!data->object)
- return;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
- reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
- break;
-
- case AVAHI_CLIENT_S_RUNNING: {
- int ret;
-
- /* Register the service */
- if ((ret = reg_create_service(data)) < 0) {
- reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
- return;
- }
-
- break;
- }
-
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_S_REGISTERING:
-
- /* Remove our entry */
- avahi_entry_group_reset(data->object);
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- /* Ignore */
- break;
- }
-
-}
-
-static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- oid_data *data = userdata;
-
- assert(g);
- assert(data);
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
-
- reg_report_status(data, SW_DISCOVERY_PUBLISH_STARTED);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION:
-
- reg_report_status(data, SW_DISCOVERY_PUBLISH_NAME_COLLISION);
- break;
-
- case AVAHI_ENTRY_GROUP_REGISTERING:
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- /* Ignore */
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
- break;
-
- }
-}
-
-sw_result sw_discovery_publish(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_const_string host,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_discovery_publish_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- sw_result result = SW_E_UNKNOWN;
- service_data *sdata;
- AvahiStringList *txt = NULL;
-
- assert(self);
- assert(name);
- assert(type);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if (text_record && text_record_len > 0)
- if (avahi_string_list_parse(text_record, text_record_len, &txt) < 0)
- return SW_E_UNKNOWN;
-
- if ((*oid = oid_alloc(self, OID_ENTRY_GROUP)) == (sw_discovery_oid) -1) {
- avahi_string_list_free(txt);
- return SW_E_UNKNOWN;
- }
-
- if (!(sdata = service_data_new(self))) {
- avahi_string_list_free(txt);
- oid_release(self, *oid);
- return SW_E_MEM;
- }
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
- data->service_data = sdata;
-
- sdata->interface = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
- sdata->name = avahi_strdup(name);
- sdata->regtype = type ? avahi_normalize_name_strdup(type) : NULL;
- sdata->domain = domain ? avahi_normalize_name_strdup(domain) : NULL;
- sdata->host = host ? avahi_normalize_name_strdup(host) : NULL;
- sdata->port = port;
- sdata->txt = txt;
-
- /* Some OOM checking would be cool here */
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_entry_group_new(self->client, reg_entry_group_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- if (avahi_client_get_state(self->client) == AVAHI_CLIENT_S_RUNNING) {
- int error;
-
- if ((error = reg_create_service(data)) < 0) {
- result = map_error(error);
- goto finish;
- }
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-static void domain_browser_callback(
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- oid_data* data = userdata;
- sw_discovery_browse_reply reply;
- static char domain_fixed[AVAHI_DOMAIN_NAME_MAX];
-
- assert(b);
- assert(data);
-
- reply = (sw_discovery_browse_reply) data->reply;
-
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_ADD_DOMAIN, interface, NULL, NULL, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_REMOVE_DOMAIN, interface, NULL, NULL, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_INVALID, interface, NULL, NULL, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-sw_result sw_discovery_browse_domains(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- AvahiIfIndex ifindex;
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if ((*oid = oid_alloc(self, OID_DOMAIN_BROWSER)) == (sw_discovery_oid) -1)
- return SW_E_UNKNOWN;
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
-
- ifindex = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_domain_browser_new(self->client, ifindex, AVAHI_PROTO_INET, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, domain_browser_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-static void service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- oid_data* data = userdata;
- sw_discovery_resolve_reply reply;
-
- assert(r);
- assert(data);
-
- reply = (sw_discovery_resolve_reply) data->reply;
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
-
- char host_name_fixed[AVAHI_DOMAIN_NAME_MAX];
- uint8_t *p = NULL;
- size_t l = 0;
- sw_ipv4_address addr;
-
- sw_ipv4_address_init_from_saddr(&addr, a->data.ipv4.address);
-
- host_name = add_trailing_dot(host_name, host_name_fixed, sizeof(host_name_fixed));
-
- if ((p = avahi_new0(uint8_t, (l = avahi_string_list_serialize(txt, NULL, 0))+1)))
- avahi_string_list_serialize(txt, p, l);
-
- reply(data->discovery, OID_GET_INDEX(data), interface, name, type, domain, addr, port, p, l, data->extra);
-
- avahi_free(p);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- /* Apparently there is no way in HOWL to inform about failed resolvings ... */
-
- avahi_warn("A service failed to resolve in the HOWL compatiblity layer of Avahi which is used by '%s'. "
- "Since the HOWL API doesn't offer any means to inform the application about this, we have to ignore the failure. "
- "Please fix your application to use the native API of Avahi!",
- avahi_exe_name());
-
- break;
- }
-}
-
-sw_result sw_discovery_resolve(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_resolve_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- AvahiIfIndex ifindex;
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
- assert(name);
- assert(type);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if ((*oid = oid_alloc(self, OID_SERVICE_RESOLVER)) == (sw_discovery_oid) -1)
- return SW_E_UNKNOWN;
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
-
- ifindex = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_service_resolver_new(self->client, ifindex, AVAHI_PROTO_INET, name, type, domain, AVAHI_PROTO_INET, 0, service_resolver_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-static void service_browser_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- oid_data* data = userdata;
- char type_fixed[AVAHI_DOMAIN_NAME_MAX], domain_fixed[AVAHI_DOMAIN_NAME_MAX];
- sw_discovery_browse_reply reply;
-
- assert(b);
- assert(data);
-
- reply = (sw_discovery_browse_reply) data->reply;
-
- type = add_trailing_dot(type, type_fixed, sizeof(type_fixed));
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_ADD_SERVICE, interface, name, type, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_REMOVE_SERVICE, interface, name, type, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- reply(data->discovery, OID_GET_INDEX(data), SW_DISCOVERY_BROWSE_INVALID, interface, name, type, domain, data->extra);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-sw_result sw_discovery_browse(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid) {
-
- oid_data *data;
- AvahiIfIndex ifindex;
- sw_result result = SW_E_UNKNOWN;
-
- assert(self);
- assert(type);
- assert(reply);
- assert(oid);
-
- AVAHI_WARN_LINKAGE;
-
- if ((*oid = oid_alloc(self, OID_SERVICE_BROWSER)) == (sw_discovery_oid) -1)
- return SW_E_UNKNOWN;
-
- data = oid_get(self, *oid);
- assert(data);
- data->reply = (sw_result (*)(void)) reply;
- data->extra = extra;
-
- ifindex = interface_index == 0 ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface_index;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&self->mutex));
-
- if (!(data->object = avahi_service_browser_new(self->client, ifindex, AVAHI_PROTO_INET, type, domain, 0, service_browser_callback, data))) {
- result = map_error(avahi_client_errno(self->client));
- goto finish;
- }
-
- result = SW_OKAY;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
- if (*oid != (sw_discovery_oid) -1)
- sw_discovery_cancel(self, *oid);
-
- return result;
-}
-
-sw_result sw_discovery_cancel(sw_discovery self, sw_discovery_oid oid) {
- oid_data *data;
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(data = oid_get(self, oid)))
- return SW_E_UNKNOWN;
-
- if (data->object) {
- switch (data->type) {
- case OID_SERVICE_BROWSER:
- avahi_service_browser_free(data->object);
- break;
-
- case OID_SERVICE_RESOLVER:
- avahi_service_resolver_free(data->object);
- break;
-
- case OID_DOMAIN_BROWSER:
- avahi_domain_browser_free(data->object);
- break;
-
- case OID_ENTRY_GROUP:
- avahi_entry_group_free(data->object);
- break;
-
- case OID_UNUSED:
- ;
- }
- }
-
- if (data->service_data) {
- assert(data->type == OID_ENTRY_GROUP);
- service_data_free(self, data->service_data);
- }
-
- oid_release(self, oid);
-
- return SW_OKAY;
-}
-
-sw_result sw_discovery_init_with_flags(
- sw_discovery * self,
- sw_discovery_init_flags flags) {
-
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (flags != SW_DISCOVERY_USE_SHARED_SERVICE)
- return SW_E_NO_IMPL;
-
- return sw_discovery_init(self);
-}
diff --git a/trunk/avahi-compat-howl/funcs.txt b/trunk/avahi-compat-howl/funcs.txt
deleted file mode 100644
index 42fbb71..0000000
--- a/trunk/avahi-compat-howl/funcs.txt
+++ /dev/null
@@ -1,184 +0,0 @@
--- Supported --
-
-sw_discovery_init
-sw_discovery_init_with_flags
-sw_discovery_fina
-sw_discovery_publish
-sw_discovery_browse_domains
-sw_discovery_browse
-sw_discovery_resolve
-sw_discovery_cancel
-sw_discovery_run
-sw_discovery_stop_run
-sw_discovery_socket
-sw_discovery_read_socket
-sw_discovery_salt
-
-sw_text_record_init
-sw_text_record_fina
-sw_text_record_add_string
-sw_text_record_add_key_and_string_value
-sw_text_record_add_key_and_binary_value
-sw_text_record_bytes
-sw_text_record_len
-sw_text_record_iterator_init
-sw_text_record_iterator_fina
-sw_text_record_iterator_next
-
-sw_ipv4_address_any
-sw_ipv4_address_loopback
-sw_ipv4_address_init
-sw_ipv4_address_init_from_saddr
-sw_ipv4_address_init_from_name
-sw_ipv4_address_init_from_address
-sw_ipv4_address_init_from_this_host
-sw_ipv4_address_fina
-sw_ipv4_address_is_any
-sw_ipv4_address_saddr
-sw_ipv4_address_name
-sw_ipv4_address_decompose
-sw_ipv4_address_equals
-
-sw_salt_step
-sw_salt_lock
-sw_salt_unlock
-sw_salt_run
-sw_salt_stop_run
-
--- Unsupported but Relevant --
-
-sw_discovery_publish_update
-sw_discovery_publish_host
-sw_discovery_query_record
-
--- Unsupported and Irrelevant --
-
-sw_strdup
-sw_strerror
-sw_timer_init
-sw_timer_fina
-sw_time_init
-sw_time_init_now
-sw_time_fina
-sw_time_add
-sw_time_sub
-sw_time_cmp
-sw_salt_init
-sw_salt_fina
-sw_salt_register_socket
-sw_salt_unregister_socket
-sw_salt_register_timer
-sw_salt_unregister_timer
-sw_salt_register_network_interface
-sw_salt_unregister_network_interface_handler
-sw_salt_register_signal
-sw_salt_unregister_signal
-sw_print_assert
-sw_print_debug
-sw_tcp_socket_init
-sw_tcp_socket_init_with_desc
-sw_udp_socket_init
-sw_multicast_socket_init
-sw_socket_fina
-sw_socket_bind
-sw_socket_join_multicast_group
-sw_socket_leave_multicast_group
-sw_socket_listen
-sw_socket_connect
-sw_socket_accept
-sw_socket_send
-sw_socket_sendto
-sw_socket_recv
-sw_socket_recvfrom
-sw_socket_set_blocking_mode
-sw_socket_set_options
-sw_socket_ipv4_address
-sw_socket_port
-sw_socket_desc
-sw_socket_close
-sw_socket_options_init
-sw_socket_options_fina
-sw_socket_options_set_debug
-sw_socket_options_set_nodelay
-sw_socket_options_set_dontroute
-sw_socket_options_set_keepalive
-sw_socket_options_set_linger
-sw_socket_options_set_reuseaddr
-sw_socket_options_set_rcvbuf
-sw_socket_options_set_sndbuf
-sw_socket_error_code
-sw_corby_orb_init
-sw_corby_orb_fina
-sw_corby_orb_register_servant
-sw_corby_orb_unregister_servant
-sw_corby_orb_register_bidirectional_object
-sw_corby_orb_register_channel
-sw_corby_orb_get_delegate
-sw_corby_orb_set_delegate
-sw_corby_orb_set_observer
-sw_corby_orb_protocol_to_address
-sw_corby_orb_protocol_to_url
-sw_corby_orb_read_channel
-sw_corby_orb_dispatch_message
-sw_corby_message_init
-sw_corby_message_fina
-sw_corby_buffer_init
-sw_corby_buffer_init_with_size
-sw_corby_buffer_init_with_delegate
-sw_corby_buffer_init_with_size_and_delegate
-sw_corby_buffer_fina
-sw_corby_buffer_reset
-sw_corby_buffer_set_octets
-sw_corby_buffer_octets
-sw_corby_buffer_bytes_used
-sw_corby_buffer_size
-sw_corby_buffer_put_int8
-sw_corby_buffer_put_uint8
-sw_corby_buffer_put_int16
-sw_corby_buffer_put_uint16
-sw_corby_buffer_put_int32
-sw_corby_buffer_put_uint32
-sw_corby_buffer_put_octets
-sw_corby_buffer_put_sized_octets
-sw_corby_buffer_put_cstring
-sw_corby_buffer_put_object
-sw_corby_buffer_put_pad
-sw_corby_buffer_get_int8
-sw_corby_buffer_get_uint8
-sw_corby_buffer_get_int16
-sw_corby_buffer_get_uint16
-sw_corby_buffer_get_int32
-sw_corby_buffer_get_uint32
-sw_corby_buffer_get_octets
-sw_corby_buffer_allocate_and_get_sized_octets
-sw_corby_buffer_get_zerocopy_sized_octets
-sw_corby_buffer_get_sized_octets
-sw_corby_buffer_allocate_and_get_cstring
-sw_corby_buffer_get_zerocopy_cstring
-sw_corby_buffer_get_cstring
-sw_corby_buffer_get_object
-sw_corby_channel_start_request
-sw_corby_channel_start_reply
-sw_corby_channel_send
-sw_corby_channel_recv
-sw_corby_channel_last_recv_from
-sw_corby_channel_ff
-sw_corby_channel_socket
-sw_corby_channel_retain
-sw_corby_channel_set_delegate
-sw_corby_channel_get_delegate
-sw_corby_channel_set_app_data
-sw_corby_channel_get_app_data
-sw_corby_channel_fina
-sw_corby_object_init_from_url
-sw_corby_object_fina
-sw_corby_object_start_request
-sw_corby_object_send
-sw_corby_object_recv
-sw_corby_object_channel
-sw_corby_object_set_channel
-sw_text_record_string_iterator_init
-sw_text_record_string_iterator_fina
-sw_text_record_string_iterator_next
-
-$Id$
diff --git a/trunk/avahi-compat-howl/include/corby/buffer.h b/trunk/avahi-compat-howl/include/corby/buffer.h
deleted file mode 100644
index 017ad5d..0000000
--- a/trunk/avahi-compat-howl/include/corby/buffer.h
+++ /dev/null
@@ -1,330 +0,0 @@
-#ifndef _sw_corby_buffer_h
-#define _sw_corby_buffer_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <corby/corby.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_corby_buffer;
-typedef struct _sw_corby_buffer * sw_corby_buffer;
-struct _sw_corby_object;
-typedef sw_opaque sw_corby_buffer_delegate;
-typedef sw_opaque sw_corby_buffer_observer;
-
-
-typedef enum _sw_corby_buffer_pad
-{
- SW_CORBY_BUFFER_PAD_NONE,
- SW_CORBY_BUFFER_PAD_ALIGN_2,
- SW_CORBY_BUFFER_PAD_ALIGN_4,
- SW_CORBY_BUFFER_PAD_ALIGN_8,
- SW_CORBY_BUFFER_PAD_ALIGN_16,
- SW_CORBY_BUFFER_PAD_ALIGN_32
-} sw_corby_buffer_pad;
-
-
-typedef sw_result
-(HOWL_API* sw_corby_buffer_written_func)(
- sw_corby_buffer_observer observer,
- sw_corby_buffer buffer,
- sw_result result,
- sw_size_t bytesWritten,
- sw_opaque_t extra);
-
-
-typedef sw_result
-(HOWL_API* sw_corby_buffer_overflow_func)(
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer buffer,
- sw_uint8 octet,
- sw_uint8 ** base,
- sw_uint8 ** bptr,
- sw_uint8 ** eptr,
- sw_uint8 ** end,
- sw_opaque_t extra);
-
-
-typedef sw_result
-(HOWL_API* sw_corby_buffer_underflow_func)(
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer buffer,
- sw_uint8 * octet,
- sw_uint8 ** base,
- sw_uint8 ** bptr,
- sw_uint8 ** eptr,
- sw_uint8 ** end,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init(
- sw_corby_buffer * self);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init_with_size(
- sw_corby_buffer * self,
- sw_size_t size);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init_with_delegate(
- sw_corby_buffer * self,
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer_overflow_func overflow,
- sw_corby_buffer_underflow_func underflow,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_buffer_init_with_size_and_delegate(
- sw_corby_buffer * self,
- sw_size_t size,
- sw_corby_buffer_delegate delegate,
- sw_corby_buffer_overflow_func overflow,
- sw_corby_buffer_underflow_func underflow,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_buffer_fina(
- sw_corby_buffer self);
-
-
-void HOWL_API
-sw_corby_buffer_reset(
- sw_corby_buffer self);
-
-
-sw_result HOWL_API
-sw_corby_buffer_set_octets(
- sw_corby_buffer self,
- sw_octets octets,
- sw_size_t size);
-
-
-sw_octets HOWL_API
-sw_corby_buffer_octets(
- sw_corby_buffer self);
-
-
-sw_size_t HOWL_API
-sw_corby_buffer_bytes_used(
- sw_corby_buffer self);
-
-
-sw_size_t HOWL_API
-sw_corby_buffer_size(
- sw_corby_buffer self);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_int8(
- sw_corby_buffer self,
- sw_int8 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_uint8(
- sw_corby_buffer self,
- sw_uint8 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_int16(
- sw_corby_buffer self,
- sw_int16 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_uint16(
- sw_corby_buffer self,
- sw_uint16 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_int32(
- sw_corby_buffer self,
- sw_int32 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_uint32(
- sw_corby_buffer self,
- sw_uint32 val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_octets(
- sw_corby_buffer self,
- sw_const_octets val,
- sw_size_t size);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_sized_octets(
- sw_corby_buffer self,
- sw_const_octets val,
- sw_uint32 len);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_cstring(
- sw_corby_buffer self,
- sw_const_string val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_object(
- sw_corby_buffer self,
- const struct _sw_corby_object * object);
-
-
-sw_result HOWL_API
-sw_corby_buffer_put_pad(
- sw_corby_buffer self,
- sw_corby_buffer_pad pad);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_int8(
- sw_corby_buffer self,
- sw_int8 * val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_uint8(
- sw_corby_buffer self,
- sw_uint8 * val);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_int16(
- sw_corby_buffer self,
- sw_int16 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_uint16(
- sw_corby_buffer self,
- sw_uint16 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_int32(
- sw_corby_buffer self,
- sw_int32 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_uint32(
- sw_corby_buffer self,
- sw_uint32 * val,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_octets(
- sw_corby_buffer self,
- sw_octets octets,
- sw_size_t size);
-
-
-sw_result HOWL_API
-sw_corby_buffer_allocate_and_get_sized_octets(
- sw_corby_buffer self,
- sw_octets * val,
- sw_uint32 * size,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_zerocopy_sized_octets(
- sw_corby_buffer self,
- sw_octets * val,
- sw_uint32 * size,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_sized_octets(
- sw_corby_buffer self,
- sw_octets val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_allocate_and_get_cstring(
- sw_corby_buffer self,
- sw_string * val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_zerocopy_cstring(
- sw_corby_buffer self,
- sw_string * val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_cstring(
- sw_corby_buffer self,
- sw_string val,
- sw_uint32 * len,
- sw_uint8 endian);
-
-
-sw_result HOWL_API
-sw_corby_buffer_get_object(
- sw_corby_buffer self,
- struct _sw_corby_object ** object,
- sw_uint8 endian);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/corby/channel.h b/trunk/avahi-compat-howl/include/corby/channel.h
deleted file mode 100644
index 823e027..0000000
--- a/trunk/avahi-compat-howl/include/corby/channel.h
+++ /dev/null
@@ -1,186 +0,0 @@
-#ifndef _sw_corby_channel_h
-#define _sw_corby_channel_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/socket.h>
-#include <corby/corby.h>
-#include <corby/buffer.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-struct _sw_corby_channel;
-typedef struct _sw_corby_channel * sw_corby_channel;
-struct _sw_corby_message;
-struct _sw_corby_profile;
-typedef struct _sw_corby_profile * sw_corby_profile;
-typedef struct _sw_corby_profile const * sw_const_corby_profile;
-
-
-typedef enum _sw_corby_reply_status
-{
- SW_CORBY_NO_EXCEPTION = 0,
- SW_CORBY_SYSTEM_EXCEPTION = 1,
- SW_CORBY_USER_EXCEPTION = 2,
- SW_CORBY_LOCATION_FORWARD = 3
-} sw_corby_reply_status;
-
-
-typedef sw_result
-(HOWL_API *sw_corby_channel_will_send_func)(
- sw_corby_channel channel,
- sw_octets bytes,
- sw_size_t len,
- sw_opaque_t extra);
-
-
-typedef sw_result
-(HOWL_API *sw_corby_channel_did_read_func)(
- sw_corby_channel channel,
- sw_octets bytes,
- sw_size_t len,
- sw_opaque_t extra);
-
-
-typedef void
-(HOWL_API *sw_corby_channel_cleanup_func)(
- sw_corby_channel channel);
-
-
-typedef struct _sw_corby_channel_delegate
-{
- sw_opaque_t m_delegate;
- sw_corby_channel_will_send_func m_will_send_func;
- sw_corby_channel_did_read_func m_did_read_func;
- sw_corby_channel_cleanup_func m_cleanup_func;
- sw_opaque_t m_extra;
-} * sw_corby_channel_delegate;
-
-
-sw_result HOWL_API
-sw_corby_channel_start_request(
- sw_corby_channel self,
- sw_const_corby_profile profile,
- struct _sw_corby_buffer ** buffer,
- sw_const_string op,
- sw_uint32 oplen,
- sw_bool reply_expected);
-
-
-sw_result HOWL_API
-sw_corby_channel_start_reply(
- sw_corby_channel self,
- struct _sw_corby_buffer ** buffer,
- sw_uint32 request_id,
- sw_corby_reply_status status);
-
-
-sw_result HOWL_API
-sw_corby_channel_send(
- sw_corby_channel self,
- struct _sw_corby_buffer * buffer,
- sw_corby_buffer_observer observer,
- sw_corby_buffer_written_func func,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_channel_recv(
- sw_corby_channel self,
- sw_salt * salt,
- struct _sw_corby_message ** message,
- sw_uint32 * request_id,
- sw_string * op,
- sw_uint32 * op_len,
- struct _sw_corby_buffer ** buffer,
- sw_uint8 * endian,
- sw_bool block);
-
-
-sw_result HOWL_API
-sw_corby_channel_last_recv_from(
- sw_corby_channel self,
- sw_ipv4_address * from,
- sw_port * from_port);
-
-
-sw_result HOWL_API
-sw_corby_channel_ff(
- sw_corby_channel self,
- struct _sw_corby_buffer * buffer);
-
-
-sw_socket HOWL_API
-sw_corby_channel_socket(
- sw_corby_channel self);
-
-
-sw_result HOWL_API
-sw_corby_channel_retain(
- sw_corby_channel self);
-
-
-sw_result HOWL_API
-sw_corby_channel_set_delegate(
- sw_corby_channel self,
- sw_corby_channel_delegate delegate);
-
-
-sw_corby_channel_delegate HOWL_API
-sw_corby_channel_get_delegate(
- sw_corby_channel self);
-
-
-void HOWL_API
-sw_corby_channel_set_app_data(
- sw_corby_channel self,
- sw_opaque app_data);
-
-
-sw_opaque HOWL_API
-sw_corby_channel_get_app_data(
- sw_corby_channel self);
-
-
-sw_result HOWL_API
-sw_corby_channel_fina(
- sw_corby_channel self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/corby/corby.h b/trunk/avahi-compat-howl/include/corby/corby.h
deleted file mode 100644
index 7d68138..0000000
--- a/trunk/avahi-compat-howl/include/corby/corby.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef _corby_corby_h
-#define _corby_corby_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-
-/*
- * corby limits
- */
-#define SW_CORBY_OID_LEN 32
-
-
-/*
- * protocol tags. the only standard one is TAG_INTERNET_IIOP.
- * the others are proprietary pandora corby protocols.
- */
-#define SW_TAG_INTERNET_IOP 0
-#define SW_TAG_UIOP 250
-#define SW_TAG_MIOP 251
-#define SW_MIOP_ADDR "231.255.255.250"
-typedef sw_uint32 sw_corby_protocol_tag;
-
-
-/*
- * error codes
- */
-#define SW_E_CORBY_BASE 0x80000500
-#define SW_E_CORBY_UNKNOWN (SW_E_CORBY_BASE + 0)
-#define SW_E_CORBY_BAD_CONFIG (SW_E_CORBY_BASE + 1)
-#define SW_E_CORBY_NO_INTERFACE (SW_E_CORBY_BASE + 2)
-#define SW_E_CORBY_BAD_URL (SW_E_CORBY_BASE + 3)
-#define SW_E_CORBY_BAD_NAME (SW_E_CORBY_BASE + 4)
-#define SW_E_CORBY_BAD_MESSAGE (SW_E_CORBY_BASE + 5)
-#define SW_E_CORBY_BAD_VERSION (SW_E_CORBY_BASE + 6)
-#define SW_E_CORBY_BAD_OID (SW_E_CORBY_BASE + 7)
-#define SW_E_CORBY_BAD_OPERATION (SW_E_CORBY_BASE + 8)
-#define SW_E_CORBY_MARSHAL (SW_E_CORBY_BASE + 10)
-#define SW_E_CORBY_OBJECT_NOT_EXIST (SW_E_CORBY_BASE + 11)
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/corby/message.h b/trunk/avahi-compat-howl/include/corby/message.h
deleted file mode 100644
index 406b9b9..0000000
--- a/trunk/avahi-compat-howl/include/corby/message.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef _sw_corby_message_h
-#define _sw_corby_message_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <corby/corby.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_corby_message;
-typedef struct _sw_corby_message * sw_corby_message;
-
-
-sw_result HOWL_API
-sw_corby_message_init(
- sw_corby_message * self);
-
-
-sw_result HOWL_API
-sw_corby_message_fina(
- sw_corby_message self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/corby/object.h b/trunk/avahi-compat-howl/include/corby/object.h
deleted file mode 100644
index 1bc7407..0000000
--- a/trunk/avahi-compat-howl/include/corby/object.h
+++ /dev/null
@@ -1,113 +0,0 @@
-#ifndef _corby_object_h
-#define _corby_object_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <corby/message.h>
-#include <corby/channel.h>
-#include <corby/buffer.h>
-#include <corby/corby.h>
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-struct _sw_corby_orb;
-struct _sw_corby_object;
-typedef struct _sw_corby_object * sw_corby_object;
-typedef sw_opaque sw_corby_object_send_completion_handler;
-typedef void
-(HOWL_API *sw_corby_object_send_completion_func)(
- sw_corby_object object,
- sw_corby_buffer buffer,
- sw_result result);
-
-
-
-sw_result HOWL_API
-sw_corby_object_init_from_url(
- sw_corby_object * self,
- struct _sw_corby_orb * orb,
- sw_const_string url,
- sw_socket_options options,
- sw_uint32 bufsize);
-
-
-sw_result HOWL_API
-sw_corby_object_fina(
- sw_corby_object self);
-
-
-sw_result HOWL_API
-sw_corby_object_start_request(
- sw_corby_object self,
- sw_const_string op,
- sw_uint32 op_len,
- sw_bool reply_expected,
- sw_corby_buffer * buffer);
-
-
-sw_result HOWL_API
-sw_corby_object_send(
- sw_corby_object self,
- sw_corby_buffer buffer,
- sw_corby_buffer_observer observer,
- sw_corby_buffer_written_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_corby_object_recv(
- sw_corby_object self,
- sw_corby_message * message,
- sw_corby_buffer * buffer,
- sw_uint8 * endian,
- sw_bool block);
-
-
-sw_result HOWL_API
-sw_corby_object_channel(
- sw_corby_object self,
- sw_corby_channel * channel);
-
-
-sw_result HOWL_API
-sw_corby_object_set_channel(
- sw_corby_object self,
- sw_corby_channel channel);
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/corby/orb.h b/trunk/avahi-compat-howl/include/corby/orb.h
deleted file mode 100644
index a674082..0000000
--- a/trunk/avahi-compat-howl/include/corby/orb.h
+++ /dev/null
@@ -1,199 +0,0 @@
-#ifndef _corby_orb_h
-#define _corby_orb_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/address.h>
-#include <salt/socket.h>
-#include <corby/corby.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_corby_orb;
-typedef struct _sw_corby_orb * sw_corby_orb;
-typedef sw_opaque sw_corby_orb_observer;
-typedef sw_opaque sw_corby_servant;
-struct _sw_corby_object;
-struct _sw_corby_channel;
-struct _sw_corby_message;
-struct _sw_corby_buffer;
-
-typedef sw_result
-(HOWL_API *sw_corby_orb_accept_channel_func)(
- sw_corby_orb orb,
- struct _sw_corby_channel * channel);
-
-
-typedef struct _sw_corby_orb_delegate
-{
- sw_opaque m_delegate;
- sw_corby_orb_accept_channel_func m_accept_channel_func;
- sw_opaque m_extra;
-} * sw_corby_orb_delegate;
-
-
-typedef struct _sw_corby_orb_config
-{
- sw_string m_name;
- sw_uint32 m_tag;
- sw_string m_host;
- sw_port m_port;
- sw_string m_options;
-} sw_corby_orb_config;
-
-
-typedef sw_result
-(HOWL_API *sw_corby_servant_cb)(
- sw_corby_servant servant,
- sw_salt salt,
- sw_corby_orb orb,
- struct _sw_corby_channel * channel,
- struct _sw_corby_message * message,
- struct _sw_corby_buffer * buffer,
- sw_const_string op,
- sw_uint32 op_len,
- sw_uint32 request_id,
- sw_uint8 endian);
-
-
-typedef sw_result
-(HOWL_API *sw_corby_orb_observer_func)(
- sw_corby_orb_observer handler,
- sw_salt salt,
- sw_corby_orb orb,
- struct _sw_corby_channel * channel,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_orb_init(
- sw_corby_orb * self,
- sw_salt salt,
- const sw_corby_orb_config * config,
- sw_corby_orb_observer observer,
- sw_corby_orb_observer_func func,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_orb_fina(
- sw_corby_orb self);
-
-
-sw_result HOWL_API
-sw_corby_orb_register_servant(
- sw_corby_orb self,
- sw_corby_servant servant,
- sw_corby_servant_cb cb,
- sw_const_string oid,
- struct _sw_corby_object ** object,
- sw_const_string protocol_name);
-
-
-sw_result HOWL_API
-sw_corby_orb_unregister_servant(
- sw_corby_orb self,
- sw_const_string oid);
-
-
-sw_result HOWL_API
-sw_corby_orb_register_bidirectional_object(
- sw_corby_orb self,
- struct _sw_corby_object * object);
-
-
-sw_result HOWL_API
-sw_corby_orb_register_channel(
- sw_corby_orb self,
- struct _sw_corby_channel * channel);
-
-
-sw_corby_orb_delegate HOWL_API
-sw_corby_orb_get_delegate(
- sw_corby_orb self);
-
-
-sw_result HOWL_API
-sw_corby_orb_set_delegate(
- sw_corby_orb self,
- sw_corby_orb_delegate delegate);
-
-
-sw_result HOWL_API
-sw_corby_orb_set_observer(
- sw_corby_orb self,
- sw_corby_orb_observer observer,
- sw_corby_orb_observer_func func,
- sw_opaque_t extra);
-
-
-sw_result HOWL_API
-sw_corby_orb_protocol_to_address(
- sw_corby_orb self,
- sw_const_string tag,
- sw_string addr,
- sw_port * port);
-
-
-sw_result HOWL_API
-sw_corby_orb_protocol_to_url(
- sw_corby_orb self,
- sw_const_string tag,
- sw_const_string name,
- sw_string url,
- sw_size_t url_len);
-
-
-sw_result HOWL_API
-sw_corby_orb_read_channel(
- sw_corby_orb self,
- struct _sw_corby_channel * channel);
-
-
-sw_result HOWL_API
-sw_corby_orb_dispatch_message(
- sw_corby_orb self,
- struct _sw_corby_channel * channel,
- struct _sw_corby_message * message,
- struct _sw_corby_buffer * buffer,
- sw_uint8 endian);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/discovery/discovery.h b/trunk/avahi-compat-howl/include/discovery/discovery.h
deleted file mode 100644
index 1e8a7d5..0000000
--- a/trunk/avahi-compat-howl/include/discovery/discovery.h
+++ /dev/null
@@ -1,327 +0,0 @@
-#ifndef _discovery_discovery_h
-#define _discovery_discovery_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/socket.h>
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-
-struct _sw_discovery;
-typedef struct _sw_discovery * sw_discovery;
-
-
-/*
- * keeps track of different discovery operations
- */
-typedef sw_uint32 sw_discovery_oid;
-
-
-/*
- * For backwards compatibility
- */
-#define sw_discovery_publish_host_id sw_discovery_oid
-#define sw_discovery_publish_id sw_discovery_oid
-#define sw_discovery_browse_id sw_discovery_oid
-#define sw_discovery_resolve_id sw_discovery_oid
-
-
-/*
- * how to connect to server
- */
-typedef enum _sw_discovery_init_flags
-{
- SW_DISCOVERY_USE_SHARED_SERVICE = 0x1,
- SW_DISCOVERY_USE_PRIVATE_SERVICE = 0x2,
- SW_DISCOVERY_SKIP_VERSION_CHECK = 0x4
-} sw_discovery_init_flags;
-
-
-/*
- * status for asynchronous registration call
- */
-typedef enum _sw_discovery_publish_status
-{
- SW_DISCOVERY_PUBLISH_STARTED,
- SW_DISCOVERY_PUBLISH_STOPPED,
- SW_DISCOVERY_PUBLISH_NAME_COLLISION,
- SW_DISCOVERY_PUBLISH_INVALID
-} sw_discovery_publish_status;
-
-
-typedef enum _sw_discovery_browse_status
-{
- SW_DISCOVERY_BROWSE_INVALID,
- SW_DISCOVERY_BROWSE_RELEASE,
- SW_DISCOVERY_BROWSE_ADD_DOMAIN,
- SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN,
- SW_DISCOVERY_BROWSE_REMOVE_DOMAIN,
- SW_DISCOVERY_BROWSE_ADD_SERVICE,
- SW_DISCOVERY_BROWSE_REMOVE_SERVICE,
- SW_DISCOVERY_BROWSE_RESOLVED
-} sw_discovery_browse_status;
-
-
-typedef enum _sw_discovery_query_record_status
-{
- SW_DISCOVERY_QUERY_RECORD_ADD = 0x1
-} sw_discovery_query_record_status;
-
-
-typedef sw_result
-(HOWL_API *sw_discovery_publish_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_publish_status status,
- sw_opaque extra);
-
-typedef sw_result
-(HOWL_API *sw_discovery_browse_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_browse_status status,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_opaque extra);
-
-typedef sw_result
-(HOWL_API *sw_discovery_resolve_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_opaque extra);
-
-
-typedef sw_result
-(HOWL_API *sw_discovery_query_record_reply)(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_query_record_status status,
- sw_uint32 interface_index,
- sw_const_string fullname,
- sw_uint16 rrtype,
- sw_uint16 rrclass,
- sw_uint16 rrdatalen,
- sw_const_octets rrdata,
- sw_uint32 ttl,
- sw_opaque extra);
-
-
-/*
- * API for publishing/browsing/resolving services
- */
-sw_result HOWL_API
-sw_discovery_init(
- sw_discovery * self);
-
-
-sw_result HOWL_API
-sw_discovery_init_with_flags(
- sw_discovery * self,
- sw_discovery_init_flags flags);
-
-
-sw_result HOWL_API
-sw_discovery_fina(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_publish_host(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_discovery_publish_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_publish(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_const_string host,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_discovery_publish_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_publish_update(
- sw_discovery self,
- sw_discovery_oid oid,
- sw_octets text_record,
- sw_uint32 text_record_len);
-
-
-
-/*
- * API for browsing domains
- */
-sw_result HOWL_API
-sw_discovery_browse_domains(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-
-/*
- * API for browsing services
- */
-sw_result HOWL_API
-sw_discovery_browse(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_browse_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-/*
- * API for resolving services
- */
-sw_result HOWL_API
-sw_discovery_resolve(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_discovery_resolve_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_query_record(
- sw_discovery self,
- sw_uint32 interface_index,
- sw_uint32 flags,
- sw_const_string fullname,
- sw_uint16 rrtype,
- sw_uint16 rrclass,
- sw_discovery_query_record_reply reply,
- sw_opaque extra,
- sw_discovery_oid * oid);
-
-
-sw_result HOWL_API
-sw_discovery_cancel(
- sw_discovery self,
- sw_discovery_oid oid);
-
-
-
-/* ----------------------------------------------------------
- *
- * Event Processing APIs
- *
- * ----------------------------------------------------------
- */
-
-
-sw_result HOWL_API
-sw_discovery_run(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_stop_run(
- sw_discovery self);
-
-
-int HOWL_API
-sw_discovery_socket(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_read_socket(
- sw_discovery self);
-
-
-sw_result HOWL_API
-sw_discovery_salt(
- sw_discovery self,
- sw_salt * salt);
-
-
-/*
- * Error codes
- */
-#define SW_DISCOVERY_E_BASE 900
-#define SW_DISCOVERY_E_UNKNOWN (SW_DISCOVERY_E_BASE + 2)
-#define SW_DISCOVERY_E_NO_SUCH_NAME (SW_DISCOVERY_E_BASE + 3)
-#define SW_DISCOVERY_E_NO_MEM (SW_DISCOVERY_E_BASE + 4)
-#define SW_DISCOVERY_E_BAD_PARAM (SW_DISCOVERY_E_BASE + 5)
-#define SW_DISCOVERY_E_BAD_REFERENCE (SW_DISCOVERY_E_BASE + 6)
-#define SW_DISCOVERY_E_BAD_STATE (SW_DISCOVERY_E_BASE + 7)
-#define SW_DISCOVERY_E_BAD_FLAGS (SW_DISCOVERY_E_BASE + 8)
-#define SW_DISCOVERY_E_NOT_SUPPORTED (SW_DISCOVERY_E_BASE + 9)
-#define SW_DISCOVERY_E_NOT_INITIALIZED (SW_DISCOVERY_E_BASE + 10)
-#define SW_DISCOVERY_E_NO_CACHE (SW_DISCOVERY_E_BASE + 11)
-#define SW_DISCOVERY_E_ALREADY_REGISTERED (SW_DISCOVERY_E_BASE + 12)
-#define SW_DISCOVERY_E_NAME_CONFLICT (SW_DISCOVERY_E_BASE + 13)
-#define SW_DISCOVERY_E_INVALID (SW_DISCOVERY_E_BASE + 14)
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/discovery/text_record.h b/trunk/avahi-compat-howl/include/discovery/text_record.h
deleted file mode 100644
index 91f16d7..0000000
--- a/trunk/avahi-compat-howl/include/discovery/text_record.h
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifndef _discovery_text_record_h
-#define _discovery_text_record_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-#define SW_TEXT_RECORD_MAX_LEN 255
-
-
-struct _sw_text_record;
-typedef struct _sw_text_record * sw_text_record;
-struct _sw_text_record_iterator;
-typedef struct _sw_text_record_iterator * sw_text_record_iterator;
-struct _sw_text_record_string_iterator;
-typedef struct _sw_text_record_string_iterator * sw_text_record_string_iterator;
-
-
-/*
- * Text record APIs
- */
-sw_result HOWL_API
-sw_text_record_init(
- sw_text_record * self);
-
-
-sw_result HOWL_API
-sw_text_record_fina(
- sw_text_record self);
-
-
-sw_result HOWL_API
-sw_text_record_add_string(
- sw_text_record self,
- sw_const_string string);
-
-
-sw_result HOWL_API
-sw_text_record_add_key_and_string_value(
- sw_text_record self,
- sw_const_string key,
- sw_const_string val);
-
-
-sw_result HOWL_API
-sw_text_record_add_key_and_binary_value(
- sw_text_record self,
- sw_const_string key,
- sw_octets val,
- sw_uint32 len);
-
-
-sw_octets HOWL_API
-sw_text_record_bytes(
- sw_text_record self);
-
-
-sw_uint32 HOWL_API
-sw_text_record_len(
- sw_text_record self);
-
-
-/*
- * APIs for iterating through raw text records
- */
-sw_result HOWL_API
-sw_text_record_iterator_init(
- sw_text_record_iterator * self,
- sw_octets text_record,
- sw_uint32 text_record_len);
-
-
-sw_result HOWL_API
-sw_text_record_iterator_fina(
- sw_text_record_iterator self);
-
-
-sw_result HOWL_API
-sw_text_record_iterator_next(
- sw_text_record_iterator self,
- char key[SW_TEXT_RECORD_MAX_LEN],
- sw_uint8 val[SW_TEXT_RECORD_MAX_LEN],
- sw_uint32 * val_len);
-
-
-/*
- * APIs for iterating through stringified text records
- */
-sw_result HOWL_API
-sw_text_record_string_iterator_init(
- sw_text_record_string_iterator * self,
- sw_const_string text_record_string);
-
-
-sw_result HOWL_API
-sw_text_record_string_iterator_fina(
- sw_text_record_string_iterator self);
-
-
-sw_result HOWL_API
-sw_text_record_string_iterator_next(
- sw_text_record_string_iterator self,
- char key[SW_TEXT_RECORD_MAX_LEN],
- char val[SW_TEXT_RECORD_MAX_LEN]);
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/howl.h b/trunk/avahi-compat-howl/include/howl.h
deleted file mode 100644
index 80a1775..0000000
--- a/trunk/avahi-compat-howl/include/howl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _sw_howl_h
-#define _sw_howl_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/salt.h>
-#include <salt/time.h>
-#include <salt/debug.h>
-#include <corby/orb.h>
-#include <corby/message.h>
-#include <corby/object.h>
-#include <corby/channel.h>
-#include <corby/buffer.h>
-#include <discovery/discovery.h>
-#include <discovery/text_record.h>
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/rendezvous/rendezvous.h b/trunk/avahi-compat-howl/include/rendezvous/rendezvous.h
deleted file mode 100644
index 1d26b4a..0000000
--- a/trunk/avahi-compat-howl/include/rendezvous/rendezvous.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef _rendezvous_rendezvous_h
-#define _rendezvous_rendezvous_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <discovery/discovery.h>
-
-#define _sw_rendezvous _sw_discovery
-#define sw_rendezvous sw_discovery
-#define sw_rendezvous_publish_domain_id sw_discovery_publish_domain_id
-#define sw_rendezvous_publish_host_id sw_discovery_publish_host_id
-#define sw_rendezvous_publish_id sw_discovery_publish_id
-#define sw_rendezvous_browse_id sw_discovery_browse_id
-#define sw_rendezvous_resolve_id sw_discovery_resolve_id
-#define sw_rendezvous_publish_status sw_discovery_publish_status
-#define SW_RENDEZVOUS_PUBLISH_STARTED SW_DISCOVERY_PUBLISH_STARTED
-#define SW_RENDEZVOUS_PUBLISH_STOPPED SW_DISCOVERY_PUBLISH_STOPPED
-#define SW_RENDEZVOUS_PUBLISH_NAME_COLLISION SW_DISCOVERY_PUBLISH_NAME_COLLISION
-#define SW_RENDEZVOUS_PUBLISH_INVALID SW_DISCOVERY_PUBLISH_INVALID
-#define sw_rendezvous_browse_status sw_discovery_browse_status
-#define SW_RENDEZVOUS_BROWSE_INVALID SW_DISCOVERY_BROWSE_INVALID
-#define SW_RENDEZVOUS_BROWSE_RELEASE SW_DISCOVERY_BROWSE_RELEASE
-#define SW_RENDEZVOUS_BROWSE_ADD_DOMAIN SW_DISCOVERY_BROWSE_ADD_DOMAIN
-#define SW_RENDEZVOUS_BROWSE_ADD_DEFAULT_DOMAIN SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN
-#define SW_RENDEZVOUS_BROWSE_REMOVE_DOMAIN SW_DISCOVERY_BROWSE_REMOVE_DOMAIN
-#define SW_RENDEZVOUS_BROWSE_ADD_SERVICE SW_DISCOVERY_BROWSE_ADD_SERVICE
-#define SW_RENDEZVOUS_BROWSE_REMOVE_SERVICE SW_DISCOVERY_BROWSE_REMOVE_SERVICE
-#define SW_RENDEZVOUS_BROWSE_RESOLVED SW_DISCOVERY_BROWSE_RESOLVED
-#define sw_rendezvous_publish_domain_handler sw_discovery_publish_domain_handler
-#define sw_rendezvous_publish_domain_reply sw_discovery_publish_domain_reply
-#define sw_rendezvous_publish_host_handler sw_discovery_publish_host_handler
-#define sw_rendezvous_publish_host_reply sw_discovery_publish_host_reply
-#define sw_rendezvous_publish_handler sw_discovery_publish_handler
-#define sw_rendezvous_publish_reply sw_discovery_publish_reply
-#define sw_rendezvous_browse_handler sw_discovery_browse_handler
-#define sw_rendezvous_browse_reply sw_discovery_browse_reply
-#define sw_rendezvous_resolve_handler sw_discovery_resolve_handler
-#define sw_rendezvous_resolve_reply sw_discovery_resolve_reply
-#define sw_rendezvous_init sw_discovery_init
-#define sw_rendezvous_fina sw_discovery_fina
-#define sw_rendezvous_publish_domain sw_discovery_publish_domain
-#define sw_rendezvous_stop_publish_domain sw_discovery_stop_publish_domain
-#define sw_rendezvous_publish_host sw_discovery_publish_host
-#define sw_rendezvous_stop_publish_host sw_discovery_stop_publish_host
-#define sw_rendezvous_publish sw_discovery_publish
-#define sw_rendezvous_publish_update sw_discovery_publish_update
-#define sw_rendezvous_stop_publish sw_discovery_stop_publish
-#define sw_rendezvous_browse_domains sw_discovery_browse_domains
-#define sw_rendezvous_stop_browse_domains sw_discovery_stop_browse_domains
-#define sw_rendezvous_browse_services sw_discovery_browse
-#define sw_rendezvous_stop_browse_services sw_discovery_stop_browse
-#define sw_rendezvous_resolve sw_discovery_resolve
-#define sw_rendezvous_stop_resolve sw_discovery_stop_resolve
-#define sw_rendezvous_run sw_discovery_run
-#define sw_rendezvous_stop_run sw_discovery_stop_run
-#define sw_rendezvous_socket sw_discovery_socket
-#define sw_rendezvous_read_socket sw_discovery_read_socket
-#define sw_rendezvous_salt sw_discovery_salt
-#define SW_RENDEZVOUS_E_BASE SW_DISCOVERY_E_BASE
-#define SW_RENDEZVOUS_E_UNKNOWN SW_DISCOVERY_E_UNKNOWN
-#define SW_RENDEZVOUS_E_NO_SUCH_NAME SW_DISCOVERY_E_NO_SUCH_NAME
-#define SW_RENDEZVOUS_E_NO_MEM SW_DISCOVERY_E_NO_MEM
-#define SW_RENDEZVOUS_E_BAD_PARAM SW_DISCOVERY_E_BAD_PARAM
-#define SW_RENDEZVOUS_E_BAD_REFERENCE SW_DISCOVERY_E_BAD_REFERENCE
-#define SW_RENDEZVOUS_E_BAD_STATE SW_DISCOVERY_E_BAD_STATE
-#define SW_RENDEZVOUS_E_BAD_FLAGS SW_DISCOVERY_E_BAD_FLAGS
-#define SW_RENDEZVOUS_E_NOT_SUPPORTED SW_DISCOVERY_E_NOT_SUPPORTED
-#define SW_RENDEZVOUS_E_NOT_INITIALIZED SW_DISCOVERY_E_NOT_INITIALIZED
-#define SW_RENDEZVOUS_E_NO_CACHE SW_DISCOVERY_E_NO_CACHE
-#define SW_RENDEZVOUS_E_ALREADY_REGISTERED SW_DISCOVERY_E_ALREADY_REGISTERED
-#define SW_RENDEZVOUS_E_NAME_CONFLICT SW_DISCOVERY_E_NAME_CONFLICT
-#define SW_RENDEZVOUS_E_INVALID SW_DISCOVERY_E_INVALID
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/rendezvous/text_record.h b/trunk/avahi-compat-howl/include/rendezvous/text_record.h
deleted file mode 100644
index cf8b845..0000000
--- a/trunk/avahi-compat-howl/include/rendezvous/text_record.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _rendezvous_text_record_h
-#define _rendezvous_text_record_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-
-#include <discovery/text_record.h>
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/address.h b/trunk/avahi-compat-howl/include/salt/address.h
deleted file mode 100644
index b18a4af..0000000
--- a/trunk/avahi-compat-howl/include/salt/address.h
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef _salt_address_h
-#define _salt_address_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-
-#include <salt/salt.h>
-
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-
-typedef struct _sw_ipv4_address
-{
- sw_uint32 m_addr;
-} sw_ipv4_address;
-
-typedef sw_uint32 sw_saddr;
-
-
-sw_ipv4_address HOWL_API
-sw_ipv4_address_any(void);
-
-
-sw_ipv4_address HOWL_API
-sw_ipv4_address_loopback(void);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init(
- sw_ipv4_address * self);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_saddr(
- sw_ipv4_address * self,
- sw_saddr saddr);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_name(
- sw_ipv4_address * self,
- sw_const_string name);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_address(
- sw_ipv4_address * self,
- sw_ipv4_address addr);
-
-
-sw_result HOWL_API
-sw_ipv4_address_init_from_this_host(
- sw_ipv4_address * self);
-
-
-sw_result HOWL_API
-sw_ipv4_address_fina(
- sw_ipv4_address self);
-
-
-sw_bool HOWL_API
-sw_ipv4_address_is_any(
- sw_ipv4_address self);
-
-
-sw_saddr HOWL_API
-sw_ipv4_address_saddr(
- sw_ipv4_address self);
-
-
-sw_string HOWL_API
-sw_ipv4_address_name(
- sw_ipv4_address self,
- sw_string name,
- sw_uint32 len);
-
-
-sw_result HOWL_API
-sw_ipv4_address_decompose(
- sw_ipv4_address self,
- sw_uint8 * a1,
- sw_uint8 * a2,
- sw_uint8 * a3,
- sw_uint8 * a4);
-
-
-sw_bool HOWL_API
-sw_ipv4_address_equals(
- sw_ipv4_address self,
- sw_ipv4_address addr);
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/debug.h b/trunk/avahi-compat-howl/include/salt/debug.h
deleted file mode 100644
index 03bd453..0000000
--- a/trunk/avahi-compat-howl/include/salt/debug.h
+++ /dev/null
@@ -1,230 +0,0 @@
-#ifndef _salt_debug_h
-#define _salt_debug_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-#include <stdarg.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#define SW_LOG_WARNING 1 << 0
-#define SW_LOG_ERROR 1 << 1
-#define SW_LOG_NOTICE 1 << 2
-#define SW_LOG_VERBOSE 1 << 3
-#define SW_LOG_OFF 0x0
-
-
-#if (defined( __GNUC__))
-
-# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
-
-# define __C99_VA_ARGS__ 1
-
-# define __GNU_VA_ARGS__ 0
-
-# else
-
-# define __C99_VA_ARGS__ 0
-
-# define __GNU_VA_ARGS__ 1
-
-# endif
-
-#else
-
-# define __C99_VA_ARGS__ 0
-
-# define __GNU_VA_ARGS__ 0
-
-#endif
-
-
-# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 9)))
-
-# define __SW_FUNCTION__ __func__
-
-#elif (defined( __GNUC__))
-
-# define __SW_FUNCTION__ __PRETTY_FUNCTION__
-
-#elif( defined(_MSC_VER ) && !defined(_WIN32_WCE))
-
-# define __SW_FUNCTION__ __FUNCTION__
-
-#else
-
-# define __SW_FUNCTION__ ""
-
-#endif
-
-
-#define sw_check(expr, label, action) \
-do \
-{ \
- if (!(expr)) \
- { \
- { \
- action; \
- } \
- goto label; \
- } \
-} while (0)
-
-
-#define sw_check_log(expr, label, action) \
-do \
-{ \
- if (!(expr)) \
- { \
- sw_print_assert(0, NULL, __FILE__, __SW_FUNCTION__, __LINE__); \
- { \
- action; \
- } \
- goto label; \
- } \
-} while (0)
-
-
-#define sw_check_okay(code, label) \
-do \
-{ \
- if ((int) code != 0) \
- { \
- goto label; \
- } \
-} while (0)
-
-
-#define sw_check_okay_log(code, label) \
-do \
-{ \
- if ((int) code != 0) \
- { \
- sw_print_assert((int) code, NULL, __FILE__, __SW_FUNCTION__, __LINE__); \
- goto label; \
- } \
-} while ( 0 )
-
-
-#define sw_translate_error(expr, errno) ((expr) ? 0 : (errno))
-
-
-#if defined(WIN32)
-
-# define sw_socket_errno() (int) WSAGetLastError()
-# define sw_set_socket_errno(X) WSASetLastError(X)
-# define sw_system_errno() (int) GetLastError()
-# define sw_set_system_errno(X) SetLastError(X)
-
-#else
-
-# define sw_socket_errno() errno
-# define sw_set_socket_errno(X) errno = X
-# define sw_system_errno() errno
-# define sw_set_system_errno(X) errno = X
-
-#endif
-
-
-#if !defined(NDEBUG)
-
-# define sw_assert(X) \
- \
- do \
- { \
- if (!(X)) \
- { \
- sw_print_assert( 0, #X, __FILE__, __SW_FUNCTION__, __LINE__); \
- } \
- } while( 0 )
-
-#else
-
-# define sw_assert(X)
-
-#endif
-
-
-void HOWL_API
-sw_print_assert(
- int code,
- sw_const_string assert_string,
- sw_const_string file,
- sw_const_string func,
- int line);
-
-
-#if !defined(NDEBUG)
-
-void HOWL_API
-sw_print_debug(
- int level,
- sw_const_string format,
- ...);
-
-# if (__C99_VA_ARGS__)
-
-# define sw_debug(...) sw_print_debug(__VA_ARGS__)
-
-# else
-
-# define sw_debug sw_print_debug
-
-# endif
-
-#else
-
-# if (__C99_VA_ARGS__)
-
-# define sw_debug(...)
-
-# else
-
-# define sw_debug while( 0 )
-
-# endif
-
-#endif
-
-
-#define SW_UNUSED_PARAM(X) (void) (X)
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/interface.h b/trunk/avahi-compat-howl/include/salt/interface.h
deleted file mode 100644
index 5356398..0000000
--- a/trunk/avahi-compat-howl/include/salt/interface.h
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifndef _sw_interface_h
-#define _sw_interface_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/address.h>
-
-struct _sw_network_interface;
-typedef struct _sw_network_interface * sw_network_interface;
-
-
-typedef enum _sw_network_interface_state
-{
- SW_NETWORK_INTERFACE_RUNNING = 0x1,
-} sw_network_interface_state;
-
-
-typedef struct _sw_mac_address
-{
- sw_uint8 m_id[6];
-} sw_mac_address;
-
-
-sw_result HOWL_API
-sw_network_interfaces(
- sw_uint32 * count,
- sw_network_interface ** netifs);
-
-
-sw_result HOWL_API
-sw_network_interfaces_fina(
- sw_uint32 count,
- sw_network_interface * netifs);
-
-
-sw_result HOWL_API
-sw_network_interface_fina(
- sw_network_interface netif);
-
-
-sw_result HOWL_API
-sw_network_interface_by_name(
- sw_string name,
- sw_network_interface * netif);
-
-
-sw_result HOWL_API
-sw_network_interface_name(
- sw_network_interface netif,
- sw_string name,
- sw_uint32 len);
-
-
-sw_result HOWL_API
-sw_network_interface_mac_address(
- sw_network_interface netif,
- sw_mac_address * addr);
-
-
-sw_result HOWL_API
-sw_network_interface_ipv4_address(
- sw_network_interface netif,
- sw_ipv4_address * addr);
-
-
-sw_result HOWL_API
-sw_network_interface_set_ipv4_address(
- sw_network_interface netif,
- sw_ipv4_address addr);
-
-
-sw_result HOWL_API
-sw_network_interface_index(
- sw_network_interface netif,
- sw_uint32 * index);
-
-
-sw_result HOWL_API
-sw_network_interface_linked(
- sw_network_interface netif,
- sw_bool * linked);
-
-
-sw_result HOWL_API
-sw_network_interface_up(
- sw_network_interface netif);
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/platform.h b/trunk/avahi-compat-howl/include/salt/platform.h
deleted file mode 100644
index d0553e7..0000000
--- a/trunk/avahi-compat-howl/include/salt/platform.h
+++ /dev/null
@@ -1,438 +0,0 @@
-#ifndef _sw_platform_h
-#define _sw_platform_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software, Inc.
- */
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-#if defined(__VXWORKS__)
-
-# define HOWL_API
-# include <vxworks.h>
-# include <sysLib.h>
-
-# define sw_snooze(SECS) taskDelay(sysClkRateGet() * SECS)
-
-#elif defined(WIN32)
-
-# define WIN32_LEAN_AND_MEAN
-# define HOWL_API __stdcall
-# pragma warning(disable:4127)
-# include <windows.h>
-# include <stdlib.h>
-
-typedef signed char int8_t;
-typedef unsigned char u_int8_t;
-typedef signed short int16_t;
-typedef unsigned short u_int16_t;
-typedef signed long int32_t;
-typedef unsigned long u_int32_t;
-typedef _int64 int64_t;
-typedef _int64 u_int64_t;
-
-# define sw_snooze(SECS) Sleep(SECS * 1000)
-
-#else
-
-# define HOWL_API
-# if defined(HOWL_KERNEL)
-# include <howl_config.h>
-# endif
-# include <sys/types.h>
-# include <stdlib.h>
-# include <unistd.h>
-
-# define sw_snooze(SECS) sleep(SECS)
-
-#endif
-
-#if defined(__sun)
-
-# define u_int8_t uint8_t
-# define u_int16_t uint16_t
-# define u_int32_t uint32_t
-# define u_int64_t uint64_t
-
-#endif
-
-typedef void * sw_opaque;
-typedef void * sw_opaque_t;
-typedef int8_t sw_int8;
-typedef u_int8_t sw_uint8;
-typedef u_int8_t sw_bool;
-typedef int16_t sw_int16;
-typedef u_int16_t sw_uint16;
-typedef int32_t sw_int32;
-typedef u_int32_t sw_uint32;
-typedef int64_t sw_int64;
-typedef u_int64_t sw_uint64;
-typedef char * sw_string;
-typedef sw_uint8 * sw_octets;
-#if !defined(__VXWORKS__) || defined(__cplusplus)
-typedef const char * sw_const_string;
-typedef const u_int8_t * sw_const_octets;
-#else
-typedef char * sw_const_string;
-typedef u_int8_t * sw_const_octets;
-#endif
-typedef size_t sw_size_t;
-typedef int sw_result;
-
-
-
-/* --------------------------------------------------------
- *
- * Endian-osity
- *
- * SW_ENDIAN is 0 for big endian platforms, 1
- * for little endian platforms.
- *
- * The macro WORDS_BIGENDIAN will be defined
- * by autoconf. If you are using Howl on
- * a platform that doesn't have autoconf, define
- * SW_ENDIAN directly
- * --------------------------------------------------------
- */
-
-#if !defined(SW_ENDIAN)
-
-# if WORDS_BIGENDIAN == 1
-
-# define SW_ENDIAN 0
-
-# else
-
-# define SW_ENDIAN 1
-
-# endif
-
-#endif
-
-
-/* --------------------------------------------------------
- *
- * Strings
- *
- * These macros supports cross platform string functions
- * for the following OSes
- *
- * Win32
- * *NIX
- * PalmOS
- * VxWorks
- *
- * --------------------------------------------------------
- */
-
-#if defined(WIN32)
-
-# include <string.h>
-
-# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3)
-# define sw_memcpy(ARG1, ARG2, ARG3) memmove((char*) ARG1, (char*) ARG2, ARG3)
-# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3)
-# define sw_strcasecmp(ARG1, ARG2) stricmp(ARG1, ARG2)
-# define sw_strncasecmp(ARG1, ARG2) strnicmp(ARG1, ARG2)
-# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) (ARG2) ? strcpy(ARG1, ARG2) : strcpy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) (ARG2) ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) strlen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3)
-
-#elif defined(__VXWORKS__)
-
-# include <string.h>
-
-extern sw_int32
-sw_strcasecmp(
- sw_const_string arg1,
- sw_const_string arg2);
-
-extern sw_int32
-sw_strncasecmp(
- sw_const_string arg1,
- sw_const_string arg2,
- sw_len n);
-
-extern sw_string
-sw_strtok_r(
- sw_string arg1,
- sw_const_string arg2,
- sw_string * lasts);
-
-# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3)
-# define sw_memcpy(ARG1, ARG2, ARG3) memcpy((char*) ARG1, (char*) ARG2, ARG3)
-# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3)
-# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) ARG2 ? strcpy(ARG1, ARG2) : strcpy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) ARG2 ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) strlen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-
-#elif defined(__PALMOS__)
-
-# include <StringMgr.h>
-
-# define sw_strcasecmp(ARG1, ARG2) strcasecmp(ARG1, ARG2)
-# define sw_strncasecmp(ARG1, ARG2) strncasecmp(ARG1, ARG2)
-# define sw_strcat(ARG1, ARG2) StrCat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) StrNCat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) StrChr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) StrCampare(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) StrNCompare(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) ARG2 ? StrCopy(ARG1, ARG2) : StrCopy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) ARG2 ? StrNCopy(ARG1, ARG2, N) : StrCopy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) StrLen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3)
-
-#else
-
-# include <string.h>
-
-# if defined(__Lynx__)
- char * strchr(char*, int);
-# endif
-
-# define sw_memset(ARG1, ARG2, ARG3) memset((char*) ARG1, ARG2, ARG3)
-# define sw_memcpy(ARG1, ARG2, ARG3) memcpy((char*) ARG1, (char*) ARG2, ARG3)
-# define sw_memcmp(ARG1, ARG2, ARG3) memcmp((char*) ARG1, ARG2, ARG3)
-# define sw_strcasecmp(ARG1, ARG2) strcasecmp(ARG1, ARG2)
-# define sw_strncasecmp(ARG1, ARG2) strncasecmp(ARG1, ARG2)
-# define sw_strcat(ARG1, ARG2) strcat(ARG1, ARG2)
-# define sw_strncat(ARG1, ARG2) strncat(ARG1, ARG2)
-# define sw_strchr(ARG1, ARG2) strchr(ARG1, ARG2)
-# define sw_strcmp(ARG1, ARG2) strcmp(ARG1, ARG2)
-# define sw_strncmp(ARG1, ARG2) strncmp(ARG1, ARG2)
-# define sw_strcoll(ARG1, ARG2) strcoll(ARG1, ARG2)
-# define sw_strcpy(ARG1, ARG2) ARG2 ? strcpy(ARG1, ARG2) : strcpy(ARG1, "")
-# define sw_strncpy(ARG1, ARG2, N) ARG2 ? strncpy(ARG1, ARG2, N) : strcpy(ARG1, "")
-# define sw_strcspn(ARG1, ARG2) strcspn(ARG1, ARG2)
-# define sw_strlen(ARG1) strlen(ARG1)
-# define sw_strstr(ARG1, ARG2) strstr(ARG1, ARG2)
-# define sw_strtok_r(ARG1, ARG2, ARG3) strtok_r(ARG1, ARG2, ARG3)
-
-#endif
-
-
-sw_string
-sw_strdup(
- sw_const_string str);
-
-
-/* --------------------------------------------------------
- *
- * Memory
- *
- * These macros support cross platform heap functions.
- * When compiling with DEBUG, some extra checking is
- * done which can aid in tracking down heap corruption
- * problems
- *
- * --------------------------------------------------------
- */
-
-#if defined(NDEBUG)
-
-# define sw_malloc(SIZE) malloc(SIZE)
-# define sw_realloc(MEM,SIZE) realloc(MEM, SIZE)
-# define sw_free(MEM) if (MEM) free(MEM)
-
-#else
-
-# define sw_malloc(SIZE) _sw_debug_malloc(SIZE, __SW_FUNCTION__, __FILE__, __LINE__)
-# define sw_realloc(MEM,SIZE) _sw_debug_realloc(MEM, SIZE, __SW_FUNCTION__, __FILE__, __LINE__)
-# define sw_free(MEM) if (MEM) _sw_debug_free(MEM, __SW_FUNCTION__, __FILE__, __LINE__)
-
-#endif
-
-
-sw_opaque HOWL_API
-_sw_debug_malloc(
- sw_size_t size,
- sw_const_string function,
- sw_const_string file,
- sw_uint32 line);
-
-
-sw_opaque HOWL_API
-_sw_debug_realloc(
- sw_opaque_t mem,
- sw_size_t size,
- sw_const_string function,
- sw_const_string file,
- sw_uint32 line);
-
-
-void HOWL_API
-_sw_debug_free(
- sw_opaque_t mem,
- sw_const_string function,
- sw_const_string file,
- sw_uint32 line);
-
-
-
-/* --------------------------------------------------------
- *
- * Sockets
- *
- * These macros and APIs support cross platform socket
- * calls. I am relying on BSD APIs, but even with those
- * there are subtle and not so subtle platform differences
- *
- * --------------------------------------------------------
- */
-
-#if defined(__VXWORKS__)
-
-# include <vxworks.h>
-# include <hostLib.h>
-# include <sockLib.h>
-# include <ioLib.h>
-# include <inetLib.h>
-
-typedef int sw_sockdesc_t;
-typedef socklen_t sw_socklen_t;
-
-#elif defined(WIN32)
-
-# include <winsock2.h>
-
-typedef SOCKET sw_sockdesc_t;
-typedef int sw_socklen_t;
-
-# define SW_E_WOULDBLOCK WSAEWOULDBLOCK
-# define SW_INVALID_SOCKET INVALID_SOCKET
-# define SW_SOCKET_ERROR SOCKET_ERROR
-
-# define sw_close_socket(X) closesocket(X)
-
-#else
-
-# if defined(sun)
-
-# include <unistd.h>
-
-# endif
-
-# include <sys/types.h>
-# include <signal.h>
-
-# if defined(__Lynx__)
-
-# include <socket.h>
-
-# else
-
-# include <sys/socket.h>
-
-# endif
-
-# include <netinet/in.h>
-# include <netinet/tcp.h>
-# include <netdb.h>
-# include <arpa/inet.h>
-# include <stdlib.h>
-# include <unistd.h>
-# include <sys/ioctl.h>
-# include <stdio.h>
-# include <errno.h>
-
-typedef sw_int32 sw_sockdesc_t;
-typedef socklen_t sw_socklen_t;
-
-# define SW_E_WOULDBLOCK EWOULDBLOCK
-# define SW_INVALID_SOCKET -1
-# define SW_SOCKET_ERROR -1
-
-# define sw_close_socket(X) close(X)
-
-#endif
-
-
-/* --------------------------------------------------------
- *
- * strerror()
- *
- * This function will print a string rep of a system error
- * code
- *
- * --------------------------------------------------------
- */
-
-sw_const_string
-sw_strerror();
-
-
-/*
- * Obsolete types and macros.
- *
- * These are here for backwards compatibility, but will
- * be removed in the future
- */
-#define sw_char sw_int8
-#define sw_uchar sw_uint8
-#define sw_octet sw_uint8
-#define sw_short sw_int16
-#define sw_ushort sw_uint16
-#define sw_long sw_int32
-#define sw_ulong sw_uint32
-
-
-#define SW_TRY(EXPR) { sw_result result; if ((result = EXPR) != SW_OKAY) return result; } ((void) 0)
-#define SW_TRY_GOTO(EXPR) { if ((result = EXPR) != SW_OKAY) goto exit; } ((void) 0)
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/salt.h b/trunk/avahi-compat-howl/include/salt/salt.h
deleted file mode 100644
index 88ac0d9..0000000
--- a/trunk/avahi-compat-howl/include/salt/salt.h
+++ /dev/null
@@ -1,215 +0,0 @@
-#ifndef _sw_salt_h
-#define _sw_salt_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software, Inc.
- */
-
-#include <salt/platform.h>
-#include <salt/time.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-typedef enum _sw_socket_event
-{
- SW_SOCKET_READ = (1 << 0),
- SW_SOCKET_WRITE = (1 << 1),
- SW_SOCKET_OOB = (1 << 2)
-} sw_socket_event;
-
-
-struct _sw_salt;
-typedef struct _sw_salt * sw_salt;
-struct _sw_socket;
-struct _sw_timer;
-struct _sw_network_interface;
-struct _sw_signal;
-
-typedef sw_opaque sw_socket_handler;
-typedef sw_result
-(HOWL_API *sw_socket_handler_func)(
- sw_socket_handler handler,
- sw_salt salt,
- struct _sw_socket * socket,
- sw_socket_event events,
- sw_opaque extra);
-
-
-typedef sw_opaque sw_timer_handler;
-typedef sw_result
-(HOWL_API *sw_timer_handler_func)(
- sw_timer_handler handler,
- sw_salt salt,
- struct _sw_timer * timer,
- sw_time timeout,
- sw_opaque extra);
-
-typedef sw_opaque sw_network_interface_handler;
-typedef sw_result
-(HOWL_API *sw_network_interface_handler_func)(
- sw_network_interface_handler handler,
- sw_salt salt,
- struct _sw_network_interface * netif,
- sw_opaque extra);
-
-typedef sw_opaque sw_signal_handler;
-typedef sw_result
-(HOWL_API *sw_signal_handler_func)(
- sw_signal_handler handler,
- sw_salt salt,
- struct _sw_signal * signal,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_init(
- sw_salt * self,
- int argc,
- char ** argv);
-
-
-sw_result HOWL_API
-sw_salt_fina(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_register_socket(
- sw_salt self,
- struct _sw_socket * socket,
- sw_socket_event events,
- sw_socket_handler handler,
- sw_socket_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_socket(
- sw_salt self,
- struct _sw_socket * socket);
-
-
-sw_result HOWL_API
-sw_salt_register_timer(
- sw_salt self,
- struct _sw_timer * timer,
- sw_time timeout,
- sw_timer_handler handler,
- sw_timer_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_timer(
- sw_salt self,
- struct _sw_timer * timer);
-
-
-sw_result HOWL_API
-sw_salt_register_network_interface(
- sw_salt self,
- struct _sw_network_interface * netif,
- sw_network_interface_handler handler,
- sw_network_interface_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_network_interface_handler(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_register_signal(
- sw_salt self,
- struct _sw_signal * signal,
- sw_signal_handler handler,
- sw_signal_handler_func func,
- sw_opaque extra);
-
-
-sw_result HOWL_API
-sw_salt_unregister_signal(
- sw_salt self,
- struct _sw_signal * signal);
-
-
-sw_result HOWL_API
-sw_salt_lock(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_unlock(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_step(
- sw_salt self,
- sw_uint32 * msec);
-
-
-sw_result HOWL_API
-sw_salt_run(
- sw_salt self);
-
-
-sw_result HOWL_API
-sw_salt_stop_run(
- sw_salt self);
-
-
-#define SW_FALSE 0
-#define SW_TRUE 1
-#define SW_OKAY 0
-
-
-/*
- * error codes
- */
-#define SW_E_CORE_BASE 0x80000000
-#define SW_E_UNKNOWN (SW_E_CORE_BASE) + 1
-#define SW_E_INIT (SW_E_CORE_BASE) + 2
-#define SW_E_MEM (SW_E_CORE_BASE) + 3
-#define SW_E_EOF (SW_E_CORE_BASE) + 4
-#define SW_E_NO_IMPL (SW_E_CORE_BASE) + 5
-#define SW_E_FILE_LOCKED (SW_E_CORE_BASE) + 6
-#define SW_E_PROTOCOL_NOT_FOUND (SW_E_CORE_BASE) + 7
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/signal.h b/trunk/avahi-compat-howl/include/salt/signal.h
deleted file mode 100644
index 2ae5bb3..0000000
--- a/trunk/avahi-compat-howl/include/salt/signal.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef _salt_signal_h
-#define _salt_signal_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_signal;
-typedef struct _sw_signal * sw_signal;
-
-
-sw_result HOWL_API
-sw_signal_init(
- sw_signal * self,
- int signal);
-
-
-sw_result HOWL_API
-sw_signal_fina(
- sw_signal self);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/socket.h b/trunk/avahi-compat-howl/include/salt/socket.h
deleted file mode 100644
index 88773e4..0000000
--- a/trunk/avahi-compat-howl/include/salt/socket.h
+++ /dev/null
@@ -1,263 +0,0 @@
-#ifndef _sw_socket_h
-#define _sw_socket_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-#include <salt/address.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_socket;
-typedef struct _sw_socket * sw_socket;
-struct _sw_socket_options;
-typedef struct _sw_socket_options * sw_socket_options;
-typedef sw_uint16 sw_port;
-
-
-
-sw_result HOWL_API
-sw_tcp_socket_init(
- sw_socket * self);
-
-
-sw_result HOWL_API
-sw_tcp_socket_init_with_desc(
- sw_socket * self,
- sw_sockdesc_t desc);
-
-
-sw_result HOWL_API
-sw_udp_socket_init(
- sw_socket * self);
-
-
-sw_result HOWL_API
-sw_multicast_socket_init(
- sw_socket * self);
-
-
-sw_result HOWL_API
-sw_socket_fina(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_bind(
- sw_socket self,
- sw_ipv4_address address,
- sw_port port);
-
-
-sw_result HOWL_API
-sw_socket_join_multicast_group(
- sw_socket self,
- sw_ipv4_address local_address,
- sw_ipv4_address multicast_address,
- sw_uint32 ttl);
-
-
-sw_result HOWL_API
-sw_socket_leave_multicast_group(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_listen(
- sw_socket self,
- int qsize);
-
-
-sw_result HOWL_API
-sw_socket_connect(
- sw_socket self,
- sw_ipv4_address address,
- sw_port port);
-
-
-sw_result HOWL_API
-sw_socket_accept(
- sw_socket self,
- sw_socket * socket);
-
-
-sw_result HOWL_API
-sw_socket_send(
- sw_socket self,
- sw_octets buffer,
- sw_size_t len,
- sw_size_t * bytesWritten);
-
-
-sw_result HOWL_API
-sw_socket_sendto(
- sw_socket self,
- sw_octets buffer,
- sw_size_t len,
- sw_size_t * bytesWritten,
- sw_ipv4_address to,
- sw_port port);
-
-
-sw_result HOWL_API
-sw_socket_recv(
- sw_socket self,
- sw_octets buffer,
- sw_size_t max,
- sw_size_t * len);
-
-
-sw_result HOWL_API
-sw_socket_recvfrom(
- sw_socket self,
- sw_octets buffer,
- sw_size_t max,
- sw_size_t * len,
- sw_ipv4_address * from,
- sw_port * port,
- sw_ipv4_address * dest,
- sw_uint32 * interface_index);
-
-
-sw_result HOWL_API
-sw_socket_set_blocking_mode(
- sw_socket self,
- sw_bool blocking_mode);
-
-
-sw_result HOWL_API
-sw_socket_set_options(
- sw_socket self,
- sw_socket_options options);
-
-
-sw_ipv4_address HOWL_API
-sw_socket_ipv4_address(
- sw_socket self);
-
-
-sw_port HOWL_API
-sw_socket_port(
- sw_socket self);
-
-
-sw_sockdesc_t HOWL_API
-sw_socket_desc(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_close(
- sw_socket self);
-
-
-sw_result HOWL_API
-sw_socket_options_init(
- sw_socket_options * self);
-
-
-sw_result HOWL_API
-sw_socket_options_fina(
- sw_socket_options self);
-
-
-sw_result HOWL_API
-sw_socket_options_set_debug(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_nodelay(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_dontroute(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_keepalive(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_linger(
- sw_socket_options self,
- sw_bool onoff,
- sw_uint32 linger);
-
-
-sw_result HOWL_API
-sw_socket_options_set_reuseaddr(
- sw_socket_options self,
- sw_bool val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_rcvbuf(
- sw_socket_options self,
- sw_uint32 val);
-
-
-sw_result HOWL_API
-sw_socket_options_set_sndbuf(
- sw_socket_options self,
- sw_uint32 val);
-
-
-int
-sw_socket_error_code(void);
-
-
-#define SW_E_SOCKET_BASE 0x80000200
-#define SW_E_SOCKET (SW_E_SOCKET_BASE) + 1
-#define SW_E_BIND (SW_E_SOCKET_BASE) + 2
-#define SW_E_GETSOCKNAME (SW_E_SOCKET_BASE) + 3
-#define SW_E_ADD_MEMBERSHIP (SW_E_SOCKET_BASE) + 4
-#define SW_E_MULTICAST_TTL (SW_E_SOCKET_BASE) + 5
-#define SW_E_NOCONNECTION (SW_E_SOCKET_BASE) + 6
-#define SW_E_INPROGRESS (SW_E_SOCKET_BASE) + 7
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/include/salt/time.h b/trunk/avahi-compat-howl/include/salt/time.h
deleted file mode 100644
index b3ec226..0000000
--- a/trunk/avahi-compat-howl/include/salt/time.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef _salt_time_h
-#define _salt_time_h
-
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <salt/platform.h>
-
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-struct _sw_timer;
-typedef struct _sw_timer * sw_timer;
-
-
-sw_result HOWL_API
-sw_timer_init(
- sw_timer * self);
-
-
-sw_result HOWL_API
-sw_timer_fina(
- sw_timer self);
-
-
-typedef struct _sw_time
-{
- sw_uint32 m_secs;
- sw_uint32 m_usecs;
-} sw_time;
-
-
-sw_result HOWL_API
-sw_time_init(
- sw_time * self);
-
-
-sw_result HOWL_API
-sw_time_init_now(
- sw_time * self);
-
-
-sw_result HOWL_API
-sw_time_fina(
- sw_time self);
-
-
-sw_time HOWL_API
-sw_time_add(
- sw_time self,
- sw_time y);
-
-
-sw_time HOWL_API
-sw_time_sub(
- sw_time self,
- sw_time y);
-
-
-sw_int32 HOWL_API
-sw_time_cmp(
- sw_time self,
- sw_time y);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/trunk/avahi-compat-howl/samples/Makefile.am b/trunk/avahi-compat-howl/samples/Makefile.am
deleted file mode 100644
index bda07b1..0000000
--- a/trunk/avahi-compat-howl/samples/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir) -I$(top_srcdir)/avahi-compat-howl/include
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-if ENABLE_COMPAT_HOWL
-
-if ENABLE_TESTS
-noinst_PROGRAMS = browse resolve publish query
-endif
-
-browse_SOURCES = \
- browse.c
-browse_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-browse_LDADD = $(AM_LDADD) ../libhowl.la
-
-resolve_SOURCES = \
- resolve.c
-resolve_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-resolve_LDADD = $(AM_LDADD) ../libhowl.la
-
-publish_SOURCES = \
- publish.c
-publish_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-publish_LDADD = $(AM_LDADD) ../libhowl.la
-
-query_SOURCES = \
- query.c
-query_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -I $(srcdir)/include
-query_LDADD = $(AM_LDADD) ../libhowl.la
-
-endif
-endif
diff --git a/trunk/avahi-compat-howl/samples/browse.c b/trunk/avahi-compat-howl/samples/browse.c
deleted file mode 100644
index b4a8cf3..0000000
--- a/trunk/avahi-compat-howl/samples/browse.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <salt/debug.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-my_resolver(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_opaque_t extra)
-{
- sw_text_record_iterator it;
- sw_int8 name_buf[16];
- sw_int8 key[SW_TEXT_RECORD_MAX_LEN];
- sw_int8 sval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint8 oval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint32 oval_len;
- sw_result err = SW_OKAY;
-
- sw_discovery_cancel(discovery, oid);
-
- fprintf(stderr, "resolve reply: 0x%x %s %s %s %s %d\n", interface_index, name, type, domain, sw_ipv4_address_name(address, name_buf, 16), port);
-
- if ((text_record_len > 0) && (text_record) && (*text_record != '\0'))
- {
- err = sw_text_record_iterator_init(&it, text_record, text_record_len);
- sw_check_okay(err, exit);
-
- while (sw_text_record_iterator_next(it, key, oval, &oval_len) == SW_OKAY)
- {
- fprintf(stderr, "Txt: [%s]=[%s] - (%d bytes)\n", key, oval, oval_len);
- }
-
- err = sw_text_record_iterator_fina(it);
- sw_check_okay(err, exit);
- }
-
-exit:
-
- return err;
-}
-
-
-static sw_result HOWL_API
-my_browser(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_discovery_browse_status status,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_opaque_t extra)
-{
- sw_discovery_resolve_id rid;
-
- switch (status)
- {
- case SW_DISCOVERY_BROWSE_INVALID:
- {
- fprintf(stderr, "browse reply: Invalid\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_RELEASE:
- {
- fprintf(stderr, "browse reply: Release\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_ADD_DOMAIN:
- {
- fprintf(stderr, "browse reply: Add Domain\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN:
- {
- fprintf(stderr, "browse reply: Add Default Domain\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_REMOVE_DOMAIN:
- {
- fprintf(stderr, "browse reply: Remove Domain\n");
- }
- break;
-
- case SW_DISCOVERY_BROWSE_ADD_SERVICE:
- {
- fprintf(stderr, "browse reply: Add Service 0x%x %s %s %s\n", interface_index, name, type, domain);
- if (sw_discovery_resolve(discovery, interface_index, name, type, domain, my_resolver, NULL, &rid) != SW_OKAY)
- {
- fprintf(stderr, "resolve failed\n");
- }
- }
- break;
-
- case SW_DISCOVERY_BROWSE_REMOVE_SERVICE:
- {
- fprintf(stderr, "browse reply: Remove Service\n");
- fprintf(stderr, "remove service: 0x%x %s %s %s\n", interface_index, name, type, domain);
- }
- break;
-
- case SW_DISCOVERY_BROWSE_RESOLVED:
- {
- fprintf(stderr, "browse reply: Resolved\n");
- }
- break;
- }
-
- return SW_OKAY;
-}
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_discovery_oid oid;
- sw_result err;
-
- err = sw_discovery_init(&discovery);
- sw_check_okay(err, exit);
-
- if (argc != 2)
- {
- fprintf(stderr, "usage: mDNSBrowse <type>\n");
- return -1;
- }
-
- err = sw_discovery_browse(discovery, 0, argv[1], NULL, my_browser, NULL, &oid);
- sw_check_okay(err, exit);
-
- err = sw_discovery_run(discovery);
- sw_check_okay(err, exit);
-
-exit:
-
- return err;
-}
diff --git a/trunk/avahi-compat-howl/samples/publish.c b/trunk/avahi-compat-howl/samples/publish.c
deleted file mode 100644
index cca6040..0000000
--- a/trunk/avahi-compat-howl/samples/publish.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2003, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-my_service_reply(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_discovery_publish_status status,
- sw_opaque extra)
-{
- static sw_string
- status_text[] =
- {
- "Started",
- "Stopped",
- "Name Collision",
- "Invalid"
- };
-
- fprintf(stderr, "publish reply: %s\n", status_text[status]);
- return SW_OKAY;
-}
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_text_record text_record;
- sw_result result;
- sw_discovery_publish_id id;
- int i;
-
- if (sw_discovery_init(&discovery) != SW_OKAY)
- {
- fprintf(stderr, "sw_discovery_init() failed\n");
- return -1;
- }
-
- if (argc < 4)
- {
- fprintf(stderr, "usage: mDNSPublish <name> <type> <port> [service text 1]...[service text n]\n");
- return -1;
- }
-
- if (sw_text_record_init(&text_record) != SW_OKAY)
- {
- fprintf(stderr, "sw_text_record_init() failed\n");
- return -1;
- }
-
- for (i = 4; i < argc; i++)
- {
- if (sw_text_record_add_string(text_record, argv[i]) != SW_OKAY)
- {
- fprintf(stderr, "unable to add service text: %s\n", argv[i]);
- return -1;
- }
- }
-
- printf("%s %s %d\n", argv[1], argv[2], atoi(argv[3]));
-
- if ((result = sw_discovery_publish(discovery, 0, argv[1], argv[2], NULL, NULL, atoi(argv[3]), sw_text_record_bytes(text_record), sw_text_record_len(text_record), my_service_reply, NULL, &id)) != SW_OKAY)
- {
- fprintf(stderr, "publish failed: %d\n", result);
- sw_text_record_fina(text_record);
- return -1;
- }
-
- sw_text_record_fina(text_record);
-
- sw_discovery_run(discovery);
-
- return 0;
-}
diff --git a/trunk/avahi-compat-howl/samples/query.c b/trunk/avahi-compat-howl/samples/query.c
deleted file mode 100644
index a74a81c..0000000
--- a/trunk/avahi-compat-howl/samples/query.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <salt/debug.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-query_record_reply(
- sw_discovery session,
- sw_discovery_oid oid,
- sw_discovery_query_record_status status,
- sw_uint32 interface_index,
- sw_const_string fullname,
- sw_uint16 rrtype,
- sw_uint16 rrclass,
- sw_uint16 rrdatalen,
- sw_const_octets rrdata,
- sw_uint32 ttl,
- sw_opaque extra)
-{
- sw_ipv4_address address;
-
- fprintf(stderr, "interface index = 0x%x, fullname is %s\n", interface_index, fullname);
-
- if ((rrtype == 1) && (rrclass == 1))
- {
- sw_ipv4_address address;
- sw_char name[16];
-
- sw_ipv4_address_init_from_saddr(&address, *(sw_saddr*) rrdata);
-
- fprintf(stderr, "address is %s\n", sw_ipv4_address_name(address, name, sizeof(name)));
- }
-
- return SW_OKAY;
-}
-
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_discovery_oid oid;
- sw_result err;
-
- err = sw_discovery_init(&discovery);
- sw_check_okay(err, exit);
-
- if (argc != 4)
- {
- fprintf(stderr, "usage: mDNSBrowse <name> <rrtype> <rrclass>\n");
- return -1;
- }
-
- err = sw_discovery_query_record(discovery, 0, 0, argv[1], atoi(argv[2]), atoi(argv[3]), query_record_reply, NULL, &oid);
- sw_check_okay(err, exit);
-
- err = sw_discovery_run(discovery);
- sw_check_okay(err, exit);
-
-exit:
-
- return err;
-}
diff --git a/trunk/avahi-compat-howl/samples/resolve.c b/trunk/avahi-compat-howl/samples/resolve.c
deleted file mode 100644
index b921c27..0000000
--- a/trunk/avahi-compat-howl/samples/resolve.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2003, 2004, 2004 Porchdog Software. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY PORCHDOG SOFTWARE ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE HOWL PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of Porchdog Software.
- */
-
-#include <howl.h>
-#include <salt/debug.h>
-#include <stdio.h>
-
-
-static sw_result HOWL_API
-my_resolver(
- sw_discovery discovery,
- sw_discovery_oid oid,
- sw_uint32 interface_index,
- sw_const_string name,
- sw_const_string type,
- sw_const_string domain,
- sw_ipv4_address address,
- sw_port port,
- sw_octets text_record,
- sw_uint32 text_record_len,
- sw_opaque_t extra)
-{
- sw_text_record_iterator it;
- sw_int8 name_buf[16];
- sw_int8 key[SW_TEXT_RECORD_MAX_LEN];
- sw_int8 sval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint8 oval[SW_TEXT_RECORD_MAX_LEN];
- sw_uint32 oval_len;
- sw_result err = SW_OKAY;
-
- sw_discovery_cancel(discovery, oid);
-
- fprintf(stderr, "resolve reply: 0x%x %s %s %s %s %d\n", interface_index, name, type, domain, sw_ipv4_address_name(address, name_buf, 16), port);
-
- if ((text_record_len > 0) && (text_record) && (*text_record != '\0'))
- {
- err = sw_text_record_iterator_init(&it, text_record, text_record_len);
- sw_check_okay(err, exit);
-
- while (sw_text_record_iterator_next(it, key, oval, &oval_len) == SW_OKAY)
- {
- fprintf(stderr, "key = %s, data is %d bytes\n", key, oval_len);
- }
-
- err = sw_text_record_iterator_fina(it);
- sw_check_okay(err, exit);
- }
-
-exit:
-
- return err;
-}
-
-
-#if defined(WIN32)
-int __cdecl
-#else
-int
-#endif
-main(
- int argc,
- char ** argv)
-{
- sw_discovery discovery;
- sw_discovery_oid oid;
- sw_result err;
-
- err = sw_discovery_init(&discovery);
- sw_check_okay(err, exit);
-
- if (argc != 3)
- {
- fprintf(stderr, "usage: mDNSResolve <name> <type>\n");
- return -1;
- }
-
- err = sw_discovery_resolve(discovery, 0, argv[1], argv[2], "local.", my_resolver, NULL, &oid);
- sw_check_okay(err, exit);
-
- err = sw_discovery_run(discovery);
- sw_check_okay(err, exit);
-
-exit:
-
- return err;
-}
diff --git a/trunk/avahi-compat-howl/text-test.c b/trunk/avahi-compat-howl/text-test.c
deleted file mode 100644
index fea653c..0000000
--- a/trunk/avahi-compat-howl/text-test.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include "howl.h"
-
-#define ASSERT_SW_OKAY(t) { sw_result _r; _r = (t); assert(_r == SW_OKAY); }
-#define ASSERT_NOT_NULL(t) { const void* _r; r = (t); assert(_r); }
-
-static void hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %u bytes from %p:\n", size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- sw_text_record r;
- sw_text_record_iterator it;
- char key[255];
- uint8_t val[255];
- sw_ulong val_len;
-
- ASSERT_SW_OKAY(sw_text_record_init(&r));
- ASSERT_SW_OKAY(sw_text_record_add_string(r, "foo=bar"));
- ASSERT_SW_OKAY(sw_text_record_add_string(r, "waldo=baz"));
- ASSERT_SW_OKAY(sw_text_record_add_key_and_string_value(r, "quux", "nimpf"));
- ASSERT_SW_OKAY(sw_text_record_add_key_and_binary_value(r, "quux", "\0\0\0\0", 4));
-
- hexdump(sw_text_record_bytes(r), sw_text_record_len(r));
-
- ASSERT_SW_OKAY(sw_text_record_iterator_init(&it, sw_text_record_bytes(r), sw_text_record_len(r)));
-
- while (sw_text_record_iterator_next(it, key, val, &val_len) == SW_OKAY) {
- printf("key=%s\n", key);
- hexdump(val, val_len);
- }
-
- ASSERT_SW_OKAY(sw_text_record_iterator_fina(it));
-
-
-
-
- ASSERT_SW_OKAY(sw_text_record_fina(r));
-
- return 0;
-}
diff --git a/trunk/avahi-compat-howl/text.c b/trunk/avahi-compat-howl/text.c
deleted file mode 100644
index 3b717be..0000000
--- a/trunk/avahi-compat-howl/text.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-
-#include "howl.h"
-#include "warn.h"
-
-struct _sw_text_record {
- AvahiStringList *strlst;
- uint8_t *buffer;
- size_t buffer_size;
- int buffer_valid;
-};
-
-#ifndef HAVE_STRLCPY
-
-static size_t strlcpy(char *dest, const char *src, size_t n) {
- assert(dest);
- assert(src);
-
- if (n > 0) {
- strncpy(dest, src, n-1);
- dest[n-1] = 0;
- }
-
- return strlen(src);
-}
-
-#endif
-
-sw_result sw_text_record_init(sw_text_record *self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(*self = avahi_new(struct _sw_text_record, 1))) {
- *self = NULL;
- return SW_E_UNKNOWN;
- }
-
- (*self)->strlst = NULL;
- (*self)->buffer = NULL;
- (*self)->buffer_size = 0;
- (*self)->buffer_valid = 0;
-
- return SW_OKAY;
-}
-
-sw_result sw_text_record_fina(sw_text_record self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- avahi_string_list_free(self->strlst);
- avahi_free(self->buffer);
- avahi_free(self);
- return SW_OKAY;
-}
-
-sw_result sw_text_record_add_string(
- sw_text_record self,
- sw_const_string string) {
-
- AvahiStringList *n;
-
- assert(self);
- assert(string);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(n = avahi_string_list_add(self->strlst, string)))
- return SW_E_UNKNOWN;
-
- self->strlst = n;
- self->buffer_valid = 0;
- return SW_OKAY;
-}
-
-sw_result sw_text_record_add_key_and_string_value(
- sw_text_record self,
- sw_const_string key,
- sw_const_string val) {
-
- AvahiStringList *n;
-
- assert(self);
- assert(key);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(n = avahi_string_list_add_pair(self->strlst, key, val)))
- return SW_E_UNKNOWN;
-
- self->strlst = n;
- self->buffer_valid = 0;
- return SW_OKAY;
-}
-
-sw_result sw_text_record_add_key_and_binary_value(
- sw_text_record self,
- sw_const_string key,
- sw_octets val,
- sw_uint32 len) {
-
- AvahiStringList *n;
-
- assert(self);
- assert(key);
- assert(len || !val);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(n = avahi_string_list_add_pair_arbitrary(self->strlst, key, val, len)))
- return SW_E_UNKNOWN;
-
- self->strlst = n;
- self->buffer_valid = 0;
- return SW_OKAY;
-}
-
-static int rebuild(sw_text_record self) {
- assert(self);
-
- if (self->buffer_valid)
- return 0;
-
- self->buffer_size = avahi_string_list_serialize(self->strlst, NULL, 0);
-
- if (!(self->buffer = avahi_realloc(self->buffer, self->buffer_size + 1)))
- return -1;
-
- avahi_string_list_serialize(self->strlst, self->buffer, self->buffer_size);
- self->buffer_valid = 1;
-
- return 0;
-}
-
-sw_octets sw_text_record_bytes(sw_text_record self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (rebuild(self) < 0)
- return NULL;
-
- return self->buffer;
-}
-
-sw_uint32 sw_text_record_len(sw_text_record self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (rebuild(self) < 0)
- return (uint32_t) -1;
-
- return self->buffer_size;
-}
-
-struct _sw_text_record_iterator {
- AvahiStringList *strlst, *index;
-
-};
-
-sw_result sw_text_record_iterator_init(
- sw_text_record_iterator * self,
- sw_octets text_record,
- sw_uint32 text_record_len) {
-
- AvahiStringList *txt;
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- if (!(*self = avahi_new(struct _sw_text_record_iterator, 1))) {
- *self = NULL;
- return SW_E_UNKNOWN;
- }
-
- if (avahi_string_list_parse(text_record, text_record_len, &txt) < 0) {
- avahi_free(*self);
- *self = NULL;
- return SW_E_UNKNOWN;
- }
-
- (*self)->index = (*self)->strlst = avahi_string_list_reverse(txt);
-
- return SW_OKAY;
-}
-
-sw_result sw_text_record_iterator_fina(sw_text_record_iterator self) {
- assert(self);
-
- AVAHI_WARN_LINKAGE;
-
- avahi_string_list_free(self->strlst);
- avahi_free(self);
-
- return SW_OKAY;
-}
-
-sw_result sw_text_record_iterator_next(
- sw_text_record_iterator self,
- char key[SW_TEXT_RECORD_MAX_LEN],
- sw_uint8 val[SW_TEXT_RECORD_MAX_LEN],
- sw_uint32 * val_len) {
-
- char *mkey = NULL, *mvalue = NULL;
- size_t msize = 0;
-
- assert(self);
- assert(key);
-
- AVAHI_WARN_LINKAGE;
-
- if (!self->index)
- return SW_E_UNKNOWN;
-
- if (avahi_string_list_get_pair(self->index, &mkey, &mvalue, &msize) < 0)
- return SW_E_UNKNOWN;
-
- strlcpy(key, mkey, SW_TEXT_RECORD_MAX_LEN);
- memset(val, 0, SW_TEXT_RECORD_MAX_LEN);
- memcpy(val, mvalue, msize);
- *val_len = msize;
-
- avahi_free(mkey);
- avahi_free(mvalue);
-
- self->index = self->index->next;
-
- return SW_OKAY;
-}
-
diff --git a/trunk/avahi-compat-howl/unsupported.c b/trunk/avahi-compat-howl/unsupported.c
deleted file mode 100644
index 800b3c3..0000000
--- a/trunk/avahi-compat-howl/unsupported.c
+++ /dev/null
@@ -1,1021 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/gccmacro.h>
-
-#include "howl.h"
-#include "warn.h"
-
-AVAHI_GCC_NORETURN
-sw_string sw_strdup(AVAHI_GCC_UNUSED sw_const_string str) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_opaque _sw_debug_malloc(
- AVAHI_GCC_UNUSED sw_size_t size,
- AVAHI_GCC_UNUSED sw_const_string function,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_uint32 line) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_opaque _sw_debug_realloc(
- AVAHI_GCC_UNUSED sw_opaque_t mem,
- AVAHI_GCC_UNUSED sw_size_t size,
- AVAHI_GCC_UNUSED sw_const_string function,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_uint32 line) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-void _sw_debug_free(
- AVAHI_GCC_UNUSED sw_opaque_t mem,
- AVAHI_GCC_UNUSED sw_const_string function,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_uint32 line) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-AVAHI_GCC_NORETURN
-sw_const_string sw_strerror(/* howl sucks */) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_timer_init(AVAHI_GCC_UNUSED sw_timer * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_timer_fina(AVAHI_GCC_UNUSED sw_timer self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_time_init(AVAHI_GCC_UNUSED sw_time * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_time_init_now(AVAHI_GCC_UNUSED sw_time * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_time_fina(AVAHI_GCC_UNUSED sw_time self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_time sw_time_add(
- AVAHI_GCC_UNUSED sw_time self,
- AVAHI_GCC_UNUSED sw_time y) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_time sw_time_sub(
- AVAHI_GCC_UNUSED sw_time self,
- AVAHI_GCC_UNUSED sw_time y) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_int32 sw_time_cmp(
- AVAHI_GCC_UNUSED sw_time self,
- AVAHI_GCC_UNUSED sw_time y) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_salt_init(
- AVAHI_GCC_UNUSED sw_salt * self,
- AVAHI_GCC_UNUSED int argc,
- AVAHI_GCC_UNUSED char ** argv) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_fina(AVAHI_GCC_UNUSED sw_salt self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_register_socket(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_socket * _socket,
- AVAHI_GCC_UNUSED sw_socket_event events,
- AVAHI_GCC_UNUSED sw_socket_handler handler,
- AVAHI_GCC_UNUSED sw_socket_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_socket(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_socket * _socket) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-
-sw_result sw_salt_register_timer(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_timer * timer,
- AVAHI_GCC_UNUSED sw_time timeout,
- AVAHI_GCC_UNUSED sw_timer_handler handler,
- AVAHI_GCC_UNUSED sw_timer_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_timer(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_timer * timer) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_register_network_interface(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_network_interface * netif,
- AVAHI_GCC_UNUSED sw_network_interface_handler handler,
- AVAHI_GCC_UNUSED sw_network_interface_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_network_interface_handler(AVAHI_GCC_UNUSED sw_salt self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_register_signal(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_signal * _signal,
- AVAHI_GCC_UNUSED sw_signal_handler handler,
- AVAHI_GCC_UNUSED sw_signal_handler_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
-
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_salt_unregister_signal(
- AVAHI_GCC_UNUSED sw_salt self,
- AVAHI_GCC_UNUSED struct _sw_signal * _signal) {
-
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-void sw_print_assert(
- AVAHI_GCC_UNUSED int code,
- AVAHI_GCC_UNUSED sw_const_string assert_string,
- AVAHI_GCC_UNUSED sw_const_string file,
- AVAHI_GCC_UNUSED sw_const_string func,
- AVAHI_GCC_UNUSED int line) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-void sw_print_debug(
- AVAHI_GCC_UNUSED int level,
- AVAHI_GCC_UNUSED sw_const_string format,
- ...) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-sw_result sw_tcp_socket_init(AVAHI_GCC_UNUSED sw_socket * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_tcp_socket_init_with_desc(
- AVAHI_GCC_UNUSED sw_socket * self,
- AVAHI_GCC_UNUSED sw_sockdesc_t desc) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_udp_socket_init(AVAHI_GCC_UNUSED sw_socket * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_multicast_socket_init(AVAHI_GCC_UNUSED sw_socket * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_fina(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_bind(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_ipv4_address address,
- AVAHI_GCC_UNUSED sw_port port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_join_multicast_group(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_ipv4_address local_address,
- AVAHI_GCC_UNUSED sw_ipv4_address multicast_address,
- AVAHI_GCC_UNUSED sw_uint32 ttl) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_leave_multicast_group(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_listen(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED int qsize) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_connect(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_ipv4_address address,
- AVAHI_GCC_UNUSED sw_port port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_accept(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_socket * _socket) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_send(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t len,
- AVAHI_GCC_UNUSED sw_size_t * bytesWritten) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_sendto(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t len,
- AVAHI_GCC_UNUSED sw_size_t * bytesWritten,
- AVAHI_GCC_UNUSED sw_ipv4_address to,
- AVAHI_GCC_UNUSED sw_port port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_recv(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t max,
- AVAHI_GCC_UNUSED sw_size_t * len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_recvfrom(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_octets buffer,
- AVAHI_GCC_UNUSED sw_size_t max,
- AVAHI_GCC_UNUSED sw_size_t * len,
- AVAHI_GCC_UNUSED sw_ipv4_address * from,
- AVAHI_GCC_UNUSED sw_port * port,
- AVAHI_GCC_UNUSED sw_ipv4_address * dest,
- AVAHI_GCC_UNUSED sw_uint32 * interface_index) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_set_blocking_mode(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_bool blocking_mode) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_set_options(
- AVAHI_GCC_UNUSED sw_socket self,
- AVAHI_GCC_UNUSED sw_socket_options options) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_ipv4_address sw_socket_ipv4_address(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_port sw_socket_port(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-AVAHI_GCC_NORETURN
-sw_sockdesc_t sw_socket_desc(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_socket_close(AVAHI_GCC_UNUSED sw_socket self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_init(AVAHI_GCC_UNUSED sw_socket_options * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_fina(AVAHI_GCC_UNUSED sw_socket_options self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_debug(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_nodelay(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_dontroute(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_keepalive(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_linger(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool onoff,
- AVAHI_GCC_UNUSED sw_uint32 linger) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_reuseaddr(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_bool val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_rcvbuf(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_uint32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_socket_options_set_sndbuf(
- AVAHI_GCC_UNUSED sw_socket_options self,
- AVAHI_GCC_UNUSED sw_uint32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-int sw_socket_error_code(void) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_orb_init(
- AVAHI_GCC_UNUSED sw_corby_orb * self,
- AVAHI_GCC_UNUSED sw_salt salt,
- AVAHI_GCC_UNUSED const sw_corby_orb_config * config,
- AVAHI_GCC_UNUSED sw_corby_orb_observer observer,
- AVAHI_GCC_UNUSED sw_corby_orb_observer_func func,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_fina(AVAHI_GCC_UNUSED sw_corby_orb self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_register_servant(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_corby_servant servant,
- AVAHI_GCC_UNUSED sw_corby_servant_cb cb,
- AVAHI_GCC_UNUSED sw_const_string oid,
- AVAHI_GCC_UNUSED struct _sw_corby_object ** object,
- AVAHI_GCC_UNUSED sw_const_string protocol_name) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_unregister_servant(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_const_string oid) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_register_bidirectional_object(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_object * object) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_register_channel(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_channel * channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_corby_orb_delegate sw_corby_orb_get_delegate(AVAHI_GCC_UNUSED sw_corby_orb self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_orb_set_delegate(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_corby_orb_delegate delegate) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_set_observer(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_corby_orb_observer observer,
- AVAHI_GCC_UNUSED sw_corby_orb_observer_func func,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_protocol_to_address(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_const_string tag,
- AVAHI_GCC_UNUSED sw_string addr,
- AVAHI_GCC_UNUSED sw_port * port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_protocol_to_url(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED sw_const_string tag,
- AVAHI_GCC_UNUSED sw_const_string name,
- AVAHI_GCC_UNUSED sw_string url,
- AVAHI_GCC_UNUSED sw_size_t url_len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_read_channel(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_channel * channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_orb_dispatch_message(
- AVAHI_GCC_UNUSED sw_corby_orb self,
- AVAHI_GCC_UNUSED struct _sw_corby_channel * channel,
- AVAHI_GCC_UNUSED struct _sw_corby_message * message,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer * buffer,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_message_init(AVAHI_GCC_UNUSED sw_corby_message * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_message_fina(AVAHI_GCC_UNUSED sw_corby_message self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init(AVAHI_GCC_UNUSED sw_corby_buffer * self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init_with_size(
- AVAHI_GCC_UNUSED sw_corby_buffer * self,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init_with_delegate(
- AVAHI_GCC_UNUSED sw_corby_buffer * self,
- AVAHI_GCC_UNUSED sw_corby_buffer_delegate delegate,
- AVAHI_GCC_UNUSED sw_corby_buffer_overflow_func overflow,
- AVAHI_GCC_UNUSED sw_corby_buffer_underflow_func underflow,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_init_with_size_and_delegate(
- AVAHI_GCC_UNUSED sw_corby_buffer * self,
- AVAHI_GCC_UNUSED sw_size_t size,
- AVAHI_GCC_UNUSED sw_corby_buffer_delegate delegate,
- AVAHI_GCC_UNUSED sw_corby_buffer_overflow_func overflow,
- AVAHI_GCC_UNUSED sw_corby_buffer_underflow_func underflow,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_fina(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-void sw_corby_buffer_reset(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-sw_result sw_corby_buffer_set_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets octets,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_octets sw_corby_buffer_octets(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return NULL;
-}
-
-sw_size_t sw_corby_buffer_bytes_used(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return 0;
-}
-
-sw_size_t sw_corby_buffer_size(AVAHI_GCC_UNUSED sw_corby_buffer self) {
- AVAHI_WARN_UNSUPPORTED;
- return 0;
-}
-
-sw_result sw_corby_buffer_put_int8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int8 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_uint8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint8 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_int16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int16 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_uint16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint16 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_int32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_uint32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint32 val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_const_octets val,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_const_octets val,
- AVAHI_GCC_UNUSED sw_uint32 len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_const_string val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_object(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED const struct _sw_corby_object * object) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_put_pad(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_corby_buffer_pad pad) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_int8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int8 * val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_uint8(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint8 * val) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_int16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int16 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_uint16(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint16 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_int32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_int32 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_uint32(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_uint32 * val,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets octets,
- AVAHI_GCC_UNUSED sw_size_t size) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_allocate_and_get_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets * val,
- AVAHI_GCC_UNUSED sw_uint32 * size,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_zerocopy_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets * val,
- AVAHI_GCC_UNUSED sw_uint32 * size,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_sized_octets(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_octets val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_allocate_and_get_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_string * val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_zerocopy_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_string * val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_cstring(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED sw_string val,
- AVAHI_GCC_UNUSED sw_uint32 * len,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_buffer_get_object(
- AVAHI_GCC_UNUSED sw_corby_buffer self,
- AVAHI_GCC_UNUSED struct _sw_corby_object ** object,
- AVAHI_GCC_UNUSED sw_uint8 endian) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_start_request(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_const_corby_profile profile,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer ** buffer,
- AVAHI_GCC_UNUSED sw_const_string op,
- AVAHI_GCC_UNUSED sw_uint32 oplen,
- AVAHI_GCC_UNUSED sw_bool reply_expected) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_start_reply(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer ** buffer,
- AVAHI_GCC_UNUSED sw_uint32 request_id,
- AVAHI_GCC_UNUSED sw_corby_reply_status status) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_send(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer * buffer,
- AVAHI_GCC_UNUSED sw_corby_buffer_observer observer,
- AVAHI_GCC_UNUSED sw_corby_buffer_written_func func,
- AVAHI_GCC_UNUSED sw_opaque_t extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_recv(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_salt * salt,
- AVAHI_GCC_UNUSED struct _sw_corby_message ** message,
- AVAHI_GCC_UNUSED sw_uint32 * request_id,
- AVAHI_GCC_UNUSED sw_string * op,
- AVAHI_GCC_UNUSED sw_uint32 * op_len,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer ** buffer,
- AVAHI_GCC_UNUSED sw_uint8 * endian,
- AVAHI_GCC_UNUSED sw_bool block) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_last_recv_from(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_ipv4_address * from,
- AVAHI_GCC_UNUSED sw_port * from_port) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_ff(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED struct _sw_corby_buffer * buffer) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_socket sw_corby_channel_socket(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_channel_retain(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_channel_set_delegate(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_corby_channel_delegate delegate) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-AVAHI_GCC_NORETURN
-sw_corby_channel_delegate sw_corby_channel_get_delegate(
- AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-void sw_corby_channel_set_app_data(
- AVAHI_GCC_UNUSED sw_corby_channel self,
- AVAHI_GCC_UNUSED sw_opaque app_data) {
- AVAHI_WARN_UNSUPPORTED;
-}
-
-AVAHI_GCC_NORETURN
-sw_opaque sw_corby_channel_get_app_data(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED_ABORT;
-}
-
-sw_result sw_corby_channel_fina(AVAHI_GCC_UNUSED sw_corby_channel self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_init_from_url(
- AVAHI_GCC_UNUSED sw_corby_object * self,
- AVAHI_GCC_UNUSED struct _sw_corby_orb * orb,
- AVAHI_GCC_UNUSED sw_const_string url,
- AVAHI_GCC_UNUSED sw_socket_options options,
- AVAHI_GCC_UNUSED sw_uint32 bufsize) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_fina(
- AVAHI_GCC_UNUSED sw_corby_object self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_start_request(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_const_string op,
- AVAHI_GCC_UNUSED sw_uint32 op_len,
- AVAHI_GCC_UNUSED sw_bool reply_expected,
- AVAHI_GCC_UNUSED sw_corby_buffer * buffer) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_send(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_buffer buffer,
- AVAHI_GCC_UNUSED sw_corby_buffer_observer observer,
- AVAHI_GCC_UNUSED sw_corby_buffer_written_func func,
- AVAHI_GCC_UNUSED sw_opaque extra) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_recv(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_message * message,
- AVAHI_GCC_UNUSED sw_corby_buffer * buffer,
- AVAHI_GCC_UNUSED sw_uint8 * endian,
- AVAHI_GCC_UNUSED sw_bool block) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_channel(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_channel * channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_corby_object_set_channel(
- AVAHI_GCC_UNUSED sw_corby_object self,
- AVAHI_GCC_UNUSED sw_corby_channel channel) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_publish_host(
- AVAHI_GCC_UNUSED sw_discovery self,
- AVAHI_GCC_UNUSED sw_uint32 interface_index,
- AVAHI_GCC_UNUSED sw_const_string name,
- AVAHI_GCC_UNUSED sw_const_string domain,
- AVAHI_GCC_UNUSED sw_ipv4_address address,
- AVAHI_GCC_UNUSED sw_discovery_publish_reply reply,
- AVAHI_GCC_UNUSED sw_opaque extra,
- AVAHI_GCC_UNUSED sw_discovery_oid * oid) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_publish_update(
- AVAHI_GCC_UNUSED sw_discovery self,
- AVAHI_GCC_UNUSED sw_discovery_oid oid,
- AVAHI_GCC_UNUSED sw_octets text_record,
- AVAHI_GCC_UNUSED sw_uint32 text_record_len) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_discovery_query_record(
- AVAHI_GCC_UNUSED sw_discovery self,
- AVAHI_GCC_UNUSED sw_uint32 interface_index,
- AVAHI_GCC_UNUSED sw_uint32 flags,
- AVAHI_GCC_UNUSED sw_const_string fullname,
- AVAHI_GCC_UNUSED sw_uint16 rrtype,
- AVAHI_GCC_UNUSED sw_uint16 rrclass,
- AVAHI_GCC_UNUSED sw_discovery_query_record_reply reply,
- AVAHI_GCC_UNUSED sw_opaque extra,
- AVAHI_GCC_UNUSED sw_discovery_oid * oid) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_text_record_string_iterator_init(
- AVAHI_GCC_UNUSED sw_text_record_string_iterator * self,
- AVAHI_GCC_UNUSED sw_const_string text_record_string) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_text_record_string_iterator_fina(
- AVAHI_GCC_UNUSED sw_text_record_string_iterator self) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
-
-sw_result sw_text_record_string_iterator_next(
- AVAHI_GCC_UNUSED sw_text_record_string_iterator self,
- AVAHI_GCC_UNUSED char key[255],
- AVAHI_GCC_UNUSED char val[255]) {
- AVAHI_WARN_UNSUPPORTED;
- return SW_E_NO_IMPL;
-}
diff --git a/trunk/avahi-compat-howl/warn.c b/trunk/avahi-compat-howl/warn.c
deleted file mode 100644
index 4bff7ee..0000000
--- a/trunk/avahi-compat-howl/warn.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "warn.h"
-
-#define COMPAT_LAYER "HOWL"
-#define CGI_SUBSYSTEM "howl"
-
-#include "../avahi-compat-libdns_sd/warn.c"
diff --git a/trunk/avahi-compat-howl/warn.h b/trunk/avahi-compat-howl/warn.h
deleted file mode 100644
index 785dba4..0000000
--- a/trunk/avahi-compat-howl/warn.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef foowarnhhowlfoo
-#define foowarnhhowlfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/* To avoid symbol name clashes when a process links to both our
- * compatiblity layers, we move the symbols out of the way here */
-
-#define avahi_warn_unsupported avahi_warn_unsupported_HOWL
-#define avahi_warn_linkage avahi_warn_linkage_HOWL
-#define avahi_warn avahi_warn_HOWL
-#define avahi_exe_name avahi_exe_name_HOWL
-
-#include "../avahi-compat-libdns_sd/warn.h"
-
-#endif
diff --git a/trunk/avahi-compat-libdns_sd.pc.in b/trunk/avahi-compat-libdns_sd.pc.in
deleted file mode 100644
index d619632..0000000
--- a/trunk/avahi-compat-libdns_sd.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include/avahi-compat-libdns_sd/
-
-Name: avahi-compat-libdns_sd
-Description: Avahi Multicast DNS Responder (libdns_sd Compatibility)
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -ldns_sd
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/trunk/avahi-compat-libdns_sd/Makefile.am b/trunk/avahi-compat-libdns_sd/Makefile.am
deleted file mode 100644
index f822135..0000000
--- a/trunk/avahi-compat-libdns_sd/Makefile.am
+++ /dev/null
@@ -1,75 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-if ENABLE_COMPAT_LIBDNS_SD
-
-avahi_compat_libdns_sddir=$(includedir)/avahi-compat-libdns_sd
-
-avahi_compat_libdns_sd_HEADERS = dns_sd.h
-
-lib_LTLIBRARIES = libdns_sd.la
-
-if ENABLE_TESTS
-noinst_PROGRAMS = txt-test null-test
-endif
-
-libdns_sd_la_SOURCES = \
- dns_sd.h \
- compat.c \
- txt.c \
- unsupported.c \
- warn.c warn.h
-libdns_sd_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-libdns_sd_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la
-
-txt_test_SOURCES = \
- dns_sd.h \
- txt.c \
- txt-test.c \
- warn.c warn.h
-txt_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-txt_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la
-
-null_test_SOURCES = \
- dns_sd.h \
- compat.c \
- null-test.c \
- warn.c warn.h
-null_test_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-null_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la
-
-# You can test the compatibility layer by sticking in mDNSResponder's
-# dns-sd.c source here, naming it "libdns_sd-test.c" and running "make
-# libdns_sd-test" manually. We do not distribute that file due to
-# licensing restrictions.
-
-libdns_sd-test: libdns_sd-test.c libdns_sd.la
- $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test.o -c libdns_sd-test.c
- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test libdns_sd-test.o $(PTHREAD_LIBS) ../avahi-common/libavahi-common.la libdns_sd.la
-
-CLEANFILES = libdns_sd-test.o libdns_sd-test
-
-endif
-endif
diff --git a/trunk/avahi-compat-libdns_sd/compat.c b/trunk/avahi-compat-libdns_sd/compat.c
deleted file mode 100644
index e6b6042..0000000
--- a/trunk/avahi-compat-libdns_sd/compat.c
+++ /dev/null
@@ -1,1253 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <assert.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include <fcntl.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/alternative.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-#include <avahi-client/lookup.h>
-
-#include "warn.h"
-#include "dns_sd.h"
-
-enum {
- COMMAND_POLL = 'p',
- COMMAND_QUIT = 'q',
- COMMAND_POLL_DONE = 'P',
- COMMAND_POLL_FAILED = 'F'
-};
-
-struct type_info {
- char *type;
- AvahiStringList *subtypes;
- int n_subtypes;
-};
-
-struct _DNSServiceRef_t {
- int n_ref;
-
- AvahiSimplePoll *simple_poll;
-
- int thread_fd, main_fd;
-
- pthread_t thread;
- int thread_running;
-
- pthread_mutex_t mutex;
-
- void *context;
- DNSServiceBrowseReply service_browser_callback;
- DNSServiceResolveReply service_resolver_callback;
- DNSServiceDomainEnumReply domain_browser_callback;
- DNSServiceRegisterReply service_register_callback;
-
- AvahiClient *client;
- AvahiServiceBrowser *service_browser;
- AvahiServiceResolver *service_resolver;
- AvahiDomainBrowser *domain_browser;
-
- struct type_info type_info;
- char *service_name, *service_name_chosen, *service_domain, *service_host;
- uint16_t service_port;
- AvahiIfIndex service_interface;
- AvahiStringList *service_txt;
-
- AvahiEntryGroup *entry_group;
-};
-
-#define ASSERT_SUCCESS(r) { int __ret = (r); assert(__ret == 0); }
-
-static DNSServiceErrorType map_error(int error) {
- switch (error) {
- case AVAHI_OK :
- return kDNSServiceErr_NoError;
-
- case AVAHI_ERR_BAD_STATE :
- return kDNSServiceErr_BadState;
-
- case AVAHI_ERR_INVALID_HOST_NAME:
- case AVAHI_ERR_INVALID_DOMAIN_NAME:
- case AVAHI_ERR_INVALID_TTL:
- case AVAHI_ERR_IS_PATTERN:
- case AVAHI_ERR_INVALID_RECORD:
- case AVAHI_ERR_INVALID_SERVICE_NAME:
- case AVAHI_ERR_INVALID_SERVICE_TYPE:
- case AVAHI_ERR_INVALID_PORT:
- case AVAHI_ERR_INVALID_KEY:
- case AVAHI_ERR_INVALID_ADDRESS:
- case AVAHI_ERR_INVALID_SERVICE_SUBTYPE:
- return kDNSServiceErr_BadParam;
-
-
- case AVAHI_ERR_COLLISION:
- return kDNSServiceErr_NameConflict;
-
- case AVAHI_ERR_TOO_MANY_CLIENTS:
- case AVAHI_ERR_TOO_MANY_OBJECTS:
- case AVAHI_ERR_TOO_MANY_ENTRIES:
- case AVAHI_ERR_ACCESS_DENIED:
- return kDNSServiceErr_Refused;
-
- case AVAHI_ERR_INVALID_OPERATION:
- case AVAHI_ERR_INVALID_OBJECT:
- return kDNSServiceErr_Invalid;
-
- case AVAHI_ERR_NO_MEMORY:
- return kDNSServiceErr_NoMemory;
-
- case AVAHI_ERR_INVALID_INTERFACE:
- case AVAHI_ERR_INVALID_PROTOCOL:
- return kDNSServiceErr_BadInterfaceIndex;
-
- case AVAHI_ERR_INVALID_FLAGS:
- return kDNSServiceErr_BadFlags;
-
- case AVAHI_ERR_NOT_FOUND:
- return kDNSServiceErr_NoSuchName;
-
- case AVAHI_ERR_VERSION_MISMATCH:
- return kDNSServiceErr_Incompatible;
-
- case AVAHI_ERR_NO_NETWORK:
- case AVAHI_ERR_OS:
- case AVAHI_ERR_INVALID_CONFIG:
- case AVAHI_ERR_TIMEOUT:
- case AVAHI_ERR_DBUS_ERROR:
- case AVAHI_ERR_DISCONNECTED:
- case AVAHI_ERR_NO_DAEMON:
- break;
-
- }
-
- return kDNSServiceErr_Unknown;
-}
-
-static void type_info_init(struct type_info *i) {
- assert(i);
- i->type = NULL;
- i->subtypes = NULL;
- i->n_subtypes = 0;
-}
-
-static void type_info_free(struct type_info *i) {
- assert(i);
-
- avahi_free(i->type);
- avahi_string_list_free(i->subtypes);
-
- type_info_init(i);
-}
-
-static int type_info_parse(struct type_info *i, const char *t) {
- char *token = NULL;
-
- assert(i);
- assert(t);
-
- type_info_init(i);
-
- for (;;) {
- size_t l;
-
- if (*t == 0)
- break;
-
- l = strcspn(t, ",");
-
- if (l <= 0)
- goto fail;
-
- token = avahi_strndup(t, l);
-
- if (!token)
- goto fail;
-
- if (!i->type) {
- /* This is the first token, hence the main type */
-
- if (!avahi_is_valid_service_type_strict(token))
- goto fail;
-
- i->type = token;
- token = NULL;
- } else {
- char *fst;
-
- /* This is not the first token, hence a subtype */
-
- if (!(fst = avahi_strdup_printf("%s._sub.%s", token, i->type)))
- goto fail;
-
- if (!avahi_is_valid_service_subtype(fst)) {
- avahi_free(fst);
- goto fail;
- }
-
- i->subtypes = avahi_string_list_add(i->subtypes, fst);
- avahi_free(fst);
-
- avahi_free(token);
- token = NULL;
-
- i->n_subtypes++;
- }
-
- t += l;
-
- if (*t == ',')
- t++;
- }
-
- if (i->type)
- return 0;
-
-fail:
- type_info_free(i);
- avahi_free(token);
- return -1;
-}
-
-static const char *add_trailing_dot(const char *s, char *buf, size_t buf_len) {
- if (!s)
- return NULL;
-
- if (*s == 0)
- return s;
-
- if (s[strlen(s)-1] == '.')
- return s;
-
- snprintf(buf, buf_len, "%s.", s);
- return buf;
-}
-
-static int read_command(int fd) {
- ssize_t r;
- char command;
-
- assert(fd >= 0);
-
- if ((r = read(fd, &command, 1)) != 1) {
- fprintf(stderr, __FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- return -1;
- }
-
- return command;
-}
-
-static int write_command(int fd, char reply) {
- assert(fd >= 0);
-
- if (write(fd, &reply, 1) != 1) {
- fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int poll_func(struct pollfd *ufds, unsigned int nfds, int timeout, void *userdata) {
- DNSServiceRef sdref = userdata;
- int ret;
-
- assert(sdref);
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
-/* fprintf(stderr, "pre-syscall\n"); */
- ret = poll(ufds, nfds, timeout);
-/* fprintf(stderr, "post-syscall\n"); */
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- return ret;
-}
-
-static void * thread_func(void *data) {
- DNSServiceRef sdref = data;
- sigset_t mask;
-
- sigfillset(&mask);
- pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
- sdref->thread = pthread_self();
- sdref->thread_running = 1;
-
- for (;;) {
- char command;
-
- if ((command = read_command(sdref->thread_fd)) < 0)
- break;
-
-/* fprintf(stderr, "Command: %c\n", command); */
-
- switch (command) {
-
- case COMMAND_POLL: {
- int ret;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- for (;;) {
- errno = 0;
-
- if ((ret = avahi_simple_poll_run(sdref->simple_poll)) < 0) {
-
- if (errno == EINTR)
- continue;
-
- fprintf(stderr, __FILE__": avahi_simple_poll_run() failed: %s\n", strerror(errno));
- }
-
- break;
- }
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (write_command(sdref->thread_fd, ret < 0 ? COMMAND_POLL_FAILED : COMMAND_POLL_DONE) < 0)
- break;
-
- break;
- }
-
- case COMMAND_QUIT:
- return NULL;
- }
-
- }
-
- return NULL;
-}
-
-static DNSServiceRef sdref_new(void) {
- int fd[2] = { -1, -1 };
- DNSServiceRef sdref = NULL;
- pthread_mutexattr_t mutex_attr;
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0)
- goto fail;
-
- if (!(sdref = avahi_new(struct _DNSServiceRef_t, 1)))
- goto fail;
-
- sdref->n_ref = 1;
- sdref->thread_fd = fd[0];
- sdref->main_fd = fd[1];
-
- sdref->client = NULL;
- sdref->service_browser = NULL;
- sdref->service_resolver = NULL;
- sdref->domain_browser = NULL;
- sdref->entry_group = NULL;
-
- sdref->service_name = sdref->service_name_chosen = sdref->service_domain = sdref->service_host = NULL;
- sdref->service_txt = NULL;
-
- type_info_init(&sdref->type_info);
-
- ASSERT_SUCCESS(pthread_mutexattr_init(&mutex_attr));
- pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE);
- ASSERT_SUCCESS(pthread_mutex_init(&sdref->mutex, &mutex_attr));
-
- sdref->thread_running = 0;
-
- if (!(sdref->simple_poll = avahi_simple_poll_new()))
- goto fail;
-
- avahi_simple_poll_set_func(sdref->simple_poll, poll_func, sdref);
-
- /* Start simple poll */
- if (avahi_simple_poll_prepare(sdref->simple_poll, -1) < 0)
- goto fail;
-
- /* Queue an initial POLL command for the thread */
- if (write_command(sdref->main_fd, COMMAND_POLL) < 0)
- goto fail;
-
- if (pthread_create(&sdref->thread, NULL, thread_func, sdref) != 0)
- goto fail;
-
- sdref->thread_running = 1;
-
- return sdref;
-
-fail:
-
- if (sdref)
- DNSServiceRefDeallocate(sdref);
-
- return NULL;
-}
-
-static void sdref_free(DNSServiceRef sdref) {
- assert(sdref);
-
- if (sdref->thread_running) {
- ASSERT_SUCCESS(write_command(sdref->main_fd, COMMAND_QUIT));
- avahi_simple_poll_wakeup(sdref->simple_poll);
- ASSERT_SUCCESS(pthread_join(sdref->thread, NULL));
- }
-
- if (sdref->client)
- avahi_client_free(sdref->client);
-
- if (sdref->simple_poll)
- avahi_simple_poll_free(sdref->simple_poll);
-
- if (sdref->thread_fd >= 0)
- close(sdref->thread_fd);
-
- if (sdref->main_fd >= 0)
- close(sdref->main_fd);
-
- ASSERT_SUCCESS(pthread_mutex_destroy(&sdref->mutex));
-
- avahi_free(sdref->service_name);
- avahi_free(sdref->service_name_chosen);
- avahi_free(sdref->service_domain);
- avahi_free(sdref->service_host);
-
- type_info_free(&sdref->type_info);
-
- avahi_string_list_free(sdref->service_txt);
-
- avahi_free(sdref);
-}
-
-static void sdref_ref(DNSServiceRef sdref) {
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- sdref->n_ref++;
-}
-
-static void sdref_unref(DNSServiceRef sdref) {
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- if (--(sdref->n_ref) <= 0)
- sdref_free(sdref);
-}
-
-int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdref) {
- if (!sdref || sdref->n_ref <= 0)
- return -1;
-
- AVAHI_WARN_LINKAGE;
-
- return sdref->main_fd;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) {
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
-
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- AVAHI_WARN_LINKAGE;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- sdref_ref(sdref);
-
- /* Cleanup notification socket */
- if (read_command(sdref->main_fd) != COMMAND_POLL_DONE)
- goto finish;
-
- if (avahi_simple_poll_dispatch(sdref->simple_poll) < 0)
- goto finish;
-
- if (sdref->n_ref > 1) /* Perhaps we should die */
-
- /* Dispatch events */
- if (avahi_simple_poll_prepare(sdref->simple_poll, -1) < 0)
- goto finish;
-
- if (sdref->n_ref > 1)
-
- /* Request the poll */
- if (write_command(sdref->main_fd, COMMAND_POLL) < 0)
- goto finish;
-
- ret = kDNSServiceErr_NoError;
-
-finish:
-
- sdref_unref(sdref);
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- return ret;
-}
-
-void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdref) {
- AVAHI_WARN_LINKAGE;
-
- if (sdref)
- sdref_unref(sdref);
-}
-
-static void service_browser_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- DNSServiceRef sdref = userdata;
- char type_fixed[AVAHI_DOMAIN_NAME_MAX], domain_fixed[AVAHI_DOMAIN_NAME_MAX];
- assert(b);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- type = add_trailing_dot(type, type_fixed, sizeof(type_fixed));
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- sdref->service_browser_callback(sdref, kDNSServiceFlagsAdd, interface, kDNSServiceErr_NoError, name, type, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- sdref->service_browser_callback(sdref, 0, interface, kDNSServiceErr_NoError, name, type, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- sdref->service_browser_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), NULL, NULL, NULL, sdref->context);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-static void generic_client_callback(AvahiClient *s, AvahiClientState state, void* userdata) {
- DNSServiceRef sdref = userdata;
- int error = kDNSServiceErr_Unknown;
-
- assert(s);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- switch (state) {
-
- case AVAHI_CLIENT_FAILURE:
-
- if (sdref->service_browser_callback)
- sdref->service_browser_callback(sdref, 0, 0, error, NULL, NULL, NULL, sdref->context);
- else if (sdref->service_resolver_callback)
- sdref->service_resolver_callback(sdref, 0, 0, error, NULL, NULL, 0, 0, NULL, sdref->context);
- else if (sdref->domain_browser_callback)
- sdref->domain_browser_callback(sdref, 0, 0, error, NULL, sdref->context);
-
- break;
-
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_S_REGISTERING:
- case AVAHI_CLIENT_CONNECTING:
- break;
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceBrowse(
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *regtype,
- const char *domain,
- DNSServiceBrowseReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiIfIndex ifindex;
- struct type_info type_info;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(regtype);
- assert(callback);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- type_info_init(&type_info);
-
- if (type_info_parse(&type_info, regtype) < 0 || type_info.n_subtypes > 1) {
- type_info_free(&type_info);
-
- if (!avahi_is_valid_service_type_generic(regtype))
- return kDNSServiceErr_Unsupported;
- } else
- regtype = type_info.subtypes ? (char*) type_info.subtypes->text : type_info.type;
-
- if (!(sdref = sdref_new())) {
- type_info_free(&type_info);
- return kDNSServiceErr_Unknown;
- }
-
- sdref->context = context;
- sdref->service_browser_callback = callback;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- ifindex = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
-
- if (!(sdref->service_browser = avahi_service_browser_new(sdref->client, ifindex, AVAHI_PROTO_UNSPEC, regtype, domain, 0, service_browser_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- type_info_free(&type_info);
-
- return ret;
-}
-
-static void service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- AVAHI_GCC_UNUSED const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- DNSServiceRef sdref = userdata;
-
- assert(r);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
-
- char host_name_fixed[AVAHI_DOMAIN_NAME_MAX];
- char full_name[AVAHI_DOMAIN_NAME_MAX];
- int ret;
- char *p = NULL;
- size_t l = 0;
-
- host_name = add_trailing_dot(host_name, host_name_fixed, sizeof(host_name_fixed));
-
- if ((p = avahi_new0(char, (l = avahi_string_list_serialize(txt, NULL, 0))+1)))
- avahi_string_list_serialize(txt, p, l);
-
- ret = avahi_service_name_join(full_name, sizeof(full_name), name, type, domain);
- assert(ret == AVAHI_OK);
-
- strcat(full_name, ".");
-
- sdref->service_resolver_callback(sdref, 0, interface, kDNSServiceErr_NoError, full_name, host_name, htons(port), l, (unsigned char*) p, sdref->context);
-
- avahi_free(p);
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
- sdref->service_resolver_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), NULL, NULL, 0, 0, NULL, sdref->context);
- break;
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceResolve(
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *name,
- const char *regtype,
- const char *domain,
- DNSServiceResolveReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiIfIndex ifindex;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(name);
- assert(regtype);
- assert(domain);
- assert(callback);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (!(sdref = sdref_new()))
- return kDNSServiceErr_Unknown;
-
- sdref->context = context;
- sdref->service_resolver_callback = callback;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- ifindex = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
-
- if (!(sdref->service_resolver = avahi_service_resolver_new(sdref->client, ifindex, AVAHI_PROTO_UNSPEC, name, regtype, domain, AVAHI_PROTO_UNSPEC, 0, service_resolver_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- return ret;
-}
-
-int DNSSD_API DNSServiceConstructFullName (
- char *fullName,
- const char *service,
- const char *regtype,
- const char *domain) {
-
- AVAHI_WARN_LINKAGE;
-
- assert(fullName);
- assert(regtype);
- assert(domain);
-
- if (avahi_service_name_join(fullName, kDNSServiceMaxDomainName, service, regtype, domain) < 0)
- return -1;
-
- return 0;
-}
-
-static void domain_browser_callback(
- AvahiDomainBrowser *b,
- AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- DNSServiceRef sdref = userdata;
- static char domain_fixed[AVAHI_DOMAIN_NAME_MAX];
-
- assert(b);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- domain = add_trailing_dot(domain, domain_fixed, sizeof(domain_fixed));
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- sdref->domain_browser_callback(sdref, kDNSServiceFlagsAdd, interface, kDNSServiceErr_NoError, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- sdref->domain_browser_callback(sdref, 0, interface, kDNSServiceErr_NoError, domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_FAILURE:
- sdref->domain_browser_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), domain, sdref->context);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains(
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- DNSServiceDomainEnumReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiIfIndex ifindex;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(callback);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly ||
- (flags != kDNSServiceFlagsBrowseDomains && flags != kDNSServiceFlagsRegistrationDomains)) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (!(sdref = sdref_new()))
- return kDNSServiceErr_Unknown;
-
- sdref->context = context;
- sdref->domain_browser_callback = callback;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, generic_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- ifindex = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
-
- if (!(sdref->domain_browser = avahi_domain_browser_new(sdref->client, ifindex, AVAHI_PROTO_UNSPEC, "local",
- flags == kDNSServiceFlagsRegistrationDomains ? AVAHI_DOMAIN_BROWSER_REGISTER : AVAHI_DOMAIN_BROWSER_BROWSE,
- 0, domain_browser_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- return ret;
-}
-
-static void reg_report_error(DNSServiceRef sdref, DNSServiceErrorType error) {
- char regtype_fixed[AVAHI_DOMAIN_NAME_MAX], domain_fixed[AVAHI_DOMAIN_NAME_MAX];
- const char *regtype, *domain;
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- if (!sdref->service_register_callback)
- return;
-
- regtype = add_trailing_dot(sdref->type_info.type, regtype_fixed, sizeof(regtype_fixed));
- domain = add_trailing_dot(sdref->service_domain, domain_fixed, sizeof(domain_fixed));
-
- sdref->service_register_callback(
- sdref, 0, error,
- sdref->service_name_chosen ? sdref->service_name_chosen : sdref->service_name,
- regtype,
- domain,
- sdref->context);
-}
-
-static int reg_create_service(DNSServiceRef sdref) {
- int ret;
- AvahiStringList *l;
-
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- if ((ret = avahi_entry_group_add_service_strlst(
- sdref->entry_group,
- sdref->service_interface,
- AVAHI_PROTO_UNSPEC,
- 0,
- sdref->service_name_chosen,
- sdref->type_info.type,
- sdref->service_domain,
- sdref->service_host,
- sdref->service_port,
- sdref->service_txt)) < 0)
- return ret;
-
- for (l = sdref->type_info.subtypes; l; l = l->next) {
- /* Create a subtype entry */
-
- if (avahi_entry_group_add_service_subtype(
- sdref->entry_group,
- sdref->service_interface,
- AVAHI_PROTO_UNSPEC,
- 0,
- sdref->service_name_chosen,
- sdref->type_info.type,
- sdref->service_domain,
- (const char*) l->text) < 0)
- return ret;
- }
-
- if ((ret = avahi_entry_group_commit(sdref->entry_group)) < 0)
- return ret;
-
- return 0;
-}
-
-static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* userdata) {
- DNSServiceRef sdref = userdata;
-
- assert(s);
- assert(sdref);
- assert(sdref->n_ref >= 1);
-
- /* We've not been setup completely */
- if (!sdref->entry_group)
- return;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
- reg_report_error(sdref, kDNSServiceErr_Unknown);
- break;
-
- case AVAHI_CLIENT_S_RUNNING: {
- int ret;
-
- if (!sdref->service_name) {
- const char *n;
- /* If the service name is taken from the host name, copy that */
-
- avahi_free(sdref->service_name_chosen);
- sdref->service_name_chosen = NULL;
-
- if (!(n = avahi_client_get_host_name(sdref->client))) {
- reg_report_error(sdref, map_error(avahi_client_errno(sdref->client)));
- return;
- }
-
- if (!(sdref->service_name_chosen = avahi_strdup(n))) {
- reg_report_error(sdref, kDNSServiceErr_NoMemory);
- return;
- }
- }
-
- /* Register the service */
-
- if ((ret = reg_create_service(sdref)) < 0) {
- reg_report_error(sdref, map_error(ret));
- return;
- }
-
- break;
- }
-
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_S_REGISTERING:
-
- /* Remove our entry */
- avahi_entry_group_reset(sdref->entry_group);
-
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- /* Ignore */
- break;
- }
-
-}
-
-static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- DNSServiceRef sdref = userdata;
-
- assert(g);
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
-
- /* Inform the user */
- reg_report_error(sdref, kDNSServiceErr_NoError);
-
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
- int ret;
-
- /* Remove our entry */
- avahi_entry_group_reset(sdref->entry_group);
-
- assert(sdref->service_name_chosen);
-
- /* Pick a new name */
- if (!(n = avahi_alternative_service_name(sdref->service_name_chosen))) {
- reg_report_error(sdref, kDNSServiceErr_NoMemory);
- return;
- }
- avahi_free(sdref->service_name_chosen);
- sdref->service_name_chosen = n;
-
- /* Register the service with that new name */
- if ((ret = reg_create_service(sdref)) < 0) {
- reg_report_error(sdref, map_error(ret));
- return;
- }
-
- break;
- }
-
- case AVAHI_ENTRY_GROUP_REGISTERING:
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- /* Ignore */
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- /* Inform the user */
- reg_report_error(sdref, map_error(avahi_client_errno(sdref->client)));
- break;
-
- }
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceRegister (
- DNSServiceRef *ret_sdref,
- DNSServiceFlags flags,
- uint32_t interface,
- const char *name,
- const char *regtype,
- const char *domain,
- const char *host,
- uint16_t port,
- uint16_t txtLen,
- const void *txtRecord,
- DNSServiceRegisterReply callback,
- void *context) {
-
- DNSServiceErrorType ret = kDNSServiceErr_Unknown;
- int error;
- DNSServiceRef sdref = NULL;
- AvahiStringList *txt = NULL;
- struct type_info type_info;
-
- AVAHI_WARN_LINKAGE;
-
- assert(ret_sdref);
- assert(regtype);
- assert(txtRecord || txtLen == 0);
-
- if (interface == kDNSServiceInterfaceIndexLocalOnly || flags) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (txtLen > 0)
- if (avahi_string_list_parse(txtRecord, txtLen, &txt) < 0)
- return kDNSServiceErr_Invalid;
-
- if (type_info_parse(&type_info, regtype) < 0) {
- avahi_string_list_free(txt);
- return kDNSServiceErr_Invalid;
- }
-
- if (!(sdref = sdref_new())) {
- avahi_string_list_free(txt);
- type_info_free(&type_info);
- return kDNSServiceErr_Unknown;
- }
-
- sdref->context = context;
- sdref->service_register_callback = callback;
-
- sdref->type_info = type_info;
- sdref->service_name = avahi_strdup(name);
- sdref->service_domain = domain ? avahi_normalize_name_strdup(domain) : NULL;
- sdref->service_host = host ? avahi_normalize_name_strdup(host) : NULL;
- sdref->service_interface = interface == kDNSServiceInterfaceIndexAny ? AVAHI_IF_UNSPEC : (AvahiIfIndex) interface;
- sdref->service_port = ntohs(port);
- sdref->service_txt = txt;
-
- /* Some OOM checking would be cool here */
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, reg_client_callback, sdref, &error))) {
- ret = map_error(error);
- goto finish;
- }
-
- if (!sdref->service_domain) {
- const char *d;
-
- if (!(d = avahi_client_get_domain_name(sdref->client))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- if (!(sdref->service_domain = avahi_strdup(d))) {
- ret = kDNSServiceErr_NoMemory;
- goto finish;
- }
- }
-
- if (!(sdref->entry_group = avahi_entry_group_new(sdref->client, reg_entry_group_callback, sdref))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- if (avahi_client_get_state(sdref->client) == AVAHI_CLIENT_S_RUNNING) {
- const char *n;
-
- if (sdref->service_name)
- n = sdref->service_name;
- else {
- if (!(n = avahi_client_get_host_name(sdref->client))) {
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
- }
-
- if (!(sdref->service_name_chosen = avahi_strdup(n))) {
- ret = kDNSServiceErr_NoMemory;
- goto finish;
- }
-
-
- if ((error = reg_create_service(sdref)) < 0) {
- ret = map_error(error);
- goto finish;
- }
- }
-
- ret = kDNSServiceErr_NoError;
- *ret_sdref = sdref;
-
-finish:
-
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- if (ret != kDNSServiceErr_NoError)
- DNSServiceRefDeallocate(sdref);
-
- return ret;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
- DNSServiceRef sdref,
- DNSRecordRef rref,
- DNSServiceFlags flags,
- uint16_t rdlen,
- const void *rdata,
- AVAHI_GCC_UNUSED uint32_t ttl) {
-
- int ret = kDNSServiceErr_Unknown;
- AvahiStringList *txt = NULL;
- assert(sdref);
-
- AVAHI_WARN_LINKAGE;
-
- if (flags || rref) {
- AVAHI_WARN_UNSUPPORTED;
- return kDNSServiceErr_Unsupported;
- }
-
- if (rdlen > 0)
- if (avahi_string_list_parse(rdata, rdlen, &txt) < 0)
- return kDNSServiceErr_Invalid;
-
- ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex));
-
- if (!avahi_string_list_equal(txt, sdref->service_txt)) {
-
- avahi_string_list_free(sdref->service_txt);
- sdref->service_txt = txt;
-
- if (avahi_client_get_state(sdref->client) == AVAHI_CLIENT_S_RUNNING &&
- sdref->entry_group &&
- (avahi_entry_group_get_state(sdref->entry_group) == AVAHI_ENTRY_GROUP_ESTABLISHED ||
- avahi_entry_group_get_state(sdref->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING))
-
- if (avahi_entry_group_update_service_txt_strlst(
- sdref->entry_group,
- sdref->service_interface,
- AVAHI_PROTO_UNSPEC,
- 0,
- sdref->service_name_chosen,
- sdref->type_info.type,
- sdref->service_domain,
- sdref->service_txt) < 0) {
-
- ret = map_error(avahi_client_errno(sdref->client));
- goto finish;
- }
-
- } else
- avahi_string_list_free(txt);
-
- ret = kDNSServiceErr_NoError;
-
-finish:
- ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
- return ret;
-}
-
diff --git a/trunk/avahi-compat-libdns_sd/dns_sd.h b/trunk/avahi-compat-libdns_sd/dns_sd.h
deleted file mode 100644
index b7eb8a2..0000000
--- a/trunk/avahi-compat-libdns_sd/dns_sd.h
+++ /dev/null
@@ -1,1722 +0,0 @@
-/* -*- Mode: C; tab-width: 4 -*-
- *
- * Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of its
- * contributors may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _DNS_SD_H
-#define _DNS_SD_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* standard calling convention under Win32 is __stdcall */
-/* Note: When compiling Intel EFI (Extensible Firmware Interface) under MS Visual Studio, the */
-/* _WIN32 symbol is defined by the compiler even though it's NOT compiling code for Windows32 */
-#if defined(_WIN32) && !defined(EFI32) && !defined(EFI64)
-#define DNSSD_API __stdcall
-#else
-#define DNSSD_API
-#endif
-
-/* stdint.h does not exist on FreeBSD 4.x; its types are defined in sys/types.h instead */
-#if defined(__FreeBSD__) && (__FreeBSD__ < 5)
-#include <sys/types.h>
-
-/* Likewise, on Sun, standard integer types are in sys/types.h */
-#elif defined(__sun__)
-#include <sys/types.h>
-
-/* EFI does not have stdint.h, or anything else equivalent */
-#elif defined(EFI32) || defined(EFI64)
-typedef UINT8 uint8_t;
-typedef INT8 int8_t;
-typedef UINT16 uint16_t;
-typedef INT16 int16_t;
-typedef UINT32 uint32_t;
-typedef INT32 int32_t;
-
-/* Windows has its own differences */
-#elif defined(_WIN32)
-#include <windows.h>
-#define _UNUSED
-#define bzero(a, b) memset(a, 0, b)
-#ifndef _MSL_STDINT_H
-typedef UINT8 uint8_t;
-typedef INT8 int8_t;
-typedef UINT16 uint16_t;
-typedef INT16 int16_t;
-typedef UINT32 uint32_t;
-typedef INT32 int32_t;
-#endif
-
-/* All other Posix platforms use stdint.h */
-#else
-#include <stdint.h>
-#endif
-
-/* DNSServiceRef, DNSRecordRef
- *
- * Opaque internal data types.
- * Note: client is responsible for serializing access to these structures if
- * they are shared between concurrent threads.
- */
-
-typedef struct _DNSServiceRef_t *DNSServiceRef;
-typedef struct _DNSRecordRef_t *DNSRecordRef;
-
-/* General flags used in functions defined below */
-enum
- {
- kDNSServiceFlagsMoreComing = 0x1,
- /* MoreComing indicates to a callback that at least one more result is
- * queued and will be delivered following immediately after this one.
- * Applications should not update their UI to display browse
- * results when the MoreComing flag is set, because this would
- * result in a great deal of ugly flickering on the screen.
- * Applications should instead wait until until MoreComing is not set,
- * and then update their UI.
- * When MoreComing is not set, that doesn't mean there will be no more
- * answers EVER, just that there are no more answers immediately
- * available right now at this instant. If more answers become available
- * in the future they will be delivered as usual.
- */
-
- kDNSServiceFlagsAdd = 0x2,
- kDNSServiceFlagsDefault = 0x4,
- /* Flags for domain enumeration and browse/query reply callbacks.
- * "Default" applies only to enumeration and is only valid in
- * conjuction with "Add". An enumeration callback with the "Add"
- * flag NOT set indicates a "Remove", i.e. the domain is no longer
- * valid.
- */
-
- kDNSServiceFlagsNoAutoRename = 0x8,
- /* Flag for specifying renaming behavior on name conflict when registering
- * non-shared records. By default, name conflicts are automatically handled
- * by renaming the service. NoAutoRename overrides this behavior - with this
- * flag set, name conflicts will result in a callback. The NoAutorename flag
- * is only valid if a name is explicitly specified when registering a service
- * (i.e. the default name is not used.)
- */
-
- kDNSServiceFlagsShared = 0x10,
- kDNSServiceFlagsUnique = 0x20,
- /* Flag for registering individual records on a connected
- * DNSServiceRef. Shared indicates that there may be multiple records
- * with this name on the network (e.g. PTR records). Unique indicates that the
- * record's name is to be unique on the network (e.g. SRV records).
- */
-
- kDNSServiceFlagsBrowseDomains = 0x40,
- kDNSServiceFlagsRegistrationDomains = 0x80,
- /* Flags for specifying domain enumeration type in DNSServiceEnumerateDomains.
- * BrowseDomains enumerates domains recommended for browsing, RegistrationDomains
- * enumerates domains recommended for registration.
- */
-
- kDNSServiceFlagsLongLivedQuery = 0x100,
- /* Flag for creating a long-lived unicast query for the DNSServiceQueryRecord call. */
-
- kDNSServiceFlagsAllowRemoteQuery = 0x200,
- /* Flag for creating a record for which we will answer remote queries
- * (queries from hosts more than one hop away; hosts not directly connected to the local link).
- */
-
- kDNSServiceFlagsForceMulticast = 0x400,
- /* Flag for signifying that a query or registration should be performed exclusively via multicast DNS,
- * even for a name in a domain (e.g. foo.apple.com.) that would normally imply unicast DNS.
- */
-
- kDNSServiceFlagsReturnCNAME = 0x800
- /* Flag for returning CNAME records in the DNSServiceQueryRecord call. CNAME records are
- * normally followed without indicating to the client that there was a CNAME record.
- */
- };
-
-/*
- * The values for DNS Classes and Types are listed in RFC 1035, and are available
- * on every OS in its DNS header file. Unfortunately every OS does not have the
- * same header file containing DNS Class and Type constants, and the names of
- * the constants are not consistent. For example, BIND 8 uses "T_A",
- * BIND 9 uses "ns_t_a", Windows uses "DNS_TYPE_A", etc.
- * For this reason, these constants are also listed here, so that code using
- * the DNS-SD programming APIs can use these constants, so that the same code
- * can compile on all our supported platforms.
- */
-
-enum
- {
- kDNSServiceClass_IN = 1 /* Internet */
- };
-
-enum
- {
- kDNSServiceType_A = 1, /* Host address. */
- kDNSServiceType_NS = 2, /* Authoritative server. */
- kDNSServiceType_MD = 3, /* Mail destination. */
- kDNSServiceType_MF = 4, /* Mail forwarder. */
- kDNSServiceType_CNAME = 5, /* Canonical name. */
- kDNSServiceType_SOA = 6, /* Start of authority zone. */
- kDNSServiceType_MB = 7, /* Mailbox domain name. */
- kDNSServiceType_MG = 8, /* Mail group member. */
- kDNSServiceType_MR = 9, /* Mail rename name. */
- kDNSServiceType_NULL = 10, /* Null resource record. */
- kDNSServiceType_WKS = 11, /* Well known service. */
- kDNSServiceType_PTR = 12, /* Domain name pointer. */
- kDNSServiceType_HINFO = 13, /* Host information. */
- kDNSServiceType_MINFO = 14, /* Mailbox information. */
- kDNSServiceType_MX = 15, /* Mail routing information. */
- kDNSServiceType_TXT = 16, /* One or more text strings. */
- kDNSServiceType_RP = 17, /* Responsible person. */
- kDNSServiceType_AFSDB = 18, /* AFS cell database. */
- kDNSServiceType_X25 = 19, /* X_25 calling address. */
- kDNSServiceType_ISDN = 20, /* ISDN calling address. */
- kDNSServiceType_RT = 21, /* Router. */
- kDNSServiceType_NSAP = 22, /* NSAP address. */
- kDNSServiceType_NSAP_PTR = 23, /* Reverse NSAP lookup (deprecated). */
- kDNSServiceType_SIG = 24, /* Security signature. */
- kDNSServiceType_KEY = 25, /* Security key. */
- kDNSServiceType_PX = 26, /* X.400 mail mapping. */
- kDNSServiceType_GPOS = 27, /* Geographical position (withdrawn). */
- kDNSServiceType_AAAA = 28, /* IPv6 Address. */
- kDNSServiceType_LOC = 29, /* Location Information. */
- kDNSServiceType_NXT = 30, /* Next domain (security). */
- kDNSServiceType_EID = 31, /* Endpoint identifier. */
- kDNSServiceType_NIMLOC = 32, /* Nimrod Locator. */
- kDNSServiceType_SRV = 33, /* Server Selection. */
- kDNSServiceType_ATMA = 34, /* ATM Address */
- kDNSServiceType_NAPTR = 35, /* Naming Authority PoinTeR */
- kDNSServiceType_KX = 36, /* Key Exchange */
- kDNSServiceType_CERT = 37, /* Certification record */
- kDNSServiceType_A6 = 38, /* IPv6 Address (deprecated) */
- kDNSServiceType_DNAME = 39, /* Non-terminal DNAME (for IPv6) */
- kDNSServiceType_SINK = 40, /* Kitchen sink (experimentatl) */
- kDNSServiceType_OPT = 41, /* EDNS0 option (meta-RR) */
- kDNSServiceType_TKEY = 249, /* Transaction key */
- kDNSServiceType_TSIG = 250, /* Transaction signature. */
- kDNSServiceType_IXFR = 251, /* Incremental zone transfer. */
- kDNSServiceType_AXFR = 252, /* Transfer zone of authority. */
- kDNSServiceType_MAILB = 253, /* Transfer mailbox records. */
- kDNSServiceType_MAILA = 254, /* Transfer mail agent records. */
- kDNSServiceType_ANY = 255 /* Wildcard match. */
- };
-
-
-/* possible error code values */
-enum
- {
- kDNSServiceErr_NoError = 0,
- kDNSServiceErr_Unknown = -65537, /* 0xFFFE FFFF */
- kDNSServiceErr_NoSuchName = -65538,
- kDNSServiceErr_NoMemory = -65539,
- kDNSServiceErr_BadParam = -65540,
- kDNSServiceErr_BadReference = -65541,
- kDNSServiceErr_BadState = -65542,
- kDNSServiceErr_BadFlags = -65543,
- kDNSServiceErr_Unsupported = -65544,
- kDNSServiceErr_NotInitialized = -65545,
- kDNSServiceErr_AlreadyRegistered = -65547,
- kDNSServiceErr_NameConflict = -65548,
- kDNSServiceErr_Invalid = -65549,
- kDNSServiceErr_Firewall = -65550,
- kDNSServiceErr_Incompatible = -65551, /* client library incompatible with daemon */
- kDNSServiceErr_BadInterfaceIndex = -65552,
- kDNSServiceErr_Refused = -65553,
- kDNSServiceErr_NoSuchRecord = -65554,
- kDNSServiceErr_NoAuth = -65555,
- kDNSServiceErr_NoSuchKey = -65556,
- kDNSServiceErr_NATTraversal = -65557,
- kDNSServiceErr_DoubleNAT = -65558,
- kDNSServiceErr_BadTime = -65559
- /* mDNS Error codes are in the range
- * FFFE FF00 (-65792) to FFFE FFFF (-65537) */
- };
-
-
-/* Maximum length, in bytes, of a service name represented as a */
-/* literal C-String, including the terminating NULL at the end. */
-
-#define kDNSServiceMaxServiceName 64
-
-/* Maximum length, in bytes, of a domain name represented as an *escaped* C-String */
-/* including the final trailing dot, and the C-String terminating NULL at the end. */
-
-#define kDNSServiceMaxDomainName 1005
-
-/*
- * Notes on DNS Name Escaping
- * -- or --
- * "Why is kDNSServiceMaxDomainName 1005, when the maximum legal domain name is 255 bytes?"
- *
- * All strings used in DNS-SD are UTF-8 strings.
- * With few exceptions, most are also escaped using standard DNS escaping rules:
- *
- * '\\' represents a single literal '\' in the name
- * '\.' represents a single literal '.' in the name
- * '\ddd', where ddd is a three-digit decimal value from 000 to 255,
- * represents a single literal byte with that value.
- * A bare unescaped '.' is a label separator, marking a boundary between domain and subdomain.
- *
- * The exceptions, that do not use escaping, are the routines where the full
- * DNS name of a resource is broken, for convenience, into servicename/regtype/domain.
- * In these routines, the "servicename" is NOT escaped. It does not need to be, since
- * it is, by definition, just a single literal string. Any characters in that string
- * represent exactly what they are. The "regtype" portion is, technically speaking,
- * escaped, but since legal regtypes are only allowed to contain letters, digits,
- * and hyphens, there is nothing to escape, so the issue is moot. The "domain"
- * portion is also escaped, though most domains in use on the public Internet
- * today, like regtypes, don't contain any characters that need to be escaped.
- * As DNS-SD becomes more popular, rich-text domains for service discovery will
- * become common, so software should be written to cope with domains with escaping.
- *
- * The servicename may be up to 63 bytes of UTF-8 text (not counting the C-String
- * terminating NULL at the end). The regtype is of the form _service._tcp or
- * _service._udp, where the "service" part is 1-14 characters, which may be
- * letters, digits, or hyphens. The domain part of the three-part name may be
- * any legal domain, providing that the resulting servicename+regtype+domain
- * name does not exceed 255 bytes.
- *
- * For most software, these issues are transparent. When browsing, the discovered
- * servicenames should simply be displayed as-is. When resolving, the discovered
- * servicename/regtype/domain are simply passed unchanged to DNSServiceResolve().
- * When a DNSServiceResolve() succeeds, the returned fullname is already in
- * the correct format to pass to standard system DNS APIs such as res_query().
- * For converting from servicename/regtype/domain to a single properly-escaped
- * full DNS name, the helper function DNSServiceConstructFullName() is provided.
- *
- * The following (highly contrived) example illustrates the escaping process.
- * Suppose you have an service called "Dr. Smith\Dr. Johnson", of type "_ftp._tcp"
- * in subdomain "4th. Floor" of subdomain "Building 2" of domain "apple.com."
- * The full (escaped) DNS name of this service's SRV record would be:
- * Dr\.\032Smith\\Dr\.\032Johnson._ftp._tcp.4th\.\032Floor.Building\0322.apple.com.
- */
-
-
-/*
- * Constants for specifying an interface index
- *
- * Specific interface indexes are identified via a 32-bit unsigned integer returned
- * by the if_nametoindex() family of calls.
- *
- * If the client passes 0 for interface index, that means "do the right thing",
- * which (at present) means, "if the name is in an mDNS local multicast domain
- * (e.g. 'local.', '254.169.in-addr.arpa.', '{8,9,A,B}.E.F.ip6.arpa.') then multicast
- * on all applicable interfaces, otherwise send via unicast to the appropriate
- * DNS server." Normally, most clients will use 0 for interface index to
- * automatically get the default sensible behaviour.
- *
- * If the client passes a positive interface index, then for multicast names that
- * indicates to do the operation only on that one interface. For unicast names the
- * interface index is ignored unless kDNSServiceFlagsForceMulticast is also set.
- *
- * If the client passes kDNSServiceInterfaceIndexLocalOnly when registering
- * a service, then that service will be found *only* by other local clients
- * on the same machine that are browsing using kDNSServiceInterfaceIndexLocalOnly
- * or kDNSServiceInterfaceIndexAny.
- * If a client has a 'private' service, accessible only to other processes
- * running on the same machine, this allows the client to advertise that service
- * in a way such that it does not inadvertently appear in service lists on
- * all the other machines on the network.
- *
- * If the client passes kDNSServiceInterfaceIndexLocalOnly when browsing
- * then it will find *all* records registered on that same local machine.
- * Clients explicitly wishing to discover *only* LocalOnly services can
- * accomplish this by inspecting the interfaceIndex of each service reported
- * to their DNSServiceBrowseReply() callback function, and discarding those
- * where the interface index is not kDNSServiceInterfaceIndexLocalOnly.
- */
-
-#define kDNSServiceInterfaceIndexAny 0
-#define kDNSServiceInterfaceIndexLocalOnly ( (uint32_t) -1 )
-
-
-typedef uint32_t DNSServiceFlags;
-typedef int32_t DNSServiceErrorType;
-
-
-/*********************************************************************************************
- *
- * Unix Domain Socket access, DNSServiceRef deallocation, and data processing functions
- *
- *********************************************************************************************/
-
-
-/* DNSServiceRefSockFD()
- *
- * Access underlying Unix domain socket for an initialized DNSServiceRef.
- * The DNS Service Discovery implmementation uses this socket to communicate between
- * the client and the mDNSResponder daemon. The application MUST NOT directly read from
- * or write to this socket. Access to the socket is provided so that it can be used as a
- * run loop source, or in a select() loop: when data is available for reading on the socket,
- * DNSServiceProcessResult() should be called, which will extract the daemon's reply from
- * the socket, and pass it to the appropriate application callback. By using a run loop or
- * select(), results from the daemon can be processed asynchronously. Without using these
- * constructs, DNSServiceProcessResult() will block until the response from the daemon arrives.
- * The client is responsible for ensuring that the data on the socket is processed in a timely
- * fashion - the daemon may terminate its connection with a client that does not clear its
- * socket buffer.
- *
- * sdRef: A DNSServiceRef initialized by any of the DNSService calls.
- *
- * return value: The DNSServiceRef's underlying socket descriptor, or -1 on
- * error.
- */
-
-int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdRef);
-
-
-/* DNSServiceProcessResult()
- *
- * Read a reply from the daemon, calling the appropriate application callback. This call will
- * block until the daemon's response is received. Use DNSServiceRefSockFD() in
- * conjunction with a run loop or select() to determine the presence of a response from the
- * server before calling this function to process the reply without blocking. Call this function
- * at any point if it is acceptable to block until the daemon's response arrives. Note that the
- * client is responsible for ensuring that DNSServiceProcessResult() is called whenever there is
- * a reply from the daemon - the daemon may terminate its connection with a client that does not
- * process the daemon's responses.
- *
- * sdRef: A DNSServiceRef initialized by any of the DNSService calls
- * that take a callback parameter.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns
- * an error code indicating the specific failure that occurred.
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdRef);
-
-
-/* DNSServiceRefDeallocate()
- *
- * Terminate a connection with the daemon and free memory associated with the DNSServiceRef.
- * Any services or records registered with this DNSServiceRef will be deregistered. Any
- * Browse, Resolve, or Query operations called with this reference will be terminated.
- *
- * Note: If the reference's underlying socket is used in a run loop or select() call, it should
- * be removed BEFORE DNSServiceRefDeallocate() is called, as this function closes the reference's
- * socket.
- *
- * Note: If the reference was initialized with DNSServiceCreateConnection(), any DNSRecordRefs
- * created via this reference will be invalidated by this call - the resource records are
- * deregistered, and their DNSRecordRefs may not be used in subsequent functions. Similarly,
- * if the reference was initialized with DNSServiceRegister, and an extra resource record was
- * added to the service via DNSServiceAddRecord(), the DNSRecordRef created by the Add() call
- * is invalidated when this function is called - the DNSRecordRef may not be used in subsequent
- * functions.
- *
- * Note: This call is to be used only with the DNSServiceRef defined by this API. It is
- * not compatible with dns_service_discovery_ref objects defined in the legacy Mach-based
- * DNSServiceDiscovery.h API.
- *
- * sdRef: A DNSServiceRef initialized by any of the DNSService calls.
- *
- */
-
-void DNSSD_API DNSServiceRefDeallocate(DNSServiceRef sdRef);
-
-
-/*********************************************************************************************
- *
- * Domain Enumeration
- *
- *********************************************************************************************/
-
-/* DNSServiceEnumerateDomains()
- *
- * Asynchronously enumerate domains available for browsing and registration.
- *
- * The enumeration MUST be cancelled via DNSServiceRefDeallocate() when no more domains
- * are to be found.
- *
- * Note that the names returned are (like all of DNS-SD) UTF-8 strings,
- * and are escaped using standard DNS escaping rules.
- * (See "Notes on DNS Name Escaping" earlier in this file for more details.)
- * A graphical browser displaying a hierarchical tree-structured view should cut
- * the names at the bare dots to yield individual labels, then de-escape each
- * label according to the escaping rules, and then display the resulting UTF-8 text.
- *
- * DNSServiceDomainEnumReply Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceEnumerateDomains().
- *
- * flags: Possible values are:
- * kDNSServiceFlagsMoreComing
- * kDNSServiceFlagsAdd
- * kDNSServiceFlagsDefault
- *
- * interfaceIndex: Specifies the interface on which the domain exists. (The index for a given
- * interface is determined via the if_nametoindex() family of calls.)
- *
- * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise indicates
- * the failure that occurred (other parameters are undefined if errorCode is nonzero).
- *
- * replyDomain: The name of the domain.
- *
- * context: The context pointer passed to DNSServiceEnumerateDomains.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceDomainEnumReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *replyDomain,
- void *context
- );
-
-
-/* DNSServiceEnumerateDomains() Parameters:
- *
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the enumeration operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Possible values are:
- * kDNSServiceFlagsBrowseDomains to enumerate domains recommended for browsing.
- * kDNSServiceFlagsRegistrationDomains to enumerate domains recommended
- * for registration.
- *
- * interfaceIndex: If non-zero, specifies the interface on which to look for domains.
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Most applications will pass 0 to enumerate domains on
- * all interfaces. See "Constants for specifying an interface index" for more details.
- *
- * callBack: The function to be called when a domain is found or the call asynchronously
- * fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is not invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceDomainEnumReply callBack,
- void *context /* may be NULL */
- );
-
-
-/*********************************************************************************************
- *
- * Service Registration
- *
- *********************************************************************************************/
-
-/* Register a service that is discovered via Browse() and Resolve() calls.
- *
- *
- * DNSServiceRegisterReply() Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceRegister().
- *
- * flags: Currently unused, reserved for future use.
- *
- * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will
- * indicate the failure that occurred (including name conflicts,
- * if the kDNSServiceFlagsNoAutoRename flag was used when registering.)
- * Other parameters are undefined if errorCode is nonzero.
- *
- * name: The service name registered (if the application did not specify a name in
- * DNSServiceRegister(), this indicates what name was automatically chosen).
- *
- * regtype: The type of service registered, as it was passed to the callout.
- *
- * domain: The domain on which the service was registered (if the application did not
- * specify a domain in DNSServiceRegister(), this indicates the default domain
- * on which the service was registered).
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceRegisterReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- DNSServiceErrorType errorCode,
- const char *name,
- const char *regtype,
- const char *domain,
- void *context
- );
-
-
-/* DNSServiceRegister() Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the registration will remain active indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * interfaceIndex: If non-zero, specifies the interface on which to register the service
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Most applications will pass 0 to register on all
- * available interfaces. See "Constants for specifying an interface index" for more details.
- *
- * flags: Indicates the renaming behavior on name conflict (most applications
- * will pass 0). See flag definitions above for details.
- *
- * name: If non-NULL, specifies the service name to be registered.
- * Most applications will not specify a name, in which case the computer
- * name is used (this name is communicated to the client via the callback).
- * If a name is specified, it must be 1-63 bytes of UTF-8 text.
- * If the name is longer than 63 bytes it will be automatically truncated
- * to a legal length, unless the NoAutoRename flag is set,
- * in which case kDNSServiceErr_BadParam will be returned.
- *
- * regtype: The service type followed by the protocol, separated by a dot
- * (e.g. "_ftp._tcp"). The service type must be an underscore, followed
- * by 1-14 characters, which may be letters, digits, or hyphens.
- * The transport protocol must be "_tcp" or "_udp". New service types
- * should be registered at <http://www.dns-sd.org/ServiceTypes.html>.
- *
- * domain: If non-NULL, specifies the domain on which to advertise the service.
- * Most applications will not specify a domain, instead automatically
- * registering in the default domain(s).
- *
- * host: If non-NULL, specifies the SRV target host name. Most applications
- * will not specify a host, instead automatically using the machine's
- * default host name(s). Note that specifying a non-NULL host does NOT
- * create an address record for that host - the application is responsible
- * for ensuring that the appropriate address record exists, or creating it
- * via DNSServiceRegisterRecord().
- *
- * port: The port, in network byte order, on which the service accepts connections.
- * Pass 0 for a "placeholder" service (i.e. a service that will not be discovered
- * by browsing, but will cause a name conflict if another client tries to
- * register that same name). Most clients will not use placeholder services.
- *
- * txtLen: The length of the txtRecord, in bytes. Must be zero if the txtRecord is NULL.
- *
- * txtRecord: The TXT record rdata. A non-NULL txtRecord MUST be a properly formatted DNS
- * TXT record, i.e. <length byte> <data> <length byte> <data> ...
- * Passing NULL for the txtRecord is allowed as a synonym for txtLen=1, txtRecord="",
- * i.e. it creates a TXT record of length one containing a single empty string.
- * RFC 1035 doesn't allow a TXT record to contain *zero* strings, so a single empty
- * string is the smallest legal DNS TXT record.
- * As with the other parameters, the DNSServiceRegister call copies the txtRecord
- * data; e.g. if you allocated the storage for the txtRecord parameter with malloc()
- * then you can safely free that memory right after the DNSServiceRegister call returns.
- *
- * callBack: The function to be called when the registration completes or asynchronously
- * fails. The client MAY pass NULL for the callback - The client will NOT be notified
- * of the default values picked on its behalf, and the client will NOT be notified of any
- * asynchronous errors (e.g. out of memory errors, etc.) that may prevent the registration
- * of the service. The client may NOT pass the NoAutoRename flag if the callback is NULL.
- * The client may still deregister the service at any time via DNSServiceRefDeallocate().
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceRegister
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *name, /* may be NULL */
- const char *regtype,
- const char *domain, /* may be NULL */
- const char *host, /* may be NULL */
- uint16_t port,
- uint16_t txtLen,
- const void *txtRecord, /* may be NULL */
- DNSServiceRegisterReply callBack, /* may be NULL */
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceAddRecord()
- *
- * Add a record to a registered service. The name of the record will be the same as the
- * registered service's name.
- * The record can later be updated or deregistered by passing the RecordRef initialized
- * by this function to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
- *
- * Note that the DNSServiceAddRecord/UpdateRecord/RemoveRecord are *NOT* thread-safe
- * with respect to a single DNSServiceRef. If you plan to have multiple threads
- * in your program simultaneously add, update, or remove records from the same
- * DNSServiceRef, then it's the caller's responsibility to use a mutext lock
- * or take similar appropriate precautions to serialize those calls.
- *
- *
- * Parameters;
- *
- * sdRef: A DNSServiceRef initialized by DNSServiceRegister().
- *
- * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this
- * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
- * If the above DNSServiceRef is passed to DNSServiceRefDeallocate(), RecordRef is also
- * invalidated and may not be used further.
- *
- * flags: Currently ignored, reserved for future use.
- *
- * rrtype: The type of the record (e.g. kDNSServiceType_TXT, kDNSServiceType_SRV, etc)
- *
- * rdlen: The length, in bytes, of the rdata.
- *
- * rdata: The raw rdata to be contained in the added resource record.
- *
- * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an
- * error code indicating the error that occurred (the RecordRef is not initialized).
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceAddRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef *RecordRef,
- DNSServiceFlags flags,
- uint16_t rrtype,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl
- );
-
-
-/* DNSServiceUpdateRecord
- *
- * Update a registered resource record. The record must either be:
- * - The primary txt record of a service registered via DNSServiceRegister()
- * - A record added to a registered service via DNSServiceAddRecord()
- * - An individual record registered by DNSServiceRegisterRecord()
- *
- *
- * Parameters:
- *
- * sdRef: A DNSServiceRef that was initialized by DNSServiceRegister()
- * or DNSServiceCreateConnection().
- *
- * RecordRef: A DNSRecordRef initialized by DNSServiceAddRecord, or NULL to update the
- * service's primary txt record.
- *
- * flags: Currently ignored, reserved for future use.
- *
- * rdlen: The length, in bytes, of the new rdata.
- *
- * rdata: The new rdata to be contained in the updated resource record.
- *
- * ttl: The time to live of the updated resource record, in seconds.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an
- * error code indicating the error that occurred.
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef RecordRef, /* may be NULL */
- DNSServiceFlags flags,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl
- );
-
-
-/* DNSServiceRemoveRecord
- *
- * Remove a record previously added to a service record set via DNSServiceAddRecord(), or deregister
- * an record registered individually via DNSServiceRegisterRecord().
- *
- * Parameters:
- *
- * sdRef: A DNSServiceRef initialized by DNSServiceRegister() (if the
- * record being removed was registered via DNSServiceAddRecord()) or by
- * DNSServiceCreateConnection() (if the record being removed was registered via
- * DNSServiceRegisterRecord()).
- *
- * recordRef: A DNSRecordRef initialized by a successful call to DNSServiceAddRecord()
- * or DNSServiceRegisterRecord().
- *
- * flags: Currently ignored, reserved for future use.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns an
- * error code indicating the error that occurred.
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef RecordRef,
- DNSServiceFlags flags
- );
-
-
-/*********************************************************************************************
- *
- * Service Discovery
- *
- *********************************************************************************************/
-
-/* Browse for instances of a service.
- *
- *
- * DNSServiceBrowseReply() Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceBrowse().
- *
- * flags: Possible values are kDNSServiceFlagsMoreComing and kDNSServiceFlagsAdd.
- * See flag definitions for details.
- *
- * interfaceIndex: The interface on which the service is advertised. This index should
- * be passed to DNSServiceResolve() when resolving the service.
- *
- * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will
- * indicate the failure that occurred. Other parameters are undefined if
- * the errorCode is nonzero.
- *
- * serviceName: The discovered service name. This name should be displayed to the user,
- * and stored for subsequent use in the DNSServiceResolve() call.
- *
- * regtype: The service type, which is usually (but not always) the same as was passed
- * to DNSServiceBrowse(). One case where the discovered service type may
- * not be the same as the requested service type is when using subtypes:
- * The client may want to browse for only those ftp servers that allow
- * anonymous connections. The client will pass the string "_ftp._tcp,_anon"
- * to DNSServiceBrowse(), but the type of the service that's discovered
- * is simply "_ftp._tcp". The regtype for each discovered service instance
- * should be stored along with the name, so that it can be passed to
- * DNSServiceResolve() when the service is later resolved.
- *
- * domain: The domain of the discovered service instance. This may or may not be the
- * same as the domain that was passed to DNSServiceBrowse(). The domain for each
- * discovered service instance should be stored along with the name, so that
- * it can be passed to DNSServiceResolve() when the service is later resolved.
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceBrowseReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *serviceName,
- const char *regtype,
- const char *replyDomain,
- void *context
- );
-
-
-/* DNSServiceBrowse() Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the browse operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Currently ignored, reserved for future use.
- *
- * interfaceIndex: If non-zero, specifies the interface on which to browse for services
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Most applications will pass 0 to browse on all available
- * interfaces. See "Constants for specifying an interface index" for more details.
- *
- * regtype: The service type being browsed for followed by the protocol, separated by a
- * dot (e.g. "_ftp._tcp"). The transport protocol must be "_tcp" or "_udp".
- *
- * domain: If non-NULL, specifies the domain on which to browse for services.
- * Most applications will not specify a domain, instead browsing on the
- * default domain(s).
- *
- * callBack: The function to be called when an instance of the service being browsed for
- * is found, or if the call asynchronously fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is not invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceBrowse
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *regtype,
- const char *domain, /* may be NULL */
- DNSServiceBrowseReply callBack,
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceResolve()
- *
- * Resolve a service name discovered via DNSServiceBrowse() to a target host name, port number, and
- * txt record.
- *
- * Note: Applications should NOT use DNSServiceResolve() solely for txt record monitoring - use
- * DNSServiceQueryRecord() instead, as it is more efficient for this task.
- *
- * Note: When the desired results have been returned, the client MUST terminate the resolve by calling
- * DNSServiceRefDeallocate().
- *
- * Note: DNSServiceResolve() behaves correctly for typical services that have a single SRV record
- * and a single TXT record. To resolve non-standard services with multiple SRV or TXT records,
- * DNSServiceQueryRecord() should be used.
- *
- * DNSServiceResolveReply Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceResolve().
- *
- * flags: Currently unused, reserved for future use.
- *
- * interfaceIndex: The interface on which the service was resolved.
- *
- * errorCode: Will be kDNSServiceErr_NoError (0) on success, otherwise will
- * indicate the failure that occurred. Other parameters are undefined if
- * the errorCode is nonzero.
- *
- * fullname: The full service domain name, in the form <servicename>.<protocol>.<domain>.
- * (This name is escaped following standard DNS rules, making it suitable for
- * passing to standard system DNS APIs such as res_query(), or to the
- * special-purpose functions included in this API that take fullname parameters.
- * See "Notes on DNS Name Escaping" earlier in this file for more details.)
- *
- * hosttarget: The target hostname of the machine providing the service. This name can
- * be passed to functions like gethostbyname() to identify the host's IP address.
- *
- * port: The port, in network byte order, on which connections are accepted for this service.
- *
- * txtLen: The length of the txt record, in bytes.
- *
- * txtRecord: The service's primary txt record, in standard txt record format.
- *
- * context: The context pointer that was passed to the callout.
- *
- * NOTE: In earlier versions of this header file, the txtRecord parameter was declared "const char *"
- * This is incorrect, since it contains length bytes which are values in the range 0 to 255, not -128 to +127.
- * Depending on your compiler settings, this change may cause signed/unsigned mismatch warnings.
- * These should be fixed by updating your own callback function definition to match the corrected
- * function signature using "const unsigned char *txtRecord". Making this change may also fix inadvertent
- * bugs in your callback function, where it could have incorrectly interpreted a length byte with value 250
- * as being -6 instead, with various bad consequences ranging from incorrect operation to software crashes.
- * If you need to maintain portable code that will compile cleanly with both the old and new versions of
- * this header file, you should update your callback function definition to use the correct unsigned value,
- * and then in the place where you pass your callback function to DNSServiceResolve(), use a cast to eliminate
- * the compiler warning, e.g.:
- * DNSServiceResolve(sd, flags, index, name, regtype, domain, (DNSServiceResolveReply)MyCallback, context);
- * This will ensure that your code compiles cleanly without warnings (and more importantly, works correctly)
- * with both the old header and with the new corrected version.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceResolveReply)
- (
- DNSServiceRef sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *fullname,
- const char *hosttarget,
- uint16_t port,
- uint16_t txtLen,
- const unsigned char *txtRecord,
- void *context
- );
-
-
-/* DNSServiceResolve() Parameters
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the resolve operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Currently ignored, reserved for future use.
- *
- * interfaceIndex: The interface on which to resolve the service. If this resolve call is
- * as a result of a currently active DNSServiceBrowse() operation, then the
- * interfaceIndex should be the index reported in the DNSServiceBrowseReply
- * callback. If this resolve call is using information previously saved
- * (e.g. in a preference file) for later use, then use interfaceIndex 0, because
- * the desired service may now be reachable via a different physical interface.
- * See "Constants for specifying an interface index" for more details.
- *
- * name: The name of the service instance to be resolved, as reported to the
- * DNSServiceBrowseReply() callback.
- *
- * regtype: The type of the service instance to be resolved, as reported to the
- * DNSServiceBrowseReply() callback.
- *
- * domain: The domain of the service instance to be resolved, as reported to the
- * DNSServiceBrowseReply() callback.
- *
- * callBack: The function to be called when a result is found, or if the call
- * asynchronously fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceResolve
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *name,
- const char *regtype,
- const char *domain,
- DNSServiceResolveReply callBack,
- void *context /* may be NULL */
- );
-
-
-/*********************************************************************************************
- *
- * Special Purpose Calls (most applications will not use these)
- *
- *********************************************************************************************/
-
-/* DNSServiceCreateConnection()
- *
- * Create a connection to the daemon allowing efficient registration of
- * multiple individual records.
- *
- *
- * Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. Deallocating
- * the reference (via DNSServiceRefDeallocate()) severs the
- * connection and deregisters all records registered on this connection.
- *
- * return value: Returns kDNSServiceErr_NoError on success, otherwise returns
- * an error code indicating the specific failure that occurred (in which
- * case the DNSServiceRef is not initialized).
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(DNSServiceRef *sdRef);
-
-
-/* DNSServiceRegisterRecord
- *
- * Register an individual resource record on a connected DNSServiceRef.
- *
- * Note that name conflicts occurring for records registered via this call must be handled
- * by the client in the callback.
- *
- *
- * DNSServiceRegisterRecordReply() parameters:
- *
- * sdRef: The connected DNSServiceRef initialized by
- * DNSServiceCreateConnection().
- *
- * RecordRef: The DNSRecordRef initialized by DNSServiceRegisterRecord(). If the above
- * DNSServiceRef is passed to DNSServiceRefDeallocate(), this DNSRecordRef is
- * invalidated, and may not be used further.
- *
- * flags: Currently unused, reserved for future use.
- *
- * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will
- * indicate the failure that occurred (including name conflicts.)
- * Other parameters are undefined if errorCode is nonzero.
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
- typedef void (DNSSD_API *DNSServiceRegisterRecordReply)
- (
- DNSServiceRef sdRef,
- DNSRecordRef RecordRef,
- DNSServiceFlags flags,
- DNSServiceErrorType errorCode,
- void *context
- );
-
-
-/* DNSServiceRegisterRecord() Parameters:
- *
- * sdRef: A DNSServiceRef initialized by DNSServiceCreateConnection().
- *
- * RecordRef: A pointer to an uninitialized DNSRecordRef. Upon succesfull completion of this
- * call, this ref may be passed to DNSServiceUpdateRecord() or DNSServiceRemoveRecord().
- * (To deregister ALL records registered on a single connected DNSServiceRef
- * and deallocate each of their corresponding DNSServiceRecordRefs, call
- * DNSServiceRefDealloocate()).
- *
- * flags: Possible values are kDNSServiceFlagsShared or kDNSServiceFlagsUnique
- * (see flag type definitions for details).
- *
- * interfaceIndex: If non-zero, specifies the interface on which to register the record
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Passing 0 causes the record to be registered on all interfaces.
- * See "Constants for specifying an interface index" for more details.
- *
- * fullname: The full domain name of the resource record.
- *
- * rrtype: The numerical type of the resource record (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN)
- *
- * rdlen: Length, in bytes, of the rdata.
- *
- * rdata: A pointer to the raw rdata, as it is to appear in the DNS record.
- *
- * ttl: The time to live of the resource record, in seconds. Pass 0 to use a default value.
- *
- * callBack: The function to be called when a result is found, or if the call
- * asynchronously fails (e.g. because of a name conflict.)
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSRecordRef is
- * not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord
- (
- DNSServiceRef sdRef,
- DNSRecordRef *RecordRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl,
- DNSServiceRegisterRecordReply callBack,
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceQueryRecord
- *
- * Query for an arbitrary DNS record.
- *
- *
- * DNSServiceQueryRecordReply() Callback Parameters:
- *
- * sdRef: The DNSServiceRef initialized by DNSServiceQueryRecord().
- *
- * flags: Possible values are kDNSServiceFlagsMoreComing and
- * kDNSServiceFlagsAdd. The Add flag is NOT set for PTR records
- * with a ttl of 0, i.e. "Remove" events.
- *
- * interfaceIndex: The interface on which the query was resolved (the index for a given
- * interface is determined via the if_nametoindex() family of calls).
- * See "Constants for specifying an interface index" for more details.
- *
- * errorCode: Will be kDNSServiceErr_NoError on success, otherwise will
- * indicate the failure that occurred. Other parameters are undefined if
- * errorCode is nonzero.
- *
- * fullname: The resource record's full domain name.
- *
- * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN).
- *
- * rdlen: The length, in bytes, of the resource record rdata.
- *
- * rdata: The raw rdata of the resource record.
- *
- * ttl: The resource record's time to live, in seconds.
- *
- * context: The context pointer that was passed to the callout.
- *
- */
-
-typedef void (DNSSD_API *DNSServiceQueryRecordReply)
- (
- DNSServiceRef DNSServiceRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- DNSServiceErrorType errorCode,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- uint16_t rdlen,
- const void *rdata,
- uint32_t ttl,
- void *context
- );
-
-
-/* DNSServiceQueryRecord() Parameters:
- *
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
- * then it initializes the DNSServiceRef, returns kDNSServiceErr_NoError,
- * and the query operation will run indefinitely until the client
- * terminates it by passing this DNSServiceRef to DNSServiceRefDeallocate().
- *
- * flags: Pass kDNSServiceFlagsLongLivedQuery to create a "long-lived" unicast
- * query in a non-local domain. Without setting this flag, unicast queries
- * will be one-shot - that is, only answers available at the time of the call
- * will be returned. By setting this flag, answers (including Add and Remove
- * events) that become available after the initial call is made will generate
- * callbacks. This flag has no effect on link-local multicast queries.
- *
- * interfaceIndex: If non-zero, specifies the interface on which to issue the query
- * (the index for a given interface is determined via the if_nametoindex()
- * family of calls.) Passing 0 causes the name to be queried for on all
- * interfaces. See "Constants for specifying an interface index" for more details.
- *
- * fullname: The full domain name of the resource record to be queried for.
- *
- * rrtype: The numerical type of the resource record to be queried for
- * (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN).
- *
- * callBack: The function to be called when a result is found, or if the call
- * asynchronously fails.
- *
- * context: An application context pointer which is passed to the callback function
- * (may be NULL).
- *
- * return value: Returns kDNSServiceErr_NoError on succeses (any subsequent, asynchronous
- * errors are delivered to the callback), otherwise returns an error code indicating
- * the error that occurred (the callback is never invoked and the DNSServiceRef
- * is not initialized.)
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceQueryRecord
- (
- DNSServiceRef *sdRef,
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- DNSServiceQueryRecordReply callBack,
- void *context /* may be NULL */
- );
-
-
-/* DNSServiceReconfirmRecord
- *
- * Instruct the daemon to verify the validity of a resource record that appears to
- * be out of date (e.g. because tcp connection to a service's target failed.)
- * Causes the record to be flushed from the daemon's cache (as well as all other
- * daemons' caches on the network) if the record is determined to be invalid.
- *
- * Parameters:
- *
- * flags: Currently unused, reserved for future use.
- *
- * interfaceIndex: If non-zero, specifies the interface of the record in question.
- * Passing 0 causes all instances of this record to be reconfirmed.
- *
- * fullname: The resource record's full domain name.
- *
- * rrtype: The resource record's type (e.g. kDNSServiceType_PTR, kDNSServiceType_SRV, etc)
- *
- * rrclass: The class of the resource record (usually kDNSServiceClass_IN).
- *
- * rdlen: The length, in bytes, of the resource record rdata.
- *
- * rdata: The raw rdata of the resource record.
- *
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord
- (
- DNSServiceFlags flags,
- uint32_t interfaceIndex,
- const char *fullname,
- uint16_t rrtype,
- uint16_t rrclass,
- uint16_t rdlen,
- const void *rdata
- );
-
-
-/*********************************************************************************************
- *
- * General Utility Functions
- *
- *********************************************************************************************/
-
-/* DNSServiceConstructFullName()
- *
- * Concatenate a three-part domain name (as returned by the above callbacks) into a
- * properly-escaped full domain name. Note that callbacks in the above functions ALREADY ESCAPE
- * strings where necessary.
- *
- * Parameters:
- *
- * fullName: A pointer to a buffer that where the resulting full domain name is to be written.
- * The buffer must be kDNSServiceMaxDomainName (1005) bytes in length to
- * accommodate the longest legal domain name without buffer overrun.
- *
- * service: The service name - any dots or backslashes must NOT be escaped.
- * May be NULL (to construct a PTR record name, e.g.
- * "_ftp._tcp.apple.com.").
- *
- * regtype: The service type followed by the protocol, separated by a dot
- * (e.g. "_ftp._tcp").
- *
- * domain: The domain name, e.g. "apple.com.". Literal dots or backslashes,
- * if any, must be escaped, e.g. "1st\. Floor.apple.com."
- *
- * return value: Returns 0 on success, -1 on error.
- *
- */
-
-int DNSSD_API DNSServiceConstructFullName
- (
- char *fullName,
- const char *service, /* may be NULL */
- const char *regtype,
- const char *domain
- );
-
-
-/*********************************************************************************************
- *
- * TXT Record Construction Functions
- *
- *********************************************************************************************/
-
-/*
- * A typical calling sequence for TXT record construction is something like:
- *
- * Client allocates storage for TXTRecord data (e.g. declare buffer on the stack)
- * TXTRecordCreate();
- * TXTRecordSetValue();
- * TXTRecordSetValue();
- * TXTRecordSetValue();
- * ...
- * DNSServiceRegister( ... TXTRecordGetLength(), TXTRecordGetBytesPtr() ... );
- * TXTRecordDeallocate();
- * Explicitly deallocate storage for TXTRecord data (if not allocated on the stack)
- */
-
-
-/* TXTRecordRef
- *
- * Opaque internal data type.
- * Note: Represents a DNS-SD TXT record.
- */
-
-typedef union _TXTRecordRef_t { char PrivateData[16]; char *ForceNaturalAlignment; } TXTRecordRef;
-
-
-/* TXTRecordCreate()
- *
- * Creates a new empty TXTRecordRef referencing the specified storage.
- *
- * If the buffer parameter is NULL, or the specified storage size is not
- * large enough to hold a key subsequently added using TXTRecordSetValue(),
- * then additional memory will be added as needed using malloc().
- *
- * On some platforms, when memory is low, malloc() may fail. In this
- * case, TXTRecordSetValue() will return kDNSServiceErr_NoMemory, and this
- * error condition will need to be handled as appropriate by the caller.
- *
- * You can avoid the need to handle this error condition if you ensure
- * that the storage you initially provide is large enough to hold all
- * the key/value pairs that are to be added to the record.
- * The caller can precompute the exact length required for all of the
- * key/value pairs to be added, or simply provide a fixed-sized buffer
- * known in advance to be large enough.
- * A no-value (key-only) key requires (1 + key length) bytes.
- * A key with empty value requires (1 + key length + 1) bytes.
- * A key with non-empty value requires (1 + key length + 1 + value length).
- * For most applications, DNS-SD TXT records are generally
- * less than 100 bytes, so in most cases a simple fixed-sized
- * 256-byte buffer will be more than sufficient.
- * Recommended size limits for DNS-SD TXT Records are discussed in
- * <http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt>
- *
- * Note: When passing parameters to and from these TXT record APIs,
- * the key name does not include the '=' character. The '=' character
- * is the separator between the key and value in the on-the-wire
- * packet format; it is not part of either the key or the value.
- *
- * txtRecord: A pointer to an uninitialized TXTRecordRef.
- *
- * bufferLen: The size of the storage provided in the "buffer" parameter.
- *
- * buffer: Optional caller-supplied storage used to hold the TXTRecord data.
- * This storage must remain valid for as long as
- * the TXTRecordRef.
- */
-
-void DNSSD_API TXTRecordCreate
- (
- TXTRecordRef *txtRecord,
- uint16_t bufferLen,
- void *buffer
- );
-
-
-/* TXTRecordDeallocate()
- *
- * Releases any resources allocated in the course of preparing a TXT Record
- * using TXTRecordCreate()/TXTRecordSetValue()/TXTRecordRemoveValue().
- * Ownership of the buffer provided in TXTRecordCreate() returns to the client.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- */
-
-void DNSSD_API TXTRecordDeallocate
- (
- TXTRecordRef *txtRecord
- );
-
-
-/* TXTRecordSetValue()
- *
- * Adds a key (optionally with value) to a TXTRecordRef. If the "key" already
- * exists in the TXTRecordRef, then the current value will be replaced with
- * the new value.
- * Keys may exist in four states with respect to a given TXT record:
- * - Absent (key does not appear at all)
- * - Present with no value ("key" appears alone)
- * - Present with empty value ("key=" appears in TXT record)
- * - Present with non-empty value ("key=value" appears in TXT record)
- * For more details refer to "Data Syntax for DNS-SD TXT Records" in
- * <http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt>
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * key: A null-terminated string which only contains printable ASCII
- * values (0x20-0x7E), excluding '=' (0x3D). Keys should be
- * 8 characters or less (not counting the terminating null).
- *
- * valueSize: The size of the value.
- *
- * value: Any binary value. For values that represent
- * textual data, UTF-8 is STRONGLY recommended.
- * For values that represent textual data, valueSize
- * should NOT include the terminating null (if any)
- * at the end of the string.
- * If NULL, then "key" will be added with no value.
- * If non-NULL but valueSize is zero, then "key=" will be
- * added with empty value.
- *
- * return value: Returns kDNSServiceErr_NoError on success.
- * Returns kDNSServiceErr_Invalid if the "key" string contains
- * illegal characters.
- * Returns kDNSServiceErr_NoMemory if adding this key would
- * exceed the available storage.
- */
-
-DNSServiceErrorType DNSSD_API TXTRecordSetValue
- (
- TXTRecordRef *txtRecord,
- const char *key,
- uint8_t valueSize, /* may be zero */
- const void *value /* may be NULL */
- );
-
-
-/* TXTRecordRemoveValue()
- *
- * Removes a key from a TXTRecordRef. The "key" must be an
- * ASCII string which exists in the TXTRecordRef.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * key: A key name which exists in the TXTRecordRef.
- *
- * return value: Returns kDNSServiceErr_NoError on success.
- * Returns kDNSServiceErr_NoSuchKey if the "key" does not
- * exist in the TXTRecordRef.
- */
-
-DNSServiceErrorType DNSSD_API TXTRecordRemoveValue
- (
- TXTRecordRef *txtRecord,
- const char *key
- );
-
-
-/* TXTRecordGetLength()
- *
- * Allows you to determine the length of the raw bytes within a TXTRecordRef.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * return value: Returns the size of the raw bytes inside a TXTRecordRef
- * which you can pass directly to DNSServiceRegister() or
- * to DNSServiceUpdateRecord().
- * Returns 0 if the TXTRecordRef is empty.
- */
-
-uint16_t DNSSD_API TXTRecordGetLength
- (
- const TXTRecordRef *txtRecord
- );
-
-
-/* TXTRecordGetBytesPtr()
- *
- * Allows you to retrieve a pointer to the raw bytes within a TXTRecordRef.
- *
- * txtRecord: A TXTRecordRef initialized by calling TXTRecordCreate().
- *
- * return value: Returns a pointer to the raw bytes inside the TXTRecordRef
- * which you can pass directly to DNSServiceRegister() or
- * to DNSServiceUpdateRecord().
- */
-
-const void * DNSSD_API TXTRecordGetBytesPtr
- (
- const TXTRecordRef *txtRecord
- );
-
-
-/*********************************************************************************************
- *
- * TXT Record Parsing Functions
- *
- *********************************************************************************************/
-
-/*
- * A typical calling sequence for TXT record parsing is something like:
- *
- * Receive TXT record data in DNSServiceResolve() callback
- * if (TXTRecordContainsKey(txtLen, txtRecord, "key")) then do something
- * val1ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key1", &len1);
- * val2ptr = TXTRecordGetValuePtr(txtLen, txtRecord, "key2", &len2);
- * ...
- * bcopy(val1ptr, myval1, len1);
- * bcopy(val2ptr, myval2, len2);
- * ...
- * return;
- *
- * If you wish to retain the values after return from the DNSServiceResolve()
- * callback, then you need to copy the data to your own storage using bcopy()
- * or similar, as shown in the example above.
- *
- * If for some reason you need to parse a TXT record you built yourself
- * using the TXT record construction functions above, then you can do
- * that using TXTRecordGetLength and TXTRecordGetBytesPtr calls:
- * TXTRecordGetValue(TXTRecordGetLength(x), TXTRecordGetBytesPtr(x), key, &len);
- *
- * Most applications only fetch keys they know about from a TXT record and
- * ignore the rest.
- * However, some debugging tools wish to fetch and display all keys.
- * To do that, use the TXTRecordGetCount() and TXTRecordGetItemAtIndex() calls.
- */
-
-/* TXTRecordContainsKey()
- *
- * Allows you to determine if a given TXT Record contains a specified key.
- *
- * txtLen: The size of the received TXT Record.
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * key: A null-terminated ASCII string containing the key name.
- *
- * return value: Returns 1 if the TXT Record contains the specified key.
- * Otherwise, it returns 0.
- */
-
-int DNSSD_API TXTRecordContainsKey
- (
- uint16_t txtLen,
- const void *txtRecord,
- const char *key
- );
-
-
-/* TXTRecordGetValuePtr()
- *
- * Allows you to retrieve the value for a given key from a TXT Record.
- *
- * txtLen: The size of the received TXT Record
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * key: A null-terminated ASCII string containing the key name.
- *
- * valueLen: On output, will be set to the size of the "value" data.
- *
- * return value: Returns NULL if the key does not exist in this TXT record,
- * or exists with no value (to differentiate between
- * these two cases use TXTRecordContainsKey()).
- * Returns pointer to location within TXT Record bytes
- * if the key exists with empty or non-empty value.
- * For empty value, valueLen will be zero.
- * For non-empty value, valueLen will be length of value data.
- */
-
-const void * DNSSD_API TXTRecordGetValuePtr
- (
- uint16_t txtLen,
- const void *txtRecord,
- const char *key,
- uint8_t *valueLen
- );
-
-
-/* TXTRecordGetCount()
- *
- * Returns the number of keys stored in the TXT Record. The count
- * can be used with TXTRecordGetItemAtIndex() to iterate through the keys.
- *
- * txtLen: The size of the received TXT Record.
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * return value: Returns the total number of keys in the TXT Record.
- *
- */
-
-uint16_t DNSSD_API TXTRecordGetCount
- (
- uint16_t txtLen,
- const void *txtRecord
- );
-
-
-/* TXTRecordGetItemAtIndex()
- *
- * Allows you to retrieve a key name and value pointer, given an index into
- * a TXT Record. Legal index values range from zero to TXTRecordGetCount()-1.
- * It's also possible to iterate through keys in a TXT record by simply
- * calling TXTRecordGetItemAtIndex() repeatedly, beginning with index zero
- * and increasing until TXTRecordGetItemAtIndex() returns kDNSServiceErr_Invalid.
- *
- * On return:
- * For keys with no value, *value is set to NULL and *valueLen is zero.
- * For keys with empty value, *value is non-NULL and *valueLen is zero.
- * For keys with non-empty value, *value is non-NULL and *valueLen is non-zero.
- *
- * txtLen: The size of the received TXT Record.
- *
- * txtRecord: Pointer to the received TXT Record bytes.
- *
- * index: An index into the TXT Record.
- *
- * keyBufLen: The size of the string buffer being supplied.
- *
- * key: A string buffer used to store the key name.
- * On return, the buffer contains a null-terminated C string
- * giving the key name. DNS-SD TXT keys are usually
- * 8 characters or less. To hold the maximum possible
- * key name, the buffer should be 256 bytes long.
- *
- * valueLen: On output, will be set to the size of the "value" data.
- *
- * value: On output, *value is set to point to location within TXT
- * Record bytes that holds the value data.
- *
- * return value: Returns kDNSServiceErr_NoError on success.
- * Returns kDNSServiceErr_NoMemory if keyBufLen is too short.
- * Returns kDNSServiceErr_Invalid if index is greater than
- * TXTRecordGetCount()-1.
- */
-
-DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex
- (
- uint16_t txtLen,
- const void *txtRecord,
- uint16_t index,
- uint16_t keyBufLen,
- char *key,
- uint8_t *valueLen,
- const void **value
- );
-
-#ifdef __APPLE_API_PRIVATE
-
-/*
- * Mac OS X specific functionality
- * 3rd party clients of this API should not depend on future support or availability of this routine
- */
-
-/* DNSServiceSetDefaultDomainForUser()
- *
- * Set the default domain for the caller's UID. Future browse and registration
- * calls by this user that do not specify an explicit domain will browse and
- * register in this wide-area domain in addition to .local. In addition, this
- * domain will be returned as a Browse domain via domain enumeration calls.
- *
- *
- * Parameters:
- *
- * flags: Pass kDNSServiceFlagsAdd to add a domain for a user. Call without
- * this flag set to clear a previously added domain.
- *
- * domain: The domain to be used for the caller's UID.
- *
- * return value: Returns kDNSServiceErr_NoError on succeses, otherwise returns
- * an error code indicating the error that occurred
- */
-
-DNSServiceErrorType DNSSD_API DNSServiceSetDefaultDomainForUser
- (
- DNSServiceFlags flags,
- const char *domain
- );
-
-#endif //__APPLE_API_PRIVATE
-
-// Some C compiler cleverness. We can make the compiler check certain things for us,
-// and report errors at compile-time if anything is wrong. The usual way to do this would
-// be to use a run-time "if" statement or the conventional run-time "assert" mechanism, but
-// then you don't find out what's wrong until you run the software. This way, if the assertion
-// condition is false, the array size is negative, and the complier complains immediately.
-
-struct DNS_SD_CompileTimeAssertionChecks
- {
- char assert0[(sizeof(union _TXTRecordRef_t) == 16) ? 1 : -1];
- };
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif /* _DNS_SD_H */
diff --git a/trunk/avahi-compat-libdns_sd/funcs.txt b/trunk/avahi-compat-libdns_sd/funcs.txt
deleted file mode 100644
index a584b4e..0000000
--- a/trunk/avahi-compat-libdns_sd/funcs.txt
+++ /dev/null
@@ -1,37 +0,0 @@
--- Supported --
-
-DNSServiceRefSockFD
-DNSServiceProcessResult
-DNSServiceRefDeallocate
-DNSServiceEnumerateDomains
-DNSServiceRegister
-DNSServiceBrowse
-DNSServiceResolve
-DNSServiceConstructFullName
-
-TXTRecordCreate
-TXTRecordDeallocate
-TXTRecordSetValue
-TXTRecordRemoveValue
-TXTRecordGetLength
-TXTRecordGetBytesPtr
-TXTRecordContainsKey
-TXTRecordGetValuePtr
-TXTRecordGetCount
-TXTRecordGetItemAtIndex
-
--- Unsupported but Relevant --
-
-DNSServiceRegisterRecord
-DNSServiceQueryRecord
-DNSServiceReconfirmRecord
-DNSServiceCreateConnection
-DNSServiceAddRecord
-DNSServiceUpdateRecord
-DNSServiceRemoveRecord
-
--- Unsupported and Irrelevant --
-
-DNSServiceSetDefaultDomainForUser
-
-$Id$
diff --git a/trunk/avahi-compat-libdns_sd/txt-test.c b/trunk/avahi-compat-libdns_sd/txt-test.c
deleted file mode 100644
index 149a38c..0000000
--- a/trunk/avahi-compat-libdns_sd/txt-test.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <assert.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include <dns_sd.h>
-
-static void hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %u bytes from %p:\n", size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- const char *r;
- TXTRecordRef ref;
- uint8_t l;
- const void *p;
- char k[256];
-
- TXTRecordCreate(&ref, 0, NULL);
-
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "foo", 7, "lennart");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "waldo", 5, "rocks");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "quux", 9, "the_house");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "yeah", 0, NULL);
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "waldo", 6, "rocked");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordRemoveValue(&ref, "foo");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordRemoveValue(&ref, "waldo");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "kawumm", 6, "bloerb");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "one", 1, "1");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "two", 1, "2");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- TXTRecordSetValue(&ref, "three", 1, "3");
- hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
- assert(TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "two"));
- assert(!TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "four"));
-
- r = TXTRecordGetValuePtr(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "kawumm", &l);
-
- hexdump(r, l);
-
- assert(TXTRecordGetCount(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref)) == 6);
-
- TXTRecordGetItemAtIndex(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), 2, sizeof(k), k, &l, &p);
-
- fprintf(stderr, "key=<%s>\n", k);
-
- hexdump(p, l);
-
- assert(TXTRecordGetItemAtIndex(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), 20, sizeof(k), k, &l, &p) == kDNSServiceErr_Invalid);
-
- TXTRecordDeallocate(&ref);
-}
diff --git a/trunk/avahi-compat-libdns_sd/txt.c b/trunk/avahi-compat-libdns_sd/txt.c
deleted file mode 100644
index 2b539e6..0000000
--- a/trunk/avahi-compat-libdns_sd/txt.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-
-#include "dns_sd.h"
-#include "warn.h"
-
-typedef struct TXTRecordInternal {
- uint8_t *buffer, *malloc_buffer;
- size_t size, max_size;
-} TXTRecordInternal;
-
-#define INTERNAL_PTR(txtref) (* (TXTRecordInternal**) (txtref))
-#define INTERNAL_PTR_CONST(txtref) (* (const TXTRecordInternal* const *) (txtref))
-
-void DNSSD_API TXTRecordCreate(
- TXTRecordRef *txtref,
- uint16_t length,
- void *buffer) {
-
- TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
-
- /* Apple's API design is flawed in so many ways, including the
- * fact that it isn't compatible with 64 bit processors. To work
- * around this we need some magic here which involves allocating
- * our own memory. Please, Apple, do your homework next time
- * before designing an API! */
-
- if ((t = avahi_new(TXTRecordInternal, 1))) {
- t->buffer = buffer;
- t->max_size = buffer ? length : (size_t)0;
- t->size = 0;
- t->malloc_buffer = NULL;
- }
-
- /* If we were unable to allocate memory, we store a NULL pointer
- * and return a NoMemory error later, is somewhat unclean, but
- * should work. */
- INTERNAL_PTR(txtref) = t;
-}
-
-void DNSSD_API TXTRecordDeallocate(TXTRecordRef *txtref) {
- TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
- t = INTERNAL_PTR(txtref);
- if (!t)
- return;
-
- avahi_free(t->malloc_buffer);
- avahi_free(t);
-
- /* Just in case ... */
- INTERNAL_PTR(txtref) = NULL;
-}
-
-static int make_sure_fits_in(TXTRecordInternal *t, size_t size) {
- uint8_t *n;
- size_t nsize;
-
- assert(t);
-
- if (t->size + size <= t->max_size)
- return 0;
-
- nsize = t->size + size + 100;
-
- if (nsize > 0xFFFF)
- return -1;
-
- if (!(n = avahi_realloc(t->malloc_buffer, nsize)))
- return -1;
-
- if (!t->malloc_buffer && t->size)
- memcpy(n, t->buffer, t->size);
-
- t->buffer = t->malloc_buffer = n;
- t->max_size = nsize;
-
- return 0;
-}
-
-static int remove_key(TXTRecordInternal *t, const char *key) {
- size_t i;
- uint8_t *p;
- size_t key_len;
- int found = 0;
-
- key_len = strlen(key);
- assert(key_len <= 0xFF);
-
- p = t->buffer;
- i = 0;
-
- while (i < t->size) {
-
- /* Does the item fit in? */
- assert(*p <= t->size - i - 1);
-
- /* Key longer than buffer */
- if (key_len > t->size - i - 1)
- break;
-
- if (key_len <= *p &&
- strncmp(key, (char*) p+1, key_len) == 0 &&
- (key_len == *p || p[1+key_len] == '=')) {
-
- uint8_t s;
-
- /* Key matches, so let's remove it */
-
- s = *p;
- memmove(p, p + 1 + *p, t->size - i - *p -1);
- t->size -= s + 1;
-
- found = 1;
- } else {
- /* Skip to next */
-
- i += *p +1;
- p += *p +1;
- }
- }
-
- return found;
-}
-
-DNSServiceErrorType DNSSD_API TXTRecordSetValue(
- TXTRecordRef *txtref,
- const char *key,
- uint8_t length,
- const void *value) {
-
- TXTRecordInternal *t;
- uint8_t *p;
- size_t l, n;
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
- assert(txtref);
-
- l = strlen(key);
-
- if (*key == 0 || strchr(key, '=') || l > 0xFF) /* Empty or invalid key */
- return kDNSServiceErr_Invalid;
-
- if (!(t = INTERNAL_PTR(txtref)))
- return kDNSServiceErr_NoMemory;
-
- n = l + (value ? length + 1 : 0);
-
- if (n > 0xFF)
- return kDNSServiceErr_Invalid;
-
- if (make_sure_fits_in(t, 1 + n) < 0)
- return kDNSServiceErr_NoMemory;
-
- remove_key(t, key);
-
- p = t->buffer + t->size;
-
- *(p++) = (uint8_t) n;
- t->size ++;
-
- memcpy(p, key, l);
- p += l;
- t->size += l;
-
- if (value) {
- *(p++) = '=';
- memcpy(p, value, length);
- t->size += length + 1;
- }
-
- assert(t->size <= t->max_size);
-
- return kDNSServiceErr_NoError;
-}
-
-DNSServiceErrorType DNSSD_API TXTRecordRemoveValue(TXTRecordRef *txtref, const char *key) {
- TXTRecordInternal *t;
- int found;
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
- assert(txtref);
-
- if (*key == 0 || strchr(key, '=') || strlen(key) > 0xFF) /* Empty or invalid key */
- return kDNSServiceErr_Invalid;
-
- if (!(t = INTERNAL_PTR(txtref)))
- return kDNSServiceErr_NoError;
-
- found = remove_key(t, key);
-
- return found ? kDNSServiceErr_NoError : kDNSServiceErr_NoSuchKey;
-}
-
-uint16_t DNSSD_API TXTRecordGetLength(const TXTRecordRef *txtref) {
- const TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
-
- if (!(t = INTERNAL_PTR_CONST(txtref)))
- return 0;
-
- assert(t->size <= 0xFFFF);
- return (uint16_t) t->size;
-}
-
-const void * DNSSD_API TXTRecordGetBytesPtr(const TXTRecordRef *txtref) {
- const TXTRecordInternal *t;
-
- AVAHI_WARN_LINKAGE;
-
- assert(txtref);
-
- if (!(t = INTERNAL_PTR_CONST(txtref)) || !t->buffer)
- return "";
-
- return t->buffer;
-}
-
-static const uint8_t *find_key(const uint8_t *buffer, size_t size, const char *key) {
- size_t i;
- const uint8_t *p;
- size_t key_len;
-
- key_len = strlen(key);
-
- assert(key_len <= 0xFF);
-
- p = buffer;
- i = 0;
-
- while (i < size) {
-
- /* Does the item fit in? */
- if (*p > size - i - 1)
- return NULL;
-
- /* Key longer than buffer */
- if (key_len > size - i - 1)
- return NULL;
-
- if (key_len <= *p &&
- strncmp(key, (const char*) p+1, key_len) == 0 &&
- (key_len == *p || p[1+key_len] == '=')) {
-
- /* Key matches, so let's return it */
-
- return p;
- }
-
- /* Skip to next */
- i += *p +1;
- p += *p +1;
- }
-
- return NULL;
-}
-
-int DNSSD_API TXTRecordContainsKey (
- uint16_t size,
- const void *buffer,
- const char *key) {
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
-
- if (!size)
- return 0;
-
- assert(buffer);
-
- if (!(find_key(buffer, size, key)))
- return 0;
-
- return 1;
-}
-
-const void * DNSSD_API TXTRecordGetValuePtr(
- uint16_t size,
- const void *buffer,
- const char *key,
- uint8_t *value_len) {
-
- const uint8_t *p;
- size_t n, l;
-
- AVAHI_WARN_LINKAGE;
-
- assert(key);
-
- if (!size)
- goto fail;
-
- if (*key == 0 || strchr(key, '=') || strlen(key) > 0xFF) /* Empty or invalid key */
- return NULL;
-
- assert(buffer);
-
- if (!(p = find_key(buffer, size, key)))
- goto fail;
-
- n = *p;
- l = strlen(key);
-
- assert(n >= l);
- p += 1 + l;
- n -= l;
-
- if (n <= 0)
- goto fail;
-
- assert(*p == '=');
- p++;
- n--;
-
- if (value_len)
- *value_len = n;
-
- return p;
-
-fail:
- if (value_len)
- *value_len = 0;
-
- return NULL;
-}
-
-
-uint16_t DNSSD_API TXTRecordGetCount(
- uint16_t size,
- const void *buffer) {
-
- const uint8_t *p;
- unsigned n = 0;
- size_t i;
-
- AVAHI_WARN_LINKAGE;
-
- if (!size)
- return 0;
-
- assert(buffer);
-
- p = buffer;
- i = 0;
-
- while (i < size) {
-
- /* Does the item fit in? */
- if (*p > size - i - 1)
- break;
-
- n++;
-
- /* Skip to next */
- i += *p +1;
- p += *p +1;
- }
-
- assert(n <= 0xFFFF);
-
- return (uint16_t) n;
-}
-
-DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex(
- uint16_t size,
- const void *buffer,
- uint16_t idx,
- uint16_t key_len,
- char *key,
- uint8_t *value_len,
- const void **value) {
-
- const uint8_t *p;
- size_t i;
- unsigned n = 0;
- DNSServiceErrorType ret = kDNSServiceErr_Invalid;
-
- AVAHI_WARN_LINKAGE;
-
- if (!size)
- goto fail;
-
- assert(buffer);
-
- p = buffer;
- i = 0;
-
- while (i < size) {
-
- /* Does the item fit in? */
- if (*p > size - i - 1)
- goto fail;
-
- if (n >= idx) {
- size_t l;
- const uint8_t *d;
-
- d = memchr(p+1, '=', *p);
-
- /* Length of key */
- l = d ? d - p - 1 : *p;
-
- if (key_len < l+1) {
- ret = kDNSServiceErr_NoMemory;
- goto fail;
- }
-
- strncpy(key, (const char*) p + 1, l);
- key[l] = 0;
-
- if (d) {
- if (value_len)
- *value_len = *p - l - 1;
-
- if (value)
- *value = d + 1;
- } else {
-
- if (value_len)
- *value_len = 0;
-
- if (value)
- *value = NULL;
- }
-
- return kDNSServiceErr_NoError;
- }
-
- n++;
-
- /* Skip to next */
- i += *p +1;
- p += *p +1;
- }
-
-
-fail:
-
- if (value)
- *value = NULL;
-
- if (value_len)
- *value_len = 0;
-
- return ret;
-
-}
diff --git a/trunk/avahi-compat-libdns_sd/unsupported.c b/trunk/avahi-compat-libdns_sd/unsupported.c
deleted file mode 100644
index a460b41..0000000
--- a/trunk/avahi-compat-libdns_sd/unsupported.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/gccmacro.h>
-
-#include "dns_sd.h"
-#include "warn.h"
-
-DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord (
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef *RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint32_t interfaceIndex,
- AVAHI_GCC_UNUSED const char *fullname,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rrclass,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata,
- AVAHI_GCC_UNUSED uint32_t ttl,
- AVAHI_GCC_UNUSED DNSServiceRegisterRecordReply callBack,
- AVAHI_GCC_UNUSED void *context) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceQueryRecord (
- AVAHI_GCC_UNUSED DNSServiceRef *sdRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint32_t interfaceIndex,
- AVAHI_GCC_UNUSED const char *fullname,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rrclass,
- AVAHI_GCC_UNUSED DNSServiceQueryRecordReply callBack,
- AVAHI_GCC_UNUSED void *context) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord (
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint32_t interfaceIndex,
- AVAHI_GCC_UNUSED const char *fullname,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rrclass,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceCreateConnection(AVAHI_GCC_UNUSED DNSServiceRef *sdRef) {
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceAddRecord(
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef *RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags,
- AVAHI_GCC_UNUSED uint16_t rrtype,
- AVAHI_GCC_UNUSED uint16_t rdlen,
- AVAHI_GCC_UNUSED const void *rdata,
- AVAHI_GCC_UNUSED uint32_t ttl) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord(
- AVAHI_GCC_UNUSED DNSServiceRef sdRef,
- AVAHI_GCC_UNUSED DNSRecordRef RecordRef,
- AVAHI_GCC_UNUSED DNSServiceFlags flags) {
-
- AVAHI_WARN_UNSUPPORTED;
-
- return kDNSServiceErr_Unsupported;
-}
-
-
diff --git a/trunk/avahi-compat-libdns_sd/warn.c b/trunk/avahi-compat-libdns_sd/warn.c
deleted file mode 100644
index 13586ef..0000000
--- a/trunk/avahi-compat-libdns_sd/warn.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <pthread.h>
-#include <unistd.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <syslog.h>
-
-#include "warn.h"
-
-#ifndef COMPAT_LAYER
-#define COMPAT_LAYER "Apple Bonjour"
-#endif
-
-#ifndef CGI_SUBSYSTEM
-#define CGI_SUBSYSTEM "libdns_sd"
-#endif
-
-static pthread_mutex_t linkage_mutex = PTHREAD_MUTEX_INITIALIZER;
-static int linkage_warning = 0;
-
-const char *avahi_exe_name(void) {
-#ifdef HAVE_GETPROGNAME
- return getprogname();
-#elif defined(__linux__)
- static char exe_name[1024] = "";
- static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
- /* Yes, I know, this is not portable. But who cares? It's for
- * cosmetics only, anyway. */
-
- pthread_mutex_lock(&mutex);
-
- if (exe_name[0] == 0) {
- int k;
-
- if ((k = readlink("/proc/self/exe", exe_name, sizeof(exe_name)-1)) < 0)
- snprintf(exe_name, sizeof(exe_name), "(unknown)");
- else {
- char *slash;
-
- assert((size_t) k <= sizeof(exe_name)-1);
- exe_name[k] = 0;
-
- if ((slash = strrchr(exe_name, '/')))
- memmove(exe_name, slash+1, strlen(slash)+1);
- }
- }
-
- pthread_mutex_unlock(&mutex);
-
- return exe_name;
-#else
-#ifdef __GNUC__
-#warning "avahi_exe_name() needs to be implemented for your operating system"
-#endif
- return "(unknown)";
-#endif
-}
-
-void avahi_warn(const char *fmt, ...) {
- char msg[512] = "*** WARNING *** ";
- va_list ap;
- size_t n;
-
- assert(fmt);
-
- va_start(ap, fmt);
- n = strlen(msg);
- vsnprintf(msg + n, sizeof(msg) - n, fmt, ap);
- va_end(ap);
-
- fprintf(stderr, "%s\n", msg);
-
- openlog(avahi_exe_name(), LOG_PID, LOG_USER);
- syslog(LOG_WARNING, "%s", msg);
- closelog();
-}
-
-void avahi_warn_linkage(void) {
- int w;
-
- pthread_mutex_lock(&linkage_mutex);
- w = linkage_warning;
- linkage_warning = 1;
- pthread_mutex_unlock(&linkage_mutex);
-
- if (!w && !getenv("AVAHI_COMPAT_NOWARN")) {
- avahi_warn("The programme '%s' uses the "COMPAT_LAYER" compatiblity layer of Avahi.", avahi_exe_name());
- avahi_warn("Please fix your application to use the native API of Avahi!");
- avahi_warn("For more information see <http://0pointer.de/avahi-compat?s="CGI_SUBSYSTEM"&e=%s>", avahi_exe_name());
- }
-}
-
-void avahi_warn_unsupported(const char *function) {
- avahi_warn("The programme '%s' called '%s()' which is not supported (or only supported partially) in the "COMPAT_LAYER" compatiblity layer of Avahi.", avahi_exe_name(), function);
- avahi_warn("Please fix your application to use the native API of Avahi!");
- avahi_warn("For more information see <http://0pointer.de/avahi-compat?s="CGI_SUBSYSTEM"&e=%s&f=%s>", avahi_exe_name(), function);
-}
diff --git a/trunk/avahi-compat-libdns_sd/warn.h b/trunk/avahi-compat-libdns_sd/warn.h
deleted file mode 100644
index da64fab..0000000
--- a/trunk/avahi-compat-libdns_sd/warn.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef foowarnhfoo
-#define foowarnhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/* This routine works on Linux only, so don't rely on it */
-const char *avahi_exe_name(void);
-
-void avahi_warn_unsupported(const char *function);
-
-void avahi_warn_linkage(void);
-
-void avahi_warn(const char *fmt, ...);
-
-#define AVAHI_WARN_LINKAGE do { avahi_warn_linkage(); } while(0)
-#define AVAHI_WARN_UNSUPPORTED do { avahi_warn_linkage(); avahi_warn_unsupported(__FUNCTION__); } while(0)
-#define AVAHI_WARN_UNSUPPORTED_ABORT do { AVAHI_WARN_UNSUPPORTED; abort(); } while(0)
-
-#endif
diff --git a/trunk/avahi-core.pc.in b/trunk/avahi-core.pc.in
deleted file mode 100644
index 52491b4..0000000
--- a/trunk/avahi-core.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-core
-Description: Avahi Multicast DNS Responder (Embeddable Stack)
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lavahi-common -lavahi-core
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/trunk/avahi-core/Makefile.am b/trunk/avahi-core/Makefile.am
deleted file mode 100644
index cb2d8f9..0000000
--- a/trunk/avahi-core/Makefile.am
+++ /dev/null
@@ -1,160 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-avahiincludedir=$(includedir)/avahi-core
-
-avahiinclude_HEADERS = \
- core.h \
- log.h \
- rr.h \
- publish.h \
- lookup.h
-
-lib_LTLIBRARIES = \
- libavahi-core.la
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- prioq-test \
- avahi-test \
- conformance-test \
- avahi-reflector \
- dns-test \
- timeeventq-test \
- hashmap-test \
- querier-test \
- update-test
-endif
-
-libavahi_core_la_SOURCES = \
- timeeventq.c timeeventq.h\
- iface.c iface.h \
- server.c internal.h entry.c \
- prioq.c prioq.h \
- cache.c cache.h \
- socket.c socket.h \
- response-sched.c response-sched.h \
- query-sched.c query-sched.h \
- probe-sched.c probe-sched.h \
- announce.c announce.h \
- browse.c browse.h \
- rrlist.c rrlist.h \
- resolve-host-name.c \
- resolve-address.c \
- browse-domain.c \
- browse-service-type.c \
- browse-service.c \
- resolve-service.c \
- dns.c dns.h \
- rr.c rr.h rr-util.h \
- core.h lookup.h publish.h \
- log.c log.h \
- browse-dns-server.c \
- fdutil.h fdutil.c \
- util.c util.h \
- hashmap.c hashmap.h \
- wide-area.c wide-area.h \
- multicast-lookup.c multicast-lookup.h \
- querier.c querier.h \
- addr-util.h addr-util.c \
- domain-util.h domain-util.c \
- dns-srv-rr.h
-
-if HAVE_NETLINK
-libavahi_core_la_SOURCES += \
- iface-linux.c iface-linux.h \
- netlink.c netlink.h
-else
-if HAVE_PF_ROUTE
-libavahi_core_la_SOURCES += \
- iface-pfroute.c iface-pfroute.h
-endif
-endif
-
-libavahi_core_la_CFLAGS = $(AM_CFLAGS)
-libavahi_core_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-libavahi_core_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_CORE_VERSION_INFO)
-
-prioq_test_SOURCES = \
- prioq-test.c \
- prioq.c prioq.h
-prioq_test_CFLAGS = $(AM_CFLAGS)
-prioq_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-avahi_test_SOURCES = \
- avahi-test.c
-avahi_test_CFLAGS = $(AM_CFLAGS)
-avahi_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-update_test_SOURCES = \
- update-test.c
-update_test_CFLAGS = $(AM_CFLAGS)
-update_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-querier_test_SOURCES = \
- querier-test.c
-querier_test_CFLAGS = $(AM_CFLAGS)
-querier_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-conformance_test_SOURCES = \
- conformance-test.c
-conformance_test_CFLAGS = $(AM_CFLAGS)
-conformance_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-avahi_reflector_SOURCES = \
- avahi-reflector.c
-avahi_reflector_CFLAGS = $(AM_CFLAGS)
-avahi_reflector_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
-
-dns_test_SOURCES = \
- dns.c dns.h \
- dns-test.c \
- log.c log.h \
- util.c util.h \
- rr.c rr.h \
- hashmap.c hashmap.h \
- domain-util.c domain-util.h
-dns_test_CFLAGS = $(AM_CFLAGS)
-dns_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-timeeventq_test_SOURCES = \
- timeeventq-test.c \
- timeeventq.h timeeventq.c \
- prioq.h prioq.c \
- log.c log.h
-timeeventq_test_CFLAGS = $(AM_CFLAGS)
-timeeventq_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-hashmap_test_SOURCES = \
- hashmap-test.c \
- hashmap.h hashmap.c \
- util.h util.c
-hashmap_test_CFLAGS = $(AM_CFLAGS)
-hashmap_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
-
-valgrind: avahi-test
- libtool --mode=execute valgrind ./avahi-test
-
-gdb: avahi-test
- libtool --mode=execute gdb ./avahi-test
diff --git a/trunk/avahi-core/addr-util.c b/trunk/avahi-core/addr-util.c
deleted file mode 100644
index 9e2d1e9..0000000
--- a/trunk/avahi-core/addr-util.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <assert.h>
-
-#include "addr-util.h"
-
-AvahiAddress *avahi_address_from_sockaddr(const struct sockaddr* sa, AvahiAddress *ret_addr) {
- assert(sa);
- assert(ret_addr);
-
- assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6);
-
- ret_addr->proto = avahi_af_to_proto(sa->sa_family);
-
- if (sa->sa_family == AF_INET)
- memcpy(&ret_addr->data.ipv4, &((const struct sockaddr_in*) sa)->sin_addr, sizeof(ret_addr->data.ipv4));
- else
- memcpy(&ret_addr->data.ipv6, &((const struct sockaddr_in6*) sa)->sin6_addr, sizeof(ret_addr->data.ipv6));
-
- return ret_addr;
-}
-
-uint16_t avahi_port_from_sockaddr(const struct sockaddr* sa) {
- assert(sa);
-
- assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6);
-
- if (sa->sa_family == AF_INET)
- return ntohs(((const struct sockaddr_in*) sa)->sin_port);
- else
- return ntohs(((const struct sockaddr_in6*) sa)->sin6_port);
-}
-
-int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a) {
-
- static const uint8_t ipv4_in_ipv6[] = {
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF
- };
-
- assert(a);
-
- if (a->proto != AVAHI_PROTO_INET6)
- return 0;
-
- return memcmp(a->data.ipv6.address, ipv4_in_ipv6, sizeof(ipv4_in_ipv6)) == 0;
-}
-
-
-
diff --git a/trunk/avahi-core/addr-util.h b/trunk/avahi-core/addr-util.h
deleted file mode 100644
index 4134de1..0000000
--- a/trunk/avahi-core/addr-util.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef fooaddrutilhfoo
-#define fooaddrutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-#include <sys/socket.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Make an address structture of a sockaddr structure */
-AvahiAddress *avahi_address_from_sockaddr(const struct sockaddr* sa, AvahiAddress *ret_addr);
-
-/** Return the port number of a sockaddr structure (either IPv4 or IPv6) */
-uint16_t avahi_port_from_sockaddr(const struct sockaddr* sa);
-
-/** Check whether the specified IPv6 address is in fact an
- * encapsulated IPv4 address, returns 1 if yes, 0 otherwise */
-int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/announce.c b/trunk/avahi-core/announce.c
deleted file mode 100644
index 4a87e1d..0000000
--- a/trunk/avahi-core/announce.c
+++ /dev/null
@@ -1,526 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "announce.h"
-#include "log.h"
-#include "rr-util.h"
-
-#define AVAHI_ANNOUNCEMENT_JITTER_MSEC 250
-#define AVAHI_PROBE_JITTER_MSEC 250
-#define AVAHI_PROBE_INTERVAL_MSEC 250
-
-static void remove_announcer(AvahiServer *s, AvahiAnnouncer *a) {
- assert(s);
- assert(a);
-
- if (a->time_event)
- avahi_time_event_free(a->time_event);
-
- AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_interface, a->interface->announcers, a);
- AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_entry, a->entry->announcers, a);
-
- avahi_free(a);
-}
-
-static void elapse_announce(AvahiTimeEvent *e, void *userdata);
-
-static void set_timeout(AvahiAnnouncer *a, const struct timeval *tv) {
- assert(a);
-
- if (!tv) {
- if (a->time_event) {
- avahi_time_event_free(a->time_event);
- a->time_event = NULL;
- }
- } else {
-
- if (a->time_event)
- avahi_time_event_update(a->time_event, tv);
- else
- a->time_event = avahi_time_event_new(a->server->time_event_queue, tv, elapse_announce, a);
- }
-}
-
-static void next_state(AvahiAnnouncer *a);
-
-void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) {
- AvahiEntry *e;
- assert(g);
- assert(!g->dead);
-
- /* Check whether all group members have been probed */
-
- if (g->state != AVAHI_ENTRY_GROUP_REGISTERING || g->n_probing > 0)
- return;
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_ESTABLISHED);
-
- if (g->dead)
- return;
-
- for (e = g->entries; e; e = e->by_group_next) {
- AvahiAnnouncer *a;
-
- for (a = e->announcers; a; a = a->by_entry_next) {
-
- if (a->state != AVAHI_WAITING)
- continue;
-
- a->state = AVAHI_ANNOUNCING;
-
- if (immediately) {
- /* Shortcut */
-
- a->n_iteration = 1;
- next_state(a);
- } else {
- struct timeval tv;
- a->n_iteration = 0;
- avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC);
- set_timeout(a, &tv);
- }
- }
- }
-}
-
-static void next_state(AvahiAnnouncer *a) {
- assert(a);
-
- if (a->state == AVAHI_WAITING) {
-
- assert(a->entry->group);
-
- avahi_s_entry_group_check_probed(a->entry->group, 1);
-
- } else if (a->state == AVAHI_PROBING) {
-
- if (a->n_iteration >= 4) {
- /* Probing done */
-
- if (a->entry->group) {
- assert(a->entry->group->n_probing);
- a->entry->group->n_probing--;
- }
-
- if (a->entry->group && a->entry->group->state == AVAHI_ENTRY_GROUP_REGISTERING)
- a->state = AVAHI_WAITING;
- else {
- a->state = AVAHI_ANNOUNCING;
- a->n_iteration = 1;
- }
-
- set_timeout(a, NULL);
- next_state(a);
- } else {
- struct timeval tv;
-
- avahi_interface_post_probe(a->interface, a->entry->record, 0);
-
- avahi_elapse_time(&tv, AVAHI_PROBE_INTERVAL_MSEC, 0);
- set_timeout(a, &tv);
-
- a->n_iteration++;
- }
-
- } else if (a->state == AVAHI_ANNOUNCING) {
-
- if (a->entry->flags & AVAHI_PUBLISH_UNIQUE)
- /* Send the whole rrset at once */
- avahi_server_prepare_matching_responses(a->server, a->interface, a->entry->record->key, 0);
- else
- avahi_server_prepare_response(a->server, a->interface, a->entry, 0, 0);
-
- avahi_server_generate_response(a->server, a->interface, NULL, NULL, 0, 0, 0);
-
- if (++a->n_iteration >= 4) {
- /* Announcing done */
-
- a->state = AVAHI_ESTABLISHED;
-
- set_timeout(a, NULL);
- } else {
- struct timeval tv;
- avahi_elapse_time(&tv, a->sec_delay*1000, AVAHI_ANNOUNCEMENT_JITTER_MSEC);
-
- if (a->n_iteration < 10)
- a->sec_delay *= 2;
-
- set_timeout(a, &tv);
- }
- }
-}
-
-static void elapse_announce(AvahiTimeEvent *e, void *userdata) {
- assert(e);
-
- next_state(userdata);
-}
-
-static AvahiAnnouncer *get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
-
- for (a = e->announcers; a; a = a->by_entry_next)
- if (a->interface == i)
- return a;
-
- return NULL;
-}
-
-static void go_to_initial_state(AvahiAnnouncer *a) {
- AvahiEntry *e;
- struct timeval tv;
-
- assert(a);
- e = a->entry;
-
- if ((e->flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_NO_PROBE))
- a->state = AVAHI_PROBING;
- else if (!(e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)) {
-
- if (!e->group || e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED)
- a->state = AVAHI_ANNOUNCING;
- else
- a->state = AVAHI_WAITING;
-
- } else
- a->state = AVAHI_ESTABLISHED;
-
- a->n_iteration = 1;
- a->sec_delay = 1;
-
- if (a->state == AVAHI_PROBING && e->group)
- e->group->n_probing++;
-
- if (a->state == AVAHI_PROBING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_PROBE_JITTER_MSEC));
- else if (a->state == AVAHI_ANNOUNCING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
- else
- set_timeout(a, NULL);
-}
-
-static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- if (!avahi_interface_match(i, e->interface, e->protocol) || !i->announcing || !avahi_entry_is_commited(e))
- return;
-
- /* We don't want duplicate announcers */
- if (get_announcer(s, e, i))
- return;
-
- if ((!(a = avahi_new(AvahiAnnouncer, 1)))) {
- avahi_log_error(__FILE__": Out of memory.");
- return;
- }
-
- a->server = s;
- a->interface = i;
- a->entry = e;
- a->time_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_interface, i->announcers, a);
- AVAHI_LLIST_PREPEND(AvahiAnnouncer, by_entry, e->announcers, a);
-
- go_to_initial_state(a);
-}
-
-void avahi_announce_interface(AvahiServer *s, AvahiInterface *i) {
- AvahiEntry *e;
-
- assert(s);
- assert(i);
-
- if (!i->announcing)
- return;
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead)
- new_announcer(s, i, e);
-}
-
-static void announce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- AvahiEntry *e = userdata;
-
- assert(m);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- new_announcer(m->server, i, e);
-}
-
-void avahi_announce_entry(AvahiServer *s, AvahiEntry *e) {
- assert(s);
- assert(e);
- assert(!e->dead);
-
- avahi_interface_monitor_walk(s->monitor, e->interface, e->protocol, announce_walk_callback, e);
-}
-
-void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g) {
- AvahiEntry *e;
-
- assert(s);
- assert(g);
-
- for (e = g->entries; e; e = e->by_group_next)
- if (!e->dead)
- avahi_announce_entry(s, e);
-}
-
-int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
- assert(!e->dead);
-
- if (!(a = get_announcer(s, e, i)))
- return 0;
-
- return
- a->state == AVAHI_ANNOUNCING ||
- a->state == AVAHI_ESTABLISHED ||
- (a->state == AVAHI_WAITING && !(e->flags & AVAHI_PUBLISH_UNIQUE));
-}
-
-int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
- assert(!e->dead);
-
- if (!(a = get_announcer(s, e, i)))
- return 0;
-
- return
- a->state == AVAHI_PROBING ||
- (a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE));
-}
-
-void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
- AvahiAnnouncer *a;
-
- assert(s);
- assert(e);
- assert(i);
-
- if (!(a = get_announcer(s, e, i)))
- return;
-
- if (a->state == AVAHI_PROBING && a->entry->group)
- a->entry->group->n_probing--;
-
- go_to_initial_state(a);
-}
-
-static AvahiRecord *make_goodbye_record(AvahiRecord *r) {
- AvahiRecord *g;
-
- assert(r);
-
- if (!(g = avahi_record_copy(r)))
- return NULL; /* OOM */
-
- assert(g->ref == 1);
- g->ttl = 0;
-
- return g;
-}
-
-static int is_duplicate_entry(AvahiServer *s, AvahiEntry *e) {
- AvahiEntry *i;
-
- assert(s);
- assert(e);
-
- for (i = avahi_hashmap_lookup(s->entries_by_key, e->record->key); i; i = i->by_key_next) {
-
- if (i == e)
- continue;
-
- if (!avahi_record_equal_no_ttl(i->record, e->record))
- continue;
-
- return 1;
- }
-
- return 0;
-}
-
-static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- AvahiEntry *e = userdata;
- AvahiRecord *g;
-
- assert(m);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- if (!avahi_interface_match(i, e->interface, e->protocol))
- return;
-
- if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)
- return;
-
- if (!avahi_entry_is_registered(m->server, e, i))
- return;
-
- if (is_duplicate_entry(m->server, e))
- return;
-
- if (!(g = make_goodbye_record(e->record)))
- return; /* OOM */
-
- avahi_interface_post_response(i, g, e->flags & AVAHI_PUBLISH_UNIQUE, NULL, 1);
- avahi_record_unref(g);
-}
-
-static void reannounce(AvahiAnnouncer *a) {
- AvahiEntry *e;
- struct timeval tv;
-
- assert(a);
- e = a->entry;
-
- /* If the group this entry belongs to is not even commited, there's nothing to reannounce */
- if (e->group && (e->group->state == AVAHI_ENTRY_GROUP_UNCOMMITED || e->group->state == AVAHI_ENTRY_GROUP_COLLISION))
- return;
-
- /* Because we might change state we decrease the probing counter first */
- if (a->state == AVAHI_PROBING && a->entry->group)
- a->entry->group->n_probing--;
-
- if (a->state == AVAHI_PROBING ||
- (a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_NO_PROBE)))
-
- /* We were probing or waiting after probe, so we restart probing from the beginning here */
-
- a->state = AVAHI_PROBING;
- else if (a->state == AVAHI_WAITING)
-
- /* We were waiting, but were not probing before, so we continue waiting */
- a->state = AVAHI_WAITING;
-
- else if (e->flags & AVAHI_PUBLISH_NO_ANNOUNCE)
-
- /* No announcer needed */
- a->state = AVAHI_ESTABLISHED;
-
- else {
-
- /* Ok, let's restart announcing */
- a->state = AVAHI_ANNOUNCING;
- }
-
- /* Now let's increase the probing counter again */
- if (a->state == AVAHI_PROBING && e->group)
- e->group->n_probing++;
-
- a->n_iteration = 1;
- a->sec_delay = 1;
-
- if (a->state == AVAHI_PROBING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_PROBE_JITTER_MSEC));
- else if (a->state == AVAHI_ANNOUNCING)
- set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
- else
- set_timeout(a, NULL);
-}
-
-
-static void reannounce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- AvahiEntry *e = userdata;
- AvahiAnnouncer *a;
-
- assert(m);
- assert(i);
- assert(e);
- assert(!e->dead);
-
- if (!(a = get_announcer(m->server, e, i)))
- return;
-
- reannounce(a);
-}
-
-void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e) {
-
- assert(s);
- assert(e);
- assert(!e->dead);
-
- avahi_interface_monitor_walk(s->monitor, e->interface, e->protocol, reannounce_walk_callback, e);
-}
-
-void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye, int remove) {
- assert(s);
- assert(i);
-
- if (send_goodbye)
- if (avahi_interface_is_relevant(i)) {
- AvahiEntry *e;
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead)
- send_goodbye_callback(s->monitor, i, e);
- }
-
- if (remove)
- while (i->announcers)
- remove_announcer(s, i->announcers);
-}
-
-void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int remove) {
- assert(s);
- assert(e);
-
- if (send_goodbye)
- if (!e->dead)
- avahi_interface_monitor_walk(s->monitor, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, send_goodbye_callback, e);
-
- if (remove)
- while (e->announcers)
- remove_announcer(s, e->announcers);
-}
-
diff --git a/trunk/avahi-core/announce.h b/trunk/avahi-core/announce.h
deleted file mode 100644
index 3a8bcf3..0000000
--- a/trunk/avahi-core/announce.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef fooannouncehfoo
-#define fooannouncehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiAnnouncer AvahiAnnouncer;
-
-#include <avahi-common/llist.h>
-#include "iface.h"
-#include "internal.h"
-#include "timeeventq.h"
-#include "publish.h"
-
-typedef enum {
- AVAHI_PROBING, /* probing phase */
- AVAHI_WAITING, /* wait for other records in group */
- AVAHI_ANNOUNCING, /* announcing phase */
- AVAHI_ESTABLISHED /* we'e established */
-} AvahiAnnouncerState;
-
-struct AvahiAnnouncer {
- AvahiServer *server;
- AvahiInterface *interface;
- AvahiEntry *entry;
-
- AvahiTimeEvent *time_event;
-
- AvahiAnnouncerState state;
- unsigned n_iteration;
- unsigned sec_delay;
-
- AVAHI_LLIST_FIELDS(AvahiAnnouncer, by_interface);
- AVAHI_LLIST_FIELDS(AvahiAnnouncer, by_entry);
-};
-
-void avahi_announce_interface(AvahiServer *s, AvahiInterface *i);
-void avahi_announce_entry(AvahiServer *s, AvahiEntry *e);
-void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g);
-
-void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
-
-void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately);
-
-int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
-int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i);
-
-void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye, int rem);
-void avahi_goodbye_entry(AvahiServer *s, AvahiEntry *e, int send_goodbye, int rem);
-
-void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e);
-
-#endif
diff --git a/trunk/avahi-core/avahi-reflector.c b/trunk/avahi-core/avahi-reflector.c
deleted file mode 100644
index df5539f..0000000
--- a/trunk/avahi-core/avahi-reflector.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-core/core.h>
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiServer *server;
- AvahiServerConfig config;
- int error;
- AvahiSimplePoll *simple_poll;
-
- simple_poll = avahi_simple_poll_new();
-
- avahi_server_config_init(&config);
- config.publish_hinfo = 0;
- config.publish_addresses = 0;
- config.publish_workstation = 0;
- config.publish_domain = 0;
- config.use_ipv6 = 0;
- config.enable_reflector = 1;
-
- server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, NULL, NULL, &error);
- avahi_server_config_free(&config);
-
- for (;;)
- if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
- break;
-
- avahi_server_free(server);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/trunk/avahi-core/avahi-test.c b/trunk/avahi-core/avahi-test.c
deleted file mode 100644
index cb7b97e..0000000
--- a/trunk/avahi-core/avahi-test.c
+++ /dev/null
@@ -1,403 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/dns-srv-rr.h>
-
-static AvahiSEntryGroup *group = NULL;
-static AvahiServer *server = NULL;
-static char *service_name = NULL;
-
-static const AvahiPoll *poll_api;
-
-static void quit_timeout_callback(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void* userdata) {
- AvahiSimplePoll *simple_poll = userdata;
-
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
- printf("%s\n", text);
-}
-
-static void dump_timeout_callback(AvahiTimeout *timeout, void* userdata) {
- struct timeval tv;
-
- AvahiServer *avahi = userdata;
- avahi_server_dump(avahi, dump_line, NULL);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_update(timeout, &tv);
-}
-
-static const char *browser_event_to_string(AvahiBrowserEvent event) {
- switch (event) {
- case AVAHI_BROWSER_NEW : return "NEW";
- case AVAHI_BROWSER_REMOVE : return "REMOVE";
- case AVAHI_BROWSER_CACHE_EXHAUSTED : return "CACHE_EXHAUSTED";
- case AVAHI_BROWSER_ALL_FOR_NOW : return "ALL_FOR_NOW";
- case AVAHI_BROWSER_FAILURE : return "FAILURE";
- }
-
- abort();
-}
-
-static const char *resolver_event_to_string(AvahiResolverEvent event) {
- switch (event) {
- case AVAHI_RESOLVER_FOUND: return "FOUND";
- case AVAHI_RESOLVER_FAILURE: return "FAILURE";
- }
- abort();
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- char *t;
-
- assert(r);
-
- if (record) {
- avahi_log_debug("RB: record [%s] on %i.%i is %s", t = avahi_record_to_string(record), interface, protocol, browser_event_to_string(event));
- avahi_free(t);
- } else
- avahi_log_debug("RB: [%s]", browser_event_to_string(event));
-
-}
-
-static void remove_entries(void);
-static void create_entries(int new_name);
-
-static void entry_group_callback(AVAHI_GCC_UNUSED AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("entry group state: %i", state);
-
- if (state == AVAHI_ENTRY_GROUP_COLLISION) {
- remove_entries();
- create_entries(1);
- avahi_log_debug("Service name conflict, retrying with <%s>", service_name);
- } else if (state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
- avahi_log_debug("Service established under name <%s>", service_name);
- }
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
-
- server = s;
- avahi_log_debug("server state: %i", state);
-
- if (state == AVAHI_SERVER_RUNNING) {
- avahi_log_debug("Server startup complete. Host name is <%s>. Service cookie is %u", avahi_server_get_host_name_fqdn(s), avahi_server_get_local_service_cookie(s));
- create_entries(0);
- } else if (state == AVAHI_SERVER_COLLISION) {
- char *n;
- remove_entries();
-
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
-
- avahi_log_debug("Host name conflict, retrying with <%s>", n);
- avahi_server_set_host_name(s, n);
- avahi_free(n);
- }
-}
-
-static void remove_entries(void) {
- if (group)
- avahi_s_entry_group_reset(group);
-}
-
-static void create_entries(int new_name) {
- AvahiAddress a;
- AvahiRecord *r;
-
- remove_entries();
-
- if (!group)
- group = avahi_s_entry_group_new(server, entry_group_callback, NULL);
-
- assert(avahi_s_entry_group_is_empty(group));
-
- if (!service_name)
- service_name = avahi_strdup("Test Service");
- else if (new_name) {
- char *n = avahi_alternative_service_name(service_name);
- avahi_free(service_name);
- service_name = n;
- }
-
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, service_name, "_http._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
- avahi_log_error("Failed to add HTTP service");
- goto fail;
- }
-
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, service_name, "_ftp._tcp", NULL, NULL, 21, "foo", NULL) < 0) {
- avahi_log_error("Failed to add FTP service");
- goto fail;
- }
-
- if (avahi_server_add_service(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0,service_name, "_webdav._tcp", NULL, NULL, 80, "foo", NULL) < 0) {
- avahi_log_error("Failed to add WEBDAV service");
- goto fail;
- }
-
- if (avahi_server_add_dns_server_address(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, NULL, AVAHI_DNS_SERVER_RESOLVE, avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &a), 53) < 0) {
- avahi_log_error("Failed to add new DNS Server address");
- goto fail;
- }
-
- r = avahi_record_new_full("cname.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_CNAME, AVAHI_DEFAULT_TTL);
- r->data.cname.name = avahi_strdup("cocaine.local");
-
- if (avahi_server_add(server, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, r) < 0) {
- avahi_record_unref(r);
- avahi_log_error("Failed to add CNAME record");
- goto fail;
- }
- avahi_record_unref(r);
-
- avahi_s_entry_group_commit(group);
- return;
-
-fail:
- if (group)
- avahi_s_entry_group_free(group);
-
- group = NULL;
-}
-
-static void hnr_callback(
- AVAHI_GCC_UNUSED AvahiSHostNameResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *hostname,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- char t[AVAHI_ADDRESS_STR_MAX];
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
-
- avahi_log_debug("HNR: (%i.%i) <%s> -> %s [%s]", iface, protocol, hostname, a ? t : "n/a", resolver_event_to_string(event));
-}
-
-static void ar_callback(
- AVAHI_GCC_UNUSED AvahiSAddressResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *hostname,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- char t[AVAHI_ADDRESS_STR_MAX];
-
- avahi_address_snprint(t, sizeof(t), a);
-
- avahi_log_debug("AR: (%i.%i) %s -> <%s> [%s]", iface, protocol, t, hostname ? hostname : "n/a", resolver_event_to_string(event));
-}
-
-static void db_callback(
- AVAHI_GCC_UNUSED AvahiSDomainBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- avahi_log_debug("DB: (%i.%i) <%s> [%s]", iface, protocol, domain ? domain : "NULL", browser_event_to_string(event));
-}
-
-static void stb_callback(
- AVAHI_GCC_UNUSED AvahiSServiceTypeBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *service_type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- avahi_log_debug("STB: (%i.%i) %s in <%s> [%s]", iface, protocol, service_type ? service_type : "NULL", domain ? domain : "NULL", browser_event_to_string(event));
-}
-
-static void sb_callback(
- AVAHI_GCC_UNUSED AvahiSServiceBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *service_type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("SB: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name ? name : "NULL", service_type ? service_type : "NULL", domain ? domain : "NULL", browser_event_to_string(event));
-}
-
-static void sr_callback(
- AVAHI_GCC_UNUSED AvahiSServiceResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char*service_type,
- const char*domain_name,
- const char*hostname,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- if (event != AVAHI_RESOLVER_FOUND)
- avahi_log_debug("SR: (%i.%i) <%s> as %s in <%s> [%s]", iface, protocol, name, service_type, domain_name, resolver_event_to_string(event));
- else {
- char t[AVAHI_ADDRESS_STR_MAX], *s;
-
- avahi_address_snprint(t, sizeof(t), a);
-
- s = avahi_string_list_to_string(txt);
- avahi_log_debug("SR: (%i.%i) <%s> as %s in <%s>: %s/%s:%i (%s) [%s]", iface, protocol, name, service_type, domain_name, hostname, t, port, s, resolver_event_to_string(event));
- avahi_free(s);
- }
-}
-
-static void dsb_callback(
- AVAHI_GCC_UNUSED AvahiSDNSServerBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char*hostname,
- const AvahiAddress *a,
- uint16_t port,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- char t[AVAHI_ADDRESS_STR_MAX] = "n/a";
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
-
- avahi_log_debug("DSB: (%i.%i): %s/%s:%i [%s]", iface, protocol, hostname ? hostname : "NULL", t, port, browser_event_to_string(event));
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiSRecordBrowser *r;
- AvahiSHostNameResolver *hnr;
- AvahiSAddressResolver *ar;
- AvahiKey *k;
- AvahiServerConfig config;
- AvahiAddress a;
- AvahiSDomainBrowser *db;
- AvahiSServiceTypeBrowser *stb;
- AvahiSServiceBrowser *sb;
- AvahiSServiceResolver *sr;
- AvahiSDNSServerBrowser *dsb;
- AvahiSimplePoll *simple_poll;
- int error;
- struct timeval tv;
-
- simple_poll = avahi_simple_poll_new();
- poll_api = avahi_simple_poll_get(simple_poll);
-
- avahi_server_config_init(&config);
-
- avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
- config.n_wide_area_servers = 1;
- config.enable_wide_area = 1;
-
- server = avahi_server_new(poll_api, &config, server_callback, NULL, &error);
- avahi_server_config_free(&config);
-
- k = avahi_key_new("_http._tcp.0pointer.de", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR);
- r = avahi_s_record_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, k, 0, record_browser_callback, NULL);
- avahi_key_unref(k);
-
- hnr = avahi_s_host_name_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "cname.local", AVAHI_PROTO_UNSPEC, 0, hnr_callback, NULL);
-
- ar = avahi_s_address_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, avahi_address_parse("192.168.50.1", AVAHI_PROTO_INET, &a), 0, ar_callback, NULL);
-
- db = avahi_s_domain_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, db_callback, NULL);
-
- stb = avahi_s_service_type_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, 0, stb_callback, NULL);
-
- sb = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, sb_callback, NULL);
-
- sr = avahi_s_service_resolver_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "Ecstasy HTTP", "_http._tcp", "local", AVAHI_PROTO_UNSPEC, 0, sr_callback, NULL);
-
- dsb = avahi_s_dns_server_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "local", AVAHI_DNS_SERVER_RESOLVE, AVAHI_PROTO_UNSPEC, 0, dsb_callback, NULL);
-
- avahi_elapse_time(&tv, 1000*5, 0);
- poll_api->timeout_new(poll_api, &tv, dump_timeout_callback, server);
-
- avahi_elapse_time(&tv, 1000*60, 0);
- poll_api->timeout_new(poll_api, &tv, quit_timeout_callback, simple_poll);
-
- avahi_simple_poll_loop(simple_poll);
-
- avahi_s_record_browser_free(r);
- avahi_s_host_name_resolver_free(hnr);
- avahi_s_address_resolver_free(ar);
- avahi_s_service_type_browser_free(stb);
- avahi_s_service_browser_free(sb);
- avahi_s_service_resolver_free(sr);
- avahi_s_dns_server_browser_free(dsb);
-
- if (group)
- avahi_s_entry_group_free(group);
-
- if (server)
- avahi_server_free(server);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(service_name);
-
- return 0;
-}
diff --git a/trunk/avahi-core/browse-dns-server.c b/trunk/avahi-core/browse-dns-server.c
deleted file mode 100644
index 48d23ad..0000000
--- a/trunk/avahi-core/browse-dns-server.c
+++ /dev/null
@@ -1,324 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-#include "rr.h"
-
-typedef struct AvahiDNSServerInfo AvahiDNSServerInfo;
-
-struct AvahiDNSServerInfo {
- AvahiSDNSServerBrowser *browser;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiRecord *srv_record;
- AvahiSHostNameResolver *host_name_resolver;
- AvahiAddress address;
- AvahiLookupResultFlags flags;
-
- AVAHI_LLIST_FIELDS(AvahiDNSServerInfo, info);
-};
-
-struct AvahiSDNSServerBrowser {
- AvahiServer *server;
-
- AvahiSRecordBrowser *record_browser;
- AvahiSDNSServerBrowserCallback callback;
- void* userdata;
- AvahiProtocol aprotocol;
- AvahiLookupFlags user_flags;
-
- unsigned n_info;
-
- AVAHI_LLIST_FIELDS(AvahiSDNSServerBrowser, browser);
- AVAHI_LLIST_HEAD(AvahiDNSServerInfo, info);
-};
-
-static AvahiDNSServerInfo* get_server_info(AvahiSDNSServerBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r) {
- AvahiDNSServerInfo *i;
-
- assert(b);
- assert(r);
-
- for (i = b->info; i; i = i->info_next)
- if (i->interface == interface &&
- i->protocol == protocol &&
- avahi_record_equal_no_ttl(r, i->srv_record))
- return i;
-
- return NULL;
-}
-
-static void server_info_free(AvahiSDNSServerBrowser *b, AvahiDNSServerInfo *i) {
- assert(b);
- assert(i);
-
- avahi_record_unref(i->srv_record);
- if (i->host_name_resolver)
- avahi_s_host_name_resolver_free(i->host_name_resolver);
-
- AVAHI_LLIST_REMOVE(AvahiDNSServerInfo, info, b->info, i);
-
- assert(b->n_info >= 1);
- b->n_info--;
-
- avahi_free(i);
-}
-
-static void host_name_resolver_callback(
- AvahiSHostNameResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *host_name,
- const AvahiAddress *a,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiDNSServerInfo *i = userdata;
-
- assert(r);
- assert(host_name);
- assert(i);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- i->address = *a;
-
- i->browser->callback(
- i->browser,
- i->interface,
- i->protocol,
- AVAHI_BROWSER_NEW,
- i->srv_record->data.srv.name,
- &i->address,
- i->srv_record->data.srv.port,
- i->flags | flags,
- i->browser->userdata);
-
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
- /* Ignore */
- break;
- }
-
- avahi_s_host_name_resolver_free(i->host_name_resolver);
- i->host_name_resolver = NULL;
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSDNSServerBrowser *b = userdata;
-
- assert(rr);
- assert(b);
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- switch (event) {
- case AVAHI_BROWSER_NEW: {
- AvahiDNSServerInfo *i;
-
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_SRV);
-
- if (get_server_info(b, interface, protocol, record))
- return;
-
- if (b->n_info >= 10)
- return;
-
- if (!(i = avahi_new(AvahiDNSServerInfo, 1)))
- return; /* OOM */
-
- i->browser = b;
- i->interface = interface;
- i->protocol = protocol;
- i->srv_record = avahi_record_ref(record);
- i->host_name_resolver = avahi_s_host_name_resolver_new(
- b->server,
- interface, protocol,
- record->data.srv.name,
- b->aprotocol,
- b->user_flags,
- host_name_resolver_callback, i);
- i->flags = flags;
-
- AVAHI_LLIST_PREPEND(AvahiDNSServerInfo, info, b->info, i);
-
- b->n_info++;
- break;
- }
-
- case AVAHI_BROWSER_REMOVE: {
- AvahiDNSServerInfo *i;
-
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_SRV);
-
- if (!(i = get_server_info(b, interface, protocol, record)))
- return;
-
- if (!i->host_name_resolver)
- b->callback(
- b,
- interface,
- protocol,
- event,
- i->srv_record->data.srv.name,
- &i->address,
- i->srv_record->data.srv.port,
- i->flags | flags,
- b->userdata);
-
- server_info_free(b, i);
- break;
- }
-
- case AVAHI_BROWSER_FAILURE:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
-
- b->callback(
- b,
- interface,
- protocol,
- event,
- NULL,
- NULL,
- 0,
- flags,
- b->userdata);
-
- break;
- }
-}
-
-AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDNSServerType type,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiSDNSServerBrowserCallback callback,
- void* userdata) {
-
- static const char * const type_table[AVAHI_DNS_SERVER_MAX] = {
- "_domain._udp",
- "_dns-update._udp"
- };
-
- AvahiSDNSServerBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(aprotocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, type < AVAHI_DNS_SERVER_MAX, AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), NULL, type_table[type], domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSDNSServerBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->server = server;
- b->callback = callback;
- b->userdata = userdata;
- b->aprotocol = aprotocol;
- b->n_info = 0;
- b->user_flags = flags;
-
- AVAHI_LLIST_HEAD_INIT(AvahiDNSServerInfo, b->info);
- AVAHI_LLIST_PREPEND(AvahiSDNSServerBrowser, browser, server->dns_server_browsers, b);
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- return b;
-
-fail:
-
- if (k)
- avahi_key_unref(k);
-
- avahi_s_dns_server_browser_free(b);
- return NULL;
-}
-
-void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b) {
- assert(b);
-
- while (b->info)
- server_info_free(b, b->info);
-
- AVAHI_LLIST_REMOVE(AvahiSDNSServerBrowser, browser, b->server->dns_server_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- avahi_free(b);
-}
-
diff --git a/trunk/avahi-core/browse-domain.c b/trunk/avahi-core/browse-domain.c
deleted file mode 100644
index 0043806..0000000
--- a/trunk/avahi-core/browse-domain.c
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-struct AvahiSDomainBrowser {
- int ref;
-
- AvahiServer *server;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiDomainBrowserType type;
- AvahiSDomainBrowserCallback callback;
- void* userdata;
-
- AvahiTimeEvent *defer_event;
-
- int all_for_now_scheduled;
-
- AVAHI_LLIST_FIELDS(AvahiSDomainBrowser, browser);
-};
-
-static void inc_ref(AvahiSDomainBrowser *b) {
- assert(b);
- assert(b->ref >= 1);
-
- b->ref++;
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSDomainBrowser *b = userdata;
- char *n = NULL;
-
- assert(rr);
- assert(b);
-
- if (event == AVAHI_BROWSER_ALL_FOR_NOW &&
- b->defer_event) {
-
- b->all_for_now_scheduled = 1;
- return;
- }
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- if (record) {
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
- n = record->data.ptr.name;
-
- if (b->type == AVAHI_DOMAIN_BROWSER_BROWSE) {
- AvahiStringList *l;
-
- /* Filter out entries defined statically */
-
- for (l = b->server->config.browse_domains; l; l = l->next)
- if (avahi_domain_equal((char*) l->text, n))
- return;
- }
-
- }
-
- b->callback(b, interface, protocol, event, n, flags, b->userdata);
-}
-
-static void defer_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSDomainBrowser *b = userdata;
- AvahiStringList *l;
-
- assert(e);
- assert(b);
-
- assert(b->type == AVAHI_DOMAIN_BROWSER_BROWSE);
-
- avahi_time_event_free(b->defer_event);
- b->defer_event = NULL;
-
- /* Increase ref counter */
- inc_ref(b);
-
- for (l = b->server->config.browse_domains; l; l = l->next) {
-
- /* Check whether this object still exists outside our own
- * stack frame */
- if (b->ref <= 1)
- break;
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_NEW, (char*) l->text, AVAHI_LOOKUP_RESULT_STATIC, b->userdata);
- }
-
- if (b->ref > 1) {
- /* If the ALL_FOR_NOW event has already been scheduled, execute it now */
-
- if (b->all_for_now_scheduled)
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_BROWSER_ALL_FOR_NOW, NULL, 0, b->userdata);
- }
-
- /* Decrease ref counter */
- avahi_s_domain_browser_free(b);
-}
-
-AvahiSDomainBrowser *avahi_s_domain_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType type,
- AvahiLookupFlags flags,
- AvahiSDomainBrowserCallback callback,
- void* userdata) {
-
- static const char * const type_table[AVAHI_DOMAIN_BROWSER_MAX] = {
- "b",
- "db",
- "r",
- "dr",
- "lb"
- };
-
- AvahiSDomainBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, type < AVAHI_DOMAIN_BROWSER_MAX, AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), type_table[type], "_dns-sd._udp", domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSDomainBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->ref = 1;
- b->server = server;
- b->callback = callback;
- b->userdata = userdata;
- b->record_browser = NULL;
- b->type = type;
- b->all_for_now_scheduled = 0;
- b->defer_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSDomainBrowser, browser, server->domain_browsers, b);
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- if (type == AVAHI_DOMAIN_BROWSER_BROWSE && b->server->config.browse_domains)
- b->defer_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
-
- return b;
-
-fail:
-
- if (k)
- avahi_key_unref(k);
-
- avahi_s_domain_browser_free(b);
-
- return NULL;
-}
-
-void avahi_s_domain_browser_free(AvahiSDomainBrowser *b) {
- assert(b);
-
- assert(b->ref >= 1);
- if (--b->ref > 0)
- return;
-
- AVAHI_LLIST_REMOVE(AvahiSDomainBrowser, browser, b->server->domain_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- if (b->defer_event)
- avahi_time_event_free(b->defer_event);
-
- avahi_free(b);
-}
diff --git a/trunk/avahi-core/browse-service-type.c b/trunk/avahi-core/browse-service-type.c
deleted file mode 100644
index 252e3cb..0000000
--- a/trunk/avahi-core/browse-service-type.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-struct AvahiSServiceTypeBrowser {
- AvahiServer *server;
- char *domain_name;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiSServiceTypeBrowserCallback callback;
- void* userdata;
-
- AVAHI_LLIST_FIELDS(AvahiSServiceTypeBrowser, browser);
-};
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSServiceTypeBrowser *b = userdata;
-
- assert(rr);
- assert(b);
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- if (record) {
- char type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
-
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (avahi_service_name_split(record->data.ptr.name, NULL, 0, type, sizeof(type), domain, sizeof(domain)) < 0) {
- avahi_log_warn("Invalid service type '%s'", record->key->name);
- return;
- }
-
- b->callback(b, interface, protocol, event, type, domain, flags, b->userdata);
- } else
- b->callback(b, interface, protocol, event, NULL, b->domain_name, flags, b->userdata);
-}
-
-AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiSServiceTypeBrowserCallback callback,
- void* userdata) {
-
- AvahiSServiceTypeBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), NULL, "_services._dns-sd._udp", domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSServiceTypeBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->server = server;
- b->callback = callback;
- b->userdata = userdata;
- b->record_browser = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSServiceTypeBrowser, browser, server->service_type_browsers, b);
-
- if (!(b->domain_name = avahi_normalize_name_strdup(domain))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- return b;
-
-fail:
- if (k)
- avahi_key_unref(k);
-
- avahi_s_service_type_browser_free(b);
-
- return NULL;
-}
-
-void avahi_s_service_type_browser_free(AvahiSServiceTypeBrowser *b) {
- assert(b);
-
- AVAHI_LLIST_REMOVE(AvahiSServiceTypeBrowser, browser, b->server->service_type_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- avahi_free(b->domain_name);
- avahi_free(b);
-}
-
-
diff --git a/trunk/avahi-core/browse-service.c b/trunk/avahi-core/browse-service.c
deleted file mode 100644
index 43778dd..0000000
--- a/trunk/avahi-core/browse-service.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-struct AvahiSServiceBrowser {
- AvahiServer *server;
- char *domain_name;
- char *service_type;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiSServiceBrowserCallback callback;
- void* userdata;
-
- AVAHI_LLIST_FIELDS(AvahiSServiceBrowser, browser);
-};
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSServiceBrowser *b = userdata;
-
- assert(rr);
- assert(b);
-
- /* Filter flags */
- flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
-
- if (record) {
- char service[AVAHI_LABEL_MAX], type[AVAHI_DOMAIN_NAME_MAX], domain[AVAHI_DOMAIN_NAME_MAX];
-
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (event == AVAHI_BROWSER_NEW && avahi_server_is_service_local(b->server, interface, protocol, record->data.ptr.name))
- flags |= AVAHI_LOOKUP_RESULT_LOCAL;
-
- if (avahi_service_name_split(record->data.ptr.name, service, sizeof(service), type, sizeof(type), domain, sizeof(domain)) < 0) {
- avahi_log_warn("Failed to split '%s'", record->key->name);
- return;
- }
-
- b->callback(b, interface, protocol, event, service, type, domain, flags, b->userdata);
-
- } else
- b->callback(b, interface, protocol, event, NULL, b->service_type, b->domain_name, flags, b->userdata);
-
-}
-
-AvahiSServiceBrowser *avahi_s_service_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *service_type,
- const char *domain,
- AvahiLookupFlags flags,
- AvahiSServiceBrowserCallback callback,
- void* userdata) {
-
- AvahiSServiceBrowser *b;
- AvahiKey *k = NULL;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int r;
-
- assert(server);
- assert(callback);
- assert(service_type);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_is_valid_service_type_generic(service_type), AVAHI_ERR_INVALID_SERVICE_TYPE);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((r = avahi_service_name_join(n, sizeof(n), NULL, service_type, domain)) < 0) {
- avahi_server_set_errno(server, r);
- return NULL;
- }
-
- if (!(b = avahi_new(AvahiSServiceBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->server = server;
- b->domain_name = b->service_type = NULL;
- b->callback = callback;
- b->userdata = userdata;
- b->record_browser = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSServiceBrowser, browser, server->service_browsers, b);
-
- if (!(b->domain_name = avahi_normalize_name_strdup(domain)) ||
- !(b->service_type = avahi_normalize_name_strdup(service_type))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if (!(b->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, b)))
- goto fail;
-
- avahi_key_unref(k);
-
- return b;
-
-fail:
-
- if (k)
- avahi_key_unref(k);
-
- avahi_s_service_browser_free(b);
- return NULL;
-}
-
-void avahi_s_service_browser_free(AvahiSServiceBrowser *b) {
- assert(b);
-
- AVAHI_LLIST_REMOVE(AvahiSServiceBrowser, browser, b->server->service_browsers, b);
-
- if (b->record_browser)
- avahi_s_record_browser_free(b->record_browser);
-
- avahi_free(b->domain_name);
- avahi_free(b->service_type);
- avahi_free(b);
-}
diff --git a/trunk/avahi-core/browse.c b/trunk/avahi-core/browse.c
deleted file mode 100644
index 16d8954..0000000
--- a/trunk/avahi-core/browse.c
+++ /dev/null
@@ -1,615 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/rlist.h>
-#include <avahi-common/address.h>
-
-#include "browse.h"
-#include "log.h"
-#include "querier.h"
-#include "domain-util.h"
-#include "rr-util.h"
-
-#define AVAHI_LOOKUPS_PER_BROWSER_MAX 15
-
-struct AvahiSRBLookup {
- AvahiSRecordBrowser *record_browser;
-
- unsigned ref;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupFlags flags;
-
- AvahiKey *key;
-
- AvahiWideAreaLookup *wide_area;
- AvahiMulticastLookup *multicast;
-
- AvahiRList *cname_lookups;
-
- AVAHI_LLIST_FIELDS(AvahiSRBLookup, lookups);
-};
-
-static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r);
-static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r);
-
-static void transport_flags_from_domain(AvahiServer *s, AvahiLookupFlags *flags, const char *domain) {
- assert(flags);
- assert(domain);
-
- assert(!((*flags & AVAHI_LOOKUP_USE_MULTICAST) && (*flags & AVAHI_LOOKUP_USE_WIDE_AREA)));
-
- if (*flags & (AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_USE_WIDE_AREA))
- return;
-
- if (!s->wide_area_lookup_engine ||
- !avahi_wide_area_has_servers(s->wide_area_lookup_engine) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_LOCAL) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV4) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV6))
- *flags |= AVAHI_LOOKUP_USE_MULTICAST;
- else
- *flags |= AVAHI_LOOKUP_USE_WIDE_AREA;
-}
-
-static AvahiSRBLookup* lookup_new(
- AvahiSRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiLookupFlags flags,
- AvahiKey *key) {
-
- AvahiSRBLookup *l;
-
- assert(b);
- assert(AVAHI_IF_VALID(interface));
- assert(AVAHI_PROTO_VALID(protocol));
-
- if (b->n_lookups >= AVAHI_LOOKUPS_PER_BROWSER_MAX)
- /* We don't like cyclic CNAMEs */
- return NULL;
-
- if (!(l = avahi_new(AvahiSRBLookup, 1)))
- return NULL;
-
- l->ref = 1;
- l->record_browser = b;
- l->interface = interface;
- l->protocol = protocol;
- l->key = avahi_key_ref(key);
- l->wide_area = NULL;
- l->multicast = NULL;
- l->cname_lookups = NULL;
- l->flags = flags;
-
- transport_flags_from_domain(b->server, &l->flags, key->name);
-
- AVAHI_LLIST_PREPEND(AvahiSRBLookup, lookups, b->lookups, l);
-
- b->n_lookups ++;
-
- return l;
-}
-
-static void lookup_unref(AvahiSRBLookup *l) {
- assert(l);
- assert(l->ref >= 1);
-
- if (--l->ref >= 1)
- return;
-
- AVAHI_LLIST_REMOVE(AvahiSRBLookup, lookups, l->record_browser->lookups, l);
- l->record_browser->n_lookups --;
-
- if (l->wide_area) {
- avahi_wide_area_lookup_free(l->wide_area);
- l->wide_area = NULL;
- }
-
- if (l->multicast) {
- avahi_multicast_lookup_free(l->multicast);
- l->multicast = NULL;
- }
-
- while (l->cname_lookups) {
- lookup_unref(l->cname_lookups->data);
- l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, l->cname_lookups);
- }
-
- avahi_key_unref(l->key);
- avahi_free(l);
-}
-
-static AvahiSRBLookup* lookup_ref(AvahiSRBLookup *l) {
- assert(l);
- assert(l->ref >= 1);
-
- l->ref++;
- return l;
-}
-
-static AvahiSRBLookup *lookup_find(
- AvahiSRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiLookupFlags flags,
- AvahiKey *key) {
-
- AvahiSRBLookup *l;
-
- assert(b);
-
- for (l = b->lookups; l; l = l->lookups_next) {
-
- if ((l->interface == AVAHI_IF_UNSPEC || l->interface == interface) &&
- (l->interface == AVAHI_PROTO_UNSPEC || l->protocol == protocol) &&
- l->flags == flags &&
- avahi_key_equal(l->key, key))
-
- return l;
- }
-
- return NULL;
-}
-
-static void browser_cancel(AvahiSRecordBrowser *b) {
- assert(b);
-
- if (b->root_lookup) {
- lookup_unref(b->root_lookup);
- b->root_lookup = NULL;
- }
-
- if (b->defer_time_event) {
- avahi_time_event_free(b->defer_time_event);
- b->defer_time_event = NULL;
- }
-}
-
-static void lookup_wide_area_callback(
- AvahiWideAreaLookupEngine *e,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata) {
-
- AvahiSRBLookup *l = userdata;
- AvahiSRecordBrowser *b;
-
- assert(e);
- assert(l);
- assert(l->ref >= 1);
-
- b = l->record_browser;
-
- if (b->dead)
- return;
-
- lookup_ref(l);
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(r);
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
- r->key->type == AVAHI_DNS_TYPE_CNAME)
- /* It's a CNAME record, so let's follow it. We only follow it on wide area DNS! */
- lookup_handle_cname(l, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_USE_WIDE_AREA, r);
- else {
- /* It's a normal record, so let's call the user callback */
- assert(avahi_key_equal(r->key, l->key));
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, event, r, flags, b->userdata);
- }
- break;
-
- case AVAHI_BROWSER_REMOVE:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- /* Not defined for wide area DNS */
- abort();
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_FAILURE:
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, event, NULL, flags, b->userdata);
- break;
- }
-
- lookup_unref(l);
-
-}
-
-static void lookup_multicast_callback(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata) {
-
- AvahiSRBLookup *l = userdata;
- AvahiSRecordBrowser *b;
-
- assert(e);
- assert(l);
-
- b = l->record_browser;
-
- if (b->dead)
- return;
-
- lookup_ref(l);
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(r);
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
- r->key->type == AVAHI_DNS_TYPE_CNAME)
- /* It's a CNAME record, so let's follow it. We allow browsing on both multicast and wide area. */
- lookup_handle_cname(l, interface, protocol, b->flags, r);
- else {
- /* It's a normal record, so let's call the user callback */
-
- if (avahi_server_is_record_local(b->server, interface, protocol, r))
- flags |= AVAHI_LOOKUP_RESULT_LOCAL;
-
- b->callback(b, interface, protocol, event, r, flags, b->userdata);
- }
- break;
-
- case AVAHI_BROWSER_REMOVE:
- assert(r);
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN &&
- r->key->type == AVAHI_DNS_TYPE_CNAME)
- /* It's a CNAME record, so let's drop that query! */
- lookup_drop_cname(l, interface, protocol, 0, r);
- else {
- /* It's a normal record, so let's call the user callback */
- assert(avahi_key_equal(b->key, l->key));
-
- b->callback(b, interface, protocol, event, r, flags, b->userdata);
- }
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
-
- b->callback(b, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, event, NULL, flags, b->userdata);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_FAILURE:
- /* Not defined for multicast DNS */
- abort();
-
- }
-
- lookup_unref(l);
-}
-
-static int lookup_start(AvahiSRBLookup *l) {
- assert(l);
-
- assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST));
- assert(!l->wide_area && !l->multicast);
-
- if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {
-
- if (!(l->wide_area = avahi_wide_area_lookup_new(l->record_browser->server->wide_area_lookup_engine, l->key, lookup_wide_area_callback, l)))
- return -1;
-
- } else {
- assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST);
-
- if (!(l->multicast = avahi_multicast_lookup_new(l->record_browser->server->multicast_lookup_engine, l->interface, l->protocol, l->key, lookup_multicast_callback, l)))
- return -1;
- }
-
- return 0;
-}
-
-static int lookup_scan_cache(AvahiSRBLookup *l) {
- int n = 0;
-
- assert(l);
-
- assert(!(l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) != !(l->flags & AVAHI_LOOKUP_USE_MULTICAST));
-
-
- if (l->flags & AVAHI_LOOKUP_USE_WIDE_AREA) {
- n = (int) avahi_wide_area_scan_cache(l->record_browser->server->wide_area_lookup_engine, l->key, lookup_wide_area_callback, l);
-
- } else {
- assert(l->flags & AVAHI_LOOKUP_USE_MULTICAST);
- n = (int) avahi_multicast_lookup_engine_scan_cache(l->record_browser->server->multicast_lookup_engine, l->interface, l->protocol, l->key, lookup_multicast_callback, l);
- }
-
- return n;
-}
-
-static AvahiSRBLookup* lookup_add(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiKey *key) {
- AvahiSRBLookup *l;
-
- assert(b);
- assert(!b->dead);
-
- if ((l = lookup_find(b, interface, protocol, flags, key)))
- return lookup_ref(l);
-
- if (!(l = lookup_new(b, interface, protocol, flags, key)))
- return NULL;
-
- return l;
-}
-
-static int lookup_go(AvahiSRBLookup *l) {
- int n = 0;
- assert(l);
-
- if (l->record_browser->dead)
- return 0;
-
- lookup_ref(l);
-
- /* Browse the cache for the root request */
- n = lookup_scan_cache(l);
-
- /* Start the lookup */
- if (!l->record_browser->dead && l->ref > 1) {
-
- if ((l->flags & AVAHI_LOOKUP_USE_MULTICAST) || n == 0)
- /* We do no start a query if the cache contained entries and we're on wide area */
-
- if (lookup_start(l) < 0)
- n = -1;
- }
-
- lookup_unref(l);
-
- return n;
-}
-
-static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
- AvahiKey *k;
- AvahiSRBLookup *n;
-
- assert(l);
- assert(r);
-
- assert(r->key->clazz == AVAHI_DNS_CLASS_IN);
- assert(r->key->type == AVAHI_DNS_TYPE_CNAME);
-
- k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type);
- n = lookup_add(l->record_browser, interface, protocol, flags, k);
- avahi_key_unref(k);
-
- if (!n) {
- avahi_log_debug(__FILE__": Failed to create SRBLookup.");
- return;
- }
-
- l->cname_lookups = avahi_rlist_prepend(l->cname_lookups, lookup_ref(n));
-
- lookup_go(n);
- lookup_unref(n);
-}
-
-static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
- AvahiKey *k;
- AvahiSRBLookup *n = NULL;
- AvahiRList *rl;
-
- assert(r->key->clazz == AVAHI_DNS_CLASS_IN);
- assert(r->key->type == AVAHI_DNS_TYPE_CNAME);
-
- k = avahi_key_new(r->data.ptr.name, l->record_browser->key->clazz, l->record_browser->key->type);
-
- for (rl = l->cname_lookups; rl; rl = rl->rlist_next) {
- n = rl->data;
-
- assert(n);
-
- if ((n->interface == AVAHI_IF_UNSPEC || n->interface == interface) &&
- (n->interface == AVAHI_PROTO_UNSPEC || n->protocol == protocol) &&
- n->flags == flags &&
- avahi_key_equal(n->key, k))
- break;
- }
-
- avahi_key_unref(k);
-
- if (rl) {
- l->cname_lookups = avahi_rlist_remove_by_link(l->cname_lookups, rl);
- lookup_unref(n);
- }
-}
-
-static void defer_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
- AvahiSRecordBrowser *b = userdata;
- int n;
-
- assert(b);
- assert(!b->dead);
-
- /* Remove the defer timeout */
- if (b->defer_time_event) {
- avahi_time_event_free(b->defer_time_event);
- b->defer_time_event = NULL;
- }
-
- /* Create initial query */
- assert(!b->root_lookup);
- b->root_lookup = lookup_add(b, b->interface, b->protocol, b->flags, b->key);
- assert(b->root_lookup);
-
- n = lookup_go(b->root_lookup);
-
- if (b->dead)
- return;
-
- if (n < 0) {
- /* sending of the initial query failed */
-
- avahi_server_set_errno(b->server, AVAHI_ERR_FAILURE);
-
- b->callback(
- b, b->interface, b->protocol, AVAHI_BROWSER_FAILURE, NULL,
- b->flags & AVAHI_LOOKUP_USE_WIDE_AREA ? AVAHI_LOOKUP_RESULT_WIDE_AREA : AVAHI_LOOKUP_RESULT_MULTICAST,
- b->userdata);
-
- browser_cancel(b);
- return;
- }
-
- /* Tell the client that we're done with the cache */
- b->callback(
- b, b->interface, b->protocol, AVAHI_BROWSER_CACHE_EXHAUSTED, NULL,
- b->flags & AVAHI_LOOKUP_USE_WIDE_AREA ? AVAHI_LOOKUP_RESULT_WIDE_AREA : AVAHI_LOOKUP_RESULT_MULTICAST,
- b->userdata);
-
- if (!b->dead && b->root_lookup && b->root_lookup->flags & AVAHI_LOOKUP_USE_WIDE_AREA && n > 0) {
-
- /* If we do wide area lookups and the the cache contained
- * entries, we assume that it is complete, and tell the user
- * so by firing ALL_FOR_NOW. */
-
- b->callback(b, b->interface, b->protocol, AVAHI_BROWSER_ALL_FOR_NOW, NULL, AVAHI_LOOKUP_RESULT_WIDE_AREA, b->userdata);
- }
-}
-
-void avahi_s_record_browser_restart(AvahiSRecordBrowser *b) {
- assert(b);
- assert(!b->dead);
-
- browser_cancel(b);
-
- /* Request a new iteration of the cache scanning */
- if (!b->defer_time_event) {
- b->defer_time_event = avahi_time_event_new(b->server->time_event_queue, NULL, defer_callback, b);
- assert(b->defer_time_event);
- }
-}
-
-AvahiSRecordBrowser *avahi_s_record_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiKey *key,
- AvahiLookupFlags flags,
- AvahiSRecordBrowserCallback callback,
- void* userdata) {
-
- AvahiSRecordBrowser *b;
-
- assert(server);
- assert(key);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !avahi_key_is_pattern(key), AVAHI_ERR_IS_PATTERN);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_key_is_valid(key), AVAHI_ERR_INVALID_KEY);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !(flags & AVAHI_LOOKUP_USE_WIDE_AREA) || !(flags & AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!(b = avahi_new(AvahiSRecordBrowser, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- b->dead = 0;
- b->server = server;
- b->interface = interface;
- b->protocol = protocol;
- b->key = avahi_key_ref(key);
- b->flags = flags;
- b->callback = callback;
- b->userdata = userdata;
- b->n_lookups = 0;
- AVAHI_LLIST_HEAD_INIT(AvahiSRBLookup, b->lookups);
- b->root_lookup = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSRecordBrowser, browser, server->record_browsers, b);
-
- /* The currently cached entries are scanned a bit later, and than we will start querying, too */
- b->defer_time_event = avahi_time_event_new(server->time_event_queue, NULL, defer_callback, b);
- assert(b->defer_time_event);
-
- return b;
-}
-
-void avahi_s_record_browser_free(AvahiSRecordBrowser *b) {
- assert(b);
- assert(!b->dead);
-
- b->dead = 1;
- b->server->need_browser_cleanup = 1;
-
- browser_cancel(b);
-}
-
-void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b) {
- assert(b);
-
- browser_cancel(b);
-
- AVAHI_LLIST_REMOVE(AvahiSRecordBrowser, browser, b->server->record_browsers, b);
-
- avahi_key_unref(b->key);
-
- avahi_free(b);
-}
-
-void avahi_browser_cleanup(AvahiServer *server) {
- AvahiSRecordBrowser *b;
- AvahiSRecordBrowser *n;
-
- assert(server);
-
- while (server->need_browser_cleanup) {
- server->need_browser_cleanup = 0;
-
- for (b = server->record_browsers; b; b = n) {
- n = b->browser_next;
-
- if (b->dead)
- avahi_s_record_browser_destroy(b);
- }
- }
-
- if (server->wide_area_lookup_engine)
- avahi_wide_area_cleanup(server->wide_area_lookup_engine);
- avahi_multicast_lookup_engine_cleanup(server->multicast_lookup_engine);
-}
-
diff --git a/trunk/avahi-core/browse.h b/trunk/avahi-core/browse.h
deleted file mode 100644
index 36d4e2e..0000000
--- a/trunk/avahi-core/browse.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef foobrowsehfoo
-#define foobrowsehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/llist.h>
-
-#include "core.h"
-#include "timeeventq.h"
-#include "internal.h"
-#include "dns.h"
-#include "lookup.h"
-
-typedef struct AvahiSRBLookup AvahiSRBLookup;
-
-struct AvahiSRecordBrowser {
- AVAHI_LLIST_FIELDS(AvahiSRecordBrowser, browser);
- int dead;
- AvahiServer *server;
-
- AvahiKey *key;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupFlags flags;
-
- AvahiTimeEvent *defer_time_event;
-
- AvahiSRecordBrowserCallback callback;
- void* userdata;
-
- /* Lookup data */
- AVAHI_LLIST_HEAD(AvahiSRBLookup, lookups);
- unsigned n_lookups;
-
- AvahiSRBLookup *root_lookup;
-};
-
-void avahi_browser_cleanup(AvahiServer *server);
-
-void avahi_s_record_browser_destroy(AvahiSRecordBrowser *b);
-void avahi_s_record_browser_restart(AvahiSRecordBrowser *b);
-
-#endif
diff --git a/trunk/avahi-core/cache.c b/trunk/avahi-core/cache.c
deleted file mode 100644
index 4ba88b5..0000000
--- a/trunk/avahi-core/cache.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "cache.h"
-#include "log.h"
-#include "rr-util.h"
-
-#define AVAHI_CACHE_ENTRIES_MAX 500
-
-static void remove_entry(AvahiCache *c, AvahiCacheEntry *e) {
- AvahiCacheEntry *t;
-
- assert(c);
- assert(e);
-
-/* avahi_log_debug("removing from cache: %p %p", c, e); */
-
- /* Remove from hash table */
- t = avahi_hashmap_lookup(c->hashmap, e->record->key);
- AVAHI_LLIST_REMOVE(AvahiCacheEntry, by_key, t, e);
- if (t)
- avahi_hashmap_replace(c->hashmap, t->record->key, t);
- else
- avahi_hashmap_remove(c->hashmap, e->record->key);
-
- /* Remove from linked list */
- AVAHI_LLIST_REMOVE(AvahiCacheEntry, entry, c->entries, e);
-
- if (e->time_event)
- avahi_time_event_free(e->time_event);
-
- avahi_multicast_lookup_engine_notify(c->server->multicast_lookup_engine, c->interface, e->record, AVAHI_BROWSER_REMOVE);
-
- avahi_record_unref(e->record);
-
- avahi_free(e);
-
- assert(c->n_entries-- >= 1);
-}
-
-AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *iface) {
- AvahiCache *c;
- assert(server);
-
- if (!(c = avahi_new(AvahiCache, 1))) {
- avahi_log_error(__FILE__": Out of memory.");
- return NULL; /* OOM */
- }
-
- c->server = server;
- c->interface = iface;
-
- if (!(c->hashmap = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL))) {
- avahi_log_error(__FILE__": Out of memory.");
- avahi_free(c);
- return NULL; /* OOM */
- }
-
- AVAHI_LLIST_HEAD_INIT(AvahiCacheEntry, c->entries);
- c->n_entries = 0;
-
- c->last_rand_timestamp = 0;
-
- return c;
-}
-
-void avahi_cache_free(AvahiCache *c) {
- assert(c);
-
- while (c->entries)
- remove_entry(c, c->entries);
- assert(c->n_entries == 0);
-
- avahi_hashmap_free(c->hashmap);
-
- avahi_free(c);
-}
-
-static AvahiCacheEntry *lookup_key(AvahiCache *c, AvahiKey *k) {
- assert(c);
- assert(k);
-
- assert(!avahi_key_is_pattern(k));
-
- return avahi_hashmap_lookup(c->hashmap, k);
-}
-
-void* avahi_cache_walk(AvahiCache *c, AvahiKey *pattern, AvahiCacheWalkCallback cb, void* userdata) {
- void* ret;
-
- assert(c);
- assert(pattern);
- assert(cb);
-
- if (avahi_key_is_pattern(pattern)) {
- AvahiCacheEntry *e, *n;
-
- for (e = c->entries; e; e = n) {
- n = e->entry_next;
-
- if (avahi_key_pattern_match(pattern, e->record->key))
- if ((ret = cb(c, pattern, e, userdata)))
- return ret;
- }
-
- } else {
- AvahiCacheEntry *e, *n;
-
- for (e = lookup_key(c, pattern); e; e = n) {
- n = e->by_key_next;
-
- if ((ret = cb(c, pattern, e, userdata)))
- return ret;
- }
- }
-
- return NULL;
-}
-
-static void* lookup_record_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void *userdata) {
- assert(c);
- assert(pattern);
- assert(e);
-
- if (avahi_record_equal_no_ttl(e->record, userdata))
- return e;
-
- return NULL;
-}
-
-static AvahiCacheEntry *lookup_record(AvahiCache *c, AvahiRecord *r) {
- assert(c);
- assert(r);
-
- return avahi_cache_walk(c, r->key, lookup_record_callback, r);
-}
-
-static void next_expiry(AvahiCache *c, AvahiCacheEntry *e, unsigned percent);
-
-static void elapse_func(AvahiTimeEvent *t, void *userdata) {
- AvahiCacheEntry *e = userdata;
-/* char *txt; */
- unsigned percent = 0;
-
- assert(t);
- assert(e);
-
-/* txt = avahi_record_to_string(e->record); */
-
- switch (e->state) {
-
- case AVAHI_CACHE_EXPIRY_FINAL:
- case AVAHI_CACHE_POOF_FINAL:
- case AVAHI_CACHE_GOODBYE_FINAL:
- case AVAHI_CACHE_REPLACE_FINAL:
-
- remove_entry(e->cache, e);
-
- e = NULL;
-/* avahi_log_debug("Removing entry from cache due to expiration (%s)", txt); */
- break;
-
- case AVAHI_CACHE_VALID:
- case AVAHI_CACHE_POOF:
- e->state = AVAHI_CACHE_EXPIRY1;
- percent = 85;
- break;
-
- case AVAHI_CACHE_EXPIRY1:
- e->state = AVAHI_CACHE_EXPIRY2;
- percent = 90;
- break;
- case AVAHI_CACHE_EXPIRY2:
- e->state = AVAHI_CACHE_EXPIRY3;
- percent = 95;
- break;
-
- case AVAHI_CACHE_EXPIRY3:
- e->state = AVAHI_CACHE_EXPIRY_FINAL;
- percent = 100;
- break;
- }
-
- if (e) {
-
- assert(percent > 0);
-
- /* Request a cache update if we are subscribed to this entry */
- if (avahi_querier_shall_refresh_cache(e->cache->interface, e->record->key))
- avahi_interface_post_query(e->cache->interface, e->record->key, 0, NULL);
-
- /* Check again later */
- next_expiry(e->cache, e, percent);
-
- }
-
-/* avahi_free(txt); */
-}
-
-static void update_time_event(AvahiCache *c, AvahiCacheEntry *e) {
- assert(c);
- assert(e);
-
- if (e->time_event)
- avahi_time_event_update(e->time_event, &e->expiry);
- else
- e->time_event = avahi_time_event_new(c->server->time_event_queue, &e->expiry, elapse_func, e);
-}
-
-static void next_expiry(AvahiCache *c, AvahiCacheEntry *e, unsigned percent) {
- AvahiUsec usec, left, right;
- time_t now;
-
- assert(c);
- assert(e);
- assert(percent > 0 && percent <= 100);
-
- usec = (AvahiUsec) e->record->ttl * 10000;
-
- left = usec * percent;
- right = usec * (percent+2); /* 2% jitter */
-
- now = time(NULL);
-
- if (now >= c->last_rand_timestamp + 10) {
- c->last_rand = rand();
- c->last_rand_timestamp = now;
- }
-
- usec = left + (AvahiUsec) ((double) (right-left) * c->last_rand / (RAND_MAX+1.0));
-
- e->expiry = e->timestamp;
- avahi_timeval_add(&e->expiry, usec);
-
-/* g_message("wake up in +%lu seconds", e->expiry.tv_sec - e->timestamp.tv_sec); */
-
- update_time_event(c, e);
-}
-
-static void expire_in_one_second(AvahiCache *c, AvahiCacheEntry *e, AvahiCacheEntryState state) {
- assert(c);
- assert(e);
-
- e->state = state;
- gettimeofday(&e->expiry, NULL);
- avahi_timeval_add(&e->expiry, 1000000); /* 1s */
- update_time_event(c, e);
-}
-
-void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const AvahiAddress *a) {
-/* char *txt; */
-
- assert(c);
- assert(r && r->ref >= 1);
-
-/* txt = avahi_record_to_string(r); */
-
- if (r->ttl == 0) {
- /* This is a goodbye request */
-
- AvahiCacheEntry *e;
-
- if ((e = lookup_record(c, r)))
- expire_in_one_second(c, e, AVAHI_CACHE_GOODBYE_FINAL);
-
- } else {
- AvahiCacheEntry *e = NULL, *first;
- struct timeval now;
-
- gettimeofday(&now, NULL);
-
- /* This is an update request */
-
- if ((first = lookup_key(c, r->key))) {
-
- if (cache_flush) {
-
- /* For unique entries drop all entries older than one second */
- for (e = first; e; e = e->by_key_next) {
- AvahiUsec t;
-
- t = avahi_timeval_diff(&now, &e->timestamp);
-
- if (t > 1000000)
- expire_in_one_second(c, e, AVAHI_CACHE_REPLACE_FINAL);
- }
- }
-
- /* Look for exactly the same entry */
- for (e = first; e; e = e->by_key_next)
- if (avahi_record_equal_no_ttl(e->record, r))
- break;
- }
-
- if (e) {
-
-/* avahi_log_debug("found matching cache entry"); */
-
- /* We need to update the hash table key if we replace the
- * record */
- if (e->by_key_prev == NULL)
- avahi_hashmap_replace(c->hashmap, r->key, e);
-
- /* Update the record */
- avahi_record_unref(e->record);
- e->record = avahi_record_ref(r);
-
-/* avahi_log_debug("cache: updating %s", txt); */
-
- } else {
- /* No entry found, therefore we create a new one */
-
-/* avahi_log_debug("cache: couldn't find matching cache entry for %s", txt); */
-
- if (c->n_entries >= AVAHI_CACHE_ENTRIES_MAX)
- return;
-
- if (!(e = avahi_new(AvahiCacheEntry, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return;
- }
-
- e->cache = c;
- e->time_event = NULL;
- e->record = avahi_record_ref(r);
-
- /* Append to hash table */
- AVAHI_LLIST_PREPEND(AvahiCacheEntry, by_key, first, e);
- avahi_hashmap_replace(c->hashmap, e->record->key, first);
-
- /* Append to linked list */
- AVAHI_LLIST_PREPEND(AvahiCacheEntry, entry, c->entries, e);
-
- c->n_entries++;
-
- /* Notify subscribers */
- avahi_multicast_lookup_engine_notify(c->server->multicast_lookup_engine, c->interface, e->record, AVAHI_BROWSER_NEW);
- }
-
- e->origin = *a;
- e->timestamp = now;
- next_expiry(c, e, 80);
- e->state = AVAHI_CACHE_VALID;
- e->cache_flush = cache_flush;
- }
-
-/* avahi_free(txt); */
-}
-
-struct dump_data {
- AvahiDumpCallback callback;
- void* userdata;
-};
-
-static void dump_callback(void* key, void* data, void* userdata) {
- AvahiCacheEntry *e = data;
- AvahiKey *k = key;
- struct dump_data *dump_data = userdata;
-
- assert(k);
- assert(e);
- assert(data);
-
- for (; e; e = e->by_key_next) {
- char *t;
-
- if (!(t = avahi_record_to_string(e->record)))
- continue; /* OOM */
-
- dump_data->callback(t, dump_data->userdata);
- avahi_free(t);
- }
-}
-
-int avahi_cache_dump(AvahiCache *c, AvahiDumpCallback callback, void* userdata) {
- struct dump_data data;
-
- assert(c);
- assert(callback);
-
- callback(";;; CACHE DUMP FOLLOWS ;;;", userdata);
-
- data.callback = callback;
- data.userdata = userdata;
-
- avahi_hashmap_foreach(c->hashmap, dump_callback, &data);
-
- return 0;
-}
-
-int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e) {
- struct timeval now;
- unsigned age;
-
- assert(c);
- assert(e);
-
- gettimeofday(&now, NULL);
-
- age = (unsigned) (avahi_timeval_diff(&now, &e->timestamp)/1000000);
-
-/* avahi_log_debug("age: %lli, ttl/2: %u", age, e->record->ttl); */
-
- return age >= e->record->ttl/2;
-}
-
-void avahi_cache_flush(AvahiCache *c) {
- assert(c);
-
- while (c->entries)
- remove_entry(c, c->entries);
-}
-
-/*** Passive observation of failure ***/
-
-static void* start_poof_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void *userdata) {
- AvahiAddress *a = userdata;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(a);
-
- switch (e->state) {
- case AVAHI_CACHE_VALID:
-
- /* The entry was perfectly valid till, now, so let's enter
- * POOF mode */
-
- e->state = AVAHI_CACHE_POOF;
- e->poof_address = *a;
-
- break;
-
- case AVAHI_CACHE_POOF:
-
- /* This is the second time we got no response, so let's
- * fucking remove this entry. */
-
- expire_in_one_second(c, e, AVAHI_CACHE_POOF_FINAL);
- break;
-
- default:
- ;
- }
-
- return NULL;
-}
-
-void avahi_cache_start_poof(AvahiCache *c, AvahiKey *key, const AvahiAddress *a) {
- assert(c);
- assert(key);
-
- avahi_cache_walk(c, key, start_poof_callback, (void*) a);
-}
-
-void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddress *a) {
- AvahiCacheEntry *e;
-
- assert(c);
- assert(record);
- assert(a);
-
- if (!(e = lookup_record(c, record)))
- return;
-
- /* This function is called for each response suppression
- record. If the matching cache entry is in POOF state and the
- query address is the same, we put it back into valid mode */
-
- if (e->state == AVAHI_CACHE_POOF || e->state == AVAHI_CACHE_POOF_FINAL)
- if (avahi_address_cmp(a, &e->poof_address) == 0) {
- e->state = AVAHI_CACHE_VALID;
- next_expiry(c, e, 80);
- }
-}
-
-
-
diff --git a/trunk/avahi-core/cache.h b/trunk/avahi-core/cache.h
deleted file mode 100644
index edf9fa5..0000000
--- a/trunk/avahi-core/cache.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef foocachehfoo
-#define foocachehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiCache AvahiCache;
-
-#include <avahi-common/llist.h>
-#include "prioq.h"
-#include "internal.h"
-#include "timeeventq.h"
-#include "hashmap.h"
-
-typedef enum {
- AVAHI_CACHE_VALID,
- AVAHI_CACHE_EXPIRY1,
- AVAHI_CACHE_EXPIRY2,
- AVAHI_CACHE_EXPIRY3,
- AVAHI_CACHE_EXPIRY_FINAL,
- AVAHI_CACHE_POOF, /* Passive observation of failure */
- AVAHI_CACHE_POOF_FINAL,
- AVAHI_CACHE_GOODBYE_FINAL,
- AVAHI_CACHE_REPLACE_FINAL
-} AvahiCacheEntryState;
-
-typedef struct AvahiCacheEntry AvahiCacheEntry;
-
-struct AvahiCacheEntry {
- AvahiCache *cache;
- AvahiRecord *record;
- struct timeval timestamp;
- struct timeval expiry;
- int cache_flush;
-
- AvahiAddress origin;
-
- AvahiCacheEntryState state;
- AvahiTimeEvent *time_event;
-
- AvahiAddress poof_address;
-
- AVAHI_LLIST_FIELDS(AvahiCacheEntry, by_key);
- AVAHI_LLIST_FIELDS(AvahiCacheEntry, entry);
-};
-
-struct AvahiCache {
- AvahiServer *server;
-
- AvahiInterface *interface;
-
- AvahiHashmap *hashmap;
-
- AVAHI_LLIST_HEAD(AvahiCacheEntry, entries);
-
- unsigned n_entries;
-
- int last_rand;
- time_t last_rand_timestamp;
-};
-
-AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *interface);
-void avahi_cache_free(AvahiCache *c);
-
-void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const AvahiAddress *a);
-
-int avahi_cache_dump(AvahiCache *c, AvahiDumpCallback callback, void* userdata);
-
-typedef void* AvahiCacheWalkCallback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata);
-void* avahi_cache_walk(AvahiCache *c, AvahiKey *pattern, AvahiCacheWalkCallback cb, void* userdata);
-
-int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e);
-
-/** Start the "Passive observation of Failure" algorithm for all
- * records of the specified key. The specified address is */
-void avahi_cache_start_poof(AvahiCache *c, AvahiKey *key, const AvahiAddress *a);
-
-/* Stop a previously started POOF algorithm for a record. (Used for response suppresions records */
-void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddress *a);
-
-void avahi_cache_flush(AvahiCache *c);
-
-#endif
diff --git a/trunk/avahi-core/conformance-test.c b/trunk/avahi-core/conformance-test.c
deleted file mode 100644
index dc3c864..0000000
--- a/trunk/avahi-core/conformance-test.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/alternative.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/publish.h>
-
-static char *name = NULL;
-static AvahiSEntryGroup *group = NULL;
-static int try = 0;
-static AvahiServer *avahi = NULL;
-static const AvahiPoll *poll_api;
-
-static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
- printf("%s\n", text);
-}
-
-static void dump_timeout_callback(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void* userdata) {
- struct timeval tv;
-
- avahi_server_dump(avahi, dump_line, NULL);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_update(timeout, &tv);
-}
-
-static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
-
-static void create_service(const char *t) {
- char *n;
-
- assert(t || name);
-
- n = t ? avahi_strdup(t) : avahi_alternative_service_name(name);
- avahi_free(name);
- name = n;
-
- if (group)
- avahi_s_entry_group_reset(group);
- else
- group = avahi_s_entry_group_new(avahi, entry_group_callback, NULL);
-
- avahi_server_add_service(avahi, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_http._tcp", NULL, NULL, 80, "foo", NULL);
- avahi_s_entry_group_commit(group);
-
- try++;
-}
-
-static void rename_timeout_callback(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
- struct timeval tv;
-
- if (access("flag", F_OK) == 0) {
- create_service("New - Bonjour Service Name");
- return;
- }
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_update(timeout, &tv);
-}
-
-static void entry_group_callback(AVAHI_GCC_UNUSED AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void* userdata) {
- if (state == AVAHI_ENTRY_GROUP_COLLISION)
- create_service(NULL);
- else if (state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
- avahi_log_debug("ESTABLISHED !!!!");
- try = 0;
- }
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("server state: %i", state);
-
- if (state == AVAHI_SERVER_RUNNING) {
- avahi_server_dump(avahi, dump_line, NULL);
- } else if (state == AVAHI_SERVER_COLLISION) {
- char *n;
-
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
- avahi_log_warn("Host name conflict, retrying with <%s>", n);
- avahi_server_set_host_name(s, n);
- avahi_free(n);
-
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- int error;
- AvahiSimplePoll *simple_poll;
- struct timeval tv;
- struct AvahiServerConfig config;
-
- simple_poll = avahi_simple_poll_new();
- poll_api = avahi_simple_poll_get(simple_poll);
-
- avahi_server_config_init(&config);
- config.publish_workstation = 0;
- config.use_ipv6 = 0;
- config.publish_domain = 0;
- config.publish_hinfo = 0;
- avahi = avahi_server_new(poll_api, &config, server_callback, NULL, &error);
- avahi_server_config_free(&config);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_new(poll_api, &tv, dump_timeout_callback, avahi);
-
- avahi_elapse_time(&tv, 5000, 0);
- poll_api->timeout_new(poll_api, &tv, rename_timeout_callback, avahi);
-
- /* Evil, but the conformace test requires that*/
- create_service("gurke");
-
-
- avahi_simple_poll_loop(simple_poll);
-
- if (group)
- avahi_s_entry_group_free(group);
- avahi_server_free(avahi);
-
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/trunk/avahi-core/core.h b/trunk/avahi-core/core.h
deleted file mode 100644
index e73abd2..0000000
--- a/trunk/avahi-core/core.h
+++ /dev/null
@@ -1,153 +0,0 @@
-#ifndef foocorehfoo
-#define foocorehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file core.h The Avahi Multicast DNS and DNS Service Discovery implementation. */
-
-/** An mDNS responder object */
-typedef struct AvahiServer AvahiServer;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/address.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/watch.h>
-#include <avahi-core/rr.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Maximum number of defined DNS servers for wide area DNS */
-#define AVAHI_WIDE_AREA_SERVERS_MAX 4
-
-/** Prototype for callback functions which are called whenever the state of an AvahiServer object changes */
-typedef void (*AvahiServerCallback) (AvahiServer *s, AvahiServerState state, void* userdata);
-
-/** Stores configuration options for a server instance */
-typedef struct AvahiServerConfig {
- char *host_name; /**< Default host name. If left empty defaults to the result of gethostname(2) of the libc */
- char *domain_name; /**< Default domain name. If left empty defaults to .local */
- int use_ipv4; /**< Enable IPv4 support */
- int use_ipv6; /**< Enable IPv6 support */
- int publish_hinfo; /**< Register a HINFO record for the host containing the local OS and CPU type */
- int publish_addresses; /**< Register A, AAAA and PTR records for all local IP addresses */
- int publish_workstation; /**< Register a _workstation._tcp service */
- int publish_domain; /**< Announce the local domain for browsing */
- int check_response_ttl; /**< If enabled the server ignores all incoming responses with IP TTL != 255. Newer versions of the RFC do no longer contain this check, so it is disabled by default. */
- int use_iff_running; /**< Require IFF_RUNNING on local network interfaces. This is the official way to check for link beat. Unfortunately this doesn't work with all drivers. So bettere leave this off. */
- int enable_reflector; /**< Reflect incoming mDNS traffic to all local networks. This allows mDNS based network browsing beyond ethernet borders */
- int reflect_ipv; /**< if enable_reflector is 1, enable/disable reflecting between IPv4 and IPv6 */
- int add_service_cookie; /**< Add magic service cookie to all locally generated records implicitly */
- int enable_wide_area; /**< Enable wide area support */
- AvahiAddress wide_area_servers[AVAHI_WIDE_AREA_SERVERS_MAX]; /** Unicast DNS server to use for wide area lookup */
- unsigned n_wide_area_servers; /**< Number of servers in wide_area_servers[] */
- int disallow_other_stacks; /**< Make sure that only one mDNS responder is run at the same time on the local machine. If this is enable Avahi will not set SO_REUSADDR on its sockets, effectively preventing other stacks from running on the local machine */
- AvahiStringList *browse_domains; /**< Additional browsing domains */
- int disable_publishing; /**< Disable publishing of any record */
- int allow_point_to_point; /**< Enable publishing on POINTOPOINT interfaces */
-} AvahiServerConfig;
-
-/** Allocate a new mDNS responder object. */
-AvahiServer *avahi_server_new(
- const AvahiPoll *api, /**< The main loop adapter */
- const AvahiServerConfig *sc, /**< If non-NULL a pointer to a configuration structure for the server. The server makes an internal deep copy of this structure, so you may free it using avahi_server_config_done() immediately after calling this function. */
- AvahiServerCallback callback, /**< A callback which is called whenever the state of the server changes */
- void* userdata, /**< An opaque pointer which is passed to the callback function */
- int *error);
-
-/** Free an mDNS responder object */
-void avahi_server_free(AvahiServer* s);
-
-/** Fill in default values for a server configuration structure. If you
- * make use of an AvahiServerConfig structure be sure to initialize
- * it with this function for the sake of upwards library
- * compatibility. This call may allocate strings on the heap. To
- * release this memory make sure to call
- * avahi_server_config_done(). If you want to replace any strings in
- * the structure be sure to free the strings filled in by this
- * function with avahi_free() first and allocate the replacements with
- * g_malloc() (or g_strdup()).*/
-AvahiServerConfig* avahi_server_config_init(
- AvahiServerConfig *c /**< A structure which shall be filled in */ );
-
-/** Make a deep copy of the configuration structure *c to *ret. */
-AvahiServerConfig* avahi_server_config_copy(
- AvahiServerConfig *ret /**< destination */,
- const AvahiServerConfig *c /**< source */);
-
-/** Free the data in a server configuration structure. */
-void avahi_server_config_free(AvahiServerConfig *c);
-
-/** Return the currently chosen domain name of the server object. The
- * return value points to an internally allocated string. Be sure to
- * make a copy of the string before calling any other library
- * functions. */
-const char* avahi_server_get_domain_name(AvahiServer *s);
-
-/** Return the currently chosen host name. The return value points to a internally allocated string. */
-const char* avahi_server_get_host_name(AvahiServer *s);
-
-/** Return the currently chosen host name as a FQDN ("fully qualified
- * domain name", i.e. the concatenation of the host and domain
- * name). The return value points to a internally allocated string. */
-const char* avahi_server_get_host_name_fqdn(AvahiServer *s);
-
-/** Change the host name of a running mDNS responder. This will drop
-all automicatilly generated RRs and readd them with the new
-name. Since the responder has to probe for the new RRs this function
-takes some time to take effect altough it returns immediately. This
-function is intended to be called when a host name conflict is
-reported using AvahiServerCallback. The caller should readd all user
-defined RRs too since they otherwise continue to point to the outdated
-host name..*/
-int avahi_server_set_host_name(AvahiServer *s, const char *host_name);
-
-/** Change the domain name of a running mDNS responder. The same rules
- * as with avahi_server_set_host_name() apply. */
-int avahi_server_set_domain_name(AvahiServer *s, const char *domain_name);
-
-/** Return the opaque user data pointer attached to a server object */
-void* avahi_server_get_data(AvahiServer *s);
-
-/** Change the opaque user data pointer attached to a server object */
-void avahi_server_set_data(AvahiServer *s, void* userdata);
-
-/** Return the current state of the server object */
-AvahiServerState avahi_server_get_state(AvahiServer *s);
-
-/** Callback prototype for avahi_server_dump() */
-typedef void (*AvahiDumpCallback)(const char *text, void* userdata);
-
-/** Dump the current server status by calling "callback" for each line. */
-int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata);
-
-/** Return the last error code */
-int avahi_server_errno(AvahiServer *s);
-
-/** Return the local service cookie */
-uint32_t avahi_server_get_local_service_cookie(AvahiServer *s);
-
-/** Set the wide area DNS servers */
-int avahi_server_set_wide_area_servers(AvahiServer *s, const AvahiAddress *a, unsigned n);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/dns-srv-rr.h b/trunk/avahi-core/dns-srv-rr.h
deleted file mode 100644
index 1a7f95f..0000000
--- a/trunk/avahi-core/dns-srv-rr.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef foodnssrvhfoo
-#define foodnssrvhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file avahi-core/dns-srv-rr.h Functions for announcing and browsing for unicast DNS servers via mDNS */
-
-/** A domain service browser object. Use this to browse for
- * conventional unicast DNS servers which may be used to resolve
- * conventional domain names */
-typedef struct AvahiSDNSServerBrowser AvahiSDNSServerBrowser;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/defs.h>
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** The type of DNS server */
-typedef enum {
- AVAHI_DNS_SERVER_RESOLVE, /**< Unicast DNS servers for normal resolves (_domain._udp)*/
- AVAHI_DNS_SERVER_UPDATE, /**< Unicast DNS servers for updates (_dns-update._udp)*/
- AVAHI_DNS_SERVER_MAX
-} AvahiDNSServerType;
-
-/** Publish the specified unicast DNS server address via mDNS. You may
- * browse for records create this way wit
- * avahi_s_dns_server_browser_new(). */
-int avahi_server_add_dns_server_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *domain,
- AvahiDNSServerType type,
- const AvahiAddress *address,
- uint16_t port /** should be 53 */);
-
-/** Callback prototype for AvahiSDNSServerBrowser events */
-typedef void (*AvahiSDNSServerBrowserCallback)(
- AvahiSDNSServerBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *host_name, /**< Host name of the DNS server, probably useless */
- const AvahiAddress *a, /**< Address of the DNS server */
- uint16_t port, /**< Port number of the DNS servers, probably 53 */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSDNSServerBrowser object */
-AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDNSServerType type,
- AvahiProtocol aprotocol, /**< Address protocol for the DNS server */
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSDNSServerBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSDNSServerBrowser object */
-void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *b);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/dns-test.c b/trunk/avahi-core/dns-test.c
deleted file mode 100644
index ae2343d..0000000
--- a/trunk/avahi-core/dns-test.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/malloc.h>
-
-#include "dns.h"
-#include "log.h"
-#include "util.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- char t[AVAHI_DOMAIN_NAME_MAX], *m;
- const char *a, *b, *c, *d;
- AvahiDnsPacket *p;
- AvahiRecord *r, *r2;
- uint8_t rdata[AVAHI_DNS_RDATA_MAX];
- size_t l;
-
- p = avahi_dns_packet_new(0);
-
- assert(avahi_dns_packet_append_name(p, a = "Ahello.hello.hello.de."));
- assert(avahi_dns_packet_append_name(p, b = "Bthis is a test.hello.de."));
- assert(avahi_dns_packet_append_name(p, c = "Cthis\\.is\\.a\\.test\\.with\\.dots.hello.de."));
- assert(avahi_dns_packet_append_name(p, d = "Dthis\\\\is another test.hello.de."));
-
- avahi_hexdump(AVAHI_DNS_PACKET_DATA(p), p->size);
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(a, t));
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(b, t));
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(c, t));
-
- assert(avahi_dns_packet_consume_name(p, t, sizeof(t)) == 0);
- avahi_log_debug(">%s<", t);
- assert(avahi_domain_equal(d, t));
-
- avahi_dns_packet_free(p);
-
- /* RDATA PARSING AND SERIALIZATION */
-
- /* Create an AvahiRecord with some usful data */
- r = avahi_record_new_full("foobar.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, AVAHI_DEFAULT_TTL);
- assert(r);
- r->data.hinfo.cpu = avahi_strdup("FOO");
- r->data.hinfo.os = avahi_strdup("BAR");
-
- /* Serialize it into a blob */
- assert((l = avahi_rdata_serialize(r, rdata, sizeof(rdata))) != (size_t) -1);
-
- /* Print it */
- avahi_hexdump(rdata, l);
-
- /* Create a new record and fill in the data from the blob */
- r2 = avahi_record_new(r->key, AVAHI_DEFAULT_TTL);
- assert(r2);
- assert(avahi_rdata_parse(r2, rdata, l) >= 0);
-
- /* Compare both versions */
- assert(avahi_record_equal_no_ttl(r, r2));
-
- /* Free the records */
- avahi_record_unref(r);
- avahi_record_unref(r2);
-
- r = avahi_record_new_full("foobar", 77, 77, AVAHI_DEFAULT_TTL);
- assert(r);
-
- assert(r->data.generic.data = avahi_memdup("HALLO", r->data.generic.size = 5));
-
- m = avahi_record_to_string(r);
- assert(m);
-
- avahi_log_debug(">%s<", m);
-
- avahi_free(m);
- avahi_record_unref(r);
-
- return 0;
-}
diff --git a/trunk/avahi-core/dns.c b/trunk/avahi-core/dns.c
deleted file mode 100644
index b31aa20..0000000
--- a/trunk/avahi-core/dns.c
+++ /dev/null
@@ -1,856 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <netinet/in.h>
-
-#include <avahi-common/defs.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-
-#include "dns.h"
-#include "log.h"
-
-AvahiDnsPacket* avahi_dns_packet_new(unsigned mtu) {
- AvahiDnsPacket *p;
- size_t max_size;
-
- if (mtu <= 0)
- max_size = AVAHI_DNS_PACKET_SIZE_MAX;
- else if (mtu >= AVAHI_DNS_PACKET_EXTRA_SIZE)
- max_size = mtu - AVAHI_DNS_PACKET_EXTRA_SIZE;
- else
- max_size = 0;
-
- if (max_size < AVAHI_DNS_PACKET_HEADER_SIZE)
- max_size = AVAHI_DNS_PACKET_HEADER_SIZE;
-
- if (!(p = avahi_malloc(sizeof(AvahiDnsPacket) + max_size)))
- return p;
-
- p->size = p->rindex = AVAHI_DNS_PACKET_HEADER_SIZE;
- p->max_size = max_size;
- p->name_table = NULL;
- p->data = NULL;
-
- memset(AVAHI_DNS_PACKET_DATA(p), 0, p->size);
- return p;
-}
-
-AvahiDnsPacket* avahi_dns_packet_new_query(unsigned mtu) {
- AvahiDnsPacket *p;
-
- if (!(p = avahi_dns_packet_new(mtu)))
- return NULL;
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
- return p;
-}
-
-AvahiDnsPacket* avahi_dns_packet_new_response(unsigned mtu, int aa) {
- AvahiDnsPacket *p;
-
- if (!(p = avahi_dns_packet_new(mtu)))
- return NULL;
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(1, 0, aa, 0, 0, 0, 0, 0, 0, 0));
- return p;
-}
-
-AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int copy_queries, int aa) {
- AvahiDnsPacket *r;
- assert(p);
-
- if (!(r = avahi_dns_packet_new_response(mtu, aa)))
- return NULL;
-
- if (copy_queries) {
- unsigned saved_rindex;
- uint32_t n;
-
- saved_rindex = p->rindex;
- p->rindex = AVAHI_DNS_PACKET_HEADER_SIZE;
-
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); n > 0; n--) {
- AvahiKey *k;
- int unicast_response;
-
- if ((k = avahi_dns_packet_consume_key(p, &unicast_response))) {
- avahi_dns_packet_append_key(r, k, unicast_response);
- avahi_key_unref(k);
- }
- }
-
- p->rindex = saved_rindex;
-
- avahi_dns_packet_set_field(r, AVAHI_DNS_FIELD_QDCOUNT, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT));
- }
-
- avahi_dns_packet_set_field(r, AVAHI_DNS_FIELD_ID, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID));
-
- avahi_dns_packet_set_field(r, AVAHI_DNS_FIELD_FLAGS,
- (avahi_dns_packet_get_field(r, AVAHI_DNS_FIELD_FLAGS) & ~AVAHI_DNS_FLAG_OPCODE) |
- (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_OPCODE));
-
- return r;
-}
-
-
-void avahi_dns_packet_free(AvahiDnsPacket *p) {
- assert(p);
-
- if (p->name_table)
- avahi_hashmap_free(p->name_table);
-
- avahi_free(p);
-}
-
-void avahi_dns_packet_set_field(AvahiDnsPacket *p, unsigned idx, uint16_t v) {
- assert(p);
- assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
-
- ((uint16_t*) AVAHI_DNS_PACKET_DATA(p))[idx] = htons(v);
-}
-
-uint16_t avahi_dns_packet_get_field(AvahiDnsPacket *p, unsigned idx) {
- assert(p);
- assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
-
- return ntohs(((uint16_t*) AVAHI_DNS_PACKET_DATA(p))[idx]);
-}
-
-void avahi_dns_packet_inc_field(AvahiDnsPacket *p, unsigned idx) {
- assert(p);
- assert(idx < AVAHI_DNS_PACKET_HEADER_SIZE);
-
- avahi_dns_packet_set_field(p, idx, avahi_dns_packet_get_field(p, idx) + 1);
-}
-
-uint8_t* avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name) {
- uint8_t *d, *saved_ptr = NULL;
- size_t saved_size;
-
- assert(p);
- assert(name);
-
- saved_size = p->size;
- saved_ptr = avahi_dns_packet_extend(p, 0);
-
- while (*name) {
- uint8_t* prev;
- const char *pname;
- char label[64], *u;
-
- /* Check whether we can compress this name. */
-
- if (p->name_table && (prev = avahi_hashmap_lookup(p->name_table, name))) {
- unsigned idx;
-
- assert(prev >= AVAHI_DNS_PACKET_DATA(p));
- idx = (unsigned) (prev - AVAHI_DNS_PACKET_DATA(p));
-
- assert(idx < p->size);
-
- if (idx < 0x4000) {
- uint8_t *t;
- if (!(t = (uint8_t*) avahi_dns_packet_extend(p, sizeof(uint16_t))))
- return NULL;
-
- t[0] = (uint8_t) ((0xC000 | idx) >> 8);
- t[1] = (uint8_t) idx;
- return saved_ptr;
- }
- }
-
- pname = name;
-
- if (!(avahi_unescape_label(&name, label, sizeof(label))))
- goto fail;
-
- if (!(d = avahi_dns_packet_append_string(p, label)))
- goto fail;
-
- if (!p->name_table)
- /* This works only for normalized domain names */
- p->name_table = avahi_hashmap_new(avahi_string_hash, avahi_string_equal, avahi_free, NULL);
-
- if (!(u = avahi_strdup(pname)))
- avahi_log_error("avahi_strdup() failed.");
- else
- avahi_hashmap_insert(p->name_table, u, d);
- }
-
- if (!(d = avahi_dns_packet_extend(p, 1)))
- goto fail;
-
- *d = 0;
-
- return saved_ptr;
-
-fail:
- p->size = saved_size;
- return NULL;
-}
-
-uint8_t* avahi_dns_packet_append_uint16(AvahiDnsPacket *p, uint16_t v) {
- uint8_t *d;
- assert(p);
-
- if (!(d = avahi_dns_packet_extend(p, sizeof(uint16_t))))
- return NULL;
-
- d[0] = (uint8_t) (v >> 8);
- d[1] = (uint8_t) v;
- return d;
-}
-
-uint8_t *avahi_dns_packet_append_uint32(AvahiDnsPacket *p, uint32_t v) {
- uint8_t *d;
- assert(p);
-
- if (!(d = avahi_dns_packet_extend(p, sizeof(uint32_t))))
- return NULL;
-
- d[0] = (uint8_t) (v >> 24);
- d[1] = (uint8_t) (v >> 16);
- d[2] = (uint8_t) (v >> 8);
- d[3] = (uint8_t) v;
-
- return d;
-}
-
-uint8_t *avahi_dns_packet_append_bytes(AvahiDnsPacket *p, const void *b, size_t l) {
- uint8_t* d;
-
- assert(p);
- assert(b);
- assert(l);
-
- if (!(d = avahi_dns_packet_extend(p, l)))
- return NULL;
-
- memcpy(d, b, l);
- return d;
-}
-
-uint8_t* avahi_dns_packet_append_string(AvahiDnsPacket *p, const char *s) {
- uint8_t* d;
- size_t k;
-
- assert(p);
- assert(s);
-
- if ((k = strlen(s)) >= 255)
- k = 255;
-
- if (!(d = avahi_dns_packet_extend(p, k+1)))
- return NULL;
-
- *d = (uint8_t) k;
- memcpy(d+1, s, k);
-
- return d;
-}
-
-uint8_t *avahi_dns_packet_extend(AvahiDnsPacket *p, size_t l) {
- uint8_t *d;
-
- assert(p);
-
- if (p->size+l > p->max_size)
- return NULL;
-
- d = AVAHI_DNS_PACKET_DATA(p) + p->size;
- p->size += l;
-
- return d;
-}
-
-int avahi_dns_packet_check_valid(AvahiDnsPacket *p) {
- uint16_t flags;
- assert(p);
-
- if (p->size < AVAHI_DNS_PACKET_HEADER_SIZE)
- return -1;
-
- flags = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS);
-
- if (flags & AVAHI_DNS_FLAG_OPCODE)
- return -1;
-
- return 0;
-}
-
-int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *p) {
- uint16_t flags;
- assert(p);
-
- if (avahi_dns_packet_check_valid(p) < 0)
- return -1;
-
- flags = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS);
-
- if (flags & AVAHI_DNS_FLAG_RCODE)
- return -1;
-
- return 0;
-}
-
-int avahi_dns_packet_is_query(AvahiDnsPacket *p) {
- assert(p);
-
- return !(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_QR);
-}
-
-static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_t l) {
- int ret = 0;
- int compressed = 0;
- int first_label = 1;
- unsigned label_ptr;
- int i;
- assert(p && ret_name && l);
-
- for (i = 0; i < AVAHI_DNS_LABELS_MAX; i++) {
- uint8_t n;
-
- if (idx+1 > p->size)
- return -1;
-
- n = AVAHI_DNS_PACKET_DATA(p)[idx];
-
- if (!n) {
- idx++;
- if (!compressed)
- ret++;
-
- if (l < 1)
- return -1;
- *ret_name = 0;
-
- return ret;
-
- } else if (n <= 63) {
- /* Uncompressed label */
- idx++;
- if (!compressed)
- ret++;
-
- if (idx + n > p->size)
- return -1;
-
- if ((size_t) n + 1 > l)
- return -1;
-
- if (!first_label) {
- *(ret_name++) = '.';
- l--;
- } else
- first_label = 0;
-
- if (!(avahi_escape_label((char*) AVAHI_DNS_PACKET_DATA(p) + idx, n, &ret_name, &l)))
- return -1;
-
- idx += n;
-
- if (!compressed)
- ret += n;
- } else if ((n & 0xC0) == 0xC0) {
- /* Compressed label */
-
- if (idx+2 > p->size)
- return -1;
-
- label_ptr = ((unsigned) (AVAHI_DNS_PACKET_DATA(p)[idx] & ~0xC0)) << 8 | AVAHI_DNS_PACKET_DATA(p)[idx+1];
-
- if ((label_ptr < AVAHI_DNS_PACKET_HEADER_SIZE) || (label_ptr >= idx))
- return -1;
-
- idx = label_ptr;
-
- if (!compressed)
- ret += 2;
-
- compressed = 1;
- } else
- return -1;
- }
-}
-
-int avahi_dns_packet_consume_name(AvahiDnsPacket *p, char *ret_name, size_t l) {
- int r;
-
- if ((r = consume_labels(p, p->rindex, ret_name, l)) < 0)
- return -1;
-
- p->rindex += r;
- return 0;
-}
-
-int avahi_dns_packet_consume_uint16(AvahiDnsPacket *p, uint16_t *ret_v) {
- uint8_t *d;
-
- assert(p);
- assert(ret_v);
-
- if (p->rindex + sizeof(uint16_t) > p->size)
- return -1;
-
- d = (uint8_t*) (AVAHI_DNS_PACKET_DATA(p) + p->rindex);
- *ret_v = (d[0] << 8) | d[1];
- p->rindex += sizeof(uint16_t);
-
- return 0;
-}
-
-int avahi_dns_packet_consume_uint32(AvahiDnsPacket *p, uint32_t *ret_v) {
- uint8_t* d;
-
- assert(p);
- assert(ret_v);
-
- if (p->rindex + sizeof(uint32_t) > p->size)
- return -1;
-
- d = (uint8_t*) (AVAHI_DNS_PACKET_DATA(p) + p->rindex);
- *ret_v = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
- p->rindex += sizeof(uint32_t);
-
- return 0;
-}
-
-int avahi_dns_packet_consume_bytes(AvahiDnsPacket *p, void * ret_data, size_t l) {
- assert(p);
- assert(ret_data);
- assert(l > 0);
-
- if (p->rindex + l > p->size)
- return -1;
-
- memcpy(ret_data, AVAHI_DNS_PACKET_DATA(p) + p->rindex, l);
- p->rindex += l;
-
- return 0;
-}
-
-int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t l) {
- size_t k;
-
- assert(p);
- assert(ret_string);
- assert(l > 0);
-
- if (p->rindex >= p->size)
- return -1;
-
- k = AVAHI_DNS_PACKET_DATA(p)[p->rindex];
-
- if (p->rindex+1+k > p->size)
- return -1;
-
- if (l > k+1)
- l = k+1;
-
- memcpy(ret_string, AVAHI_DNS_PACKET_DATA(p)+p->rindex+1, l-1);
- ret_string[l-1] = 0;
-
- p->rindex += 1+k;
-
- return 0;
-}
-
-const void* avahi_dns_packet_get_rptr(AvahiDnsPacket *p) {
- assert(p);
-
- if (p->rindex > p->size)
- return NULL;
-
- return AVAHI_DNS_PACKET_DATA(p) + p->rindex;
-}
-
-int avahi_dns_packet_skip(AvahiDnsPacket *p, size_t length) {
- assert(p);
-
- if (p->rindex + length > p->size)
- return -1;
-
- p->rindex += length;
- return 0;
-}
-
-static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
- char buf[AVAHI_DOMAIN_NAME_MAX];
- const void* start;
-
- assert(p);
- assert(r);
-
- start = avahi_dns_packet_get_rptr(p);
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
-
- if (avahi_dns_packet_consume_name(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.ptr.name = avahi_strdup(buf);
- break;
-
-
- case AVAHI_DNS_TYPE_SRV:
-
- if (avahi_dns_packet_consume_uint16(p, &r->data.srv.priority) < 0 ||
- avahi_dns_packet_consume_uint16(p, &r->data.srv.weight) < 0 ||
- avahi_dns_packet_consume_uint16(p, &r->data.srv.port) < 0 ||
- avahi_dns_packet_consume_name(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.srv.name = avahi_strdup(buf);
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
-
- if (avahi_dns_packet_consume_string(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.hinfo.cpu = avahi_strdup(buf);
-
- if (avahi_dns_packet_consume_string(p, buf, sizeof(buf)) < 0)
- return -1;
-
- r->data.hinfo.os = avahi_strdup(buf);
- break;
-
- case AVAHI_DNS_TYPE_TXT:
-
- if (rdlength > 0) {
- if (avahi_string_list_parse(avahi_dns_packet_get_rptr(p), rdlength, &r->data.txt.string_list) < 0)
- return -1;
-
- if (avahi_dns_packet_skip(p, rdlength) < 0)
- return -1;
- } else
- r->data.txt.string_list = NULL;
-
- break;
-
- case AVAHI_DNS_TYPE_A:
-
-/* avahi_log_debug("A"); */
-
- if (avahi_dns_packet_consume_bytes(p, &r->data.a.address, sizeof(AvahiIPv4Address)) < 0)
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
-
-/* avahi_log_debug("aaaa"); */
-
- if (avahi_dns_packet_consume_bytes(p, &r->data.aaaa.address, sizeof(AvahiIPv6Address)) < 0)
- return -1;
-
- break;
-
- default:
-
-/* avahi_log_debug("generic"); */
-
- if (rdlength > 0) {
-
- r->data.generic.data = avahi_memdup(avahi_dns_packet_get_rptr(p), rdlength);
-
- if (avahi_dns_packet_skip(p, rdlength) < 0)
- return -1;
- }
-
- break;
- }
-
- /* Check if we read enough data */
- if ((const uint8_t*) avahi_dns_packet_get_rptr(p) - (const uint8_t*) start != rdlength)
- return -1;
-
- return 0;
-}
-
-AvahiRecord* avahi_dns_packet_consume_record(AvahiDnsPacket *p, int *ret_cache_flush) {
- char name[AVAHI_DOMAIN_NAME_MAX];
- uint16_t type, class;
- uint32_t ttl;
- uint16_t rdlength;
- AvahiRecord *r = NULL;
-
- assert(p);
-
- if (avahi_dns_packet_consume_name(p, name, sizeof(name)) < 0 ||
- avahi_dns_packet_consume_uint16(p, &type) < 0 ||
- avahi_dns_packet_consume_uint16(p, &class) < 0 ||
- avahi_dns_packet_consume_uint32(p, &ttl) < 0 ||
- avahi_dns_packet_consume_uint16(p, &rdlength) < 0 ||
- p->rindex + rdlength > p->size)
- goto fail;
-
- if (ret_cache_flush)
- *ret_cache_flush = !!(class & AVAHI_DNS_CACHE_FLUSH);
- class &= ~AVAHI_DNS_CACHE_FLUSH;
-
- if (!(r = avahi_record_new_full(name, class, type, ttl)))
- goto fail;
-
- if (parse_rdata(p, r, rdlength) < 0)
- goto fail;
-
- if (!avahi_record_is_valid(r))
- goto fail;
-
- return r;
-
-fail:
- if (r)
- avahi_record_unref(r);
-
- return NULL;
-}
-
-AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_response) {
- char name[256];
- uint16_t type, class;
- AvahiKey *k;
-
- assert(p);
-
- if (avahi_dns_packet_consume_name(p, name, sizeof(name)) < 0 ||
- avahi_dns_packet_consume_uint16(p, &type) < 0 ||
- avahi_dns_packet_consume_uint16(p, &class) < 0)
- return NULL;
-
- if (ret_unicast_response)
- *ret_unicast_response = !!(class & AVAHI_DNS_UNICAST_RESPONSE);
-
- class &= ~AVAHI_DNS_UNICAST_RESPONSE;
-
- if (!(k = avahi_key_new(name, class, type)))
- return NULL;
-
- if (!avahi_key_is_valid(k)) {
- avahi_key_unref(k);
- return NULL;
- }
-
- return k;
-}
-
-uint8_t* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, int unicast_response) {
- uint8_t *t;
- size_t size;
-
- assert(p);
- assert(k);
-
- size = p->size;
-
- if (!(t = avahi_dns_packet_append_name(p, k->name)) ||
- !avahi_dns_packet_append_uint16(p, k->type) ||
- !avahi_dns_packet_append_uint16(p, k->clazz | (unicast_response ? AVAHI_DNS_UNICAST_RESPONSE : 0))) {
- p->size = size;
- return NULL;
- }
-
- return t;
-}
-
-static int append_rdata(AvahiDnsPacket *p, AvahiRecord *r) {
- assert(p);
- assert(r);
-
- switch (r->key->type) {
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
-
- if (!(avahi_dns_packet_append_name(p, r->data.ptr.name)))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_SRV:
-
- if (!avahi_dns_packet_append_uint16(p, r->data.srv.priority) ||
- !avahi_dns_packet_append_uint16(p, r->data.srv.weight) ||
- !avahi_dns_packet_append_uint16(p, r->data.srv.port) ||
- !avahi_dns_packet_append_name(p, r->data.srv.name))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- if (!avahi_dns_packet_append_string(p, r->data.hinfo.cpu) ||
- !avahi_dns_packet_append_string(p, r->data.hinfo.os))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_TXT: {
-
- uint8_t *data;
- size_t n;
-
- n = avahi_string_list_serialize(r->data.txt.string_list, NULL, 0);
-
- if (!(data = avahi_dns_packet_extend(p, n)))
- return -1;
-
- avahi_string_list_serialize(r->data.txt.string_list, data, n);
- break;
- }
-
-
- case AVAHI_DNS_TYPE_A:
-
- if (!avahi_dns_packet_append_bytes(p, &r->data.a.address, sizeof(r->data.a.address)))
- return -1;
-
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
-
- if (!avahi_dns_packet_append_bytes(p, &r->data.aaaa.address, sizeof(r->data.aaaa.address)))
- return -1;
-
- break;
-
- default:
-
- if (r->data.generic.size)
- if (avahi_dns_packet_append_bytes(p, r->data.generic.data, r->data.generic.size))
- return -1;
-
- break;
- }
-
- return 0;
-}
-
-
-uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int cache_flush, unsigned max_ttl) {
- uint8_t *t, *l, *start;
- size_t size;
-
- assert(p);
- assert(r);
-
- size = p->size;
-
- if (!(t = avahi_dns_packet_append_name(p, r->key->name)) ||
- !avahi_dns_packet_append_uint16(p, r->key->type) ||
- !avahi_dns_packet_append_uint16(p, cache_flush ? (r->key->clazz | AVAHI_DNS_CACHE_FLUSH) : (r->key->clazz &~ AVAHI_DNS_CACHE_FLUSH)) ||
- !avahi_dns_packet_append_uint32(p, (max_ttl && r->ttl > max_ttl) ? max_ttl : r->ttl) ||
- !(l = avahi_dns_packet_append_uint16(p, 0)))
- goto fail;
-
- start = avahi_dns_packet_extend(p, 0);
-
- if (append_rdata(p, r) < 0)
- goto fail;
-
- size = avahi_dns_packet_extend(p, 0) - start;
- assert(size <= 0xFFFF);
-
-/* avahi_log_debug("appended %u", size); */
-
- l[0] = (uint8_t) ((uint16_t) size >> 8);
- l[1] = (uint8_t) ((uint16_t) size);
-
- return t;
-
-
-fail:
- p->size = size;
- return NULL;
-}
-
-int avahi_dns_packet_is_empty(AvahiDnsPacket *p) {
- assert(p);
-
- return p->size <= AVAHI_DNS_PACKET_HEADER_SIZE;
-}
-
-size_t avahi_dns_packet_space(AvahiDnsPacket *p) {
- assert(p);
-
- assert(p->size <= p->max_size);
-
- return p->max_size - p->size;
-}
-
-int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size) {
- int ret;
- AvahiDnsPacket p;
-
- assert(record);
- assert(rdata);
-
- p.data = (void*) rdata;
- p.max_size = p.size = size;
- p.rindex = 0;
- p.name_table = NULL;
-
- ret = parse_rdata(&p, record, size);
-
- assert(!p.name_table);
-
- return ret;
-}
-
-size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size) {
- int ret;
- AvahiDnsPacket p;
-
- assert(record);
- assert(rdata);
- assert(max_size > 0);
-
- p.data = (void*) rdata;
- p.max_size = max_size;
- p.size = p.rindex = 0;
- p.name_table = NULL;
-
- ret = append_rdata(&p, record);
-
- if (p.name_table)
- avahi_hashmap_free(p.name_table);
-
- if (ret < 0)
- return (size_t) -1;
-
- return p.size;
-}
diff --git a/trunk/avahi-core/dns.h b/trunk/avahi-core/dns.h
deleted file mode 100644
index d1c06a5..0000000
--- a/trunk/avahi-core/dns.h
+++ /dev/null
@@ -1,112 +0,0 @@
-#ifndef foodnshfoo
-#define foodnshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "rr.h"
-#include "hashmap.h"
-
-#define AVAHI_DNS_PACKET_SIZE_MAX 9000
-#define AVAHI_DNS_PACKET_HEADER_SIZE 12
-#define AVAHI_DNS_PACKET_EXTRA_SIZE 48
-#define AVAHI_DNS_LABELS_MAX 127
-
-typedef struct AvahiDnsPacket {
- size_t size, rindex, max_size;
- AvahiHashmap *name_table; /* for name compression */
- uint8_t *data;
-} AvahiDnsPacket;
-
-#define AVAHI_DNS_PACKET_DATA(p) ((p)->data ? (p)->data : ((uint8_t*) p) + sizeof(AvahiDnsPacket))
-
-AvahiDnsPacket* avahi_dns_packet_new(unsigned mtu);
-AvahiDnsPacket* avahi_dns_packet_new_query(unsigned mtu);
-AvahiDnsPacket* avahi_dns_packet_new_response(unsigned mtu, int aa);
-
-AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int copy_queries, int aa);
-
-void avahi_dns_packet_free(AvahiDnsPacket *p);
-void avahi_dns_packet_set_field(AvahiDnsPacket *p, unsigned idx, uint16_t v);
-uint16_t avahi_dns_packet_get_field(AvahiDnsPacket *p, unsigned idx);
-void avahi_dns_packet_inc_field(AvahiDnsPacket *p, unsigned idx);
-
-uint8_t *avahi_dns_packet_extend(AvahiDnsPacket *p, size_t l);
-
-uint8_t *avahi_dns_packet_append_uint16(AvahiDnsPacket *p, uint16_t v);
-uint8_t *avahi_dns_packet_append_uint32(AvahiDnsPacket *p, uint32_t v);
-uint8_t *avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name);
-uint8_t *avahi_dns_packet_append_bytes(AvahiDnsPacket *p, const void *d, size_t l);
-uint8_t* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, int unicast_response);
-uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int cache_flush, unsigned max_ttl);
-uint8_t* avahi_dns_packet_append_string(AvahiDnsPacket *p, const char *s);
-
-int avahi_dns_packet_is_query(AvahiDnsPacket *p);
-int avahi_dns_packet_check_valid(AvahiDnsPacket *p);
-int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *p);
-
-int avahi_dns_packet_consume_uint16(AvahiDnsPacket *p, uint16_t *ret_v);
-int avahi_dns_packet_consume_uint32(AvahiDnsPacket *p, uint32_t *ret_v);
-int avahi_dns_packet_consume_name(AvahiDnsPacket *p, char *ret_name, size_t l);
-int avahi_dns_packet_consume_bytes(AvahiDnsPacket *p, void* ret_data, size_t l);
-AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_response);
-AvahiRecord* avahi_dns_packet_consume_record(AvahiDnsPacket *p, int *ret_cache_flush);
-int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t l);
-
-const void* avahi_dns_packet_get_rptr(AvahiDnsPacket *p);
-
-int avahi_dns_packet_skip(AvahiDnsPacket *p, size_t length);
-
-int avahi_dns_packet_is_empty(AvahiDnsPacket *p);
-size_t avahi_dns_packet_space(AvahiDnsPacket *p);
-
-#define AVAHI_DNS_FIELD_ID 0
-#define AVAHI_DNS_FIELD_FLAGS 1
-#define AVAHI_DNS_FIELD_QDCOUNT 2
-#define AVAHI_DNS_FIELD_ANCOUNT 3
-#define AVAHI_DNS_FIELD_NSCOUNT 4
-#define AVAHI_DNS_FIELD_ARCOUNT 5
-
-#define AVAHI_DNS_FLAG_QR (1 << 15)
-#define AVAHI_DNS_FLAG_OPCODE (15 << 11)
-#define AVAHI_DNS_FLAG_RCODE (15)
-#define AVAHI_DNS_FLAG_TC (1 << 9)
-#define AVAHI_DNS_FLAG_AA (1 << 10)
-
-#define AVAHI_DNS_FLAGS(qr, opcode, aa, tc, rd, ra, z, ad, cd, rcode) \
- (((uint16_t) !!qr << 15) | \
- ((uint16_t) (opcode & 15) << 11) | \
- ((uint16_t) !!aa << 10) | \
- ((uint16_t) !!tc << 9) | \
- ((uint16_t) !!rd << 8) | \
- ((uint16_t) !!ra << 7) | \
- ((uint16_t) !!ad << 5) | \
- ((uint16_t) !!cd << 4) | \
- ((uint16_t) (rcode & 15)))
-
-#define AVAHI_MDNS_SUFFIX_LOCAL "local"
-#define AVAHI_MDNS_SUFFIX_ADDR_IPV4 "254.169.in-addr.arpa"
-#define AVAHI_MDNS_SUFFIX_ADDR_IPV6 "0.8.e.f.ip6.arpa"
-
-#define AVAHI_DNS_RDATA_MAX 65535
-
-#endif
-
diff --git a/trunk/avahi-core/domain-util.c b/trunk/avahi-core/domain-util.c
deleted file mode 100644
index 3aeba12..0000000
--- a/trunk/avahi-core/domain-util.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/utsname.h>
-#include <stdio.h>
-
-#include <avahi-common/malloc.h>
-
-#include "domain-util.h"
-#include "util.h"
-
-static void strip_bad_chars(char *s) {
- char *p, *d;
-
- s[strcspn(s, ".")] = 0;
-
- for (p = s, d = s; *p; p++)
- if ((*p >= 'a' && *p <= 'z') ||
- (*p >= 'A' && *p <= 'Z') ||
- (*p >= '0' && *p <= '9') ||
- *p == '-')
- *(d++) = *p;
-
- *d = 0;
-}
-
-char *avahi_get_host_name(char *ret_s, size_t size) {
- assert(ret_s);
- assert(size > 0);
-
- if (gethostname(ret_s, size) >= 0) {
- ret_s[size-1] = 0;
- strip_bad_chars(ret_s);
- } else
- *ret_s = 0;
-
- if (*ret_s == 0) {
- struct utsname utsname;
-
- /* No hostname was set, so let's take the OS name */
-
- if (uname(&utsname) >= 0) {
- snprintf(ret_s, size, "%s", utsname.sysname);
- strip_bad_chars(ret_s);
- avahi_strdown(ret_s);
- }
-
- if (*ret_s == 0)
- snprintf(ret_s, size, "unnamed");
- }
-
- if (size >= AVAHI_LABEL_MAX)
- ret_s[AVAHI_LABEL_MAX-1] = 0;
-
- return ret_s;
-}
-
-char *avahi_get_host_name_strdup(void) {
- char t[AVAHI_DOMAIN_NAME_MAX];
-
- if (!(avahi_get_host_name(t, sizeof(t))))
- return NULL;
-
- return avahi_strdup(t);
-}
-
-int avahi_binary_domain_cmp(const char *a, const char *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 0;
-
- for (;;) {
- char ca[AVAHI_LABEL_MAX], cb[AVAHI_LABEL_MAX], *p;
- int r;
-
- p = avahi_unescape_label(&a, ca, sizeof(ca));
- assert(p);
- p = avahi_unescape_label(&b, cb, sizeof(cb));
- assert(p);
-
- if ((r = strcmp(ca, cb)))
- return r;
-
- if (!*a && !*b)
- return 0;
- }
-}
-
-int avahi_domain_ends_with(const char *domain, const char *suffix) {
- assert(domain);
- assert(suffix);
-
- for (;;) {
- char dummy[AVAHI_LABEL_MAX], *r;
-
- if (*domain == 0)
- return 0;
-
- if (avahi_domain_equal(domain, suffix))
- return 1;
-
- r = avahi_unescape_label(&domain, dummy, sizeof(dummy));
- assert(r);
- }
-}
-
diff --git a/trunk/avahi-core/domain-util.h b/trunk/avahi-core/domain-util.h
deleted file mode 100644
index 01233d8..0000000
--- a/trunk/avahi-core/domain-util.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef foodomainutilhfoo
-#define foodomainutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/domain.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Return the local host name. */
-char *avahi_get_host_name(char *ret_s, size_t size);
-
-/** Return the local host name. avahi_free() the result! */
-char *avahi_get_host_name_strdup(void);
-
-/** Do a binary comparison of to specified domain names, return -1, 0, or 1, depending on the order. */
-int avahi_binary_domain_cmp(const char *a, const char *b);
-
-/** Returns 1 if the the end labels of domain are eqal to suffix */
-int avahi_domain_ends_with(const char *domain, const char *suffix);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/entry.c b/trunk/avahi-core/entry.c
deleted file mode 100644
index 9e9c0dd..0000000
--- a/trunk/avahi-core/entry.c
+++ /dev/null
@@ -1,1206 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include <arpa/inet.h>
-
-#include <sys/utsname.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-
-#include "internal.h"
-#include "iface.h"
-#include "socket.h"
-#include "browse.h"
-#include "log.h"
-#include "util.h"
-#include "dns-srv-rr.h"
-#include "rr-util.h"
-#include "domain-util.h"
-
-static void transport_flags_from_domain(AvahiServer *s, AvahiPublishFlags *flags, const char *domain) {
- assert(flags);
- assert(domain);
-
- assert(!((*flags & AVAHI_PUBLISH_USE_MULTICAST) && (*flags & AVAHI_PUBLISH_USE_WIDE_AREA)));
-
- if (*flags & (AVAHI_PUBLISH_USE_MULTICAST|AVAHI_PUBLISH_USE_WIDE_AREA))
- return;
-
- if (!s->wide_area_lookup_engine ||
- !avahi_wide_area_has_servers(s->wide_area_lookup_engine) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_LOCAL) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV4) ||
- avahi_domain_ends_with(domain, AVAHI_MDNS_SUFFIX_ADDR_IPV6))
- *flags |= AVAHI_PUBLISH_USE_MULTICAST;
- else
- *flags |= AVAHI_PUBLISH_USE_WIDE_AREA;
-}
-
-void avahi_entry_free(AvahiServer*s, AvahiEntry *e) {
- AvahiEntry *t;
-
- assert(s);
- assert(e);
-
- avahi_goodbye_entry(s, e, 1, 1);
-
- /* Remove from linked list */
- AVAHI_LLIST_REMOVE(AvahiEntry, entries, s->entries, e);
-
- /* Remove from hash table indexed by name */
- t = avahi_hashmap_lookup(s->entries_by_key, e->record->key);
- AVAHI_LLIST_REMOVE(AvahiEntry, by_key, t, e);
- if (t)
- avahi_hashmap_replace(s->entries_by_key, t->record->key, t);
- else
- avahi_hashmap_remove(s->entries_by_key, e->record->key);
-
- /* Remove from associated group */
- if (e->group)
- AVAHI_LLIST_REMOVE(AvahiEntry, by_group, e->group->entries, e);
-
- avahi_record_unref(e->record);
- avahi_free(e);
-}
-
-void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g) {
- assert(s);
- assert(g);
-
- while (g->entries)
- avahi_entry_free(s, g->entries);
-
- if (g->register_time_event)
- avahi_time_event_free(g->register_time_event);
-
- AVAHI_LLIST_REMOVE(AvahiSEntryGroup, groups, s->groups, g);
- avahi_free(g);
-}
-
-void avahi_cleanup_dead_entries(AvahiServer *s) {
- assert(s);
-
- if (s->need_group_cleanup) {
- AvahiSEntryGroup *g, *next;
-
- for (g = s->groups; g; g = next) {
- next = g->groups_next;
-
- if (g->dead)
- avahi_entry_group_free(s, g);
- }
-
- s->need_group_cleanup = 0;
- }
-
- if (s->need_entry_cleanup) {
- AvahiEntry *e, *next;
-
- for (e = s->entries; e; e = next) {
- next = e->entries_next;
-
- if (e->dead)
- avahi_entry_free(s, e);
- }
-
- s->need_entry_cleanup = 0;
- }
-
- if (s->need_browser_cleanup)
- avahi_browser_cleanup(s);
-}
-
-static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r, AvahiPublishFlags flags) {
- AvahiEntry *e;
-
- assert(s);
- assert(r);
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, r->key); e; e = e->by_key_next) {
- if (e->dead)
- continue;
-
- if (!(flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_UNIQUE))
- continue;
-
- if ((flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) && (e->flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) )
- continue;
-
- if ((interface <= 0 ||
- e->interface <= 0 ||
- e->interface == interface) &&
- (protocol == AVAHI_PROTO_UNSPEC ||
- e->protocol == AVAHI_PROTO_UNSPEC ||
- e->protocol == protocol))
-
- return -1;
- }
-
- return 0;
-}
-
-static AvahiEntry * server_add_internal(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- AvahiRecord *r) {
-
- AvahiEntry *e;
-
- assert(s);
- assert(r);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, s->state != AVAHI_SERVER_FAILURE && s->state != AVAHI_SERVER_INVALID, AVAHI_ERR_BAD_STATE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_FLAGS_VALID(
- flags,
- AVAHI_PUBLISH_NO_ANNOUNCE|
- AVAHI_PUBLISH_NO_PROBE|
- AVAHI_PUBLISH_UNIQUE|
- AVAHI_PUBLISH_ALLOW_MULTIPLE|
- AVAHI_PUBLISH_UPDATE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_is_valid_domain_name(r->key->name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, r->ttl != 0, AVAHI_ERR_INVALID_TTL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !avahi_key_is_pattern(r->key), AVAHI_ERR_IS_PATTERN);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_record_is_valid(r), AVAHI_ERR_INVALID_RECORD);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, r->key->clazz == AVAHI_DNS_CLASS_IN, AVAHI_ERR_INVALID_DNS_CLASS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s,
- (r->key->type != 0) &&
- (r->key->type != AVAHI_DNS_TYPE_ANY) &&
- (r->key->type != AVAHI_DNS_TYPE_OPT) &&
- (r->key->type != AVAHI_DNS_TYPE_TKEY) &&
- (r->key->type != AVAHI_DNS_TYPE_TSIG) &&
- (r->key->type != AVAHI_DNS_TYPE_IXFR) &&
- (r->key->type != AVAHI_DNS_TYPE_AXFR), AVAHI_ERR_INVALID_DNS_TYPE);
-
- transport_flags_from_domain(s, &flags, r->key->name);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !s->config.disable_publishing, AVAHI_ERR_NOT_PERMITTED);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s,
- !g ||
- (g->state != AVAHI_ENTRY_GROUP_ESTABLISHED && g->state != AVAHI_ENTRY_GROUP_REGISTERING) ||
- (flags & AVAHI_PUBLISH_UPDATE), AVAHI_ERR_BAD_STATE);
-
- if (flags & AVAHI_PUBLISH_UPDATE) {
- AvahiRecord *old_record;
- int is_first = 1;
-
- /* Update and existing record */
-
- /* Find the first matching entry */
- for (e = avahi_hashmap_lookup(s->entries_by_key, r->key); e; e = e->by_key_next) {
- if (!e->dead && e->group == g && e->interface == interface && e->protocol == protocol)
- break;
-
- is_first = 0;
- }
-
- /* Hmm, nothing found? */
- if (!e) {
- avahi_server_set_errno(s, AVAHI_ERR_NOT_FOUND);
- return NULL;
- }
-
- /* Update the entry */
- old_record = e->record;
- e->record = avahi_record_ref(r);
- e->flags = flags;
-
- /* Announce our changes when needed */
- if (!avahi_record_equal_no_ttl(old_record, r) && (!g || g->state != AVAHI_ENTRY_GROUP_UNCOMMITED)) {
-
- /* Remove the old entry from all caches, if needed */
- if (!(e->flags & AVAHI_PUBLISH_UNIQUE))
- avahi_goodbye_entry(s, e, 1, 0);
-
- /* Reannounce our updated entry */
- avahi_reannounce_entry(s, e);
- }
-
- /* If we were the first entry in the list, we need to update the key */
- if (is_first)
- avahi_hashmap_replace(s->entries_by_key, e->record->key, e);
-
- avahi_record_unref(old_record);
-
- } else {
- AvahiEntry *t;
-
- /* Add a new record */
-
- if (check_record_conflict(s, interface, protocol, r, flags) < 0) {
- avahi_server_set_errno(s, AVAHI_ERR_COLLISION);
- return NULL;
- }
-
- if (!(e = avahi_new(AvahiEntry, 1))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- e->server = s;
- e->record = avahi_record_ref(r);
- e->group = g;
- e->interface = interface;
- e->protocol = protocol;
- e->flags = flags;
- e->dead = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiAnnouncer, e->announcers);
-
- AVAHI_LLIST_PREPEND(AvahiEntry, entries, s->entries, e);
-
- /* Insert into hash table indexed by name */
- t = avahi_hashmap_lookup(s->entries_by_key, e->record->key);
- AVAHI_LLIST_PREPEND(AvahiEntry, by_key, t, e);
- avahi_hashmap_replace(s->entries_by_key, e->record->key, t);
-
- /* Insert into group list */
- if (g)
- AVAHI_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
-
- avahi_announce_entry(s, e);
- }
-
- return e;
-}
-
-int avahi_server_add(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- AvahiRecord *r) {
-
- if (!server_add_internal(s, g, interface, protocol, flags, r))
- return avahi_server_errno(s);
-
- return AVAHI_OK;
-}
-
-const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, void **state) {
- AvahiEntry **e = (AvahiEntry**) state;
- assert(s);
- assert(e);
-
- if (!*e)
- *e = g ? g->entries : s->entries;
-
- while (*e && (*e)->dead)
- *e = g ? (*e)->by_group_next : (*e)->entries_next;
-
- if (!*e)
- return NULL;
-
- return avahi_record_ref((*e)->record);
-}
-
-int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata) {
- AvahiEntry *e;
-
- assert(s);
- assert(callback);
-
- callback(";;; ZONE DUMP FOLLOWS ;;;", userdata);
-
- for (e = s->entries; e; e = e->entries_next) {
- char *t;
- char ln[256];
-
- if (e->dead)
- continue;
-
- if (!(t = avahi_record_to_string(e->record)))
- return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
- snprintf(ln, sizeof(ln), "%s ; iface=%i proto=%i", t, e->interface, e->protocol);
- avahi_free(t);
-
- callback(ln, userdata);
- }
-
- avahi_dump_caches(s->monitor, callback, userdata);
-
- if (s->wide_area_lookup_engine)
- avahi_wide_area_cache_dump(s->wide_area_lookup_engine, callback, userdata);
- return AVAHI_OK;
-}
-
-static AvahiEntry *server_add_ptr_internal(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- const char *dest) {
-
- AvahiRecord *r;
- AvahiEntry *e;
-
- assert(s);
- assert(dest);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !name || avahi_is_valid_domain_name(name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_is_valid_domain_name(dest), AVAHI_ERR_INVALID_HOST_NAME);
-
- if (!name)
- name = s->host_name_fqdn;
-
- if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR, ttl))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->data.ptr.name = avahi_normalize_name_strdup(dest);
- e = server_add_internal(s, g, interface, protocol, flags, r);
- avahi_record_unref(r);
- return e;
-}
-
-int avahi_server_add_ptr(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- const char *dest) {
-
- AvahiEntry *e;
-
- assert(s);
-
- if (!(e = server_add_ptr_internal(s, g, interface, protocol, flags, ttl, name, dest)))
- return avahi_server_errno(s);
-
- return AVAHI_OK;
-}
-
-int avahi_server_add_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- AvahiAddress *a) {
-
- char n[AVAHI_DOMAIN_NAME_MAX];
- int ret = AVAHI_OK;
- AvahiEntry *entry = NULL, *reverse = NULL;
- AvahiRecord *r;
-
- assert(s);
- assert(a);
-
- AVAHI_CHECK_VALIDITY(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY(s, AVAHI_PROTO_VALID(protocol) && AVAHI_PROTO_VALID(a->proto), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY(s, AVAHI_FLAGS_VALID(flags,
- AVAHI_PUBLISH_NO_REVERSE|
- AVAHI_PUBLISH_NO_ANNOUNCE|
- AVAHI_PUBLISH_NO_PROBE|
- AVAHI_PUBLISH_UPDATE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY(s, !name || avahi_is_valid_fqdn(name), AVAHI_ERR_INVALID_HOST_NAME);
-
- /* Prepare the host naem */
-
- if (!name)
- name = s->host_name_fqdn;
- else {
- AVAHI_ASSERT_TRUE(avahi_normalize_name(name, n, sizeof(n)));
- name = n;
- }
-
- transport_flags_from_domain(s, &flags, name);
- AVAHI_CHECK_VALIDITY(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- /* Create the A/AAAA record */
-
- if (a->proto == AVAHI_PROTO_INET) {
-
- if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto finish;
- }
-
- r->data.a.address = a->data.ipv4;
-
- } else {
- assert(a->proto == AVAHI_PROTO_INET6);
-
- if (!(r = avahi_record_new_full(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto finish;
- }
-
- r->data.aaaa.address = a->data.ipv6;
- }
-
- entry = server_add_internal(s, g, interface, protocol, (flags & ~ AVAHI_PUBLISH_NO_REVERSE) | AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
- avahi_record_unref(r);
-
- if (!entry) {
- ret = avahi_server_errno(s);
- goto finish;
- }
-
- /* Create the reverse lookup entry */
-
- if (!(flags & AVAHI_PUBLISH_NO_REVERSE)) {
- char reverse_n[AVAHI_DOMAIN_NAME_MAX];
- avahi_reverse_lookup_name(a, reverse_n, sizeof(reverse_n));
-
- if (!(reverse = server_add_ptr_internal(s, g, interface, protocol, flags | AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL_HOST_NAME, reverse_n, name))) {
- ret = avahi_server_errno(s);
- goto finish;
- }
- }
-
-finish:
-
- if (ret != AVAHI_OK && !(flags & AVAHI_PUBLISH_UPDATE)) {
- if (entry)
- avahi_entry_free(s, entry);
- if (reverse)
- avahi_entry_free(s, reverse);
- }
-
- return ret;
-}
-
-static AvahiEntry *server_add_txt_strlst_nocopy(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- AvahiStringList *strlst) {
-
- AvahiRecord *r;
- AvahiEntry *e;
-
- assert(s);
-
- if (!(r = avahi_record_new_full(name ? name : s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT, ttl))) {
- avahi_string_list_free(strlst);
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->data.txt.string_list = strlst;
- e = server_add_internal(s, g, interface, protocol, flags, r);
- avahi_record_unref(r);
-
- return e;
-}
-
-static AvahiStringList *add_magic_cookie(
- AvahiServer *s,
- AvahiStringList *strlst) {
-
- assert(s);
-
- if (!s->config.add_service_cookie)
- return strlst;
-
- if (avahi_string_list_find(strlst, AVAHI_SERVICE_COOKIE))
- /* This string list already contains a magic cookie */
- return strlst;
-
- return avahi_string_list_add_printf(strlst, AVAHI_SERVICE_COOKIE"=%u", s->local_service_cookie);
-}
-
-static int server_add_service_strlst_nocopy(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *strlst) {
-
- char ptr_name[AVAHI_DOMAIN_NAME_MAX], svc_name[AVAHI_DOMAIN_NAME_MAX], enum_ptr[AVAHI_DOMAIN_NAME_MAX], *h = NULL;
- AvahiRecord *r = NULL;
- int ret = AVAHI_OK;
- AvahiEntry *srv_entry = NULL, *txt_entry = NULL, *ptr_entry = NULL, *enum_entry = NULL;
-
- assert(s);
- assert(type);
- assert(name);
-
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_FLAGS_VALID(flags,
- AVAHI_PUBLISH_NO_COOKIE|
- AVAHI_PUBLISH_UPDATE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !host || avahi_is_valid_fqdn(host), AVAHI_ERR_INVALID_HOST_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- if (!host)
- host = s->host_name_fqdn;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if (!(h = avahi_normalize_name_strdup(host))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- if ((ret = avahi_service_name_join(svc_name, sizeof(svc_name), name, type, domain)) < 0 ||
- (ret = avahi_service_name_join(ptr_name, sizeof(ptr_name), NULL, type, domain)) < 0 ||
- (ret = avahi_service_name_join(enum_ptr, sizeof(enum_ptr), NULL, "_services._dns-sd._udp", domain)) < 0) {
- avahi_server_set_errno(s, ret);
- goto fail;
- }
-
- /* Add service enumeration PTR record */
-
- if (!(ptr_entry = server_add_ptr_internal(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, ptr_name, svc_name))) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
- /* Add SRV record */
-
- if (!(r = avahi_record_new_full(svc_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- ret = avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- goto fail;
- }
-
- r->data.srv.priority = 0;
- r->data.srv.weight = 0;
- r->data.srv.port = port;
- r->data.srv.name = h;
- h = NULL;
- srv_entry = server_add_internal(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, r);
- avahi_record_unref(r);
-
- if (!srv_entry) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
- /* Add TXT record */
-
- if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
- strlst = add_magic_cookie(s, strlst);
-
- txt_entry = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE, AVAHI_DEFAULT_TTL, svc_name, strlst);
- strlst = NULL;
-
- if (!txt_entry) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
- /* Add service type enumeration record */
-
- if (!(enum_entry = server_add_ptr_internal(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, enum_ptr, ptr_name))) {
- ret = avahi_server_errno(s);
- goto fail;
- }
-
-fail:
- if (ret != AVAHI_OK && !(flags & AVAHI_PUBLISH_UPDATE)) {
- if (srv_entry)
- avahi_entry_free(s, srv_entry);
- if (txt_entry)
- avahi_entry_free(s, txt_entry);
- if (ptr_entry)
- avahi_entry_free(s, ptr_entry);
- if (enum_entry)
- avahi_entry_free(s, enum_entry);
- }
-
- avahi_string_list_free(strlst);
- avahi_free(h);
-
- return ret;
-}
-
-int avahi_server_add_service_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *strlst) {
-
- assert(s);
- assert(type);
- assert(name);
-
- return server_add_service_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, host, port, avahi_string_list_copy(strlst));
-}
-
-int avahi_server_add_service(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- ... ){
-
- va_list va;
- int ret;
-
- va_start(va, port);
- ret = server_add_service_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, host, port, avahi_string_list_new_va(va));
- va_end(va);
-
- return ret;
-}
-
-static int server_update_service_txt_strlst_nocopy(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst) {
-
- char svc_name[AVAHI_DOMAIN_NAME_MAX];
- int ret = AVAHI_OK;
- AvahiEntry *e;
-
- assert(s);
- assert(type);
- assert(name);
-
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_FLAGS_VALID(flags,
- AVAHI_PUBLISH_NO_COOKIE|
- AVAHI_PUBLISH_USE_WIDE_AREA|
- AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if ((ret = avahi_service_name_join(svc_name, sizeof(svc_name), name, type, domain)) < 0) {
- avahi_server_set_errno(s, ret);
- goto fail;
- }
-
- /* Add TXT record */
- if (!(flags & AVAHI_PUBLISH_NO_COOKIE))
- strlst = add_magic_cookie(s, strlst);
-
- e = server_add_txt_strlst_nocopy(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_UPDATE, AVAHI_DEFAULT_TTL, svc_name, strlst);
- strlst = NULL;
-
- if (!e)
- ret = avahi_server_errno(s);
-
-fail:
-
- avahi_string_list_free(strlst);
-
- return ret;
-}
-
-int avahi_server_update_service_txt_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst) {
-
- return server_update_service_txt_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, avahi_string_list_copy(strlst));
-}
-
-/** Update the TXT record for a service with the NULL termonate list of strings */
-int avahi_server_update_service_txt(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- ...) {
-
- va_list va;
- int ret;
-
- va_start(va, domain);
- ret = server_update_service_txt_strlst_nocopy(s, g, interface, protocol, flags, name, type, domain, avahi_string_list_new_va(va));
- va_end(va);
-
- return ret;
-}
-
-int avahi_server_add_service_subtype(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *subtype) {
-
- int ret = AVAHI_OK;
- char svc_name[AVAHI_DOMAIN_NAME_MAX], ptr_name[AVAHI_DOMAIN_NAME_MAX];
-
- assert(name);
- assert(type);
- assert(subtype);
-
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_USE_MULTICAST|AVAHI_PUBLISH_USE_WIDE_AREA), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, avahi_is_valid_service_subtype(subtype), AVAHI_ERR_INVALID_SERVICE_SUBTYPE);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if ((ret = avahi_service_name_join(svc_name, sizeof(svc_name), name, type, domain)) < 0 ||
- (ret = avahi_service_name_join(ptr_name, sizeof(ptr_name), NULL, subtype, domain)) < 0) {
- avahi_server_set_errno(s, ret);
- goto fail;
- }
-
- if ((ret = avahi_server_add_ptr(s, g, interface, protocol, 0, AVAHI_DEFAULT_TTL, ptr_name, svc_name)) < 0)
- goto fail;
-
-fail:
-
- return ret;
-}
-
-static void hexstring(char *s, size_t sl, const void *p, size_t pl) {
- static const char hex[] = "0123456789abcdef";
- int b = 0;
- const uint8_t *k = p;
-
- while (sl > 1 && pl > 0) {
- *(s++) = hex[(b ? *k : *k >> 4) & 0xF];
-
- if (b) {
- k++;
- pl--;
- }
-
- b = !b;
-
- sl--;
- }
-
- if (sl > 0)
- *s = 0;
-}
-
-static AvahiEntry *server_add_dns_server_name(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *domain,
- AvahiDNSServerType type,
- const char *name,
- uint16_t port /** should be 53 */) {
-
- AvahiEntry *e;
- char t[AVAHI_DOMAIN_NAME_MAX], normalized_d[AVAHI_DOMAIN_NAME_MAX], *n;
-
- AvahiRecord *r;
-
- assert(s);
- assert(name);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_USE_WIDE_AREA|AVAHI_PUBLISH_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE, AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, port != 0, AVAHI_ERR_INVALID_PORT);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, avahi_is_valid_fqdn(name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if (!(n = avahi_normalize_name_strdup(name))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- AVAHI_ASSERT_TRUE(avahi_normalize_name(domain, normalized_d, sizeof(normalized_d)));
-
- snprintf(t, sizeof(t), "%s.%s", type == AVAHI_DNS_SERVER_RESOLVE ? "_domain._udp" : "_dns-update._udp", normalized_d);
-
- if (!(r = avahi_record_new_full(t, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV, AVAHI_DEFAULT_TTL_HOST_NAME))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- avahi_free(n);
- return NULL;
- }
-
- r->data.srv.priority = 0;
- r->data.srv.weight = 0;
- r->data.srv.port = port;
- r->data.srv.name = n;
- e = server_add_internal(s, g, interface, protocol, 0, r);
- avahi_record_unref(r);
-
- return e;
-}
-
-int avahi_server_add_dns_server_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *domain,
- AvahiDNSServerType type,
- const AvahiAddress *address,
- uint16_t port /** should be 53 */) {
-
- AvahiRecord *r;
- char n[64], h[64];
- AvahiEntry *a_entry, *s_entry;
-
- assert(s);
- assert(address);
-
- AVAHI_CHECK_VALIDITY(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY(s, AVAHI_PROTO_VALID(protocol) && AVAHI_PROTO_VALID(address->proto), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY(s, AVAHI_FLAGS_VALID(flags, AVAHI_PUBLISH_USE_MULTICAST|AVAHI_PUBLISH_USE_WIDE_AREA), AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY(s, type == AVAHI_DNS_SERVER_UPDATE || type == AVAHI_DNS_SERVER_RESOLVE, AVAHI_ERR_INVALID_FLAGS);
- AVAHI_CHECK_VALIDITY(s, port != 0, AVAHI_ERR_INVALID_PORT);
- AVAHI_CHECK_VALIDITY(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if (!domain)
- domain = s->domain_name;
-
- transport_flags_from_domain(s, &flags, domain);
- AVAHI_CHECK_VALIDITY(s, flags & AVAHI_PUBLISH_USE_MULTICAST, AVAHI_ERR_NOT_SUPPORTED);
-
- if (address->proto == AVAHI_PROTO_INET) {
- hexstring(h, sizeof(h), &address->data, sizeof(AvahiIPv4Address));
- snprintf(n, sizeof(n), "ip-%s.%s", h, domain);
- r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A, AVAHI_DEFAULT_TTL_HOST_NAME);
- r->data.a.address = address->data.ipv4;
- } else {
- hexstring(h, sizeof(h), &address->data, sizeof(AvahiIPv6Address));
- snprintf(n, sizeof(n), "ip6-%s.%s", h, domain);
- r = avahi_record_new_full(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA, AVAHI_DEFAULT_TTL_HOST_NAME);
- r->data.aaaa.address = address->data.ipv6;
- }
-
- if (!r)
- return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
- a_entry = server_add_internal(s, g, interface, protocol, AVAHI_PUBLISH_UNIQUE | AVAHI_PUBLISH_ALLOW_MULTIPLE, r);
- avahi_record_unref(r);
-
- if (!a_entry)
- return avahi_server_errno(s);
-
- if (!(s_entry = server_add_dns_server_name(s, g, interface, protocol, flags, domain, type, n, port))) {
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- avahi_entry_free(s, a_entry);
- return avahi_server_errno(s);
- }
-
- return AVAHI_OK;
-}
-
-void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state) {
- assert(g);
-
- if (g->state == state)
- return;
-
- assert(state <= AVAHI_ENTRY_GROUP_COLLISION);
-
- if (g->state == AVAHI_ENTRY_GROUP_ESTABLISHED) {
-
- /* If the entry group was established for a time longer then
- * 5s, reset the establishment trial counter */
-
- if (avahi_age(&g->established_at) > 5000000)
- g->n_register_try = 0;
- }
-
- if (state == AVAHI_ENTRY_GROUP_ESTABLISHED)
-
- /* If the entry group is now established, remember the time
- * this happened */
-
- gettimeofday(&g->established_at, NULL);
-
- g->state = state;
-
- if (g->callback)
- g->callback(g->server, g, state, g->userdata);
-}
-
-AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallback callback, void* userdata) {
- AvahiSEntryGroup *g;
-
- assert(s);
-
- if (!(g = avahi_new(AvahiSEntryGroup, 1))) {
- avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- g->server = s;
- g->callback = callback;
- g->userdata = userdata;
- g->dead = 0;
- g->state = AVAHI_ENTRY_GROUP_UNCOMMITED;
- g->n_probing = 0;
- g->n_register_try = 0;
- g->register_time_event = NULL;
- g->register_time.tv_sec = 0;
- g->register_time.tv_usec = 0;
- AVAHI_LLIST_HEAD_INIT(AvahiEntry, g->entries);
-
- AVAHI_LLIST_PREPEND(AvahiSEntryGroup, groups, s->groups, g);
- return g;
-}
-
-void avahi_s_entry_group_free(AvahiSEntryGroup *g) {
- AvahiEntry *e;
-
- assert(g);
- assert(g->server);
-
- for (e = g->entries; e; e = e->by_group_next) {
- if (!e->dead) {
- avahi_goodbye_entry(g->server, e, 1, 1);
- e->dead = 1;
- }
- }
-
- if (g->register_time_event) {
- avahi_time_event_free(g->register_time_event);
- g->register_time_event = NULL;
- }
-
- g->dead = 1;
-
- g->server->need_group_cleanup = 1;
- g->server->need_entry_cleanup = 1;
-}
-
-static void entry_group_commit_real(AvahiSEntryGroup *g) {
- assert(g);
-
- gettimeofday(&g->register_time, NULL);
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING);
-
- if (g->dead)
- return;
-
- avahi_announce_group(g->server, g);
- avahi_s_entry_group_check_probed(g, 0);
-}
-
-static void entry_group_register_time_event_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* userdata) {
- AvahiSEntryGroup *g = userdata;
- assert(g);
-
- avahi_time_event_free(g->register_time_event);
- g->register_time_event = NULL;
-
- /* Holdoff time passed, so let's start probing */
- entry_group_commit_real(g);
-}
-
-int avahi_s_entry_group_commit(AvahiSEntryGroup *g) {
- struct timeval now;
-
- assert(g);
- assert(!g->dead);
-
- if (g->state != AVAHI_ENTRY_GROUP_UNCOMMITED && g->state != AVAHI_ENTRY_GROUP_COLLISION)
- return avahi_server_set_errno(g->server, AVAHI_ERR_BAD_STATE);
-
- if (avahi_s_entry_group_is_empty(g))
- return avahi_server_set_errno(g->server, AVAHI_ERR_IS_EMPTY);
-
- g->n_register_try++;
-
- avahi_timeval_add(&g->register_time,
- 1000*(g->n_register_try >= AVAHI_RR_RATE_LIMIT_COUNT ?
- AVAHI_RR_HOLDOFF_MSEC_RATE_LIMIT :
- AVAHI_RR_HOLDOFF_MSEC));
-
- gettimeofday(&now, NULL);
-
- if (avahi_timeval_compare(&g->register_time, &now) <= 0) {
-
- /* Holdoff time passed, so let's start probing */
- entry_group_commit_real(g);
- } else {
-
- /* Holdoff time has not yet passed, so let's wait */
- assert(!g->register_time_event);
- g->register_time_event = avahi_time_event_new(g->server->time_event_queue, &g->register_time, entry_group_register_time_event_callback, g);
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_REGISTERING);
- }
-
- return AVAHI_OK;
-}
-
-void avahi_s_entry_group_reset(AvahiSEntryGroup *g) {
- AvahiEntry *e;
- assert(g);
-
- for (e = g->entries; e; e = e->by_group_next) {
- if (!e->dead) {
- avahi_goodbye_entry(g->server, e, 1, 1);
- e->dead = 1;
- }
- }
- g->server->need_entry_cleanup = 1;
-
- if (g->register_time_event) {
- avahi_time_event_free(g->register_time_event);
- g->register_time_event = NULL;
- }
-
- g->n_probing = 0;
-
- gettimeofday(&g->register_time, NULL);
-
- avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED);
-}
-
-int avahi_entry_is_commited(AvahiEntry *e) {
- assert(e);
- assert(!e->dead);
-
- return !e->group ||
- e->group->state == AVAHI_ENTRY_GROUP_REGISTERING ||
- e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED;
-}
-
-AvahiEntryGroupState avahi_s_entry_group_get_state(AvahiSEntryGroup *g) {
- assert(g);
- assert(!g->dead);
-
- return g->state;
-}
-
-void avahi_s_entry_group_set_data(AvahiSEntryGroup *g, void* userdata) {
- assert(g);
-
- g->userdata = userdata;
-}
-
-void* avahi_s_entry_group_get_data(AvahiSEntryGroup *g) {
- assert(g);
-
- return g->userdata;
-}
-
-int avahi_s_entry_group_is_empty(AvahiSEntryGroup *g) {
- AvahiEntry *e;
- assert(g);
-
- /* Look for an entry that is not dead */
- for (e = g->entries; e; e = e->by_group_next)
- if (!e->dead)
- return 0;
-
- return 1;
-}
diff --git a/trunk/avahi-core/fdutil.c b/trunk/avahi-core/fdutil.c
deleted file mode 100644
index de7b0cf..0000000
--- a/trunk/avahi-core/fdutil.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <assert.h>
-
-#include "fdutil.h"
-
-int avahi_set_cloexec(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFD)) < 0)
- return -1;
-
- if (n & FD_CLOEXEC)
- return 0;
-
- return fcntl(fd, F_SETFD, n|FD_CLOEXEC);
-}
-
-int avahi_set_nonblock(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFL)) < 0)
- return -1;
-
- if (n & O_NONBLOCK)
- return 0;
-
- return fcntl(fd, F_SETFL, n|O_NONBLOCK);
-}
-
-int avahi_wait_for_write(int fd) {
- fd_set fds;
- int r;
-
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
-
- if ((r = select(fd+1, NULL, &fds, NULL, NULL)) < 0)
- return -1;
-
- assert(r > 0);
-
- return 0;
-}
diff --git a/trunk/avahi-core/fdutil.h b/trunk/avahi-core/fdutil.h
deleted file mode 100644
index 047b9bb..0000000
--- a/trunk/avahi-core/fdutil.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef foofdutilhfoo
-#define foofdutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-int avahi_set_cloexec(int fd);
-int avahi_set_nonblock(int fd);
-int avahi_wait_for_write(int fd);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/hashmap-test.c b/trunk/avahi-core/hashmap-test.c
deleted file mode 100644
index 9826d53..0000000
--- a/trunk/avahi-core/hashmap-test.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-
-#include "hashmap.h"
-#include "util.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- unsigned n;
- AvahiHashmap *m;
- const char *t;
-
- m = avahi_hashmap_new(avahi_string_hash, avahi_string_equal, avahi_free, avahi_free);
-
- avahi_hashmap_insert(m, avahi_strdup("bla"), avahi_strdup("#1"));
- avahi_hashmap_insert(m, avahi_strdup("bla2"), avahi_strdup("asdf"));
- avahi_hashmap_insert(m, avahi_strdup("gurke"), avahi_strdup("ffsdf"));
- avahi_hashmap_insert(m, avahi_strdup("blubb"), avahi_strdup("sadfsd"));
- avahi_hashmap_insert(m, avahi_strdup("bla"), avahi_strdup("#2"));
-
- for (n = 0; n < 1000; n ++)
- avahi_hashmap_insert(m, avahi_strdup_printf("key %u", n), avahi_strdup_printf("value %u", n));
-
- printf("%s\n", (const char*) avahi_hashmap_lookup(m, "bla"));
-
- avahi_hashmap_replace(m, avahi_strdup("bla"), avahi_strdup("#3"));
-
- printf("%s\n", (const char*) avahi_hashmap_lookup(m, "bla"));
-
- avahi_hashmap_remove(m, "bla");
-
- t = (const char*) avahi_hashmap_lookup(m, "bla");
- printf("%s\n", t ? t : "(null)");
-
- avahi_hashmap_free(m);
-
- return 0;
-}
diff --git a/trunk/avahi-core/hashmap.c b/trunk/avahi-core/hashmap.c
deleted file mode 100644
index 07bd707..0000000
--- a/trunk/avahi-core/hashmap.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-
-#include "hashmap.h"
-#include "util.h"
-
-#define HASH_MAP_SIZE 123
-
-typedef struct Entry Entry;
-struct Entry {
- AvahiHashmap *hashmap;
- void *key;
- void *value;
-
- AVAHI_LLIST_FIELDS(Entry, bucket);
- AVAHI_LLIST_FIELDS(Entry, entries);
-};
-
-struct AvahiHashmap {
- AvahiHashFunc hash_func;
- AvahiEqualFunc equal_func;
- AvahiFreeFunc key_free_func, value_free_func;
-
- Entry *entries[HASH_MAP_SIZE];
- AVAHI_LLIST_HEAD(Entry, entries_list);
-};
-
-static Entry* entry_get(AvahiHashmap *m, const void *key) {
- unsigned idx;
- Entry *e;
-
- idx = m->hash_func(key) % HASH_MAP_SIZE;
-
- for (e = m->entries[idx]; e; e = e->bucket_next)
- if (m->equal_func(key, e->key))
- return e;
-
- return NULL;
-}
-
-static void entry_free(AvahiHashmap *m, Entry *e, int stolen) {
- unsigned idx;
- assert(m);
- assert(e);
-
- idx = m->hash_func(e->key) % HASH_MAP_SIZE;
-
- AVAHI_LLIST_REMOVE(Entry, bucket, m->entries[idx], e);
- AVAHI_LLIST_REMOVE(Entry, entries, m->entries_list, e);
-
- if (m->key_free_func)
- m->key_free_func(e->key);
- if (m->value_free_func && !stolen)
- m->value_free_func(e->value);
-
- avahi_free(e);
-}
-
-AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_func, AvahiFreeFunc key_free_func, AvahiFreeFunc value_free_func) {
- AvahiHashmap *m;
-
- assert(hash_func);
- assert(equal_func);
-
- if (!(m = avahi_new0(AvahiHashmap, 1)))
- return NULL;
-
- m->hash_func = hash_func;
- m->equal_func = equal_func;
- m->key_free_func = key_free_func;
- m->value_free_func = value_free_func;
-
- AVAHI_LLIST_HEAD_INIT(Entry, m->entries_list);
-
- return m;
-}
-
-void avahi_hashmap_free(AvahiHashmap *m) {
- assert(m);
-
- while (m->entries_list)
- entry_free(m, m->entries_list, 0);
-
- avahi_free(m);
-}
-
-void* avahi_hashmap_lookup(AvahiHashmap *m, const void *key) {
- Entry *e;
-
- assert(m);
-
- if (!(e = entry_get(m, key)))
- return NULL;
-
- return e->value;
-}
-
-int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value) {
- unsigned idx;
- Entry *e;
-
- assert(m);
-
- if ((e = entry_get(m, key))) {
- if (m->key_free_func)
- m->key_free_func(key);
- if (m->value_free_func)
- m->value_free_func(value);
-
- return 1;
- }
-
- if (!(e = avahi_new(Entry, 1)))
- return -1;
-
- e->hashmap = m;
- e->key = key;
- e->value = value;
-
- AVAHI_LLIST_PREPEND(Entry, entries, m->entries_list, e);
-
- idx = m->hash_func(key) % HASH_MAP_SIZE;
- AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
-
- return 0;
-}
-
-
-int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value) {
- unsigned idx;
- Entry *e;
-
- assert(m);
-
- if ((e = entry_get(m, key))) {
- if (m->key_free_func)
- m->key_free_func(e->key);
- if (m->value_free_func)
- m->value_free_func(e->value);
-
- e->key = key;
- e->value = value;
-
- return 1;
- }
-
- if (!(e = avahi_new(Entry, 1)))
- return -1;
-
- e->hashmap = m;
- e->key = key;
- e->value = value;
-
- AVAHI_LLIST_PREPEND(Entry, entries, m->entries_list, e);
-
- idx = m->hash_func(key) % HASH_MAP_SIZE;
- AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
-
- return 0;
-}
-
-void avahi_hashmap_remove(AvahiHashmap *m, const void *key) {
- Entry *e;
-
- assert(m);
-
- if (!(e = entry_get(m, key)))
- return;
-
- entry_free(m, e, 0);
-}
-
-void avahi_hashmap_foreach(AvahiHashmap *m, AvahiHashmapForeachCallback callback, void *userdata) {
- Entry *e, *next;
- assert(m);
- assert(callback);
-
- for (e = m->entries_list; e; e = next) {
- next = e->entries_next;
-
- callback(e->key, e->value, userdata);
- }
-}
-
-unsigned avahi_string_hash(const void *data) {
- const char *p = data;
- unsigned hash = 0;
-
- assert(p);
-
- for (; *p; p++)
- hash = 31 * hash + *p;
-
- return hash;
-}
-
-int avahi_string_equal(const void *a, const void *b) {
- const char *p = a, *q = b;
-
- assert(p);
- assert(q);
-
- return strcmp(p, q) == 0;
-}
-
-unsigned avahi_int_hash(const void *data) {
- const int *i = data;
-
- assert(i);
-
- return (unsigned) *i;
-}
-
-int avahi_int_equal(const void *a, const void *b) {
- const int *_a = a, *_b = b;
-
- assert(_a);
- assert(_b);
-
- return *_a == *_b;
-}
diff --git a/trunk/avahi-core/hashmap.h b/trunk/avahi-core/hashmap.h
deleted file mode 100644
index 120cf30..0000000
--- a/trunk/avahi-core/hashmap.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef foohashmaphfoo
-#define foohashmaphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-typedef struct AvahiHashmap AvahiHashmap;
-
-typedef unsigned (*AvahiHashFunc)(const void *data);
-typedef int (*AvahiEqualFunc)(const void *a, const void *b);
-typedef void (*AvahiFreeFunc)(void *p);
-
-AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_func, AvahiFreeFunc key_free_func, AvahiFreeFunc value_free_func);
-
-void avahi_hashmap_free(AvahiHashmap *m);
-void* avahi_hashmap_lookup(AvahiHashmap *m, const void *key);
-int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value);
-int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value);
-void avahi_hashmap_remove(AvahiHashmap *m, const void *key);
-
-typedef void (*AvahiHashmapForeachCallback)(void *key, void *value, void *userdata);
-
-void avahi_hashmap_foreach(AvahiHashmap *m, AvahiHashmapForeachCallback callback, void *userdata);
-
-unsigned avahi_string_hash(const void *data);
-int avahi_string_equal(const void *a, const void *b);
-
-unsigned avahi_int_hash(const void *data);
-int avahi_int_equal(const void *a, const void *b);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/iface-linux.c b/trunk/avahi-core/iface-linux.c
deleted file mode 100644
index c8ed9e0..0000000
--- a/trunk/avahi-core/iface-linux.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <net/if.h>
-#include <errno.h>
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-
-#include "log.h"
-#include "iface.h"
-#include "iface-linux.h"
-
-#ifndef IFLA_RTA
-#include <linux/if_addr.h>
-#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
-#endif
-
-#ifndef IFA_RTA
-#include <linux/if_addr.h>
-#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))
-#endif
-
-static int netlink_list_items(AvahiNetlink *nl, uint16_t type, unsigned *ret_seq) {
- struct nlmsghdr *n;
- struct rtgenmsg *gen;
- uint8_t req[1024];
-
- /* Issue a wild dump NETLINK request */
-
- memset(&req, 0, sizeof(req));
- n = (struct nlmsghdr*) req;
- n->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
- n->nlmsg_type = type;
- n->nlmsg_flags = NLM_F_ROOT|NLM_F_REQUEST;
- n->nlmsg_pid = 0;
-
- gen = NLMSG_DATA(n);
- memset(gen, 0, sizeof(struct rtgenmsg));
- gen->rtgen_family = AF_UNSPEC;
-
- return avahi_netlink_send(nl, n, ret_seq);
-}
-
-static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdata) {
- AvahiInterfaceMonitor *m = userdata;
-
- /* This routine is called for every RTNETLINK response packet */
-
- assert(m);
- assert(n);
- assert(m->osdep.netlink == nl);
-
- if (n->nlmsg_type == RTM_NEWLINK) {
-
- /* A new interface appeared or an existing one has been modified */
-
- struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
- AvahiHwInterface *hw;
- struct rtattr *a = NULL;
- size_t l;
-
- /* A (superfluous?) sanity check */
- if (ifinfomsg->ifi_family != AF_UNSPEC)
- return;
-
- /* Check whether there already is an AvahiHwInterface object
- * for this link, so that we can update its data. Note that
- * Netlink sends us an RTM_NEWLINK not only when a new
- * interface appears, but when it changes, too */
-
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, ifinfomsg->ifi_index)))
-
- /* No object found, so let's create a new
- * one. avahi_hw_interface_new() will call
- * avahi_interface_new() internally twice for IPv4 and
- * IPv6, so there is no need for us to do that
- * ourselves */
- if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) ifinfomsg->ifi_index)))
- return; /* OOM */
-
- /* Check whether the flags of this interface are OK for us */
- hw->flags_ok =
- (ifinfomsg->ifi_flags & IFF_UP) &&
- (!m->server->config.use_iff_running || (ifinfomsg->ifi_flags & IFF_RUNNING)) &&
- !(ifinfomsg->ifi_flags & IFF_LOOPBACK) &&
- (ifinfomsg->ifi_flags & IFF_MULTICAST) &&
- (m->server->config.allow_point_to_point || !(ifinfomsg->ifi_flags & IFF_POINTOPOINT));
-
- /* Handle interface attributes */
- l = NLMSG_PAYLOAD(n, sizeof(struct ifinfomsg));
- a = IFLA_RTA(ifinfomsg);
-
- while (RTA_OK(a, l)) {
- switch(a->rta_type) {
- case IFLA_IFNAME:
-
- /* Fill in interface name */
- avahi_free(hw->name);
- hw->name = avahi_strndup(RTA_DATA(a), RTA_PAYLOAD(a));
- break;
-
- case IFLA_MTU:
-
- /* Fill in MTU */
- assert(RTA_PAYLOAD(a) == sizeof(unsigned int));
- hw->mtu = *((unsigned int*) RTA_DATA(a));
- break;
-
- case IFLA_ADDRESS:
-
- /* Fill in hardware (MAC) address */
- hw->mac_address_size = RTA_PAYLOAD(a);
- if (hw->mac_address_size > AVAHI_MAC_ADDRESS_MAX)
- hw->mac_address_size = AVAHI_MAC_ADDRESS_MAX;
-
- memcpy(hw->mac_address, RTA_DATA(a), hw->mac_address_size);
- break;
-
- default:
- ;
- }
-
- a = RTA_NEXT(a, l);
- }
-
- /* Check whether this interface is now "relevant" for us. If
- * it is Avahi will start to announce its records on this
- * interface and send out queries for subscribed records on
- * it */
- avahi_hw_interface_check_relevant(hw);
-
- /* Update any associated RRs of this interface. (i.e. the
- * _workstation._tcp record containing the MAC address) */
- avahi_hw_interface_update_rrs(hw, 0);
-
- } else if (n->nlmsg_type == RTM_DELLINK) {
-
- /* An interface has been removed */
-
- struct ifinfomsg *ifinfomsg = NLMSG_DATA(n);
- AvahiHwInterface *hw;
-
- /* A (superfluous?) sanity check */
- if (ifinfomsg->ifi_family != AF_UNSPEC)
- return;
-
- /* Get a reference to our AvahiHwInterface object of this interface */
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) ifinfomsg->ifi_index)))
- return;
-
- /* Free our object */
- avahi_hw_interface_free(hw, 0);
-
- } else if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
-
- /* An address has been added, modified or removed */
-
- struct ifaddrmsg *ifaddrmsg = NLMSG_DATA(n);
- AvahiInterface *i;
- struct rtattr *a = NULL;
- size_t l;
- AvahiAddress raddr;
- int raddr_valid = 0;
-
- /* We are only interested in IPv4 and IPv6 */
- if (ifaddrmsg->ifa_family != AF_INET && ifaddrmsg->ifa_family != AF_INET6)
- return;
-
- /* Try to get a reference to our AvahiInterface object for the
- * interface this address is assigned to. If ther is no object
- * for this interface, we ignore this address. */
- if (!(i = avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifaddrmsg->ifa_index, avahi_af_to_proto(ifaddrmsg->ifa_family))))
- return;
-
- /* Fill in address family for our new address */
- raddr.proto = avahi_af_to_proto(ifaddrmsg->ifa_family);
-
- l = NLMSG_PAYLOAD(n, sizeof(struct ifaddrmsg));
- a = IFA_RTA(ifaddrmsg);
-
- while (RTA_OK(a, l)) {
-
- switch(a->rta_type) {
- case IFA_ADDRESS:
- /* Fill in address data */
-
- if ((raddr.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
- (raddr.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
- return;
-
- memcpy(raddr.data.data, RTA_DATA(a), RTA_PAYLOAD(a));
- raddr_valid = 1;
-
- break;
-
- default:
- ;
- }
-
- a = RTA_NEXT(a, l);
- }
-
- /* If there was no adress attached to this message, let's quit. */
- if (!raddr_valid)
- return;
-
- if (n->nlmsg_type == RTM_NEWADDR) {
- AvahiInterfaceAddress *addr;
-
- /* This address is new or has been modified, so let's get an object for it */
- if (!(addr = avahi_interface_monitor_get_address(m, i, &raddr)))
-
- /* Mmm, no object existing yet, so let's create a new one */
- if (!(addr = avahi_interface_address_new(m, i, &raddr, ifaddrmsg->ifa_prefixlen)))
- return; /* OOM */
-
- /* Update the scope field for the address */
- addr->global_scope = ifaddrmsg->ifa_scope == RT_SCOPE_UNIVERSE || ifaddrmsg->ifa_scope == RT_SCOPE_SITE;
- } else {
- AvahiInterfaceAddress *addr;
- assert(n->nlmsg_type == RTM_DELADDR);
-
- /* Try to get a reference to our AvahiInterfaceAddress object for this address */
- if (!(addr = avahi_interface_monitor_get_address(m, i, &raddr)))
- return;
-
- /* And free it */
- avahi_interface_address_free(addr);
- }
-
- /* Avahi only considers interfaces with at least one address
- * attached relevant. Since we migh have added or removed an
- * address, let's have it check again whether the interface is
- * now relevant */
- avahi_interface_check_relevant(i);
-
- /* Update any associated RRs, like A or AAAA for our new/removed address */
- avahi_interface_update_rrs(i, 0);
-
- } else if (n->nlmsg_type == NLMSG_DONE) {
-
- /* This wild dump request ended, so let's see what we do next */
-
- if (m->osdep.list == LIST_IFACE) {
-
- /* Mmmm, interfaces have been wild dumped already, so
- * let's go on with wild dumping the addresses */
-
- if (netlink_list_items(m->osdep.netlink, RTM_GETADDR, &m->osdep.query_addr_seq) < 0) {
- avahi_log_warn("NETLINK: Failed to list addrs: %s", strerror(errno));
- m->osdep.list = LIST_DONE;
- } else
-
- /* Update state information */
- m->osdep.list = LIST_ADDR;
-
- } else
- /* We're done. Tell avahi_interface_monitor_sync() to finish. */
- m->osdep.list = LIST_DONE;
-
- if (m->osdep.list == LIST_DONE) {
-
- /* Only after this boolean variable has been set, Avahi
- * will start to announce or browse on all interfaces. It
- * is originaly set to 0, which means that relevancy
- * checks and RR updates are disabled during the wild
- * dumps. */
- m->list_complete = 1;
-
- /* So let's check if any interfaces are relevant now */
- avahi_interface_monitor_check_relevant(m);
-
- /* And update all RRs attached to any interface */
- avahi_interface_monitor_update_rrs(m, 0);
-
- /* Tell the user that the wild dump is complete */
- avahi_log_info("Network interface enumeration completed.");
- }
-
- } else if (n->nlmsg_type == NLMSG_ERROR &&
- (n->nlmsg_seq == m->osdep.query_link_seq || n->nlmsg_seq == m->osdep.query_addr_seq)) {
- struct nlmsgerr *e = NLMSG_DATA (n);
-
- /* Some kind of error happened. Let's just tell the user and
- * ignore it otherwise */
-
- if (e->error)
- avahi_log_warn("NETLINK: Failed to browse: %s", strerror(-e->error));
- }
-}
-
-int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
- assert(m);
-
- /* Initialize our own data */
-
- m->osdep.netlink = NULL;
- m->osdep.query_addr_seq = m->osdep.query_link_seq = 0;
-
- /* Create a netlink object for us. It abstracts some things and
- * makes netlink easier to use. It will attach to the main loop
- * for us and call netlink_callback() whenever an event
- * happens. */
- if (!(m->osdep.netlink = avahi_netlink_new(m->server->poll_api, RTMGRP_LINK|RTMGRP_IPV4_IFADDR|RTMGRP_IPV6_IFADDR, netlink_callback, m)))
- goto fail;
-
- /* Set the initial state. */
- m->osdep.list = LIST_IFACE;
-
- /* Start the wild dump for the interfaces */
- if (netlink_list_items(m->osdep.netlink, RTM_GETLINK, &m->osdep.query_link_seq) < 0)
- goto fail;
-
- return 0;
-
-fail:
-
- if (m->osdep.netlink) {
- avahi_netlink_free(m->osdep.netlink);
- m->osdep.netlink = NULL;
- }
-
- return -1;
-}
-
-void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m) {
- assert(m);
-
- if (m->osdep.netlink) {
- avahi_netlink_free(m->osdep.netlink);
- m->osdep.netlink = NULL;
- }
-}
-
-void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
- assert(m);
-
- /* Let's handle netlink events until we are done with wild
- * dumping */
-
- while (!m->list_complete)
- if (!avahi_netlink_work(m->osdep.netlink, 1) == 0)
- break;
-
- /* At this point Avahi knows about all local interfaces and
- * addresses in existance. */
-}
diff --git a/trunk/avahi-core/iface-linux.h b/trunk/avahi-core/iface-linux.h
deleted file mode 100644
index eed648c..0000000
--- a/trunk/avahi-core/iface-linux.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef fooifacelinuxhfoo
-#define fooifacelinuxhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
-
-#include "netlink.h"
-
-struct AvahiInterfaceMonitorOSDep {
- AvahiNetlink *netlink;
-
- unsigned query_addr_seq, query_link_seq;
-
- enum {
- LIST_IFACE,
- LIST_ADDR,
- LIST_DONE
- } list;
-};
-
-
-#endif
diff --git a/trunk/avahi-core/iface-pfroute.c b/trunk/avahi-core/iface-pfroute.c
deleted file mode 100644
index 035e267..0000000
--- a/trunk/avahi-core/iface-pfroute.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/malloc.h>
-
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/param.h>
-#ifdef HAVE_SYS_SYSCTL_H
-#include <sys/sysctl.h>
-#else
-#include <sys/sockio.h>
-#endif
-
-#include <net/route.h>
-#include <net/if.h>
-#include <net/if_dl.h>
-#include <netinet/in.h>
-
-#include "log.h"
-#include "iface.h"
-#include "iface-pfroute.h"
-#include "util.h"
-
-static int bitcount (unsigned int n)
-{
- int count=0 ;
- while (n)
- {
- count++ ;
- n &= (n - 1) ;
- }
- return count ;
-}
-
-static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
-{
- AvahiHwInterface *hw;
- struct if_msghdr *ifm = (struct if_msghdr *)rtm;
- struct sockaddr_dl *sdl = (struct sockaddr_dl *)(ifm + 1);
-
- if (sdl->sdl_family != AF_LINK)
- return;
-
- if (ifm->ifm_addrs == 0 && ifm->ifm_index > 0) {
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) ifm->ifm_index)))
- return;
- avahi_hw_interface_free(hw, 0);
- return;
- }
-
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, ifm->ifm_index)))
- if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) ifm->ifm_index)))
- return; /* OOM */
-
- hw->flags_ok =
- (ifm->ifm_flags & IFF_UP) &&
- (!m->server->config.use_iff_running || (ifm->ifm_flags & IFF_RUNNING)) &&
- !(ifm->ifm_flags & IFF_LOOPBACK) &&
- (ifm->ifm_flags & IFF_MULTICAST) &&
- (m->server->config.allow_point_to_point || !(ifm->ifm_flags & IFF_POINTOPOINT));
-
- avahi_free(hw->name);
- hw->name = avahi_strndup(sdl->sdl_data, sdl->sdl_nlen);
-
- hw->mtu = ifm->ifm_data.ifi_mtu;
-
- hw->mac_address_size = sdl->sdl_alen;
- if (hw->mac_address_size > AVAHI_MAC_ADDRESS_MAX)
- hw->mac_address_size = AVAHI_MAC_ADDRESS_MAX;
-
- memcpy(hw->mac_address, sdl->sdl_data + sdl->sdl_nlen, hw->mac_address_size);
-
-/* { */
-/* char mac[256]; */
-/* avahi_log_debug("======\n name: %s\n index:%d\n mtu:%d\n mac:%s\n flags_ok:%d\n======", */
-/* hw->name, hw->index, */
-/* hw->mtu, */
-/* avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size), */
-/* hw->flags_ok); */
-/* } */
-
- avahi_hw_interface_check_relevant(hw);
- avahi_hw_interface_update_rrs(hw, 0);
-}
-
-#define ROUNDUP(a) \
- ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-#ifdef HAVE_SYS_SYSCTL_H
-#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
-#else
-#define ADVANCE(x, n) (x += ROUNDUP(sizeof(struct sockaddr)))
-#endif
-
-static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
-{
- AvahiInterface *iface;
- AvahiAddress raddr;
- int raddr_valid = 0;
- struct ifa_msghdr *ifam = (struct ifa_msghdr *) rtm;
- char *cp = (char *)(ifam + 1);
- int addrs = ifam->ifam_addrs;
- int i;
- int prefixlen = 0;
- struct sockaddr *sa =NULL;
-
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- if(((struct sockaddr *)cp)->sa_family == AF_UNSPEC)
- ((struct sockaddr *)cp)->sa_family = AF_INET;
-#endif
-
- if(((struct sockaddr *)cp)->sa_family != AF_INET && ((struct sockaddr *)cp)->sa_family != AF_INET6)
- return;
-
- if (!(iface = avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifam->ifam_index, avahi_af_to_proto(((struct sockaddr *)cp)->sa_family))))
- return;
-
- raddr.proto = avahi_af_to_proto(((struct sockaddr *)cp)->sa_family);
-
- for(i = 0; addrs != 0 && i < RTAX_MAX; addrs &= ~(1<<i), i++)
- {
- if (!(addrs & 1<<i))
- continue;
- sa = (struct sockaddr *)cp;
-#ifdef HAVE_SYS_SYSCTL_H
- if (sa->sa_len == 0)
- continue;
-#endif
- switch(sa->sa_family) {
- case AF_INET:
- switch (1<<i) {
- case RTA_NETMASK:
- prefixlen = bitcount((unsigned int)((struct sockaddr_in *)sa)->sin_addr.s_addr);
- break;
- case RTA_IFA:
- memcpy(raddr.data.data, &((struct sockaddr_in *)sa)->sin_addr, sizeof(struct in_addr));
- raddr_valid = 1;
- default:
- break;
- }
- break;
- case AF_INET6:
- switch (1<<i) {
- case RTA_NETMASK:
- prefixlen = bitcount((unsigned int)((struct sockaddr_in6 *)sa)->sin6_addr.s6_addr);
- break;
- case RTA_IFA:
- memcpy(raddr.data.data, &((struct sockaddr_in6 *)sa)->sin6_addr, sizeof(struct in6_addr));
- raddr_valid = 1;
- default:
- break;
- }
- break;
- default:
- break;
- }
-#ifdef SA_SIZE
- cp += SA_SIZE(sa);
-#else
- ADVANCE(cp, sa);
-#endif
- }
-
- if (!raddr_valid)
- return;
-
- if(rtm->rtm_type == RTM_NEWADDR)
- {
- AvahiInterfaceAddress *addriface;
- if (!(addriface = avahi_interface_monitor_get_address(m, iface, &raddr)))
- if (!(addriface = avahi_interface_address_new(m, iface, &raddr, prefixlen)))
- return; /* OOM */
- /* FIXME */
- /* addriface->global_scope = ifaddrmsg->ifa_scope == RT_SCOPE_UNIVERSE || ifaddrmsg->ifa_scope == RT_SCOPE_SITE; */
- addriface->global_scope = 1;
- }
- else
- {
- AvahiInterfaceAddress *addriface;
- assert(rtm->rtm_type == RTM_DELADDR);
- if (!(addriface = avahi_interface_monitor_get_address(m, iface, &raddr)))
- return;
- avahi_interface_address_free(addriface);
- }
-
- avahi_interface_check_relevant(iface);
- avahi_interface_update_rrs(iface, 0);
-}
-
-static void parse_rtmsg(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
-{
- assert(m);
- assert(rtm);
-
- if (rtm->rtm_version != RTM_VERSION) {
- avahi_log_warn("routing message version %d not understood",
- rtm->rtm_version);
- return;
- }
-
- switch (rtm->rtm_type) {
- case RTM_IFINFO:
- rtm_info(rtm,m);
- break;
- case RTM_NEWADDR:
- case RTM_DELADDR:
- rtm_addr(rtm,m);
- break;
- default:
- break;
- }
-}
-
-static void socket_event(AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event,void *userdata) {
- AvahiInterfaceMonitor *m = (AvahiInterfaceMonitor *)userdata;
- AvahiPfRoute *nl = m->osdep.pfroute;
- ssize_t bytes;
- char msg[2048];
-
- assert(m);
- assert(w);
- assert(nl);
- assert(fd == nl->fd);
-
- do {
- if((bytes = recv(nl->fd, msg, 2048, MSG_DONTWAIT)) < 0) {
- if (errno == EAGAIN || errno == EINTR)
- return;
- avahi_log_error(__FILE__": recv() failed: %s", strerror(errno));
- return;
- }
- parse_rtmsg((struct rt_msghdr *)msg, m);
- }
- while (bytes > 0);
-}
-
-int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
- int fd = -1;
- m->osdep.pfroute = NULL;
-
- assert(m);
-
- if ((fd = socket(PF_ROUTE, SOCK_RAW, AF_UNSPEC)) < 0) {
- avahi_log_error(__FILE__": socket(PF_ROUTE): %s", strerror(errno));
- goto fail;
- }
-
- if (!(m->osdep.pfroute = avahi_new(AvahiPfRoute , 1))) {
- avahi_log_error(__FILE__": avahi_new() failed.");
- goto fail;
- }
- m->osdep.pfroute->fd = fd;
-
- if (!(m->osdep.pfroute->watch = m->server->poll_api->watch_new(m->server->poll_api,
- m->osdep.pfroute->fd,
- AVAHI_WATCH_IN,
- socket_event,
- m))) {
- avahi_log_error(__FILE__": Failed to create watch.");
- goto fail;
- }
-
- return 0;
-
-fail:
-
- if (m->osdep.pfroute) {
- if (m->osdep.pfroute->watch)
- m->server->poll_api->watch_free(m->osdep.pfroute->watch);
-
- if (fd >= 0)
- close(fd);
-
- m->osdep.pfroute = NULL;
- }
-
- return -1;
-}
-
-void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m) {
- assert(m);
-
- if (m->osdep.pfroute) {
- if (m->osdep.pfroute->watch)
- m->server->poll_api->watch_free(m->osdep.pfroute->watch);
-
- if (m->osdep.pfroute->fd >= 0)
- close(m->osdep.pfroute->fd);
-
- avahi_free(m->osdep.pfroute);
- m->osdep.pfroute = NULL;
- }
-}
-
-#if defined (SIOCGLIFNUM) && defined(HAVE_STRUCT_LIFCONF) /* Solaris 8 and later; Sol 7? */
-/*
- * I got this function from GNU zsbra
- */
-static int ip6_masklen (struct in6_addr netmask) {
- int len = 0;
- unsigned char val;
- unsigned char *pnt;
-
- pnt = (unsigned char *) & netmask;
-
- while ((*pnt == 0xff) && len < 128) {
- len += 8;
- pnt++;
- }
-
- if (len < 128) {
- val = *pnt;
- while (val) {
- len++;
- val <<= 1;
- }
- }
- return len;
-}
-
-static void if_add_interface(struct lifreq *lifreq, AvahiInterfaceMonitor *m, int fd, int count)
-{
- AvahiHwInterface *hw;
- AvahiAddress addr;
- struct lifreq lifrcopy;
- unsigned int index;
- int flags;
- int mtu;
- int prefixlen;
- AvahiInterfaceAddress *addriface;
- AvahiInterface *iface;
- struct sockaddr_in mask;
- struct sockaddr_in6 mask6;
- char caddr[AVAHI_ADDRESS_STR_MAX];
-
- lifrcopy = *lifreq;
-
- if (ioctl(fd, SIOCGLIFFLAGS, &lifrcopy) < 0) {
- avahi_log_error(__FILE__": ioctl(SIOCGLIFFLAGS) %s", strerror(errno));
- return;
- }
- flags = lifrcopy.lifr_flags;
-
- if (ioctl(fd, SIOCGLIFMTU, &lifrcopy) < 0) {
- avahi_log_error(__FILE__": ioctl(SIOCGLIFMTU) %s", strerror(errno));
- return;
- }
- mtu = lifrcopy.lifr_metric;
-
- if (ioctl(fd, SIOCGLIFADDR, &lifrcopy) < 0) {
- avahi_log_error(__FILE__": ioctl(SIOCGLIFADDR) %s", strerror(errno));
- return;
- }
- addr.proto = avahi_af_to_proto(lifreq->lifr_addr.ss_family);
- if (ioctl(fd, SIOCGLIFNETMASK, &lifrcopy) < 0) {
- avahi_log_error(__FILE__": ioctl(SIOCGLIFNETMASK) %s", strerror(errno));
- return;
- }
- switch (lifreq->lifr_addr.ss_family) {
- case AF_INET:
- memcpy(addr.data.data, &((struct sockaddr_in *)&lifreq->lifr_addr)->sin_addr, sizeof(struct in_addr));
- memcpy(&mask, &((struct sockaddr_in *)&lifrcopy.lifr_addr)->sin_addr, sizeof(struct in_addr));
- prefixlen = bitcount((unsigned int) mask.sin_addr.s_addr);
- break;
- case AF_INET6:
- memcpy(addr.data.data, &((struct sockaddr_in6 *)&lifreq->lifr_addr)->sin6_addr, sizeof(struct in6_addr));
- memcpy(&mask6, &((struct sockaddr_in6 *)&lifrcopy.lifr_addr)->sin6_addr, sizeof(struct in6_addr));
- prefixlen = lifrcopy.lifr_addrlen;
- break;
- default:
- break;
- }
- index = if_nametoindex(lifreq->lifr_name);
-
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, (AvahiIfIndex) index))) {
- if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) index)))
- return; /* OOM */
-
- hw->flags_ok =
- (flags & IFF_UP) &&
- (!m->server->config.use_iff_running || (flags & IFF_RUNNING)) &&
- !(flags & IFF_LOOPBACK) &&
- (flags & IFF_MULTICAST) &&
- (m->server->config.allow_point_to_point || !(flags & IFF_POINTOPOINT));
- hw->name = avahi_strdup(lifreq->lifr_name);
- hw->mtu = mtu;
- /* TODO get mac address */
- }
-
- if (!(iface = avahi_interface_monitor_get_interface(m, (AvahiIfIndex)index, addr.proto)))
- return;
-
- if (!(addriface = avahi_interface_monitor_get_address(m, iface, &addr)))
- if (!(addriface = avahi_interface_address_new(m, iface, &addr, prefixlen)))
- return; /* OOM */
-
- addriface->global_scope = 1;
-
- avahi_hw_interface_check_relevant(hw);
- avahi_hw_interface_update_rrs(hw, 0);
-}
-#endif
-
-void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
-#ifndef HAVE_STRUCT_LIFCONF
- size_t needed;
- int mib[6];
- char *buf, *lim, *next, count = 0;
- struct rt_msghdr *rtm;
-
- assert(m);
-
- retry2:
- mib[0] = CTL_NET;
- mib[1] = PF_ROUTE;
- mib[2] = 0; /* protocol */
- mib[3] = 0; /* wildcard address family */
- mib[4] = NET_RT_IFLIST;
- mib[5] = 0; /* no flags */
- if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
- {
- avahi_log_error("sysctl failed: %s", strerror(errno));
- avahi_log_error("route-sysctl-estimate");
- return;
- }
- if ((buf = avahi_malloc(needed)) == NULL)
- {
- avahi_log_error("malloc failed in avahi_interface_monitor_sync");
- return;
- }
- if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
- avahi_log_warn("sysctl failed: %s", strerror(errno));
- if (errno == ENOMEM && count++ < 10) {
- avahi_log_warn("Routing table grew, retrying");
- sleep(1);
- avahi_free(buf);
- goto retry2;
- }
- }
- lim = buf + needed;
- for (next = buf; next < lim; next += rtm->rtm_msglen) {
- rtm = (struct rt_msghdr *)next;
- parse_rtmsg(rtm, m);
- }
-
- m->list_complete = 1;
- avahi_interface_monitor_check_relevant(m);
- avahi_interface_monitor_update_rrs(m, 0);
- avahi_log_info("Network interface enumeration completed.");
-#elif defined (SIOCGLIFNUM) && defined(HAVE_STRUCT_LIFCONF) /* Solaris 8 and later; Sol 7? */
- int sockfd;
- int ret;
- int n;
- struct lifnum lifn;
- struct lifconf lifc;
- struct lifreq *lifreq;
-
- if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- avahi_log_error(__FILE__": socket(PFROUTE): %s", strerror(errno));
- return;
- }
- lifc.lifc_buf = NULL;
- lifn.lifn_family = AF_UNSPEC;
- lifn.lifn_flags = 0;
- if (ioctl(sockfd, SIOCGLIFNUM, &lifn) < 0) {
- avahi_log_error(__FILE__": ioctl(SIOCGLIFNUM): %s", strerror(errno));
- goto end;
- }
- lifc.lifc_len = lifn.lifn_count * sizeof (struct lifreq);
- if ((lifc.lifc_buf = avahi_malloc(lifc.lifc_len)) == NULL) {
- avahi_log_error("malloc failed in avahi_interface_monitor_sync");
- goto end;
- }
- lifc.lifc_family = NULL;
- lifc.lifc_flags = 0;
- if(ioctl(sockfd, SIOCGLIFCONF, &lifc) < 0) {
- avahi_log_error(__FILE__": ioctl(SIOCGLIFCONF): %s", strerror(errno));
- goto end;
- }
- lifreq = lifc.lifc_req;
-
- for (n = 0; n < lifc.lifc_len; n += sizeof(struct lifreq)) {
- if_add_interface(lifreq, m, sockfd, lifn.lifn_count);
- lifreq++;
- }
- m->list_complete = 1;
- avahi_interface_monitor_check_relevant(m);
- avahi_interface_monitor_update_rrs(m, 0);
-end:
- close(sockfd);
- avahi_free(lifc.lifc_buf);
-
- avahi_log_info("Network interface enumeration completed.");
-#endif
-}
diff --git a/trunk/avahi-core/iface-pfroute.h b/trunk/avahi-core/iface-pfroute.h
deleted file mode 100644
index 34098da..0000000
--- a/trunk/avahi-core/iface-pfroute.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef fooifacepfroutehfoo
-#define fooifacepfroutehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-#include <avahi-common/watch.h>
-
-typedef struct AvahiPfRoute AvahiPfRoute;
-struct AvahiPfRoute {
- int fd;
- AvahiWatch *watch;
- AvahiInterfaceMonitor *m;
-};
-
-typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
-
-struct AvahiInterfaceMonitorOSDep {
- AvahiPfRoute *pfroute;
-};
-
-#endif
diff --git a/trunk/avahi-core/iface.c b/trunk/avahi-core/iface.c
deleted file mode 100644
index 5685618..0000000
--- a/trunk/avahi-core/iface.c
+++ /dev/null
@@ -1,812 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-
-#include "iface.h"
-#include "dns.h"
-#include "socket.h"
-#include "announce.h"
-#include "util.h"
-#include "log.h"
-#include "multicast-lookup.h"
-#include "querier.h"
-
-void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs) {
- AvahiInterfaceMonitor *m;
-
- assert(a);
- m = a->monitor;
-
- if (a->interface->announcing &&
- m->list_complete &&
- avahi_interface_address_is_relevant(a) &&
- !remove_rrs &&
- m->server->config.publish_addresses &&
- (m->server->state == AVAHI_SERVER_RUNNING ||
- m->server->state == AVAHI_SERVER_REGISTERING)) {
-
- /* Fill the entry group */
- if (!a->entry_group)
- a->entry_group = avahi_s_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL);
-
- if (!a->entry_group) /* OOM */
- return;
-
- if (avahi_s_entry_group_is_empty(a->entry_group)) {
- char t[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(t, sizeof(t), &a->address);
-
- avahi_log_info("Registering new address record for %s on %s.", t, a->interface->hardware->name);
-
- if (avahi_server_add_address(m->server, a->entry_group, a->interface->hardware->index, a->interface->protocol, 0, NULL, &a->address) < 0) {
- avahi_log_warn(__FILE__": avahi_server_add_address() failed: %s", avahi_strerror(m->server->error));
- avahi_s_entry_group_free(a->entry_group);
- a->entry_group = NULL;
- return;
- }
-
- avahi_s_entry_group_commit(a->entry_group);
- }
- } else {
-
- /* Clear the entry group */
-
- if (a->entry_group && !avahi_s_entry_group_is_empty(a->entry_group)) {
- char t[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(t, sizeof(t), &a->address);
-
- if (avahi_s_entry_group_get_state(a->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING &&
- m->server->state == AVAHI_SERVER_REGISTERING)
- avahi_server_decrease_host_rr_pending(m->server);
-
- avahi_log_info("Withdrawing address record for %s on %s.", t, a->interface->hardware->name);
-
- avahi_s_entry_group_reset(a->entry_group);
- }
- }
-}
-
-void avahi_interface_update_rrs(AvahiInterface *i, int remove_rrs) {
- AvahiInterfaceAddress *a;
-
- assert(i);
-
- for (a = i->addresses; a; a = a->address_next)
- avahi_interface_address_update_rrs(a, remove_rrs);
-}
-
-void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs) {
- AvahiInterface *i;
- AvahiInterfaceMonitor *m;
-
- assert(hw);
- m = hw->monitor;
-
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- avahi_interface_update_rrs(i, remove_rrs);
-
- if (m->list_complete &&
- !remove_rrs &&
- m->server->config.publish_workstation &&
- (m->server->state == AVAHI_SERVER_RUNNING)) {
-
- if (!hw->entry_group)
- hw->entry_group = avahi_s_entry_group_new(m->server, avahi_host_rr_entry_group_callback, NULL);
-
- if (!hw->entry_group)
- return; /* OOM */
-
- if (avahi_s_entry_group_is_empty(hw->entry_group)) {
- char name[AVAHI_LABEL_MAX], mac[256];
-
- avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size);
- snprintf(name, sizeof(name), "%s [%s]", m->server->host_name, mac);
-
- if (avahi_server_add_service(m->server, hw->entry_group, hw->index, AVAHI_PROTO_UNSPEC, 0, name, "_workstation._tcp", NULL, NULL, 9, NULL) < 0) {
- avahi_log_warn(__FILE__": avahi_server_add_service() failed: %s", avahi_strerror(m->server->error));
- avahi_s_entry_group_free(hw->entry_group);
- hw->entry_group = NULL;
- } else
- avahi_s_entry_group_commit(hw->entry_group);
- }
-
- } else {
-
- if (hw->entry_group && !avahi_s_entry_group_is_empty(hw->entry_group)) {
-
- if (avahi_s_entry_group_get_state(hw->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING)
- avahi_server_decrease_host_rr_pending(m->server);
-
- avahi_s_entry_group_reset(hw->entry_group);
- }
- }
-}
-
-void avahi_interface_monitor_update_rrs(AvahiInterfaceMonitor *m, int remove_rrs) {
- AvahiHwInterface *hw;
-
- assert(m);
-
- for (hw = m->hw_interfaces; hw; hw = hw->hardware_next)
- avahi_hw_interface_update_rrs(hw, remove_rrs);
-}
-
-static int interface_mdns_mcast_join(AvahiInterface *i, int join) {
- char at[AVAHI_ADDRESS_STR_MAX];
- int r;
- assert(i);
-
- if (!!join == !!i->mcast_joined)
- return 0;
-
- if (join) {
- AvahiInterfaceAddress *a;
-
- /* Look if there's an address with global scope */
- for (a = i->addresses; a; a = a->address_next)
- if (a->global_scope)
- break;
-
- /* No address with a global scope has been found, so let's use
- * any. */
- if (!a)
- a = i->addresses;
-
- /* Hmm, there is no address available. */
- if (!a) {
- avahi_log_warn(__FILE__": interface_mdns_mcast_join() called but no local address available.");
- return -1;
- }
-
- i->local_mcast_address = a->address;
- }
-
- avahi_log_info("%s mDNS multicast group on interface %s.%s with address %s.",
- join ? "Joining" : "Leaving",
- i->hardware->name,
- avahi_proto_to_string(i->protocol),
- avahi_address_snprint(at, sizeof(at), &i->local_mcast_address));
-
- if (i->protocol == AVAHI_PROTO_INET6)
- r = avahi_mdns_mcast_join_ipv6(i->monitor->server->fd_ipv6, &i->local_mcast_address.data.ipv6, i->hardware->index, join);
- else {
- assert(i->protocol == AVAHI_PROTO_INET);
-
- r = avahi_mdns_mcast_join_ipv4(i->monitor->server->fd_ipv4, &i->local_mcast_address.data.ipv4, i->hardware->index, join);
- }
-
- if (r < 0)
- i->mcast_joined = 0;
- else
- i->mcast_joined = join;
-
- return 0;
-}
-
-static int interface_mdns_mcast_rejoin(AvahiInterface *i) {
- AvahiInterfaceAddress *a, *usable = NULL, *found = NULL;
- assert(i);
-
- if (!i->mcast_joined)
- return 0;
-
- /* Check whether old address we joined with is still available. If
- * not, rejoin using an other address. */
-
- for (a = i->addresses; a; a = a->address_next) {
- if (a->global_scope && !usable)
- usable = a;
-
- if (avahi_address_cmp(&a->address, &i->local_mcast_address) == 0) {
-
- if (a->global_scope)
- /* No action necessary: the address still exists and
- * has global scope. */
- return 0;
-
- found = a;
- }
- }
-
- if (found && !usable)
- /* No action necessary: the address still exists and no better one has been found */
- return 0;
-
- interface_mdns_mcast_join(i, 0);
- return interface_mdns_mcast_join(i, 1);
-}
-
-void avahi_interface_address_free(AvahiInterfaceAddress *a) {
- assert(a);
- assert(a->interface);
-
- avahi_interface_address_update_rrs(a, 1);
- AVAHI_LLIST_REMOVE(AvahiInterfaceAddress, address, a->interface->addresses, a);
-
- if (a->entry_group)
- avahi_s_entry_group_free(a->entry_group);
-
- interface_mdns_mcast_rejoin(a->interface);
-
- avahi_free(a);
-}
-
-void avahi_interface_free(AvahiInterface *i, int send_goodbye) {
- assert(i);
-
- /* Handle goodbyes and remove announcers */
- avahi_goodbye_interface(i->monitor->server, i, send_goodbye, 1);
- avahi_response_scheduler_force(i->response_scheduler);
- assert(!i->announcers);
-
- if (i->mcast_joined)
- interface_mdns_mcast_join(i, 0);
-
- /* Remove queriers */
- avahi_querier_free_all(i);
- avahi_hashmap_free(i->queriers_by_key);
-
- /* Remove local RRs */
- avahi_interface_update_rrs(i, 1);
-
- while (i->addresses)
- avahi_interface_address_free(i->addresses);
-
- avahi_response_scheduler_free(i->response_scheduler);
- avahi_query_scheduler_free(i->query_scheduler);
- avahi_probe_scheduler_free(i->probe_scheduler);
- avahi_cache_free(i->cache);
-
- AVAHI_LLIST_REMOVE(AvahiInterface, interface, i->monitor->interfaces, i);
- AVAHI_LLIST_REMOVE(AvahiInterface, by_hardware, i->hardware->interfaces, i);
-
- avahi_free(i);
-}
-
-void avahi_hw_interface_free(AvahiHwInterface *hw, int send_goodbye) {
- assert(hw);
-
- avahi_hw_interface_update_rrs(hw, 1);
-
- while (hw->interfaces)
- avahi_interface_free(hw->interfaces, send_goodbye);
-
- if (hw->entry_group)
- avahi_s_entry_group_free(hw->entry_group);
-
- AVAHI_LLIST_REMOVE(AvahiHwInterface, hardware, hw->monitor->hw_interfaces, hw);
- avahi_hashmap_remove(hw->monitor->hashmap, &hw->index);
-
- avahi_free(hw->name);
- avahi_free(hw);
-}
-
-AvahiInterface* avahi_interface_new(AvahiInterfaceMonitor *m, AvahiHwInterface *hw, AvahiProtocol protocol) {
- AvahiInterface *i;
-
- assert(m);
- assert(hw);
- assert(AVAHI_PROTO_VALID(protocol));
-
- if (!(i = avahi_new(AvahiInterface, 1)))
- goto fail; /* OOM */
-
- i->monitor = m;
- i->hardware = hw;
- i->protocol = protocol;
- i->announcing = 0;
- i->mcast_joined = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiInterfaceAddress, i->addresses);
- AVAHI_LLIST_HEAD_INIT(AvahiAnnouncer, i->announcers);
-
- AVAHI_LLIST_HEAD_INIT(AvahiQuerier, i->queriers);
- i->queriers_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL);
-
- i->cache = avahi_cache_new(m->server, i);
- i->response_scheduler = avahi_response_scheduler_new(i);
- i->query_scheduler = avahi_query_scheduler_new(i);
- i->probe_scheduler = avahi_probe_scheduler_new(i);
-
- if (!i->cache || !i->response_scheduler || !i->query_scheduler || !i->probe_scheduler)
- goto fail; /* OOM */
-
- AVAHI_LLIST_PREPEND(AvahiInterface, by_hardware, hw->interfaces, i);
- AVAHI_LLIST_PREPEND(AvahiInterface, interface, m->interfaces, i);
-
- return i;
-
-fail:
-
- if (i) {
- if (i->cache)
- avahi_cache_free(i->cache);
- if (i->response_scheduler)
- avahi_response_scheduler_free(i->response_scheduler);
- if (i->query_scheduler)
- avahi_query_scheduler_free(i->query_scheduler);
- if (i->probe_scheduler)
- avahi_probe_scheduler_free(i->probe_scheduler);
- }
-
- return NULL;
-}
-
-AvahiHwInterface *avahi_hw_interface_new(AvahiInterfaceMonitor *m, AvahiIfIndex idx) {
- AvahiHwInterface *hw;
-
- assert(m);
- assert(AVAHI_IF_VALID(idx));
-
- if (!(hw = avahi_new(AvahiHwInterface, 1)))
- return NULL;
-
- hw->monitor = m;
- hw->name = NULL;
- hw->flags_ok = 0;
- hw->mtu = 1500;
- hw->index = idx;
- hw->mac_address_size = 0;
- hw->entry_group = NULL;
-
- AVAHI_LLIST_HEAD_INIT(AvahiInterface, hw->interfaces);
- AVAHI_LLIST_PREPEND(AvahiHwInterface, hardware, m->hw_interfaces, hw);
-
- avahi_hashmap_insert(m->hashmap, &hw->index, hw);
-
- if (m->server->fd_ipv4 >= 0)
- avahi_interface_new(m, hw, AVAHI_PROTO_INET);
- if (m->server->fd_ipv6 >= 0)
- avahi_interface_new(m, hw, AVAHI_PROTO_INET6);
-
- return hw;
-}
-
-AvahiInterfaceAddress *avahi_interface_address_new(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *addr, unsigned prefix_len) {
- AvahiInterfaceAddress *a;
-
- assert(m);
- assert(i);
-
- if (!(a = avahi_new(AvahiInterfaceAddress, 1)))
- return NULL;
-
- a->interface = i;
- a->monitor = m;
- a->address = *addr;
- a->prefix_len = prefix_len;
- a->global_scope = 0;
- a->entry_group = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiInterfaceAddress, address, i->addresses, a);
-
- return a;
-}
-
-void avahi_interface_check_relevant(AvahiInterface *i) {
- int b;
- AvahiInterfaceMonitor *m;
-
- assert(i);
- m = i->monitor;
-
- b = avahi_interface_is_relevant(i);
-
- if (m->list_complete && b && !i->announcing) {
- avahi_log_info("New relevant interface %s.%s for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol));
-
- interface_mdns_mcast_join(i, 1);
-
- i->announcing = 1;
- avahi_announce_interface(m->server, i);
- avahi_multicast_lookup_engine_new_interface(m->server->multicast_lookup_engine, i);
- } else if (!b && i->announcing) {
- avahi_log_info("Interface %s.%s no longer relevant for mDNS.", i->hardware->name, avahi_proto_to_string(i->protocol));
-
- interface_mdns_mcast_join(i, 0);
-
- avahi_goodbye_interface(m->server, i, 0, 1);
- avahi_querier_free_all(i);
-
- avahi_response_scheduler_clear(i->response_scheduler);
- avahi_query_scheduler_clear(i->query_scheduler);
- avahi_probe_scheduler_clear(i->probe_scheduler);
- avahi_cache_flush(i->cache);
-
- i->announcing = 0;
-
- } else
- interface_mdns_mcast_rejoin(i);
-}
-
-void avahi_hw_interface_check_relevant(AvahiHwInterface *hw) {
- AvahiInterface *i;
-
- assert(hw);
-
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- avahi_interface_check_relevant(i);
-}
-
-void avahi_interface_monitor_check_relevant(AvahiInterfaceMonitor *m) {
- AvahiInterface *i;
-
- assert(m);
-
- for (i = m->interfaces; i; i = i->interface_next)
- avahi_interface_check_relevant(i);
-}
-
-AvahiInterfaceMonitor *avahi_interface_monitor_new(AvahiServer *s) {
- AvahiInterfaceMonitor *m = NULL;
-
- if (!(m = avahi_new0(AvahiInterfaceMonitor, 1)))
- return NULL; /* OOM */
-
- m->server = s;
- m->list_complete = 0;
- m->hashmap = avahi_hashmap_new(avahi_int_hash, avahi_int_equal, NULL, NULL);
-
- AVAHI_LLIST_HEAD_INIT(AvahiInterface, m->interfaces);
- AVAHI_LLIST_HEAD_INIT(AvahiHwInterface, m->hw_interfaces);
-
- if (avahi_interface_monitor_init_osdep(m) < 0)
- goto fail;
-
- return m;
-
-fail:
- avahi_interface_monitor_free(m);
- return NULL;
-}
-
-void avahi_interface_monitor_free(AvahiInterfaceMonitor *m) {
- assert(m);
-
- while (m->hw_interfaces)
- avahi_hw_interface_free(m->hw_interfaces, 1);
-
- assert(!m->interfaces);
-
- avahi_interface_monitor_free_osdep(m);
-
- if (m->hashmap)
- avahi_hashmap_free(m->hashmap);
-
- avahi_free(m);
-}
-
-
-AvahiInterface* avahi_interface_monitor_get_interface(AvahiInterfaceMonitor *m, AvahiIfIndex idx, AvahiProtocol protocol) {
- AvahiHwInterface *hw;
- AvahiInterface *i;
-
- assert(m);
- assert(idx >= 0);
- assert(protocol != AVAHI_PROTO_UNSPEC);
-
- if (!(hw = avahi_interface_monitor_get_hw_interface(m, idx)))
- return NULL;
-
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- if (i->protocol == protocol)
- return i;
-
- return NULL;
-}
-
-AvahiHwInterface* avahi_interface_monitor_get_hw_interface(AvahiInterfaceMonitor *m, AvahiIfIndex idx) {
- assert(m);
- assert(idx > 0);
-
- return avahi_hashmap_lookup(m->hashmap, &idx);
-}
-
-AvahiInterfaceAddress* avahi_interface_monitor_get_address(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *raddr) {
- AvahiInterfaceAddress *ia;
-
- assert(m);
- assert(i);
- assert(raddr);
-
- for (ia = i->addresses; ia; ia = ia->address_next)
- if (avahi_address_cmp(&ia->address, raddr) == 0)
- return ia;
-
- return NULL;
-}
-
-void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port) {
- assert(i);
- assert(p);
-
- if (!avahi_interface_is_relevant(i))
- return;
-
- assert(!a || a->proto == i->protocol);
-
- if (i->protocol == AVAHI_PROTO_INET && i->monitor->server->fd_ipv4 >= 0)
- avahi_send_dns_packet_ipv4(i->monitor->server->fd_ipv4, i->hardware->index, p, i->mcast_joined ? &i->local_mcast_address.data.ipv4 : NULL, a ? &a->data.ipv4 : NULL, port);
- else if (i->protocol == AVAHI_PROTO_INET6 && i->monitor->server->fd_ipv6 >= 0)
- avahi_send_dns_packet_ipv6(i->monitor->server->fd_ipv6, i->hardware->index, p, i->mcast_joined ? &i->local_mcast_address.data.ipv6 : NULL, a ? &a->data.ipv6 : NULL, port);
-}
-
-void avahi_interface_send_packet(AvahiInterface *i, AvahiDnsPacket *p) {
- assert(i);
- assert(p);
-
- avahi_interface_send_packet_unicast(i, p, NULL, 0);
-}
-
-int avahi_interface_post_query(AvahiInterface *i, AvahiKey *key, int immediately, unsigned *ret_id) {
- assert(i);
- assert(key);
-
- if (avahi_interface_is_relevant(i))
- return avahi_query_scheduler_post(i->query_scheduler, key, immediately, ret_id);
-
- return 0;
-}
-
-int avahi_interface_withraw_query(AvahiInterface *i, unsigned id) {
-
- return avahi_query_scheduler_withdraw_by_id(i->query_scheduler, id);
-}
-
-int avahi_interface_post_response(AvahiInterface *i, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately) {
- assert(i);
- assert(record);
-
- if (avahi_interface_is_relevant(i))
- return avahi_response_scheduler_post(i->response_scheduler, record, flush_cache, querier, immediately);
-
- return 0;
-}
-
-int avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *record, int immediately) {
- assert(i);
- assert(record);
-
- if (avahi_interface_is_relevant(i))
- return avahi_probe_scheduler_post(i->probe_scheduler, record, immediately);
-
- return 0;
-}
-
-int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void* userdata) {
- AvahiInterface *i;
- assert(m);
-
- for (i = m->interfaces; i; i = i->interface_next) {
- if (avahi_interface_is_relevant(i)) {
- char ln[256];
- snprintf(ln, sizeof(ln), ";;; INTERFACE %s.%s ;;;", i->hardware->name, avahi_proto_to_string(i->protocol));
- callback(ln, userdata);
- if (avahi_cache_dump(i->cache, callback, userdata) < 0)
- return -1;
- }
- }
-
- return 0;
-}
-
-int avahi_interface_is_relevant(AvahiInterface *i) {
- AvahiInterfaceAddress *a;
- int relevant_address;
-
- assert(i);
-
- relevant_address = 0;
-
- for (a = i->addresses; a; a = a->address_next)
- if (avahi_interface_address_is_relevant(a)) {
- relevant_address = 1;
- break;
- }
-
- return i->hardware->flags_ok && relevant_address;
-}
-
-int avahi_interface_address_is_relevant(AvahiInterfaceAddress *a) {
- AvahiInterfaceAddress *b;
- assert(a);
-
- /* Publish public IP addresses */
- if (a->global_scope)
- return 1;
- else {
-
- /* Publish link local IP addresses if they are the only ones on the link */
- for (b = a->interface->addresses; b; b = b->address_next) {
- if (b == a)
- continue;
-
- if (b->global_scope)
- return 0;
- }
-
- return 1;
- }
-
- return 0;
-}
-
-int avahi_interface_match(AvahiInterface *i, AvahiIfIndex idx, AvahiProtocol protocol) {
- assert(i);
-
- if (idx != AVAHI_IF_UNSPEC && idx != i->hardware->index)
- return 0;
-
- if (protocol != AVAHI_PROTO_UNSPEC && protocol != i->protocol)
- return 0;
-
- return 1;
-}
-
-void avahi_interface_monitor_walk(AvahiInterfaceMonitor *m, AvahiIfIndex interface, AvahiProtocol protocol, AvahiInterfaceMonitorWalkCallback callback, void* userdata) {
- assert(m);
- assert(callback);
-
- if (interface != AVAHI_IF_UNSPEC) {
- if (protocol != AVAHI_PROTO_UNSPEC) {
- AvahiInterface *i;
-
- if ((i = avahi_interface_monitor_get_interface(m, interface, protocol)))
- callback(m, i, userdata);
-
- } else {
- AvahiHwInterface *hw;
- AvahiInterface *i;
-
- if ((hw = avahi_interface_monitor_get_hw_interface(m, interface)))
- for (i = hw->interfaces; i; i = i->by_hardware_next)
- if (avahi_interface_match(i, interface, protocol))
- callback(m, i, userdata);
- }
-
- } else {
- AvahiInterface *i;
-
- for (i = m->interfaces; i; i = i->interface_next)
- if (avahi_interface_match(i, interface, protocol))
- callback(m, i, userdata);
- }
-}
-
-
-int avahi_address_is_local(AvahiInterfaceMonitor *m, const AvahiAddress *a) {
- AvahiInterface *i;
- AvahiInterfaceAddress *ia;
- assert(m);
- assert(a);
-
- for (i = m->interfaces; i; i = i->interface_next)
- for (ia = i->addresses; ia; ia = ia->address_next)
- if (avahi_address_cmp(a, &ia->address) == 0)
- return 1;
-
- return 0;
-}
-
-int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a) {
- AvahiInterfaceAddress *ia;
-
- assert(i);
- assert(a);
-
- if (a->proto != i->protocol)
- return 0;
-
- for (ia = i->addresses; ia; ia = ia->address_next) {
-
- if (a->proto == AVAHI_PROTO_INET) {
- uint32_t m;
-
- m = ~(((uint32_t) -1) >> ia->prefix_len);
-
- if ((ntohl(a->data.ipv4.address) & m) == (ntohl(ia->address.data.ipv4.address) & m))
- return 1;
- } else {
- unsigned j;
- unsigned char pl;
- assert(a->proto == AVAHI_PROTO_INET6);
-
- pl = ia->prefix_len;
-
- for (j = 0; j < 16; j++) {
- uint8_t m;
-
- if (pl == 0)
- return 1;
-
- if (pl >= 8) {
- m = 0xFF;
- pl -= 8;
- } else {
- m = ~(0xFF >> pl);
- pl = 0;
- }
-
- if ((a->data.ipv6.address[j] & m) != (ia->address.data.ipv6.address[j] & m))
- break;
- }
- }
- }
-
- return 0;
-}
-
-int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, const AvahiAddress *a) {
- AvahiInterface *i;
- AvahiInterfaceAddress *j;
-
- assert(m);
- assert(iface != AVAHI_IF_UNSPEC);
- assert(a);
-
- if (!(i = avahi_interface_monitor_get_interface(m, iface, a->proto)))
- return 0;
-
- for (j = i->addresses; j; j = j->address_next)
- if (avahi_address_cmp(a, &j->address) == 0)
- return 1;
-
- return 0;
-}
-
-AvahiIfIndex avahi_find_interface_for_address(AvahiInterfaceMonitor *m, const AvahiAddress *a) {
- AvahiInterface *i;
- assert(m);
-
- /* Some stupid OS don't support passing the interface index when a
- * packet is recieved. We have to work around that limitation by
- * looking for an interface that has the incoming address
- * attached. This is sometimes ambiguous, but we have to live with
- * it. */
-
- for (i = m->interfaces; i; i = i->interface_next) {
- AvahiInterfaceAddress *ai;
-
- if (i->protocol != a->proto)
- continue;
-
- for (ai = i->addresses; ai; ai = ai->address_next)
- if (avahi_address_cmp(a, &ai->address) == 0)
- return i->hardware->index;
- }
-
- return AVAHI_IF_UNSPEC;
-}
diff --git a/trunk/avahi-core/iface.h b/trunk/avahi-core/iface.h
deleted file mode 100644
index 4106ea7..0000000
--- a/trunk/avahi-core/iface.h
+++ /dev/null
@@ -1,192 +0,0 @@
-#ifndef fooifacehfoo
-#define fooifacehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiInterfaceMonitor AvahiInterfaceMonitor;
-typedef struct AvahiInterfaceAddress AvahiInterfaceAddress;
-typedef struct AvahiInterface AvahiInterface;
-typedef struct AvahiHwInterface AvahiHwInterface;
-
-#include <avahi-common/llist.h>
-#include <avahi-common/address.h>
-
-#include "internal.h"
-#include "cache.h"
-#include "response-sched.h"
-#include "query-sched.h"
-#include "probe-sched.h"
-#include "dns.h"
-#include "announce.h"
-#include "browse.h"
-#include "querier.h"
-
-#ifdef HAVE_NETLINK
-#include "iface-linux.h"
-#elif defined(HAVE_PF_ROUTE)
-#include "iface-pfroute.h"
-#else
-typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
-struct AvahiInterfaceMonitorOSDep {
-
- unsigned query_addr_seq, query_link_seq;
-
- enum {
- LIST_IFACE,
- LIST_ADDR,
- LIST_DONE
- } list;
-};
-#endif
-
-#define AVAHI_MAC_ADDRESS_MAX 32
-
-struct AvahiInterfaceMonitor {
- AvahiServer *server;
- AvahiHashmap *hashmap;
-
- AVAHI_LLIST_HEAD(AvahiInterface, interfaces);
- AVAHI_LLIST_HEAD(AvahiHwInterface, hw_interfaces);
-
- int list_complete;
- AvahiInterfaceMonitorOSDep osdep;
-};
-
-struct AvahiHwInterface {
- AvahiInterfaceMonitor *monitor;
-
- AVAHI_LLIST_FIELDS(AvahiHwInterface, hardware);
-
- char *name;
- AvahiIfIndex index;
- int flags_ok;
-
- unsigned mtu;
-
- uint8_t mac_address[AVAHI_MAC_ADDRESS_MAX];
- size_t mac_address_size;
-
- AvahiSEntryGroup *entry_group;
-
- AVAHI_LLIST_HEAD(AvahiInterface, interfaces);
-};
-
-struct AvahiInterface {
- AvahiInterfaceMonitor *monitor;
- AvahiHwInterface *hardware;
-
- AVAHI_LLIST_FIELDS(AvahiInterface, interface);
- AVAHI_LLIST_FIELDS(AvahiInterface, by_hardware);
-
- AvahiProtocol protocol;
- int announcing;
- AvahiAddress local_mcast_address;
- int mcast_joined;
-
- AvahiCache *cache;
-
- AvahiQueryScheduler *query_scheduler;
- AvahiResponseScheduler * response_scheduler;
- AvahiProbeScheduler *probe_scheduler;
-
- AVAHI_LLIST_HEAD(AvahiInterfaceAddress, addresses);
- AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
-
- AvahiHashmap *queriers_by_key;
- AVAHI_LLIST_HEAD(AvahiQuerier, queriers);
-};
-
-struct AvahiInterfaceAddress {
- AvahiInterfaceMonitor *monitor;
- AvahiInterface *interface;
-
- AVAHI_LLIST_FIELDS(AvahiInterfaceAddress, address);
-
- AvahiAddress address;
- unsigned prefix_len;
-
- int global_scope;
-
- AvahiSEntryGroup *entry_group;
-};
-
-AvahiInterfaceMonitor *avahi_interface_monitor_new(AvahiServer *server);
-void avahi_interface_monitor_free(AvahiInterfaceMonitor *m);
-
-int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m);
-void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m);
-void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m);
-
-typedef void (*AvahiInterfaceMonitorWalkCallback)(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata);
-void avahi_interface_monitor_walk(AvahiInterfaceMonitor *m, AvahiIfIndex idx, AvahiProtocol protocol, AvahiInterfaceMonitorWalkCallback callback, void* userdata);
-int avahi_dump_caches(AvahiInterfaceMonitor *m, AvahiDumpCallback callback, void* userdata);
-
-void avahi_interface_monitor_update_rrs(AvahiInterfaceMonitor *m, int remove_rrs);
-int avahi_address_is_local(AvahiInterfaceMonitor *m, const AvahiAddress *a);
-void avahi_interface_monitor_check_relevant(AvahiInterfaceMonitor *m);
-
-/* AvahiHwInterface */
-
-AvahiHwInterface *avahi_hw_interface_new(AvahiInterfaceMonitor *m, AvahiIfIndex idx);
-void avahi_hw_interface_free(AvahiHwInterface *hw, int send_goodbye);
-
-void avahi_hw_interface_update_rrs(AvahiHwInterface *hw, int remove_rrs);
-void avahi_hw_interface_check_relevant(AvahiHwInterface *hw);
-
-AvahiHwInterface* avahi_interface_monitor_get_hw_interface(AvahiInterfaceMonitor *m, int idx);
-
-/* AvahiInterface */
-
-AvahiInterface* avahi_interface_new(AvahiInterfaceMonitor *m, AvahiHwInterface *hw, AvahiProtocol protocol);
-void avahi_interface_free(AvahiInterface *i, int send_goodbye);
-
-void avahi_interface_update_rrs(AvahiInterface *i, int remove_rrs);
-void avahi_interface_check_relevant(AvahiInterface *i);
-int avahi_interface_is_relevant(AvahiInterface *i);
-
-void avahi_interface_send_packet(AvahiInterface *i, AvahiDnsPacket *p);
-void avahi_interface_send_packet_unicast(AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port);
-
-int avahi_interface_post_query(AvahiInterface *i, AvahiKey *k, int immediately, unsigned *ret_id);
-int avahi_interface_withraw_query(AvahiInterface *i, unsigned id);
-int avahi_interface_post_response(AvahiInterface *i, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately);
-int avahi_interface_post_probe(AvahiInterface *i, AvahiRecord *p, int immediately);
-
-int avahi_interface_match(AvahiInterface *i, AvahiIfIndex idx, AvahiProtocol protocol);
-int avahi_interface_address_on_link(AvahiInterface *i, const AvahiAddress *a);
-int avahi_interface_has_address(AvahiInterfaceMonitor *m, AvahiIfIndex iface, const AvahiAddress *a);
-
-AvahiInterface* avahi_interface_monitor_get_interface(AvahiInterfaceMonitor *m, AvahiIfIndex idx, AvahiProtocol protocol);
-
-/* AvahiInterfaceAddress */
-
-AvahiInterfaceAddress *avahi_interface_address_new(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *addr, unsigned prefix_len);
-void avahi_interface_address_free(AvahiInterfaceAddress *a);
-
-void avahi_interface_address_update_rrs(AvahiInterfaceAddress *a, int remove_rrs);
-int avahi_interface_address_is_relevant(AvahiInterfaceAddress *a);
-
-AvahiInterfaceAddress* avahi_interface_monitor_get_address(AvahiInterfaceMonitor *m, AvahiInterface *i, const AvahiAddress *raddr);
-
-AvahiIfIndex avahi_find_interface_for_address(AvahiInterfaceMonitor *m, const AvahiAddress *a);
-
-#endif
diff --git a/trunk/avahi-core/internal.h b/trunk/avahi-core/internal.h
deleted file mode 100644
index 0d88d5a..0000000
--- a/trunk/avahi-core/internal.h
+++ /dev/null
@@ -1,227 +0,0 @@
-#ifndef foointernalhfoo
-#define foointernalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** A locally registered DNS resource record */
-typedef struct AvahiEntry AvahiEntry;
-
-#include <avahi-common/llist.h>
-#include <avahi-common/watch.h>
-
-#include "core.h"
-#include "iface.h"
-#include "prioq.h"
-#include "timeeventq.h"
-#include "announce.h"
-#include "browse.h"
-#include "dns.h"
-#include "rrlist.h"
-#include "hashmap.h"
-#include "wide-area.h"
-#include "multicast-lookup.h"
-#include "dns-srv-rr.h"
-
-#define AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX 100
-
-#define AVAHI_FLAGS_VALID(flags, max) (!((flags) & ~(max)))
-
-#define AVAHI_RR_HOLDOFF_MSEC 1000
-#define AVAHI_RR_HOLDOFF_MSEC_RATE_LIMIT 20000
-#define AVAHI_RR_RATE_LIMIT_COUNT 15
-
-typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot;
-
-struct AvahiLegacyUnicastReflectSlot {
- AvahiServer *server;
-
- uint16_t id, original_id;
- AvahiAddress address;
- uint16_t port;
- int interface;
- struct timeval elapse_time;
- AvahiTimeEvent *time_event;
-};
-
-struct AvahiEntry {
- AvahiServer *server;
- AvahiSEntryGroup *group;
-
- int dead;
-
- AvahiPublishFlags flags;
- AvahiRecord *record;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- AVAHI_LLIST_FIELDS(AvahiEntry, entries);
- AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
- AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
-
- AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
-};
-
-struct AvahiSEntryGroup {
- AvahiServer *server;
- int dead;
-
- AvahiEntryGroupState state;
- void* userdata;
- AvahiSEntryGroupCallback callback;
-
- unsigned n_probing;
-
- unsigned n_register_try;
- struct timeval register_time;
- AvahiTimeEvent *register_time_event;
-
- struct timeval established_at;
-
- AVAHI_LLIST_FIELDS(AvahiSEntryGroup, groups);
- AVAHI_LLIST_HEAD(AvahiEntry, entries);
-};
-
-struct AvahiServer {
- const AvahiPoll *poll_api;
-
- AvahiInterfaceMonitor *monitor;
- AvahiServerConfig config;
-
- AVAHI_LLIST_HEAD(AvahiEntry, entries);
- AvahiHashmap *entries_by_key;
-
- AVAHI_LLIST_HEAD(AvahiSEntryGroup, groups);
-
- AVAHI_LLIST_HEAD(AvahiSRecordBrowser, record_browsers);
- AvahiHashmap *record_browser_hashmap;
- AVAHI_LLIST_HEAD(AvahiSHostNameResolver, host_name_resolvers);
- AVAHI_LLIST_HEAD(AvahiSAddressResolver, address_resolvers);
- AVAHI_LLIST_HEAD(AvahiSDomainBrowser, domain_browsers);
- AVAHI_LLIST_HEAD(AvahiSServiceTypeBrowser, service_type_browsers);
- AVAHI_LLIST_HEAD(AvahiSServiceBrowser, service_browsers);
- AVAHI_LLIST_HEAD(AvahiSServiceResolver, service_resolvers);
- AVAHI_LLIST_HEAD(AvahiSDNSServerBrowser, dns_server_browsers);
-
- int need_entry_cleanup, need_group_cleanup, need_browser_cleanup;
-
- AvahiTimeEventQueue *time_event_queue;
-
- char *host_name, *host_name_fqdn, *domain_name;
-
- int fd_ipv4, fd_ipv6,
- /* The following two sockets two are used for reflection only */
- fd_legacy_unicast_ipv4, fd_legacy_unicast_ipv6;
-
- AvahiWatch *watch_ipv4, *watch_ipv6,
- *watch_legacy_unicast_ipv4, *watch_legacy_unicast_ipv6;
-
- AvahiServerState state;
- AvahiServerCallback callback;
- void* userdata;
-
- AvahiSEntryGroup *hinfo_entry_group;
- AvahiSEntryGroup *browse_domain_entry_group;
- unsigned n_host_rr_pending;
-
- /* Used for assembling responses */
- AvahiRecordList *record_list;
-
- /* Used for reflection of legacy unicast packets */
- AvahiLegacyUnicastReflectSlot **legacy_unicast_reflect_slots;
- uint16_t legacy_unicast_reflect_id;
-
- /* The last error code */
- int error;
-
- /* The local service cookie */
- uint32_t local_service_cookie;
-
- AvahiMulticastLookupEngine *multicast_lookup_engine;
- AvahiWideAreaLookupEngine *wide_area_lookup_engine;
-
- AvahiStringList *static_browse_domains;
-};
-
-void avahi_entry_free(AvahiServer*s, AvahiEntry *e);
-void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g);
-
-void avahi_cleanup_dead_entries(AvahiServer *s);
-
-void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, int unicast_response, int auxiliary);
-void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response);
-void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port, int legacy_unicast, int is_probe);
-
-void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState state);
-
-int avahi_entry_is_commited(AvahiEntry *e);
-
-void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata);
-
-void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void *userdata);
-
-void avahi_server_decrease_host_rr_pending(AvahiServer *s);
-
-int avahi_server_set_errno(AvahiServer *s, int error);
-
-int avahi_server_is_service_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name);
-int avahi_server_is_record_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *record);
-
-int avahi_server_add_ptr(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
- const char *dest);
-
-#define AVAHI_CHECK_VALIDITY(server, expression, error) { \
- if (!(expression)) \
- return avahi_server_set_errno((server), (error)); \
-}
-
-#define AVAHI_CHECK_VALIDITY_RETURN_NULL(server, expression, error) { \
- if (!(expression)) { \
- avahi_server_set_errno((server), (error)); \
- return NULL; \
- } \
-}
-
-#define AVAHI_CHECK_VALIDITY_SET_RET_GOTO_FAIL(server, expression, error) {\
- if (!(expression)) { \
- ret = avahi_server_set_errno((server), (error)); \
- goto fail; \
- } \
-}
-
-#define AVAHI_ASSERT_TRUE(expression) { \
- int __tmp = !!(expression); \
- assert(__tmp); \
-}
-
-#define AVAHI_ASSERT_SUCCESS(expression) { \
- int __tmp = (expression); \
- assert(__tmp == 0); \
-}
-
-#endif
diff --git a/trunk/avahi-core/log.c b/trunk/avahi-core/log.c
deleted file mode 100644
index bfd4021..0000000
--- a/trunk/avahi-core/log.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "log.h"
-
-static AvahiLogFunction log_function = NULL;
-
-void avahi_set_log_function(AvahiLogFunction function) {
- log_function = function;
-}
-
-void avahi_log_ap(AvahiLogLevel level, const char*format, va_list ap) {
- char txt[256];
-
- vsnprintf(txt, sizeof(txt), format, ap);
-
- if (log_function)
- log_function(level, txt);
- else
- fprintf(stderr, "%s\n", txt);
-}
-
-void avahi_log(AvahiLogLevel level, const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(level, format, ap);
- va_end(ap);
-}
-
-void avahi_log_error(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_ERROR, format, ap);
- va_end(ap);
-}
-
-void avahi_log_warn(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_WARN, format, ap);
- va_end(ap);
-}
-
-void avahi_log_notice(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_NOTICE, format, ap);
- va_end(ap);
-}
-
-void avahi_log_info(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_INFO, format, ap);
- va_end(ap);
-}
-
-void avahi_log_debug(const char*format, ...) {
- va_list ap;
- va_start(ap, format);
- avahi_log_ap(AVAHI_LOG_DEBUG, format, ap);
- va_end(ap);
-}
diff --git a/trunk/avahi-core/log.h b/trunk/avahi-core/log.h
deleted file mode 100644
index 25e3940..0000000
--- a/trunk/avahi-core/log.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef foologhfoo
-#define foologhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdarg.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/gccmacro.h>
-
-/** \file log.h Extensible logging subsystem */
-
-AVAHI_C_DECL_BEGIN
-
-/** Log level for avahi_log_xxx() */
-typedef enum {
- AVAHI_LOG_ERROR = 0, /**< Error messages */
- AVAHI_LOG_WARN = 1, /**< Warning messages */
- AVAHI_LOG_NOTICE = 2, /**< Notice messages */
- AVAHI_LOG_INFO = 3, /**< Info messages */
- AVAHI_LOG_DEBUG = 4, /**< Debug messages */
- AVAHI_LOG_LEVEL_MAX
-} AvahiLogLevel;
-
-/** Prototype for a user supplied log function */
-typedef void (*AvahiLogFunction)(AvahiLogLevel level, const char *txt);
-
-/** Set a user supplied log function, replacing the default which
- * prints to log messages unconditionally to STDERR. Pass NULL for
- * resetting to the default log function */
-void avahi_set_log_function(AvahiLogFunction function);
-
-/** Issue a log message using a va_list object */
-void avahi_log_ap(AvahiLogLevel level, const char *format, va_list ap);
-
-/** Issue a log message by passing a log level and a format string */
-void avahi_log(AvahiLogLevel level, const char*format, ...) AVAHI_GCC_PRINTF_ATTR23;
-
-/** Shortcut for avahi_log(AVAHI_LOG_ERROR, ...) */
-void avahi_log_error(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_WARN, ...) */
-void avahi_log_warn(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_NOTICE, ...) */
-void avahi_log_notice(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_INFO, ...) */
-void avahi_log_info(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-/** Shortcut for avahi_log(AVAHI_LOG_DEBUG, ...) */
-void avahi_log_debug(const char*format, ...) AVAHI_GCC_PRINTF_ATTR12;
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/lookup.h b/trunk/avahi-core/lookup.h
deleted file mode 100644
index 0ce6fe8..0000000
--- a/trunk/avahi-core/lookup.h
+++ /dev/null
@@ -1,237 +0,0 @@
-#ifndef foolookuphfoo
-#define foolookuphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file avahi-core/lookup.h Functions for browsing/resolving services and other RRs */
-
-/** \example core-browse-services.c Example how to browse for DNS-SD
- * services using an embedded mDNS stack. */
-
-/** A browsing object for arbitrary RRs */
-typedef struct AvahiSRecordBrowser AvahiSRecordBrowser;
-
-/** A host name to IP adddress resolver object */
-typedef struct AvahiSHostNameResolver AvahiSHostNameResolver;
-
-/** An IP address to host name resolver object ("reverse lookup") */
-typedef struct AvahiSAddressResolver AvahiSAddressResolver;
-
-/** A local domain browsing object. May be used to enumerate domains used on the local LAN */
-typedef struct AvahiSDomainBrowser AvahiSDomainBrowser;
-
-/** A DNS-SD service type browsing object. May be used to enumerate the service types of all available services on the local LAN */
-typedef struct AvahiSServiceTypeBrowser AvahiSServiceTypeBrowser;
-
-/** A DNS-SD service browser. Use this to enumerate available services of a certain kind on the local LAN. Use AvahiSServiceResolver to get specific service data like address and port for a service. */
-typedef struct AvahiSServiceBrowser AvahiSServiceBrowser;
-
-/** A DNS-SD service resolver. Use this to retrieve addres, port and TXT data for a DNS-SD service */
-typedef struct AvahiSServiceResolver AvahiSServiceResolver;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/defs.h>
-#include <avahi-core/core.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Callback prototype for AvahiSRecordBrowser events */
-typedef void (*AvahiSRecordBrowserCallback)(
- AvahiSRecordBrowser *b, /**< The AvahiSRecordBrowser object that is emitting this callback */
- AvahiIfIndex interface, /**< Logical OS network interface number the record was found on */
- AvahiProtocol protocol, /**< Protocol number the record was found. */
- AvahiBrowserEvent event, /**< Browsing event, either AVAHI_BROWSER_NEW or AVAHI_BROWSER_REMOVE */
- AvahiRecord *record, /**< The record that was found */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata /**< Arbitrary user data passed to avahi_s_record_browser_new() */ );
-
-/** Create a new browsing object for arbitrary RRs */
-AvahiSRecordBrowser *avahi_s_record_browser_new(
- AvahiServer *server, /**< The server object to which attach this query */
- AvahiIfIndex interface, /**< Logical OS interface number where to look for the records, or AVAHI_IF_UNSPEC to look on interfaces */
- AvahiProtocol protocol, /**< Protocol number to use when looking for the record, or AVAHI_PROTO_UNSPEC to look on all protocols */
- AvahiKey *key, /**< The search key */
- AvahiLookupFlags flags, /**< Lookup flags. Must have set either AVAHI_LOOKUP_FORCE_WIDE_AREA or AVAHI_LOOKUP_FORCE_MULTICAST, since domain based detection is not available here. */
- AvahiSRecordBrowserCallback callback, /**< The callback to call on browsing events */
- void* userdata /**< Arbitrary use suppliable data which is passed to the callback */);
-
-/** Free an AvahiSRecordBrowser object */
-void avahi_s_record_browser_free(AvahiSRecordBrowser *b);
-
-/** Callback prototype for AvahiSHostNameResolver events */
-typedef void (*AvahiSHostNameResolverCallback)(
- AvahiSHostNameResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event, /**< Resolving event */
- const char *host_name, /**< Host name which should be resolved. May differ in case from the query */
- const AvahiAddress *a, /**< The address, or NULL if the host name couldn't be resolved. */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create an AvahiSHostNameResolver object for resolving a host name to an adddress. See AvahiSRecordBrowser for more info on the paramters. */
-AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *host_name, /**< The host name to look for */
- AvahiProtocol aprotocol, /**< The address family of the desired address or AVAHI_PROTO_UNSPEC if doesn't matter. */
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSHostNameResolverCallback calback,
- void* userdata);
-
-/** Free a AvahiSHostNameResolver object */
-void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r);
-
-/** Callback prototype for AvahiSAddressResolver events */
-typedef void (*AvahiSAddressResolverCallback)(
- AvahiSAddressResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *host_name, /**< A host name for the specified address, if one was found, i.e. event == AVAHI_RESOLVER_FOUND */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create an AvahiSAddressResolver object. See AvahiSRecordBrowser for more info on the paramters. */
-AvahiSAddressResolver *avahi_s_address_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *address,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSAddressResolverCallback calback,
- void* userdata);
-
-/** Free an AvahiSAddressResolver object */
-void avahi_s_address_resolver_free(AvahiSAddressResolver *r);
-
-/** Callback prototype for AvahiSDomainBrowser events */
-typedef void (*AvahiSDomainBrowserCallback)(
- AvahiSDomainBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSDomainBrowser object */
-AvahiSDomainBrowser *avahi_s_domain_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiDomainBrowserType type,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSDomainBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSDomainBrowser object */
-void avahi_s_domain_browser_free(AvahiSDomainBrowser *b);
-
-/** Callback prototype for AvahiSServiceTypeBrowser events */
-typedef void (*AvahiSServiceTypeBrowserCallback)(
- AvahiSServiceTypeBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSServiceTypeBrowser object. */
-AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *domain,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSServiceTypeBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSServiceTypeBrowser object */
-void avahi_s_service_type_browser_free(AvahiSServiceTypeBrowser *b);
-
-/** Callback prototype for AvahiSServiceBrowser events */
-typedef void (*AvahiSServiceBrowserCallback)(
- AvahiSServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name /**< Service name, e.g. "Lennart's Files" */,
- const char *type /**< DNS-SD type, e.g. "_http._tcp" */,
- const char *domain /**< Domain of this service, e.g. "local" */,
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSServiceBrowser object. */
-AvahiSServiceBrowser *avahi_s_service_browser_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *service_type /** DNS-SD service type, e.g. "_http._tcp" */,
- const char *domain,
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSServiceBrowserCallback callback,
- void* userdata);
-
-/** Free an AvahiSServiceBrowser object */
-void avahi_s_service_browser_free(AvahiSServiceBrowser *b);
-
-/** Callback prototype for AvahiSServiceResolver events */
-typedef void (*AvahiSServiceResolverCallback)(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event, /**< Is AVAHI_RESOLVER_FOUND when the service was resolved successfully, and everytime it changes. Is AVAHI_RESOLVER_TIMOUT when the service failed to resolve or disappeared. */
- const char *name, /**< Service name */
- const char *type, /**< Service Type */
- const char *domain,
- const char *host_name, /**< Host name of the service */
- const AvahiAddress *a, /**< The resolved host name */
- uint16_t port, /**< Service name */
- AvahiStringList *txt, /**< TXT record data */
- AvahiLookupResultFlags flags, /**< Lookup flags */
- void* userdata);
-
-/** Create a new AvahiSServiceResolver object. The specified callback function will be called with the resolved service data. */
-AvahiSServiceResolver *avahi_s_service_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol, /**< Address family of the desired service address. Use AVAHI_PROTO_UNSPEC if you don't care */
- AvahiLookupFlags flags, /**< Lookup flags. */
- AvahiSServiceResolverCallback calback,
- void* userdata);
-
-/** Free an AvahiSServiceResolver object */
-void avahi_s_service_resolver_free(AvahiSServiceResolver *r);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/multicast-lookup.c b/trunk/avahi-core/multicast-lookup.c
deleted file mode 100644
index c3afcb0..0000000
--- a/trunk/avahi-core/multicast-lookup.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/timeval.h>
-
-#include "internal.h"
-#include "browse.h"
-#include "socket.h"
-#include "log.h"
-#include "hashmap.h"
-#include "multicast-lookup.h"
-#include "rr-util.h"
-
-struct AvahiMulticastLookup {
- AvahiMulticastLookupEngine *engine;
- int dead;
-
- AvahiKey *key, *cname_key;
-
- AvahiMulticastLookupCallback callback;
- void *userdata;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- int queriers_added;
-
- AvahiTimeEvent *all_for_now_event;
-
- AVAHI_LLIST_FIELDS(AvahiMulticastLookup, lookups);
- AVAHI_LLIST_FIELDS(AvahiMulticastLookup, by_key);
-};
-
-struct AvahiMulticastLookupEngine {
- AvahiServer *server;
-
- /* Lookups */
- AVAHI_LLIST_HEAD(AvahiMulticastLookup, lookups);
- AvahiHashmap *lookups_by_key;
-
- int cleanup_dead;
-};
-
-static void all_for_now_callback(AvahiTimeEvent *e, void* userdata) {
- AvahiMulticastLookup *l = userdata;
-
- assert(e);
- assert(l);
-
- avahi_time_event_free(l->all_for_now_event);
- l->all_for_now_event = NULL;
-
- l->callback(l->engine, l->interface, l->protocol, AVAHI_BROWSER_ALL_FOR_NOW, AVAHI_LOOKUP_RESULT_MULTICAST, NULL, l->userdata);
-}
-
-AvahiMulticastLookup *avahi_multicast_lookup_new(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiKey *key,
- AvahiMulticastLookupCallback callback,
- void *userdata) {
-
- AvahiMulticastLookup *l, *t;
- struct timeval tv;
-
- assert(e);
- assert(AVAHI_IF_VALID(interface));
- assert(AVAHI_PROTO_VALID(protocol));
- assert(key);
- assert(callback);
-
- l = avahi_new(AvahiMulticastLookup, 1);
- l->engine = e;
- l->dead = 0;
- l->key = avahi_key_ref(key);
- l->cname_key = avahi_key_new_cname(l->key);
- l->callback = callback;
- l->userdata = userdata;
- l->interface = interface;
- l->protocol = protocol;
- l->all_for_now_event = NULL;
- l->queriers_added = 0;
-
- t = avahi_hashmap_lookup(e->lookups_by_key, l->key);
- AVAHI_LLIST_PREPEND(AvahiMulticastLookup, by_key, t, l);
- avahi_hashmap_replace(e->lookups_by_key, avahi_key_ref(l->key), t);
-
- AVAHI_LLIST_PREPEND(AvahiMulticastLookup, lookups, e->lookups, l);
-
- avahi_querier_add_for_all(e->server, interface, protocol, l->key, &tv);
- l->queriers_added = 1;
-
- /* Add a second */
- avahi_timeval_add(&tv, 1000000);
-
- /* Issue the ALL_FOR_NOW event one second after the querier was initially created */
- l->all_for_now_event = avahi_time_event_new(e->server->time_event_queue, &tv, all_for_now_callback, l);
-
- return l;
-}
-
-static void lookup_stop(AvahiMulticastLookup *l) {
- assert(l);
-
- l->callback = NULL;
-
- if (l->queriers_added) {
- avahi_querier_remove_for_all(l->engine->server, l->interface, l->protocol, l->key);
- l->queriers_added = 0;
- }
-
- if (l->all_for_now_event) {
- avahi_time_event_free(l->all_for_now_event);
- l->all_for_now_event = NULL;
- }
-}
-
-static void lookup_destroy(AvahiMulticastLookup *l) {
- AvahiMulticastLookup *t;
- assert(l);
-
- lookup_stop(l);
-
- t = avahi_hashmap_lookup(l->engine->lookups_by_key, l->key);
- AVAHI_LLIST_REMOVE(AvahiMulticastLookup, by_key, t, l);
- if (t)
- avahi_hashmap_replace(l->engine->lookups_by_key, avahi_key_ref(l->key), t);
- else
- avahi_hashmap_remove(l->engine->lookups_by_key, l->key);
-
- AVAHI_LLIST_REMOVE(AvahiMulticastLookup, lookups, l->engine->lookups, l);
-
- if (l->key)
- avahi_key_unref(l->key);
-
- if (l->cname_key)
- avahi_key_unref(l->cname_key);
-
- avahi_free(l);
-}
-
-void avahi_multicast_lookup_free(AvahiMulticastLookup *l) {
- assert(l);
-
- if (l->dead)
- return;
-
- l->dead = 1;
- l->engine->cleanup_dead = 1;
- lookup_stop(l);
-}
-
-void avahi_multicast_lookup_engine_cleanup(AvahiMulticastLookupEngine *e) {
- AvahiMulticastLookup *l, *n;
- assert(e);
-
- while (e->cleanup_dead) {
- e->cleanup_dead = 0;
-
- for (l = e->lookups; l; l = n) {
- n = l->lookups_next;
-
- if (l->dead)
- lookup_destroy(l);
- }
- }
-}
-
-struct cbdata {
- AvahiMulticastLookupEngine *engine;
- AvahiMulticastLookupCallback callback;
- void *userdata;
- AvahiKey *key, *cname_key;
- AvahiInterface *interface;
- unsigned n_found;
-};
-
-static void* scan_cache_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
- struct cbdata *cbdata = userdata;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(cbdata);
-
- cbdata->callback(
- cbdata->engine,
- cbdata->interface->hardware->index,
- cbdata->interface->protocol,
- AVAHI_BROWSER_NEW,
- AVAHI_LOOKUP_RESULT_CACHED|AVAHI_LOOKUP_RESULT_MULTICAST,
- e->record,
- cbdata->userdata);
-
- cbdata->n_found ++;
-
- return NULL;
-}
-
-static void scan_interface_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- struct cbdata *cbdata = userdata;
-
- assert(m);
- assert(i);
- assert(cbdata);
-
- cbdata->interface = i;
-
- avahi_cache_walk(i->cache, cbdata->key, scan_cache_callback, cbdata);
-
- if (cbdata->cname_key)
- avahi_cache_walk(i->cache, cbdata->cname_key, scan_cache_callback, cbdata);
-
- cbdata->interface = NULL;
-}
-
-unsigned avahi_multicast_lookup_engine_scan_cache(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiKey *key,
- AvahiMulticastLookupCallback callback,
- void *userdata) {
-
- struct cbdata cbdata;
-
- assert(e);
- assert(key);
- assert(callback);
-
- assert(AVAHI_IF_VALID(interface));
- assert(AVAHI_PROTO_VALID(protocol));
-
- cbdata.engine = e;
- cbdata.key = key;
- cbdata.cname_key = avahi_key_new_cname(key);
- cbdata.callback = callback;
- cbdata.userdata = userdata;
- cbdata.interface = NULL;
- cbdata.n_found = 0;
-
- avahi_interface_monitor_walk(e->server->monitor, interface, protocol, scan_interface_callback, &cbdata);
-
- if (cbdata.cname_key)
- avahi_key_unref(cbdata.cname_key);
-
- return cbdata.n_found;
-}
-
-void avahi_multicast_lookup_engine_new_interface(AvahiMulticastLookupEngine *e, AvahiInterface *i) {
- AvahiMulticastLookup *l;
-
- assert(e);
- assert(i);
-
- for (l = e->lookups; l; l = l->lookups_next) {
-
- if (l->dead || !l->callback)
- continue;
-
- if (l->queriers_added && avahi_interface_match(i, l->interface, l->protocol))
- avahi_querier_add(i, l->key, NULL);
- }
-}
-
-void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiInterface *i, AvahiRecord *record, AvahiBrowserEvent event) {
- AvahiMulticastLookup *l;
-
- assert(e);
- assert(record);
- assert(i);
-
- for (l = avahi_hashmap_lookup(e->lookups_by_key, record->key); l; l = l->by_key_next) {
- if (l->dead || !l->callback)
- continue;
-
- if (avahi_interface_match(i, l->interface, l->protocol))
- l->callback(e, i->hardware->index, i->protocol, event, AVAHI_LOOKUP_RESULT_MULTICAST, record, l->userdata);
- }
-
-
- if (record->key->clazz == AVAHI_DNS_CLASS_IN && record->key->type == AVAHI_DNS_TYPE_CNAME) {
- /* It's a CNAME record, so we have to scan the all lookups to see if one matches */
-
- for (l = e->lookups; l; l = l->lookups_next) {
- AvahiKey *key;
-
- if (l->dead || !l->callback)
- continue;
-
- if ((key = avahi_key_new_cname(l->key))) {
- if (avahi_key_equal(record->key, key))
- l->callback(e, i->hardware->index, i->protocol, event, AVAHI_LOOKUP_RESULT_MULTICAST, record, l->userdata);
-
- avahi_key_unref(key);
- }
- }
- }
-}
-
-AvahiMulticastLookupEngine *avahi_multicast_lookup_engine_new(AvahiServer *s) {
- AvahiMulticastLookupEngine *e;
-
- assert(s);
-
- e = avahi_new(AvahiMulticastLookupEngine, 1);
- e->server = s;
- e->cleanup_dead = 0;
-
- /* Initialize lookup list */
- e->lookups_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, (AvahiFreeFunc) avahi_key_unref, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiWideAreaLookup, e->lookups);
-
- return e;
-}
-
-void avahi_multicast_lookup_engine_free(AvahiMulticastLookupEngine *e) {
- assert(e);
-
- while (e->lookups)
- lookup_destroy(e->lookups);
-
- avahi_hashmap_free(e->lookups_by_key);
- avahi_free(e);
-}
-
diff --git a/trunk/avahi-core/multicast-lookup.h b/trunk/avahi-core/multicast-lookup.h
deleted file mode 100644
index 43e240d..0000000
--- a/trunk/avahi-core/multicast-lookup.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef foomulticastlookuphfoo
-#define foomulticastlookuphfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "lookup.h"
-#include "browse.h"
-
-typedef struct AvahiMulticastLookupEngine AvahiMulticastLookupEngine;
-typedef struct AvahiMulticastLookup AvahiMulticastLookup;
-
-typedef void (*AvahiMulticastLookupCallback)(
- AvahiMulticastLookupEngine *e,
- AvahiIfIndex idx,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata);
-
-AvahiMulticastLookupEngine *avahi_multicast_lookup_engine_new(AvahiServer *s);
-void avahi_multicast_lookup_engine_free(AvahiMulticastLookupEngine *e);
-
-unsigned avahi_multicast_lookup_engine_scan_cache(AvahiMulticastLookupEngine *e, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, AvahiMulticastLookupCallback callback, void *userdata);
-void avahi_multicast_lookup_engine_new_interface(AvahiMulticastLookupEngine *e, AvahiInterface *i);
-void avahi_multicast_lookup_engine_cleanup(AvahiMulticastLookupEngine *e);
-void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiInterface *i, AvahiRecord *record, AvahiBrowserEvent event);
-
-AvahiMulticastLookup *avahi_multicast_lookup_new(AvahiMulticastLookupEngine *e, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, AvahiMulticastLookupCallback callback, void *userdata);
-void avahi_multicast_lookup_free(AvahiMulticastLookup *q);
-
-
-#endif
-
diff --git a/trunk/avahi-core/netlink.c b/trunk/avahi-core/netlink.c
deleted file mode 100644
index 7411c90..0000000
--- a/trunk/avahi-core/netlink.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <assert.h>
-
-#include <avahi-common/malloc.h>
-#include "netlink.h"
-#include "log.h"
-
-struct AvahiNetlink {
- int fd;
- unsigned seq;
- AvahiNetlinkCallback callback;
- void* userdata;
- uint8_t* buffer;
- size_t buffer_length;
-
- const AvahiPoll *poll_api;
- AvahiWatch *watch;
-};
-
-int avahi_netlink_work(AvahiNetlink *nl, int block) {
- ssize_t bytes;
- struct msghdr smsg;
- struct cmsghdr *cmsg;
- struct ucred *cred;
- struct iovec iov;
- struct nlmsghdr *p;
- char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
-
- assert(nl);
-
- iov.iov_base = nl->buffer;
- iov.iov_len = nl->buffer_length;
-
- smsg.msg_name = (void*) NULL;
- smsg.msg_namelen = 0;
- smsg.msg_iov = &iov;
- smsg.msg_iovlen = 1;
- smsg.msg_control = cred_msg;
- smsg.msg_controllen = sizeof(cred_msg);
- smsg.msg_flags = (block ? 0 : MSG_DONTWAIT);
-
- if ((bytes = recvmsg(nl->fd, &smsg, 0)) < 0) {
- if (errno == EAGAIN || errno == EINTR)
- return 0;
-
- avahi_log_error(__FILE__": recvmsg() failed: %s", strerror(errno));
- return -1;
- }
-
- cmsg = CMSG_FIRSTHDR(&smsg);
- cred = (struct ucred *) CMSG_DATA (cmsg);
-
- if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
- avahi_log_error("No sender credentials received, ignoring data.");
- return -1;
- }
-
- if (cred->uid != 0) {
- avahi_log_warn("Netlink message received from cred->uid != 0 (%d)", cred->uid);
- return -1;
- }
-
- p = (struct nlmsghdr *) nl->buffer;
-
- assert(nl->callback);
-
- for (; bytes > 0; p = NLMSG_NEXT(p, bytes)) {
- if (!NLMSG_OK(p, (size_t) bytes)) {
- avahi_log_warn(__FILE__": packet truncated");
- return -1;
- }
-
- nl->callback(nl, p, nl->userdata);
- }
-
- return 0;
-}
-
-static void socket_event(AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, void *userdata) {
- AvahiNetlink *nl = userdata;
-
- assert(w);
- assert(nl);
- assert(fd == nl->fd);
-
- avahi_netlink_work(nl, 0);
-}
-
-AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void (*cb) (AvahiNetlink *nl, struct nlmsghdr *n, void* userdata), void* userdata) {
- int fd = -1;
- const int on = 1;
- struct sockaddr_nl addr;
- AvahiNetlink *nl = NULL;
-
- assert(poll_api);
- assert(cb);
-
- if ((fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
- avahi_log_error(__FILE__": socket(PF_NETLINK): %s", strerror(errno));
- return NULL;
- }
-
- memset(&addr, 0, sizeof(addr));
- addr.nl_family = AF_NETLINK;
- addr.nl_groups = groups;
- addr.nl_pid = getpid();
-
- if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- avahi_log_error(__FILE__": bind(): %s", strerror(errno));
- goto fail;
- }
-
- if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
- avahi_log_error(__FILE__": bind(): %s", strerror(errno));
- goto fail;
- }
-
- if (!(nl = avahi_new(AvahiNetlink, 1))) {
- avahi_log_error(__FILE__": avahi_new() failed.");
- goto fail;
- }
-
- nl->poll_api = poll_api;
- nl->fd = fd;
- nl->seq = 0;
- nl->callback = cb;
- nl->userdata = userdata;
-
- if (!(nl->buffer = avahi_new(uint8_t, nl->buffer_length = 64*1024))) {
- avahi_log_error(__FILE__": avahi_new() failed.");
- goto fail;
- }
-
- if (!(nl->watch = poll_api->watch_new(poll_api, fd, AVAHI_WATCH_IN, socket_event, nl))) {
- avahi_log_error(__FILE__": Failed to create watch.");
- goto fail;
- }
-
- return nl;
-
-fail:
-
- if (fd >= 0)
- close(fd);
-
- if (nl) {
- avahi_free(nl->buffer);
- avahi_free(nl);
- }
-
- return NULL;
-}
-
-void avahi_netlink_free(AvahiNetlink *nl) {
- assert(nl);
-
- if (nl->watch)
- nl->poll_api->watch_free(nl->watch);
-
- if (nl->fd >= 0)
- close(nl->fd);
-
- avahi_free(nl->buffer);
- avahi_free(nl);
-}
-
-int avahi_netlink_send(AvahiNetlink *nl, struct nlmsghdr *m, unsigned *ret_seq) {
- assert(nl);
- assert(m);
-
- m->nlmsg_seq = nl->seq++;
- m->nlmsg_flags |= NLM_F_ACK;
-
- if (send(nl->fd, m, m->nlmsg_len, 0) < 0) {
- avahi_log_error(__FILE__": send(): %s", strerror(errno));
- return -1;
- }
-
- if (ret_seq)
- *ret_seq = m->nlmsg_seq;
-
- return 0;
-}
diff --git a/trunk/avahi-core/netlink.h b/trunk/avahi-core/netlink.h
deleted file mode 100644
index 8f2f8cb..0000000
--- a/trunk/avahi-core/netlink.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef foonetlinkhfoo
-#define foonetlinkhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <sys/socket.h>
-#include <asm/types.h>
-#include <inttypes.h>
-
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-
-#include <avahi-common/watch.h>
-
-typedef struct AvahiNetlink AvahiNetlink;
-
-typedef void (*AvahiNetlinkCallback)(AvahiNetlink *n, struct nlmsghdr *m, void* userdata);
-
-AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, AvahiNetlinkCallback callback, void* userdata);
-void avahi_netlink_free(AvahiNetlink *n);
-int avahi_netlink_send(AvahiNetlink *n, struct nlmsghdr *m, unsigned *ret_seq);
-int avahi_netlink_work(AvahiNetlink *n, int block);
-
-#endif
diff --git a/trunk/avahi-core/prioq-test.c b/trunk/avahi-core/prioq-test.c
deleted file mode 100644
index d85a222..0000000
--- a/trunk/avahi-core/prioq-test.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-
-#include <avahi-common/gccmacro.h>
-
-#include "prioq.h"
-
-#define POINTER_TO_INT(p) ((int) (p))
-#define INT_TO_POINTER(i) ((void*) (i))
-
-static int compare_int(const void* a, const void* b) {
- int i = POINTER_TO_INT(a), j = POINTER_TO_INT(b);
-
- return i < j ? -1 : (i > j ? 1 : 0);
-}
-
-static int compare_ptr(const void* a, const void* b) {
- return a < b ? -1 : (a > b ? 1 : 0);
-}
-
-static void rec(AvahiPrioQueueNode *n) {
- if (!n)
- return;
-
- if (n->left)
- assert(n->left->parent == n);
-
- if (n->right)
- assert(n->right->parent == n);
-
- if (n->parent) {
- assert(n->parent->left == n || n->parent->right == n);
-
- if (n->parent->left == n)
- assert(n->next == n->parent->right);
- }
-
- if (!n->next) {
- assert(n->queue->last == n);
-
- if (n->parent && n->parent->left == n)
- assert(n->parent->right == NULL);
- }
-
-
- if (n->parent) {
- int a = POINTER_TO_INT(n->parent->data), b = POINTER_TO_INT(n->data);
- if (a > b) {
- printf("%i <= %i: NO\n", a, b);
- abort();
- }
- }
-
- rec(n->left);
- rec(n->right);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiPrioQueue *q, *q2;
- int i;
-
- q = avahi_prio_queue_new(compare_int);
- q2 = avahi_prio_queue_new(compare_ptr);
-
- srand(time(NULL));
-
- for (i = 0; i < 10000; i++)
- avahi_prio_queue_put(q2, avahi_prio_queue_put(q, INT_TO_POINTER(random() & 0xFFFF)));
-
- while (q2->root) {
- rec(q->root);
- rec(q2->root);
-
- assert(q->n_nodes == q2->n_nodes);
-
- printf("%i\n", POINTER_TO_INT(((AvahiPrioQueueNode*)q2->root->data)->data));
-
- avahi_prio_queue_remove(q, q2->root->data);
- avahi_prio_queue_remove(q2, q2->root);
- }
-
-
-/* prev = 0; */
-/* while (q->root) { */
-/* int v = GPOINTER_TO_INT(q->root->data); */
-/* rec(q->root); */
-/* printf("%i\n", v); */
-/* avahi_prio_queue_remove(q, q->root); */
-/* assert(v >= prev); */
-/* prev = v; */
-/* } */
-
- avahi_prio_queue_free(q);
- return 0;
-}
diff --git a/trunk/avahi-core/prioq.c b/trunk/avahi-core/prioq.c
deleted file mode 100644
index 8d91d87..0000000
--- a/trunk/avahi-core/prioq.c
+++ /dev/null
@@ -1,390 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/malloc.h>
-
-#include "prioq.h"
-
-AvahiPrioQueue* avahi_prio_queue_new(AvahiPQCompareFunc compare) {
- AvahiPrioQueue *q;
- assert(compare);
-
- if (!(q = avahi_new(AvahiPrioQueue, 1)))
- return NULL; /* OOM */
-
- q->root = q->last = NULL;
- q->n_nodes = 0;
- q->compare = compare;
-
- return q;
-}
-
-void avahi_prio_queue_free(AvahiPrioQueue *q) {
- assert(q);
-
- while (q->last)
- avahi_prio_queue_remove(q, q->last);
-
- assert(!q->n_nodes);
- avahi_free(q);
-}
-
-static AvahiPrioQueueNode* get_node_at_xy(AvahiPrioQueue *q, unsigned x, unsigned y) {
- unsigned r;
- AvahiPrioQueueNode *n;
- assert(q);
-
- n = q->root;
- assert(n);
-
- for (r = 0; r < y; r++) {
- assert(n);
-
- if ((x >> (y-r-1)) & 1)
- n = n->right;
- else
- n = n->left;
- }
-
- assert(n->x == x);
- assert(n->y == y);
-
- return n;
-}
-
-static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQueueNode *b) {
- AvahiPrioQueueNode *l, *r, *p, *ap, *an, *bp, *bn;
- unsigned t;
- assert(q);
- assert(a);
- assert(b);
- assert(a != b);
-
- /* Swap positions */
- t = a->x; a->x = b->x; b->x = t;
- t = a->y; a->y = b->y; b->y = t;
-
- if (a->parent == b) {
- /* B is parent of A */
-
- p = b->parent;
- b->parent = a;
-
- if ((a->parent = p)) {
- if (a->parent->left == b)
- a->parent->left = a;
- else
- a->parent->right = a;
- } else
- q->root = a;
-
- if (b->left == a) {
- if ((b->left = a->left))
- b->left->parent = b;
- a->left = b;
-
- r = a->right;
- if ((a->right = b->right))
- a->right->parent = a;
- if ((b->right = r))
- b->right->parent = b;
-
- } else {
- if ((b->right = a->right))
- b->right->parent = b;
- a->right = b;
-
- l = a->left;
- if ((a->left = b->left))
- a->left->parent = a;
- if ((b->left = l))
- b->left->parent = b;
- }
- } else if (b->parent == a) {
- /* A ist parent of B */
-
- p = a->parent;
- a->parent = b;
-
- if ((b->parent = p)) {
- if (b->parent->left == a)
- b->parent->left = b;
- else
- b->parent->right = b;
- } else
- q->root = b;
-
- if (a->left == b) {
- if ((a->left = b->left))
- a->left->parent = a;
- b->left = a;
-
- r = a->right;
- if ((a->right = b->right))
- a->right->parent = a;
- if ((b->right = r))
- b->right->parent = b;
- } else {
- if ((a->right = b->right))
- a->right->parent = a;
- b->right = a;
-
- l = a->left;
- if ((a->left = b->left))
- a->left->parent = a;
- if ((b->left = l))
- b->left->parent = b;
- }
- } else {
- AvahiPrioQueueNode *apl = NULL, *bpl = NULL;
-
- /* Swap parents */
- ap = a->parent;
- bp = b->parent;
-
- if (ap)
- apl = ap->left;
- if (bp)
- bpl = bp->left;
-
- if ((a->parent = bp)) {
- if (bpl == b)
- bp->left = a;
- else
- bp->right = a;
- } else
- q->root = a;
-
- if ((b->parent = ap)) {
- if (apl == a)
- ap->left = b;
- else
- ap->right = b;
- } else
- q->root = b;
-
- /* Swap children */
- l = a->left;
- r = a->right;
-
- if ((a->left = b->left))
- a->left->parent = a;
-
- if ((b->left = l))
- b->left->parent = b;
-
- if ((a->right = b->right))
- a->right->parent = a;
-
- if ((b->right = r))
- b->right->parent = b;
- }
-
- /* Swap siblings */
- ap = a->prev; an = a->next;
- bp = b->prev; bn = b->next;
-
- if (a->next == b) {
- /* A is predecessor of B */
- a->prev = b;
- b->next = a;
-
- if ((a->next = bn))
- a->next->prev = a;
- else
- q->last = a;
-
- if ((b->prev = ap))
- b->prev->next = b;
-
- } else if (b->next == a) {
- /* B is predecessor of A */
- a->next = b;
- b->prev = a;
-
- if ((a->prev = bp))
- a->prev->next = a;
-
- if ((b->next = an))
- b->next->prev = b;
- else
- q->last = b;
-
- } else {
- /* A is no neighbour of B */
-
- if ((a->prev = bp))
- a->prev->next = a;
-
- if ((a->next = bn))
- a->next->prev = a;
- else
- q->last = a;
-
- if ((b->prev = ap))
- b->prev->next = b;
-
- if ((b->next = an))
- b->next->prev = b;
- else
- q->last = b;
- }
-}
-
-/* Move a node to the correct position */
-void avahi_prio_queue_shuffle(AvahiPrioQueue *q, AvahiPrioQueueNode *n) {
- assert(q);
- assert(n);
- assert(n->queue == q);
-
- /* Move up until the position is OK */
- while (n->parent && q->compare(n->parent->data, n->data) > 0)
- exchange_nodes(q, n, n->parent);
-
- /* Move down until the position is OK */
- for (;;) {
- AvahiPrioQueueNode *min;
-
- if (!(min = n->left)) {
- /* No children */
- assert(!n->right);
- break;
- }
-
- if (n->right && q->compare(n->right->data, min->data) < 0)
- min = n->right;
-
- /* min now contains the smaller one of our two children */
-
- if (q->compare(n->data, min->data) <= 0)
- /* Order OK */
- break;
-
- exchange_nodes(q, n, min);
- }
-}
-
-AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
- AvahiPrioQueueNode *n;
- assert(q);
-
- if (!(n = avahi_new(AvahiPrioQueueNode, 1)))
- return NULL; /* OOM */
-
- n->queue = q;
- n->data = data;
-
- if (q->last) {
- assert(q->root);
- assert(q->n_nodes);
-
- n->y = q->last->y;
- n->x = q->last->x+1;
-
- if (n->x >= ((unsigned) 1 << n->y)) {
- n->x = 0;
- n->y++;
- }
-
- q->last->next = n;
- n->prev = q->last;
-
- assert(n->y > 0);
- n->parent = get_node_at_xy(q, n->x/2, n->y-1);
-
- if (n->x & 1)
- n->parent->right = n;
- else
- n->parent->left = n;
- } else {
- assert(!q->root);
- assert(!q->n_nodes);
-
- n->y = n->x = 0;
- q->root = n;
- n->prev = n->parent = NULL;
- }
-
- n->next = n->left = n->right = NULL;
- q->last = n;
- q->n_nodes++;
-
- avahi_prio_queue_shuffle(q, n);
-
- return n;
-}
-
-void avahi_prio_queue_remove(AvahiPrioQueue *q, AvahiPrioQueueNode *n) {
- assert(q);
- assert(n);
- assert(q == n->queue);
-
- if (n != q->last) {
- AvahiPrioQueueNode *replacement = q->last;
- exchange_nodes(q, replacement, n);
- avahi_prio_queue_remove(q, n);
- avahi_prio_queue_shuffle(q, replacement);
- return;
- }
-
- assert(n == q->last);
- assert(!n->next);
- assert(!n->left);
- assert(!n->right);
-
- q->last = n->prev;
-
- if (n->prev) {
- n->prev->next = NULL;
- assert(n->parent);
- } else
- assert(!n->parent);
-
- if (n->parent) {
- assert(n->prev);
- if (n->parent->left == n) {
- assert(n->parent->right == NULL);
- n->parent->left = NULL;
- } else {
- assert(n->parent->right == n);
- assert(n->parent->left != NULL);
- n->parent->right = NULL;
- }
- } else {
- assert(q->root == n);
- assert(!n->prev);
- assert(q->n_nodes == 1);
- q->root = NULL;
- }
-
- avahi_free(n);
-
- assert(q->n_nodes > 0);
- q->n_nodes--;
-}
-
diff --git a/trunk/avahi-core/prioq.h b/trunk/avahi-core/prioq.h
deleted file mode 100644
index ace92f6..0000000
--- a/trunk/avahi-core/prioq.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef fooprioqhfoo
-#define fooprioqhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiPrioQueue AvahiPrioQueue;
-typedef struct AvahiPrioQueueNode AvahiPrioQueueNode;
-
-typedef int (*AvahiPQCompareFunc)(const void* a, const void* b);
-
-struct AvahiPrioQueue {
- AvahiPrioQueueNode *root, *last;
- unsigned n_nodes;
- AvahiPQCompareFunc compare;
-};
-
-struct AvahiPrioQueueNode {
- AvahiPrioQueue *queue;
- void* data;
- unsigned x, y;
- AvahiPrioQueueNode *left, *right, *parent, *next, *prev;
-};
-
-AvahiPrioQueue* avahi_prio_queue_new(AvahiPQCompareFunc compare);
-void avahi_prio_queue_free(AvahiPrioQueue *q);
-
-AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data);
-void avahi_prio_queue_remove(AvahiPrioQueue *q, AvahiPrioQueueNode *n);
-
-void avahi_prio_queue_shuffle(AvahiPrioQueue *q, AvahiPrioQueueNode *n);
-
-#endif
diff --git a/trunk/avahi-core/probe-sched.c b/trunk/avahi-core/probe-sched.c
deleted file mode 100644
index f430bce..0000000
--- a/trunk/avahi-core/probe-sched.c
+++ /dev/null
@@ -1,402 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "probe-sched.h"
-#include "log.h"
-#include "rr-util.h"
-
-#define AVAHI_PROBE_HISTORY_MSEC 150
-#define AVAHI_PROBE_DEFER_MSEC 50
-
-typedef struct AvahiProbeJob AvahiProbeJob;
-
-struct AvahiProbeJob {
- AvahiProbeScheduler *scheduler;
- AvahiTimeEvent *time_event;
-
- int chosen; /* Use for packet assembling */
- int done;
- struct timeval delivery;
-
- AvahiRecord *record;
-
- AVAHI_LLIST_FIELDS(AvahiProbeJob, jobs);
-};
-
-struct AvahiProbeScheduler {
- AvahiInterface *interface;
- AvahiTimeEventQueue *time_event_queue;
-
- AVAHI_LLIST_HEAD(AvahiProbeJob, jobs);
- AVAHI_LLIST_HEAD(AvahiProbeJob, history);
-};
-
-static AvahiProbeJob* job_new(AvahiProbeScheduler *s, AvahiRecord *record, int done) {
- AvahiProbeJob *pj;
-
- assert(s);
- assert(record);
-
- if (!(pj = avahi_new(AvahiProbeJob, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL; /* OOM */
- }
-
- pj->scheduler = s;
- pj->record = avahi_record_ref(record);
- pj->time_event = NULL;
- pj->chosen = 0;
-
- if ((pj->done = done))
- AVAHI_LLIST_PREPEND(AvahiProbeJob, jobs, s->history, pj);
- else
- AVAHI_LLIST_PREPEND(AvahiProbeJob, jobs, s->jobs, pj);
-
- return pj;
-}
-
-static void job_free(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
- assert(pj);
-
- if (pj->time_event)
- avahi_time_event_free(pj->time_event);
-
- if (pj->done)
- AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->history, pj);
- else
- AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->jobs, pj);
-
- avahi_record_unref(pj->record);
- avahi_free(pj);
-}
-
-static void elapse_callback(AvahiTimeEvent *e, void* data);
-
-static void job_set_elapse_time(AvahiProbeScheduler *s, AvahiProbeJob *pj, unsigned msec, unsigned jitter) {
- struct timeval tv;
-
- assert(s);
- assert(pj);
-
- avahi_elapse_time(&tv, msec, jitter);
-
- if (pj->time_event)
- avahi_time_event_update(pj->time_event, &tv);
- else
- pj->time_event = avahi_time_event_new(s->time_event_queue, &tv, elapse_callback, pj);
-}
-
-static void job_mark_done(AvahiProbeScheduler *s, AvahiProbeJob *pj) {
- assert(s);
- assert(pj);
-
- assert(!pj->done);
-
- AVAHI_LLIST_REMOVE(AvahiProbeJob, jobs, s->jobs, pj);
- AVAHI_LLIST_PREPEND(AvahiProbeJob, jobs, s->history, pj);
-
- pj->done = 1;
-
- job_set_elapse_time(s, pj, AVAHI_PROBE_HISTORY_MSEC, 0);
- gettimeofday(&pj->delivery, NULL);
-}
-
-AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i) {
- AvahiProbeScheduler *s;
-
- assert(i);
-
- if (!(s = avahi_new(AvahiProbeScheduler, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- s->interface = i;
- s->time_event_queue = i->monitor->server->time_event_queue;
-
- AVAHI_LLIST_HEAD_INIT(AvahiProbeJob, s->jobs);
- AVAHI_LLIST_HEAD_INIT(AvahiProbeJob, s->history);
-
- return s;
-}
-
-void avahi_probe_scheduler_free(AvahiProbeScheduler *s) {
- assert(s);
-
- avahi_probe_scheduler_clear(s);
- avahi_free(s);
-}
-
-void avahi_probe_scheduler_clear(AvahiProbeScheduler *s) {
- assert(s);
-
- while (s->jobs)
- job_free(s, s->jobs);
- while (s->history)
- job_free(s, s->history);
-}
-
-static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, AvahiProbeJob *pj) {
- size_t size;
- AvahiKey *k;
- int b;
-
- assert(s);
- assert(p);
- assert(pj);
-
- assert(!pj->chosen);
-
- /* Estimate the size for this record */
- size =
- avahi_key_get_estimate_size(pj->record->key) +
- avahi_record_get_estimate_size(pj->record);
-
- /* Too large */
- if (size > avahi_dns_packet_space(p))
- return 0;
-
- /* Create the probe query */
- if (!(k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY)))
- return 0; /* OOM */
-
- b = !!avahi_dns_packet_append_key(p, k, 0);
- assert(b);
-
- /* Mark this job for addition to the packet */
- pj->chosen = 1;
-
- /* Scan for more jobs whith matching key pattern */
- for (pj = s->jobs; pj; pj = pj->jobs_next) {
- if (pj->chosen)
- continue;
-
- /* Does the record match the probe? */
- if (k->clazz != pj->record->key->clazz || !avahi_domain_equal(k->name, pj->record->key->name))
- continue;
-
- /* This job wouldn't fit in */
- if (avahi_record_get_estimate_size(pj->record) > avahi_dns_packet_space(p))
- break;
-
- /* Mark this job for addition to the packet */
- pj->chosen = 1;
- }
-
- avahi_key_unref(k);
-
- return 1;
-}
-
-static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
- AvahiProbeJob *pj = data, *next;
- AvahiProbeScheduler *s;
- AvahiDnsPacket *p;
- unsigned n;
-
- assert(pj);
- s = pj->scheduler;
-
- if (pj->done) {
- /* Lets remove it from the history */
- job_free(s, pj);
- return;
- }
-
- if (!(p = avahi_dns_packet_new_query(s->interface->hardware->mtu)))
- return; /* OOM */
- n = 1;
-
- /* Add the import probe */
- if (!packet_add_probe_query(s, p, pj)) {
- size_t size;
- AvahiKey *k;
- int b;
-
- avahi_dns_packet_free(p);
-
- /* The probe didn't fit in the package, so let's allocate a larger one */
-
- size =
- avahi_key_get_estimate_size(pj->record->key) +
- avahi_record_get_estimate_size(pj->record) +
- AVAHI_DNS_PACKET_HEADER_SIZE;
-
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(p = avahi_dns_packet_new_query(size)))
- return; /* OOM */
-
- if (!(k = avahi_key_new(pj->record->key->name, pj->record->key->clazz, AVAHI_DNS_TYPE_ANY))) {
- avahi_dns_packet_free(p);
- return; /* OOM */
- }
-
- b = avahi_dns_packet_append_key(p, k, 0) && avahi_dns_packet_append_record(p, pj->record, 0, 0);
- avahi_key_unref(k);
-
- if (b) {
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_NSCOUNT, 1);
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_QDCOUNT, 1);
- avahi_interface_send_packet(s->interface, p);
- } else
- avahi_log_warn("Probe record too large, cannot send");
-
- avahi_dns_packet_free(p);
- job_mark_done(s, pj);
-
- return;
- }
-
- /* Try to fill up packet with more probes, if available */
- for (pj = s->jobs; pj; pj = pj->jobs_next) {
-
- if (pj->chosen)
- continue;
-
- if (!packet_add_probe_query(s, p, pj))
- break;
-
- n++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_QDCOUNT, n);
-
- n = 0;
-
- /* Now add the chosen records to the authorative section */
- for (pj = s->jobs; pj; pj = next) {
-
- next = pj->jobs_next;
-
- if (!pj->chosen)
- continue;
-
- if (!avahi_dns_packet_append_record(p, pj->record, 0, 0)) {
-/* avahi_log_warn("Bad probe size estimate!"); */
-
- /* Unmark all following jobs */
- for (; pj; pj = pj->jobs_next)
- pj->chosen = 0;
-
- break;
- }
-
- job_mark_done(s, pj);
-
- n ++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_NSCOUNT, n);
-
- /* Send it now */
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-}
-
-static AvahiProbeJob* find_scheduled_job(AvahiProbeScheduler *s, AvahiRecord *record) {
- AvahiProbeJob *pj;
-
- assert(s);
- assert(record);
-
- for (pj = s->jobs; pj; pj = pj->jobs_next) {
- assert(!pj->done);
-
- if (avahi_record_equal_no_ttl(pj->record, record))
- return pj;
- }
-
- return NULL;
-}
-
-static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *record) {
- AvahiProbeJob *pj;
-
- assert(s);
- assert(record);
-
- for (pj = s->history; pj; pj = pj->jobs_next) {
- assert(pj->done);
-
- if (avahi_record_equal_no_ttl(pj->record, record)) {
- /* Check whether this entry is outdated */
-
- if (avahi_age(&pj->delivery) > AVAHI_PROBE_HISTORY_MSEC*1000) {
- /* it is outdated, so let's remove it */
- job_free(s, pj);
- return NULL;
- }
-
- return pj;
- }
- }
-
- return NULL;
-}
-
-int avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, int immediately) {
- AvahiProbeJob *pj;
- struct timeval tv;
-
- assert(s);
- assert(record);
- assert(!avahi_key_is_pattern(record->key));
-
- if ((pj = find_history_job(s, record)))
- return 0;
-
- avahi_elapse_time(&tv, immediately ? 0 : AVAHI_PROBE_DEFER_MSEC, 0);
-
- if ((pj = find_scheduled_job(s, record))) {
-
- if (avahi_timeval_compare(&tv, &pj->delivery) < 0) {
- /* If the new entry should be scheduled earlier, update the old entry */
- pj->delivery = tv;
- avahi_time_event_update(pj->time_event, &pj->delivery);
- }
-
- return 1;
- } else {
- /* Create a new job and schedule it */
- if (!(pj = job_new(s, record, 0)))
- return 0; /* OOM */
-
- pj->delivery = tv;
- pj->time_event = avahi_time_event_new(s->time_event_queue, &pj->delivery, elapse_callback, pj);
-
-
-/* avahi_log_debug("Accepted new probe job."); */
-
- return 1;
- }
-}
diff --git a/trunk/avahi-core/probe-sched.h b/trunk/avahi-core/probe-sched.h
deleted file mode 100644
index 3af1319..0000000
--- a/trunk/avahi-core/probe-sched.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef fooprobeschedhfoo
-#define fooprobeschedhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiProbeScheduler AvahiProbeScheduler;
-
-#include <avahi-common/address.h>
-#include "iface.h"
-
-AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i);
-void avahi_probe_scheduler_free(AvahiProbeScheduler *s);
-void avahi_probe_scheduler_clear(AvahiProbeScheduler *s);
-
-int avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, int immediately);
-
-#endif
diff --git a/trunk/avahi-core/publish.h b/trunk/avahi-core/publish.h
deleted file mode 100644
index 77c49af..0000000
--- a/trunk/avahi-core/publish.h
+++ /dev/null
@@ -1,177 +0,0 @@
-#ifndef foopublishhfoo
-#define foopublishhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file core/publish.h Functions for publising local services and RRs */
-
-/** \example core-publish-service.c Example how to register a DNS-SD
- * service using an embedded mDNS stack. It behaves like a network
- * printer registering both an IPP and a BSD LPR service. */
-
-/** A group of locally registered DNS RRs */
-typedef struct AvahiSEntryGroup AvahiSEntryGroup;
-
-#include <avahi-common/cdecl.h>
-#include <avahi-core/core.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Prototype for callback functions which are called whenever the state of an AvahiSEntryGroup object changes */
-typedef void (*AvahiSEntryGroupCallback) (AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
-
-/** Iterate through all local entries of the server. (when g is NULL)
- * or of a specified entry group. At the first call state should point
- * to a NULL initialized void pointer, That pointer is used to track
- * the current iteration. It is not safe to call any other
- * avahi_server_xxx() function during the iteration. If the last entry
- * has been read, NULL is returned. */
-const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, void **state);
-
-/** Create a new entry group. The specified callback function is
- * called whenever the state of the group changes. Use entry group
- * objects to keep track of you RRs. Add new RRs to a group using
- * avahi_server_add_xxx(). Make sure to call avahi_s_entry_group_commit()
- * to start the registration process for your RRs */
-AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallback callback, void* userdata);
-
-/** Free an entry group. All RRs assigned to the group are removed from the server */
-void avahi_s_entry_group_free(AvahiSEntryGroup *g);
-
-/** Commit an entry group. This starts the probing and registration process for all RRs in the group */
-int avahi_s_entry_group_commit(AvahiSEntryGroup *g);
-
-/** Remove all entries from the entry group and reset the state to AVAHI_ENTRY_GROUP_UNCOMMITED. */
-void avahi_s_entry_group_reset(AvahiSEntryGroup *g);
-
-/** Return 1 if the entry group is empty, i.e. has no records attached. */
-int avahi_s_entry_group_is_empty(AvahiSEntryGroup *g);
-
-/** Return the current state of the specified entry group */
-AvahiEntryGroupState avahi_s_entry_group_get_state(AvahiSEntryGroup *g);
-
-/** Change the opaque user data pointer attached to an entry group object */
-void avahi_s_entry_group_set_data(AvahiSEntryGroup *g, void* userdata);
-
-/** Return the opaque user data pointer currently set for the entry group object */
-void* avahi_s_entry_group_get_data(AvahiSEntryGroup *g);
-
-/** Add a new resource record to the server. Returns 0 on success, negative otherwise. */
-int avahi_server_add(
- AvahiServer *s, /**< The server object to add this record to */
- AvahiSEntryGroup *g, /**< An entry group object if this new record shall be attached to one, or NULL. If you plan to remove the record sometime later you a required to pass an entry group object here. */
- AvahiIfIndex interface, /**< A numeric index of a network interface to attach this record to, or AVAHI_IF_UNSPEC to attach this record to all interfaces */
- AvahiProtocol protocol, /**< A protocol family to attach this record to. One of the AVAHI_PROTO_xxx constants. Use AVAHI_PROTO_UNSPEC to make this record available on all protocols (wich means on both IPv4 and IPv6). */
- AvahiPublishFlags flags, /**< Special flags for this record */
- AvahiRecord *r /**< The record to add. This function increases the reference counter of this object. */);
-
-/** Add an IP address mapping to the server. This will add both the
- * host-name-to-address and the reverse mapping to the server. See
- * avahi_server_add() for more information. If adding one of the RRs
- * fails, the function returns with an error, but it is not defined if
- * the other RR is deleted from the server or not. Therefore, you have
- * to free the AvahiSEntryGroup and create a new one before
- * proceeding. */
-int avahi_server_add_address(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- AvahiAddress *a);
-
-/** Add an DNS-SD service to the Server. This will add all required
- * RRs to the server. See avahi_server_add() for more information. If
- * adding one of the RRs fails, the function returns with an error,
- * but it is not defined if the other RR is deleted from the server or
- * not. Therefore, you have to free the AvahiSEntryGroup and create a
- * new one before proceeding. */
-int avahi_server_add_service(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name, /**< Service name, e.g. "Lennart's Files" */
- const char *type, /**< DNS-SD type, e.g. "_http._tcp" */
- const char *domain,
- const char *host, /**< Host name where this servcie resides, or NULL if on the local host */
- uint16_t port, /**< Port number of the service */
- ... /**< Text records, terminated by NULL */) AVAHI_GCC_SENTINEL;
-
-/** Mostly identical to avahi_server_add_service(), but takes an AvahiStringList object for the TXT records. The AvahiStringList object is copied. */
-int avahi_server_add_service_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- const char *host,
- uint16_t port,
- AvahiStringList *strlst);
-
-/** Add a subtype for an already existing service */
-int avahi_server_add_service_subtype(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name, /**< Specify the name of main service you already added here */
- const char *type, /**< Specify the main type of the service you already added here */
- const char *domain, /**< Specify the main type of the service you already added here */
- const char *subtype /**< The new subtype for the specified service */ );
-
-/** Update the TXT record for a service with the data from the specified string list */
-int avahi_server_update_service_txt_strlst(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- AvahiStringList *strlst);
-
-/** Update the TXT record for a service with the NULL termonate list of strings */
-int avahi_server_update_service_txt(
- AvahiServer *s,
- AvahiSEntryGroup *g,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
- ...) AVAHI_GCC_SENTINEL;
-
-/** Check if there is a service locally defined and return the entry group it is attached to. Returns NULL if the service isn't local*/
-int avahi_server_get_group_of_service(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiSEntryGroup** ret_group);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/querier-test.c b/trunk/avahi-core/querier-test.c
deleted file mode 100644
index 1c28ea0..0000000
--- a/trunk/avahi-core/querier-test.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-
-#define DOMAIN NULL
-#define SERVICE_TYPE "_http._tcp"
-
-static AvahiSServiceBrowser *service_browser1 = NULL, *service_browser2 = NULL;
-static const AvahiPoll * poll_api = NULL;
-static AvahiServer *server = NULL;
-static AvahiSimplePoll *simple_poll;
-
-static const char *browser_event_to_string(AvahiBrowserEvent event) {
- switch (event) {
- case AVAHI_BROWSER_NEW : return "NEW";
- case AVAHI_BROWSER_REMOVE : return "REMOVE";
- case AVAHI_BROWSER_CACHE_EXHAUSTED : return "CACHE_EXHAUSTED";
- case AVAHI_BROWSER_ALL_FOR_NOW : return "ALL_FOR_NOW";
- case AVAHI_BROWSER_FAILURE : return "FAILURE";
- }
-
- abort();
-}
-
-static void sb_callback(
- AvahiSServiceBrowser *b,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *service_type,
- const char *domain,
- AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("SB%i: (%i.%s) <%s> as <%s> in <%s> [%s] cached=%i", b == service_browser1 ? 1 : 2, iface, avahi_proto_to_string(protocol), name, service_type, domain, browser_event_to_string(event), !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
-}
-
-static void create_second_service_browser(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void* userdata) {
-
- service_browser2 = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, DOMAIN, 0, sb_callback, NULL);
- assert(service_browser2);
-
- poll_api->timeout_free(timeout);
-}
-
-static void quit(AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
- avahi_simple_poll_quit(simple_poll);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- struct timeval tv;
- AvahiServerConfig config;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- avahi_server_config_init(&config);
- config.publish_hinfo = 0;
- config.publish_addresses = 0;
- config.publish_workstation = 0;
- config.publish_domain = 0;
-
- avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
- config.n_wide_area_servers = 1;
- config.enable_wide_area = 1;
-
- server = avahi_server_new(poll_api, &config, NULL, NULL, NULL);
- assert(server);
- avahi_server_config_free(&config);
-
- service_browser1 = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, SERVICE_TYPE, DOMAIN, 0, sb_callback, NULL);
- assert(service_browser1);
-
- poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 10000, 0), create_second_service_browser, NULL);
-
- poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 60000, 0), quit, NULL);
-
-
- for (;;)
- if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
- break;
-
- avahi_server_free(server);
- avahi_simple_poll_free(simple_poll);
-
- return 0;
-}
diff --git a/trunk/avahi-core/querier.c b/trunk/avahi-core/querier.c
deleted file mode 100644
index 8a230cd..0000000
--- a/trunk/avahi-core/querier.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-
-#include "querier.h"
-#include "log.h"
-
-struct AvahiQuerier {
- AvahiInterface *interface;
-
- AvahiKey *key;
- int n_used;
-
- unsigned sec_delay;
-
- AvahiTimeEvent *time_event;
-
- struct timeval creation_time;
-
- unsigned post_id;
- int post_id_valid;
-
- AVAHI_LLIST_FIELDS(AvahiQuerier, queriers);
-};
-
-void avahi_querier_free(AvahiQuerier *q) {
- assert(q);
-
- AVAHI_LLIST_REMOVE(AvahiQuerier, queriers, q->interface->queriers, q);
- avahi_hashmap_remove(q->interface->queriers_by_key, q->key);
-
- avahi_key_unref(q->key);
- avahi_time_event_free(q->time_event);
-
- avahi_free(q);
-}
-
-static void querier_elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
- AvahiQuerier *q = userdata;
- struct timeval tv;
-
- assert(q);
-
- if (q->n_used <= 0) {
-
- /* We are not referenced by anyone anymore, so let's free
- * ourselves. We should not send out any further queries from
- * this querier object anymore. */
-
- avahi_querier_free(q);
- return;
- }
-
- if (avahi_interface_post_query(q->interface, q->key, 0, &q->post_id)) {
-
- /* The queue accepted our query. We store the query id here,
- * that allows us to drop the query at a later point if the
- * query is very short-lived. */
-
- q->post_id_valid = 1;
- }
-
- q->sec_delay *= 2;
-
- if (q->sec_delay >= 60*60) /* 1h */
- q->sec_delay = 60*60;
-
- avahi_elapse_time(&tv, q->sec_delay*1000, 0);
- avahi_time_event_update(q->time_event, &tv);
-}
-
-void avahi_querier_add(AvahiInterface *i, AvahiKey *key, struct timeval *ret_ctime) {
- AvahiQuerier *q;
- struct timeval tv;
-
- assert(i);
- assert(key);
-
- if ((q = avahi_hashmap_lookup(i->queriers_by_key, key))) {
-
- /* Someone is already browsing for records of this RR key */
- q->n_used++;
-
- /* Return the creation time. This is used for generating the
- * ALL_FOR_NOW event one second after the querier was
- * initially created. */
- if (ret_ctime)
- *ret_ctime = q->creation_time;
- return;
- }
-
- /* No one is browsing for this RR key, so we add a new querier */
- if (!(q = avahi_new(AvahiQuerier, 1)))
- return; /* OOM */
-
- q->key = avahi_key_ref(key);
- q->interface = i;
- q->n_used = 1;
- q->sec_delay = 1;
- q->post_id_valid = 0;
- gettimeofday(&q->creation_time, NULL);
-
- /* Do the initial query */
- if (avahi_interface_post_query(i, key, 0, &q->post_id))
- q->post_id_valid = 1;
-
- /* Schedule next queries */
- q->time_event = avahi_time_event_new(i->monitor->server->time_event_queue, avahi_elapse_time(&tv, q->sec_delay*1000, 0), querier_elapse_callback, q);
-
- AVAHI_LLIST_PREPEND(AvahiQuerier, queriers, i->queriers, q);
- avahi_hashmap_insert(i->queriers_by_key, q->key, q);
-
- /* Return the creation time. This is used for generating the
- * ALL_FOR_NOW event one second after the querier was initially
- * created. */
- if (ret_ctime)
- *ret_ctime = q->creation_time;
-}
-
-void avahi_querier_remove(AvahiInterface *i, AvahiKey *key) {
- AvahiQuerier *q;
-
- if (!(q = avahi_hashmap_lookup(i->queriers_by_key, key)) || q->n_used <= 0) {
- /* There was no querier for this RR key, or it wasn't referenced by anyone */
- avahi_log_warn(__FILE__": querier_remove() called but no querier to remove.");
- return;
- }
-
- if ((--q->n_used) <= 0) {
-
- /* Nobody references us anymore. */
-
- if (q->post_id_valid && avahi_interface_withraw_query(i, q->post_id)) {
-
- /* We succeeded in withdrawing our query from the queue,
- * so let's drop dead. */
-
- avahi_querier_free(q);
- }
-
- /* If we failed to withdraw our query from the queue, we stay
- * alive, in case someone else might recycle our querier at a
- * later point. We are freed at our next expiry, in case
- * nobody recycled us. */
- }
-}
-
-static void remove_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- assert(m);
- assert(i);
- assert(userdata);
-
- if (i->announcing)
- avahi_querier_remove(i, (AvahiKey*) userdata);
-}
-
-void avahi_querier_remove_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key) {
- assert(s);
- assert(key);
-
- avahi_interface_monitor_walk(s->monitor, idx, protocol, remove_querier_callback, key);
-}
-
-struct cbdata {
- AvahiKey *key;
- struct timeval *ret_ctime;
-};
-
-static void add_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
- struct cbdata *cbdata = userdata;
-
- assert(m);
- assert(i);
- assert(cbdata);
-
- if (i->announcing) {
- struct timeval tv;
- avahi_querier_add(i, cbdata->key, &tv);
-
- if (cbdata->ret_ctime && avahi_timeval_compare(&tv, cbdata->ret_ctime) > 0)
- *cbdata->ret_ctime = tv;
- }
-}
-
-void avahi_querier_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, struct timeval *ret_ctime) {
- struct cbdata cbdata;
-
- assert(s);
- assert(key);
-
- cbdata.key = key;
- cbdata.ret_ctime = ret_ctime;
-
- if (ret_ctime)
- ret_ctime->tv_sec = ret_ctime->tv_usec = 0;
-
- avahi_interface_monitor_walk(s->monitor, idx, protocol, add_querier_callback, &cbdata);
-}
-
-int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key) {
- AvahiQuerier *q;
-
- assert(i);
- assert(key);
-
- /* Called by the cache maintainer */
-
- if (!(q = avahi_hashmap_lookup(i->queriers_by_key, key)))
- /* This key is currently not subscribed at all, so no cache
- * refresh is needed */
- return 0;
-
- if (q->n_used <= 0) {
-
- /* If this is an entry nobody references right now, don't
- * consider it "existing". */
-
- /* Remove this querier since it is referenced by nobody
- * and the cached data will soon be out of date */
- avahi_querier_free(q);
-
- /* Tell the cache that no refresh is needed */
- return 0;
-
- } else {
- struct timeval tv;
-
- /* We can defer our query a little, since the cache will now
- * issue a refresh query anyway. */
- avahi_elapse_time(&tv, q->sec_delay*1000, 0);
- avahi_time_event_update(q->time_event, &tv);
-
- /* Tell the cache that a refresh should be issued */
- return 1;
- }
-}
-
-void avahi_querier_free_all(AvahiInterface *i) {
- assert(i);
-
- while (i->queriers)
- avahi_querier_free(i->queriers);
-}
diff --git a/trunk/avahi-core/querier.h b/trunk/avahi-core/querier.h
deleted file mode 100644
index 3f4eead..0000000
--- a/trunk/avahi-core/querier.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef fooquerierhfoo
-#define fooquerierhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiQuerier AvahiQuerier;
-
-#include "iface.h"
-
-/** Add querier for the specified key to the specified interface */
-void avahi_querier_add(AvahiInterface *i, AvahiKey *key, struct timeval *ret_ctime);
-
-/** Remove a querier for the specified key from the specified interface */
-void avahi_querier_remove(AvahiInterface *i, AvahiKey *key);
-
-/** Add a querier for the specified key on all interfaces that mach */
-void avahi_querier_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key, struct timeval *ret_ctime);
-
-/** Remove a querier for the specified key on all interfaces that mach */
-void avahi_querier_remove_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol protocol, AvahiKey *key);
-
-/** Free all queriers */
-void avahi_querier_free(AvahiQuerier *q);
-
-/** Free all queriers on the specified interface */
-void avahi_querier_free_all(AvahiInterface *i);
-
-/** Return 1 if there is a querier for the specified key on the specified interface */
-int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key);
-
-#endif
diff --git a/trunk/avahi-core/query-sched.c b/trunk/avahi-core/query-sched.c
deleted file mode 100644
index 0319b02..0000000
--- a/trunk/avahi-core/query-sched.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "query-sched.h"
-#include "log.h"
-
-#define AVAHI_QUERY_HISTORY_MSEC 100
-#define AVAHI_QUERY_DEFER_MSEC 100
-
-typedef struct AvahiQueryJob AvahiQueryJob;
-typedef struct AvahiKnownAnswer AvahiKnownAnswer;
-
-struct AvahiQueryJob {
- unsigned id;
- int n_posted;
-
- AvahiQueryScheduler *scheduler;
- AvahiTimeEvent *time_event;
-
- int done;
- struct timeval delivery;
-
- AvahiKey *key;
-
- /* Jobs are stored in a simple linked list. It might turn out in
- * the future that this list grows too long and we must switch to
- * some other kind of data structure. This needs further
- * investigation. I expect the list to be very short (< 20
- * entries) most of the time, but this might be a wrong
- * assumption, especially on setups where traffic reflection is
- * involved. */
-
- AVAHI_LLIST_FIELDS(AvahiQueryJob, jobs);
-};
-
-struct AvahiKnownAnswer {
- AvahiQueryScheduler *scheduler;
- AvahiRecord *record;
-
- AVAHI_LLIST_FIELDS(AvahiKnownAnswer, known_answer);
-};
-
-struct AvahiQueryScheduler {
- AvahiInterface *interface;
- AvahiTimeEventQueue *time_event_queue;
-
- unsigned next_id;
-
- AVAHI_LLIST_HEAD(AvahiQueryJob, jobs);
- AVAHI_LLIST_HEAD(AvahiQueryJob, history);
- AVAHI_LLIST_HEAD(AvahiKnownAnswer, known_answers);
-};
-
-static AvahiQueryJob* job_new(AvahiQueryScheduler *s, AvahiKey *key, int done) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- if (!(qj = avahi_new(AvahiQueryJob, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- qj->scheduler = s;
- qj->key = avahi_key_ref(key);
- qj->time_event = NULL;
- qj->n_posted = 1;
- qj->id = s->next_id++;
-
- if ((qj->done = done))
- AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->history, qj);
- else
- AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->jobs, qj);
-
- return qj;
-}
-
-static void job_free(AvahiQueryScheduler *s, AvahiQueryJob *qj) {
- assert(s);
- assert(qj);
-
- if (qj->time_event)
- avahi_time_event_free(qj->time_event);
-
- if (qj->done)
- AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->history, qj);
- else
- AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->jobs, qj);
-
- avahi_key_unref(qj->key);
- avahi_free(qj);
-}
-
-static void elapse_callback(AvahiTimeEvent *e, void* data);
-
-static void job_set_elapse_time(AvahiQueryScheduler *s, AvahiQueryJob *qj, unsigned msec, unsigned jitter) {
- struct timeval tv;
-
- assert(s);
- assert(qj);
-
- avahi_elapse_time(&tv, msec, jitter);
-
- if (qj->time_event)
- avahi_time_event_update(qj->time_event, &tv);
- else
- qj->time_event = avahi_time_event_new(s->time_event_queue, &tv, elapse_callback, qj);
-}
-
-static void job_mark_done(AvahiQueryScheduler *s, AvahiQueryJob *qj) {
- assert(s);
- assert(qj);
-
- assert(!qj->done);
-
- AVAHI_LLIST_REMOVE(AvahiQueryJob, jobs, s->jobs, qj);
- AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->history, qj);
-
- qj->done = 1;
-
- job_set_elapse_time(s, qj, AVAHI_QUERY_HISTORY_MSEC, 0);
- gettimeofday(&qj->delivery, NULL);
-}
-
-AvahiQueryScheduler *avahi_query_scheduler_new(AvahiInterface *i) {
- AvahiQueryScheduler *s;
- assert(i);
-
- if (!(s = avahi_new(AvahiQueryScheduler, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL; /* OOM */
- }
-
- s->interface = i;
- s->time_event_queue = i->monitor->server->time_event_queue;
- s->next_id = 0;
-
- AVAHI_LLIST_HEAD_INIT(AvahiQueryJob, s->jobs);
- AVAHI_LLIST_HEAD_INIT(AvahiQueryJob, s->history);
- AVAHI_LLIST_HEAD_INIT(AvahiKnownAnswer, s->known_answers);
-
- return s;
-}
-
-void avahi_query_scheduler_free(AvahiQueryScheduler *s) {
- assert(s);
-
- assert(!s->known_answers);
- avahi_query_scheduler_clear(s);
- avahi_free(s);
-}
-
-void avahi_query_scheduler_clear(AvahiQueryScheduler *s) {
- assert(s);
-
- while (s->jobs)
- job_free(s, s->jobs);
- while (s->history)
- job_free(s, s->history);
-}
-
-static void* known_answer_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
- AvahiQueryScheduler *s = userdata;
- AvahiKnownAnswer *ka;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(s);
-
- if (avahi_cache_entry_half_ttl(c, e))
- return NULL;
-
- if (!(ka = avahi_new0(AvahiKnownAnswer, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- ka->scheduler = s;
- ka->record = avahi_record_ref(e->record);
-
- AVAHI_LLIST_PREPEND(AvahiKnownAnswer, known_answer, s->known_answers, ka);
- return NULL;
-}
-
-static int packet_add_query_job(AvahiQueryScheduler *s, AvahiDnsPacket *p, AvahiQueryJob *qj) {
- assert(s);
- assert(p);
- assert(qj);
-
- if (!avahi_dns_packet_append_key(p, qj->key, 0))
- return 0;
-
- /* Add all matching known answers to the list */
- avahi_cache_walk(s->interface->cache, qj->key, known_answer_walk_callback, s);
-
- job_mark_done(s, qj);
-
- return 1;
-}
-
-static void append_known_answers_and_send(AvahiQueryScheduler *s, AvahiDnsPacket *p) {
- AvahiKnownAnswer *ka;
- unsigned n;
- assert(s);
- assert(p);
-
- n = 0;
-
- while ((ka = s->known_answers)) {
- int too_large = 0;
-
- while (!avahi_dns_packet_append_record(p, ka->record, 0, 0)) {
-
- if (avahi_dns_packet_is_empty(p)) {
- /* The record is too large to fit into one packet, so
- there's no point in sending it. Better is letting
- the owner of the record send it as a response. This
- has the advantage of a cache refresh. */
-
- too_large = 1;
- break;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_FLAGS, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) | AVAHI_DNS_FLAG_TC);
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ANCOUNT, n);
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-
- p = avahi_dns_packet_new_query(s->interface->hardware->mtu);
- n = 0;
- }
-
- AVAHI_LLIST_REMOVE(AvahiKnownAnswer, known_answer, s->known_answers, ka);
- avahi_record_unref(ka->record);
- avahi_free(ka);
-
- if (!too_large)
- n++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ANCOUNT, n);
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-}
-
-static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
- AvahiQueryJob *qj = data;
- AvahiQueryScheduler *s;
- AvahiDnsPacket *p;
- unsigned n;
- int b;
-
- assert(qj);
- s = qj->scheduler;
-
- if (qj->done) {
- /* Lets remove it from the history */
- job_free(s, qj);
- return;
- }
-
- assert(!s->known_answers);
-
- if (!(p = avahi_dns_packet_new_query(s->interface->hardware->mtu)))
- return; /* OOM */
-
- b = packet_add_query_job(s, p, qj);
- assert(b); /* An query must always fit in */
- n = 1;
-
- /* Try to fill up packet with more queries, if available */
- while (s->jobs) {
-
- if (!packet_add_query_job(s, p, s->jobs))
- break;
-
- n++;
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_QDCOUNT, n);
-
- /* Now add known answers */
- append_known_answers_and_send(s, p);
-}
-
-static AvahiQueryJob* find_scheduled_job(AvahiQueryScheduler *s, AvahiKey *key) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- for (qj = s->jobs; qj; qj = qj->jobs_next) {
- assert(!qj->done);
-
- if (avahi_key_equal(qj->key, key))
- return qj;
- }
-
- return NULL;
-}
-
-static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- for (qj = s->history; qj; qj = qj->jobs_next) {
- assert(qj->done);
-
- if (avahi_key_equal(qj->key, key)) {
- /* Check whether this entry is outdated */
-
- if (avahi_age(&qj->delivery) > AVAHI_QUERY_HISTORY_MSEC*1000) {
- /* it is outdated, so let's remove it */
- job_free(s, qj);
- return NULL;
- }
-
- return qj;
- }
- }
-
- return NULL;
-}
-
-int avahi_query_scheduler_post(AvahiQueryScheduler *s, AvahiKey *key, int immediately, unsigned *ret_id) {
- struct timeval tv;
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- if ((qj = find_history_job(s, key)))
- return 0;
-
- avahi_elapse_time(&tv, immediately ? 0 : AVAHI_QUERY_DEFER_MSEC, 0);
-
- if ((qj = find_scheduled_job(s, key))) {
- /* Duplicate questions suppression */
-
- if (avahi_timeval_compare(&tv, &qj->delivery) < 0) {
- /* If the new entry should be scheduled earlier,
- * update the old entry */
- qj->delivery = tv;
- avahi_time_event_update(qj->time_event, &qj->delivery);
- }
-
- qj->n_posted++;
-
- } else {
-
- if (!(qj = job_new(s, key, 0)))
- return 0; /* OOM */
-
- qj->delivery = tv;
- qj->time_event = avahi_time_event_new(s->time_event_queue, &qj->delivery, elapse_callback, qj);
- }
-
- if (ret_id)
- *ret_id = qj->id;
-
- return 1;
-}
-
-void avahi_query_scheduler_incoming(AvahiQueryScheduler *s, AvahiKey *key) {
- AvahiQueryJob *qj;
-
- assert(s);
- assert(key);
-
- /* This function is called whenever an incoming query was
- * received. We drop scheduled queries that match. The keyword is
- * "DUPLICATE QUESTION SUPPRESION". */
-
- if ((qj = find_scheduled_job(s, key))) {
- job_mark_done(s, qj);
- return;
- }
-
- /* Look if there's a history job for this key. If there is, just
- * update the elapse time */
- if (!(qj = find_history_job(s, key)))
- if (!(qj = job_new(s, key, 1)))
- return; /* OOM */
-
- gettimeofday(&qj->delivery, NULL);
- job_set_elapse_time(s, qj, AVAHI_QUERY_HISTORY_MSEC, 0);
-}
-
-int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id) {
- AvahiQueryJob *qj;
-
- assert(s);
-
- /* Very short lived queries can withdraw an already scheduled item
- * from the queue using this function, simply by passing the id
- * returned by avahi_query_scheduler_post(). */
-
- for (qj = s->jobs; qj; qj = qj->jobs_next) {
- assert(!qj->done);
-
- if (qj->id == id) {
- /* Entry found */
-
- assert(qj->n_posted >= 1);
-
- if (--qj->n_posted <= 0) {
-
- /* We withdraw this job only if the calling object was
- * the only remaining poster. (Usually this is the
- * case since there should exist only one querier per
- * key, but there are exceptions, notably reflected
- * traffic.) */
-
- job_free(s, qj);
- return 1;
- }
- }
- }
-
- return 0;
-}
diff --git a/trunk/avahi-core/query-sched.h b/trunk/avahi-core/query-sched.h
deleted file mode 100644
index 5238558..0000000
--- a/trunk/avahi-core/query-sched.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef fooqueryschedhfoo
-#define fooqueryschedhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiQueryScheduler AvahiQueryScheduler;
-
-#include <avahi-common/address.h>
-#include "iface.h"
-
-AvahiQueryScheduler *avahi_query_scheduler_new(AvahiInterface *i);
-void avahi_query_scheduler_free(AvahiQueryScheduler *s);
-void avahi_query_scheduler_clear(AvahiQueryScheduler *s);
-
-int avahi_query_scheduler_post(AvahiQueryScheduler *s, AvahiKey *key, int immediately, unsigned *ret_id);
-int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id);
-void avahi_query_scheduler_incoming(AvahiQueryScheduler *s, AvahiKey *key);
-
-#endif
diff --git a/trunk/avahi-core/resolve-address.c b/trunk/avahi-core/resolve-address.c
deleted file mode 100644
index 25d21ac..0000000
--- a/trunk/avahi-core/resolve-address.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-
-#include "browse.h"
-
-#define TIMEOUT_MSEC 5000
-
-struct AvahiSAddressResolver {
- AvahiServer *server;
- AvahiAddress address;
-
- AvahiSRecordBrowser *record_browser;
-
- AvahiSAddressResolverCallback callback;
- void* userdata;
-
- AvahiRecord *ptr_record;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupResultFlags flags;
-
- int retry_with_multicast;
- AvahiKey *key;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiSAddressResolver, resolver);
-};
-
-static void finish(AvahiSAddressResolver *r, AvahiResolverEvent event) {
- assert(r);
-
- if (r->time_event) {
- avahi_time_event_free(r->time_event);
- r->time_event = NULL;
- }
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
- r->callback(r, r->interface, r->protocol, event, &r->address, NULL, r->flags, r->userdata);
- break;
-
- case AVAHI_RESOLVER_FOUND:
- assert(r->ptr_record);
- r->callback(r, r->interface, r->protocol, event, &r->address, r->ptr_record->data.ptr.name, r->flags, r->userdata);
- break;
- }
-}
-
-static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSAddressResolver *r = userdata;
-
- assert(e);
- assert(r);
-
- avahi_server_set_errno(r->server, AVAHI_ERR_TIMEOUT);
- finish(r, AVAHI_RESOLVER_FAILURE);
-}
-
-static void start_timeout(AvahiSAddressResolver *r) {
- struct timeval tv;
- assert(r);
-
- if (r->time_event)
- return;
-
- avahi_elapse_time(&tv, TIMEOUT_MSEC, 0);
- r->time_event = avahi_time_event_new(r->server->time_event_queue, &tv, time_event_callback, r);
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSAddressResolver *r = userdata;
-
- assert(rr);
- assert(r);
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (r->interface > 0 && interface != r->interface)
- return;
-
- if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
- return;
-
- if (r->interface <= 0)
- r->interface = interface;
-
- if (r->protocol == AVAHI_PROTO_UNSPEC)
- r->protocol = protocol;
-
- if (!r->ptr_record) {
- r->ptr_record = avahi_record_ref(record);
- r->flags = flags;
-
- finish(r, AVAHI_RESOLVER_FOUND);
- }
- break;
-
- case AVAHI_BROWSER_REMOVE:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_PTR);
-
- if (r->ptr_record && avahi_record_equal_no_ttl(record, r->ptr_record)) {
- avahi_record_unref(r->ptr_record);
- r->ptr_record = NULL;
- r->flags = flags;
-
- /** Look for a replacement */
- avahi_s_record_browser_restart(r->record_browser);
- start_timeout(r);
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE:
-
- if (r->retry_with_multicast) {
- r->retry_with_multicast = 0;
-
- avahi_s_record_browser_free(r->record_browser);
- r->record_browser = avahi_s_record_browser_new(r->server, r->interface, r->protocol, r->key, AVAHI_LOOKUP_USE_MULTICAST, record_browser_callback, r);
-
- if (r->record_browser) {
- start_timeout(r);
- break;
- }
- }
-
- r->flags = flags;
- finish(r, AVAHI_RESOLVER_FAILURE);
- break;
- }
-}
-
-AvahiSAddressResolver *avahi_s_address_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const AvahiAddress *address,
- AvahiLookupFlags flags,
- AvahiSAddressResolverCallback callback,
- void* userdata) {
-
- AvahiSAddressResolver *r;
- AvahiKey *k;
- char n[AVAHI_DOMAIN_NAME_MAX];
-
- assert(server);
- assert(address);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, address->proto == AVAHI_PROTO_INET || address->proto == AVAHI_PROTO_INET6, AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- avahi_reverse_lookup_name(address, n, sizeof(n));
-
- if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- if (!(r = avahi_new(AvahiSAddressResolver, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- avahi_key_unref(k);
- return NULL;
- }
-
- r->server = server;
- r->address = *address;
- r->callback = callback;
- r->userdata = userdata;
- r->ptr_record = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->flags = 0;
- r->retry_with_multicast = 0;
- r->key = k;
-
- r->record_browser = NULL;
- AVAHI_LLIST_PREPEND(AvahiSAddressResolver, resolver, server->address_resolvers, r);
-
- r->time_event = NULL;
-
- if (!(flags & (AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_USE_WIDE_AREA))) {
-
- if (!server->wide_area_lookup_engine || !avahi_wide_area_has_servers(server->wide_area_lookup_engine))
- flags |= AVAHI_LOOKUP_USE_MULTICAST;
- else {
- flags |= AVAHI_LOOKUP_USE_WIDE_AREA;
- r->retry_with_multicast = 1;
- }
- }
-
- r->record_browser = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, r);
-
- if (!r->record_browser) {
- avahi_s_address_resolver_free(r);
- return NULL;
- }
-
- start_timeout(r);
-
- return r;
-}
-
-void avahi_s_address_resolver_free(AvahiSAddressResolver *r) {
- assert(r);
-
- AVAHI_LLIST_REMOVE(AvahiSAddressResolver, resolver, r->server->address_resolvers, r);
-
- if (r->record_browser)
- avahi_s_record_browser_free(r->record_browser);
-
- if (r->time_event)
- avahi_time_event_free(r->time_event);
-
- if (r->ptr_record)
- avahi_record_unref(r->ptr_record);
-
- if (r->key)
- avahi_key_unref(r->key);
-
- avahi_free(r);
-}
diff --git a/trunk/avahi-core/resolve-host-name.c b/trunk/avahi-core/resolve-host-name.c
deleted file mode 100644
index 59dc3cf..0000000
--- a/trunk/avahi-core/resolve-host-name.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-#define TIMEOUT_MSEC 5000
-
-struct AvahiSHostNameResolver {
- AvahiServer *server;
- char *host_name;
-
- AvahiSRecordBrowser *record_browser_a;
- AvahiSRecordBrowser *record_browser_aaaa;
-
- AvahiSHostNameResolverCallback callback;
- void* userdata;
-
- AvahiRecord *address_record;
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- AvahiLookupResultFlags flags;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiSHostNameResolver, resolver);
-};
-
-static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
- assert(r);
-
- if (r->time_event) {
- avahi_time_event_free(r->time_event);
- r->time_event = NULL;
- }
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- AvahiAddress a;
-
- assert(r->address_record);
-
- switch (r->address_record->key->type) {
- case AVAHI_DNS_TYPE_A:
- a.proto = AVAHI_PROTO_INET;
- a.data.ipv4 = r->address_record->data.a.address;
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- a.proto = AVAHI_PROTO_INET6;
- a.data.ipv6 = r->address_record->data.aaaa.address;
- break;
-
- default:
- abort();
- }
-
- r->callback(r, r->interface, r->protocol, AVAHI_RESOLVER_FOUND, r->address_record->key->name, &a, r->flags, r->userdata);
- break;
-
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- r->callback(r, r->interface, r->protocol, event, r->host_name, NULL, r->flags, r->userdata);
- break;
- }
-}
-
-static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSHostNameResolver *r = userdata;
-
- assert(e);
- assert(r);
-
- avahi_server_set_errno(r->server, AVAHI_ERR_TIMEOUT);
- finish(r, AVAHI_RESOLVER_FAILURE);
-}
-
-static void start_timeout(AvahiSHostNameResolver *r) {
- struct timeval tv;
- assert(r);
-
- if (r->time_event)
- return;
-
- avahi_elapse_time(&tv, TIMEOUT_MSEC, 0);
-
- r->time_event = avahi_time_event_new(r->server->time_event_queue, &tv, time_event_callback, r);
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSHostNameResolver *r = userdata;
-
- assert(rr);
- assert(r);
-
-
- switch (event) {
- case AVAHI_BROWSER_NEW:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_A || record->key->type == AVAHI_DNS_TYPE_AAAA);
-
- if (r->interface > 0 && interface != r->interface)
- return;
-
- if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
- return;
-
- if (r->interface <= 0)
- r->interface = interface;
-
- if (r->protocol == AVAHI_PROTO_UNSPEC)
- r->protocol = protocol;
-
- if (!r->address_record) {
- r->address_record = avahi_record_ref(record);
- r->flags = flags;
-
- finish(r, AVAHI_RESOLVER_FOUND);
- }
-
- break;
-
- case AVAHI_BROWSER_REMOVE:
- assert(record);
- assert(record->key->type == AVAHI_DNS_TYPE_A || record->key->type == AVAHI_DNS_TYPE_AAAA);
-
- if (r->address_record && avahi_record_equal_no_ttl(record, r->address_record)) {
- avahi_record_unref(r->address_record);
- r->address_record = NULL;
-
- r->flags = flags;
-
-
- /** Look for a replacement */
- if (r->record_browser_aaaa)
- avahi_s_record_browser_restart(r->record_browser_aaaa);
- if (r->record_browser_a)
- avahi_s_record_browser_restart(r->record_browser_a);
-
- start_timeout(r);
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- /* Ignore */
- break;
-
- case AVAHI_BROWSER_FAILURE:
-
- /* Stop browsers */
-
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
-
- r->record_browser_a = r->record_browser_aaaa = NULL;
- r->flags = flags;
-
- finish(r, AVAHI_RESOLVER_FAILURE);
- break;
- }
-}
-
-AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *host_name,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiSHostNameResolverCallback callback,
- void* userdata) {
-
- AvahiSHostNameResolver *r;
- AvahiKey *k;
-
- assert(server);
- assert(host_name);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_is_valid_fqdn(host_name), AVAHI_ERR_INVALID_HOST_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(aprotocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST), AVAHI_ERR_INVALID_FLAGS);
-
- if (!(r = avahi_new(AvahiSHostNameResolver, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->server = server;
- r->host_name = avahi_normalize_name_strdup(host_name);
- r->callback = callback;
- r->userdata = userdata;
- r->address_record = NULL;
- r->interface = interface;
- r->protocol = protocol;
- r->flags = 0;
-
- r->record_browser_a = r->record_browser_aaaa = NULL;
-
- r->time_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiSHostNameResolver, resolver, server->host_name_resolvers, r);
-
- r->record_browser_aaaa = r->record_browser_a = NULL;
-
- if (aprotocol == AVAHI_PROTO_INET || aprotocol == AVAHI_PROTO_UNSPEC) {
- k = avahi_key_new(host_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A);
- r->record_browser_a = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_a)
- goto fail;
- }
-
- if (aprotocol == AVAHI_PROTO_INET6 || aprotocol == AVAHI_PROTO_UNSPEC) {
- k = avahi_key_new(host_name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA);
- r->record_browser_aaaa = avahi_s_record_browser_new(server, interface, protocol, k, flags, record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_aaaa)
- goto fail;
- }
-
- assert(r->record_browser_aaaa || r->record_browser_a);
-
- start_timeout(r);
-
- return r;
-
-fail:
- avahi_s_host_name_resolver_free(r);
- return NULL;
-}
-
-void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r) {
- assert(r);
-
- AVAHI_LLIST_REMOVE(AvahiSHostNameResolver, resolver, r->server->host_name_resolvers, r);
-
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
-
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
-
- if (r->time_event)
- avahi_time_event_free(r->time_event);
-
- if (r->address_record)
- avahi_record_unref(r->address_record);
-
- avahi_free(r->host_name);
- avahi_free(r);
-}
diff --git a/trunk/avahi-core/resolve-service.c b/trunk/avahi-core/resolve-service.c
deleted file mode 100644
index 1ad6078..0000000
--- a/trunk/avahi-core/resolve-service.c
+++ /dev/null
@@ -1,491 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "browse.h"
-#include "log.h"
-
-#define TIMEOUT_MSEC 5000
-
-struct AvahiSServiceResolver {
- AvahiServer *server;
- char *service_name;
- char *service_type;
- char *domain_name;
- AvahiProtocol address_protocol;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- AvahiSRecordBrowser *record_browser_srv;
- AvahiSRecordBrowser *record_browser_txt;
- AvahiSRecordBrowser *record_browser_a;
- AvahiSRecordBrowser *record_browser_aaaa;
-
- AvahiRecord *srv_record, *txt_record, *address_record;
- AvahiLookupResultFlags srv_flags, txt_flags, address_flags;
-
- AvahiSServiceResolverCallback callback;
- void* userdata;
- AvahiLookupFlags user_flags;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiSServiceResolver, resolver);
-};
-
-static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
- AvahiLookupResultFlags flags;
-
- assert(r);
-
- if (r->time_event) {
- avahi_time_event_free(r->time_event);
- r->time_event = NULL;
- }
-
- flags =
- r->txt_flags |
- r->srv_flags |
- r->address_flags;
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
-
- r->callback(
- r,
- r->interface,
- r->protocol,
- event,
- r->service_name,
- r->service_type,
- r->domain_name,
- NULL,
- NULL,
- 0,
- NULL,
- flags,
- r->userdata);
-
- break;
-
- case AVAHI_RESOLVER_FOUND: {
- AvahiAddress a;
-
- assert(event == AVAHI_RESOLVER_FOUND);
-
- assert(r->srv_record);
-
- if (r->address_record) {
- switch (r->address_record->key->type) {
- case AVAHI_DNS_TYPE_A:
- a.proto = AVAHI_PROTO_INET;
- a.data.ipv4 = r->address_record->data.a.address;
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- a.proto = AVAHI_PROTO_INET6;
- a.data.ipv6 = r->address_record->data.aaaa.address;
- break;
-
- default:
- assert(0);
- }
- }
-
- r->callback(
- r,
- r->interface,
- r->protocol,
- event,
- r->service_name,
- r->service_type,
- r->domain_name,
- r->srv_record->data.srv.name,
- r->address_record ? &a : NULL,
- r->srv_record->data.srv.port,
- r->txt_record ? r->txt_record->data.txt.string_list : NULL,
- flags,
- r->userdata);
-
- break;
- }
- }
-}
-
-static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiSServiceResolver *r = userdata;
-
- assert(e);
- assert(r);
-
- avahi_server_set_errno(r->server, AVAHI_ERR_TIMEOUT);
- finish(r, AVAHI_RESOLVER_FAILURE);
-}
-
-static void start_timeout(AvahiSServiceResolver *r) {
- struct timeval tv;
- assert(r);
-
- if (r->time_event)
- return;
-
- avahi_elapse_time(&tv, TIMEOUT_MSEC, 0);
-
- r->time_event = avahi_time_event_new(r->server->time_event_queue, &tv, time_event_callback, r);
-}
-
-static void record_browser_callback(
- AvahiSRecordBrowser*rr,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiSServiceResolver *r = userdata;
-
- assert(rr);
- assert(r);
-
- if (rr == r->record_browser_aaaa || rr == r->record_browser_a)
- r->address_flags = flags;
- else if (rr == r->record_browser_srv)
- r->srv_flags = flags;
- else if (rr == r->record_browser_txt)
- r->txt_flags = flags;
-
- switch (event) {
-
- case AVAHI_BROWSER_NEW: {
- int changed = 0;
- assert(record);
-
- if (r->interface > 0 && interface > 0 && interface != r->interface)
- return;
-
- if (r->protocol != AVAHI_PROTO_UNSPEC && protocol != AVAHI_PROTO_UNSPEC && protocol != r->protocol)
- return;
-
- if (r->interface <= 0)
- r->interface = interface;
-
- if (r->protocol == AVAHI_PROTO_UNSPEC)
- r->protocol = protocol;
-
- switch (record->key->type) {
- case AVAHI_DNS_TYPE_SRV:
- if (!r->srv_record) {
- r->srv_record = avahi_record_ref(record);
- changed = 1;
-
- if (r->record_browser_a) {
- avahi_s_record_browser_free(r->record_browser_a);
- r->record_browser_a = NULL;
- }
-
- if (r->record_browser_aaaa) {
- avahi_s_record_browser_free(r->record_browser_aaaa);
- r->record_browser_aaaa = NULL;
- }
-
- if (!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS)) {
-
- if (r->address_protocol == AVAHI_PROTO_INET || r->address_protocol == AVAHI_PROTO_UNSPEC) {
- AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_A);
- r->record_browser_a = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, r->user_flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
- }
-
- if (r->address_protocol == AVAHI_PROTO_INET6 || r->address_protocol == AVAHI_PROTO_UNSPEC) {
- AvahiKey *k = avahi_key_new(r->srv_record->data.srv.name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_AAAA);
- r->record_browser_aaaa = avahi_s_record_browser_new(r->server, r->interface, r->protocol, k, r->user_flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
- }
- }
- }
- break;
-
- case AVAHI_DNS_TYPE_TXT:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_TXT));
-
- if (!r->txt_record) {
- r->txt_record = avahi_record_ref(record);
- changed = 1;
- }
- break;
-
- case AVAHI_DNS_TYPE_A:
- case AVAHI_DNS_TYPE_AAAA:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS));
-
- if (!r->address_record) {
- r->address_record = avahi_record_ref(record);
- changed = 1;
- }
- break;
-
- default:
- abort();
- }
-
-
- if (changed &&
- r->srv_record &&
- (r->txt_record || (r->user_flags & AVAHI_LOOKUP_NO_TXT)) &&
- (r->address_record || (r->user_flags & AVAHI_LOOKUP_NO_ADDRESS)))
- finish(r, AVAHI_RESOLVER_FOUND);
-
- break;
-
- }
-
- case AVAHI_BROWSER_REMOVE:
-
- assert(record);
-
- switch (record->key->type) {
- case AVAHI_DNS_TYPE_SRV:
-
- if (r->srv_record && avahi_record_equal_no_ttl(record, r->srv_record)) {
- avahi_record_unref(r->srv_record);
- r->srv_record = NULL;
-
- if (r->record_browser_a) {
- avahi_s_record_browser_free(r->record_browser_a);
- r->record_browser_a = NULL;
- }
-
- if (r->record_browser_aaaa) {
- avahi_s_record_browser_free(r->record_browser_aaaa);
- r->record_browser_aaaa = NULL;
- }
-
- /** Look for a replacement */
- avahi_s_record_browser_restart(r->record_browser_srv);
- start_timeout(r);
- }
-
- break;
-
- case AVAHI_DNS_TYPE_TXT:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_TXT));
-
- if (r->txt_record && avahi_record_equal_no_ttl(record, r->txt_record)) {
- avahi_record_unref(r->txt_record);
- r->txt_record = NULL;
-
- /** Look for a replacement */
- avahi_s_record_browser_restart(r->record_browser_txt);
- start_timeout(r);
- }
- break;
-
- case AVAHI_DNS_TYPE_A:
- case AVAHI_DNS_TYPE_AAAA:
-
- assert(!(r->user_flags & AVAHI_LOOKUP_NO_ADDRESS));
-
- if (r->address_record && avahi_record_equal_no_ttl(record, r->address_record)) {
- avahi_record_unref(r->address_record);
- r->address_record = NULL;
-
- /** Look for a replacement */
- if (r->record_browser_aaaa)
- avahi_s_record_browser_restart(r->record_browser_aaaa);
- if (r->record_browser_a)
- avahi_s_record_browser_restart(r->record_browser_a);
- start_timeout(r);
- }
- break;
-
- default:
- abort();
- }
-
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- case AVAHI_BROWSER_ALL_FOR_NOW:
- break;
-
- case AVAHI_BROWSER_FAILURE:
-
- if (rr == r->record_browser_a && r->record_browser_aaaa) {
- /* We were looking for both AAAA and A, and the other query is still living, so we'll not die */
- avahi_s_record_browser_free(r->record_browser_a);
- r->record_browser_a = NULL;
- break;
- }
-
- if (rr == r->record_browser_aaaa && r->record_browser_a) {
- /* We were looking for both AAAA and A, and the other query is still living, so we'll not die */
- avahi_s_record_browser_free(r->record_browser_aaaa);
- r->record_browser_aaaa = NULL;
- break;
- }
-
- /* Hmm, everything's lost, tell the user */
-
- if (r->record_browser_srv)
- avahi_s_record_browser_free(r->record_browser_srv);
- if (r->record_browser_txt)
- avahi_s_record_browser_free(r->record_browser_txt);
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
-
- r->record_browser_srv = r->record_browser_txt = r->record_browser_a = r->record_browser_aaaa = NULL;
-
- finish(r, AVAHI_RESOLVER_FAILURE);
- break;
- }
-}
-
-AvahiSServiceResolver *avahi_s_service_resolver_new(
- AvahiServer *server,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char *name,
- const char *type,
- const char *domain,
- AvahiProtocol aprotocol,
- AvahiLookupFlags flags,
- AvahiSServiceResolverCallback callback,
- void* userdata) {
-
- AvahiSServiceResolver *r;
- AvahiKey *k;
- char n[AVAHI_DOMAIN_NAME_MAX];
- int ret;
-
- assert(server);
- assert(type);
- assert(callback);
-
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_PROTO_VALID(aprotocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, !name || avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY_RETURN_NULL(server, AVAHI_FLAGS_VALID(flags, AVAHI_LOOKUP_USE_WIDE_AREA|AVAHI_LOOKUP_USE_MULTICAST|AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), AVAHI_ERR_INVALID_FLAGS);
-
- if (!domain)
- domain = server->domain_name;
-
- if ((ret = avahi_service_name_join(n, sizeof(n), name, type, domain)) < 0) {
- avahi_server_set_errno(server, ret);
- return NULL;
- }
-
- if (!(r = avahi_new(AvahiSServiceResolver, 1))) {
- avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY);
- return NULL;
- }
-
- r->server = server;
- r->service_name = avahi_strdup(name);
- r->service_type = avahi_normalize_name_strdup(type);
- r->domain_name = avahi_normalize_name_strdup(domain);
- r->callback = callback;
- r->userdata = userdata;
- r->address_protocol = aprotocol;
- r->srv_record = r->txt_record = r->address_record = NULL;
- r->srv_flags = r->txt_flags = r->address_flags = 0;
- r->interface = interface;
- r->protocol = protocol;
- r->user_flags = flags;
- r->record_browser_a = r->record_browser_aaaa = r->record_browser_srv = r->record_browser_txt = NULL;
- r->time_event = NULL;
- AVAHI_LLIST_PREPEND(AvahiSServiceResolver, resolver, server->service_resolvers, r);
-
- k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV);
- r->record_browser_srv = avahi_s_record_browser_new(server, interface, protocol, k, flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_srv) {
- avahi_s_service_resolver_free(r);
- return NULL;
- }
-
- if (!(flags & AVAHI_LOOKUP_NO_TXT)) {
- k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_TXT);
- r->record_browser_txt = avahi_s_record_browser_new(server, interface, protocol, k, flags & ~(AVAHI_LOOKUP_NO_TXT|AVAHI_LOOKUP_NO_ADDRESS), record_browser_callback, r);
- avahi_key_unref(k);
-
- if (!r->record_browser_txt) {
- avahi_s_service_resolver_free(r);
- return NULL;
- }
- }
-
- start_timeout(r);
-
- return r;
-}
-
-void avahi_s_service_resolver_free(AvahiSServiceResolver *r) {
- assert(r);
-
- AVAHI_LLIST_REMOVE(AvahiSServiceResolver, resolver, r->server->service_resolvers, r);
-
- if (r->time_event)
- avahi_time_event_free(r->time_event);
-
- if (r->record_browser_srv)
- avahi_s_record_browser_free(r->record_browser_srv);
- if (r->record_browser_txt)
- avahi_s_record_browser_free(r->record_browser_txt);
- if (r->record_browser_a)
- avahi_s_record_browser_free(r->record_browser_a);
- if (r->record_browser_aaaa)
- avahi_s_record_browser_free(r->record_browser_aaaa);
-
- if (r->srv_record)
- avahi_record_unref(r->srv_record);
- if (r->txt_record)
- avahi_record_unref(r->txt_record);
- if (r->address_record)
- avahi_record_unref(r->address_record);
-
- avahi_free(r->service_name);
- avahi_free(r->service_type);
- avahi_free(r->domain_name);
- avahi_free(r);
-}
diff --git a/trunk/avahi-core/response-sched.c b/trunk/avahi-core/response-sched.c
deleted file mode 100644
index ef10eca..0000000
--- a/trunk/avahi-core/response-sched.c
+++ /dev/null
@@ -1,516 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "response-sched.h"
-#include "log.h"
-#include "rr-util.h"
-
-/* Local packets are supressed this long after sending them */
-#define AVAHI_RESPONSE_HISTORY_MSEC 500
-
-/* Local packets are deferred this long before sending them */
-#define AVAHI_RESPONSE_DEFER_MSEC 20
-
-/* Additional jitter for deferred packets */
-#define AVAHI_RESPONSE_JITTER_MSEC 100
-
-/* Remote packets can suppress local traffic as long as this value */
-#define AVAHI_RESPONSE_SUPPRESS_MSEC 700
-
-typedef struct AvahiResponseJob AvahiResponseJob;
-
-typedef enum {
- AVAHI_SCHEDULED,
- AVAHI_DONE,
- AVAHI_SUPPRESSED
-} AvahiResponseJobState;
-
-struct AvahiResponseJob {
- AvahiResponseScheduler *scheduler;
- AvahiTimeEvent *time_event;
-
- AvahiResponseJobState state;
- struct timeval delivery;
-
- AvahiRecord *record;
- int flush_cache;
- AvahiAddress querier;
- int querier_valid;
-
- AVAHI_LLIST_FIELDS(AvahiResponseJob, jobs);
-};
-
-struct AvahiResponseScheduler {
- AvahiInterface *interface;
- AvahiTimeEventQueue *time_event_queue;
-
- AVAHI_LLIST_HEAD(AvahiResponseJob, jobs);
- AVAHI_LLIST_HEAD(AvahiResponseJob, history);
- AVAHI_LLIST_HEAD(AvahiResponseJob, suppressed);
-};
-
-static AvahiResponseJob* job_new(AvahiResponseScheduler *s, AvahiRecord *record, AvahiResponseJobState state) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
-
- if (!(rj = avahi_new(AvahiResponseJob, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- rj->scheduler = s;
- rj->record = avahi_record_ref(record);
- rj->time_event = NULL;
- rj->flush_cache = 0;
- rj->querier_valid = 0;
-
- if ((rj->state = state) == AVAHI_SCHEDULED)
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->jobs, rj);
- else if (rj->state == AVAHI_DONE)
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->history, rj);
- else /* rj->state == AVAHI_SUPPRESSED */
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->suppressed, rj);
-
- return rj;
-}
-
-static void job_free(AvahiResponseScheduler *s, AvahiResponseJob *rj) {
- assert(s);
- assert(rj);
-
- if (rj->time_event)
- avahi_time_event_free(rj->time_event);
-
- if (rj->state == AVAHI_SCHEDULED)
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->jobs, rj);
- else if (rj->state == AVAHI_DONE)
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->history, rj);
- else /* rj->state == AVAHI_SUPPRESSED */
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->suppressed, rj);
-
- avahi_record_unref(rj->record);
- avahi_free(rj);
-}
-
-static void elapse_callback(AvahiTimeEvent *e, void* data);
-
-static void job_set_elapse_time(AvahiResponseScheduler *s, AvahiResponseJob *rj, unsigned msec, unsigned jitter) {
- struct timeval tv;
-
- assert(s);
- assert(rj);
-
- avahi_elapse_time(&tv, msec, jitter);
-
- if (rj->time_event)
- avahi_time_event_update(rj->time_event, &tv);
- else
- rj->time_event = avahi_time_event_new(s->time_event_queue, &tv, elapse_callback, rj);
-}
-
-static void job_mark_done(AvahiResponseScheduler *s, AvahiResponseJob *rj) {
- assert(s);
- assert(rj);
-
- assert(rj->state == AVAHI_SCHEDULED);
-
- AVAHI_LLIST_REMOVE(AvahiResponseJob, jobs, s->jobs, rj);
- AVAHI_LLIST_PREPEND(AvahiResponseJob, jobs, s->history, rj);
-
- rj->state = AVAHI_DONE;
-
- job_set_elapse_time(s, rj, AVAHI_RESPONSE_HISTORY_MSEC, 0);
-
- gettimeofday(&rj->delivery, NULL);
-}
-
-AvahiResponseScheduler *avahi_response_scheduler_new(AvahiInterface *i) {
- AvahiResponseScheduler *s;
- assert(i);
-
- if (!(s = avahi_new(AvahiResponseScheduler, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL;
- }
-
- s->interface = i;
- s->time_event_queue = i->monitor->server->time_event_queue;
-
- AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->jobs);
- AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->history);
- AVAHI_LLIST_HEAD_INIT(AvahiResponseJob, s->suppressed);
-
- return s;
-}
-
-void avahi_response_scheduler_free(AvahiResponseScheduler *s) {
- assert(s);
-
- avahi_response_scheduler_clear(s);
- avahi_free(s);
-}
-
-void avahi_response_scheduler_clear(AvahiResponseScheduler *s) {
- assert(s);
-
- while (s->jobs)
- job_free(s, s->jobs);
- while (s->history)
- job_free(s, s->history);
- while (s->suppressed)
- job_free(s, s->suppressed);
-}
-
-static void enumerate_aux_records_callback(AVAHI_GCC_UNUSED AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata) {
- AvahiResponseJob *rj = userdata;
-
- assert(r);
- assert(rj);
-
- avahi_response_scheduler_post(rj->scheduler, r, flush_cache, rj->querier_valid ? &rj->querier : NULL, 0);
-}
-
-static int packet_add_response_job(AvahiResponseScheduler *s, AvahiDnsPacket *p, AvahiResponseJob *rj) {
- assert(s);
- assert(p);
- assert(rj);
-
- /* Try to add this record to the packet */
- if (!avahi_dns_packet_append_record(p, rj->record, rj->flush_cache, 0))
- return 0;
-
- /* Ok, this record will definitely be sent, so schedule the
- * auxilliary packets, too */
- avahi_server_enumerate_aux_records(s->interface->monitor->server, s->interface, rj->record, enumerate_aux_records_callback, rj);
- job_mark_done(s, rj);
-
- return 1;
-}
-
-static void send_response_packet(AvahiResponseScheduler *s, AvahiResponseJob *rj) {
- AvahiDnsPacket *p;
- unsigned n;
-
- assert(s);
- assert(rj);
-
- if (!(p = avahi_dns_packet_new_response(s->interface->hardware->mtu, 1)))
- return; /* OOM */
- n = 1;
-
- /* Put it in the packet. */
- if (packet_add_response_job(s, p, rj)) {
-
- /* Try to fill up packet with more responses, if available */
- while (s->jobs) {
-
- if (!packet_add_response_job(s, p, s->jobs))
- break;
-
- n++;
- }
-
- } else {
- size_t size;
-
- avahi_dns_packet_free(p);
-
- /* OK, the packet was too small, so create one that fits */
- size = avahi_record_get_estimate_size(rj->record) + AVAHI_DNS_PACKET_HEADER_SIZE;
-
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(p = avahi_dns_packet_new_response(size, 1)))
- return; /* OOM */
-
- if (!packet_add_response_job(s, p, rj)) {
- avahi_dns_packet_free(p);
-
- avahi_log_warn("Record too large, cannot send");
- job_mark_done(s, rj);
- return;
- }
- }
-
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ANCOUNT, n);
- avahi_interface_send_packet(s->interface, p);
- avahi_dns_packet_free(p);
-}
-
-static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
- AvahiResponseJob *rj = data;
-
- assert(rj);
-
- if (rj->state == AVAHI_DONE || rj->state == AVAHI_SUPPRESSED)
- job_free(rj->scheduler, rj); /* Lets drop this entry */
- else
- send_response_packet(rj->scheduler, rj);
-}
-
-static AvahiResponseJob* find_scheduled_job(AvahiResponseScheduler *s, AvahiRecord *record) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
-
- for (rj = s->jobs; rj; rj = rj->jobs_next) {
- assert(rj->state == AVAHI_SCHEDULED);
-
- if (avahi_record_equal_no_ttl(rj->record, record))
- return rj;
- }
-
- return NULL;
-}
-
-static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord *record) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
-
- for (rj = s->history; rj; rj = rj->jobs_next) {
- assert(rj->state == AVAHI_DONE);
-
- if (avahi_record_equal_no_ttl(rj->record, record)) {
- /* Check whether this entry is outdated */
-
-/* avahi_log_debug("history age: %u", (unsigned) (avahi_age(&rj->delivery)/1000)); */
-
- if (avahi_age(&rj->delivery)/1000 > AVAHI_RESPONSE_HISTORY_MSEC) {
- /* it is outdated, so let's remove it */
- job_free(s, rj);
- return NULL;
- }
-
- return rj;
- }
- }
-
- return NULL;
-}
-
-static AvahiResponseJob* find_suppressed_job(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
- assert(querier);
-
- for (rj = s->suppressed; rj; rj = rj->jobs_next) {
- assert(rj->state == AVAHI_SUPPRESSED);
- assert(rj->querier_valid);
-
- if (avahi_record_equal_no_ttl(rj->record, record) &&
- avahi_address_cmp(&rj->querier, querier) == 0) {
- /* Check whether this entry is outdated */
-
- if (avahi_age(&rj->delivery) > AVAHI_RESPONSE_SUPPRESS_MSEC*1000) {
- /* it is outdated, so let's remove it */
- job_free(s, rj);
- return NULL;
- }
-
- return rj;
- }
- }
-
- return NULL;
-}
-
-int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately) {
- AvahiResponseJob *rj;
- struct timeval tv;
-/* char *t; */
-
- assert(s);
- assert(record);
-
- assert(!avahi_key_is_pattern(record->key));
-
-/* t = avahi_record_to_string(record); */
-/* avahi_log_debug("post %i %s", immediately, t); */
-/* avahi_free(t); */
-
- /* Check whether this response is suppressed */
- if (querier &&
- (rj = find_suppressed_job(s, record, querier)) &&
- avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) &&
- rj->record->ttl >= record->ttl/2) {
-
-/* avahi_log_debug("Response suppressed by known answer suppression."); */
- return 0;
- }
-
- /* Check if we already sent this response recently */
- if ((rj = find_history_job(s, record))) {
-
- if (avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) &&
- rj->record->ttl >= record->ttl/2 &&
- (rj->flush_cache || !flush_cache)) {
-/* avahi_log_debug("Response suppressed by local duplicate suppression (history)"); */
- return 0;
- }
-
- /* Outdated ... */
- job_free(s, rj);
- }
-
- avahi_elapse_time(&tv, immediately ? 0 : AVAHI_RESPONSE_DEFER_MSEC, immediately ? 0 : AVAHI_RESPONSE_JITTER_MSEC);
-
- if ((rj = find_scheduled_job(s, record))) {
-/* avahi_log_debug("Response suppressed by local duplicate suppression (scheduled)"); */
-
- /* Update a little ... */
-
- /* Update the time if the new is prior to the old */
- if (avahi_timeval_compare(&tv, &rj->delivery) < 0) {
- rj->delivery = tv;
- avahi_time_event_update(rj->time_event, &rj->delivery);
- }
-
- /* Update the flush cache bit */
- if (flush_cache)
- rj->flush_cache = 1;
-
- /* Update the querier field */
- if (!querier || (rj->querier_valid && avahi_address_cmp(querier, &rj->querier) != 0))
- rj->querier_valid = 0;
-
- /* Update record data (just for the TTL) */
- avahi_record_unref(rj->record);
- rj->record = avahi_record_ref(record);
-
- return 1;
- } else {
-/* avahi_log_debug("Accepted new response job."); */
-
- /* Create a new job and schedule it */
- if (!(rj = job_new(s, record, AVAHI_SCHEDULED)))
- return 0; /* OOM */
-
- rj->delivery = tv;
- rj->time_event = avahi_time_event_new(s->time_event_queue, &rj->delivery, elapse_callback, rj);
- rj->flush_cache = flush_cache;
-
- if ((rj->querier_valid = !!querier))
- rj->querier = *querier;
-
- return 1;
- }
-}
-
-void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache) {
- AvahiResponseJob *rj;
- assert(s);
-
- /* This function is called whenever an incoming response was
- * receieved. We drop scheduled responses which match here. The
- * keyword is "DUPLICATE ANSWER SUPPRESION". */
-
- if ((rj = find_scheduled_job(s, record))) {
-
- if ((!rj->flush_cache || flush_cache) && /* flush cache bit was set correctly */
- avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) && /* both goodbye packets, or both not */
- record->ttl >= rj->record->ttl/2) { /* sensible TTL */
-
- /* A matching entry was found, so let's mark it done */
-/* avahi_log_debug("Response suppressed by distributed duplicate suppression"); */
- job_mark_done(s, rj);
- }
-
- return;
- }
-
- if ((rj = find_history_job(s, record))) {
- /* Found a history job, let's update it */
- avahi_record_unref(rj->record);
- rj->record = avahi_record_ref(record);
- } else
- /* Found no existing history job, so let's create a new one */
- if (!(rj = job_new(s, record, AVAHI_DONE)))
- return; /* OOM */
-
- rj->flush_cache = flush_cache;
- rj->querier_valid = 0;
-
- gettimeofday(&rj->delivery, NULL);
- job_set_elapse_time(s, rj, AVAHI_RESPONSE_HISTORY_MSEC, 0);
-}
-
-void avahi_response_scheduler_suppress(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier) {
- AvahiResponseJob *rj;
-
- assert(s);
- assert(record);
- assert(querier);
-
- if ((rj = find_scheduled_job(s, record))) {
-
- if (rj->querier_valid && avahi_address_cmp(querier, &rj->querier) == 0 && /* same originator */
- avahi_record_is_goodbye(record) == avahi_record_is_goodbye(rj->record) && /* both goodbye packets, or both not */
- record->ttl >= rj->record->ttl/2) { /* sensible TTL */
-
- /* A matching entry was found, so let's drop it */
-/* avahi_log_debug("Known answer suppression active!"); */
- job_free(s, rj);
- }
- }
-
- if ((rj = find_suppressed_job(s, record, querier))) {
-
- /* Let's update the old entry */
- avahi_record_unref(rj->record);
- rj->record = avahi_record_ref(record);
-
- } else {
-
- /* Create a new entry */
- if (!(rj = job_new(s, record, AVAHI_SUPPRESSED)))
- return; /* OOM */
- rj->querier_valid = 1;
- rj->querier = *querier;
- }
-
- gettimeofday(&rj->delivery, NULL);
- job_set_elapse_time(s, rj, AVAHI_RESPONSE_SUPPRESS_MSEC, 0);
-}
-
-void avahi_response_scheduler_force(AvahiResponseScheduler *s) {
- assert(s);
-
- /* Send all scheduled responses immediately */
- while (s->jobs)
- send_response_packet(s, s->jobs);
-}
diff --git a/trunk/avahi-core/response-sched.h b/trunk/avahi-core/response-sched.h
deleted file mode 100644
index 68c4a9d..0000000
--- a/trunk/avahi-core/response-sched.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef fooresponseschedhfoo
-#define fooresponseschedhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-typedef struct AvahiResponseScheduler AvahiResponseScheduler;
-
-#include <avahi-common/address.h>
-#include "iface.h"
-
-AvahiResponseScheduler *avahi_response_scheduler_new(AvahiInterface *i);
-void avahi_response_scheduler_free(AvahiResponseScheduler *s);
-void avahi_response_scheduler_clear(AvahiResponseScheduler *s);
-void avahi_response_scheduler_force(AvahiResponseScheduler *s);
-
-int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache, const AvahiAddress *querier, int immediately);
-void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *record, int flush_cache);
-void avahi_response_scheduler_suppress(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier);
-
-#endif
diff --git a/trunk/avahi-core/rr-util.h b/trunk/avahi-core/rr-util.h
deleted file mode 100644
index b3c35b4..0000000
--- a/trunk/avahi-core/rr-util.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef foorrutilhfoo
-#define foorrutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "rr.h"
-
-AVAHI_C_DECL_BEGIN
-
-/** Creaze new AvahiKey object based on an existing key but replaceing the type by CNAME */
-AvahiKey *avahi_key_new_cname(AvahiKey *key);
-
-/** Match a key to a key pattern. The pattern has a type of
-AVAHI_DNS_CLASS_ANY, the classes are taken to be equal. Same for the
-type. If the pattern has neither class nor type with ANY constants,
-this function is identical to avahi_key_equal(). In contrast to
-avahi_equal() this function is not commutative. */
-int avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k);
-
-/** Check whether a key is a pattern key, i.e. the class/type has a
- * value of AVAHI_DNS_CLASS_ANY/AVAHI_DNS_TYPE_ANY */
-int avahi_key_is_pattern(const AvahiKey *k);
-
-/** Returns a maximum estimate for the space that is needed to store
- * this key in a DNS packet. */
-size_t avahi_key_get_estimate_size(AvahiKey *k);
-
-/** Returns a maximum estimate for the space that is needed to store
- * the record in a DNS packet. */
-size_t avahi_record_get_estimate_size(AvahiRecord *r);
-
-/** Do a mDNS spec conforming lexicographical comparison of the two
- * records. Return a negative value if a < b, a positive if a > b,
- * zero if equal. */
-int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b);
-
-/** Return 1 if the specified record is an mDNS goodbye record. i.e. TTL is zero. */
-int avahi_record_is_goodbye(AvahiRecord *r);
-
-/** Make a deep copy of an AvahiRecord object */
-AvahiRecord *avahi_record_copy(AvahiRecord *r);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/rr.c b/trunk/avahi-core/rr.c
deleted file mode 100644
index 8b7fab7..0000000
--- a/trunk/avahi-core/rr.c
+++ /dev/null
@@ -1,703 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#include <assert.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/defs.h>
-
-#include "rr.h"
-#include "log.h"
-#include "util.h"
-#include "hashmap.h"
-#include "domain-util.h"
-#include "rr-util.h"
-
-AvahiKey *avahi_key_new(const char *name, uint16_t class, uint16_t type) {
- AvahiKey *k;
- assert(name);
-
- if (!(k = avahi_new(AvahiKey, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- if (!(k->name = avahi_normalize_name_strdup(name))) {
- avahi_log_error("avahi_normalize_name() failed.");
- avahi_free(k);
- return NULL;
- }
-
- k->ref = 1;
- k->clazz = class;
- k->type = type;
-
- return k;
-}
-
-AvahiKey *avahi_key_new_cname(AvahiKey *key) {
- assert(key);
-
- if (key->clazz != AVAHI_DNS_CLASS_IN)
- return NULL;
-
- if (key->type == AVAHI_DNS_TYPE_CNAME)
- return NULL;
-
- return avahi_key_new(key->name, key->clazz, AVAHI_DNS_TYPE_CNAME);
-}
-
-AvahiKey *avahi_key_ref(AvahiKey *k) {
- assert(k);
- assert(k->ref >= 1);
-
- k->ref++;
-
- return k;
-}
-
-void avahi_key_unref(AvahiKey *k) {
- assert(k);
- assert(k->ref >= 1);
-
- if ((--k->ref) <= 0) {
- avahi_free(k->name);
- avahi_free(k);
- }
-}
-
-AvahiRecord *avahi_record_new(AvahiKey *k, uint32_t ttl) {
- AvahiRecord *r;
-
- assert(k);
-
- if (!(r = avahi_new(AvahiRecord, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- r->ref = 1;
- r->key = avahi_key_ref(k);
-
- memset(&r->data, 0, sizeof(r->data));
-
- r->ttl = ttl != (uint32_t) -1 ? ttl : AVAHI_DEFAULT_TTL;
-
- return r;
-}
-
-AvahiRecord *avahi_record_new_full(const char *name, uint16_t class, uint16_t type, uint32_t ttl) {
- AvahiRecord *r;
- AvahiKey *k;
-
- assert(name);
-
- if (!(k = avahi_key_new(name, class, type))) {
- avahi_log_error("avahi_key_new() failed.");
- return NULL;
- }
-
- r = avahi_record_new(k, ttl);
- avahi_key_unref(k);
-
- if (!r) {
- avahi_log_error("avahi_record_new() failed.");
- return NULL;
- }
-
- return r;
-}
-
-AvahiRecord *avahi_record_ref(AvahiRecord *r) {
- assert(r);
- assert(r->ref >= 1);
-
- r->ref++;
- return r;
-}
-
-void avahi_record_unref(AvahiRecord *r) {
- assert(r);
- assert(r->ref >= 1);
-
- if ((--r->ref) <= 0) {
- switch (r->key->type) {
-
- case AVAHI_DNS_TYPE_SRV:
- avahi_free(r->data.srv.name);
- break;
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- avahi_free(r->data.ptr.name);
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- avahi_free(r->data.hinfo.cpu);
- avahi_free(r->data.hinfo.os);
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- avahi_string_list_free(r->data.txt.string_list);
- break;
-
- case AVAHI_DNS_TYPE_A:
- case AVAHI_DNS_TYPE_AAAA:
- break;
-
- default:
- avahi_free(r->data.generic.data);
- }
-
- avahi_key_unref(r->key);
- avahi_free(r);
- }
-}
-
-const char *avahi_dns_class_to_string(uint16_t class) {
- if (class & AVAHI_DNS_CACHE_FLUSH)
- return "FLUSH";
-
- switch (class) {
- case AVAHI_DNS_CLASS_IN:
- return "IN";
- case AVAHI_DNS_CLASS_ANY:
- return "ANY";
- default:
- return NULL;
- }
-}
-
-const char *avahi_dns_type_to_string(uint16_t type) {
- switch (type) {
- case AVAHI_DNS_TYPE_CNAME:
- return "CNAME";
- case AVAHI_DNS_TYPE_A:
- return "A";
- case AVAHI_DNS_TYPE_AAAA:
- return "AAAA";
- case AVAHI_DNS_TYPE_PTR:
- return "PTR";
- case AVAHI_DNS_TYPE_HINFO:
- return "HINFO";
- case AVAHI_DNS_TYPE_TXT:
- return "TXT";
- case AVAHI_DNS_TYPE_SRV:
- return "SRV";
- case AVAHI_DNS_TYPE_ANY:
- return "ANY";
- case AVAHI_DNS_TYPE_SOA:
- return "SOA";
- case AVAHI_DNS_TYPE_NS:
- return "NS";
- default:
- return NULL;
- }
-}
-
-char *avahi_key_to_string(const AvahiKey *k) {
- char class[16], type[16];
- const char *c, *t;
-
- assert(k);
- assert(k->ref >= 1);
-
- /* According to RFC3597 */
-
- if (!(c = avahi_dns_class_to_string(k->clazz))) {
- snprintf(class, sizeof(class), "CLASS%u", k->clazz);
- c = class;
- }
-
- if (!(t = avahi_dns_type_to_string(k->type))) {
- snprintf(type, sizeof(type), "TYPE%u", k->type);
- t = type;
- }
-
- return avahi_strdup_printf("%s\t%s\t%s", k->name, c, t);
-}
-
-char *avahi_record_to_string(const AvahiRecord *r) {
- char *p, *s;
- char buf[1024], *t = NULL, *d = NULL;
-
- assert(r);
- assert(r->ref >= 1);
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_A:
- inet_ntop(AF_INET, &r->data.a.address.address, t = buf, sizeof(buf));
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- inet_ntop(AF_INET6, &r->data.aaaa.address.address, t = buf, sizeof(buf));
- break;
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
-
- t = r->data.ptr.name;
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- t = d = avahi_string_list_to_string(r->data.txt.string_list);
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
-
- snprintf(t = buf, sizeof(buf), "\"%s\" \"%s\"", r->data.hinfo.cpu, r->data.hinfo.os);
- break;
-
- case AVAHI_DNS_TYPE_SRV:
-
- snprintf(t = buf, sizeof(buf), "%u %u %u %s",
- r->data.srv.priority,
- r->data.srv.weight,
- r->data.srv.port,
- r->data.srv.name);
-
- break;
-
- default: {
-
- uint8_t *c;
- uint16_t n;
- int i;
- char *e;
-
- /* According to RFC3597 */
-
- snprintf(t = buf, sizeof(buf), "\\# %u", r->data.generic.size);
-
- e = strchr(t, 0);
-
- for (c = r->data.generic.data, n = r->data.generic.size, i = 0;
- n > 0 && i < 20;
- c ++, n --, i++) {
-
- sprintf(e, " %02X", *c);
- e = strchr(e, 0);
- }
-
- break;
- }
- }
-
- p = avahi_key_to_string(r->key);
- s = avahi_strdup_printf("%s %s ; ttl=%u", p, t, r->ttl);
- avahi_free(p);
- avahi_free(d);
-
- return s;
-}
-
-int avahi_key_equal(const AvahiKey *a, const AvahiKey *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 1;
-
- return avahi_domain_equal(a->name, b->name) &&
- a->type == b->type &&
- a->clazz == b->clazz;
-}
-
-int avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *k) {
- assert(pattern);
- assert(k);
-
- assert(!avahi_key_is_pattern(k));
-
- if (pattern == k)
- return 1;
-
- return avahi_domain_equal(pattern->name, k->name) &&
- (pattern->type == k->type || pattern->type == AVAHI_DNS_TYPE_ANY) &&
- (pattern->clazz == k->clazz || pattern->clazz == AVAHI_DNS_CLASS_ANY);
-}
-
-int avahi_key_is_pattern(const AvahiKey *k) {
- assert(k);
-
- return
- k->type == AVAHI_DNS_TYPE_ANY ||
- k->clazz == AVAHI_DNS_CLASS_ANY;
-}
-
-unsigned avahi_key_hash(const AvahiKey *k) {
- assert(k);
-
- return
- avahi_domain_hash(k->name) +
- k->type +
- k->clazz;
-}
-
-static int rdata_equal(const AvahiRecord *a, const AvahiRecord *b) {
- assert(a);
- assert(b);
- assert(a->key->type == b->key->type);
-
- switch (a->key->type) {
- case AVAHI_DNS_TYPE_SRV:
- return
- a->data.srv.priority == b->data.srv.priority &&
- a->data.srv.weight == b->data.srv.weight &&
- a->data.srv.port == b->data.srv.port &&
- avahi_domain_equal(a->data.srv.name, b->data.srv.name);
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- return avahi_domain_equal(a->data.ptr.name, b->data.ptr.name);
-
- case AVAHI_DNS_TYPE_HINFO:
- return
- !strcmp(a->data.hinfo.cpu, b->data.hinfo.cpu) &&
- !strcmp(a->data.hinfo.os, b->data.hinfo.os);
-
- case AVAHI_DNS_TYPE_TXT:
- return avahi_string_list_equal(a->data.txt.string_list, b->data.txt.string_list);
-
- case AVAHI_DNS_TYPE_A:
- return memcmp(&a->data.a.address, &b->data.a.address, sizeof(AvahiIPv4Address)) == 0;
-
- case AVAHI_DNS_TYPE_AAAA:
- return memcmp(&a->data.aaaa.address, &b->data.aaaa.address, sizeof(AvahiIPv6Address)) == 0;
-
- default:
- return a->data.generic.size == b->data.generic.size &&
- (a->data.generic.size == 0 || memcmp(a->data.generic.data, b->data.generic.data, a->data.generic.size) == 0);
- }
-
-}
-
-int avahi_record_equal_no_ttl(const AvahiRecord *a, const AvahiRecord *b) {
- assert(a);
- assert(b);
-
- if (a == b)
- return 1;
-
- return
- avahi_key_equal(a->key, b->key) &&
- rdata_equal(a, b);
-}
-
-
-AvahiRecord *avahi_record_copy(AvahiRecord *r) {
- AvahiRecord *copy;
-
- if (!(copy = avahi_new(AvahiRecord, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- copy->ref = 1;
- copy->key = avahi_key_ref(r->key);
- copy->ttl = r->ttl;
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- if (!(copy->data.ptr.name = avahi_strdup(r->data.ptr.name)))
- goto fail;
- break;
-
- case AVAHI_DNS_TYPE_SRV:
- copy->data.srv.priority = r->data.srv.priority;
- copy->data.srv.weight = r->data.srv.weight;
- copy->data.srv.port = r->data.srv.port;
- if (!(copy->data.srv.name = avahi_strdup(r->data.srv.name)))
- goto fail;
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- if (!(copy->data.hinfo.os = avahi_strdup(r->data.hinfo.os)))
- goto fail;
-
- if (!(copy->data.hinfo.cpu = avahi_strdup(r->data.hinfo.cpu))) {
- avahi_free(r->data.hinfo.os);
- goto fail;
- }
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- copy->data.txt.string_list = avahi_string_list_copy(r->data.txt.string_list);
- break;
-
- case AVAHI_DNS_TYPE_A:
- copy->data.a.address = r->data.a.address;
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- copy->data.aaaa.address = r->data.aaaa.address;
- break;
-
- default:
- if (!(copy->data.generic.data = avahi_memdup(r->data.generic.data, r->data.generic.size)))
- goto fail;
- copy->data.generic.size = r->data.generic.size;
- break;
-
- }
-
- return copy;
-
-fail:
- avahi_log_error("Failed to allocate memory");
-
- avahi_key_unref(copy->key);
- avahi_free(copy);
-
- return NULL;
-}
-
-
-size_t avahi_key_get_estimate_size(AvahiKey *k) {
- assert(k);
-
- return strlen(k->name)+1+4;
-}
-
-size_t avahi_record_get_estimate_size(AvahiRecord *r) {
- size_t n;
- assert(r);
-
- n = avahi_key_get_estimate_size(r->key) + 4 + 2;
-
- switch (r->key->type) {
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- n += strlen(r->data.ptr.name) + 1;
- break;
-
- case AVAHI_DNS_TYPE_SRV:
- n += 6 + strlen(r->data.srv.name) + 1;
- break;
-
- case AVAHI_DNS_TYPE_HINFO:
- n += strlen(r->data.hinfo.os) + 1 + strlen(r->data.hinfo.cpu) + 1;
- break;
-
- case AVAHI_DNS_TYPE_TXT:
- n += avahi_string_list_serialize(r->data.txt.string_list, NULL, 0);
- break;
-
- case AVAHI_DNS_TYPE_A:
- n += sizeof(AvahiIPv4Address);
- break;
-
- case AVAHI_DNS_TYPE_AAAA:
- n += sizeof(AvahiIPv6Address);
- break;
-
- default:
- n += r->data.generic.size;
- }
-
- return n;
-}
-
-static int lexicographical_memcmp(const void* a, size_t al, const void* b, size_t bl) {
- size_t c;
- int ret;
-
- assert(a);
- assert(b);
-
- c = al < bl ? al : bl;
- if ((ret = memcmp(a, b, c)))
- return ret;
-
- if (al == bl)
- return 0;
- else
- return al == c ? 1 : -1;
-}
-
-static int uint16_cmp(uint16_t a, uint16_t b) {
- return a == b ? 0 : (a < b ? -1 : 1);
-}
-
-int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) {
- int r;
-/* char *t1, *t2; */
-
- assert(a);
- assert(b);
-
-/* t1 = avahi_record_to_string(a); */
-/* t2 = avahi_record_to_string(b); */
-/* g_message("lexicocmp: %s %s", t1, t2); */
-/* avahi_free(t1); */
-/* avahi_free(t2); */
-
- if (a == b)
- return 0;
-
- if ((r = uint16_cmp(a->key->clazz, b->key->clazz)) ||
- (r = uint16_cmp(a->key->type, b->key->type)))
- return r;
-
- switch (a->key->type) {
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- return avahi_binary_domain_cmp(a->data.ptr.name, b->data.ptr.name);
-
- case AVAHI_DNS_TYPE_SRV: {
- if ((r = uint16_cmp(a->data.srv.priority, b->data.srv.priority)) == 0 &&
- (r = uint16_cmp(a->data.srv.weight, b->data.srv.weight)) == 0 &&
- (r = uint16_cmp(a->data.srv.port, b->data.srv.port)) == 0)
- r = avahi_binary_domain_cmp(a->data.srv.name, b->data.srv.name);
-
- return r;
- }
-
- case AVAHI_DNS_TYPE_HINFO: {
-
- if ((r = strcmp(a->data.hinfo.cpu, b->data.hinfo.cpu)) ||
- (r = strcmp(a->data.hinfo.os, b->data.hinfo.os)))
- return r;
-
- return 0;
-
- }
-
- case AVAHI_DNS_TYPE_TXT: {
-
- uint8_t *ma = NULL, *mb = NULL;
- size_t asize, bsize;
-
- asize = avahi_string_list_serialize(a->data.txt.string_list, NULL, 0);
- bsize = avahi_string_list_serialize(b->data.txt.string_list, NULL, 0);
-
- if (asize > 0 && !(ma = avahi_new(uint8_t, asize)))
- goto fail;
-
- if (bsize > 0 && !(mb = avahi_new(uint8_t, bsize))) {
- avahi_free(ma);
- goto fail;
- }
-
- avahi_string_list_serialize(a->data.txt.string_list, ma, asize);
- avahi_string_list_serialize(b->data.txt.string_list, mb, bsize);
-
- if (asize && bsize)
- r = lexicographical_memcmp(ma, asize, mb, bsize);
- else if (asize && !bsize)
- r = 1;
- else if (!asize && bsize)
- r = -1;
- else
- r = 0;
-
- avahi_free(ma);
- avahi_free(mb);
-
- return r;
- }
-
- case AVAHI_DNS_TYPE_A:
- return memcmp(&a->data.a.address, &b->data.a.address, sizeof(AvahiIPv4Address));
-
- case AVAHI_DNS_TYPE_AAAA:
- return memcmp(&a->data.aaaa.address, &b->data.aaaa.address, sizeof(AvahiIPv6Address));
-
- default:
- return lexicographical_memcmp(a->data.generic.data, a->data.generic.size,
- b->data.generic.data, b->data.generic.size);
- }
-
-
-fail:
- avahi_log_error(__FILE__": Out of memory");
- return -1; /* or whatever ... */
-}
-
-int avahi_record_is_goodbye(AvahiRecord *r) {
- assert(r);
-
- return r->ttl == 0;
-}
-
-int avahi_key_is_valid(AvahiKey *k) {
- assert(k);
-
- if (!avahi_is_valid_domain_name(k->name))
- return 0;
-
- return 1;
-}
-
-int avahi_record_is_valid(AvahiRecord *r) {
- assert(r);
-
- if (!avahi_key_is_valid(r->key))
- return 0;
-
- switch (r->key->type) {
-
- case AVAHI_DNS_TYPE_PTR:
- case AVAHI_DNS_TYPE_CNAME:
- case AVAHI_DNS_TYPE_NS:
- return avahi_is_valid_domain_name(r->data.ptr.name);
-
- case AVAHI_DNS_TYPE_SRV:
- return avahi_is_valid_domain_name(r->data.srv.name);
-
- case AVAHI_DNS_TYPE_HINFO:
- return
- strlen(r->data.hinfo.os) <= 255 &&
- strlen(r->data.hinfo.cpu) <= 255;
-
- case AVAHI_DNS_TYPE_TXT: {
-
- AvahiStringList *strlst;
-
- for (strlst = r->data.txt.string_list; strlst; strlst = strlst->next)
- if (strlst->size > 255 || strlst->size <= 0)
- return 0;
-
- return 1;
- }
- }
-
-
- return 1;
-}
diff --git a/trunk/avahi-core/rr.h b/trunk/avahi-core/rr.h
deleted file mode 100644
index 6bfe0ec..0000000
--- a/trunk/avahi-core/rr.h
+++ /dev/null
@@ -1,174 +0,0 @@
-#ifndef foorrhfoo
-#define foorrhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file rr.h Functions and definitions for manipulating DNS resource record (RR) data. */
-
-#include <inttypes.h>
-#include <sys/types.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/address.h>
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** DNS record types, see RFC 1035, in addition to those defined in defs.h */
-enum {
- AVAHI_DNS_TYPE_ANY = 0xFF, /**< Special query type for requesting all records */
- AVAHI_DNS_TYPE_OPT = 41, /**< EDNS0 option */
- AVAHI_DNS_TYPE_TKEY = 249,
- AVAHI_DNS_TYPE_TSIG = 250,
- AVAHI_DNS_TYPE_IXFR = 251,
- AVAHI_DNS_TYPE_AXFR = 252
-};
-
-/** DNS record classes, see RFC 1035, in addition to those defined in defs.h */
-enum {
- AVAHI_DNS_CLASS_ANY = 0xFF, /**< Special query type for requesting all records */
- AVAHI_DNS_CACHE_FLUSH = 0x8000, /**< Not really a class but a bit which may be set in response packets, see mDNS spec for more information */
- AVAHI_DNS_UNICAST_RESPONSE = 0x8000 /**< Not really a class but a bit which may be set in query packets, see mDNS spec for more information */
-};
-
-/** Encapsulates a DNS query key consisting of class, type and
- name. Use avahi_key_ref()/avahi_key_unref() for manipulating the
- reference counter. The structure is intended to be treated as "immutable", no
- changes should be imposed after creation */
-typedef struct AvahiKey {
- int ref; /**< Reference counter */
- char *name; /**< Record name */
- uint16_t clazz; /**< Record class, one of the AVAHI_DNS_CLASS_xxx constants */
- uint16_t type; /**< Record type, one of the AVAHI_DNS_TYPE_xxx constants */
-} AvahiKey;
-
-/** Encapsulates a DNS resource record. The structure is intended to
- * be treated as "immutable", no changes should be imposed after
- * creation. */
-typedef struct AvahiRecord {
- int ref; /**< Reference counter */
- AvahiKey *key; /**< Reference to the query key of this record */
-
- uint32_t ttl; /**< DNS TTL of this record */
-
- union {
-
- struct {
- void* data;
- uint16_t size;
- } generic; /**< Generic record data for unknown types */
-
- struct {
- uint16_t priority;
- uint16_t weight;
- uint16_t port;
- char *name;
- } srv; /**< Data for SRV records */
-
- struct {
- char *name;
- } ptr, ns, cname; /**< Data for PTR, NS and CNAME records */
-
- struct {
- char *cpu;
- char *os;
- } hinfo; /**< Data for HINFO records */
-
- struct {
- AvahiStringList *string_list;
- } txt; /**< Data for TXT records */
-
- struct {
- AvahiIPv4Address address;
- } a; /**< Data for A records */
-
- struct {
- AvahiIPv6Address address;
- } aaaa; /**< Data for AAAA records */
-
- } data; /**< Record data */
-
-} AvahiRecord;
-
-/** Create a new AvahiKey object. The reference counter will be set to 1. */
-AvahiKey *avahi_key_new(const char *name, uint16_t clazz, uint16_t type);
-
-/** Increase the reference counter of an AvahiKey object by one */
-AvahiKey *avahi_key_ref(AvahiKey *k);
-
-/** Decrease the reference counter of an AvahiKey object by one */
-void avahi_key_unref(AvahiKey *k);
-
-/** Check whether two AvahiKey object contain the same
- * data. AVAHI_DNS_CLASS_ANY/AVAHI_DNS_TYPE_ANY are treated like any
- * other class/type. */
-int avahi_key_equal(const AvahiKey *a, const AvahiKey *b);
-
-/** Return a numeric hash value for a key for usage in hash tables. */
-unsigned avahi_key_hash(const AvahiKey *k);
-
-/** Create a new record object. Record data should be filled in right after creation. The reference counter is set to 1. */
-AvahiRecord *avahi_record_new(AvahiKey *k, uint32_t ttl);
-
-/** Create a new record object. Record data should be filled in right after creation. The reference counter is set to 1. */
-AvahiRecord *avahi_record_new_full(const char *name, uint16_t clazz, uint16_t type, uint32_t ttl);
-
-/** Increase the reference counter of an AvahiRecord by one. */
-AvahiRecord *avahi_record_ref(AvahiRecord *r);
-
-/** Decrease the reference counter of an AvahiRecord by one. */
-void avahi_record_unref(AvahiRecord *r);
-
-/** Return a textual representation of the specified DNS class. The
- * returned pointer points to a read only internal string. */
-const char *avahi_dns_class_to_string(uint16_t clazz);
-
-/** Return a textual representation of the specified DNS class. The
- * returned pointer points to a read only internal string. */
-const char *avahi_dns_type_to_string(uint16_t type);
-
-/** Create a textual representation of the specified key. avahi_free() the
- * result! */
-char *avahi_key_to_string(const AvahiKey *k);
-
-/** Create a textual representation of the specified record, similar
- * in style to BIND zone file data. avahi_free() the result! */
-char *avahi_record_to_string(const AvahiRecord *r);
-
-/** Check whether two records are equal (regardless of the TTL */
-int avahi_record_equal_no_ttl(const AvahiRecord *a, const AvahiRecord *b);
-
-/** Check whether the specified key is valid */
-int avahi_key_is_valid(AvahiKey *k);
-
-/** Check whether the specified record is valid */
-int avahi_record_is_valid(AvahiRecord *r);
-
-/** Parse a binary rdata object and fill it into *record. This function is actually implemented in dns.c */
-int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size);
-
-/** Serialize an AvahiRecord object into binary rdata. This function is actually implemented in dns.c */
-size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/rrlist.c b/trunk/avahi-core/rrlist.c
deleted file mode 100644
index 915ecbb..0000000
--- a/trunk/avahi-core/rrlist.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-
-#include "rrlist.h"
-#include "log.h"
-
-typedef struct AvahiRecordListItem AvahiRecordListItem;
-
-struct AvahiRecordListItem {
- int read;
- AvahiRecord *record;
- int unicast_response;
- int flush_cache;
- int auxiliary;
- AVAHI_LLIST_FIELDS(AvahiRecordListItem, items);
-};
-
-struct AvahiRecordList {
- AVAHI_LLIST_HEAD(AvahiRecordListItem, read);
- AVAHI_LLIST_HEAD(AvahiRecordListItem, unread);
-
- int all_flush_cache;
-};
-
-AvahiRecordList *avahi_record_list_new(void) {
- AvahiRecordList *l;
-
- if (!(l = avahi_new(AvahiRecordList, 1))) {
- avahi_log_error("avahi_new() failed.");
- return NULL;
- }
-
- AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->read);
- AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->unread);
-
- l->all_flush_cache = 1;
- return l;
-}
-
-void avahi_record_list_free(AvahiRecordList *l) {
- assert(l);
-
- avahi_record_list_flush(l);
- avahi_free(l);
-}
-
-static void item_free(AvahiRecordList *l, AvahiRecordListItem *i) {
- assert(l);
- assert(i);
-
- if (i->read)
- AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->read, i);
- else
- AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
-
- avahi_record_unref(i->record);
- avahi_free(i);
-}
-
-void avahi_record_list_flush(AvahiRecordList *l) {
- assert(l);
-
- while (l->read)
- item_free(l, l->read);
- while (l->unread)
- item_free(l, l->unread);
-
- l->all_flush_cache = 1;
-}
-
-AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, int *ret_unicast_response, int *ret_auxiliary) {
- AvahiRecord *r;
- AvahiRecordListItem *i;
-
- if (!(i = l->unread))
- return NULL;
-
- assert(!i->read);
-
- r = avahi_record_ref(i->record);
- if (ret_unicast_response)
- *ret_unicast_response = i->unicast_response;
- if (ret_flush_cache)
- *ret_flush_cache = i->flush_cache;
- if (ret_auxiliary)
- *ret_auxiliary = i->auxiliary;
-
- AVAHI_LLIST_REMOVE(AvahiRecordListItem, items, l->unread, i);
- AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->read, i);
-
- i->read = 1;
-
- return r;
-}
-
-static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) {
- AvahiRecordListItem *i;
-
- assert(l);
- assert(r);
-
- for (i = l->read; i; i = i->items_next)
- if (avahi_record_equal_no_ttl(i->record, r))
- return i;
-
- for (i = l->unread; i; i = i->items_next)
- if (avahi_record_equal_no_ttl(i->record, r))
- return i;
-
- return NULL;
-}
-
-void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary) {
- AvahiRecordListItem *i;
-
- assert(l);
- assert(r);
-
- if (get(l, r))
- return;
-
- if (!(i = avahi_new(AvahiRecordListItem, 1))) {
- avahi_log_error("avahi_new() failed.");
- return;
- }
-
- i->unicast_response = unicast_response;
- i->flush_cache = flush_cache;
- i->auxiliary = auxiliary;
- i->record = avahi_record_ref(r);
- i->read = 0;
-
- l->all_flush_cache = l->all_flush_cache && flush_cache;
-
- AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->unread, i);
-}
-
-void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r) {
- AvahiRecordListItem *i;
-
- assert(l);
- assert(r);
-
- if (!(i = get(l, r)))
- return;
-
- item_free(l, i);
-}
-
-int avahi_record_list_is_empty(AvahiRecordList *l) {
- assert(l);
-
- return !l->unread && !l->read;
-}
-
-int avahi_record_list_all_flush_cache(AvahiRecordList *l) {
- assert(l);
-
- /* Return TRUE if all entries in this list have flush_cache set */
-
- return l->all_flush_cache;
-}
diff --git a/trunk/avahi-core/rrlist.h b/trunk/avahi-core/rrlist.h
deleted file mode 100644
index 9c07ecd..0000000
--- a/trunk/avahi-core/rrlist.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef foorrlisthfoo
-#define foorrlisthfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-#include "rr.h"
-
-typedef struct AvahiRecordList AvahiRecordList;
-
-AvahiRecordList *avahi_record_list_new(void);
-void avahi_record_list_free(AvahiRecordList *l);
-void avahi_record_list_flush(AvahiRecordList *l);
-
-AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, int *ret_unicast_response, int *ret_auxiliary);
-void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary);
-void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r);
-
-int avahi_record_list_all_flush_cache(AvahiRecordList *l);
-
-int avahi_record_list_is_empty(AvahiRecordList *l);
-
-#endif
diff --git a/trunk/avahi-core/server.c b/trunk/avahi-core/server.c
deleted file mode 100644
index 5bfbc50..0000000
--- a/trunk/avahi-core/server.c
+++ /dev/null
@@ -1,1723 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include "internal.h"
-#include "iface.h"
-#include "socket.h"
-#include "browse.h"
-#include "log.h"
-#include "util.h"
-#include "dns-srv-rr.h"
-#include "addr-util.h"
-#include "domain-util.h"
-#include "rr-util.h"
-
-static void enum_aux_records(AvahiServer *s, AvahiInterface *i, const char *name, uint16_t type, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata) {
- assert(s);
- assert(i);
- assert(name);
- assert(callback);
-
- if (type == AVAHI_DNS_TYPE_ANY) {
- AvahiEntry *e;
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead &&
- avahi_entry_is_registered(s, e, i) &&
- e->record->key->clazz == AVAHI_DNS_CLASS_IN &&
- avahi_domain_equal(name, e->record->key->name))
- callback(s, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, userdata);
-
- } else {
- AvahiEntry *e;
- AvahiKey *k;
-
- if (!(k = avahi_key_new(name, AVAHI_DNS_CLASS_IN, type)))
- return; /** OOM */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, k); e; e = e->by_key_next)
- if (!e->dead && avahi_entry_is_registered(s, e, i))
- callback(s, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, userdata);
-
- avahi_key_unref(k);
- }
-}
-
-void avahi_server_enumerate_aux_records(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, void (*callback)(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata), void* userdata) {
- assert(s);
- assert(i);
- assert(r);
- assert(callback);
-
- /* Call the specified callback far all records referenced by the one specified in *r */
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN) {
- if (r->key->type == AVAHI_DNS_TYPE_PTR) {
- enum_aux_records(s, i, r->data.ptr.name, AVAHI_DNS_TYPE_SRV, callback, userdata);
- enum_aux_records(s, i, r->data.ptr.name, AVAHI_DNS_TYPE_TXT, callback, userdata);
- } else if (r->key->type == AVAHI_DNS_TYPE_SRV) {
- enum_aux_records(s, i, r->data.srv.name, AVAHI_DNS_TYPE_A, callback, userdata);
- enum_aux_records(s, i, r->data.srv.name, AVAHI_DNS_TYPE_AAAA, callback, userdata);
- } else if (r->key->type == AVAHI_DNS_TYPE_CNAME)
- enum_aux_records(s, i, r->data.cname.name, AVAHI_DNS_TYPE_ANY, callback, userdata);
- }
-}
-
-void avahi_server_prepare_response(AvahiServer *s, AvahiInterface *i, AvahiEntry *e, int unicast_response, int auxiliary) {
- assert(s);
- assert(i);
- assert(e);
-
- avahi_record_list_push(s->record_list, e->record, e->flags & AVAHI_PUBLISH_UNIQUE, unicast_response, auxiliary);
-}
-
-void avahi_server_prepare_matching_responses(AvahiServer *s, AvahiInterface *i, AvahiKey *k, int unicast_response) {
- assert(s);
- assert(i);
- assert(k);
-
- /* Push all records that match the specified key to the record list */
-
- if (avahi_key_is_pattern(k)) {
- AvahiEntry *e;
-
- /* Handle ANY query */
-
- for (e = s->entries; e; e = e->entries_next)
- if (!e->dead && avahi_key_pattern_match(k, e->record->key) && avahi_entry_is_registered(s, e, i))
- avahi_server_prepare_response(s, i, e, unicast_response, 0);
-
- } else {
- AvahiEntry *e;
-
- /* Handle all other queries */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, k); e; e = e->by_key_next)
- if (!e->dead && avahi_entry_is_registered(s, e, i))
- avahi_server_prepare_response(s, i, e, unicast_response, 0);
- }
-
- /* Look for CNAME records */
-
- if ((k->clazz == AVAHI_DNS_CLASS_IN || k->clazz == AVAHI_DNS_CLASS_ANY)
- && k->type != AVAHI_DNS_TYPE_CNAME && k->type != AVAHI_DNS_TYPE_ANY) {
-
- AvahiKey *cname_key;
-
- if (!(cname_key = avahi_key_new(k->name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_CNAME)))
- return;
-
- avahi_server_prepare_matching_responses(s, i, cname_key, unicast_response);
- avahi_key_unref(cname_key);
- }
-}
-
-static void withdraw_entry(AvahiServer *s, AvahiEntry *e) {
- assert(s);
- assert(e);
-
- /* Withdraw the specified entry, and if is part of an entry group,
- * put that into COLLISION state */
-
- if (e->dead)
- return;
-
- if (e->group) {
- AvahiEntry *k;
-
- for (k = e->group->entries; k; k = k->by_group_next)
- if (!k->dead) {
- avahi_goodbye_entry(s, k, 0, 1);
- k->dead = 1;
- }
-
- e->group->n_probing = 0;
-
- avahi_s_entry_group_change_state(e->group, AVAHI_ENTRY_GROUP_COLLISION);
- } else {
- avahi_goodbye_entry(s, e, 0, 1);
- e->dead = 1;
- }
-
- s->need_entry_cleanup = 1;
-}
-
-static void withdraw_rrset(AvahiServer *s, AvahiKey *key) {
- AvahiEntry *e;
-
- assert(s);
- assert(key);
-
- /* Withdraw an entry RRSset */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, key); e; e = e->by_key_next)
- withdraw_entry(s, e);
-}
-
-static void incoming_probe(AvahiServer *s, AvahiRecord *record, AvahiInterface *i) {
- AvahiEntry *e, *n;
- int ours = 0, won = 0, lost = 0;
-
- assert(s);
- assert(record);
- assert(i);
-
- /* Handle incoming probes and check if they conflict our own probes */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, record->key); e; e = n) {
- int cmp;
- n = e->by_key_next;
-
- if (e->dead)
- continue;
-
- if ((cmp = avahi_record_lexicographical_compare(e->record, record)) == 0) {
- ours = 1;
- break;
- } else {
-
- if (avahi_entry_is_probing(s, e, i)) {
- if (cmp > 0)
- won = 1;
- else /* cmp < 0 */
- lost = 1;
- }
- }
- }
-
- if (!ours) {
- char *t = avahi_record_to_string(record);
-
- if (won)
- avahi_log_debug("Recieved conflicting probe [%s]. Local host won.", t);
- else if (lost) {
- avahi_log_debug("Recieved conflicting probe [%s]. Local host lost. Withdrawing.", t);
- withdraw_rrset(s, record->key);
- }
-
- avahi_free(t);
- }
-}
-
-static int handle_conflict(AvahiServer *s, AvahiInterface *i, AvahiRecord *record, int unique) {
- int valid = 1, ours = 0, conflict = 0, withdraw_immediately = 0;
- AvahiEntry *e, *n, *conflicting_entry = NULL;
-
- assert(s);
- assert(i);
- assert(record);
-
- /* Check whether an incoming record conflicts with one of our own */
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, record->key); e; e = n) {
- n = e->by_key_next;
-
- if (e->dead)
- continue;
-
- /* Check if the incoming is a goodbye record */
- if (avahi_record_is_goodbye(record)) {
-
- if (avahi_record_equal_no_ttl(e->record, record)) {
- char *t;
-
- /* Refresh */
- t = avahi_record_to_string(record);
- avahi_log_debug("Recieved goodbye record for one of our records [%s]. Refreshing.", t);
- avahi_server_prepare_matching_responses(s, i, e->record->key, 0);
-
- valid = 0;
- avahi_free(t);
- break;
- }
-
- /* If the goodybe packet doesn't match one of our own RRs, we simply ignore it. */
- continue;
- }
-
- if (!(e->flags & AVAHI_PUBLISH_UNIQUE) && !unique)
- continue;
-
- /* Either our entry or the other is intended to be unique, so let's check */
-
- if (avahi_record_equal_no_ttl(e->record, record)) {
- ours = 1; /* We have an identical record, so this is no conflict */
-
- /* Check wheter there is a TTL conflict */
- if (record->ttl <= e->record->ttl/2 &&
- avahi_entry_is_registered(s, e, i)) {
- char *t;
- /* Refresh */
- t = avahi_record_to_string(record);
-
- avahi_log_debug("Recieved record with bad TTL [%s]. Refreshing.", t);
- avahi_server_prepare_matching_responses(s, i, e->record->key, 0);
- valid = 0;
-
- avahi_free(t);
- }
-
- /* There's no need to check the other entries of this RRset */
- break;
-
- } else {
-
- if (avahi_entry_is_registered(s, e, i)) {
-
- /* A conflict => we have to return to probe mode */
- conflict = 1;
- conflicting_entry = e;
-
- } else if (avahi_entry_is_probing(s, e, i)) {
-
- /* We are currently registering a matching record, but
- * someone else already claimed it, so let's
- * withdraw */
- conflict = 1;
- withdraw_immediately = 1;
- }
- }
- }
-
- if (!ours && conflict) {
- char *t;
-
- valid = 0;
-
- t = avahi_record_to_string(record);
-
- if (withdraw_immediately) {
- avahi_log_debug("Recieved conflicting record [%s] with local record to be. Withdrawing.", t);
- withdraw_rrset(s, record->key);
- } else {
- assert(conflicting_entry);
- avahi_log_debug("Recieved conflicting record [%s]. Resetting our record.", t);
- avahi_entry_return_to_initial_state(s, conflicting_entry, i);
-
- /* Local unique records are returned to probing
- * state. Local shared records are reannounced. */
- }
-
- avahi_free(t);
- }
-
- return valid;
-}
-
-static void append_aux_callback(AvahiServer *s, AvahiRecord *r, int flush_cache, void* userdata) {
- int *unicast_response = userdata;
-
- assert(s);
- assert(r);
- assert(unicast_response);
-
- avahi_record_list_push(s->record_list, r, flush_cache, *unicast_response, 1);
-}
-
-static void append_aux_records_to_list(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, int unicast_response) {
- assert(s);
- assert(r);
-
- avahi_server_enumerate_aux_records(s, i, r, append_aux_callback, &unicast_response);
-}
-
-void avahi_server_generate_response(AvahiServer *s, AvahiInterface *i, AvahiDnsPacket *p, const AvahiAddress *a, uint16_t port, int legacy_unicast, int immediately) {
-
- assert(s);
- assert(i);
- assert(!legacy_unicast || (a && port > 0 && p));
-
- if (legacy_unicast) {
- AvahiDnsPacket *reply;
- AvahiRecord *r;
-
- if (!(reply = avahi_dns_packet_new_reply(p, 512 /* unicast DNS maximum packet size is 512 */ , 1, 1)))
- return; /* OOM */
-
- while ((r = avahi_record_list_next(s->record_list, NULL, NULL, NULL))) {
-
- append_aux_records_to_list(s, i, r, 0);
-
- if (avahi_dns_packet_append_record(reply, r, 0, 10))
- avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
- else {
- char *t = avahi_record_to_string(r);
- avahi_log_warn("Record [%s] not fitting in legacy unicast packet, dropping.", t);
- avahi_free(t);
- }
-
- avahi_record_unref(r);
- }
-
- if (avahi_dns_packet_get_field(reply, AVAHI_DNS_FIELD_ANCOUNT) != 0)
- avahi_interface_send_packet_unicast(i, reply, a, port);
-
- avahi_dns_packet_free(reply);
-
- } else {
- int unicast_response, flush_cache, auxiliary;
- AvahiDnsPacket *reply = NULL;
- AvahiRecord *r;
-
- /* In case the query packet was truncated never respond
- immediately, because known answer suppression records might be
- contained in later packets */
- int tc = p && !!(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_TC);
-
- while ((r = avahi_record_list_next(s->record_list, &flush_cache, &unicast_response, &auxiliary))) {
-
- int im = immediately;
-
- /* Only send the response immediately if it contains a
- * unique entry AND it is not in reply to a truncated
- * packet AND it is not an auxiliary record AND all other
- * responses for this record are unique too. */
-
- if (flush_cache && !tc && !auxiliary && avahi_record_list_all_flush_cache(s->record_list))
- im = 1;
-
- if (!avahi_interface_post_response(i, r, flush_cache, a, im) && unicast_response) {
-
- /* Due to some reasons the record has not been scheduled.
- * The client requested an unicast response in that
- * case. Therefore we prepare such a response */
-
- append_aux_records_to_list(s, i, r, unicast_response);
-
- for (;;) {
-
- if (!reply) {
- assert(p);
-
- if (!(reply = avahi_dns_packet_new_reply(p, i->hardware->mtu, 0, 0)))
- break; /* OOM */
- }
-
- if (avahi_dns_packet_append_record(reply, r, flush_cache, 0)) {
-
- /* Appending this record succeeded, so incremeant
- * the specific header field, and return to the caller */
-
- avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
-
- break;
- }
-
- if (avahi_dns_packet_get_field(reply, AVAHI_DNS_FIELD_ANCOUNT) == 0) {
- size_t size;
-
- /* The record is too large for one packet, so create a larger packet */
-
- avahi_dns_packet_free(reply);
- size = avahi_record_get_estimate_size(r) + AVAHI_DNS_PACKET_HEADER_SIZE;
- if (size > AVAHI_DNS_PACKET_SIZE_MAX)
- size = AVAHI_DNS_PACKET_SIZE_MAX;
-
- if (!(reply = avahi_dns_packet_new_reply(p, size, 0, 1)))
- break; /* OOM */
-
- if (!avahi_dns_packet_append_record(reply, r, flush_cache, 0)) {
- char *t;
- avahi_dns_packet_free(reply);
- t = avahi_record_to_string(r);
- avahi_log_warn("Record [%s] too large, doesn't fit in any packet!", t);
- avahi_free(t);
- break;
- } else
- avahi_dns_packet_inc_field(reply, AVAHI_DNS_FIELD_ANCOUNT);
- }
-
- /* Appending the record didn't succeeed, so let's send this packet, and create a new one */
- avahi_interface_send_packet_unicast(i, reply, a, port);
- avahi_dns_packet_free(reply);
- reply = NULL;
- }
- }
-
- avahi_record_unref(r);
- }
-
- if (reply) {
- if (avahi_dns_packet_get_field(reply, AVAHI_DNS_FIELD_ANCOUNT) != 0)
- avahi_interface_send_packet_unicast(i, reply, a, port);
- avahi_dns_packet_free(reply);
- }
- }
-
- avahi_record_list_flush(s->record_list);
-}
-
-static void reflect_response(AvahiServer *s, AvahiInterface *i, AvahiRecord *r, int flush_cache) {
- AvahiInterface *j;
-
- assert(s);
- assert(i);
- assert(r);
-
- if (!s->config.enable_reflector)
- return;
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol))
- avahi_interface_post_response(j, r, flush_cache, NULL, 1);
-}
-
-static void* reflect_cache_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEntry *e, void* userdata) {
- AvahiServer *s = userdata;
-
- assert(c);
- assert(pattern);
- assert(e);
- assert(s);
-
- avahi_record_list_push(s->record_list, e->record, e->cache_flush, 0, 0);
- return NULL;
-}
-
-static void reflect_query(AvahiServer *s, AvahiInterface *i, AvahiKey *k) {
- AvahiInterface *j;
-
- assert(s);
- assert(i);
- assert(k);
-
- if (!s->config.enable_reflector)
- return;
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol)) {
- /* Post the query to other networks */
- avahi_interface_post_query(j, k, 1, NULL);
-
- /* Reply from caches of other network. This is needed to
- * "work around" known answer suppression. */
-
- avahi_cache_walk(j->cache, k, reflect_cache_walk_callback, s);
- }
-}
-
-static void reflect_probe(AvahiServer *s, AvahiInterface *i, AvahiRecord *r) {
- AvahiInterface *j;
-
- assert(s);
- assert(i);
- assert(r);
-
- if (!s->config.enable_reflector)
- return;
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (j != i && (s->config.reflect_ipv || j->protocol == i->protocol))
- avahi_interface_post_probe(j, r, 1);
-}
-
-static void handle_query_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a, uint16_t port, int legacy_unicast, int from_local_iface) {
- size_t n;
- int is_probe;
-
- assert(s);
- assert(p);
- assert(i);
- assert(a);
-
- assert(avahi_record_list_is_empty(s->record_list));
-
- is_probe = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) > 0;
-
- /* Handle the questions */
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); n > 0; n --) {
- AvahiKey *key;
- int unicast_response = 0;
-
- if (!(key = avahi_dns_packet_consume_key(p, &unicast_response))) {
- avahi_log_warn(__FILE__": Packet too short or invalid while reading question key. (Maybe an UTF8 problem?)");
- goto fail;
- }
-
- if (!legacy_unicast && !from_local_iface) {
- reflect_query(s, i, key);
- avahi_cache_start_poof(i->cache, key, a);
- }
-
- if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 &&
- !(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_TC))
- /* Allow our own queries to be suppressed by incoming
- * queries only when they do not include known answers */
- avahi_query_scheduler_incoming(i->query_scheduler, key);
-
- avahi_server_prepare_matching_responses(s, i, key, unicast_response);
- avahi_key_unref(key);
- }
-
- if (!legacy_unicast) {
-
- /* Known Answer Suppression */
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT); n > 0; n --) {
- AvahiRecord *record;
- int unique = 0;
-
- if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
- avahi_log_warn(__FILE__": Packet too short or invalid while reading known answer record. (Maybe an UTF8 problem?)");
- goto fail;
- }
-
- if (handle_conflict(s, i, record, unique)) {
- avahi_response_scheduler_suppress(i->response_scheduler, record, a);
- avahi_record_list_drop(s->record_list, record);
- avahi_cache_stop_poof(i->cache, record, a);
- }
-
- avahi_record_unref(record);
- }
-
- /* Probe record */
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT); n > 0; n --) {
- AvahiRecord *record;
- int unique = 0;
-
- if (!(record = avahi_dns_packet_consume_record(p, &unique))) {
- avahi_log_warn(__FILE__": Packet too short or invalid while reading probe record. (Maybe an UTF8 problem?)");
- goto fail;
- }
-
- if (!avahi_key_is_pattern(record->key)) {
- if (!from_local_iface)
- reflect_probe(s, i, record);
- incoming_probe(s, record, i);
- }
-
- avahi_record_unref(record);
- }
- }
-
- if (!avahi_record_list_is_empty(s->record_list))
- avahi_server_generate_response(s, i, p, a, port, legacy_unicast, is_probe);
-
- return;
-
-fail:
- avahi_record_list_flush(s->record_list);
-}
-
-static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a, int from_local_iface) {
- unsigned n;
-
- assert(s);
- assert(p);
- assert(i);
- assert(a);
-
- for (n = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) +
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT); n > 0; n--) {
- AvahiRecord *record;
- int cache_flush = 0;
-/* char *txt; */
-
- if (!(record = avahi_dns_packet_consume_record(p, &cache_flush))) {
- avahi_log_warn(__FILE__": Packet too short or invalid while reading response record. (Maybe an UTF8 problem?)");
- break;
- }
-
- if (!avahi_key_is_pattern(record->key)) {
-
- if (handle_conflict(s, i, record, cache_flush)) {
- if (!from_local_iface)
- reflect_response(s, i, record, cache_flush);
- avahi_cache_update(i->cache, record, cache_flush, a);
- avahi_response_scheduler_incoming(i->response_scheduler, record, cache_flush);
- }
- }
-
- avahi_record_unref(record);
- }
-
- /* If the incoming response contained a conflicting record, some
- records have been scheduling for sending. We need to flush them
- here. */
- if (!avahi_record_list_is_empty(s->record_list))
- avahi_server_generate_response(s, i, NULL, NULL, 0, 0, 1);
-}
-
-static AvahiLegacyUnicastReflectSlot* allocate_slot(AvahiServer *s) {
- unsigned n, idx = (unsigned) -1;
- AvahiLegacyUnicastReflectSlot *slot;
-
- assert(s);
-
- if (!s->legacy_unicast_reflect_slots)
- s->legacy_unicast_reflect_slots = avahi_new0(AvahiLegacyUnicastReflectSlot*, AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX);
-
- for (n = 0; n < AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX; n++, s->legacy_unicast_reflect_id++) {
- idx = s->legacy_unicast_reflect_id % AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX;
-
- if (!s->legacy_unicast_reflect_slots[idx])
- break;
- }
-
- if (idx == (unsigned) -1 || s->legacy_unicast_reflect_slots[idx])
- return NULL;
-
- if (!(slot = avahi_new(AvahiLegacyUnicastReflectSlot, 1)))
- return NULL; /* OOM */
-
- s->legacy_unicast_reflect_slots[idx] = slot;
- slot->id = s->legacy_unicast_reflect_id++;
- slot->server = s;
-
- return slot;
-}
-
-static void deallocate_slot(AvahiServer *s, AvahiLegacyUnicastReflectSlot *slot) {
- unsigned idx;
-
- assert(s);
- assert(slot);
-
- idx = slot->id % AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX;
-
- assert(s->legacy_unicast_reflect_slots[idx] == slot);
-
- avahi_time_event_free(slot->time_event);
-
- avahi_free(slot);
- s->legacy_unicast_reflect_slots[idx] = NULL;
-}
-
-static void free_slots(AvahiServer *s) {
- unsigned idx;
- assert(s);
-
- if (!s->legacy_unicast_reflect_slots)
- return;
-
- for (idx = 0; idx < AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX; idx ++)
- if (s->legacy_unicast_reflect_slots[idx])
- deallocate_slot(s, s->legacy_unicast_reflect_slots[idx]);
-
- avahi_free(s->legacy_unicast_reflect_slots);
- s->legacy_unicast_reflect_slots = NULL;
-}
-
-static AvahiLegacyUnicastReflectSlot* find_slot(AvahiServer *s, uint16_t id) {
- unsigned idx;
-
- assert(s);
-
- if (!s->legacy_unicast_reflect_slots)
- return NULL;
-
- idx = id % AVAHI_LEGACY_UNICAST_REFLECT_SLOTS_MAX;
-
- if (!s->legacy_unicast_reflect_slots[idx] || s->legacy_unicast_reflect_slots[idx]->id != id)
- return NULL;
-
- return s->legacy_unicast_reflect_slots[idx];
-}
-
-static void legacy_unicast_reflect_slot_timeout(AvahiTimeEvent *e, void *userdata) {
- AvahiLegacyUnicastReflectSlot *slot = userdata;
-
- assert(e);
- assert(slot);
- assert(slot->time_event == e);
-
- deallocate_slot(slot->server, slot);
-}
-
-static void reflect_legacy_unicast_query_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInterface *i, const AvahiAddress *a, uint16_t port) {
- AvahiLegacyUnicastReflectSlot *slot;
- AvahiInterface *j;
-
- assert(s);
- assert(p);
- assert(i);
- assert(a);
- assert(port > 0);
- assert(i->protocol == a->proto);
-
- if (!s->config.enable_reflector)
- return;
-
- /* Reflecting legacy unicast queries is a little more complicated
- than reflecting normal queries, since we must route the
- responses back to the right client. Therefore we must store
- some information for finding the right client contact data for
- response packets. In contrast to normal queries legacy
- unicast query and response packets are reflected untouched and
- are not reassembled into larger packets */
-
- if (!(slot = allocate_slot(s))) {
- /* No slot available, we drop this legacy unicast query */
- avahi_log_warn("No slot available for legacy unicast reflection, dropping query packet.");
- return;
- }
-
- slot->original_id = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID);
- slot->address = *a;
- slot->port = port;
- slot->interface = i->hardware->index;
-
- avahi_elapse_time(&slot->elapse_time, 2000, 0);
- slot->time_event = avahi_time_event_new(s->time_event_queue, &slot->elapse_time, legacy_unicast_reflect_slot_timeout, slot);
-
- /* Patch the packet with our new locally generatet id */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->id);
-
- for (j = s->monitor->interfaces; j; j = j->interface_next)
- if (avahi_interface_is_relevant(j) &&
- j != i &&
- (s->config.reflect_ipv || j->protocol == i->protocol)) {
-
- if (j->protocol == AVAHI_PROTO_INET && s->fd_legacy_unicast_ipv4 >= 0) {
- avahi_send_dns_packet_ipv4(s->fd_legacy_unicast_ipv4, j->hardware->index, p, NULL, NULL, 0);
- } else if (j->protocol == AVAHI_PROTO_INET6 && s->fd_legacy_unicast_ipv6 >= 0)
- avahi_send_dns_packet_ipv6(s->fd_legacy_unicast_ipv6, j->hardware->index, p, NULL, NULL, 0);
- }
-
- /* Reset the id */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->original_id);
-}
-
-static int originates_from_local_legacy_unicast_socket(AvahiServer *s, const AvahiAddress *address, uint16_t port) {
- assert(s);
- assert(address);
- assert(port > 0);
-
- if (!s->config.enable_reflector)
- return 0;
-
- if (!avahi_address_is_local(s->monitor, address))
- return 0;
-
- if (address->proto == AVAHI_PROTO_INET && s->fd_legacy_unicast_ipv4 >= 0) {
- struct sockaddr_in lsa;
- socklen_t l = sizeof(lsa);
-
- if (getsockname(s->fd_legacy_unicast_ipv4, (struct sockaddr*) &lsa, &l) != 0)
- avahi_log_warn("getsockname(): %s", strerror(errno));
- else
- return lsa.sin_port == port;
-
- }
-
- if (address->proto == AVAHI_PROTO_INET6 && s->fd_legacy_unicast_ipv6 >= 0) {
- struct sockaddr_in6 lsa;
- socklen_t l = sizeof(lsa);
-
- if (getsockname(s->fd_legacy_unicast_ipv6, (struct sockaddr*) &lsa, &l) != 0)
- avahi_log_warn("getsockname(): %s", strerror(errno));
- else
- return lsa.sin6_port == port;
- }
-
- return 0;
-}
-
-static int is_mdns_mcast_address(const AvahiAddress *a) {
- AvahiAddress b;
- assert(a);
-
- avahi_address_parse(a->proto == AVAHI_PROTO_INET ? AVAHI_IPV4_MCAST_GROUP : AVAHI_IPV6_MCAST_GROUP, a->proto, &b);
- return avahi_address_cmp(a, &b) == 0;
-}
-
-static int originates_from_local_iface(AvahiServer *s, AvahiIfIndex iface, const AvahiAddress *a, uint16_t port) {
- assert(s);
- assert(iface != AVAHI_IF_UNSPEC);
- assert(a);
-
- /* If it isn't the MDNS port it can't be generated by us */
- if (port != AVAHI_MDNS_PORT)
- return 0;
-
- return avahi_interface_has_address(s->monitor, iface, a);
-}
-
-static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddress *src_address, uint16_t port, const AvahiAddress *dst_address, AvahiIfIndex iface, int ttl) {
- AvahiInterface *i;
- int from_local_iface = 0;
-
- assert(s);
- assert(p);
- assert(src_address);
- assert(dst_address);
- assert(iface > 0);
- assert(src_address->proto == dst_address->proto);
-
- if (!(i = avahi_interface_monitor_get_interface(s->monitor, iface, src_address->proto)) ||
- !avahi_interface_is_relevant(i)) {
- avahi_log_warn("Recieved packet from invalid interface.");
- return;
- }
-
- if (avahi_address_is_ipv4_in_ipv6(src_address))
- /* This is an IPv4 address encapsulated in IPv6, so let's ignore it. */
- return;
-
- if (originates_from_local_legacy_unicast_socket(s, src_address, port))
- /* This originates from our local reflector, so let's ignore it */
- return;
-
- /* We don't want to reflect local traffic, so we check if this packet is generated locally. */
- if (s->config.enable_reflector)
- from_local_iface = originates_from_local_iface(s, iface, src_address, port);
-
- if (avahi_dns_packet_check_valid_multicast(p) < 0) {
- avahi_log_warn("Recieved invalid packet.");
- return;
- }
-
- if (avahi_dns_packet_is_query(p)) {
- int legacy_unicast = 0;
-
- if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT) != 0) {
- avahi_log_warn("Invalid query packet.");
- return;
- }
-
- if (port != AVAHI_MDNS_PORT) {
- /* Legacy Unicast */
-
- if ((avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) != 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0)) {
- avahi_log_warn("Invalid legacy unicast query packet.");
- return;
- }
-
- legacy_unicast = 1;
- }
-
- if (legacy_unicast)
- reflect_legacy_unicast_query_packet(s, p, i, src_address, port);
-
- handle_query_packet(s, p, i, src_address, port, legacy_unicast, from_local_iface);
-
- } else {
- if (port != AVAHI_MDNS_PORT) {
- avahi_log_warn("Recieved repsonse with invalid source port %u on interface '%s.%i'", port, i->hardware->name, i->protocol);
- return;
- }
-
- if (ttl != 255 && s->config.check_response_ttl) {
- avahi_log_warn("Recieved response with invalid TTL %u on interface '%s.%i'.", ttl, i->hardware->name, i->protocol);
- return;
- }
-
- if (!is_mdns_mcast_address(dst_address) &&
- !avahi_interface_address_on_link(i, src_address)) {
- avahi_log_warn("Received non-local response on interface '%s.%i'.", i->hardware->name, i->protocol);
- return;
- }
-
- if (avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT) != 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) != 0) {
- avahi_log_warn("Invalid response packet.");
- return;
- }
-
- handle_response_packet(s, p, i, src_address, from_local_iface);
- }
-}
-
-static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p) {
- AvahiInterface *j;
- AvahiLegacyUnicastReflectSlot *slot;
-
- assert(s);
- assert(p);
-
- if (avahi_dns_packet_check_valid(p) < 0 || avahi_dns_packet_is_query(p)) {
- avahi_log_warn("Recieved invalid packet.");
- return;
- }
-
- if (!(slot = find_slot(s, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID)))) {
- avahi_log_warn("Recieved legacy unicast response with unknown id");
- return;
- }
-
- if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.proto)) ||
- !avahi_interface_is_relevant(j))
- return;
-
- /* Patch the original ID into this response */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->original_id);
-
- /* Forward the response to the correct client */
- avahi_interface_send_packet_unicast(j, p, &slot->address, slot->port);
-
- /* Undo changes to packet */
- avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->id);
-}
-
-static void cleanup_dead(AvahiServer *s) {
- assert(s);
-
- avahi_cleanup_dead_entries(s);
- avahi_browser_cleanup(s);
-}
-
-static void mcast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *userdata) {
- AvahiServer *s = userdata;
- AvahiAddress dest, src;
- AvahiDnsPacket *p = NULL;
- AvahiIfIndex iface;
- uint16_t port;
- uint8_t ttl;
-
- assert(w);
- assert(fd >= 0);
- assert(events & AVAHI_WATCH_IN);
-
- if (fd == s->fd_ipv4) {
- dest.proto = src.proto = AVAHI_PROTO_INET;
- p = avahi_recv_dns_packet_ipv4(s->fd_ipv4, &src.data.ipv4, &port, &dest.data.ipv4, &iface, &ttl);
- } else {
- assert(fd == s->fd_ipv6);
- dest.proto = src.proto = AVAHI_PROTO_INET6;
- p = avahi_recv_dns_packet_ipv6(s->fd_ipv6, &src.data.ipv6, &port, &dest.data.ipv6, &iface, &ttl);
- }
-
- if (p) {
- if (iface == AVAHI_IF_UNSPEC)
- iface = avahi_find_interface_for_address(s->monitor, &dest);
-
- if (iface != AVAHI_IF_UNSPEC)
- dispatch_packet(s, p, &src, port, &dest, iface, ttl);
- else
- avahi_log_error("Incoming packet recieved on address that isn't local.");
-
- avahi_dns_packet_free(p);
-
- cleanup_dead(s);
- }
-}
-
-static void legacy_unicast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *userdata) {
- AvahiServer *s = userdata;
- AvahiDnsPacket *p = NULL;
-
- assert(w);
- assert(fd >= 0);
- assert(events & AVAHI_WATCH_IN);
-
- if (fd == s->fd_legacy_unicast_ipv4)
- p = avahi_recv_dns_packet_ipv4(s->fd_legacy_unicast_ipv4, NULL, NULL, NULL, NULL, NULL);
- else {
- assert(fd == s->fd_legacy_unicast_ipv6);
- p = avahi_recv_dns_packet_ipv6(s->fd_legacy_unicast_ipv6, NULL, NULL, NULL, NULL, NULL);
- }
-
- if (p) {
- dispatch_legacy_unicast_packet(s, p);
- avahi_dns_packet_free(p);
-
- cleanup_dead(s);
- }
-}
-
-static void server_set_state(AvahiServer *s, AvahiServerState state) {
- assert(s);
-
- if (s->state == state)
- return;
-
- s->state = state;
-
- avahi_interface_monitor_update_rrs(s->monitor, 0);
-
- if (s->callback)
- s->callback(s, state, s->userdata);
-}
-
-static void withdraw_host_rrs(AvahiServer *s) {
- assert(s);
-
- if (s->hinfo_entry_group)
- avahi_s_entry_group_reset(s->hinfo_entry_group);
-
- if (s->browse_domain_entry_group)
- avahi_s_entry_group_reset(s->browse_domain_entry_group);
-
- avahi_interface_monitor_update_rrs(s->monitor, 1);
- s->n_host_rr_pending = 0;
-}
-
-void avahi_server_decrease_host_rr_pending(AvahiServer *s) {
- assert(s);
-
- assert(s->n_host_rr_pending > 0);
-
- if (--s->n_host_rr_pending == 0)
- server_set_state(s, AVAHI_SERVER_RUNNING);
-}
-
-void avahi_host_rr_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) {
- assert(s);
- assert(g);
-
- if (state == AVAHI_ENTRY_GROUP_REGISTERING &&
- s->state == AVAHI_SERVER_REGISTERING)
- s->n_host_rr_pending ++;
-
- else if (state == AVAHI_ENTRY_GROUP_COLLISION &&
- (s->state == AVAHI_SERVER_REGISTERING || s->state == AVAHI_SERVER_RUNNING)) {
- withdraw_host_rrs(s);
- server_set_state(s, AVAHI_SERVER_COLLISION);
-
- } else if (state == AVAHI_ENTRY_GROUP_ESTABLISHED &&
- s->state == AVAHI_SERVER_REGISTERING)
- avahi_server_decrease_host_rr_pending(s);
-}
-
-static void register_hinfo(AvahiServer *s) {
- struct utsname utsname;
- AvahiRecord *r;
-
- assert(s);
-
- if (!s->config.publish_hinfo)
- return;
-
- if (s->hinfo_entry_group)
- assert(avahi_s_entry_group_is_empty(s->hinfo_entry_group));
- else
- s->hinfo_entry_group = avahi_s_entry_group_new(s, avahi_host_rr_entry_group_callback, NULL);
-
- if (!s->hinfo_entry_group) {
- avahi_log_warn("Failed to create HINFO entry group: %s", avahi_strerror(s->error));
- return;
- }
-
- /* Fill in HINFO rr */
- if ((r = avahi_record_new_full(s->host_name_fqdn, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_HINFO, AVAHI_DEFAULT_TTL_HOST_NAME))) {
-
- if (uname(&utsname) < 0)
- avahi_log_warn("uname() failed: %s\n", avahi_strerror(errno));
- else {
-
- r->data.hinfo.cpu = avahi_strdup(avahi_strup(utsname.machine));
- r->data.hinfo.os = avahi_strdup(avahi_strup(utsname.sysname));
-
- avahi_log_info("Registering HINFO record with values '%s'/'%s'.", r->data.hinfo.cpu, r->data.hinfo.os);
-
- if (avahi_server_add(s, s->hinfo_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_UNIQUE, r) < 0) {
- avahi_log_warn("Failed to add HINFO RR: %s", avahi_strerror(s->error));
- return;
- }
- }
-
- avahi_record_unref(r);
- }
-
- if (avahi_s_entry_group_commit(s->hinfo_entry_group) < 0)
- avahi_log_warn("Failed to commit HINFO entry group: %s", avahi_strerror(s->error));
-
-}
-
-static void register_localhost(AvahiServer *s) {
- AvahiAddress a;
- assert(s);
-
- /* Add localhost entries */
- avahi_address_parse("127.0.0.1", AVAHI_PROTO_INET, &a);
- avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_NO_ANNOUNCE, "localhost", &a);
-
- avahi_address_parse("::1", AVAHI_PROTO_INET6, &a);
- avahi_server_add_address(s, NULL, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, AVAHI_PUBLISH_NO_PROBE|AVAHI_PUBLISH_NO_ANNOUNCE, "ip6-localhost", &a);
-}
-
-static void register_browse_domain(AvahiServer *s) {
- assert(s);
-
- if (!s->config.publish_domain)
- return;
-
- if (avahi_domain_equal(s->domain_name, "local"))
- return;
-
- if (s->browse_domain_entry_group)
- assert(avahi_s_entry_group_is_empty(s->browse_domain_entry_group));
- else
- s->browse_domain_entry_group = avahi_s_entry_group_new(s, NULL, NULL);
-
- if (!s->browse_domain_entry_group) {
- avahi_log_warn("Failed to create browse domain entry group: %s", avahi_strerror(s->error));
- return;
- }
-
- if (avahi_server_add_ptr(s, s->browse_domain_entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, AVAHI_DEFAULT_TTL, "b._dns-sd._udp.local", s->domain_name) < 0) {
- avahi_log_warn("Failed to add browse domain RR: %s", avahi_strerror(s->error));
- return;
- }
-
- if (avahi_s_entry_group_commit(s->browse_domain_entry_group) < 0)
- avahi_log_warn("Failed to commit browse domain entry group: %s", avahi_strerror(s->error));
-}
-
-static void register_stuff(AvahiServer *s) {
- assert(s);
-
- server_set_state(s, AVAHI_SERVER_REGISTERING);
- s->n_host_rr_pending ++; /** Make sure that the state isn't changed tp AVAHI_SERVER_RUNNING too early */
-
- register_hinfo(s);
- register_browse_domain(s);
- avahi_interface_monitor_update_rrs(s->monitor, 0);
-
- s->n_host_rr_pending --;
-
- if (s->n_host_rr_pending == 0)
- server_set_state(s, AVAHI_SERVER_RUNNING);
-}
-
-static void update_fqdn(AvahiServer *s) {
- char *n;
-
- assert(s);
- assert(s->host_name);
- assert(s->domain_name);
-
- if (!(n = avahi_strdup_printf("%s.%s", s->host_name, s->domain_name)))
- return; /* OOM */
-
- avahi_free(s->host_name_fqdn);
- s->host_name_fqdn = n;
-}
-
-int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
- char *hn = NULL;
- assert(s);
-
- AVAHI_CHECK_VALIDITY(s, !host_name || avahi_is_valid_host_name(host_name), AVAHI_ERR_INVALID_HOST_NAME);
-
- if (!host_name) {
- hn = avahi_get_host_name_strdup();
- hn[strcspn(hn, ".")] = 0;
- host_name = hn;
- }
-
- if (avahi_domain_equal(s->host_name, host_name) && s->state != AVAHI_SERVER_COLLISION) {
- avahi_free(hn);
- return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
- }
-
- withdraw_host_rrs(s);
-
- avahi_free(s->host_name);
- s->host_name = hn ? hn : avahi_strdup(host_name);
-
- update_fqdn(s);
-
- register_stuff(s);
- return AVAHI_OK;
-}
-
-int avahi_server_set_domain_name(AvahiServer *s, const char *domain_name) {
- char *dn = NULL;
- assert(s);
-
- AVAHI_CHECK_VALIDITY(s, !domain_name || avahi_is_valid_domain_name(domain_name), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if (!domain_name) {
- dn = avahi_strdup("local");
- domain_name = dn;
- }
-
- if (avahi_domain_equal(s->domain_name, domain_name)) {
- avahi_free(dn);
- return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
- }
-
- withdraw_host_rrs(s);
-
- avahi_free(s->domain_name);
- s->domain_name = avahi_normalize_name_strdup(domain_name);
- update_fqdn(s);
-
- register_stuff(s);
-
- avahi_free(dn);
- return AVAHI_OK;
-}
-
-static int valid_server_config(const AvahiServerConfig *sc) {
-
- if (sc->host_name && !avahi_is_valid_host_name(sc->host_name))
- return AVAHI_ERR_INVALID_HOST_NAME;
-
- if (sc->domain_name && !avahi_is_valid_domain_name(sc->domain_name))
- return AVAHI_ERR_INVALID_DOMAIN_NAME;
-
- return AVAHI_OK;
-}
-
-static int setup_sockets(AvahiServer *s) {
- assert(s);
-
- s->fd_ipv4 = s->config.use_ipv4 ? avahi_open_socket_ipv4(s->config.disallow_other_stacks) : -1;
- s->fd_ipv6 = s->config.use_ipv6 ? avahi_open_socket_ipv6(s->config.disallow_other_stacks) : -1;
-
- if (s->fd_ipv6 < 0 && s->fd_ipv4 < 0)
- return AVAHI_ERR_NO_NETWORK;
-
- if (s->fd_ipv4 < 0 && s->config.use_ipv4)
- avahi_log_notice("Failed to create IPv4 socket, proceeding in IPv6 only mode");
- else if (s->fd_ipv6 < 0 && s->config.use_ipv6)
- avahi_log_notice("Failed to create IPv6 socket, proceeding in IPv4 only mode");
-
- s->fd_legacy_unicast_ipv4 = s->fd_ipv4 >= 0 && s->config.enable_reflector ? avahi_open_unicast_socket_ipv4() : -1;
- s->fd_legacy_unicast_ipv6 = s->fd_ipv6 >= 0 && s->config.enable_reflector ? avahi_open_unicast_socket_ipv6() : -1;
-
- s->watch_ipv4 =
- s->watch_ipv6 =
- s->watch_legacy_unicast_ipv4 =
- s->watch_legacy_unicast_ipv6 = NULL;
-
- if (s->fd_ipv4 >= 0)
- s->watch_ipv4 = s->poll_api->watch_new(s->poll_api, s->fd_ipv4, AVAHI_WATCH_IN, mcast_socket_event, s);
- if (s->fd_ipv6 >= 0)
- s->watch_ipv6 = s->poll_api->watch_new(s->poll_api, s->fd_ipv6, AVAHI_WATCH_IN, mcast_socket_event, s);
-
- if (s->fd_legacy_unicast_ipv4 >= 0)
- s->watch_legacy_unicast_ipv4 = s->poll_api->watch_new(s->poll_api, s->fd_legacy_unicast_ipv4, AVAHI_WATCH_IN, legacy_unicast_socket_event, s);
- if (s->fd_legacy_unicast_ipv6 >= 0)
- s->watch_legacy_unicast_ipv6 = s->poll_api->watch_new(s->poll_api, s->fd_legacy_unicast_ipv6, AVAHI_WATCH_IN, legacy_unicast_socket_event, s);
-
- return 0;
-}
-
-AvahiServer *avahi_server_new(const AvahiPoll *poll_api, const AvahiServerConfig *sc, AvahiServerCallback callback, void* userdata, int *error) {
- AvahiServer *s;
- int e;
-
- if (sc && (e = valid_server_config(sc)) < 0) {
- if (error)
- *error = e;
- return NULL;
- }
-
- if (!(s = avahi_new(AvahiServer, 1))) {
- if (error)
- *error = AVAHI_ERR_NO_MEMORY;
-
- return NULL;
- }
-
- s->poll_api = poll_api;
-
- if (sc)
- avahi_server_config_copy(&s->config, sc);
- else
- avahi_server_config_init(&s->config);
-
- if ((e = setup_sockets(s)) < 0) {
- if (error)
- *error = e;
-
- avahi_server_config_free(&s->config);
- avahi_free(s);
-
- return NULL;
- }
-
- s->n_host_rr_pending = 0;
- s->need_entry_cleanup = 0;
- s->need_group_cleanup = 0;
- s->need_browser_cleanup = 0;
- s->hinfo_entry_group = NULL;
- s->browse_domain_entry_group = NULL;
- s->error = AVAHI_OK;
- s->state = AVAHI_SERVER_INVALID;
-
- s->callback = callback;
- s->userdata = userdata;
-
- s->time_event_queue = avahi_time_event_queue_new(poll_api);
-
- s->entries_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiEntry, s->entries);
- AVAHI_LLIST_HEAD_INIT(AvahiGroup, s->groups);
-
- s->record_browser_hashmap = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, NULL, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiSRecordBrowser, s->record_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSHostNameResolver, s->host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiSAddressResolver, s->address_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiSDomainBrowser, s->domain_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSServiceTypeBrowser, s->service_type_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSServiceBrowser, s->service_browsers);
- AVAHI_LLIST_HEAD_INIT(AvahiSServiceResolver, s->service_resolvers);
- AVAHI_LLIST_HEAD_INIT(AvahiSDNSServerBrowser, s->dns_server_browsers);
-
- s->legacy_unicast_reflect_slots = NULL;
- s->legacy_unicast_reflect_id = 0;
-
- s->record_list = avahi_record_list_new();
-
- /* Get host name */
- s->host_name = s->config.host_name ? avahi_normalize_name_strdup(s->config.host_name) : avahi_get_host_name_strdup();
- s->host_name[strcspn(s->host_name, ".")] = 0;
- s->domain_name = s->config.domain_name ? avahi_normalize_name_strdup(s->config.domain_name) : avahi_strdup("local");
- s->host_name_fqdn = NULL;
- update_fqdn(s);
-
- do {
- s->local_service_cookie = (uint32_t) rand() * (uint32_t) rand();
- } while (s->local_service_cookie == AVAHI_SERVICE_COOKIE_INVALID);
-
- if (s->config.enable_wide_area) {
- s->wide_area_lookup_engine = avahi_wide_area_engine_new(s);
- avahi_wide_area_set_servers(s->wide_area_lookup_engine, s->config.wide_area_servers, s->config.n_wide_area_servers);
- } else
- s->wide_area_lookup_engine = NULL;
-
- s->multicast_lookup_engine = avahi_multicast_lookup_engine_new(s);
-
- s->monitor = avahi_interface_monitor_new(s);
- avahi_interface_monitor_sync(s->monitor);
-
- register_localhost(s);
- register_stuff(s);
-
- return s;
-}
-
-void avahi_server_free(AvahiServer* s) {
- assert(s);
-
- /* Remove all browsers */
-
- while (s->dns_server_browsers)
- avahi_s_dns_server_browser_free(s->dns_server_browsers);
- while (s->host_name_resolvers)
- avahi_s_host_name_resolver_free(s->host_name_resolvers);
- while (s->address_resolvers)
- avahi_s_address_resolver_free(s->address_resolvers);
- while (s->domain_browsers)
- avahi_s_domain_browser_free(s->domain_browsers);
- while (s->service_type_browsers)
- avahi_s_service_type_browser_free(s->service_type_browsers);
- while (s->service_browsers)
- avahi_s_service_browser_free(s->service_browsers);
- while (s->service_resolvers)
- avahi_s_service_resolver_free(s->service_resolvers);
- while (s->record_browsers)
- avahi_s_record_browser_destroy(s->record_browsers);
-
- /* Remove all locally rgeistered stuff */
-
- while(s->entries)
- avahi_entry_free(s, s->entries);
-
- avahi_interface_monitor_free(s->monitor);
-
- while (s->groups)
- avahi_entry_group_free(s, s->groups);
-
- free_slots(s);
-
- avahi_hashmap_free(s->entries_by_key);
- avahi_record_list_free(s->record_list);
- avahi_hashmap_free(s->record_browser_hashmap);
-
- if (s->wide_area_lookup_engine)
- avahi_wide_area_engine_free(s->wide_area_lookup_engine);
- avahi_multicast_lookup_engine_free(s->multicast_lookup_engine);
-
- avahi_time_event_queue_free(s->time_event_queue);
-
- /* Free watches */
-
- if (s->watch_ipv4)
- s->poll_api->watch_free(s->watch_ipv4);
- if (s->watch_ipv6)
- s->poll_api->watch_free(s->watch_ipv6);
-
- if (s->watch_legacy_unicast_ipv4)
- s->poll_api->watch_free(s->watch_legacy_unicast_ipv4);
- if (s->watch_legacy_unicast_ipv6)
- s->poll_api->watch_free(s->watch_legacy_unicast_ipv6);
-
- /* Free sockets */
-
- if (s->fd_ipv4 >= 0)
- close(s->fd_ipv4);
- if (s->fd_ipv6 >= 0)
- close(s->fd_ipv6);
-
- if (s->fd_legacy_unicast_ipv4 >= 0)
- close(s->fd_legacy_unicast_ipv4);
- if (s->fd_legacy_unicast_ipv6 >= 0)
- close(s->fd_legacy_unicast_ipv6);
-
- /* Free other stuff */
-
- avahi_free(s->host_name);
- avahi_free(s->domain_name);
- avahi_free(s->host_name_fqdn);
-
- avahi_server_config_free(&s->config);
-
- avahi_free(s);
-}
-
-const char* avahi_server_get_domain_name(AvahiServer *s) {
- assert(s);
-
- return s->domain_name;
-}
-
-const char* avahi_server_get_host_name(AvahiServer *s) {
- assert(s);
-
- return s->host_name;
-}
-
-const char* avahi_server_get_host_name_fqdn(AvahiServer *s) {
- assert(s);
-
- return s->host_name_fqdn;
-}
-
-void* avahi_server_get_data(AvahiServer *s) {
- assert(s);
-
- return s->userdata;
-}
-
-void avahi_server_set_data(AvahiServer *s, void* userdata) {
- assert(s);
-
- s->userdata = userdata;
-}
-
-AvahiServerState avahi_server_get_state(AvahiServer *s) {
- assert(s);
-
- return s->state;
-}
-
-AvahiServerConfig* avahi_server_config_init(AvahiServerConfig *c) {
- assert(c);
-
- memset(c, 0, sizeof(AvahiServerConfig));
- c->use_ipv6 = 1;
- c->use_ipv4 = 1;
- c->host_name = NULL;
- c->domain_name = NULL;
- c->check_response_ttl = 0;
- c->publish_hinfo = 1;
- c->publish_addresses = 1;
- c->publish_workstation = 1;
- c->publish_domain = 1;
- c->use_iff_running = 0;
- c->enable_reflector = 0;
- c->reflect_ipv = 0;
- c->add_service_cookie = 1;
- c->enable_wide_area = 0;
- c->n_wide_area_servers = 0;
- c->disallow_other_stacks = 0;
- c->browse_domains = NULL;
- c->disable_publishing = 0;
- c->allow_point_to_point = 0;
-
- return c;
-}
-
-void avahi_server_config_free(AvahiServerConfig *c) {
- assert(c);
-
- avahi_free(c->host_name);
- avahi_free(c->domain_name);
- avahi_string_list_free(c->browse_domains);
-}
-
-AvahiServerConfig* avahi_server_config_copy(AvahiServerConfig *ret, const AvahiServerConfig *c) {
- char *d = NULL, *h = NULL;
- AvahiStringList *l = NULL;
- assert(ret);
- assert(c);
-
- if (c->host_name)
- if (!(h = avahi_strdup(c->host_name)))
- return NULL;
-
- if (c->domain_name)
- if (!(d = avahi_strdup(c->domain_name))) {
- avahi_free(h);
- return NULL;
- }
-
- if (!(l = avahi_string_list_copy(c->browse_domains)) && c->browse_domains) {
- avahi_free(h);
- avahi_free(d);
- return NULL;
- }
-
- *ret = *c;
- ret->host_name = h;
- ret->domain_name = d;
- ret->browse_domains = l;
-
- return ret;
-}
-
-int avahi_server_errno(AvahiServer *s) {
- assert(s);
-
- return s->error;
-}
-
-/* Just for internal use */
-int avahi_server_set_errno(AvahiServer *s, int error) {
- assert(s);
-
- return s->error = error;
-}
-
-uint32_t avahi_server_get_local_service_cookie(AvahiServer *s) {
- assert(s);
-
- return s->local_service_cookie;
-}
-
-static AvahiEntry *find_entry(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiKey *key) {
- AvahiEntry *e;
-
- assert(s);
- assert(key);
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, key); e; e = e->by_key_next)
-
- if ((e->interface == interface || e->interface <= 0 || interface <= 0) &&
- (e->protocol == protocol || e->protocol == AVAHI_PROTO_UNSPEC || protocol == AVAHI_PROTO_UNSPEC) &&
- (!e->group || e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED || e->group->state == AVAHI_ENTRY_GROUP_REGISTERING))
-
- return e;
-
- return NULL;
-}
-
-int avahi_server_get_group_of_service(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, AvahiSEntryGroup** ret_group) {
- AvahiKey *key = NULL;
- AvahiEntry *e;
- int ret;
- char n[AVAHI_DOMAIN_NAME_MAX];
-
- assert(s);
- assert(name);
- assert(type);
- assert(ret_group);
-
- AVAHI_CHECK_VALIDITY(s, AVAHI_IF_VALID(interface), AVAHI_ERR_INVALID_INTERFACE);
- AVAHI_CHECK_VALIDITY(s, AVAHI_PROTO_VALID(protocol), AVAHI_ERR_INVALID_PROTOCOL);
- AVAHI_CHECK_VALIDITY(s, avahi_is_valid_service_name(name), AVAHI_ERR_INVALID_SERVICE_NAME);
- AVAHI_CHECK_VALIDITY(s, avahi_is_valid_service_type_strict(type), AVAHI_ERR_INVALID_SERVICE_TYPE);
- AVAHI_CHECK_VALIDITY(s, !domain || avahi_is_valid_domain_name(domain), AVAHI_ERR_INVALID_DOMAIN_NAME);
-
- if ((ret = avahi_service_name_join(n, sizeof(n), name, type, domain) < 0))
- return avahi_server_set_errno(s, ret);
-
- if (!(key = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV)))
- return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
-
- e = find_entry(s, interface, protocol, key);
- avahi_key_unref(key);
-
- if (e) {
- *ret_group = e->group;
- return AVAHI_OK;
- }
-
- return avahi_server_set_errno(s, AVAHI_ERR_NOT_FOUND);
-}
-
-int avahi_server_is_service_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, const char *name) {
- AvahiKey *key = NULL;
- AvahiEntry *e;
-
- assert(s);
- assert(name);
-
- if (!s->host_name_fqdn)
- return 0;
-
- if (!(key = avahi_key_new(name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_SRV)))
- return 0;
-
- e = find_entry(s, interface, protocol, key);
- avahi_key_unref(key);
-
- if (!e)
- return 0;
-
- return avahi_domain_equal(s->host_name_fqdn, e->record->data.srv.name);
-}
-
-int avahi_server_is_record_local(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *record) {
- AvahiEntry *e;
-
- assert(s);
- assert(record);
-
- for (e = avahi_hashmap_lookup(s->entries_by_key, record->key); e; e = e->by_key_next)
-
- if ((e->interface == interface || e->interface <= 0 || interface <= 0) &&
- (e->protocol == protocol || e->protocol == AVAHI_PROTO_UNSPEC || protocol == AVAHI_PROTO_UNSPEC) &&
- (!e->group || e->group->state == AVAHI_ENTRY_GROUP_ESTABLISHED || e->group->state == AVAHI_ENTRY_GROUP_REGISTERING) &&
- avahi_record_equal_no_ttl(record, e->record))
- return 1;
-
- return 0;
-}
-
-/** Set the wide area DNS servers */
-int avahi_server_set_wide_area_servers(AvahiServer *s, const AvahiAddress *a, unsigned n) {
- assert(s);
-
- if (!s->wide_area_lookup_engine)
- return avahi_server_set_errno(s, AVAHI_ERR_INVALID_CONFIG);
-
- avahi_wide_area_set_servers(s->wide_area_lookup_engine, a, n);
- return AVAHI_OK;
-}
diff --git a/trunk/avahi-core/socket.c b/trunk/avahi-core/socket.c
deleted file mode 100644
index 9291f08..0000000
--- a/trunk/avahi-core/socket.c
+++ /dev/null
@@ -1,930 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <inttypes.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
-#include <assert.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <sys/uio.h>
-
-#ifdef IP_RECVIF
-#include <net/if_dl.h>
-#endif
-
-#include "dns.h"
-#include "fdutil.h"
-#include "socket.h"
-#include "log.h"
-#include "addr-util.h"
-
-/* this is a portability hack */
-#ifndef IPV6_ADD_MEMBERSHIP
-#ifdef IPV6_JOIN_GROUP
-#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
-#endif
-#endif
-
-#ifndef IPV6_DROP_MEMBERSHIP
-#ifdef IPV6_LEAVE_GROUP
-#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
-#endif
-#endif
-
-static void mdns_mcast_group_ipv4(struct sockaddr_in *ret_sa) {
- assert(ret_sa);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in));
- ret_sa->sin_family = AF_INET;
- ret_sa->sin_port = htons(AVAHI_MDNS_PORT);
- inet_pton(AF_INET, AVAHI_IPV4_MCAST_GROUP, &ret_sa->sin_addr);
-}
-
-static void mdns_mcast_group_ipv6(struct sockaddr_in6 *ret_sa) {
- assert(ret_sa);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in6));
- ret_sa->sin6_family = AF_INET6;
- ret_sa->sin6_port = htons(AVAHI_MDNS_PORT);
- inet_pton(AF_INET6, AVAHI_IPV6_MCAST_GROUP, &ret_sa->sin6_addr);
-}
-
-static void ipv4_address_to_sockaddr(struct sockaddr_in *ret_sa, const AvahiIPv4Address *a, uint16_t port) {
- assert(ret_sa);
- assert(a);
- assert(port > 0);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in));
- ret_sa->sin_family = AF_INET;
- ret_sa->sin_port = htons(port);
- memcpy(&ret_sa->sin_addr, a, sizeof(AvahiIPv4Address));
-}
-
-static void ipv6_address_to_sockaddr(struct sockaddr_in6 *ret_sa, const AvahiIPv6Address *a, uint16_t port) {
- assert(ret_sa);
- assert(a);
- assert(port > 0);
-
- memset(ret_sa, 0, sizeof(struct sockaddr_in6));
- ret_sa->sin6_family = AF_INET6;
- ret_sa->sin6_port = htons(port);
- memcpy(&ret_sa->sin6_addr, a, sizeof(AvahiIPv6Address));
-}
-
-int avahi_mdns_mcast_join_ipv4(int fd, const AvahiIPv4Address *a, int idx, int join) {
-#ifdef HAVE_STRUCT_IP_MREQN
- struct ip_mreqn mreq;
-#else
- struct ip_mreq mreq;
-#endif
- struct sockaddr_in sa;
-
- assert(fd >= 0);
- assert(idx >= 0);
- assert(a);
-
- memset(&mreq, 0, sizeof(mreq));
-#ifdef HAVE_STRUCT_IP_MREQN
- mreq.imr_ifindex = idx;
- mreq.imr_address.s_addr = a->address;
-#else
- mreq.imr_interface.s_addr = a->address;
-#endif
- mdns_mcast_group_ipv4(&sa);
- mreq.imr_multiaddr = sa.sin_addr;
-
- /* Some network drivers have issues with dropping membership of
- * mcast groups when the iface is down, but don't allow rejoining
- * when it comes back up. This is an ugly workaround */
- if (join)
- setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
-
- if (setsockopt(fd, IPPROTO_IP, join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
- avahi_log_warn("%s failed: %s", join ? "IP_ADD_MEMBERSHIP" : "IP_DROP_MEMBERSHIP", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-int avahi_mdns_mcast_join_ipv6(int fd, const AvahiIPv6Address *a, int idx, int join) {
- struct ipv6_mreq mreq6;
- struct sockaddr_in6 sa6;
-
- assert(fd >= 0);
- assert(idx >= 0);
- assert(a);
-
- memset(&mreq6, 0, sizeof(mreq6));
- mdns_mcast_group_ipv6 (&sa6);
- mreq6.ipv6mr_multiaddr = sa6.sin6_addr;
- mreq6.ipv6mr_interface = idx;
-
- if (join)
- setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6));
-
- if (setsockopt(fd, IPPROTO_IPV6, join ? IPV6_ADD_MEMBERSHIP : IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
- avahi_log_warn("%s failed: %s", join ? "IPV6_ADD_MEMBERSHIP" : "IPV6_DROP_MEMBERSHIP", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int reuseaddr(int fd) {
- int yes;
-
- yes = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("SO_REUSEADDR failed: %s", strerror(errno));
- return -1;
- }
-
-#ifdef SO_REUSEPORT
- yes = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("SO_REUSEPORT failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
- return 0;
-}
-
-static int bind_with_warn(int fd, const struct sockaddr *sa, socklen_t l) {
-
- assert(fd >= 0);
- assert(sa);
- assert(l > 0);
-
- if (bind(fd, sa, l) < 0) {
-
- if (errno != EADDRINUSE) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- return -1;
- }
-
- avahi_log_warn("*** WARNING: Detected another %s mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***",
- sa->sa_family == AF_INET ? "IPv4" : "IPv6");
-
- /* Try again, this time with SO_REUSEADDR set */
- if (reuseaddr(fd) < 0)
- return -1;
-
- if (bind(fd, sa, l) < 0) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- return -1;
- }
- } else {
-
- /* We enable SO_REUSEADDR afterwards, to make sure that the
- * user may run other mDNS implementations if he really
- * wants. */
-
- if (reuseaddr(fd) < 0)
- return -1;
- }
-
- return 0;
-}
-
-static int ipv4_pktinfo(int fd) {
- int yes;
-
-#ifdef IP_PKTINFO
- yes = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_PKTINFO failed: %s", strerror(errno));
- return -1;
- }
-#else
-
-#ifdef IP_RECVINTERFACE
- yes = 1;
- if (setsockopt (fd, IPPROTO_IP, IP_RECVINTERFACE, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVINTERFACE failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IP_RECVIF)
- yes = 1;
- if (setsockopt (fd, IPPROTO_IP, IP_RECVIF, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVIF failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
-#ifdef IP_RECVDSTADDR
- yes = 1;
- if (setsockopt (fd, IPPROTO_IP, IP_RECVDSTADDR, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVDSTADDR failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
-#endif /* IP_PKTINFO */
-
-#ifdef IP_RECVTTL
- yes = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_RECVTTL, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IP_RECVTTL failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
- return 0;
-}
-
-static int ipv6_pktinfo(int fd) {
- int yes;
-
-#ifdef IPV6_RECVPKTINFO
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_RECVPKTINFO failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IPV6_PKTINFO)
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_PKTINFO, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_PKTINFO failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
-#ifdef IPV6_RECVHOPS
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPS, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_RECVHOPS failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IPV6_RECVHOPLIMIT)
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_RECVHOPLIMIT failed: %s", strerror(errno));
- return -1;
- }
-#elif defined(IPV6_HOPLIMIT)
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_HOPLIMIT, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_HOPLIMIT failed: %s", strerror(errno));
- return -1;
- }
-#endif
-
- return 0;
-}
-
-int avahi_open_socket_ipv4(int no_reuse) {
- struct sockaddr_in local;
- int fd = -1, r, ittl;
- uint8_t ttl, cyes;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- ttl = 255;
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0) {
- avahi_log_warn("IP_MULTICAST_TTL failed: %s", strerror(errno));
- goto fail;
- }
-
- ittl = 255;
- if (setsockopt(fd, IPPROTO_IP, IP_TTL, &ittl, sizeof(ittl)) < 0) {
- avahi_log_warn("IP_TTL failed: %s", strerror(errno));
- goto fail;
- }
-
- cyes = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &cyes, sizeof(cyes)) < 0) {
- avahi_log_warn("IP_MULTICAST_LOOP failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin_family = AF_INET;
- local.sin_port = htons(AVAHI_MDNS_PORT);
-
- if (no_reuse)
- r = bind(fd, (struct sockaddr*) &local, sizeof(local));
- else
- r = bind_with_warn(fd, (struct sockaddr*) &local, sizeof(local));
-
- if (r < 0)
- goto fail;
-
- if (ipv4_pktinfo (fd) < 0)
- goto fail;
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-int avahi_open_socket_ipv6(int no_reuse) {
- struct sockaddr_in6 sa, local;
- int fd = -1, yes, r;
- int ttl;
-
- mdns_mcast_group_ipv6(&sa);
-
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- ttl = 255;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &ttl, sizeof(ttl)) < 0) {
- avahi_log_warn("IPV6_MULTICAST_HOPS failed: %s", strerror(errno));
- goto fail;
- }
-
- ttl = 255;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)) < 0) {
- avahi_log_warn("IPV6_UNICAST_HOPS failed: %s", strerror(errno));
- goto fail;
- }
-
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_V6ONLY failed: %s", strerror(errno));
- goto fail;
- }
-
- yes = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &yes, sizeof(yes)) < 0) {
- avahi_log_warn("IPV6_MULTICAST_LOOP failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin6_family = AF_INET6;
- local.sin6_port = htons(AVAHI_MDNS_PORT);
-
- if (no_reuse)
- r = bind(fd, (struct sockaddr*) &local, sizeof(local));
- else
- r = bind_with_warn(fd, (struct sockaddr*) &local, sizeof(local));
-
- if (r < 0)
- goto fail;
-
- if (ipv6_pktinfo(fd) < 0)
- goto fail;
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-static int sendmsg_loop(int fd, struct msghdr *msg, int flags) {
- assert(fd >= 0);
- assert(msg);
-
- for (;;) {
-
- if (sendmsg(fd, msg, flags) >= 0)
- break;
-
- if (errno != EAGAIN) {
- avahi_log_debug("sendmsg() failed: %s", strerror(errno));
- return -1;
- }
-
- if (avahi_wait_for_write(fd) < 0)
- return -1;
- }
-
- return 0;
-}
-
-int avahi_send_dns_packet_ipv4(
- int fd,
- AvahiIfIndex interface,
- AvahiDnsPacket *p,
- const AvahiIPv4Address *src_address,
- const AvahiIPv4Address *dst_address,
- uint16_t dst_port) {
-
- struct sockaddr_in sa;
- struct msghdr msg;
- struct iovec io;
-#ifdef IP_PKTINFO
- struct cmsghdr *cmsg;
- uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in_pktinfo))];
-#elif defined(IP_SENDSRCADDR)
- struct cmsghdr *cmsg;
- uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in_addr))];
-#endif
-
- assert(fd >= 0);
- assert(p);
- assert(avahi_dns_packet_check_valid(p) >= 0);
- assert(!dst_address || dst_port > 0);
-
- if (!dst_address)
- mdns_mcast_group_ipv4(&sa);
- else
- ipv4_address_to_sockaddr(&sa, dst_address, dst_port);
-
- memset(&io, 0, sizeof(io));
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &sa;
- msg.msg_namelen = sizeof(sa);
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_flags = 0;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
-
-#ifdef IP_PKTINFO
- if (interface > 0 || src_address) {
- struct in_pktinfo *pkti;
-
- memset(cmsg_data, 0, sizeof(cmsg_data));
- msg.msg_control = cmsg_data;
- msg.msg_controllen = sizeof(cmsg_data);
-
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
- cmsg->cmsg_level = IPPROTO_IP;
- cmsg->cmsg_type = IP_PKTINFO;
-
- pkti = (struct in_pktinfo*) CMSG_DATA(cmsg);
-
- if (interface > 0)
- pkti->ipi_ifindex = interface;
-
- if (src_address)
- pkti->ipi_spec_dst.s_addr = src_address->address;
-
- msg.msg_controllen = cmsg->cmsg_len;
- }
-#elif defined(IP_SENDSRCADDR)
- if (src_address) {
- struct in_addr *addr;
-
- memset(cmsg_data, 0, sizeof(cmsg_data));
- msg.msg_control = cmsg_data;
- msg.msg_controllen = sizeof(cmsg_data);
-
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_addr));
- cmsg->cmsg_level = IPPROTO_IP;
- cmsg->cmsg_type = IP_SENDSRCADDR;
-
- addr = (struct in_addr *)CMSG_DATA(cmsg);
- addr->s_addr = src_address->address;
-
- msg.msg_controllen = cmsg->cmsg_len;
-}
-#elif defined(IP_MULTICAST_IF)
- {
- struct in_addr any = { INADDR_ANY };
- if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, src_address ? (const void*) &src_address->address : (const void*) &any, sizeof(struct in_addr)) < 0) {
- avahi_log_warn("IP_MULTICAST_IF failed: %s", strerror(errno));
- return -1;
- }
- }
-#elif defined(__GNUC__)
-#warning "FIXME: We need some code to set the outgoing interface/local address here if IP_PKTINFO/IP_MULTICAST_IF is not available"
-#endif
-
- return sendmsg_loop(fd, &msg, 0);
-}
-
-int avahi_send_dns_packet_ipv6(int fd, AvahiIfIndex interface, AvahiDnsPacket *p, const AvahiIPv6Address *src_address, const AvahiIPv6Address *dst_address, uint16_t dst_port) {
- struct sockaddr_in6 sa;
- struct msghdr msg;
- struct iovec io;
- struct cmsghdr *cmsg;
- uint8_t cmsg_data[CMSG_SPACE(sizeof(struct in6_pktinfo))];
-
- assert(fd >= 0);
- assert(p);
- assert(avahi_dns_packet_check_valid(p) >= 0);
- assert(!dst_address || dst_port > 0);
-
- if (!dst_address)
- mdns_mcast_group_ipv6(&sa);
- else
- ipv6_address_to_sockaddr(&sa, dst_address, dst_port);
-
- memset(&io, 0, sizeof(io));
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &sa;
- msg.msg_namelen = sizeof(sa);
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_flags = 0;
-
- if (interface > 0 || src_address) {
- struct in6_pktinfo *pkti;
-
- memset(cmsg_data, 0, sizeof(cmsg_data));
- msg.msg_control = cmsg_data;
- msg.msg_controllen = sizeof(cmsg_data);
-
- cmsg = CMSG_FIRSTHDR(&msg);
- cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
- cmsg->cmsg_level = IPPROTO_IPV6;
- cmsg->cmsg_type = IPV6_PKTINFO;
-
- pkti = (struct in6_pktinfo*) CMSG_DATA(cmsg);
-
- if (interface > 0)
- pkti->ipi6_ifindex = interface;
-
- if (src_address)
- memcpy(&pkti->ipi6_addr, src_address->address, sizeof(src_address->address));
-
- msg.msg_controllen = cmsg->cmsg_len;
- } else {
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- }
-
- return sendmsg_loop(fd, &msg, 0);
-}
-
-AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv4Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl) {
- AvahiDnsPacket *p= NULL;
- struct msghdr msg;
- struct iovec io;
- size_t aux[1024 / sizeof(size_t)]; /* for alignment on ia64 ! */
- ssize_t l;
- struct cmsghdr *cmsg;
- int found_addr = 0;
- int ms;
- struct sockaddr_in sa;
-
- assert(fd >= 0);
-
- if (ioctl(fd, FIONREAD, &ms) < 0) {
- avahi_log_warn("ioctl(): %s", strerror(errno));
- goto fail;
- }
-
- p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
-
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->max_size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = &sa;
- msg.msg_namelen = sizeof(sa);
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_control = aux;
- msg.msg_controllen = sizeof(aux);
- msg.msg_flags = 0;
-
- if ((l = recvmsg(fd, &msg, 0)) < 0) {
- avahi_log_warn("recvmsg(): %s", strerror(errno));
- goto fail;
- }
-
- if (sa.sin_addr.s_addr == INADDR_ANY) {
- /* Linux 2.4 behaves very strangely sometimes! */
- goto fail;
- }
-
- assert(!(msg.msg_flags & MSG_CTRUNC));
- assert(!(msg.msg_flags & MSG_TRUNC));
-
- p->size = (size_t) l;
-
- if (ret_src_port)
- *ret_src_port = avahi_port_from_sockaddr((struct sockaddr*) &sa);
-
- if (ret_src_address) {
- AvahiAddress a;
- avahi_address_from_sockaddr((struct sockaddr*) &sa, &a);
- *ret_src_address = a.data.ipv4;
- }
-
- if (ret_ttl)
- *ret_ttl = 255;
-
- if (ret_iface)
- *ret_iface = AVAHI_IF_UNSPEC;
-
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-
- if (cmsg->cmsg_level == IPPROTO_IP) {
-
- switch (cmsg->cmsg_type) {
-#ifdef IP_RECVTTL
- case IP_RECVTTL:
-#endif
- case IP_TTL:
- if (ret_ttl)
- *ret_ttl = (uint8_t) (*(int *) CMSG_DATA(cmsg));
-
- break;
-
-#ifdef IP_PKTINFO
- case IP_PKTINFO: {
- struct in_pktinfo *i = (struct in_pktinfo*) CMSG_DATA(cmsg);
-
- if (ret_iface)
- *ret_iface = (int) i->ipi_ifindex;
-
- if (ret_dst_address)
- ret_dst_address->address = i->ipi_addr.s_addr;
-
- found_addr = 1;
-
- break;
- }
-#endif
-
-#ifdef IP_RECVIF
- case IP_RECVIF: {
- struct sockaddr_dl *sdl = (struct sockaddr_dl *) CMSG_DATA (cmsg);
-
- if (ret_iface)
-#ifdef __sun
- *ret_iface = *(uint_t*) sdl;
-#else
- *ret_iface = (int) sdl->sdl_index;
-#endif
-
- break;
- }
-#endif
-
-#ifdef IP_RECVDSTADDR
- case IP_RECVDSTADDR:
- if (ret_dst_address)
- memcpy(&ret_dst_address->address, CMSG_DATA (cmsg), 4);
-
- found_addr = 1;
- break;
-#endif
-
- default:
- avahi_log_warn("Unhandled cmsg_type : %d", cmsg->cmsg_type);
- break;
- }
- }
- }
-
- assert(found_addr);
-
- return p;
-
-fail:
- if (p)
- avahi_dns_packet_free(p);
-
- return NULL;
-}
-
-AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv6Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl) {
- AvahiDnsPacket *p = NULL;
- struct msghdr msg;
- struct iovec io;
- size_t aux[1024 / sizeof(size_t)];
- ssize_t l;
- int ms;
- struct cmsghdr *cmsg;
- int found_ttl = 0, found_iface = 0;
- struct sockaddr_in6 sa;
-
- assert(fd >= 0);
-
- if (ioctl(fd, FIONREAD, &ms) < 0) {
- avahi_log_warn("ioctl(): %s", strerror(errno));
- goto fail;
- }
-
- p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
-
- io.iov_base = AVAHI_DNS_PACKET_DATA(p);
- io.iov_len = p->max_size;
-
- memset(&msg, 0, sizeof(msg));
- msg.msg_name = (struct sockaddr*) &sa;
- msg.msg_namelen = sizeof(sa);
-
- msg.msg_iov = &io;
- msg.msg_iovlen = 1;
- msg.msg_control = aux;
- msg.msg_controllen = sizeof(aux);
- msg.msg_flags = 0;
-
- if ((l = recvmsg(fd, &msg, 0)) < 0) {
- avahi_log_warn("recvmsg(): %s", strerror(errno));
- goto fail;
- }
-
- assert(!(msg.msg_flags & MSG_CTRUNC));
- assert(!(msg.msg_flags & MSG_TRUNC));
-
- p->size = (size_t) l;
-
- if (ret_src_port)
- *ret_src_port = avahi_port_from_sockaddr((struct sockaddr*) &sa);
-
- if (ret_src_address) {
- AvahiAddress a;
- avahi_address_from_sockaddr((struct sockaddr*) &sa, &a);
- *ret_src_address = a.data.ipv6;
- }
-
- for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
-
- if (cmsg->cmsg_level == IPPROTO_IPV6) {
-
- switch (cmsg->cmsg_type) {
-
- case IPV6_HOPLIMIT:
-
- if (ret_ttl)
- *ret_ttl = (uint8_t) (*(int *) CMSG_DATA(cmsg));
-
- found_ttl = 1;
-
- break;
-
- case IPV6_PKTINFO: {
- struct in6_pktinfo *i = (struct in6_pktinfo*) CMSG_DATA(cmsg);
-
- if (ret_iface)
- *ret_iface = i->ipi6_ifindex;
-
- if (ret_dst_address)
- memcpy(ret_dst_address->address, i->ipi6_addr.s6_addr, 16);
-
- found_iface = 1;
- break;
- }
-
- default:
- avahi_log_warn("Unhandled cmsg_type : %d", cmsg->cmsg_type);
- break;
- }
- }
- }
-
- assert(found_iface);
- assert(found_ttl);
-
- return p;
-
-fail:
- if (p)
- avahi_dns_packet_free(p);
-
- return NULL;
-}
-
-int avahi_open_unicast_socket_ipv4(void) {
- struct sockaddr_in local;
- int fd = -1;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin_family = AF_INET;
-
- if (bind(fd, (struct sockaddr*) &local, sizeof(local)) < 0) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- goto fail;
- }
-
- if (ipv4_pktinfo(fd) < 0) {
- goto fail;
- }
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-int avahi_open_unicast_socket_ipv6(void) {
- struct sockaddr_in6 local;
- int fd = -1;
-
- if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- avahi_log_warn("socket() failed: %s", strerror(errno));
- goto fail;
- }
-
- memset(&local, 0, sizeof(local));
- local.sin6_family = AF_INET6;
-
- if (bind(fd, (struct sockaddr*) &local, sizeof(local)) < 0) {
- avahi_log_warn("bind() failed: %s", strerror(errno));
- goto fail;
- }
-
- if (ipv6_pktinfo(fd) < 0)
- goto fail;
-
- if (avahi_set_cloexec(fd) < 0) {
- avahi_log_warn("FD_CLOEXEC failed: %s", strerror(errno));
- goto fail;
- }
-
- if (avahi_set_nonblock(fd) < 0) {
- avahi_log_warn("O_NONBLOCK failed: %s", strerror(errno));
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
diff --git a/trunk/avahi-core/socket.h b/trunk/avahi-core/socket.h
deleted file mode 100644
index 237b534..0000000
--- a/trunk/avahi-core/socket.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef foosockethfoo
-#define foosockethfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include "dns.h"
-
-#define AVAHI_MDNS_PORT 5353
-#define AVAHI_DNS_PORT 53
-#define AVAHI_IPV4_MCAST_GROUP "224.0.0.251"
-#define AVAHI_IPV6_MCAST_GROUP "ff02::fb"
-
-int avahi_open_socket_ipv4(int no_reuse);
-int avahi_open_socket_ipv6(int no_reuse);
-
-int avahi_open_unicast_socket_ipv4(void);
-int avahi_open_unicast_socket_ipv6(void);
-
-int avahi_send_dns_packet_ipv4(int fd, AvahiIfIndex iface, AvahiDnsPacket *p, const AvahiIPv4Address *src_address, const AvahiIPv4Address *dst_address, uint16_t dst_port);
-int avahi_send_dns_packet_ipv6(int fd, AvahiIfIndex iface, AvahiDnsPacket *p, const AvahiIPv6Address *src_address, const AvahiIPv6Address *dst_address, uint16_t dst_port);
-
-AvahiDnsPacket *avahi_recv_dns_packet_ipv4(int fd, AvahiIPv4Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv4Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl);
-AvahiDnsPacket *avahi_recv_dns_packet_ipv6(int fd, AvahiIPv6Address *ret_src_address, uint16_t *ret_src_port, AvahiIPv6Address *ret_dst_address, AvahiIfIndex *ret_iface, uint8_t *ret_ttl);
-
-int avahi_mdns_mcast_join_ipv4(int fd, const AvahiIPv4Address *local_address, int iface, int join);
-int avahi_mdns_mcast_join_ipv6(int fd, const AvahiIPv6Address *local_address, int iface, int join);
-
-#endif
diff --git a/trunk/avahi-core/timeeventq-test.c b/trunk/avahi-core/timeeventq-test.c
deleted file mode 100644
index c66a55a..0000000
--- a/trunk/avahi-core/timeeventq-test.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/simple-watch.h>
-
-#include "timeeventq.h"
-#include "log.h"
-
-#define POINTER_TO_INT(p) ((int) (p))
-#define INT_TO_POINTER(i) ((void*) (i))
-
-static AvahiTimeEventQueue *q = NULL;
-
-static void callback(AvahiTimeEvent*e, void* userdata) {
- struct timeval tv = {0, 0};
- assert(e);
- avahi_log_info("callback(%i)", POINTER_TO_INT(userdata));
- avahi_elapse_time(&tv, 1000, 100);
- avahi_time_event_update(e, &tv);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- struct timeval tv;
- AvahiSimplePoll *s;
-
- s = avahi_simple_poll_new();
-
- q = avahi_time_event_queue_new(avahi_simple_poll_get(s));
-
- avahi_time_event_new(q, avahi_elapse_time(&tv, 5000, 100), callback, INT_TO_POINTER(1));
- avahi_time_event_new(q, avahi_elapse_time(&tv, 5000, 100), callback, INT_TO_POINTER(2));
-
- avahi_log_info("starting");
-
- for (;;)
- if (avahi_simple_poll_iterate(s, -1) != 0)
- break;
-
- avahi_time_event_queue_free(q);
- avahi_simple_poll_free(s);
-
- return 0;
-}
diff --git a/trunk/avahi-core/timeeventq.c b/trunk/avahi-core/timeeventq.c
deleted file mode 100644
index 17334ee..0000000
--- a/trunk/avahi-core/timeeventq.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/timeval.h>
-#include <avahi-common/malloc.h>
-
-#include "timeeventq.h"
-#include "log.h"
-
-struct AvahiTimeEvent {
- AvahiTimeEventQueue *queue;
- AvahiPrioQueueNode *node;
- struct timeval expiry;
- struct timeval last_run;
- AvahiTimeEventCallback callback;
- void* userdata;
-};
-
-struct AvahiTimeEventQueue {
- const AvahiPoll *poll_api;
- AvahiPrioQueue *prioq;
- AvahiTimeout *timeout;
-};
-
-static int compare(const void* _a, const void* _b) {
- const AvahiTimeEvent *a = _a, *b = _b;
- int ret;
-
- if ((ret = avahi_timeval_compare(&a->expiry, &b->expiry)) != 0)
- return ret;
-
- /* If both exevents are scheduled for the same time, put the entry
- * that has been run earlier the last time first. */
- return avahi_timeval_compare(&a->last_run, &b->last_run);
-}
-
-static AvahiTimeEvent* time_event_queue_root(AvahiTimeEventQueue *q) {
- assert(q);
-
- return q->prioq->root ? q->prioq->root->data : NULL;
-}
-
-static void update_timeout(AvahiTimeEventQueue *q) {
- AvahiTimeEvent *e;
- assert(q);
-
- if ((e = time_event_queue_root(q)))
- q->poll_api->timeout_update(q->timeout, &e->expiry);
- else
- q->poll_api->timeout_update(q->timeout, NULL);
-}
-
-static void expiration_event(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void *userdata) {
- AvahiTimeEventQueue *q = userdata;
- AvahiTimeEvent *e;
-
- if ((e = time_event_queue_root(q))) {
- struct timeval now;
-
- gettimeofday(&now, NULL);
-
- /* Check if expired */
- if (avahi_timeval_compare(&now, &e->expiry) >= 0) {
-
- /* Make sure to move the entry away from the front */
- e->last_run = now;
- avahi_prio_queue_shuffle(q->prioq, e->node);
-
- /* Run it */
- assert(e->callback);
- e->callback(e, e->userdata);
-
- update_timeout(q);
- return;
- }
- }
-
- avahi_log_debug(__FILE__": Strange, expiration_event() called, but nothing really happened.");
- update_timeout(q);
-}
-
-static void fix_expiry_time(AvahiTimeEvent *e) {
- struct timeval now;
- assert(e);
-
- return; /*** DO WE REALLY NEED THIS? ***/
-
- gettimeofday(&now, NULL);
-
- if (avahi_timeval_compare(&now, &e->expiry) > 0)
- e->expiry = now;
-}
-
-AvahiTimeEventQueue* avahi_time_event_queue_new(const AvahiPoll *poll_api) {
- AvahiTimeEventQueue *q;
-
- if (!(q = avahi_new(AvahiTimeEventQueue, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- goto oom;
- }
-
- q->poll_api = poll_api;
-
- if (!(q->prioq = avahi_prio_queue_new(compare)))
- goto oom;
-
- if (!(q->timeout = poll_api->timeout_new(poll_api, NULL, expiration_event, q)))
- goto oom;
-
- return q;
-
-oom:
-
- if (q) {
- avahi_free(q);
-
- if (q->prioq)
- avahi_prio_queue_free(q->prioq);
- }
-
- return NULL;
-}
-
-void avahi_time_event_queue_free(AvahiTimeEventQueue *q) {
- AvahiTimeEvent *e;
-
- assert(q);
-
- while ((e = time_event_queue_root(q)))
- avahi_time_event_free(e);
- avahi_prio_queue_free(q->prioq);
-
- q->poll_api->timeout_free(q->timeout);
-
- avahi_free(q);
-}
-
-AvahiTimeEvent* avahi_time_event_new(
- AvahiTimeEventQueue *q,
- const struct timeval *timeval,
- AvahiTimeEventCallback callback,
- void* userdata) {
-
- AvahiTimeEvent *e;
-
- assert(q);
- assert(callback);
- assert(userdata);
-
- if (!(e = avahi_new(AvahiTimeEvent, 1))) {
- avahi_log_error(__FILE__": Out of memory");
- return NULL; /* OOM */
- }
-
- e->queue = q;
- e->callback = callback;
- e->userdata = userdata;
-
- if (timeval)
- e->expiry = *timeval;
- else {
- e->expiry.tv_sec = 0;
- e->expiry.tv_usec = 0;
- }
-
- fix_expiry_time(e);
-
- e->last_run.tv_sec = 0;
- e->last_run.tv_usec = 0;
-
- if (!(e->node = avahi_prio_queue_put(q->prioq, e))) {
- avahi_free(e);
- return NULL;
- }
-
- update_timeout(q);
- return e;
-}
-
-void avahi_time_event_free(AvahiTimeEvent *e) {
- AvahiTimeEventQueue *q;
- assert(e);
-
- q = e->queue;
-
- avahi_prio_queue_remove(q->prioq, e->node);
- avahi_free(e);
-
- update_timeout(q);
-}
-
-void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval) {
- assert(e);
- assert(timeval);
-
- e->expiry = *timeval;
- fix_expiry_time(e);
- avahi_prio_queue_shuffle(e->queue->prioq, e->node);
-
- update_timeout(e->queue);
-}
-
diff --git a/trunk/avahi-core/timeeventq.h b/trunk/avahi-core/timeeventq.h
deleted file mode 100644
index cdfa5e6..0000000
--- a/trunk/avahi-core/timeeventq.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef footimeeventqhfoo
-#define footimeeventqhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <sys/types.h>
-
-typedef struct AvahiTimeEventQueue AvahiTimeEventQueue;
-typedef struct AvahiTimeEvent AvahiTimeEvent;
-
-#include <avahi-common/watch.h>
-
-#include "prioq.h"
-
-typedef void (*AvahiTimeEventCallback)(AvahiTimeEvent *e, void* userdata);
-
-AvahiTimeEventQueue* avahi_time_event_queue_new(const AvahiPoll *poll_api);
-void avahi_time_event_queue_free(AvahiTimeEventQueue *q);
-
-AvahiTimeEvent* avahi_time_event_new(
- AvahiTimeEventQueue *q,
- const struct timeval *timeval,
- AvahiTimeEventCallback callback,
- void* userdata);
-
-void avahi_time_event_free(AvahiTimeEvent *e);
-void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *timeval);
-
-#endif
diff --git a/trunk/avahi-core/update-test.c b/trunk/avahi-core/update-test.c
deleted file mode 100644
index bdffc0c..0000000
--- a/trunk/avahi-core/update-test.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-
-static AvahiSEntryGroup *group = NULL;
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
-
- avahi_log_debug("server state: %i", state);
-
- if (state == AVAHI_SERVER_RUNNING) {
- int ret;
-
- group = avahi_s_entry_group_new(s, NULL, NULL);
- assert(group);
-
- ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "foo", "_http._tcp", NULL, NULL, 80, "test1", NULL);
- assert(ret == AVAHI_OK);
-
- avahi_s_entry_group_commit(group);
- }
-}
-
-static void modify_txt_callback(AVAHI_GCC_UNUSED AvahiTimeout *e, void *userdata) {
- int ret;
- AvahiServer *s = userdata;
-
- avahi_log_debug("modifying");
-
- ret = avahi_server_update_service_txt(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "foo", "_http._tcp", NULL, "test2", NULL);
- assert(ret == AVAHI_OK);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiSimplePoll *simple_poll;
- const AvahiPoll *poll_api;
- AvahiServer *server;
- struct timeval tv;
- AvahiServerConfig config;
-
- simple_poll = avahi_simple_poll_new();
- assert(simple_poll);
-
- poll_api = avahi_simple_poll_get(simple_poll);
- assert(poll_api);
-
- avahi_server_config_init(&config);
- config.publish_domain = config.publish_workstation = config.use_ipv6 = config.publish_hinfo = 0;
- server = avahi_server_new(poll_api, &config, server_callback, NULL, NULL);
- assert(server);
- avahi_server_config_free(&config);
-
- poll_api->timeout_new(poll_api, avahi_elapse_time(&tv, 1000*10, 0), modify_txt_callback, server);
-
- avahi_simple_poll_loop(simple_poll);
-}
diff --git a/trunk/avahi-core/util.c b/trunk/avahi-core/util.c
deleted file mode 100644
index b1925f0..0000000
--- a/trunk/avahi-core/util.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <ctype.h>
-
-#include <avahi-common/malloc.h>
-#include "util.h"
-
-void avahi_hexdump(const void* p, size_t size) {
- const uint8_t *c = p;
- assert(p);
-
- printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
-
- while (size > 0) {
- unsigned i;
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%02x ", c[i]);
- else
- printf(" ");
- }
-
- for (i = 0; i < 16; i++) {
- if (i < size)
- printf("%c", c[i] >= 32 && c[i] < 127 ? c[i] : '.');
- else
- printf(" ");
- }
-
- printf("\n");
-
- c += 16;
-
- if (size <= 16)
- break;
-
- size -= 16;
- }
-}
-
-char *avahi_format_mac_address(char *r, size_t l, const uint8_t* mac, size_t size) {
- char *t = r;
- unsigned i;
- static const char hex[] = "0123456789abcdef";
-
- assert(r);
- assert(l > 0);
- assert(mac);
-
- if (size <= 0) {
- *r = 0;
- return r;
- }
-
- for (i = 0; i < size; i++) {
- if (l < 3)
- break;
-
- *(t++) = hex[*mac >> 4];
- *(t++) = hex[*mac & 0xF];
- *(t++) = ':';
-
- l -= 3;
-
- mac++;
- }
-
- if (t > r)
- *(t-1) = 0;
- else
- *r = 0;
-
- return r;
-}
-
-char *avahi_strup(char *s) {
- char *c;
- assert(s);
-
- for (c = s; *c; c++)
- *c = (char) toupper(*c);
-
- return s;
-}
-
-char *avahi_strdown(char *s) {
- char *c;
- assert(s);
-
- for (c = s; *c; c++)
- *c = (char) tolower(*c);
-
- return s;
-}
diff --git a/trunk/avahi-core/util.h b/trunk/avahi-core/util.h
deleted file mode 100644
index 8d2caee..0000000
--- a/trunk/avahi-core/util.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef fooutilhfoo
-#define fooutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <avahi-common/cdecl.h>
-
-AVAHI_C_DECL_BEGIN
-
-void avahi_hexdump(const void *p, size_t size);
-
-char *avahi_format_mac_address(char *t, size_t l, const uint8_t* mac, size_t size);
-
-/** Change every character in the string to upper case (ASCII), return a pointer to the string */
-char *avahi_strup(char *s);
-
-/** Change every character in the string to lower case (ASCII), return a pointer to the string */
-char *avahi_strdown(char *s);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-core/wide-area.c b/trunk/avahi-core/wide-area.c
deleted file mode 100644
index 4072f83..0000000
--- a/trunk/avahi-core/wide-area.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netinet/in.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/timeval.h>
-
-#include "internal.h"
-#include "browse.h"
-#include "socket.h"
-#include "log.h"
-#include "hashmap.h"
-#include "wide-area.h"
-#include "addr-util.h"
-#include "rr-util.h"
-
-#define CACHE_ENTRIES_MAX 500
-
-typedef struct AvahiWideAreaCacheEntry AvahiWideAreaCacheEntry;
-
-struct AvahiWideAreaCacheEntry {
- AvahiWideAreaLookupEngine *engine;
-
- AvahiRecord *record;
- struct timeval timestamp;
- struct timeval expiry;
-
- AvahiTimeEvent *time_event;
-
- AVAHI_LLIST_FIELDS(AvahiWideAreaCacheEntry, by_key);
- AVAHI_LLIST_FIELDS(AvahiWideAreaCacheEntry, cache);
-};
-
-struct AvahiWideAreaLookup {
- AvahiWideAreaLookupEngine *engine;
- int dead;
-
- uint32_t id; /* effectively just an uint16_t, but we need it as an index for a hash table */
- AvahiTimeEvent *time_event;
-
- AvahiKey *key, *cname_key;
-
- int n_send;
- AvahiDnsPacket *packet;
-
- AvahiWideAreaLookupCallback callback;
- void *userdata;
-
- AvahiAddress dns_server_used;
-
- AVAHI_LLIST_FIELDS(AvahiWideAreaLookup, lookups);
- AVAHI_LLIST_FIELDS(AvahiWideAreaLookup, by_key);
-};
-
-struct AvahiWideAreaLookupEngine {
- AvahiServer *server;
-
- int fd_ipv4, fd_ipv6;
- AvahiWatch *watch_ipv4, *watch_ipv6;
-
- uint16_t next_id;
-
- /* Cache */
- AVAHI_LLIST_HEAD(AvahiWideAreaCacheEntry, cache);
- AvahiHashmap *cache_by_key;
- unsigned cache_n_entries;
-
- /* Lookups */
- AVAHI_LLIST_HEAD(AvahiWideAreaLookup, lookups);
- AvahiHashmap *lookups_by_id;
- AvahiHashmap *lookups_by_key;
-
- int cleanup_dead;
-
- AvahiAddress dns_servers[AVAHI_WIDE_AREA_SERVERS_MAX];
- unsigned n_dns_servers;
- unsigned current_dns_server;
-};
-
-static AvahiWideAreaLookup* find_lookup(AvahiWideAreaLookupEngine *e, uint16_t id) {
- AvahiWideAreaLookup *l;
- int i = (int) id;
-
- assert(e);
-
- if (!(l = avahi_hashmap_lookup(e->lookups_by_id, &i)))
- return NULL;
-
- assert(l->id == id);
-
- if (l->dead)
- return NULL;
-
- return l;
-}
-
-static int send_to_dns_server(AvahiWideAreaLookup *l, AvahiDnsPacket *p) {
- AvahiAddress *a;
-
- assert(l);
- assert(p);
-
- if (l->engine->n_dns_servers <= 0)
- return -1;
-
- assert(l->engine->current_dns_server < l->engine->n_dns_servers);
-
- a = &l->engine->dns_servers[l->engine->current_dns_server];
- l->dns_server_used = *a;
-
- if (a->proto == AVAHI_PROTO_INET) {
-
- if (l->engine->fd_ipv4 < 0)
- return -1;
-
- return avahi_send_dns_packet_ipv4(l->engine->fd_ipv4, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv4, AVAHI_DNS_PORT);
-
- } else {
- assert(a->proto == AVAHI_PROTO_INET6);
-
- if (l->engine->fd_ipv6 < 0)
- return -1;
-
- return avahi_send_dns_packet_ipv6(l->engine->fd_ipv6, AVAHI_IF_UNSPEC, p, NULL, &a->data.ipv6, AVAHI_DNS_PORT);
- }
-}
-
-static void next_dns_server(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- e->current_dns_server++;
-
- if (e->current_dns_server >= e->n_dns_servers)
- e->current_dns_server = 0;
-}
-
-static void lookup_stop(AvahiWideAreaLookup *l) {
- assert(l);
-
- l->callback = NULL;
-
- if (l->time_event) {
- avahi_time_event_free(l->time_event);
- l->time_event = NULL;
- }
-}
-
-static void sender_timeout_callback(AvahiTimeEvent *e, void *userdata) {
- AvahiWideAreaLookup *l = userdata;
- struct timeval tv;
-
- assert(l);
-
- /* Try another DNS server after three retries */
- if (l->n_send >= 3 && avahi_address_cmp(&l->engine->dns_servers[l->engine->current_dns_server], &l->dns_server_used) == 0) {
- next_dns_server(l->engine);
-
- if (avahi_address_cmp(&l->engine->dns_servers[l->engine->current_dns_server], &l->dns_server_used) == 0)
- /* There is no other DNS server, fail */
- l->n_send = 1000;
- }
-
- if (l->n_send >= 6) {
- avahi_log_warn(__FILE__": Query timed out.");
- avahi_server_set_errno(l->engine->server, AVAHI_ERR_TIMEOUT);
- l->callback(l->engine, AVAHI_BROWSER_FAILURE, AVAHI_LOOKUP_RESULT_WIDE_AREA, NULL, l->userdata);
- lookup_stop(l);
- return;
- }
-
- assert(l->packet);
- send_to_dns_server(l, l->packet);
- l->n_send++;
-
- avahi_time_event_update(e, avahi_elapse_time(&tv, 1000, 0));
-}
-
-AvahiWideAreaLookup *avahi_wide_area_lookup_new(
- AvahiWideAreaLookupEngine *e,
- AvahiKey *key,
- AvahiWideAreaLookupCallback callback,
- void *userdata) {
-
- struct timeval tv;
- AvahiWideAreaLookup *l, *t;
- uint8_t *p;
-
- assert(e);
- assert(key);
- assert(callback);
- assert(userdata);
-
- l = avahi_new(AvahiWideAreaLookup, 1);
- l->engine = e;
- l->dead = 0;
- l->key = avahi_key_ref(key);
- l->cname_key = avahi_key_new_cname(l->key);
- l->callback = callback;
- l->userdata = userdata;
-
- /* If more than 65K wide area quries are issued simultaneously,
- * this will break. This should be limited by some higher level */
-
- for (;; e->next_id++)
- if (!find_lookup(e, e->next_id))
- break; /* This ID is not yet used. */
-
- l->id = e->next_id++;
-
- /* We keep the packet around in case we need to repeat our query */
- l->packet = avahi_dns_packet_new(0);
-
- avahi_dns_packet_set_field(l->packet, AVAHI_DNS_FIELD_ID, (uint16_t) l->id);
- avahi_dns_packet_set_field(l->packet, AVAHI_DNS_FIELD_FLAGS, AVAHI_DNS_FLAGS(0, 0, 0, 0, 1, 0, 0, 0, 0, 0));
-
- p = avahi_dns_packet_append_key(l->packet, key, 0);
- assert(p);
-
- avahi_dns_packet_set_field(l->packet, AVAHI_DNS_FIELD_QDCOUNT, 1);
-
- if (send_to_dns_server(l, l->packet) < 0) {
- avahi_log_error(__FILE__": Failed to send packet.");
- avahi_dns_packet_free(l->packet);
- avahi_key_unref(l->key);
- if (l->cname_key)
- avahi_key_unref(l->cname_key);
- avahi_free(l);
- return NULL;
- }
-
- l->n_send = 1;
-
- l->time_event = avahi_time_event_new(e->server->time_event_queue, avahi_elapse_time(&tv, 500, 0), sender_timeout_callback, l);
-
- avahi_hashmap_insert(e->lookups_by_id, &l->id, l);
-
- t = avahi_hashmap_lookup(e->lookups_by_key, l->key);
- AVAHI_LLIST_PREPEND(AvahiWideAreaLookup, by_key, t, l);
- avahi_hashmap_replace(e->lookups_by_key, avahi_key_ref(l->key), t);
-
- AVAHI_LLIST_PREPEND(AvahiWideAreaLookup, lookups, e->lookups, l);
-
- return l;
-}
-
-static void lookup_destroy(AvahiWideAreaLookup *l) {
- AvahiWideAreaLookup *t;
- assert(l);
-
- lookup_stop(l);
-
- t = avahi_hashmap_lookup(l->engine->lookups_by_key, l->key);
- AVAHI_LLIST_REMOVE(AvahiWideAreaLookup, by_key, t, l);
- if (t)
- avahi_hashmap_replace(l->engine->lookups_by_key, avahi_key_ref(l->key), t);
- else
- avahi_hashmap_remove(l->engine->lookups_by_key, l->key);
-
- AVAHI_LLIST_REMOVE(AvahiWideAreaLookup, lookups, l->engine->lookups, l);
-
- avahi_hashmap_remove(l->engine->lookups_by_id, &l->id);
- avahi_dns_packet_free(l->packet);
-
- if (l->key)
- avahi_key_unref(l->key);
-
- if (l->cname_key)
- avahi_key_unref(l->cname_key);
-
- avahi_free(l);
-}
-
-void avahi_wide_area_lookup_free(AvahiWideAreaLookup *l) {
- assert(l);
-
- if (l->dead)
- return;
-
- l->dead = 1;
- l->engine->cleanup_dead = 1;
- lookup_stop(l);
-}
-
-void avahi_wide_area_cleanup(AvahiWideAreaLookupEngine *e) {
- AvahiWideAreaLookup *l, *n;
- assert(e);
-
- while (e->cleanup_dead) {
- e->cleanup_dead = 0;
-
- for (l = e->lookups; l; l = n) {
- n = l->lookups_next;
-
- if (l->dead)
- lookup_destroy(l);
- }
- }
-}
-
-static void cache_entry_free(AvahiWideAreaCacheEntry *c) {
- AvahiWideAreaCacheEntry *t;
- assert(c);
-
- if (c->time_event)
- avahi_time_event_free(c->time_event);
-
- AVAHI_LLIST_REMOVE(AvahiWideAreaCacheEntry, cache, c->engine->cache, c);
-
- t = avahi_hashmap_lookup(c->engine->cache_by_key, c->record->key);
- AVAHI_LLIST_REMOVE(AvahiWideAreaCacheEntry, by_key, t, c);
- if (t)
- avahi_hashmap_replace(c->engine->cache_by_key, avahi_key_ref(c->record->key), t);
- else
- avahi_hashmap_remove(c->engine->cache_by_key, c->record->key);
-
- c->engine->cache_n_entries --;
-
- avahi_record_unref(c->record);
- avahi_free(c);
-}
-
-static void expiry_event(AvahiTimeEvent *te, void *userdata) {
- AvahiWideAreaCacheEntry *e = userdata;
-
- assert(te);
- assert(e);
-
- cache_entry_free(e);
-}
-
-static AvahiWideAreaCacheEntry* find_record_in_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
- AvahiWideAreaCacheEntry *c;
-
- assert(e);
- assert(r);
-
- for (c = avahi_hashmap_lookup(e->cache_by_key, r->key); c; c = c->by_key_next)
- if (avahi_record_equal_no_ttl(r, c->record))
- return c;
-
- return NULL;
-}
-
-static void run_callbacks(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
- AvahiWideAreaLookup *l;
-
- assert(e);
- assert(r);
-
- for (l = avahi_hashmap_lookup(e->lookups_by_key, r->key); l; l = l->by_key_next) {
- if (l->dead || !l->callback)
- continue;
-
- l->callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA, r, l->userdata);
- }
-
- if (r->key->clazz == AVAHI_DNS_CLASS_IN && r->key->type == AVAHI_DNS_TYPE_CNAME) {
- /* It's a CNAME record, so we have to scan the all lookups to see if one matches */
-
- for (l = e->lookups; l; l = l->lookups_next) {
- AvahiKey *key;
-
- if (l->dead || !l->callback)
- continue;
-
- if ((key = avahi_key_new_cname(l->key))) {
- if (avahi_key_equal(r->key, key))
- l->callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA, r, l->userdata);
-
- avahi_key_unref(key);
- }
- }
- }
-}
-
-static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
- AvahiWideAreaCacheEntry *c;
- int is_new;
-
- assert(e);
- assert(r);
-
- if ((c = find_record_in_cache(e, r))) {
- is_new = 0;
-
- /* Update the existing entry */
- avahi_record_unref(c->record);
- } else {
- AvahiWideAreaCacheEntry *t;
-
- is_new = 1;
-
- /* Enforce cache size */
- if (e->cache_n_entries >= CACHE_ENTRIES_MAX)
- /* Eventually we should improve the caching algorithm here */
- goto finish;
-
- c = avahi_new(AvahiWideAreaCacheEntry, 1);
- c->engine = e;
- c->time_event = NULL;
-
- AVAHI_LLIST_PREPEND(AvahiWideAreaCacheEntry, cache, e->cache, c);
-
- /* Add the new entry to the cache entry hash table */
- t = avahi_hashmap_lookup(e->cache_by_key, r->key);
- AVAHI_LLIST_PREPEND(AvahiWideAreaCacheEntry, by_key, t, c);
- avahi_hashmap_replace(e->cache_by_key, avahi_key_ref(r->key), t);
-
- e->cache_n_entries ++;
- }
-
- c->record = avahi_record_ref(r);
-
- gettimeofday(&c->timestamp, NULL);
- c->expiry = c->timestamp;
- avahi_timeval_add(&c->expiry, r->ttl * 1000000);
-
- if (c->time_event)
- avahi_time_event_update(c->time_event, &c->expiry);
- else
- c->time_event = avahi_time_event_new(e->server->time_event_queue, &c->expiry, expiry_event, c);
-
-finish:
-
- if (is_new)
- run_callbacks(e, r);
-}
-
-static int map_dns_error(uint16_t error) {
- static const int table[16] = {
- AVAHI_OK,
- AVAHI_ERR_DNS_FORMERR,
- AVAHI_ERR_DNS_SERVFAIL,
- AVAHI_ERR_DNS_NXDOMAIN,
- AVAHI_ERR_DNS_NOTIMP,
- AVAHI_ERR_DNS_REFUSED,
- AVAHI_ERR_DNS_YXDOMAIN,
- AVAHI_ERR_DNS_YXRRSET,
- AVAHI_ERR_DNS_NXRRSET,
- AVAHI_ERR_DNS_NOTAUTH,
- AVAHI_ERR_DNS_NOTZONE,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR,
- AVAHI_ERR_INVALID_DNS_ERROR
- };
-
- assert(error <= 15);
-
- return table[error];
-}
-
-static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
- AvahiWideAreaLookup *l = NULL;
- int i, r;
-
- AvahiBrowserEvent final_event = AVAHI_BROWSER_ALL_FOR_NOW;
-
- assert(e);
- assert(p);
-
- /* Some superficial validity tests */
- if (avahi_dns_packet_check_valid(p) < 0 || avahi_dns_packet_is_query(p)) {
- avahi_log_warn(__FILE__": Ignoring invalid response for wide area datagram.");
- goto finish;
- }
-
- /* Look for the lookup that issued this query */
- if (!(l = find_lookup(e, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID))) || l->dead)
- goto finish;
-
- /* Check whether this a packet indicating a failure */
- if ((r = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & 15) != 0 ||
- avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) == 0) {
-
- avahi_server_set_errno(e->server, r == 0 ? AVAHI_ERR_NOT_FOUND : map_dns_error(r));
- /* Tell the user about the failure */
- final_event = AVAHI_BROWSER_FAILURE;
-
- /* We go on here, since some of the records contained in the
- reply might be interesting in some way */
- }
-
- /* Skip over the question */
- for (i = (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_QDCOUNT); i > 0; i--) {
- AvahiKey *k;
-
- if (!(k = avahi_dns_packet_consume_key(p, NULL))) {
- avahi_log_warn(__FILE__": Wide area response packet too short or invalid while reading question key. (Maybe an UTF8 problem?)");
- avahi_server_set_errno(e->server, AVAHI_ERR_INVALID_PACKET);
- final_event = AVAHI_BROWSER_FAILURE;
- goto finish;
- }
-
- avahi_key_unref(k);
- }
-
- /* Process responses */
- for (i = (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ANCOUNT) +
- (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_NSCOUNT) +
- (int) avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT); i > 0; i--) {
-
- AvahiRecord *rr;
-
- if (!(rr = avahi_dns_packet_consume_record(p, NULL))) {
- avahi_log_warn(__FILE__": Wide area response packet too short or invalid while reading response ecord. (Maybe an UTF8 problem?)");
- avahi_server_set_errno(e->server, AVAHI_ERR_INVALID_PACKET);
- final_event = AVAHI_BROWSER_FAILURE;
- goto finish;
- }
-
- add_to_cache(e, rr);
- avahi_record_unref(rr);
- }
-
-finish:
-
- if (l && !l->dead) {
- if (l->callback)
- l->callback(e, final_event, AVAHI_LOOKUP_RESULT_WIDE_AREA, NULL, l->userdata);
-
- lookup_stop(l);
- }
-}
-
-static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent events, void *userdata) {
- AvahiWideAreaLookupEngine *e = userdata;
- AvahiDnsPacket *p = NULL;
-
- if (fd == e->fd_ipv4)
- p = avahi_recv_dns_packet_ipv4(e->fd_ipv4, NULL, NULL, NULL, NULL, NULL);
- else {
- assert(fd == e->fd_ipv6);
- p = avahi_recv_dns_packet_ipv6(e->fd_ipv6, NULL, NULL, NULL, NULL, NULL);
- }
-
- if (p) {
- handle_packet(e, p);
- avahi_dns_packet_free(p);
- }
-}
-
-AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
- AvahiWideAreaLookupEngine *e;
-
- assert(s);
-
- e = avahi_new(AvahiWideAreaLookupEngine, 1);
- e->server = s;
- e->cleanup_dead = 0;
-
- /* Create sockets */
- e->fd_ipv4 = avahi_open_unicast_socket_ipv4();
- e->fd_ipv6 = avahi_open_unicast_socket_ipv6();
-
- if (e->fd_ipv4 < 0 && e->fd_ipv6 < 0) {
- avahi_log_error(__FILE__": Failed to create wide area sockets: %s", strerror(errno));
-
- if (e->fd_ipv6 >= 0)
- close(e->fd_ipv6);
-
- if (e->fd_ipv4 >= 0)
- close(e->fd_ipv4);
-
- avahi_free(e);
- return NULL;
- }
-
- /* Create watches */
-
- e->watch_ipv4 = e->watch_ipv6 = NULL;
-
- if (e->fd_ipv4 >= 0)
- e->watch_ipv4 = s->poll_api->watch_new(e->server->poll_api, e->fd_ipv4, AVAHI_WATCH_IN, socket_event, e);
- if (e->fd_ipv6 >= 0)
- e->watch_ipv6 = s->poll_api->watch_new(e->server->poll_api, e->fd_ipv6, AVAHI_WATCH_IN, socket_event, e);
-
- e->n_dns_servers = e->current_dns_server = 0;
- e->next_id = (uint16_t) rand();
-
- /* Initialize cache */
- AVAHI_LLIST_HEAD_INIT(AvahiWideAreaCacheEntry, e->cache);
- e->cache_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, (AvahiFreeFunc) avahi_key_unref, NULL);
- e->cache_n_entries = 0;
-
- /* Initialize lookup list */
- e->lookups_by_id = avahi_hashmap_new((AvahiHashFunc) avahi_int_hash, (AvahiEqualFunc) avahi_int_equal, NULL, NULL);
- e->lookups_by_key = avahi_hashmap_new((AvahiHashFunc) avahi_key_hash, (AvahiEqualFunc) avahi_key_equal, (AvahiFreeFunc) avahi_key_unref, NULL);
- AVAHI_LLIST_HEAD_INIT(AvahiWideAreaLookup, e->lookups);
-
- return e;
-}
-
-void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- avahi_wide_area_clear_cache(e);
-
- while (e->lookups)
- lookup_destroy(e->lookups);
-
- avahi_hashmap_free(e->cache_by_key);
- avahi_hashmap_free(e->lookups_by_id);
- avahi_hashmap_free(e->lookups_by_key);
-
- if (e->watch_ipv4)
- e->server->poll_api->watch_free(e->watch_ipv4);
-
- if (e->watch_ipv6)
- e->server->poll_api->watch_free(e->watch_ipv6);
-
- if (e->fd_ipv6 >= 0)
- close(e->fd_ipv6);
-
- if (e->fd_ipv4 >= 0)
- close(e->fd_ipv4);
-
- avahi_free(e);
-}
-
-void avahi_wide_area_clear_cache(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- while (e->cache)
- cache_entry_free(e->cache);
-
- assert(e->cache_n_entries == 0);
-}
-
-void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddress *a, unsigned n) {
- assert(e);
-
- if (a) {
- for (e->n_dns_servers = 0; n > 0 && e->n_dns_servers < AVAHI_WIDE_AREA_SERVERS_MAX; a++, n--)
- if ((a->proto == AVAHI_PROTO_INET && e->fd_ipv4 >= 0) || (a->proto == AVAHI_PROTO_INET6 && e->fd_ipv6 >= 0))
- e->dns_servers[e->n_dns_servers++] = *a;
- } else {
- assert(n == 0);
- e->n_dns_servers = 0;
- }
-
- e->current_dns_server = 0;
-
- avahi_wide_area_clear_cache(e);
-}
-
-void avahi_wide_area_cache_dump(AvahiWideAreaLookupEngine *e, AvahiDumpCallback callback, void* userdata) {
- AvahiWideAreaCacheEntry *c;
-
- assert(e);
- assert(callback);
-
- callback(";; WIDE AREA CACHE ;;; ", userdata);
-
- for (c = e->cache; c; c = c->cache_next) {
- char *t = avahi_record_to_string(c->record);
- callback(t, userdata);
- avahi_free(t);
- }
-}
-
-unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key, AvahiWideAreaLookupCallback callback, void *userdata) {
- AvahiWideAreaCacheEntry *c;
- AvahiKey *cname_key;
- unsigned n = 0;
-
- assert(e);
- assert(key);
- assert(callback);
-
- for (c = avahi_hashmap_lookup(e->cache_by_key, key); c; c = c->by_key_next) {
- callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA|AVAHI_LOOKUP_RESULT_CACHED, c->record, userdata);
- n++;
- }
-
- if ((cname_key = avahi_key_new_cname(key))) {
-
- for (c = avahi_hashmap_lookup(e->cache_by_key, cname_key); c; c = c->by_key_next) {
- callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA|AVAHI_LOOKUP_RESULT_CACHED, c->record, userdata);
- n++;
- }
-
- avahi_key_unref(cname_key);
- }
-
- return n;
-}
-
-int avahi_wide_area_has_servers(AvahiWideAreaLookupEngine *e) {
- assert(e);
-
- return e->n_dns_servers > 0;
-}
-
-
-
diff --git a/trunk/avahi-core/wide-area.h b/trunk/avahi-core/wide-area.h
deleted file mode 100644
index 1af613b..0000000
--- a/trunk/avahi-core/wide-area.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef foowideareahfoo
-#define foowideareahfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include "lookup.h"
-#include "browse.h"
-
-typedef struct AvahiWideAreaLookupEngine AvahiWideAreaLookupEngine;
-typedef struct AvahiWideAreaLookup AvahiWideAreaLookup;
-
-typedef void (*AvahiWideAreaLookupCallback)(
- AvahiWideAreaLookupEngine *e,
- AvahiBrowserEvent event,
- AvahiLookupResultFlags flags,
- AvahiRecord *r,
- void *userdata);
-
-AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s);
-void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e);
-
-unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key, AvahiWideAreaLookupCallback callback, void *userdata);
-void avahi_wide_area_cache_dump(AvahiWideAreaLookupEngine *e, AvahiDumpCallback callback, void* userdata);
-void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddress *a, unsigned n);
-void avahi_wide_area_clear_cache(AvahiWideAreaLookupEngine *e);
-void avahi_wide_area_cleanup(AvahiWideAreaLookupEngine *e);
-int avahi_wide_area_has_servers(AvahiWideAreaLookupEngine *e);
-
-AvahiWideAreaLookup *avahi_wide_area_lookup_new(AvahiWideAreaLookupEngine *e, AvahiKey *key, AvahiWideAreaLookupCallback callback, void *userdata);
-void avahi_wide_area_lookup_free(AvahiWideAreaLookup *q);
-
-
-
-#endif
-
diff --git a/trunk/avahi-daemon/AddressResolver.introspect b/trunk/avahi-daemon/AddressResolver.introspect
deleted file mode 100644
index 3550ecd..0000000
--- a/trunk/avahi-daemon/AddressResolver.introspect
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.AddressResolver">
-
- <method name="Free"/>
-
- <signal name="Found">
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/DomainBrowser.introspect b/trunk/avahi-daemon/DomainBrowser.introspect
deleted file mode 100644
index 5840060..0000000
--- a/trunk/avahi-daemon/DomainBrowser.introspect
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.DomainBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
-
diff --git a/trunk/avahi-daemon/EntryGroup.introspect b/trunk/avahi-daemon/EntryGroup.introspect
deleted file mode 100644
index e49bbe6..0000000
--- a/trunk/avahi-daemon/EntryGroup.introspect
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out"/>
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.EntryGroup">
- <method name="Free"/>
- <method name="Commit"/>
- <method name="Reset"/>
-
- <method name="GetState">
- <arg name="state" type="i" direction="out"/>
- </method>
-
- <signal name="StateChanged">
- <arg name="state" type="i"/>
- <arg name="error" type="s"/>
- </signal>
-
- <method name="IsEmpty">
- <arg name="empty" type="b" direction="out"/>
- </method>
-
- <method name="AddService">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="host" type="s" direction="in"/>
- <arg name="port" type="q" direction="in"/>
- <arg name="txt" type="aay" direction="in"/>
- </method>
-
- <method name="AddServiceSubtype">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="subtype" type="s" direction="in"/>
- </method>
-
- <method name="UpdateServiceTxt">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="txt" type="aay" direction="in"/>
- </method>
-
- <method name="AddAddress">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="address" type="s" direction="in"/>
- </method>
-
- <method name="AddRecord">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="clazz" type="q" direction="in"/>
- <arg name="type" type="q" direction="in"/>
- <arg name="ttl" type="u" direction="in"/>
- <arg name="rdata" type="ay" direction="in"/>
- </method>
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/HostNameResolver.introspect b/trunk/avahi-daemon/HostNameResolver.introspect
deleted file mode 100644
index db77ae3..0000000
--- a/trunk/avahi-daemon/HostNameResolver.introspect
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceResolver">
-
- <method name="Free"/>
-
- <signal name="Found">
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/Makefile.am b/trunk/avahi-daemon/Makefile.am
deleted file mode 100644
index 973a2b5..0000000
--- a/trunk/avahi-daemon/Makefile.am
+++ /dev/null
@@ -1,165 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_LIBDAEMON
-if HAVE_EXPAT
-
-pkgsysconfdir=$(sysconfdir)/avahi
-servicedir=$(pkgsysconfdir)/services
-introspectiondir=$(pkgdatadir)/introspection
-
-AM_CFLAGS+= \
- -DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \
- -DAVAHI_SOCKET=\"$(avahi_socket)\" \
- -DAVAHI_SERVICE_DIR=\"$(servicedir)\" \
- -DAVAHI_CONFIG_FILE=\"$(pkgsysconfdir)/avahi-daemon.conf\" \
- -DAVAHI_HOSTS_FILE=\"$(pkgsysconfdir)/hosts\" \
- -DAVAHI_DBUS_INTROSPECTION_DIR=\"$(introspectiondir)\" \
- -DAVAHI_CONFIG_DIR=\"$(pkgsysconfdir)\"
-
-sbin_PROGRAMS = \
- avahi-daemon
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- ini-file-parser-test
-endif
-
-avahi_daemon_SOURCES = \
- main.c main.h \
- simple-protocol.c simple-protocol.h \
- static-services.c static-services.h \
- static-hosts.c static-hosts.h \
- ini-file-parser.c ini-file-parser.h \
- setproctitle.c setproctitle.h \
- ../avahi-client/check-nss.c
-
-avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
-avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) -lexpat
-
-ini_file_parser_test_SOURCES = \
- ini-file-parser.c ini-file-parser.h \
- ini-file-parser-test.c
-
-ini_file_parser_test_CFLAGS = $(AM_CFLAGS)
-ini_file_parser_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la
-
-pkgsysconf_DATA = \
- avahi-daemon.conf \
- hosts
-
-service_DATA = \
- ssh.service \
- sftp-ssh.service
-
-pkgdata_DATA = \
- avahi-service.dtd
-
-if ENABLE_CHROOT
-
-avahi_daemon_SOURCES += \
- chroot.c chroot.h \
- caps.c caps.h
-
-avahi_daemon_LDADD += -lcap
-
-endif
-
-if HAVE_DLOPEN
-avahi_daemon_LDADD += -ldl
-endif
-
-if HAVE_DBUS
-
-dbusservicedir=$(DBUS_SYS_DIR)
-
-avahi_daemon_SOURCES += \
- dbus-protocol.c dbus-protocol.h \
- dbus-util.c dbus-util.h \
- dbus-internal.h \
- dbus-async-address-resolver.c \
- dbus-async-host-name-resolver.c \
- dbus-async-service-resolver.c \
- dbus-domain-browser.c \
- dbus-entry-group.c \
- dbus-service-browser.c \
- dbus-service-type-browser.c \
- dbus-sync-address-resolver.c \
- dbus-sync-host-name-resolver.c \
- dbus-sync-service-resolver.c \
- dbus-record-browser.c \
- ../avahi-common/dbus.c ../avahi-common/dbus.h \
- ../avahi-common/dbus-watch-glue.c ../avahi-common/dbus-watch-glue.h
-
-avahi_daemon_LDADD += \
- $(DBUS_LIBS)
-
-avahi_daemon_CFLAGS += $(DBUS_CFLAGS)
-
-dbusservice_DATA = avahi-dbus.conf
-
-introspection_DATA = \
- Server.introspect \
- EntryGroup.introspect \
- DomainBrowser.introspect \
- ServiceTypeBrowser.introspect \
- ServiceBrowser.introspect \
- ServiceResolver.introspect \
- AddressResolver.introspect \
- HostNameResolver.introspect \
- RecordBrowser.introspect
-
-endif
-endif
-endif
-
-EXTRA_DIST = \
- avahi-service.dtd \
- avahi-daemon.conf \
- example.service \
- avahi-dbus.conf \
- Server.introspect \
- EntryGroup.introspect \
- DomainBrowser.introspect \
- ServiceTypeBrowser.introspect \
- ServiceBrowser.introspect \
- ServiceResolver.introspect \
- AddressResolver.introspect \
- HostNameResolver.introspect \
- RecordBrowser.introspect \
- ssh.service \
- sftp-ssh.service \
- hosts \
- example.service \
- introspect.dtd \
- introspect.xsl
-
-xmllint:
- xmllint --noout --valid example.service
- for F in $(introspection_DATA) ; do \
- xmllint --noout --valid $$F ; \
- done
-
-install-data-local:
- test -z "$(localstatedir)/run" || $(mkdir_p) "$(DESTDIR)$(localstatedir)/run"
diff --git a/trunk/avahi-daemon/RecordBrowser.introspect b/trunk/avahi-daemon/RecordBrowser.introspect
deleted file mode 100644
index 57c1e66..0000000
--- a/trunk/avahi-daemon/RecordBrowser.introspect
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.RecordBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="clazz" type="q"/>
- <arg name="type" type="q"/>
- <arg name="rdata" type="ay"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="clazz" type="q"/>
- <arg name="type" type="q"/>
- <arg name="rdata" type="ay"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/Server.introspect b/trunk/avahi-daemon/Server.introspect
deleted file mode 100644
index 9d743ba..0000000
--- a/trunk/avahi-daemon/Server.introspect
+++ /dev/null
@@ -1,221 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out"/>
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.Server">
-
- <method name="GetVersionString">
- <arg name="version" type="s" direction="out"/>
- </method>
-
- <method name="GetAPIVersion">
- <arg name="version" type="u" direction="out"/>
- </method>
-
- <method name="GetHostName">
- <arg name="name" type="s" direction="out"/>
- </method>
- <method name="SetHostName">
- <arg name="name" type="s" direction="in"/>
- </method>
- <method name="GetHostNameFqdn">
- <arg name="name" type="s" direction="out"/>
- </method>
- <method name="GetDomainName">
- <arg name="name" type="s" direction="out"/>
- </method>
-
- <method name="IsNSSSupportAvailable">
- <arg name="yes" type="b" direction="out"/>
- </method>
-
- <method name="GetState">
- <arg name="state" type="i" direction="out"/>
- </method>
-
- <signal name="StateChanged">
- <arg name="state" type="i"/>
- <arg name="error" type="s"/>
- </signal>
-
- <method name="GetLocalServiceCookie">
- <arg name="cookie" type="u" direction="out"/>
- </method>
-
- <method name="GetAlternativeHostName">
- <arg name="name" type="s" direction="in"/>
- <arg name="name" type="s" direction="out"/>
- </method>
-
- <method name="GetAlternativeServiceName">
- <arg name="name" type="s" direction="in"/>
- <arg name="name" type="s" direction="out"/>
- </method>
-
- <method name="GetNetworkInterfaceNameByIndex">
- <arg name="index" type="i" direction="in"/>
- <arg name="name" type="s" direction="out"/>
- </method>
- <method name="GetNetworkInterfaceIndexByName">
- <arg name="name" type="s" direction="in"/>
- <arg name="index" type="i" direction="out"/>
- </method>
-
- <method name="ResolveHostName">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </method>
-
- <method name="ResolveAddress">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="address" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </method>
-
- <method name="ResolveService">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="type" type="s" direction="out"/>
- <arg name="domain" type="s" direction="out"/>
- <arg name="host" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="port" type="q" direction="out"/>
- <arg name="txt" type="aay" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </method>
-
- <method name="EntryGroupNew">
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="DomainBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="btype" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="ServiceTypeBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="ServiceBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="ServiceResolverNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="type" type="s" direction="in"/>
- <arg name="domain" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="HostNameResolverNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="aprotocol" type="i" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="AddressResolverNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="address" type="s" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
- <method name="RecordBrowserNew">
- <arg name="interface" type="i" direction="in"/>
- <arg name="protocol" type="i" direction="in"/>
- <arg name="name" type="s" direction="in"/>
- <arg name="clazz" type="q" direction="in"/>
- <arg name="type" type="q" direction="in"/>
- <arg name="flags" type="u" direction="in"/>
-
- <arg name="path" type="o" direction="out"/>
- </method>
-
-
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/ServiceBrowser.introspect b/trunk/avahi-daemon/ServiceBrowser.introspect
deleted file mode 100644
index 4a7b430..0000000
--- a/trunk/avahi-daemon/ServiceBrowser.introspect
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="name" type="s"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/ServiceResolver.introspect b/trunk/avahi-daemon/ServiceResolver.introspect
deleted file mode 100644
index 2be9347..0000000
--- a/trunk/avahi-daemon/ServiceResolver.introspect
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceResolver">
-
- <method name="Free"/>
-
- <signal name="Found">
- <arg name="interface" type="i" direction="out"/>
- <arg name="protocol" type="i" direction="out"/>
- <arg name="name" type="s" direction="out"/>
- <arg name="type" type="s" direction="out"/>
- <arg name="domain" type="s" direction="out"/>
- <arg name="host" type="s" direction="out"/>
- <arg name="aprotocol" type="i" direction="out"/>
- <arg name="address" type="s" direction="out"/>
- <arg name="port" type="q" direction="out"/>
- <arg name="txt" type="aay" direction="out"/>
- <arg name="flags" type="u" direction="out"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/ServiceTypeBrowser.introspect b/trunk/avahi-daemon/ServiceTypeBrowser.introspect
deleted file mode 100644
index cb07f24..0000000
--- a/trunk/avahi-daemon/ServiceTypeBrowser.introspect
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
-<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<node>
-
- <interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" type="s" direction="out" />
- </method>
- </interface>
-
- <interface name="org.freedesktop.Avahi.ServiceTypeBrowser">
-
- <method name="Free"/>
-
- <signal name="ItemNew">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="ItemRemove">
- <arg name="interface" type="i"/>
- <arg name="protocol" type="i"/>
- <arg name="type" type="s"/>
- <arg name="domain" type="s"/>
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="Failure">
- <arg name="error" type="s"/>
- </signal>
-
- <signal name="AllForNow"/>
-
- <signal name="CacheExhausted"/>
-
- </interface>
-</node>
diff --git a/trunk/avahi-daemon/avahi-daemon.conf b/trunk/avahi-daemon/avahi-daemon.conf
deleted file mode 100644
index 1992a67..0000000
--- a/trunk/avahi-daemon/avahi-daemon.conf
+++ /dev/null
@@ -1,60 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# See avahi-daemon.conf(5) for more information on this configuration
-# file!
-
-[server]
-#host-name=foo
-#domain-name=local
-browse-domains=0pointer.de, zeroconf.org
-use-ipv4=yes
-use-ipv6=no
-#check-response-ttl=no
-#use-iff-running=no
-#enable-dbus=yes
-#disallow-other-stacks=no
-#allow-point-to-point=no
-
-[wide-area]
-enable-wide-area=yes
-
-[publish]
-#disable-publishing=no
-#disable-user-service-publishing=no
-#add-service-cookie=yes
-#publish-addresses=yes
-#publish-hinfo=yes
-#publish-workstation=yes
-#publish-domain=yes
-#publish-dns-servers=192.168.50.1, 192.168.50.2
-#publish-resolv-conf-dns-servers=yes
-
-[reflector]
-#enable-reflector=no
-#reflect-ipv=no
-
-[rlimits]
-#rlimit-as=
-rlimit-core=0
-rlimit-data=4194304
-rlimit-fsize=0
-rlimit-nofile=30
-rlimit-stack=4194304
-rlimit-nproc=3
diff --git a/trunk/avahi-daemon/avahi-dbus.conf.in b/trunk/avahi-daemon/avahi-dbus.conf.in
deleted file mode 100644
index c570754..0000000
--- a/trunk/avahi-daemon/avahi-dbus.conf.in
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE busconfig PUBLIC
- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-
- <!-- Only root or user @AVAHI_USER@ can own the Avahi service -->
- <policy user="@AVAHI_USER@">
- <allow own="org.freedesktop.Avahi"/>
- </policy>
- <policy user="root">
- <allow own="org.freedesktop.Avahi"/>
- </policy>
-
- <!-- Allow anyone to invoke methods on Avahi server, except SetHostName -->
- <policy context="default">
- <allow send_destination="org.freedesktop.Avahi"/>
- <allow receive_sender="org.freedesktop.Avahi"/>
-
- <deny send_interface="org.freedesktop.Avahi.Server" send_member="SetHostName"/>
- </policy>
-
- <!-- Allow everything, including access to SetHostName to users of the group "netdev" -->
- <policy group="@AVAHI_PRIV_ACCESS_GROUP@">
- <allow send_destination="org.freedesktop.Avahi"/>
- <allow receive_sender="org.freedesktop.Avahi"/>
- </policy>
-</busconfig>
diff --git a/trunk/avahi-daemon/avahi-service.dtd b/trunk/avahi-daemon/avahi-service.dtd
deleted file mode 100644
index c3c25e2..0000000
--- a/trunk/avahi-daemon/avahi-service.dtd
+++ /dev/null
@@ -1,20 +0,0 @@
-<!-- $Id$ -->
-
-<!ELEMENT service-group (name,service+)>
-<!ATTLIST service-group>
-<!ELEMENT name (#PCDATA)>
-<!ATTLIST name replace-wildcards (yes|no) "no">
-<!ELEMENT service (type,subtype*,domain-name?,host-name?,port,txt-record*)>
-<!ATTLIST service protocol (ipv4|ipv6|any) "any">
-<!ELEMENT type (#PCDATA)>
-<!ATTLIST type>
-<!ELEMENT subtype (#PCDATA)>
-<!ATTLIST subtype>
-<!ELEMENT domain-name (#PCDATA)>
-<!ATTLIST domain-name>
-<!ELEMENT host-name (#PCDATA)>
-<!ATTLIST host-name>
-<!ELEMENT port (#PCDATA)>
-<!ATTLIST port>
-<!ELEMENT txt-record (#PCDATA)>
-<!ATTLIST txt-record>
diff --git a/trunk/avahi-daemon/caps.c b/trunk/avahi-daemon/caps.c
deleted file mode 100644
index 2d0f39a..0000000
--- a/trunk/avahi-daemon/caps.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/capability.h>
-#include <sys/prctl.h>
-
-#include <avahi-core/log.h>
-
-#include "caps.h"
-
-int avahi_caps_reduce(void) {
- int ret = 0;
- cap_t caps;
- static cap_value_t cap_values[] = { CAP_SYS_CHROOT, CAP_SETUID, CAP_SETGID };
-
- /* Let's reduce our caps to the minimum set and tell Linux to keep
- * them accross setuid(). This is called before we droppped
- * priviliges. */
-
- caps = cap_init();
- assert(caps);
- cap_clear(caps);
-
- cap_set_flag(caps, CAP_EFFECTIVE, 3, cap_values, CAP_SET);
- cap_set_flag(caps, CAP_PERMITTED, 3, cap_values, CAP_SET);
-
- if (cap_set_proc(caps) < 0) {
- avahi_log_error("cap_set_proc() failed: %s", strerror(errno));
- ret = -1;
- }
- cap_free(caps);
-
- /* Retain capabilities accros setuid() */
- if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0) {
- avahi_log_error("prctl(PR_SET_KEEPCAPS) failed: %s", strerror(errno));
- ret = -1;
- }
-
- return ret;
-}
-
-int avahi_caps_reduce2(void) {
- int ret = 0;
- cap_t caps;
- static cap_value_t cap_values[] = { CAP_SYS_CHROOT };
-
- /* Reduce our caps to the bare minimum and tell Linux not to keep
- * them across setuid(). This is called after we dropped
- * privilige. */
-
- /* No longer retain caps across setuid() */
- if (prctl(PR_SET_KEEPCAPS, 0, 0, 0, 0) < 0) {
- avahi_log_error("prctl(PR_SET_KEEPCAPS) failed: %s", strerror(errno));
- ret = -1;
- }
-
- caps = cap_init();
- assert(caps);
- cap_clear(caps);
-
- /* setuid() zeroed our effective caps, let's get them back */
- cap_set_flag(caps, CAP_EFFECTIVE, 1, cap_values, CAP_SET);
- cap_set_flag(caps, CAP_PERMITTED, 1, cap_values, CAP_SET);
-
- if (cap_set_proc(caps) < 0) {
- avahi_log_error("cap_set_proc() failed: %s", strerror(errno));
- ret = -1;
- }
- cap_free(caps);
-
- return ret;
-}
-
-int avahi_caps_drop_all(void) {
- cap_t caps;
- int ret = 0;
-
- /* Drop all capabilities and turn ourselves into a normal user process */
-
- caps = cap_init();
- assert(caps);
- cap_clear(caps);
-
- if (cap_set_proc(caps) < 0) {
- avahi_log_error("cap_set_proc() failed: %s", strerror(errno));
- ret = -1;
- }
- cap_free(caps);
-
- return ret;
-}
diff --git a/trunk/avahi-daemon/caps.h b/trunk/avahi-daemon/caps.h
deleted file mode 100644
index 788aceb..0000000
--- a/trunk/avahi-daemon/caps.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef foocapshfoo
-#define foocapshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-int avahi_caps_reduce(void);
-int avahi_caps_reduce2(void);
-int avahi_caps_drop_all(void);
-
-#endif
diff --git a/trunk/avahi-daemon/chroot.c b/trunk/avahi-daemon/chroot.c
deleted file mode 100644
index 20e2f03..0000000
--- a/trunk/avahi-daemon/chroot.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <inttypes.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/un.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-
-#include <avahi-core/log.h>
-#include <libdaemon/dfork.h>
-
-#include "chroot.h"
-#include "caps.h"
-#include "setproctitle.h"
-
-enum {
- AVAHI_CHROOT_SUCCESS = 0,
- AVAHI_CHROOT_FAILURE,
- AVAHI_CHROOT_GET_RESOLV_CONF,
-#ifdef HAVE_DBUS
- AVAHI_CHROOT_GET_SERVER_INTROSPECT,
- AVAHI_CHROOT_GET_ENTRY_GROUP_INTROSPECT,
- AVAHI_CHROOT_GET_ADDRESS_RESOLVER_INTROSPECT,
- AVAHI_CHROOT_GET_DOMAIN_BROWSER_INTROSPECT,
- AVAHI_CHROOT_GET_HOST_NAME_RESOLVER_INTROSPECT,
- AVAHI_CHROOT_GET_SERVICE_BROWSER_INTROSPECT,
- AVAHI_CHROOT_GET_SERVICE_RESOLVER_INTROSPECT,
- AVAHI_CHROOT_GET_SERVICE_TYPE_BROWSER_INTROSPECT,
- AVAHI_CHROOT_GET_RECORD_BROWSER_INTROSPECT,
-#endif
- AVAHI_CHROOT_UNLINK_PID,
- AVAHI_CHROOT_UNLINK_SOCKET,
- AVAHI_CHROOT_MAX
-};
-
-static const char* const get_file_name_table[AVAHI_CHROOT_MAX] = {
- NULL,
- NULL,
- "/etc/resolv.conf",
-#ifdef HAVE_DBUS
- AVAHI_DBUS_INTROSPECTION_DIR"/Server.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/EntryGroup.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/AddressResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/DomainBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/HostNameResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceTypeBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/RecordBrowser.introspect",
-#endif
- NULL,
- NULL
-};
-
-static const char *const unlink_file_name_table[AVAHI_CHROOT_MAX] = {
- NULL,
- NULL,
- NULL,
-#ifdef HAVE_DBUS
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
-#endif
- AVAHI_DAEMON_RUNTIME_DIR"/pid",
- AVAHI_SOCKET
-};
-
-static int helper_fd = -1;
-
-static int send_fd(int fd, int payload_fd) {
- uint8_t dummy = AVAHI_CHROOT_SUCCESS;
- struct iovec iov;
- struct msghdr msg;
- union {
- struct cmsghdr hdr;
- char buf[CMSG_SPACE(sizeof(int))];
- } cmsg;
-
- /* Send a file descriptor over the socket */
-
- memset(&iov, 0, sizeof(iov));
- memset(&msg, 0, sizeof(msg));
- memset(&cmsg, 0, sizeof(cmsg));
-
- iov.iov_base = &dummy;
- iov.iov_len = sizeof(dummy);
-
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
-
- msg.msg_control = &cmsg;
- msg.msg_controllen = sizeof(cmsg);
- msg.msg_flags = 0;
-
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
- cmsg.hdr.cmsg_level = SOL_SOCKET;
- cmsg.hdr.cmsg_type = SCM_RIGHTS;
- *((int*) CMSG_DATA(&cmsg.hdr)) = payload_fd;
-
- if (sendmsg(fd, &msg, 0) < 0) {
- avahi_log_error("sendmsg() failed: %s", strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
-static int recv_fd(int fd) {
- uint8_t dummy;
- struct iovec iov;
- struct msghdr msg;
- union {
- struct cmsghdr hdr;
- char buf[CMSG_SPACE(sizeof(int))];
- } cmsg;
-
- /* Receive a file descriptor from a socket */
-
- memset(&iov, 0, sizeof(iov));
- memset(&msg, 0, sizeof(msg));
- memset(&cmsg, 0, sizeof(cmsg));
-
- iov.iov_base = &dummy;
- iov.iov_len = sizeof(dummy);
-
- msg.msg_iov = &iov;
- msg.msg_iovlen = 1;
- msg.msg_name = NULL;
- msg.msg_namelen = 0;
-
- msg.msg_control = cmsg.buf;
- msg.msg_controllen = sizeof(cmsg);
- msg.msg_flags = 0;
-
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
- cmsg.hdr.cmsg_level = SOL_SOCKET;
- cmsg.hdr.cmsg_type = SCM_RIGHTS;
- *((int*) CMSG_DATA(&cmsg.hdr)) = -1;
-
- if (recvmsg(fd, &msg, 0) <= 0) {
- avahi_log_error("recvmsg() failed: %s", strerror(errno));
- return -1;
- } else {
- struct cmsghdr* h;
-
- if (dummy != AVAHI_CHROOT_SUCCESS) {
- errno = EINVAL;
- return -1;
- }
-
- if (!(h = CMSG_FIRSTHDR(&msg))) {
- avahi_log_error("recvmsg() sent no fd.");
- errno = EINVAL;
- return -1;
- }
-
- assert(h->cmsg_len = CMSG_LEN(sizeof(int)));
- assert(h->cmsg_level = SOL_SOCKET);
- assert(h->cmsg_type == SCM_RIGHTS);
-
- return *((int*)CMSG_DATA(h));
- }
-}
-
-static int helper_main(int fd) {
- int ret = 1;
- assert(fd >= 0);
-
- /* This is the main function of our helper process which is forked
- * off to access files outside the chroot environment. Keep in
- * mind that this code is security sensitive! */
-
- avahi_log_debug(__FILE__": chroot() helper started");
-
- for (;;) {
- uint8_t command;
- ssize_t r;
-
- if ((r = read(fd, &command, sizeof(command))) <= 0) {
-
- /* EOF? */
- if (r == 0)
- break;
-
- avahi_log_error(__FILE__": read() failed: %s", strerror(errno));
- goto fail;
- }
-
- assert(r == sizeof(command));
-
- avahi_log_debug(__FILE__": chroot() helper got command %02x", command);
-
- switch (command) {
-#ifdef HAVE_DBUS
- case AVAHI_CHROOT_GET_SERVER_INTROSPECT:
- case AVAHI_CHROOT_GET_ENTRY_GROUP_INTROSPECT:
- case AVAHI_CHROOT_GET_ADDRESS_RESOLVER_INTROSPECT:
- case AVAHI_CHROOT_GET_DOMAIN_BROWSER_INTROSPECT:
- case AVAHI_CHROOT_GET_HOST_NAME_RESOLVER_INTROSPECT:
- case AVAHI_CHROOT_GET_SERVICE_BROWSER_INTROSPECT:
- case AVAHI_CHROOT_GET_SERVICE_RESOLVER_INTROSPECT:
- case AVAHI_CHROOT_GET_SERVICE_TYPE_BROWSER_INTROSPECT:
- case AVAHI_CHROOT_GET_RECORD_BROWSER_INTROSPECT:
-#endif
- case AVAHI_CHROOT_GET_RESOLV_CONF: {
- int payload;
-
- if ((payload = open(get_file_name_table[(int) command], O_RDONLY)) < 0) {
- uint8_t c = AVAHI_CHROOT_FAILURE;
-
- avahi_log_error(__FILE__": open() failed: %s", strerror(errno));
-
- if (write(fd, &c, sizeof(c)) != sizeof(c)) {
- avahi_log_error(__FILE__": write() failed: %s\n", strerror(errno));
- goto fail;
- }
-
- break;
- }
-
- if (send_fd(fd, payload) < 0)
- goto fail;
-
- close(payload);
-
- break;
- }
-
- case AVAHI_CHROOT_UNLINK_SOCKET:
- case AVAHI_CHROOT_UNLINK_PID: {
- uint8_t c = AVAHI_CHROOT_SUCCESS;
-
- unlink(unlink_file_name_table[(int) command]);
-
- if (write(fd, &c, sizeof(c)) != sizeof(c)) {
- avahi_log_error(__FILE__": write() failed: %s\n", strerror(errno));
- goto fail;
- }
-
- break;
- }
-
- default:
- avahi_log_error(__FILE__": Unknown command %02x.", command);
- break;
- }
- }
-
- ret = 0;
-
-fail:
-
- avahi_log_debug(__FILE__": chroot() helper exiting with return value %i", ret);
-
- return ret;
-}
-
-int avahi_chroot_helper_start(const char *argv0) {
- int sock[2];
- pid_t pid;
-
- assert(helper_fd < 0);
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, sock) < 0) {
- avahi_log_error("socketpair() failed: %s", strerror(errno));
- return -1;
- }
-
- if ((pid = fork()) < 0) {
- close(sock[0]);
- close(sock[1]);
- avahi_log_error(__FILE__": fork() failed: %s", strerror(errno));
- return -1;
- } else if (pid == 0) {
-
- setsid();
-
- /* Drop all remaining capabilities */
- avahi_caps_drop_all();
-
- avahi_set_proc_title(argv0, "%s: chroot helper", argv0);
-
- daemon_retval_done();
-
- close(sock[0]);
- helper_main(sock[1]);
- _exit(0);
- }
-
- close(sock[1]);
- helper_fd = sock[0];
-
- return 0;
-}
-
-void avahi_chroot_helper_shutdown(void) {
-
- if (helper_fd <= 0)
- return;
-
- close(helper_fd);
- helper_fd = -1;
-}
-
-int avahi_chroot_helper_get_fd(const char *fname) {
-
- if (helper_fd >= 0) {
- uint8_t command;
-
- for (command = 2; command < AVAHI_CHROOT_MAX; command++)
- if (get_file_name_table[(int) command] &&
- strcmp(fname, get_file_name_table[(int) command]) == 0)
- break;
-
- if (command >= AVAHI_CHROOT_MAX) {
- avahi_log_error("chroot() helper accessed for invalid file name");
- errno = EACCES;
- return -1;
- }
-
- assert(get_file_name_table[(int) command]);
-
- if (write(helper_fd, &command, sizeof(command)) < 0) {
- avahi_log_error("write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- return recv_fd(helper_fd);
-
- } else
- return open(fname, O_RDONLY);
-}
-
-
-FILE *avahi_chroot_helper_get_file(const char *fname) {
- FILE *f;
- int fd;
-
- if ((fd = avahi_chroot_helper_get_fd(fname)) < 0)
- return NULL;
-
- f = fdopen(fd, "r");
- assert(f);
-
- return f;
-}
-
-int avahi_chroot_helper_unlink(const char *fname) {
-
- if (helper_fd >= 0) {
- uint8_t c, command;
- ssize_t r;
-
- for (command = 2; command < AVAHI_CHROOT_MAX; command++)
- if (unlink_file_name_table[(int) command] &&
- strcmp(fname, unlink_file_name_table[(int) command]) == 0)
- break;
-
- if (command >= AVAHI_CHROOT_MAX) {
- avahi_log_error("chroot() helper accessed for invalid file name");
- errno = EACCES;
- return -1;
- }
-
- if (write(helper_fd, &command, sizeof(command)) < 0) {
- avahi_log_error("write() failed: %s\n", strerror(errno));
- return -1;
- }
-
- if ((r = read(helper_fd, &c, sizeof(c))) < 0) {
- avahi_log_error("read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- return -1;
- }
-
- return 0;
-
- } else
-
- return unlink(fname);
-
-}
diff --git a/trunk/avahi-daemon/chroot.h b/trunk/avahi-daemon/chroot.h
deleted file mode 100644
index ea61c5a..0000000
--- a/trunk/avahi-daemon/chroot.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef foochroothelperhfoo
-#define foochroothelperhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-
-int avahi_chroot_helper_start(const char *argv0);
-void avahi_chroot_helper_shutdown(void);
-int avahi_chroot_helper_get(const char *fname);
-
-int avahi_chroot_helper_get_fd(const char *fname);
-FILE *avahi_chroot_helper_get_file(const char *fname);
-
-int avahi_chroot_helper_unlink(const char *fname);
-
-#endif
diff --git a/trunk/avahi-daemon/dbus-async-address-resolver.c b/trunk/avahi-daemon/dbus-async-address-resolver.c
deleted file mode 100644
index f05af8f..0000000
--- a/trunk/avahi-daemon/dbus-async-address-resolver.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i) {
- assert(i);
-
- if (i->address_resolver)
- avahi_s_address_resolver_free(i->address_resolver);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
-
- AVAHI_LLIST_REMOVE(AsyncAddressResolverInfo, async_address_resolvers, i->client->async_address_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata) {
- AsyncAddressResolverInfo *i = userdata;
- DBusMessage *reply;
-
- assert(r);
- assert(i);
-
- reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, avahi_dbus_map_resolve_signal_name(event));
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
-
- assert(address);
- assert(host_name);
- avahi_address_snprint(t, sizeof(t), address);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) address->proto;
- u_flags = (uint32_t) flags;
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_append_server_error(reply);
- }
-
- dbus_message_set_destination(reply, i->client->name);
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
-}
-
-DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- AsyncAddressResolverInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "AddressResolver.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing AddressResolver::Free message");
- goto fail;
- }
-
- avahi_dbus_async_address_resolver_free(i);
- return avahi_dbus_respond_ok(c, m);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
diff --git a/trunk/avahi-daemon/dbus-async-host-name-resolver.c b/trunk/avahi-daemon/dbus-async-host-name-resolver.c
deleted file mode 100644
index a2c99a7..0000000
--- a/trunk/avahi-daemon/dbus-async-host-name-resolver.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i) {
- assert(i);
-
- if (i->host_name_resolver)
- avahi_s_host_name_resolver_free(i->host_name_resolver);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
- AVAHI_LLIST_REMOVE(AsyncHostNameResolverInfo, async_host_name_resolvers, i->client->async_host_name_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_async_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata) {
- AsyncHostNameResolverInfo *i = userdata;
- DBusMessage *reply;
-
- assert(r);
- assert(i);
-
- reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, avahi_dbus_map_resolve_signal_name(event));
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
-
- assert(a);
- assert(host_name);
- avahi_address_snprint(t, sizeof(t), a);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) a->proto;
- u_flags = (uint32_t) flags;
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_append_server_error(reply);
- }
-
- dbus_message_set_destination(reply, i->client->name);
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
-}
-
-DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- AsyncHostNameResolverInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "HostNameResolver.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing HostNameResolver::Free message");
- goto fail;
- }
-
- avahi_dbus_async_host_name_resolver_free(i);
- return avahi_dbus_respond_ok(c, m);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
diff --git a/trunk/avahi-daemon/dbus-async-service-resolver.c b/trunk/avahi-daemon/dbus-async-service-resolver.c
deleted file mode 100644
index a9a1364..0000000
--- a/trunk/avahi-daemon/dbus-async-service-resolver.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i) {
- assert(i);
-
- if (i->service_resolver)
- avahi_s_service_resolver_free(i->service_resolver);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
-
- AVAHI_LLIST_REMOVE(AsyncServiceResolverInfo, async_service_resolvers, i->client->async_service_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_async_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- AsyncServiceResolverInfo *i = userdata;
- DBusMessage *reply;
-
- assert(r);
- assert(i);
-
- reply = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, avahi_dbus_map_resolve_signal_name(event));
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
-
- assert(host_name);
-
-/* avahi_log_debug(__FILE__": [%s] Successfully resolved service <%s.%s.%s>", i->path, name, type, domain); */
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
- else
- t[0] = 0;
-
- if (!name)
- name = "";
-
- if (avahi_dbus_is_our_own_service(i->client, interface, protocol, name, type, domain) > 0)
- flags |= AVAHI_LOOKUP_RESULT_OUR_OWN;
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- if (a)
- i_aprotocol = (int32_t) a->proto;
- else
- i_aprotocol = AVAHI_PROTO_UNSPEC;
- u_flags = (uint32_t) flags;
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID);
-
- avahi_dbus_append_string_list(reply, txt);
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_append_server_error(reply);
- }
-
- dbus_message_set_destination(reply, i->client->name);
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
-}
-
-DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- AsyncServiceResolverInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceResolver.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing ServiceResolver::Free message");
- goto fail;
- }
-
- avahi_dbus_async_service_resolver_free(i);
- return avahi_dbus_respond_ok(c, m);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
diff --git a/trunk/avahi-daemon/dbus-domain-browser.c b/trunk/avahi-daemon/dbus-domain-browser.c
deleted file mode 100644
index b529ede..0000000
--- a/trunk/avahi-daemon/dbus-domain-browser.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_domain_browser_free(DomainBrowserInfo *i) {
- assert(i);
-
- if (i->domain_browser)
- avahi_s_domain_browser_free(i->domain_browser);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
-
- AVAHI_LLIST_REMOVE(DomainBrowserInfo, domain_browsers, i->client->domain_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- DomainBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "DomainBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing DomainBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_domain_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
- DomainBrowserInfo *i = userdata;
- DBusMessage *m;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- assert(domain);
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
diff --git a/trunk/avahi-daemon/dbus-entry-group.c b/trunk/avahi-daemon/dbus-entry-group.c
deleted file mode 100644
index 0e1a21c..0000000
--- a/trunk/avahi-daemon/dbus-entry-group.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_entry_group_free(EntryGroupInfo *i) {
- assert(i);
-
- if (i->entry_group)
- avahi_s_entry_group_free(i->entry_group);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
- AVAHI_LLIST_REMOVE(EntryGroupInfo, entry_groups, i->client->entry_groups, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata) {
- EntryGroupInfo *i = userdata;
- DBusMessage *m;
- int32_t t;
- const char *e;
-
- assert(s);
- assert(g);
- assert(i);
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "StateChanged");
-
- t = (int32_t) state;
- if (state == AVAHI_ENTRY_GROUP_FAILURE)
- e = avahi_error_number_to_dbus(avahi_server_errno(s));
- else if (state == AVAHI_ENTRY_GROUP_COLLISION)
- e = AVAHI_DBUS_ERR_COLLISION;
- else
- e = AVAHI_DBUS_ERR_OK;
-
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &t,
- DBUS_TYPE_STRING, &e,
- DBUS_TYPE_INVALID);
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
-DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- EntryGroupInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "EntryGroup.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::Free message");
- goto fail;
- }
-
- avahi_dbus_entry_group_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "Commit")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::Commit message");
- goto fail;
- }
-
- if (avahi_s_entry_group_commit(i->entry_group) < 0)
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
-
- return avahi_dbus_respond_ok(c, m);
-
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "Reset")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::Reset message");
- goto fail;
- }
-
- avahi_s_entry_group_reset(i->entry_group);
- i->n_entries = 0;
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "IsEmpty")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::IsEmpty message");
- goto fail;
- }
-
- return avahi_dbus_respond_boolean(c, m, !!avahi_s_entry_group_is_empty(i->entry_group));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "GetState")) {
- AvahiEntryGroupState state;
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing EntryGroup::GetState message");
- goto fail;
- }
-
- state = avahi_s_entry_group_get_state(i->entry_group);
- return avahi_dbus_respond_int32(c, m, (int32_t) state);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddService")) {
- int32_t interface, protocol;
- uint32_t flags;
- char *type, *name, *domain, *host;
- uint16_t port;
- AvahiStringList *strlst = NULL;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID) ||
- !type || !name ||
- avahi_dbus_read_strlst(m, 8, &strlst) < 0) {
- avahi_log_warn("Error parsing EntryGroup::AddService message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX) {
- avahi_string_list_free(strlst);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
- }
-
- if (domain && !*domain)
- domain = NULL;
-
- if (host && !*host)
- host = NULL;
-
- if (avahi_server_add_service_strlst(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, type, domain, host, port, strlst) < 0) {
- avahi_string_list_free(strlst);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- avahi_string_list_free(strlst);
-
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddServiceSubtype")) {
-
- int32_t interface, protocol;
- uint32_t flags;
- char *type, *name, *domain, *subtype;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &subtype,
- DBUS_TYPE_INVALID) || !type || !name || !subtype) {
- avahi_log_warn("Error parsing EntryGroup::AddServiceSubtype message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
-
- if (domain && !*domain)
- domain = NULL;
-
- if (avahi_server_add_service_subtype(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, type, domain, subtype) < 0)
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "UpdateServiceTxt")) {
- int32_t interface, protocol;
- uint32_t flags;
- char *type, *name, *domain;
- AvahiStringList *strlst;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INVALID) ||
- !type || !name ||
- avahi_dbus_read_strlst(m, 6, &strlst)) {
- avahi_log_warn("Error parsing EntryGroup::UpdateServiceTxt message");
- goto fail;
- }
-
- if (domain && !*domain)
- domain = NULL;
-
- if (avahi_server_update_service_txt_strlst(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, type, domain, strlst) < 0) {
- avahi_string_list_free(strlst);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_string_list_free(strlst);
-
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddAddress")) {
- int32_t interface, protocol;
- uint32_t flags;
- char *name, *address;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_INVALID) || !name || !address) {
- avahi_log_warn("Error parsing EntryGroup::AddAddress message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
-
- if (!(avahi_address_parse(address, AVAHI_PROTO_UNSPEC, &a)))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_ADDRESS, NULL);
-
- if (avahi_server_add_address(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, name, &a) < 0)
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- return avahi_dbus_respond_ok(c, m);
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_ENTRY_GROUP, "AddRecord")) {
- int32_t interface, protocol;
- uint32_t flags, ttl, size;
- uint16_t clazz, type;
- char *name;
- void *rdata;
- AvahiRecord *r;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &ttl,
- DBUS_TYPE_INVALID) || !name ||
- avahi_dbus_read_rdata (m, 7, &rdata, &size)) {
- avahi_log_warn("Error parsing EntryGroup::AddRecord message");
- goto fail;
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_ENTRIES, NULL);
-
- if (!avahi_is_valid_domain_name (name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_DOMAIN_NAME, NULL);
-
- if (!(r = avahi_record_new_full (name, clazz, type, ttl)))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_NO_MEMORY, NULL);
-
- if (avahi_rdata_parse (r, rdata, size) < 0) {
- avahi_record_unref (r);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_RDATA, NULL);
- }
-
- if (avahi_server_add(avahi_server, i->entry_group, (AvahiIfIndex) interface, (AvahiProtocol) protocol, (AvahiPublishFlags) flags, r) < 0) {
- avahi_record_unref (r);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- if (!(flags & AVAHI_PUBLISH_UPDATE))
- i->n_entries ++;
-
- avahi_record_unref (r);
-
- return avahi_dbus_respond_ok(c, m);
- }
-
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
diff --git a/trunk/avahi-daemon/dbus-internal.h b/trunk/avahi-daemon/dbus-internal.h
deleted file mode 100644
index 11c1094..0000000
--- a/trunk/avahi-daemon/dbus-internal.h
+++ /dev/null
@@ -1,252 +0,0 @@
-#ifndef foodbusinternalhfoo
-#define foodbusinternalhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-#include <dbus/dbus.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/lookup.h>
-
-#include <avahi-common/llist.h>
-
-typedef struct Server Server;
-typedef struct Client Client;
-typedef struct EntryGroupInfo EntryGroupInfo;
-typedef struct SyncHostNameResolverInfo SyncHostNameResolverInfo;
-typedef struct AsyncHostNameResolverInfo AsyncHostNameResolverInfo;
-typedef struct SyncAddressResolverInfo SyncAddressResolverInfo;
-typedef struct AsyncAddressResolverInfo AsyncAddressResolverInfo;
-typedef struct DomainBrowserInfo DomainBrowserInfo;
-typedef struct ServiceTypeBrowserInfo ServiceTypeBrowserInfo;
-typedef struct ServiceBrowserInfo ServiceBrowserInfo;
-typedef struct SyncServiceResolverInfo SyncServiceResolverInfo;
-typedef struct AsyncServiceResolverInfo AsyncServiceResolverInfo;
-typedef struct RecordBrowserInfo RecordBrowserInfo;
-
-#define CLIENTS_MAX 256
-#define OBJECTS_PER_CLIENT_MAX 250
-#define ENTRIES_PER_ENTRY_GROUP_MAX 20
-
-struct EntryGroupInfo {
- unsigned id;
- Client *client;
- AvahiSEntryGroup *entry_group;
- char *path;
-
- int n_entries;
-
- AVAHI_LLIST_FIELDS(EntryGroupInfo, entry_groups);
-};
-
-struct SyncHostNameResolverInfo {
- Client *client;
- AvahiSHostNameResolver *host_name_resolver;
- DBusMessage *message;
-
- AVAHI_LLIST_FIELDS(SyncHostNameResolverInfo, sync_host_name_resolvers);
-};
-
-struct AsyncHostNameResolverInfo {
- unsigned id;
- Client *client;
- AvahiSHostNameResolver *host_name_resolver;
- char *path;
-
- AVAHI_LLIST_FIELDS(AsyncHostNameResolverInfo, async_host_name_resolvers);
-};
-
-struct SyncAddressResolverInfo {
- Client *client;
- AvahiSAddressResolver *address_resolver;
- DBusMessage *message;
-
- AVAHI_LLIST_FIELDS(SyncAddressResolverInfo, sync_address_resolvers);
-};
-
-struct AsyncAddressResolverInfo {
- unsigned id;
- Client *client;
- AvahiSAddressResolver *address_resolver;
- char *path;
-
- AVAHI_LLIST_FIELDS(AsyncAddressResolverInfo, async_address_resolvers);
-};
-
-struct DomainBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSDomainBrowser *domain_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(DomainBrowserInfo, domain_browsers);
-};
-
-struct ServiceTypeBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSServiceTypeBrowser *service_type_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(ServiceTypeBrowserInfo, service_type_browsers);
-};
-
-struct ServiceBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSServiceBrowser *service_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(ServiceBrowserInfo, service_browsers);
-};
-
-struct SyncServiceResolverInfo {
- Client *client;
- AvahiSServiceResolver *service_resolver;
- DBusMessage *message;
-
- AVAHI_LLIST_FIELDS(SyncServiceResolverInfo, sync_service_resolvers);
-};
-
-struct AsyncServiceResolverInfo {
- unsigned id;
- Client *client;
- AvahiSServiceResolver *service_resolver;
- char *path;
-
- AVAHI_LLIST_FIELDS(AsyncServiceResolverInfo, async_service_resolvers);
-};
-
-struct RecordBrowserInfo {
- unsigned id;
- Client *client;
- AvahiSRecordBrowser *record_browser;
- char *path;
-
- AVAHI_LLIST_FIELDS(RecordBrowserInfo, record_browsers);
-};
-
-struct Client {
- unsigned id;
- char *name;
- unsigned current_id;
- int n_objects;
-
- AVAHI_LLIST_FIELDS(Client, clients);
- AVAHI_LLIST_HEAD(EntryGroupInfo, entry_groups);
- AVAHI_LLIST_HEAD(SyncHostNameResolverInfo, sync_host_name_resolvers);
- AVAHI_LLIST_HEAD(AsyncHostNameResolverInfo, async_host_name_resolvers);
- AVAHI_LLIST_HEAD(SyncAddressResolverInfo, sync_address_resolvers);
- AVAHI_LLIST_HEAD(AsyncAddressResolverInfo, async_address_resolvers);
- AVAHI_LLIST_HEAD(DomainBrowserInfo, domain_browsers);
- AVAHI_LLIST_HEAD(ServiceTypeBrowserInfo, service_type_browsers);
- AVAHI_LLIST_HEAD(ServiceBrowserInfo, service_browsers);
- AVAHI_LLIST_HEAD(SyncServiceResolverInfo, sync_service_resolvers);
- AVAHI_LLIST_HEAD(AsyncServiceResolverInfo, async_service_resolvers);
- AVAHI_LLIST_HEAD(RecordBrowserInfo, record_browsers);
-};
-
-struct Server {
- const AvahiPoll *poll_api;
- DBusConnection *bus;
- AVAHI_LLIST_HEAD(Client, clients);
- int n_clients;
- unsigned current_id;
-
- AvahiTimeout *reconnect_timeout;
- int reconnect;
-};
-
-extern Server *server;
-
-void avahi_dbus_entry_group_free(EntryGroupInfo *i);
-void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
-DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_sync_host_name_resolver_free(SyncHostNameResolverInfo *i);
-void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i);
-void avahi_dbus_async_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata);
-DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_sync_address_resolver_free(SyncAddressResolverInfo *i);
-void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i);
-void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata);
-DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_domain_browser_free(DomainBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *domain, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_service_browser_free(ServiceBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata);
-
-void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i);
-
-void avahi_dbus_sync_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata);
-
-void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i);
-void avahi_dbus_async_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata);
-
-DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-
-void avahi_dbus_record_browser_free(RecordBrowserInfo *i);
-DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata);
-void avahi_dbus_record_browser_callback(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, AvahiLookupResultFlags flags, void* userdata);
-
-#endif
diff --git a/trunk/avahi-daemon/dbus-protocol.c b/trunk/avahi-daemon/dbus-protocol.c
deleted file mode 100644
index caa2e19..0000000
--- a/trunk/avahi-daemon/dbus-protocol.c
+++ /dev/null
@@ -1,1178 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <errno.h>
-#include <unistd.h>
-#include <assert.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <signal.h>
-#include <stdlib.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/dbus.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus-watch-glue.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/error.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/timeval.h>
-
-#include <avahi-core/log.h>
-#include <avahi-core/core.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/publish.h>
-
-#include "dbus-protocol.h"
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-/* #define VALGRIND_WORKAROUND 1 */
-
-#define RECONNECT_MSEC 3000
-
-Server *server = NULL;
-
-static int disable_user_service_publishing = 0;
-
-static int dbus_connect(void);
-static void dbus_disconnect(void);
-
-static void client_free(Client *c) {
-
- assert(server);
- assert(c);
-
- while (c->entry_groups)
- avahi_dbus_entry_group_free(c->entry_groups);
-
- while (c->sync_host_name_resolvers)
- avahi_dbus_sync_host_name_resolver_free(c->sync_host_name_resolvers);
-
- while (c->async_host_name_resolvers)
- avahi_dbus_async_host_name_resolver_free(c->async_host_name_resolvers);
-
- while (c->sync_address_resolvers)
- avahi_dbus_sync_address_resolver_free(c->sync_address_resolvers);
-
- while (c->async_address_resolvers)
- avahi_dbus_async_address_resolver_free(c->async_address_resolvers);
-
- while (c->domain_browsers)
- avahi_dbus_domain_browser_free(c->domain_browsers);
-
- while (c->service_type_browsers)
- avahi_dbus_service_type_browser_free(c->service_type_browsers);
-
- while (c->service_browsers)
- avahi_dbus_service_browser_free(c->service_browsers);
-
- while (c->sync_service_resolvers)
- avahi_dbus_sync_service_resolver_free(c->sync_service_resolvers);
-
- while (c->async_service_resolvers)
- avahi_dbus_async_service_resolver_free(c->async_service_resolvers);
-
- while (c->record_browsers)
- avahi_dbus_record_browser_free(c->record_browsers);
-
- assert(c->n_objects == 0);
-
- avahi_free(c->name);
- AVAHI_LLIST_REMOVE(Client, clients, server->clients, c);
- avahi_free(c);
-
- server->n_clients --;
- assert(server->n_clients >= 0);
-}
-
-static Client *client_get(const char *name, int create) {
- Client *client;
-
- assert(server);
- assert(name);
-
- for (client = server->clients; client; client = client->clients_next)
- if (!strcmp(name, client->name))
- return client;
-
- if (!create)
- return NULL;
-
- if (server->n_clients >= CLIENTS_MAX)
- return NULL;
-
- /* If not existant yet, create a new entry */
- client = avahi_new(Client, 1);
- client->id = server->current_id++;
- client->name = avahi_strdup(name);
- client->current_id = 0;
- client->n_objects = 0;
-
- AVAHI_LLIST_HEAD_INIT(EntryGroupInfo, client->entry_groups);
- AVAHI_LLIST_HEAD_INIT(SyncHostNameResolverInfo, client->sync_host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(AsyncHostNameResolverInfo, client->async_host_name_resolvers);
- AVAHI_LLIST_HEAD_INIT(SyncAddressResolverInfo, client->sync_address_resolvers);
- AVAHI_LLIST_HEAD_INIT(AsyncAddressResolverInfo, client->async_address_resolvers);
- AVAHI_LLIST_HEAD_INIT(DomainBrowserInfo, client->domain_browsers);
- AVAHI_LLIST_HEAD_INIT(ServiceTypeBrowserInfo, client->service_type_browsers);
- AVAHI_LLIST_HEAD_INIT(ServiceBrowserInfo, client->service_browsers);
- AVAHI_LLIST_HEAD_INIT(SyncServiceResolverInfo, client->sync_service_resolvers);
- AVAHI_LLIST_HEAD_INIT(AsyncServiceResolverInfo, client->async_service_resolvers);
- AVAHI_LLIST_HEAD_INIT(RecordBrowserInfo, client->record_browsers);
-
- AVAHI_LLIST_PREPEND(Client, clients, server->clients, client);
-
- server->n_clients++;
- assert(server->n_clients > 0);
-
- return client;
-}
-
-static void reconnect_callback(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) {
- assert(!server->bus);
-
- if (dbus_connect() < 0) {
- struct timeval tv;
- avahi_log_debug(__FILE__": Connection failed, retrying in %ims...", RECONNECT_MSEC);
- avahi_elapse_time(&tv, RECONNECT_MSEC, 0);
- server->poll_api->timeout_update(t, &tv);
- } else {
- avahi_log_debug(__FILE__": Successfully reconnected.");
- server->poll_api->timeout_update(t, NULL);
- }
-}
-
-static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection *c, DBusMessage *m, AVAHI_GCC_UNUSED void *userdata) {
- DBusError error;
-
- dbus_error_init(&error);
-
-/* avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s", */
-/* dbus_message_get_interface(m), */
-/* dbus_message_get_path(m), */
-/* dbus_message_get_member(m)); */
-
- if (dbus_message_is_signal(m, DBUS_INTERFACE_LOCAL, "Disconnected")) {
- struct timeval tv;
-
- if (server->reconnect) {
- avahi_log_warn("Disconnnected from D-Bus, trying to reconnect in %ims...", RECONNECT_MSEC);
-
- dbus_disconnect();
-
- avahi_elapse_time(&tv, RECONNECT_MSEC, 0);
-
- if (server->reconnect_timeout)
- server->poll_api->timeout_update(server->reconnect_timeout, &tv);
- else
- server->reconnect_timeout = server->poll_api->timeout_new(server->poll_api, &tv, reconnect_callback, NULL);
- } else {
- avahi_log_warn("Disconnnected from D-Bus, exiting.");
- raise(SIGQUIT);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameAcquired")) {
- char *name;
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing NameAcquired message");
- goto fail;
- }
-
-/* avahi_log_info(__FILE__": name acquired (%s)", name); */
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
- char *name, *old, *new;
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_STRING, &old, DBUS_TYPE_STRING, &new, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing NameOwnerChanged message");
- goto fail;
- }
-
- if (!*new) {
- Client *client;
-
- if ((client = client_get(name, FALSE))) {
- avahi_log_debug(__FILE__": client %s vanished.", name);
- client_free(client);
- }
- }
- }
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAHI_GCC_UNUSED void *userdata) {
- DBusError error;
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "Server.introspect");
-
- else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostName")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::GetHostName message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, avahi_server_get_host_name(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "SetHostName")) {
-
- char *name;
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::SetHostName message");
- goto fail;
- }
-
- if (avahi_server_set_host_name(avahi_server, name) < 0)
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
-
- avahi_log_info("Changing host name to '%s'.", name);
-
- return avahi_dbus_respond_ok(c, m);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetDomainName")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::GetDomainName message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, avahi_server_get_domain_name(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetHostNameFqdn")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetHostNameFqdn message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, avahi_server_get_host_name_fqdn(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "IsNSSSupportAvailable")) {
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::IsNSSSupportAvailable message");
- goto fail;
- }
-
- return avahi_dbus_respond_boolean(c, m, nss_support);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetVersionString")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetVersionString message");
- goto fail;
- }
-
- return avahi_dbus_respond_string(c, m, PACKAGE_STRING);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAPIVersion")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetAPIVersion message");
- goto fail;
- }
-
- return avahi_dbus_respond_uint32(c, m, AVAHI_DBUS_API_VERSION);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetState")) {
- AvahiServerState state;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetState message");
- goto fail;
- }
-
- state = avahi_server_get_state(avahi_server);
- return avahi_dbus_respond_int32(c, m, (int32_t) state);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetLocalServiceCookie")) {
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetLocalServiceCookie message");
- goto fail;
- }
-
- return avahi_dbus_respond_uint32(c, m, avahi_server_get_local_service_cookie(avahi_server));
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetNetworkInterfaceNameByIndex")) {
- int32_t idx;
- char name[IF_NAMESIZE];
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_INT32, &idx, DBUS_TYPE_INVALID))) {
- avahi_log_warn("Error parsing Server::GetNetworkInterfaceNameByIndex message");
- goto fail;
- }
-
-#ifdef VALGRIND_WORKAROUND
- return respond_string(c, m, "blah");
-#else
- if ((!if_indextoname(idx, name))) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
- return avahi_dbus_respond_string(c, m, name);
-#endif
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetNetworkInterfaceIndexByName")) {
- char *n;
- int32_t idx;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID)) || !n) {
- avahi_log_warn("Error parsing Server::GetNetworkInterfaceIndexByName message");
- goto fail;
- }
-
-#ifdef VALGRIND_WORKAROUND
- return respond_int32(c, m, 1);
-#else
- if (!(idx = if_nametoindex(n))) {
- char txt[256];
- snprintf(txt, sizeof(txt), "OS Error: %s", strerror(errno));
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_OS, txt);
- }
-
- return avahi_dbus_respond_int32(c, m, idx);
-#endif
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAlternativeHostName")) {
- char *n, * t;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID)) || !n) {
- avahi_log_warn("Error parsing Server::GetAlternativeHostName message");
- goto fail;
- }
-
- t = avahi_alternative_host_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAlternativeServiceName")) {
- char *n, *t;
-
- if (!(dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &n, DBUS_TYPE_INVALID)) || !n) {
- avahi_log_warn("Error parsing Server::GetAlternativeServiceName message");
- goto fail;
- }
-
- t = avahi_alternative_service_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "EntryGroupNew")) {
- Client *client;
- EntryGroupInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_entry_group_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::EntryGroupNew message");
- goto fail;
- }
-
- if (disable_user_service_publishing)
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_PERMITTED, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(EntryGroupInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- i->n_entries = 0;
- AVAHI_LLIST_PREPEND(EntryGroupInfo, entry_groups, client->entry_groups, i);
- client->n_objects++;
-
- if (!(i->entry_group = avahi_s_entry_group_new(avahi_server, avahi_dbus_entry_group_callback, i))) {
- avahi_dbus_entry_group_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- i->path = avahi_strdup_printf("/Client%u/EntryGroup%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveHostName")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name;
- SyncHostNameResolverInfo *i;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !name) {
- avahi_log_warn("Error parsing Server::ResolveHostName message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(SyncHostNameResolverInfo, 1);
- i->client = client;
- i->message = dbus_message_ref(m);
- AVAHI_LLIST_PREPEND(SyncHostNameResolverInfo, sync_host_name_resolvers, client->sync_host_name_resolvers, i);
- client->n_objects++;
-
- if (!(i->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, (AvahiProtocol) aprotocol, (AvahiLookupFlags) flags, avahi_dbus_sync_host_name_resolver_callback, i))) {
- avahi_dbus_sync_host_name_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveAddress")) {
- Client *client;
- int32_t interface, protocol;
- uint32_t flags;
- char *address;
- SyncAddressResolverInfo *i;
- AvahiAddress a;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !address) {
- avahi_log_warn("Error parsing Server::ResolveAddress message");
- goto fail;
- }
-
- if (!avahi_address_parse(address, AVAHI_PROTO_UNSPEC, &a))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_ADDRESS, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(SyncAddressResolverInfo, 1);
- i->client = client;
- i->message = dbus_message_ref(m);
- AVAHI_LLIST_PREPEND(SyncAddressResolverInfo, sync_address_resolvers, client->sync_address_resolvers, i);
- client->n_objects++;
-
- if (!(i->address_resolver = avahi_s_address_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, &a, (AvahiLookupFlags) flags, avahi_dbus_sync_address_resolver_callback, i))) {
- avahi_dbus_sync_address_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "DomainBrowserNew")) {
- Client *client;
- DomainBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_domain_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol, type;
- uint32_t flags;
- char *domain;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &type,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || type < 0 || type >= AVAHI_DOMAIN_BROWSER_MAX) {
- avahi_log_warn("Error parsing Server::DomainBrowserNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- i = avahi_new(DomainBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- AVAHI_LLIST_PREPEND(DomainBrowserInfo, domain_browsers, client->domain_browsers, i);
- client->n_objects++;
-
- if (!(i->domain_browser = avahi_s_domain_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, (AvahiDomainBrowserType) type, (AvahiLookupFlags) flags, avahi_dbus_domain_browser_callback, i))) {
- avahi_dbus_domain_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- i->path = avahi_strdup_printf("/Client%u/DomainBrowser%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ServiceTypeBrowserNew")) {
- Client *client;
- ServiceTypeBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_service_type_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol;
- uint32_t flags;
- char *domain;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing Server::ServiceTypeBrowserNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- i = avahi_new(ServiceTypeBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- AVAHI_LLIST_PREPEND(ServiceTypeBrowserInfo, service_type_browsers, client->service_type_browsers, i);
- client->n_objects++;
-
- if (!(i->service_type_browser = avahi_s_service_type_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, domain, (AvahiLookupFlags) flags, avahi_dbus_service_type_browser_callback, i))) {
- avahi_dbus_service_type_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- i->path = avahi_strdup_printf("/Client%u/ServiceTypeBrowser%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ServiceBrowserNew")) {
- Client *client;
- ServiceBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_service_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol;
- uint32_t flags;
- char *domain, *type;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !type) {
- avahi_log_warn("Error parsing Server::ServiceBrowserNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- i = avahi_new(ServiceBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- AVAHI_LLIST_PREPEND(ServiceBrowserInfo, service_browsers, client->service_browsers, i);
- client->n_objects++;
-
- if (!(i->service_browser = avahi_s_service_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, type, domain, (AvahiLookupFlags) flags, avahi_dbus_service_browser_callback, i))) {
- avahi_dbus_service_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- i->path = avahi_strdup_printf("/Client%u/ServiceBrowser%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ResolveService")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *type, *domain;
- SyncServiceResolverInfo *i;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !type) {
- avahi_log_warn("Error parsing Server::ResolveService message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- if (!*name)
- name = NULL;
-
- i = avahi_new(SyncServiceResolverInfo, 1);
- i->client = client;
- i->message = dbus_message_ref(m);
- AVAHI_LLIST_PREPEND(SyncServiceResolverInfo, sync_service_resolvers, client->sync_service_resolvers, i);
- client->n_objects++;
-
- if (!(i->service_resolver = avahi_s_service_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, type, domain, (AvahiProtocol) aprotocol, (AvahiLookupFlags) flags, avahi_dbus_sync_service_resolver_callback, i))) {
- avahi_dbus_sync_service_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "ServiceResolverNew")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name, *type, *domain;
- AsyncServiceResolverInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_async_service_resolver_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !type) {
- avahi_log_warn("Error parsing Server::ServiceResolverNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn(__FILE__": Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn(__FILE__": Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- if (!*domain)
- domain = NULL;
-
- if (!*name)
- name = NULL;
-
- i = avahi_new(AsyncServiceResolverInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- AVAHI_LLIST_PREPEND(AsyncServiceResolverInfo, async_service_resolvers, client->async_service_resolvers, i);
- client->n_objects++;
-
- if (!(i->service_resolver = avahi_s_service_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, type, domain, (AvahiProtocol) aprotocol, (AvahiLookupFlags) flags, avahi_dbus_async_service_resolver_callback, i))) {
- avahi_dbus_async_service_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
-/* avahi_log_debug(__FILE__": [%s], new service resolver for <%s.%s.%s>", i->path, name, type, domain); */
-
- i->path = avahi_strdup_printf("/Client%u/ServiceResolver%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "HostNameResolverNew")) {
- Client *client;
- int32_t interface, protocol, aprotocol;
- uint32_t flags;
- char *name;
- AsyncHostNameResolverInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_async_host_name_resolver_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_INT32, &aprotocol,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !name) {
- avahi_log_warn("Error parsing Server::HostNameResolverNew message");
- goto fail;
- }
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn(__FILE__": Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn(__FILE__": Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(AsyncHostNameResolverInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- AVAHI_LLIST_PREPEND(AsyncHostNameResolverInfo, async_host_name_resolvers, client->async_host_name_resolvers, i);
- client->n_objects++;
-
- if (!(i->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, name, aprotocol, (AvahiLookupFlags) flags, avahi_dbus_async_host_name_resolver_callback, i))) {
- avahi_dbus_async_host_name_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- i->path = avahi_strdup_printf("/Client%u/HostNameResolver%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "AddressResolverNew")) {
- Client *client;
- int32_t interface, protocol;
- uint32_t flags;
- char *address;
- AsyncAddressResolverInfo *i;
- AvahiAddress a;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_async_address_resolver_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &address,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !address) {
- avahi_log_warn("Error parsing Server::AddressResolverNew message");
- goto fail;
- }
-
- if (!avahi_address_parse(address, AVAHI_PROTO_UNSPEC, &a))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_ADDRESS, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn(__FILE__": Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn(__FILE__": Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(AsyncAddressResolverInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- AVAHI_LLIST_PREPEND(AsyncAddressResolverInfo, async_address_resolvers, client->async_address_resolvers, i);
- client->n_objects++;
-
- if (!(i->address_resolver = avahi_s_address_resolver_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, &a, (AvahiLookupFlags) flags, avahi_dbus_async_address_resolver_callback, i))) {
- avahi_dbus_async_address_resolver_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- i->path = avahi_strdup_printf("/Client%u/AddressResolver%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
-
- } else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "RecordBrowserNew")) {
- Client *client;
- RecordBrowserInfo *i;
- static const DBusObjectPathVTable vtable = {
- NULL,
- avahi_dbus_msg_record_browser_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
- int32_t interface, protocol;
- uint32_t flags;
- char *name;
- uint16_t type, clazz;
- AvahiKey *key;
-
- if (!dbus_message_get_args(
- m, &error,
- DBUS_TYPE_INT32, &interface,
- DBUS_TYPE_INT32, &protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_UINT16, &clazz,
- DBUS_TYPE_UINT16, &type,
- DBUS_TYPE_UINT32, &flags,
- DBUS_TYPE_INVALID) || !name) {
- avahi_log_warn("Error parsing Server::RecordBrowserNew message");
- goto fail;
- }
-
- if (!avahi_is_valid_domain_name(name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_DOMAIN_NAME, NULL);
-
- if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
- avahi_log_warn("Too many clients, client request failed.");
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
- }
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
- avahi_log_warn("Too many objects for client '%s', client request failed.", client->name);
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_OBJECTS, NULL);
- }
-
- i = avahi_new(RecordBrowserInfo, 1);
- i->id = ++client->current_id;
- i->client = client;
- i->path = NULL;
- AVAHI_LLIST_PREPEND(RecordBrowserInfo, record_browsers, client->record_browsers, i);
- client->n_objects++;
-
- key = avahi_key_new(name, clazz, type);
- assert(key);
-
- if (!(i->record_browser = avahi_s_record_browser_new(avahi_server, (AvahiIfIndex) interface, (AvahiProtocol) protocol, key, (AvahiLookupFlags) flags, avahi_dbus_record_browser_callback, i))) {
- avahi_key_unref(key);
- avahi_dbus_record_browser_free(i);
- return avahi_dbus_respond_error(c, m, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_key_unref(key);
-
- i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);
- dbus_connection_register_object_path(c, i->path, &vtable, i);
- return avahi_dbus_respond_path(c, m, i->path);
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void dbus_protocol_server_state_changed(AvahiServerState state) {
- DBusMessage *m;
- int32_t t;
- const char *e;
-
- if (!server || !server->bus)
- return;
-
- m = dbus_message_new_signal(AVAHI_DBUS_PATH_SERVER, AVAHI_DBUS_INTERFACE_SERVER, "StateChanged");
- t = (int32_t) state;
-
- if (state == AVAHI_SERVER_COLLISION)
- e = AVAHI_DBUS_ERR_COLLISION;
- else if (state == AVAHI_SERVER_FAILURE)
- e = avahi_error_number_to_dbus(avahi_server_errno(avahi_server));
- else
- e = AVAHI_DBUS_ERR_OK;
-
- dbus_message_append_args(m, DBUS_TYPE_INT32, &t, DBUS_TYPE_STRING, &e, DBUS_TYPE_INVALID);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
-static int dbus_connect(void) {
- DBusError error;
-
- static const DBusObjectPathVTable server_vtable = {
- NULL,
- msg_server_impl,
- NULL,
- NULL,
- NULL,
- NULL
- };
-
- assert(server);
- assert(!server->bus);
-
- dbus_error_init(&error);
-
- if (!(server->bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) {
- assert(dbus_error_is_set(&error));
- avahi_log_error("dbus_bus_get(): %s", error.message);
- goto fail;
- }
- if (avahi_dbus_connection_glue(server->bus, server->poll_api) < 0) {
- avahi_log_error("avahi_dbus_connection_glue() failed");
- goto fail;
- }
-
- dbus_connection_set_exit_on_disconnect(server->bus, FALSE);
-
- if (dbus_bus_request_name(
- server->bus,
- AVAHI_DBUS_NAME,
-#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR < 60)
- DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT,
-#else
- DBUS_NAME_FLAG_DO_NOT_QUEUE,
-#endif
- &error) != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- if (dbus_error_is_set(&error)) {
- avahi_log_error("dbus_bus_request_name(): %s", error.message);
- goto fail;
- }
-
- avahi_log_error("Failed to acquire D-Bus name '"AVAHI_DBUS_NAME"'");
- goto fail;
- }
-
- if (!(dbus_connection_add_filter(server->bus, msg_signal_filter_impl, (void*) server->poll_api, NULL))) {
- avahi_log_error("dbus_connection_add_filter() failed");
- goto fail;
- }
-
- dbus_bus_add_match(server->bus, "type='signal',""interface='" DBUS_INTERFACE_DBUS "'", &error);
-
- if (dbus_error_is_set(&error)) {
- avahi_log_error("dbus_bus_add_match(): %s", error.message);
- goto fail;
- }
-
- if (!(dbus_connection_register_object_path(server->bus, AVAHI_DBUS_PATH_SERVER, &server_vtable, NULL))) {
- avahi_log_error("dbus_connection_register_object_path() failed");
- goto fail;
- }
-
- return 0;
-fail:
-
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- if (server->bus) {
- dbus_connection_unref(server->bus);
- server->bus = NULL;
- }
-
- return -1;
-}
-
-static void dbus_disconnect(void) {
- assert(server);
-
- while (server->clients)
- client_free(server->clients);
-
- assert(server->n_clients == 0);
-
- if (server->bus) {
- dbus_connection_unref(server->bus);
- server->bus = NULL;
- }
-}
-
-int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_publishing, int force) {
-
- disable_user_service_publishing = _disable_user_service_publishing;
-
- server = avahi_new(Server, 1);
- AVAHI_LLIST_HEAD_INIT(Clients, server->clients);
- server->current_id = 0;
- server->n_clients = 0;
- server->bus = NULL;
- server->poll_api = poll_api;
- server->reconnect_timeout = NULL;
- server->reconnect = force;
-
- if (dbus_connect() < 0) {
- struct timeval tv;
-
- if (!force)
- goto fail;
-
- avahi_log_warn("WARNING: Failed to contact D-Bus daemon, retrying in %ims.", RECONNECT_MSEC);
-
- avahi_elapse_time(&tv, RECONNECT_MSEC, 0);
- server->reconnect_timeout = server->poll_api->timeout_new(server->poll_api, &tv, reconnect_callback, NULL);
- }
-
- return 0;
-
-fail:
- if (server->bus) {
- dbus_connection_unref(server->bus);
- }
-
- avahi_free(server);
- server = NULL;
- return -1;
-}
-
-void dbus_protocol_shutdown(void) {
-
- if (server) {
- dbus_disconnect();
-
- if (server->reconnect_timeout)
- server->poll_api->timeout_free(server->reconnect_timeout);
-
- avahi_free(server);
- server = NULL;
- }
-}
diff --git a/trunk/avahi-daemon/dbus-protocol.h b/trunk/avahi-daemon/dbus-protocol.h
deleted file mode 100644
index d4404f2..0000000
--- a/trunk/avahi-daemon/dbus-protocol.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef foodbusprotocolhfoo
-#define foodbusprotocolhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-int dbus_protocol_setup(const AvahiPoll *poll_api, int disable_user_service_publishing, int force);
-void dbus_protocol_shutdown(void);
-void dbus_protocol_server_state_changed(AvahiServerState state);
-
-#endif
diff --git a/trunk/avahi-daemon/dbus-record-browser.c b/trunk/avahi-daemon/dbus-record-browser.c
deleted file mode 100644
index ea23fe4..0000000
--- a/trunk/avahi-daemon/dbus-record-browser.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_record_browser_free(RecordBrowserInfo *i) {
- assert(i);
-
- if (i->record_browser)
- avahi_s_record_browser_free(i->record_browser);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
- AVAHI_LLIST_REMOVE(RecordBrowserInfo, record_browsers, i->client->record_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- RecordBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "RecordBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing RecordBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_record_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_record_browser_callback(
- AvahiSRecordBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AvahiRecord *record,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- RecordBrowserInfo *i = userdata;
- DBusMessage *m = NULL;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_RECORD_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- uint8_t rdata[0xFFFF];
- size_t size;
- assert(record);
-
- if (!(dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &record->key->name,
- DBUS_TYPE_UINT16, &record->key->clazz,
- DBUS_TYPE_UINT16, &record->key->type,
- DBUS_TYPE_INVALID)))
- goto fail;
-
- if ((size = avahi_rdata_serialize(record, rdata, sizeof(rdata))) == (size_t) -1 ||
- avahi_dbus_append_rdata(m, rdata, size) < 0) {
- avahi_log_debug(__FILE__": Failed to append rdata");
- dbus_message_unref(m);
- return;
- }
-
- dbus_message_append_args(
- m,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-
- return;
-
-fail:
-
- if (m)
- dbus_message_unref(m);
-}
diff --git a/trunk/avahi-daemon/dbus-service-browser.c b/trunk/avahi-daemon/dbus-service-browser.c
deleted file mode 100644
index 1515ddf..0000000
--- a/trunk/avahi-daemon/dbus-service-browser.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_service_browser_free(ServiceBrowserInfo *i) {
- assert(i);
-
- if (i->service_browser)
- avahi_s_service_browser_free(i->service_browser);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
-
- AVAHI_LLIST_REMOVE(ServiceBrowserInfo, service_browsers, i->client->service_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- ServiceBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing ServiceBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_service_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
- ServiceBrowserInfo *i = userdata;
- DBusMessage *m;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW) {
- /* Patch in AVAHI_LOOKUP_RESULT_OUR_OWN */
-
- if (avahi_dbus_is_our_own_service(i->client, interface, protocol, name, type, domain) > 0)
- flags |= AVAHI_LOOKUP_RESULT_OUR_OWN;
- }
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- assert(name);
- assert(type);
- assert(domain);
-
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
diff --git a/trunk/avahi-daemon/dbus-service-type-browser.c b/trunk/avahi-daemon/dbus-service-type-browser.c
deleted file mode 100644
index 9207a74..0000000
--- a/trunk/avahi-daemon/dbus-service-type-browser.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-
-void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i) {
- assert(i);
-
- if (i->service_type_browser)
- avahi_s_service_type_browser_free(i->service_type_browser);
-
- if (i->path) {
- dbus_connection_unregister_object_path(server->bus, i->path);
- avahi_free(i->path);
- }
-
- AVAHI_LLIST_REMOVE(ServiceTypeBrowserInfo, service_type_browsers, i->client->service_type_browsers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DBusMessage *m, void *userdata) {
- DBusError error;
- ServiceTypeBrowserInfo *i = userdata;
-
- assert(c);
- assert(m);
- assert(i);
-
- dbus_error_init(&error);
-
- avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
- dbus_message_get_interface(m),
- dbus_message_get_path(m),
- dbus_message_get_member(m));
-
- /* Introspection */
- if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceTypeBrowser.introspect");
-
- /* Access control */
- if (strcmp(dbus_message_get_sender(m), i->client->name))
- return avahi_dbus_respond_error(c, m, AVAHI_ERR_ACCESS_DENIED, NULL);
-
- if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Free")) {
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_warn("Error parsing ServiceTypeBrowser::Free message");
- goto fail;
- }
-
- avahi_dbus_service_type_browser_free(i);
- return avahi_dbus_respond_ok(c, m);
-
- }
-
- avahi_log_warn("Missed message %s::%s()", dbus_message_get_interface(m), dbus_message_get_member(m));
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata) {
- ServiceTypeBrowserInfo *i = userdata;
- DBusMessage *m;
- int32_t i_interface, i_protocol;
- uint32_t u_flags;
-
- assert(b);
- assert(i);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- u_flags = (uint32_t) flags;
-
- m = dbus_message_new_signal(i->path, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, avahi_dbus_map_browse_signal_name(event));
-
- if (event == AVAHI_BROWSER_NEW || event == AVAHI_BROWSER_REMOVE) {
- assert(type);
- assert(domain);
- dbus_message_append_args(
- m,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
- } else if (event == AVAHI_BROWSER_FAILURE)
- avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
- dbus_connection_send(server->bus, m, NULL);
- dbus_message_unref(m);
-}
-
-
diff --git a/trunk/avahi-daemon/dbus-sync-address-resolver.c b/trunk/avahi-daemon/dbus-sync-address-resolver.c
deleted file mode 100644
index 0a5fa59..0000000
--- a/trunk/avahi-daemon/dbus-sync-address-resolver.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_sync_address_resolver_free(SyncAddressResolverInfo *i) {
- assert(i);
-
- if (i->address_resolver)
- avahi_s_address_resolver_free(i->address_resolver);
- dbus_message_unref(i->message);
- AVAHI_LLIST_REMOVE(SyncAddressResolverInfo, sync_address_resolvers, i->client->sync_address_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata) {
- SyncAddressResolverInfo *i = userdata;
-
- assert(r);
- assert(address);
- assert(i);
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- DBusMessage *reply;
-
- assert(host_name);
- avahi_address_snprint(t, sizeof(t), address);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) address->proto;
- u_flags = (uint32_t) flags;
-
- reply = dbus_message_new_method_return(i->message);
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_respond_error(server->bus, i->message, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_dbus_sync_address_resolver_free(i);
-}
-
diff --git a/trunk/avahi-daemon/dbus-sync-host-name-resolver.c b/trunk/avahi-daemon/dbus-sync-host-name-resolver.c
deleted file mode 100644
index 9750dd4..0000000
--- a/trunk/avahi-daemon/dbus-sync-host-name-resolver.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_sync_host_name_resolver_free(SyncHostNameResolverInfo *i) {
- assert(i);
-
- if (i->host_name_resolver)
- avahi_s_host_name_resolver_free(i->host_name_resolver);
- dbus_message_unref(i->message);
- AVAHI_LLIST_REMOVE(SyncHostNameResolverInfo, sync_host_name_resolvers, i->client->sync_host_name_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata) {
- SyncHostNameResolverInfo *i = userdata;
-
- assert(r);
- assert(host_name);
- assert(i);
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- DBusMessage *reply;
-
- assert(a);
- avahi_address_snprint(t, sizeof(t), a);
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- i_aprotocol = (int32_t) a->proto;
- u_flags = (uint32_t) flags;
-
- reply = dbus_message_new_method_return(i->message);
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
- avahi_dbus_respond_error(server->bus, i->message, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_dbus_sync_host_name_resolver_free(i);
-}
-
diff --git a/trunk/avahi-daemon/dbus-sync-service-resolver.c b/trunk/avahi-daemon/dbus-sync-service-resolver.c
deleted file mode 100644
index 21ae481..0000000
--- a/trunk/avahi-daemon/dbus-sync-service-resolver.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-
-#include "dbus-util.h"
-#include "dbus-internal.h"
-#include "main.h"
-
-void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i) {
- assert(i);
-
- if (i->service_resolver)
- avahi_s_service_resolver_free(i->service_resolver);
- dbus_message_unref(i->message);
- AVAHI_LLIST_REMOVE(SyncServiceResolverInfo, sync_service_resolvers, i->client->sync_service_resolvers, i);
-
- i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
- avahi_free(i);
-}
-
-void avahi_dbus_sync_service_resolver_callback(
- AvahiSServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- void* userdata) {
-
- SyncServiceResolverInfo *i = userdata;
-
- assert(r);
- assert(i);
-
- if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX], *pt = t;
- int32_t i_interface, i_protocol, i_aprotocol;
- uint32_t u_flags;
- DBusMessage *reply;
-
- assert(host_name);
-
- if (!name)
- name = "";
-
- if (a)
- avahi_address_snprint(t, sizeof(t), a);
- else
- t[0] = 0;
-
- /* Patch in AVAHI_LOOKUP_RESULT_OUR_OWN */
-
- if (avahi_dbus_is_our_own_service(i->client, interface, protocol, name, type, domain) > 0)
- flags |= AVAHI_LOOKUP_RESULT_OUR_OWN;
-
- i_interface = (int32_t) interface;
- i_protocol = (int32_t) protocol;
- if (a)
- i_aprotocol = (int32_t) a->proto;
- else
- i_aprotocol = AVAHI_PROTO_UNSPEC;
- u_flags = (uint32_t) flags;
-
- reply = dbus_message_new_method_return(i->message);
- dbus_message_append_args(
- reply,
- DBUS_TYPE_INT32, &i_interface,
- DBUS_TYPE_INT32, &i_protocol,
- DBUS_TYPE_STRING, &name,
- DBUS_TYPE_STRING, &type,
- DBUS_TYPE_STRING, &domain,
- DBUS_TYPE_STRING, &host_name,
- DBUS_TYPE_INT32, &i_aprotocol,
- DBUS_TYPE_STRING, &pt,
- DBUS_TYPE_UINT16, &port,
- DBUS_TYPE_INVALID);
-
- avahi_dbus_append_string_list(reply, txt);
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_UINT32, &u_flags,
- DBUS_TYPE_INVALID);
-
- dbus_connection_send(server->bus, reply, NULL);
- dbus_message_unref(reply);
- } else {
- assert(event == AVAHI_RESOLVER_FAILURE);
-
- avahi_dbus_respond_error(server->bus, i->message, avahi_server_errno(avahi_server), NULL);
- }
-
- avahi_dbus_sync_service_resolver_free(i);
-}
diff --git a/trunk/avahi-daemon/dbus-util.c b/trunk/avahi-daemon/dbus-util.c
deleted file mode 100644
index c9ef949..0000000
--- a/trunk/avahi-daemon/dbus-util.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#include <avahi-common/error.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/malloc.h>
-#include <avahi-core/log.h>
-#include <avahi-core/core.h>
-
-#ifdef ENABLE_CHROOT
-#include "chroot.h"
-#endif
-
-#include "main.h"
-#include "dbus-util.h"
-
-DBusHandlerResult avahi_dbus_respond_error(DBusConnection *c, DBusMessage *m, int error, const char *text) {
- DBusMessage *reply;
-
- assert(-error > -AVAHI_OK);
- assert(-error < -AVAHI_ERR_MAX);
-
- if (!text)
- text = avahi_strerror(error);
-
- reply = dbus_message_new_error(m, avahi_error_number_to_dbus(error), text);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- avahi_log_debug(__FILE__": Responding error '%s' (%i)", text, error);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_string(DBusConnection *c, DBusMessage *m, const char *text) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_STRING, &text, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_int32(DBusConnection *c, DBusMessage *m, int32_t i) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_INT32, &i, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_uint32(DBusConnection *c, DBusMessage *m, uint32_t u) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_UINT32, &u, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_boolean(DBusConnection *c, DBusMessage *m, int b) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &b, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_ok(DBusConnection *c, DBusMessage *m) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusHandlerResult avahi_dbus_respond_path(DBusConnection *c, DBusMessage *m, const char *path) {
- DBusMessage *reply;
-
- reply = dbus_message_new_method_return(m);
- dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID);
- dbus_connection_send(c, reply, NULL);
- dbus_message_unref(reply);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-}
-
-void avahi_dbus_append_server_error(DBusMessage *reply) {
- const char *t;
-
- t = avahi_error_number_to_dbus(avahi_server_errno(avahi_server));
-
- dbus_message_append_args(
- reply,
- DBUS_TYPE_STRING, &t,
- DBUS_TYPE_INVALID);
-}
-
-const char *avahi_dbus_map_browse_signal_name(AvahiBrowserEvent e) {
- switch (e) {
- case AVAHI_BROWSER_NEW : return "ItemNew";
- case AVAHI_BROWSER_REMOVE : return "ItemRemove";
- case AVAHI_BROWSER_FAILURE : return "Failure";
- case AVAHI_BROWSER_CACHE_EXHAUSTED : return "CacheExhausted";
- case AVAHI_BROWSER_ALL_FOR_NOW : return "AllForNow";
- }
-
- abort();
-}
-
-const char *avahi_dbus_map_resolve_signal_name(AvahiResolverEvent e) {
- switch (e) {
- case AVAHI_RESOLVER_FOUND : return "Found";
- case AVAHI_RESOLVER_FAILURE : return "Failure";
- }
-
- abort();
-}
-
-static char *file_get_contents(const char *fname) {
- int fd = -1;
- struct stat st;
- ssize_t size;
- char *buf = NULL;
-
- assert(fname);
-
-#ifdef ENABLE_CHROOT
- fd = avahi_chroot_helper_get_fd(fname);
-#else
- fd = open(fname, O_RDONLY);
-#endif
-
- if (fd < 0) {
- avahi_log_error("Failed to open %s: %s", fname, strerror(errno));
- goto fail;
- }
-
- if (fstat(fd, &st) < 0) {
- avahi_log_error("stat(%s) failed: %s", fname, strerror(errno));
- goto fail;
- }
-
- if (!(S_ISREG(st.st_mode))) {
- avahi_log_error("Invalid file %s", fname);
- goto fail;
- }
-
- if (st.st_size > 1024*1024) { /** 1MB */
- avahi_log_error("File too large %s", fname);
- goto fail;
- }
-
- buf = avahi_new(char, st.st_size+1);
-
- if ((size = read(fd, buf, st.st_size)) < 0) {
- avahi_log_error("read() failed: %s\n", strerror(errno));
- goto fail;
- }
-
- buf[size] = 0;
-
- close(fd);
-
- return buf;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- if (buf)
- avahi_free(buf);
-
- return NULL;
-
-}
-
-DBusHandlerResult avahi_dbus_handle_introspect(DBusConnection *c, DBusMessage *m, const char *fname) {
- char *contents, *path;
- DBusError error;
-
- assert(c);
- assert(m);
- assert(fname);
-
- dbus_error_init(&error);
-
- if (!dbus_message_get_args(m, &error, DBUS_TYPE_INVALID)) {
- avahi_log_error("Error parsing Introspect message: %s", error.message);
- goto fail;
- }
-
- path = avahi_strdup_printf("%s/%s", AVAHI_DBUS_INTROSPECTION_DIR, fname);
- contents = file_get_contents(path);
- avahi_free(path);
-
- if (!contents) {
- avahi_log_error("Failed to load introspection data.");
- goto fail;
- }
-
- avahi_dbus_respond_string(c, m, contents);
- avahi_free(contents);
-
- return DBUS_HANDLER_RESULT_HANDLED;
-
-fail:
- if (dbus_error_is_set(&error))
- dbus_error_free(&error);
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-
-}
-
-void avahi_dbus_append_string_list(DBusMessage *reply, AvahiStringList *txt) {
- AvahiStringList *p;
- DBusMessageIter iter, sub;
-
- assert(reply);
-
- dbus_message_iter_init_append(reply, &iter);
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "ay", &sub);
-
- for (p = txt; p; p = p->next) {
- DBusMessageIter sub2;
- const uint8_t *data = p->text;
-
- dbus_message_iter_open_container(&sub, DBUS_TYPE_ARRAY, "y", &sub2);
- dbus_message_iter_append_fixed_array(&sub2, DBUS_TYPE_BYTE, &data, p->size);
- dbus_message_iter_close_container(&sub, &sub2);
-
- }
- dbus_message_iter_close_container(&iter, &sub);
-}
-
-int avahi_dbus_read_rdata(DBusMessage *m, int idx, void **rdata, uint32_t *size) {
- DBusMessageIter iter, sub;
- int n, j;
- uint8_t *k;
-
- assert(m);
-
- dbus_message_iter_init(m, &iter);
-
- for (j = 0; j < idx; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_BYTE)
- goto fail;
-
- dbus_message_iter_recurse(&iter, &sub);
- dbus_message_iter_get_fixed_array(&sub, &k, &n);
-
- *rdata = k;
- *size = n;
-
- return 0;
-
-fail:
- avahi_log_warn("Error parsing data");
-
- *rdata = NULL;
- size = 0;
- return -1;
-}
-
-int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) {
- DBusMessageIter iter, sub;
- int j;
- AvahiStringList *strlst = NULL;
-
- assert(m);
- assert(l);
-
- dbus_message_iter_init(m, &iter);
-
- for (j = 0; j < idx; j++)
- dbus_message_iter_next(&iter);
-
- if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
- dbus_message_iter_get_element_type(&iter) != DBUS_TYPE_ARRAY)
- goto fail;
-
- dbus_message_iter_recurse(&iter, &sub);
-
- for (;;) {
- int at, n;
- const uint8_t *k;
- DBusMessageIter sub2;
-
- if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
- break;
-
- assert(at == DBUS_TYPE_ARRAY);
-
- if (dbus_message_iter_get_element_type(&sub) != DBUS_TYPE_BYTE)
- goto fail;
-
- dbus_message_iter_recurse(&sub, &sub2);
-
- if (dbus_message_iter_get_array_len(&sub2) > 0)
- dbus_message_iter_get_fixed_array(&sub2, &k, &n);
- else {
- k = (const uint8_t*) "";
- n = 0;
- }
-
- strlst = avahi_string_list_add_arbitrary(strlst, k, n);
-
- dbus_message_iter_next(&sub);
- }
-
- *l = strlst;
-
- return 0;
-
-fail:
- avahi_log_warn("Error parsing TXT data");
-
- avahi_string_list_free(strlst);
- *l = NULL;
- return -1;
-}
-
-int avahi_dbus_is_our_own_service(Client *c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- AvahiSEntryGroup *g;
-
- if (avahi_server_get_group_of_service(avahi_server, interface, protocol, name, type, domain, &g) == AVAHI_OK) {
- EntryGroupInfo *egi;
-
- for (egi = c->entry_groups; egi; egi = egi->entry_groups_next)
- if (egi->entry_group == g)
- return 1;
- }
-
- return 0;
-}
-
-int avahi_dbus_append_rdata(DBusMessage *message, const void *rdata, size_t size) {
- DBusMessageIter iter, sub;
-
- assert(message);
-
- dbus_message_iter_init_append(message, &iter);
-
- if (!(dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &sub)) ||
- !(dbus_message_iter_append_fixed_array(&sub, DBUS_TYPE_BYTE, &rdata, size)) ||
- !(dbus_message_iter_close_container(&iter, &sub)))
- return -1;
-
- return 0;
-}
diff --git a/trunk/avahi-daemon/dbus-util.h b/trunk/avahi-daemon/dbus-util.h
deleted file mode 100644
index e994915..0000000
--- a/trunk/avahi-daemon/dbus-util.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef foodbusutilhfoo
-#define foodbusutilhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <inttypes.h>
-
-#include <dbus/dbus.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/defs.h>
-
-#include "dbus-internal.h"
-
-DBusHandlerResult avahi_dbus_respond_error(DBusConnection *c, DBusMessage *m, int error, const char *text);
-DBusHandlerResult avahi_dbus_respond_string(DBusConnection *c, DBusMessage *m, const char *text);
-DBusHandlerResult avahi_dbus_respond_int32(DBusConnection *c, DBusMessage *m, int32_t i);
-DBusHandlerResult avahi_dbus_respond_uint32(DBusConnection *c, DBusMessage *m, uint32_t u);
-DBusHandlerResult avahi_dbus_respond_boolean(DBusConnection *c, DBusMessage *m, int b);
-DBusHandlerResult avahi_dbus_respond_ok(DBusConnection *c, DBusMessage *m);
-DBusHandlerResult avahi_dbus_respond_path(DBusConnection *c, DBusMessage *m, const char *path);
-
-void avahi_dbus_append_server_error(DBusMessage *reply);
-
-const char *avahi_dbus_map_browse_signal_name(AvahiBrowserEvent e);
-
-const char *avahi_dbus_map_resolve_signal_name(AvahiResolverEvent e);
-
-DBusHandlerResult avahi_dbus_handle_introspect(DBusConnection *c, DBusMessage *m, const char *fname);
-
-void avahi_dbus_append_string_list(DBusMessage *reply, AvahiStringList *txt);
-
-int avahi_dbus_read_rdata(DBusMessage *m, int idx, void **rdata, uint32_t *size);
-int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l);
-
-int avahi_dbus_is_our_own_service(Client *c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain);
-
-int avahi_dbus_append_rdata(DBusMessage *message, const void *rdata, size_t size);
-
-#endif
diff --git a/trunk/avahi-daemon/example.service b/trunk/avahi-daemon/example.service
deleted file mode 100644
index 7d6c6b8..0000000
--- a/trunk/avahi-daemon/example.service
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<!-- See avahi.service(5) for more information about this configuration file -->
-
-<service-group>
-
- <name replace-wildcards="yes">Printer on %h</name>
-
- <service>
- <type>_printer._tcp</type>
- <port>515</port>
- </service>
-
- <service>
- <type>_ipp._tcp</type>
- <subtype>_colour._sub._ipp._tcp</subtype>
- <port>631</port>
- </service>
-
- <service protocol="ipv6">
- <type>_uberprinter._tcp</type>
- <domain-name>local</domain-name>
- <host-name>quux.local</host-name>
- <port>4711</port>
- <txt-record>this=is</txt-record>
- <txt-record>a=really</txt-record>
- <txt-record>bad=example</txt-record>
- </service>
-
-</service-group>
diff --git a/trunk/avahi-daemon/hosts b/trunk/avahi-daemon/hosts
deleted file mode 100644
index 495daa7..0000000
--- a/trunk/avahi-daemon/hosts
+++ /dev/null
@@ -1,29 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# This file contains static ip address <-> host name mappings. These
-# can be useful to publish services on behalf of a non-avahi enabled
-# device. Please bear in mind that host names are expected to be
-# fully qualified domain names, i.e. ending in .local!
-
-# See avahi.hosts(5) for more information on this configuration file!
-
-# Examples:
-# 192.168.0.1 router.local
-# 2001::81:1 test.local
diff --git a/trunk/avahi-daemon/ini-file-parser-test.c b/trunk/avahi-daemon/ini-file-parser-test.c
deleted file mode 100644
index 47530b5..0000000
--- a/trunk/avahi-daemon/ini-file-parser-test.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-
-#include <avahi-common/malloc.h>
-
-#include "ini-file-parser.h"
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
- AvahiIniFile *f;
- AvahiIniFileGroup *g;
-
- if (!(f = avahi_ini_file_load("avahi-daemon.conf"))) {
- return 1;
- }
-
- printf("%u groups\n", f->n_groups);
-
- for (g = f->groups; g; g = g->groups_next) {
- AvahiIniFilePair *p;
- printf("<%s> (%u pairs)\n", g->name, g->n_pairs);
-
- for (p = g->pairs; p; p = p->pairs_next) {
- char **split, **i;
-
- printf("\t<%s> = ", p->key);
- split = avahi_split_csv(p->value);
-
- for (i = split; *i; i++)
- printf("<%s> ", *i);
-
- avahi_strfreev(split);
-
- printf("\n");
- }
- }
-
- avahi_ini_file_free(f);
- return 0;
-}
diff --git a/trunk/avahi-daemon/ini-file-parser.c b/trunk/avahi-daemon/ini-file-parser.c
deleted file mode 100644
index 135876e..0000000
--- a/trunk/avahi-daemon/ini-file-parser.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-core/log.h>
-
-#include "ini-file-parser.h"
-
-AvahiIniFile* avahi_ini_file_load(const char *fname) {
- AvahiIniFile *f;
- FILE *fo;
- AvahiIniFileGroup *group = NULL;
- unsigned line;
-
- assert(fname);
-
- if (!(fo = fopen(fname, "r"))) {
- avahi_log_error("Failed to open file '%s': %s", fname, strerror(errno));
- return NULL;
- }
-
- f = avahi_new(AvahiIniFile, 1);
- AVAHI_LLIST_HEAD_INIT(AvahiIniFileGroup, f->groups);
- f->n_groups = 0;
-
- line = 0;
- while (!feof(fo)) {
- char ln[256], *s, *e;
- AvahiIniFilePair *pair;
-
- if (!(fgets(ln, sizeof(ln), fo)))
- break;
-
- line++;
-
- s = ln + strspn(ln, " \t");
- s[strcspn(s, "\r\n")] = 0;
-
- /* Skip comments and empty lines */
- if (*s == '#' || *s == '%' || *s == 0)
- continue;
-
- if (*s == '[') {
- /* new group */
-
- if (!(e = strchr(s, ']'))) {
- avahi_log_error("Unclosed group header in %s:%u: <%s>", fname, line, s);
- goto fail;
- }
-
- *e = 0;
-
- group = avahi_new(AvahiIniFileGroup, 1);
- group->name = avahi_strdup(s+1);
- group->n_pairs = 0;
- AVAHI_LLIST_HEAD_INIT(AvahiIniFilePair, group->pairs);
-
- AVAHI_LLIST_PREPEND(AvahiIniFileGroup, groups, f->groups, group);
- f->n_groups++;
- } else {
-
- /* Normal assignment */
- if (!(e = strchr(s, '='))) {
- avahi_log_error("Missing assignment in %s:%u: <%s>", fname, line, s);
- goto fail;
- }
-
- if (!group) {
- avahi_log_error("Assignment outside group in %s:%u <%s>", fname, line, s);
- goto fail;
- }
-
- /* Split the key and the value */
- *(e++) = 0;
-
- pair = avahi_new(AvahiIniFilePair, 1);
- pair->key = avahi_strdup(s);
- pair->value = avahi_strdup(e);
-
- AVAHI_LLIST_PREPEND(AvahiIniFilePair, pairs, group->pairs, pair);
- group->n_pairs++;
- }
- }
-
- fclose(fo);
-
- return f;
-
-fail:
-
- if (fo)
- fclose(fo);
-
- if (f)
- avahi_ini_file_free(f);
-
- return NULL;
-}
-
-void avahi_ini_file_free(AvahiIniFile *f) {
- AvahiIniFileGroup *g;
- assert(f);
-
- while ((g = f->groups)) {
- AvahiIniFilePair *p;
-
- while ((p = g->pairs)) {
- avahi_free(p->key);
- avahi_free(p->value);
-
- AVAHI_LLIST_REMOVE(AvahiIniFilePair, pairs, g->pairs, p);
- avahi_free(p);
- }
-
- avahi_free(g->name);
-
- AVAHI_LLIST_REMOVE(AvahiIniFileGroup, groups, f->groups, g);
- avahi_free(g);
- }
-
- avahi_free(f);
-}
-
-char** avahi_split_csv(const char *t) {
- unsigned n_comma = 0;
- const char *p;
- char **r, **i;
-
- for (p = t; *p; p++)
- if (*p == ',')
- n_comma++;
-
- i = r = avahi_new(char*, n_comma+2);
-
- for (;;) {
- size_t n, l = strcspn(t, ",");
- const char *c;
-
- /* Ignore leading blanks */
- for (c = t, n = l; isblank(*c); c++, n--);
-
- /* Ignore trailing blanks */
- for (; n > 0 && isblank(c[n-1]); n--);
-
- *(i++) = avahi_strndup(c, n);
-
- t += l;
-
- if (*t == 0)
- break;
-
- assert(*t == ',');
- t++;
- }
-
- *i = NULL;
-
- return r;
-}
-
-void avahi_strfreev(char **p) {
- char **i;
-
- if (!p)
- return;
-
- for (i = p; *i; i++)
- avahi_free(*i);
-
- avahi_free(p);
-}
diff --git a/trunk/avahi-daemon/ini-file-parser.h b/trunk/avahi-daemon/ini-file-parser.h
deleted file mode 100644
index 82c5acf..0000000
--- a/trunk/avahi-daemon/ini-file-parser.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef fooinifileparserhfoo
-#define fooinifileparserhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/llist.h>
-
-typedef struct AvahiIniFile AvahiIniFile;
-typedef struct AvahiIniFilePair AvahiIniFilePair;
-typedef struct AvahiIniFileGroup AvahiIniFileGroup;
-
-struct AvahiIniFilePair {
- AVAHI_LLIST_FIELDS(AvahiIniFilePair, pairs);
- char *key, *value;
-};
-
-struct AvahiIniFileGroup {
- AVAHI_LLIST_FIELDS(AvahiIniFileGroup, groups);
- char *name;
-
- AVAHI_LLIST_HEAD(AvahiIniFilePair, pairs);
- unsigned n_pairs;
-};
-
-struct AvahiIniFile {
- AVAHI_LLIST_HEAD(AvahiIniFileGroup, groups);
- unsigned n_groups;
-};
-
-
-AvahiIniFile* avahi_ini_file_load(const char *fname);
-void avahi_ini_file_free(AvahiIniFile *f);
-
-char** avahi_split_csv(const char *t);
-
-void avahi_strfreev(char **);
-
-#endif
diff --git a/trunk/avahi-daemon/introspect.dtd b/trunk/avahi-daemon/introspect.dtd
deleted file mode 100644
index 15d913a..0000000
--- a/trunk/avahi-daemon/introspect.dtd
+++ /dev/null
@@ -1,37 +0,0 @@
-<!-- DTD for D-BUS Introspection data -->
-<!-- (C) 2005-02-02 David A. Wheeler; released under the D-BUS licenses,
- GNU GPL version 2 (or greater) and AFL 1.1 (or greater) -->
-
-<!-- see D-BUS specification for documentation -->
-
-<!ELEMENT node (node|interface)*>
-<!ATTLIST node name CDATA #IMPLIED>
-
-<!ELEMENT interface (method|signal|property|annotation)*>
-<!ATTLIST interface name CDATA #REQUIRED>
-
-<!ELEMENT method (arg|annotation)*>
-<!ATTLIST method name CDATA #REQUIRED>
-
-<!ELEMENT signal (arg|annotation)*>
-<!ATTLIST signal name CDATA #REQUIRED>
-
-<!ELEMENT arg EMPTY>
-<!ATTLIST arg name CDATA #IMPLIED>
-<!ATTLIST arg type CDATA #REQUIRED>
-<!-- Method arguments SHOULD include "direction",
- while signal and error arguments SHOULD not (since there's no point).
- The DTD format can't express that subtlety. -->
-<!ATTLIST arg direction (in|out) "in">
-
-<!-- AKA "attribute" -->
-<!ELEMENT property (annotation)*>
-<!ATTLIST property name CDATA #REQUIRED>
-<!ATTLIST property type CDATA #REQUIRED>
-<!ATTLIST property access (read|write|readwrite) #REQUIRED>
-
-<!ELEMENT annotation EMPTY> <!-- Generic metadata -->
-<!ATTLIST annotation name CDATA #REQUIRED>
-<!ATTLIST annotation value CDATA #REQUIRED>
-
-
diff --git a/trunk/avahi-daemon/introspect.xsl b/trunk/avahi-daemon/introspect.xsl
deleted file mode 100644
index 32a371c..0000000
--- a/trunk/avahi-daemon/introspect.xsl
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-15"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
--->
-
-<!-- $Id$ -->
-
-<xsl:output method="xml" version="1.0" encoding="iso-8859-15" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
-
-<xsl:template match="/">
- <html>
- <head>
- <title>DBUS Introspection data</title>
- <style type="text/css">
- body { color: black; background-color: white }
- h1 { font-family: sans-serif }
- ul { list-style-type: none; margin-bottom: 10px }
- li { font-family: sans-serif }
- .keyword { font-style: italic }
- .type { font-weight: bold }
- .symbol { font-family: monospace }
- .interface { padding: 10px; margin: 10px }
- </style>
- </head>
- <body>
- <xsl:for-each select="node/interface">
- <div class="interface">
- <h1>
- <span class="keyword">interface</span><xsl:text> </xsl:text>
- <span class="symbol"><xsl:value-of select="@name"/></span>
- </h1>
-
- <ul>
-
- <xsl:apply-templates select="annotation"/>
-
- <xsl:for-each select="method|signal|property">
- <li>
- <span class="keyword"><xsl:value-of select="name()"/></span>
- <xsl:text> </xsl:text>
- <span class="symbol"><xsl:value-of select="@name"/></span>
-
- <ul>
- <xsl:apply-templates select="annotation"/>
- <xsl:for-each select="arg">
- <li>
- <span class="keyword">
- <xsl:choose>
- <xsl:when test="@direction != &quot;&quot;">
- <xsl:value-of select="@direction"/>
- </xsl:when>
- <xsl:when test="name(..) = &quot;signal&quot;">
- out
- </xsl:when>
- <xsl:otherwise>
- in
- </xsl:otherwise>
- </xsl:choose>
- </span>
-
- <xsl:text> </xsl:text>
-
- <span class="type"><xsl:value-of select="@type"/></span><xsl:text> </xsl:text>
- <span class="symbol"><xsl:value-of select="@name"/></span><xsl:text> </xsl:text>
- </li>
- </xsl:for-each>
- </ul>
-
- </li>
- </xsl:for-each>
-
- </ul>
- </div>
- </xsl:for-each>
- </body>
- </html>
-</xsl:template>
-
-
-<xsl:template match="annotation">
- <li>
- <span class="keyword">annotation</span>
- <code><xsl:value-of select="@name"/></code><xsl:text> = </xsl:text>
- <code><xsl:value-of select="@value"/></code>
- </li>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/trunk/avahi-daemon/main.c b/trunk/avahi-daemon/main.c
deleted file mode 100644
index 6d8abb1..0000000
--- a/trunk/avahi-daemon/main.c
+++ /dev/null
@@ -1,1227 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <getopt.h>
-#include <string.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <grp.h>
-#include <pwd.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <time.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/socket.h>
-
-#include <libdaemon/dfork.h>
-#include <libdaemon/dsignal.h>
-#include <libdaemon/dlog.h>
-#include <libdaemon/dpid.h>
-
-#include <avahi-common/malloc.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/domain.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/dns-srv-rr.h>
-#include <avahi-core/log.h>
-
-#ifdef ENABLE_CHROOT
-#include "chroot.h"
-#include "caps.h"
-#endif
-
-#include "setproctitle.h"
-#include "main.h"
-#include "simple-protocol.h"
-#include "static-services.h"
-#include "static-hosts.h"
-#include "ini-file-parser.h"
-
-#ifdef HAVE_DBUS
-#include "dbus-protocol.h"
-#endif
-
-AvahiServer *avahi_server = NULL;
-AvahiSimplePoll *simple_poll_api = NULL;
-static char *argv0 = NULL;
-int nss_support = 0;
-
-typedef enum {
- DAEMON_RUN,
- DAEMON_KILL,
- DAEMON_VERSION,
- DAEMON_HELP,
- DAEMON_RELOAD,
- DAEMON_CHECK
-} DaemonCommand;
-
-typedef struct {
- AvahiServerConfig server_config;
- DaemonCommand command;
- int daemonize;
- int use_syslog;
- char *config_file;
-#ifdef HAVE_DBUS
- int enable_dbus;
- int fail_on_missing_dbus;
-#endif
- int drop_root;
- int set_rlimits;
-#ifdef ENABLE_CHROOT
- int use_chroot;
-#endif
- int modify_proc_title;
-
- int disable_user_service_publishing;
- int publish_resolv_conf;
- char ** publish_dns_servers;
- int debug;
-
- int rlimit_as_set, rlimit_core_set, rlimit_data_set, rlimit_fsize_set, rlimit_nofile_set, rlimit_stack_set;
- rlim_t rlimit_as, rlimit_core, rlimit_data, rlimit_fsize, rlimit_nofile, rlimit_stack;
-
-#ifdef RLIMIT_NPROC
- int rlimit_nproc_set;
- rlim_t rlimit_nproc;
-#endif
-} DaemonConfig;
-
-#define RESOLV_CONF "/etc/resolv.conf"
-
-static AvahiSEntryGroup *dns_servers_entry_group = NULL;
-static AvahiSEntryGroup *resolv_conf_entry_group = NULL;
-
-static char **resolv_conf = NULL;
-
-static DaemonConfig config;
-
-static int has_prefix(const char *s, const char *prefix) {
- size_t l;
-
- l = strlen(prefix);
-
- return strlen(s) >= l && strncmp(s, prefix, l) == 0;
-}
-
-static int load_resolv_conf(void) {
- int ret = -1;
- FILE *f;
- int i = 0;
-
- avahi_strfreev(resolv_conf);
- resolv_conf = NULL;
-
-#ifdef ENABLE_CHROOT
- f = avahi_chroot_helper_get_file(RESOLV_CONF);
-#else
- f = fopen(RESOLV_CONF, "r");
-#endif
-
- if (!f) {
- avahi_log_warn("Failed to open "RESOLV_CONF": %s", strerror(errno));
- goto finish;
- }
-
- resolv_conf = avahi_new0(char*, AVAHI_WIDE_AREA_SERVERS_MAX+1);
-
- while (!feof(f) && i < AVAHI_WIDE_AREA_SERVERS_MAX) {
- char ln[128];
- char *p;
-
- if (!(fgets(ln, sizeof(ln), f)))
- break;
-
- ln[strcspn(ln, "\r\n#")] = 0;
- p = ln + strspn(ln, "\t ");
-
- if (has_prefix(p, "nameserver")) {
- p += 10;
- p += strspn(p, "\t ");
- p[strcspn(p, "\t ")] = 0;
- resolv_conf[i++] = avahi_strdup(p);
- }
- }
-
- ret = 0;
-
-finish:
-
- if (ret != 0) {
- avahi_strfreev(resolv_conf);
- resolv_conf = NULL;
- }
-
- if (f)
- fclose(f);
-
- return ret;
-}
-
-static AvahiSEntryGroup* add_dns_servers(AvahiServer *s, AvahiSEntryGroup* g, char **l) {
- char **p;
-
- assert(s);
- assert(l);
-
- if (!g)
- g = avahi_s_entry_group_new(s, NULL, NULL);
-
- assert(avahi_s_entry_group_is_empty(g));
-
- for (p = l; *p; p++) {
- AvahiAddress a;
-
- if (!avahi_address_parse(*p, AVAHI_PROTO_UNSPEC, &a))
- avahi_log_warn("Failed to parse address '%s', ignoring.", *p);
- else
- if (avahi_server_add_dns_server_address(s, g, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, NULL, AVAHI_DNS_SERVER_RESOLVE, &a, 53) < 0) {
- avahi_s_entry_group_free(g);
- avahi_log_error("Failed to add DNS server address: %s", avahi_strerror(avahi_server_errno(s)));
- return NULL;
- }
- }
-
- avahi_s_entry_group_commit(g);
-
- return g;
-}
-
-static void remove_dns_server_entry_groups(void) {
-
- if (resolv_conf_entry_group)
- avahi_s_entry_group_reset(resolv_conf_entry_group);
-
- if (dns_servers_entry_group)
- avahi_s_entry_group_reset(dns_servers_entry_group);
-}
-
-static void update_wide_area_servers(void) {
- AvahiAddress a[AVAHI_WIDE_AREA_SERVERS_MAX];
- unsigned n = 0;
- char **p;
-
- if (!resolv_conf) {
- avahi_server_set_wide_area_servers(avahi_server, NULL, 0);
- return;
- }
-
- for (p = resolv_conf; *p && n < AVAHI_WIDE_AREA_SERVERS_MAX; p++) {
- if (!avahi_address_parse(*p, AVAHI_PROTO_UNSPEC, &a[n]))
- avahi_log_warn("Failed to parse address '%s', ignoring.", *p);
- else
- n++;
- }
-
- avahi_server_set_wide_area_servers(avahi_server, a, n);
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, void *userdata) {
- DaemonConfig *c = userdata;
-
- assert(s);
- assert(c);
-
- /* This function is possibly called before the global variable
- * avahi_server has been set, therefore we do it explicitly */
-
- avahi_server = s;
-
-#ifdef HAVE_DBUS
- if (c->enable_dbus && state != AVAHI_SERVER_INVALID && state != AVAHI_SERVER_FAILURE)
- dbus_protocol_server_state_changed(state);
-#endif
-
- switch (state) {
- case AVAHI_SERVER_RUNNING:
- avahi_log_info("Server startup complete. Host name is %s. Local service cookie is %u.", avahi_server_get_host_name_fqdn(s), avahi_server_get_local_service_cookie(s));
-
- avahi_set_proc_title(argv0, "%s: running [%s]", argv0, avahi_server_get_host_name_fqdn(s));
-
- static_service_add_to_server();
- static_hosts_add_to_server();
-
- remove_dns_server_entry_groups();
-
- if (c->publish_resolv_conf && resolv_conf && resolv_conf[0])
- resolv_conf_entry_group = add_dns_servers(s, resolv_conf_entry_group, resolv_conf);
-
- if (c->publish_dns_servers && c->publish_dns_servers[0])
- dns_servers_entry_group = add_dns_servers(s, dns_servers_entry_group, c->publish_dns_servers);
-
- simple_protocol_restart_queries();
- break;
-
- case AVAHI_SERVER_COLLISION: {
- char *n;
-
- avahi_set_proc_title(argv0, "%s: collision", argv0);
-
- static_service_remove_from_server();
- static_hosts_remove_from_server();
- remove_dns_server_entry_groups();
-
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
- avahi_log_warn("Host name conflict, retrying with <%s>", n);
- avahi_server_set_host_name(s, n);
- avahi_free(n);
-
- break;
- }
-
- case AVAHI_SERVER_FAILURE:
-
- avahi_log_error("Server error: %s", avahi_strerror(avahi_server_errno(s)));
- avahi_simple_poll_quit(simple_poll_api);
- break;
-
- case AVAHI_SERVER_REGISTERING:
-
- avahi_set_proc_title(argv0, "%s: registering [%s]", argv0, avahi_server_get_host_name_fqdn(s));
-
- static_service_remove_from_server();
- static_hosts_remove_from_server();
- remove_dns_server_entry_groups();
-
- break;
-
- case AVAHI_SERVER_INVALID:
- break;
-
- }
-}
-
-static void help(FILE *f) {
- fprintf(f,
- "%s [options]\n"
- " -h --help Show this help\n"
- " -D --daemonize Daemonize after startup (implies -s)\n"
- " -s --syslog Write log messages to syslog(3) instead of STDERR\n"
- " -k --kill Kill a running daemon\n"
- " -r --reload Request a running daemon to reload static services\n"
- " -c --check Return 0 if a daemon is already running\n"
- " -V --version Show version\n"
- " -f --file=FILE Load the specified configuration file instead of\n"
- " "AVAHI_CONFIG_FILE"\n"
- " --no-rlimits Don't enforce resource limits\n"
- " --no-drop-root Don't drop privileges\n"
-#ifdef ENABLE_CHROOT
- " --no-chroot Don't chroot()\n"
-#endif
- " --no-proc-title Don't modify process title\n"
- " --debug Increase verbosity\n",
- argv0);
-}
-
-
-static int parse_command_line(DaemonConfig *c, int argc, char *argv[]) {
- int o;
-
- enum {
- OPTION_NO_RLIMITS = 256,
- OPTION_NO_DROP_ROOT,
-#ifdef ENABLE_CHROOT
- OPTION_NO_CHROOT,
-#endif
- OPTION_NO_PROC_TITLE,
- OPTION_DEBUG
- };
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "daemonize", no_argument, NULL, 'D' },
- { "kill", no_argument, NULL, 'k' },
- { "version", no_argument, NULL, 'V' },
- { "file", required_argument, NULL, 'f' },
- { "reload", no_argument, NULL, 'r' },
- { "check", no_argument, NULL, 'c' },
- { "syslog", no_argument, NULL, 's' },
- { "no-rlimits", no_argument, NULL, OPTION_NO_RLIMITS },
- { "no-drop-root", no_argument, NULL, OPTION_NO_DROP_ROOT },
-#ifdef ENABLE_CHROOT
- { "no-chroot", no_argument, NULL, OPTION_NO_CHROOT },
-#endif
- { "no-proc-title", no_argument, NULL, OPTION_NO_PROC_TITLE },
- { "debug", no_argument, NULL, OPTION_DEBUG },
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hDkVf:rcs", long_options, NULL)) >= 0) {
-
- switch(o) {
- case 's':
- c->use_syslog = 1;
- break;
- case 'h':
- c->command = DAEMON_HELP;
- break;
- case 'D':
- c->daemonize = 1;
- break;
- case 'k':
- c->command = DAEMON_KILL;
- break;
- case 'V':
- c->command = DAEMON_VERSION;
- break;
- case 'f':
- avahi_free(c->config_file);
- c->config_file = avahi_strdup(optarg);
- break;
- case 'r':
- c->command = DAEMON_RELOAD;
- break;
- case 'c':
- c->command = DAEMON_CHECK;
- break;
- case OPTION_NO_RLIMITS:
- c->set_rlimits = 0;
- break;
- case OPTION_NO_DROP_ROOT:
- c->drop_root = 0;
- break;
-#ifdef ENABLE_CHROOT
- case OPTION_NO_CHROOT:
- c->use_chroot = 0;
- break;
-#endif
- case OPTION_NO_PROC_TITLE:
- c->modify_proc_title = 0;
- break;
- case OPTION_DEBUG:
- c->debug = 1;
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr, "Too many arguments\n");
- return -1;
- }
-
- return 0;
-}
-
-static int is_yes(const char *s) {
- assert(s);
-
- return *s == 'y' || *s == 'Y';
-}
-
-static int load_config_file(DaemonConfig *c) {
- int r = -1;
- AvahiIniFile *f;
- AvahiIniFileGroup *g;
-
- assert(c);
-
- if (!(f = avahi_ini_file_load(c->config_file ? c->config_file : AVAHI_CONFIG_FILE)))
- goto finish;
-
- for (g = f->groups; g; g = g->groups_next) {
-
- if (strcasecmp(g->name, "server") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "host-name") == 0) {
- avahi_free(c->server_config.host_name);
- c->server_config.host_name = avahi_strdup(p->value);
- } else if (strcasecmp(p->key, "domain-name") == 0) {
- avahi_free(c->server_config.domain_name);
- c->server_config.domain_name = avahi_strdup(p->value);
- } else if (strcasecmp(p->key, "browse-domains") == 0) {
- char **e, **t;
-
- e = avahi_split_csv(p->value);
-
- for (t = e; *t; t++) {
- char cleaned[AVAHI_DOMAIN_NAME_MAX];
-
- if (!avahi_normalize_name(*t, cleaned, sizeof(cleaned))) {
- avahi_log_error("Invalid domain name \"%s\" for key \"%s\" in group \"%s\"\n", *t, p->key, g->name);
- avahi_strfreev(e);
- goto finish;
- }
-
- c->server_config.browse_domains = avahi_string_list_add(c->server_config.browse_domains, cleaned);
- }
-
- avahi_strfreev(e);
- } else if (strcasecmp(p->key, "use-ipv4") == 0)
- c->server_config.use_ipv4 = is_yes(p->value);
- else if (strcasecmp(p->key, "use-ipv6") == 0)
- c->server_config.use_ipv6 = is_yes(p->value);
- else if (strcasecmp(p->key, "check-response-ttl") == 0)
- c->server_config.check_response_ttl = is_yes(p->value);
- else if (strcasecmp(p->key, "allow-point-to-point") == 0)
- c->server_config.allow_point_to_point = is_yes(p->value);
- else if (strcasecmp(p->key, "use-iff-running") == 0)
- c->server_config.use_iff_running = is_yes(p->value);
- else if (strcasecmp(p->key, "disallow-other-stacks") == 0)
- c->server_config.disallow_other_stacks = is_yes(p->value);
-#ifdef HAVE_DBUS
- else if (strcasecmp(p->key, "enable-dbus") == 0) {
-
- if (*(p->value) == 'w' || *(p->value) == 'W') {
- c->fail_on_missing_dbus = 0;
- c->enable_dbus = 1;
- } else if (*(p->value) == 'y' || *(p->value) == 'Y') {
- c->fail_on_missing_dbus = 1;
- c->enable_dbus = 1;
- } else {
- c->enable_dbus = 0;
- }
- }
-#endif
- else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "publish") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "publish-addresses") == 0)
- c->server_config.publish_addresses = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-hinfo") == 0)
- c->server_config.publish_hinfo = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-workstation") == 0)
- c->server_config.publish_workstation = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-domain") == 0)
- c->server_config.publish_domain = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-resolv-conf-dns-servers") == 0)
- c->publish_resolv_conf = is_yes(p->value);
- else if (strcasecmp(p->key, "disable-publishing") == 0)
- c->server_config.disable_publishing = is_yes(p->value);
- else if (strcasecmp(p->key, "disable-user-service-publishing") == 0)
- c->disable_user_service_publishing = is_yes(p->value);
- else if (strcasecmp(p->key, "add-service-cookie") == 0)
- c->server_config.add_service_cookie = is_yes(p->value);
- else if (strcasecmp(p->key, "publish-dns-servers") == 0) {
- avahi_strfreev(c->publish_dns_servers);
- c->publish_dns_servers = avahi_split_csv(p->value);
- } else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "wide-area") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "enable-wide-area") == 0)
- c->server_config.enable_wide_area = is_yes(p->value);
- else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "reflector") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "enable-reflector") == 0)
- c->server_config.enable_reflector = is_yes(p->value);
- else if (strcasecmp(p->key, "reflect-ipv") == 0)
- c->server_config.reflect_ipv = is_yes(p->value);
- else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
- }
-
- } else if (strcasecmp(g->name, "rlimits") == 0) {
- AvahiIniFilePair *p;
-
- for (p = g->pairs; p; p = p->pairs_next) {
-
- if (strcasecmp(p->key, "rlimit-as") == 0) {
- c->rlimit_as_set = 1;
- c->rlimit_as = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-core") == 0) {
- c->rlimit_core_set = 1;
- c->rlimit_core = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-data") == 0) {
- c->rlimit_data_set = 1;
- c->rlimit_data = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-fsize") == 0) {
- c->rlimit_fsize_set = 1;
- c->rlimit_fsize = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-nofile") == 0) {
- c->rlimit_nofile_set = 1;
- c->rlimit_nofile = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-stack") == 0) {
- c->rlimit_stack_set = 1;
- c->rlimit_stack = atoi(p->value);
- } else if (strcasecmp(p->key, "rlimit-nproc") == 0) {
-#ifdef RLIMIT_NPROC
- c->rlimit_nproc_set = 1;
- c->rlimit_nproc = atoi(p->value);
-#else
- avahi_log_error("Ignoring configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
-#endif
- } else {
- avahi_log_error("Invalid configuration key \"%s\" in group \"%s\"\n", p->key, g->name);
- goto finish;
- }
-
- }
-
- } else {
- avahi_log_error("Invalid configuration file group \"%s\".\n", g->name);
- goto finish;
- }
- }
-
- r = 0;
-
-finish:
-
- if (f)
- avahi_ini_file_free(f);
-
- return r;
-}
-
-static void log_function(AvahiLogLevel level, const char *txt) {
-
- static const int log_level_map[] = {
- LOG_ERR,
- LOG_WARNING,
- LOG_NOTICE,
- LOG_INFO,
- LOG_DEBUG
- };
-
- assert(level < AVAHI_LOG_LEVEL_MAX);
- assert(txt);
-
- if (!config.debug && level == AVAHI_LOG_DEBUG)
- return;
-
- daemon_log(log_level_map[level], "%s", txt);
-}
-
-static void dump(const char *text, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_info("%s", text);
-}
-
-static void signal_callback(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
- int sig;
- const AvahiPoll *poll_api;
-
- assert(watch);
- assert(simple_poll_api);
-
- poll_api = avahi_simple_poll_get(simple_poll_api);
-
- if ((sig = daemon_signal_next()) <= 0) {
- avahi_log_error("daemon_signal_next() failed");
- poll_api->watch_free(watch);
- return;
- }
-
- switch (sig) {
- case SIGINT:
- case SIGQUIT:
- case SIGTERM:
- avahi_log_info(
- "Got %s, quitting.",
- sig == SIGINT ? "SIGINT" :
- (sig == SIGQUIT ? "SIGQUIT" : "SIGTERM"));
- avahi_simple_poll_quit(simple_poll_api);
- break;
-
- case SIGHUP:
- avahi_log_info("Got SIGHUP, reloading.");
-#ifdef ENABLE_CHROOT
- static_service_load(config.use_chroot);
- static_hosts_load(config.use_chroot);
-#else
- static_service_load(0);
- static_hosts_load(0);
-#endif
- static_service_add_to_server();
- static_hosts_add_to_server();
-
- if (resolv_conf_entry_group)
- avahi_s_entry_group_reset(resolv_conf_entry_group);
-
- load_resolv_conf();
-
- update_wide_area_servers();
-
- if (config.publish_resolv_conf && resolv_conf && resolv_conf[0])
- resolv_conf_entry_group = add_dns_servers(avahi_server, resolv_conf_entry_group, resolv_conf);
-
- break;
-
- case SIGUSR1:
- avahi_log_info("Got SIGUSR1, dumping record data.");
- avahi_server_dump(avahi_server, dump, NULL);
- break;
-
- default:
- avahi_log_warn("Got spurious signal, ignoring.");
- break;
- }
-}
-
-/* Imported from ../avahi-client/nss-check.c */
-int avahi_nss_support(void);
-
-static int run_server(DaemonConfig *c) {
- int r = -1;
- int error;
- const AvahiPoll *poll_api = NULL;
- AvahiWatch *sig_watch = NULL;
- int retval_is_sent = 0;
-
- assert(c);
-
- if (!(nss_support = avahi_nss_support()))
- avahi_log_warn("WARNING: No NSS support for mDNS detected, consider installing nss-mdns!");
-
- if (!(simple_poll_api = avahi_simple_poll_new())) {
- avahi_log_error("Failed to create main loop object.");
- goto finish;
- }
-
- poll_api = avahi_simple_poll_get(simple_poll_api);
-
- if (daemon_signal_init(SIGINT, SIGQUIT, SIGHUP, SIGTERM, SIGUSR1, 0) < 0) {
- avahi_log_error("Could not register signal handlers (%s).", strerror(errno));
- goto finish;
- }
-
- if (!(sig_watch = poll_api->watch_new(poll_api, daemon_signal_fd(), AVAHI_WATCH_IN, signal_callback, simple_poll_api))) {
- avahi_log_error( "Failed to create signal watcher");
- goto finish;
- }
-
- if (simple_protocol_setup(poll_api) < 0)
- goto finish;
-
-#ifdef HAVE_DBUS
- if (c->enable_dbus) {
- if (dbus_protocol_setup(poll_api, config.disable_user_service_publishing, !c->fail_on_missing_dbus
-#ifdef ENABLE_CHROOT
- && !config.use_chroot
-#endif
- ) < 0) {
-
- avahi_log_warn("WARNING: Failed to contact D-Bus daemon.");
-
- if (c->fail_on_missing_dbus)
- goto finish;
- }
- }
-#endif
-
-#ifdef ENABLE_CHROOT
-
- if (config.drop_root && config.use_chroot) {
- if (chroot(AVAHI_CONFIG_DIR) < 0) {
- avahi_log_error("Failed to chroot(): %s", strerror(errno));
- goto finish;
- }
-
- avahi_log_info("Successfully called chroot().");
- chdir("/");
-
- if (avahi_caps_drop_all() < 0) {
- avahi_log_error("Failed to drop capabilities.");
- goto finish;
- }
- avahi_log_info("Successfully dropped remaining capabilities.");
- }
-
-#endif
-
- load_resolv_conf();
-#ifdef ENABLE_CHROOT
- static_service_load(config.use_chroot);
- static_hosts_load(config.use_chroot);
-#else
- static_service_load(0);
- static_hosts_load(0);
-#endif
-
- if (!(avahi_server = avahi_server_new(poll_api, &c->server_config, server_callback, c, &error))) {
- avahi_log_error("Failed to create server: %s", avahi_strerror(error));
- goto finish;
- }
-
- update_wide_area_servers();
-
- if (c->daemonize) {
- daemon_retval_send(0);
- retval_is_sent = 1;
- }
-
- for (;;) {
- if ((r = avahi_simple_poll_iterate(simple_poll_api, -1)) < 0) {
-
- /* We handle signals through an FD, so let's continue */
- if (errno == EINTR)
- continue;
-
- avahi_log_error("poll(): %s", strerror(errno));
- goto finish;
- } else if (r > 0)
- /* Quit */
- break;
- }
-
-
-finish:
-
- static_service_remove_from_server();
- static_service_free_all();
-
- static_hosts_remove_from_server();
- static_hosts_free_all();
-
- remove_dns_server_entry_groups();
-
- simple_protocol_shutdown();
-
-#ifdef HAVE_DBUS
- if (c->enable_dbus)
- dbus_protocol_shutdown();
-#endif
-
- if (avahi_server) {
- avahi_server_free(avahi_server);
- avahi_server = NULL;
- }
-
- daemon_signal_done();
-
- if (sig_watch)
- poll_api->watch_free(sig_watch);
-
- if (simple_poll_api) {
- avahi_simple_poll_free(simple_poll_api);
- simple_poll_api = NULL;
- }
-
- if (!retval_is_sent && c->daemonize)
- daemon_retval_send(1);
-
- return r;
-}
-
-#define set_env(key, value) putenv(avahi_strdup_printf("%s=%s", (key), (value)))
-
-static int drop_root(void) {
- struct passwd *pw;
- struct group * gr;
- int r;
-
- if (!(pw = getpwnam(AVAHI_USER))) {
- avahi_log_error( "Failed to find user '"AVAHI_USER"'.");
- return -1;
- }
-
- if (!(gr = getgrnam(AVAHI_GROUP))) {
- avahi_log_error( "Failed to find group '"AVAHI_GROUP"'.");
- return -1;
- }
-
- avahi_log_info("Found user '"AVAHI_USER"' (UID %lu) and group '"AVAHI_GROUP"' (GID %lu).", (unsigned long) pw->pw_uid, (unsigned long) gr->gr_gid);
-
- if (initgroups(AVAHI_USER, gr->gr_gid) != 0) {
- avahi_log_error("Failed to change group list: %s", strerror(errno));
- return -1;
- }
-
-#if defined(HAVE_SETRESGID)
- r = setresgid(gr->gr_gid, gr->gr_gid, gr->gr_gid);
-#elif defined(HAVE_SETEGID)
- if ((r = setgid(gr->gr_gid)) >= 0)
- r = setegid(gr->gr_gid);
-#elif defined(HAVE_SETREGID)
- r = setregid(gr->gr_gid, gr->gr_gid);
-#else
-#error "No API to drop priviliges"
-#endif
-
- if (r < 0) {
- avahi_log_error("Failed to change GID: %s", strerror(errno));
- return -1;
- }
-
-#if defined(HAVE_SETRESUID)
- r = setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid);
-#elif defined(HAVE_SETEUID)
- if ((r = setuid(pw->pw_uid)) >= 0)
- r = seteuid(pw->pw_uid);
-#elif defined(HAVE_SETREUID)
- r = setreuid(pw->pw_uid, pw->pw_uid);
-#else
-#error "No API to drop priviliges"
-#endif
-
- if (r < 0) {
- avahi_log_error("Failed to change UID: %s", strerror(errno));
- return -1;
- }
-
- set_env("USER", pw->pw_name);
- set_env("LOGNAME", pw->pw_name);
- set_env("HOME", pw->pw_dir);
-
- avahi_log_info("Successfully dropped root privileges.");
-
- return 0;
-}
-
-static const char* pid_file_proc(void) {
- return AVAHI_DAEMON_RUNTIME_DIR"/pid";
-}
-
-static int make_runtime_dir(void) {
- int r = -1;
- mode_t u;
- int reset_umask = 0;
- struct passwd *pw;
- struct group * gr;
- struct stat st;
-
- if (!(pw = getpwnam(AVAHI_USER))) {
- avahi_log_error( "Failed to find user '"AVAHI_USER"'.");
- goto fail;
- }
-
- if (!(gr = getgrnam(AVAHI_GROUP))) {
- avahi_log_error( "Failed to find group '"AVAHI_GROUP"'.");
- goto fail;
- }
-
- u = umask(0000);
- reset_umask = 1;
-
- if (mkdir(AVAHI_DAEMON_RUNTIME_DIR, 0755) < 0 && errno != EEXIST) {
- avahi_log_error("mkdir(\""AVAHI_DAEMON_RUNTIME_DIR"\"): %s", strerror(errno));
- goto fail;
- }
-
- chown(AVAHI_DAEMON_RUNTIME_DIR, pw->pw_uid, gr->gr_gid);
-
- if (stat(AVAHI_DAEMON_RUNTIME_DIR, &st) < 0) {
- avahi_log_error("stat(): %s\n", strerror(errno));
- goto fail;
- }
-
- if (!S_ISDIR(st.st_mode) || st.st_uid != pw->pw_uid || st.st_gid != gr->gr_gid) {
- avahi_log_error("Failed to create runtime directory "AVAHI_DAEMON_RUNTIME_DIR".");
- goto fail;
- }
-
- r = 0;
-
-fail:
- if (reset_umask)
- umask(u);
- return r;
-}
-
-static void set_one_rlimit(int resource, rlim_t limit, const char *name) {
- struct rlimit rl;
- rl.rlim_cur = rl.rlim_max = limit;
-
- if (setrlimit(resource, &rl) < 0)
- avahi_log_warn("setrlimit(%s, {%u, %u}) failed: %s", name, (unsigned) limit, (unsigned) limit, strerror(errno));
-}
-
-static void enforce_rlimits(void) {
-#ifdef RLIMIT_AS
- if (config.rlimit_as_set)
- set_one_rlimit(RLIMIT_AS, config.rlimit_as, "RLIMIT_AS");
-#endif
- if (config.rlimit_core_set)
- set_one_rlimit(RLIMIT_CORE, config.rlimit_core, "RLIMIT_CORE");
- if (config.rlimit_data_set)
- set_one_rlimit(RLIMIT_DATA, config.rlimit_data, "RLIMIT_DATA");
- if (config.rlimit_fsize_set)
- set_one_rlimit(RLIMIT_FSIZE, config.rlimit_fsize, "RLIMIT_FSIZE");
- if (config.rlimit_nofile_set)
- set_one_rlimit(RLIMIT_NOFILE, config.rlimit_nofile, "RLIMIT_NOFILE");
- if (config.rlimit_stack_set)
- set_one_rlimit(RLIMIT_STACK, config.rlimit_stack, "RLIMIT_STACK");
-#ifdef RLIMIT_NPROC
- if (config.rlimit_nproc_set)
- set_one_rlimit(RLIMIT_NPROC, config.rlimit_nproc, "RLIMIT_NPROC");
-#endif
-
- /* the sysctl() call from iface-pfroute.c needs locked memory on FreeBSD */
-#if defined(RLIMIT_MEMLOCK) && !defined(__FreeBSD__)
- /* We don't need locked memory */
- set_one_rlimit(RLIMIT_MEMLOCK, 0, "RLIMIT_MEMLOCK");
-#endif
-}
-
-#define RANDOM_DEVICE "/dev/urandom"
-
-static void init_rand_seed(void) {
- int fd;
- unsigned seed = 0;
-
- /* Try to initialize seed from /dev/urandom, to make it a little
- * less predictable, and to make sure that multiple machines
- * booted at the same time choose different random seeds. */
- if ((fd = open(RANDOM_DEVICE, O_RDONLY)) >= 0) {
- read(fd, &seed, sizeof(seed));
- close(fd);
- }
-
- /* If the initialization failed by some reason, we add the time to the seed*/
- seed ^= (unsigned) time(NULL);
-
- srand(seed);
-}
-
-int main(int argc, char *argv[]) {
- int r = 255;
- int wrote_pid_file = 0;
-
- avahi_set_log_function(log_function);
-
- init_rand_seed();
-
- avahi_server_config_init(&config.server_config);
- config.command = DAEMON_RUN;
- config.daemonize = 0;
- config.config_file = NULL;
-#ifdef HAVE_DBUS
- config.enable_dbus = 1;
- config.fail_on_missing_dbus = 1;
-#endif
-
- config.drop_root = 1;
- config.set_rlimits = 1;
-#ifdef ENABLE_CHROOT
- config.use_chroot = 1;
-#endif
- config.modify_proc_title = 1;
-
- config.disable_user_service_publishing = 0;
- config.publish_dns_servers = NULL;
- config.publish_resolv_conf = 0;
- config.use_syslog = 0;
- config.debug = 0;
- config.rlimit_as_set = 0;
- config.rlimit_core_set = 0;
- config.rlimit_data_set = 0;
- config.rlimit_fsize_set = 0;
- config.rlimit_nofile_set = 0;
- config.rlimit_stack_set = 0;
-#ifdef RLIMIT_NPROC
- config.rlimit_nproc_set = 0;
-#endif
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0 = avahi_strdup(argv0 + 1);
- else
- argv0 = avahi_strdup(argv[0]);
-
- daemon_pid_file_ident = (const char *) argv0;
- daemon_log_ident = (char*) argv0;
- daemon_pid_file_proc = pid_file_proc;
-
- if (parse_command_line(&config, argc, argv) < 0)
- goto finish;
-
- if (config.modify_proc_title)
- avahi_init_proc_title(argc, argv);
-
-#ifdef ENABLE_CHROOT
- config.use_chroot = config.use_chroot && config.drop_root;
-#endif
-
- if (config.command == DAEMON_HELP) {
- help(stdout);
- r = 0;
- } else if (config.command == DAEMON_VERSION) {
- printf("%s "PACKAGE_VERSION"\n", argv0);
- r = 0;
- } else if (config.command == DAEMON_KILL) {
- if (daemon_pid_file_kill_wait(SIGTERM, 5) < 0) {
- avahi_log_warn("Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
-
- } else if (config.command == DAEMON_RELOAD) {
- if (daemon_pid_file_kill(SIGHUP) < 0) {
- avahi_log_warn("Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
-
- } else if (config.command == DAEMON_CHECK)
- r = (daemon_pid_file_is_running() >= 0) ? 0 : 1;
- else if (config.command == DAEMON_RUN) {
- pid_t pid;
-
- if (getuid() != 0 && config.drop_root) {
- avahi_log_error("This program is intended to be run as root.");
- goto finish;
- }
-
- if ((pid = daemon_pid_file_is_running()) >= 0) {
- avahi_log_error("Daemon already running on PID %u", pid);
- goto finish;
- }
-
- if (load_config_file(&config) < 0)
- goto finish;
-
- if (config.daemonize) {
- daemon_retval_init();
-
- if ((pid = daemon_fork()) < 0)
- goto finish;
- else if (pid != 0) {
- int ret;
- /** Parent **/
-
- if ((ret = daemon_retval_wait(20)) < 0) {
- avahi_log_error("Could not receive return value from daemon process.");
- goto finish;
- }
-
- r = ret;
- goto finish;
- }
-
- /* Child */
- }
-
- if (config.use_syslog || config.daemonize)
- daemon_log_use = DAEMON_LOG_SYSLOG;
-
- if (make_runtime_dir() < 0)
- goto finish;
-
- if (config.drop_root) {
-#ifdef ENABLE_CHROOT
- if (config.use_chroot)
- if (avahi_caps_reduce() < 0)
- goto finish;
-#endif
-
- if (drop_root() < 0)
- goto finish;
-
-#ifdef ENABLE_CHROOT
- if (config.use_chroot)
- if (avahi_caps_reduce2() < 0)
- goto finish;
-#endif
- }
-
- if (daemon_pid_file_create() < 0) {
- avahi_log_error("Failed to create PID file: %s", strerror(errno));
-
- if (config.daemonize)
- daemon_retval_send(1);
- goto finish;
- } else
- wrote_pid_file = 1;
-
- if (config.set_rlimits)
- enforce_rlimits();
-
- chdir("/");
-
-#ifdef ENABLE_CHROOT
- if (config.drop_root && config.use_chroot)
- if (avahi_chroot_helper_start(argv0) < 0) {
- avahi_log_error("failed to start chroot() helper daemon.");
- goto finish;
- }
-#endif
- avahi_log_info("%s "PACKAGE_VERSION" starting up.", argv0);
-
- avahi_set_proc_title(argv0, "%s: starting up", argv0);
-
- if (run_server(&config) == 0)
- r = 0;
- }
-
-finish:
-
- if (config.daemonize)
- daemon_retval_done();
-
- avahi_server_config_free(&config.server_config);
- avahi_free(config.config_file);
- avahi_strfreev(config.publish_dns_servers);
- avahi_strfreev(resolv_conf);
-
- if (wrote_pid_file) {
-#ifdef ENABLE_CHROOT
- avahi_chroot_helper_unlink(pid_file_proc());
-#else
- daemon_pid_file_remove();
-#endif
- }
-
-#ifdef ENABLE_CHROOT
- avahi_chroot_helper_shutdown();
-#endif
-
- avahi_free(argv0);
-
- return r;
-}
diff --git a/trunk/avahi-daemon/main.h b/trunk/avahi-daemon/main.h
deleted file mode 100644
index 77af0d0..0000000
--- a/trunk/avahi-daemon/main.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef foomainhfoo
-#define foomainhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-core/core.h>
-#include <avahi-common/simple-watch.h>
-
-extern AvahiServer *avahi_server;
-extern AvahiSimplePoll *simple_poll_api;
-
-extern int nss_support;
-
-#endif
diff --git a/trunk/avahi-daemon/setproctitle.c b/trunk/avahi-daemon/setproctitle.c
deleted file mode 100644
index 09b7f65..0000000
--- a/trunk/avahi-daemon/setproctitle.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <unistd.h>
-
-#ifdef HAVE_SYS_PRCTL_H
-#include <sys/prctl.h>
-#endif
-
-#include <avahi-common/malloc.h>
-
-#include "setproctitle.h"
-
-#if !defined(HAVE_SETPROCTITLE) && defined(__linux__)
-static char** argv_buffer = NULL;
-static size_t argv_size = 0;
-
-#if !HAVE_DECL_ENVIRON
-extern char **environ;
-#endif
-
-#endif
-
-void avahi_init_proc_title(int argc, char **argv) {
-
-#if !defined(HAVE_SETPROCTITLE) && defined(__linux__)
-
- unsigned i;
- char **new_environ, *endptr;
-
- /* This code is really really ugly. We make some memory layout
- * assumptions and reuse the environment array as memory to store
- * our process title in */
-
- for (i = 0; environ[i]; i++);
-
- endptr = i ? environ[i-1] + strlen(environ[i-1]) : argv[argc-1] + strlen(argv[argc-1]);
-
- argv_buffer = argv;
- argv_size = endptr - argv_buffer[0];
-
- /* Make a copy of environ */
-
- new_environ = avahi_malloc(sizeof(char*) * (i + 1));
- for (i = 0; environ[i]; i++)
- new_environ[i] = avahi_strdup(environ[i]);
- new_environ[i] = NULL;
-
- environ = new_environ;
-
-#endif
-}
-
-void avahi_set_proc_title(const char *name, const char *fmt,...) {
-#ifdef HAVE_SETPROCTITLE
- char t[256];
-
- va_list ap;
- va_start(ap, fmt);
- vsnprintf(t, sizeof(t), fmt, ap);
- va_end(ap);
-
- setproctitle("-%s", t);
-#elif __linux__
- size_t l;
- va_list ap;
-
- if (!argv_buffer)
- return;
-
- va_start(ap, fmt);
- vsnprintf(argv_buffer[0], argv_size, fmt, ap);
- va_end(ap);
-
- l = strlen(argv_buffer[0]);
-
- memset(argv_buffer[0] + l, 0, argv_size - l);
- argv_buffer[1] = NULL;
-#endif
-
-#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME)
-
- if (name)
- prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0);
-
-#endif
-}
diff --git a/trunk/avahi-daemon/setproctitle.h b/trunk/avahi-daemon/setproctitle.h
deleted file mode 100644
index a8f2a1a..0000000
--- a/trunk/avahi-daemon/setproctitle.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foosetproctitlehfoo
-#define foosetproctitlehfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/gccmacro.h>
-
-void avahi_init_proc_title(int argc, char **argv);
-void avahi_set_proc_title(const char *name, const char *fmt, ...) AVAHI_GCC_PRINTF_ATTR23;
-
-#endif
diff --git a/trunk/avahi-daemon/simple-protocol.c b/trunk/avahi-daemon/simple-protocol.c
deleted file mode 100644
index 04b07c7..0000000
--- a/trunk/avahi-daemon/simple-protocol.c
+++ /dev/null
@@ -1,547 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-#include <avahi-core/log.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/dns-srv-rr.h>
-
-#include "simple-protocol.h"
-#include "main.h"
-
-#ifdef ENABLE_CHROOT
-#include "chroot.h"
-#endif
-
-#ifndef AF_LOCAL
-#define AF_LOCAL AF_UNIX
-#endif
-#ifndef PF_LOCAL
-#define PF_LOCAL PF_UNIX
-#endif
-
-#define BUFFER_SIZE (20*1024)
-
-#define CLIENTS_MAX 50
-
-typedef struct Client Client;
-typedef struct Server Server;
-
-typedef enum {
- CLIENT_IDLE,
- CLIENT_RESOLVE_HOSTNAME,
- CLIENT_RESOLVE_ADDRESS,
- CLIENT_BROWSE_DNS_SERVERS,
- CLIENT_DEAD
-} ClientState;
-
-struct Client {
- Server *server;
-
- ClientState state;
-
- int fd;
- AvahiWatch *watch;
-
- char inbuf[BUFFER_SIZE], outbuf[BUFFER_SIZE];
- size_t inbuf_length, outbuf_length;
-
- AvahiSHostNameResolver *host_name_resolver;
- AvahiSAddressResolver *address_resolver;
- AvahiSDNSServerBrowser *dns_server_browser;
-
- AvahiProtocol afquery;
-
- AVAHI_LLIST_FIELDS(Client, clients);
-};
-
-struct Server {
- const AvahiPoll *poll_api;
- int fd;
- AvahiWatch *watch;
- AVAHI_LLIST_HEAD(Client, clients);
-
- unsigned n_clients;
- int bind_successful;
-};
-
-static Server *server = NULL;
-
-static void client_work(AvahiWatch *watch, int fd, AvahiWatchEvent events, void *userdata);
-
-static void client_free(Client *c) {
- assert(c);
-
- assert(c->server->n_clients >= 1);
- c->server->n_clients--;
-
- if (c->host_name_resolver)
- avahi_s_host_name_resolver_free(c->host_name_resolver);
-
- if (c->address_resolver)
- avahi_s_address_resolver_free(c->address_resolver);
-
- if (c->dns_server_browser)
- avahi_s_dns_server_browser_free(c->dns_server_browser);
-
- c->server->poll_api->watch_free(c->watch);
- close(c->fd);
-
- AVAHI_LLIST_REMOVE(Client, clients, c->server->clients, c);
- avahi_free(c);
-}
-
-static void client_new(Server *s, int fd) {
- Client *c;
-
- assert(fd >= 0);
-
- c = avahi_new(Client, 1);
- c->server = s;
- c->fd = fd;
- c->state = CLIENT_IDLE;
-
- c->inbuf_length = c->outbuf_length = 0;
-
- c->host_name_resolver = NULL;
- c->address_resolver = NULL;
- c->dns_server_browser = NULL;
-
- c->watch = s->poll_api->watch_new(s->poll_api, fd, AVAHI_WATCH_IN, client_work, c);
-
- AVAHI_LLIST_PREPEND(Client, clients, s->clients, c);
- s->n_clients++;
-}
-
-static void client_output(Client *c, const uint8_t*data, size_t size) {
- size_t k, m;
-
- assert(c);
- assert(data);
-
- if (!size)
- return;
-
- k = sizeof(c->outbuf) - c->outbuf_length;
- m = size > k ? k : size;
-
- memcpy(c->outbuf + c->outbuf_length, data, m);
- c->outbuf_length += m;
-
- server->poll_api->watch_update(c->watch, AVAHI_WATCH_OUT);
-}
-
-static void client_output_printf(Client *c, const char *format, ...) {
- char *t;
- va_list ap;
-
- va_start(ap, format);
- t = avahi_strdup_vprintf(format, ap);
- va_end(ap);
-
- client_output(c, (uint8_t*) t, strlen(t));
- avahi_free(t);
-}
-
-static void host_name_resolver_callback(
- AVAHI_GCC_UNUSED AvahiSHostNameResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *hostname,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- Client *c = userdata;
-
- assert(c);
-
- if (event == AVAHI_RESOLVER_FAILURE)
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- else if (event == AVAHI_RESOLVER_FOUND) {
- char t[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(t, sizeof(t), a);
- client_output_printf(c, "+ %i %u %s %s\n", iface, protocol, hostname, t);
- }
-
- c->state = CLIENT_DEAD;
-}
-
-static void address_resolver_callback(
- AVAHI_GCC_UNUSED AvahiSAddressResolver *r,
- AvahiIfIndex iface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- AVAHI_GCC_UNUSED const AvahiAddress *a,
- const char *hostname,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- Client *c = userdata;
-
- assert(c);
-
- if (event == AVAHI_RESOLVER_FAILURE)
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- else if (event == AVAHI_RESOLVER_FOUND)
- client_output_printf(c, "+ %i %u %s\n", iface, protocol, hostname);
-
- c->state = CLIENT_DEAD;
-}
-
-static void dns_server_browser_callback(
- AVAHI_GCC_UNUSED AvahiSDNSServerBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- AVAHI_GCC_UNUSED const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- Client *c = userdata;
- char t[AVAHI_ADDRESS_STR_MAX];
-
- assert(c);
-
- if (!a)
- return;
-
- switch (event) {
- case AVAHI_BROWSER_FAILURE:
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- c->state = CLIENT_DEAD;
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- break;
-
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE:
-
- avahi_address_snprint(t, sizeof(t), a);
- client_output_printf(c, "%c %i %u %s %u\n", event == AVAHI_BROWSER_NEW ? '>' : '<', interface, protocol, t, port);
- break;
- }
-}
-
-static void handle_line(Client *c, const char *s) {
- char cmd[64], arg[64];
- int n_args;
-
- assert(c);
- assert(s);
-
- if (c->state != CLIENT_IDLE)
- return;
-
- if ((n_args = sscanf(s, "%63s %63s", cmd, arg)) < 1 ) {
- client_output_printf(c, "%+i Failed to parse command, try \"HELP\".\n", AVAHI_ERR_INVALID_OPERATION);
- c->state = CLIENT_DEAD;
- return;
- }
-
- if (strcmp(cmd, "HELP") == 0) {
- client_output_printf(c,
- "+ Available commands are:\n"
- "+ RESOLVE-HOSTNAME <hostname>\n"
- "+ RESOLVE-HOSTNAME-IPV6 <hostname>\n"
- "+ RESOLVE-HOSTNAME-IPV4 <hostname>\n"
- "+ RESOLVE-ADDRESS <address>\n"
- "+ BROWSE-DNS-SERVERS\n"
- "+ BROWSE-DNS-SERVERS-IPV4\n"
- "+ BROWSE-DNS-SERVERS-IPV6\n");
- c->state = CLIENT_DEAD; }
- else if (strcmp(cmd, "FUCK") == 0 && n_args == 1) {
- client_output_printf(c, "+ FUCK: Go fuck yourself!\n");
- c->state = CLIENT_DEAD;
- } else if (strcmp(cmd, "RESOLVE-HOSTNAME-IPV4") == 0 && n_args == 2) {
- c->state = CLIENT_RESOLVE_HOSTNAME;
- if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, arg, c->afquery = AVAHI_PROTO_INET, AVAHI_LOOKUP_USE_MULTICAST, host_name_resolver_callback, c)))
- goto fail;
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
- } else if (strcmp(cmd, "RESOLVE-HOSTNAME-IPV6") == 0 && n_args == 2) {
- c->state = CLIENT_RESOLVE_HOSTNAME;
- if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, arg, c->afquery = AVAHI_PROTO_INET6, AVAHI_LOOKUP_USE_MULTICAST, host_name_resolver_callback, c)))
- goto fail;
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
- } else if (strcmp(cmd, "RESOLVE-HOSTNAME") == 0 && n_args == 2) {
- c->state = CLIENT_RESOLVE_HOSTNAME;
- if (!(c->host_name_resolver = avahi_s_host_name_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, arg, c->afquery = AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_USE_MULTICAST, host_name_resolver_callback, c)))
- goto fail;
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
- } else if (strcmp(cmd, "RESOLVE-ADDRESS") == 0 && n_args == 2) {
- AvahiAddress addr;
-
- if (!(avahi_address_parse(arg, AVAHI_PROTO_UNSPEC, &addr))) {
- client_output_printf(c, "%+i Failed to parse address \"%s\".\n", AVAHI_ERR_INVALID_ADDRESS, arg);
- c->state = CLIENT_DEAD;
- } else {
- c->state = CLIENT_RESOLVE_ADDRESS;
- if (!(c->address_resolver = avahi_s_address_resolver_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, &addr, AVAHI_LOOKUP_USE_MULTICAST, address_resolver_callback, c)))
- goto fail;
- }
-
- avahi_log_debug(__FILE__": Got %s request for '%s'.", cmd, arg);
-
- } else if (strcmp(cmd, "BROWSE-DNS-SERVERS-IPV4") == 0 && n_args == 1) {
- c->state = CLIENT_BROWSE_DNS_SERVERS;
- if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AVAHI_PROTO_INET, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c)))
- goto fail;
- client_output_printf(c, "+ Browsing ...\n");
-
- avahi_log_debug(__FILE__": Got %s request.", cmd);
-
- } else if (strcmp(cmd, "BROWSE-DNS-SERVERS-IPV6") == 0 && n_args == 1) {
- c->state = CLIENT_BROWSE_DNS_SERVERS;
- if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AVAHI_PROTO_INET6, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c)))
- goto fail;
- client_output_printf(c, "+ Browsing ...\n");
-
- avahi_log_debug(__FILE__": Got %s request.", cmd);
-
- } else if (strcmp(cmd, "BROWSE-DNS-SERVERS") == 0 && n_args == 1) {
- c->state = CLIENT_BROWSE_DNS_SERVERS;
- if (!(c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery = AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c)))
- goto fail;
- client_output_printf(c, "+ Browsing ...\n");
-
- avahi_log_debug(__FILE__": Got %s request.", cmd);
-
- } else {
- client_output_printf(c, "%+i Invalid command \"%s\", try \"HELP\".\n", AVAHI_ERR_INVALID_OPERATION, cmd);
- c->state = CLIENT_DEAD;
-
- avahi_log_debug(__FILE__": Got invalid request '%s'.", cmd);
- }
-
- return;
-
-fail:
- client_output_printf(c, "%+i %s\n", avahi_server_errno(avahi_server), avahi_strerror(avahi_server_errno(avahi_server)));
- c->state = CLIENT_DEAD;
-}
-
-static void handle_input(Client *c) {
- assert(c);
-
- for (;;) {
- char *e;
- size_t k;
-
- if (!(e = memchr(c->inbuf, '\n', c->inbuf_length)))
- break;
-
- k = e - (char*) c->inbuf;
- *e = 0;
-
- handle_line(c, c->inbuf);
- c->inbuf_length -= k + 1;
- memmove(c->inbuf, e+1, c->inbuf_length);
- }
-}
-
-static void client_work(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEvent events, void *userdata) {
- Client *c = userdata;
-
- assert(c);
-
- if ((events & AVAHI_WATCH_IN) && c->inbuf_length < sizeof(c->inbuf)) {
- ssize_t r;
-
- if ((r = read(c->fd, c->inbuf + c->inbuf_length, sizeof(c->inbuf) - c->inbuf_length)) <= 0) {
- if (r < 0)
- avahi_log_warn("read(): %s", strerror(errno));
- client_free(c);
- return;
- }
-
- c->inbuf_length += r;
- assert(c->inbuf_length <= sizeof(c->inbuf));
-
- handle_input(c);
- }
-
- if ((events & AVAHI_WATCH_OUT) && c->outbuf_length > 0) {
- ssize_t r;
-
- if ((r = write(c->fd, c->outbuf, c->outbuf_length)) < 0) {
- avahi_log_warn("write(): %s", strerror(errno));
- client_free(c);
- return;
- }
-
- assert((size_t) r <= c->outbuf_length);
- c->outbuf_length -= r;
-
- if (c->outbuf_length)
- memmove(c->outbuf, c->outbuf + r, c->outbuf_length - r);
-
- if (c->outbuf_length == 0 && c->state == CLIENT_DEAD) {
- client_free(c);
- return;
- }
- }
-
- c->server->poll_api->watch_update(
- watch,
- (c->outbuf_length > 0 ? AVAHI_WATCH_OUT : 0) |
- (c->inbuf_length < sizeof(c->inbuf) ? AVAHI_WATCH_IN : 0));
-}
-
-static void server_work(AVAHI_GCC_UNUSED AvahiWatch *watch, int fd, AvahiWatchEvent events, void *userdata) {
- Server *s = userdata;
-
- assert(s);
-
- if (events & AVAHI_WATCH_IN) {
- int cfd;
-
- if ((cfd = accept(fd, NULL, NULL)) < 0)
- avahi_log_error("accept(): %s", strerror(errno));
- else
- client_new(s, cfd);
- }
-}
-
-int simple_protocol_setup(const AvahiPoll *poll_api) {
- struct sockaddr_un sa;
- mode_t u;
-
- assert(!server);
-
- server = avahi_new(Server, 1);
- server->poll_api = poll_api;
- server->bind_successful = 0;
- server->fd = -1;
- server->n_clients = 0;
- AVAHI_LLIST_HEAD_INIT(Client, server->clients);
- server->watch = NULL;
-
- u = umask(0000);
-
- if ((server->fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
- avahi_log_warn("socket(PF_LOCAL, SOCK_STREAM, 0): %s", strerror(errno));
- goto fail;
- }
-
- memset(&sa, 0, sizeof(sa));
- sa.sun_family = AF_LOCAL;
- strncpy(sa.sun_path, AVAHI_SOCKET, sizeof(sa.sun_path)-1);
-
- /* We simply remove existing UNIX sockets under this name. The
- Avahi daemons makes sure that it runs only once on a host,
- therefore sockets that already exist are stale and may be
- removed without any ill effects */
-
- unlink(AVAHI_SOCKET);
-
- if (bind(server->fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
- avahi_log_warn("bind(): %s", strerror(errno));
- goto fail;
- }
-
- server->bind_successful = 1;
-
- if (listen(server->fd, 2) < 0) {
- avahi_log_warn("listen(): %s", strerror(errno));
- goto fail;
- }
-
- umask(u);
-
- server->watch = poll_api->watch_new(poll_api, server->fd, AVAHI_WATCH_IN, server_work, server);
-
- return 0;
-
-fail:
-
- umask(u);
- simple_protocol_shutdown();
-
- return -1;
-}
-
-void simple_protocol_shutdown(void) {
-
- if (server) {
-
- if (server->bind_successful)
-#ifdef ENABLE_CHROOT
- avahi_chroot_helper_unlink(AVAHI_SOCKET);
-#else
- unlink(AVAHI_SOCKET);
-#endif
-
- while (server->clients)
- client_free(server->clients);
-
- if (server->watch)
- server->poll_api->watch_free(server->watch);
-
- if (server->fd >= 0)
- close(server->fd);
-
- avahi_free(server);
-
- server = NULL;
- }
-}
-
-void simple_protocol_restart_queries(void) {
- Client *c;
-
- /* Restart queries in case of local domain name changes */
-
- assert(server);
-
- for (c = server->clients; c; c = c->clients_next)
- if (c->state == CLIENT_BROWSE_DNS_SERVERS && c->dns_server_browser) {
- avahi_s_dns_server_browser_free(c->dns_server_browser);
- c->dns_server_browser = avahi_s_dns_server_browser_new(avahi_server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DNS_SERVER_RESOLVE, c->afquery, AVAHI_LOOKUP_USE_MULTICAST, dns_server_browser_callback, c);
- }
-}
-
-
diff --git a/trunk/avahi-daemon/simple-protocol.h b/trunk/avahi-daemon/simple-protocol.h
deleted file mode 100644
index 1e64036..0000000
--- a/trunk/avahi-daemon/simple-protocol.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef foosimpleprotocolhfoo
-#define foosimpleprotocolhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/watch.h>
-
-int simple_protocol_setup(const AvahiPoll *poll_api);
-void simple_protocol_shutdown(void);
-void simple_protocol_restart_queries(void);
-
-#endif
diff --git a/trunk/avahi-daemon/ssh.service b/trunk/avahi-daemon/ssh.service
deleted file mode 100644
index 41e3a5a..0000000
--- a/trunk/avahi-daemon/ssh.service
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
-<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
--->
-
-<!-- See avahi.service(5) for more information about this configuration file -->
-
-<service-group>
-
- <name replace-wildcards="yes">Remote Terminal on %h</name>
-
- <service>
- <type>_ssh._tcp</type>
- <port>22</port>
- </service>
-
-</service-group>
diff --git a/trunk/avahi-daemon/static-hosts.c b/trunk/avahi-daemon/static-hosts.c
deleted file mode 100644
index 9941a51..0000000
--- a/trunk/avahi-daemon/static-hosts.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-
-#include "main.h"
-#include "static-hosts.h"
-
-typedef struct StaticHost StaticHost;
-
-struct StaticHost {
- AvahiSEntryGroup *group;
-
- char *host, *ip;
-
- AVAHI_LLIST_FIELDS(StaticHost, hosts);
-};
-
-static AVAHI_LLIST_HEAD(StaticHost, hosts) = NULL;
-
-static void add_static_host_to_server(StaticHost *h);
-static void remove_static_host_from_server(StaticHost *h);
-
-static void entry_group_callback(AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *eg, AvahiEntryGroupState state, void* userdata) {
- StaticHost *h;
-
- assert(s);
- assert(eg);
-
- h = userdata;
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_COLLISION:
- avahi_log_error("Host name conflict for \"%s\", not established.", h->host);
- break;
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
- avahi_log_notice ("Static host name \"%s\" successfully established.", h->host);
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- avahi_log_notice ("Failed to establish static host name \"%s\": %s.", h->host, avahi_strerror (avahi_server_errno (s)));
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static StaticHost *static_host_new(void) {
- StaticHost *s;
-
- s = avahi_new(StaticHost, 1);
-
- s->group = NULL;
- s->host = NULL;
- s->ip = NULL;
-
- AVAHI_LLIST_PREPEND(StaticHost, hosts, hosts, s);
-
- return s;
-}
-
-static void static_host_free(StaticHost *s) {
- assert(s);
-
- AVAHI_LLIST_REMOVE(StaticHost, hosts, hosts, s);
-
- if (s->group)
- avahi_s_entry_group_free (s->group);
-
- avahi_free(s->host);
- avahi_free(s->ip);
-
- avahi_free(s);
-}
-
-static void add_static_host_to_server(StaticHost *h)
-{
- AvahiAddress a;
- int err;
-
- if (!h->group)
- if (!(h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h))) {
- avahi_log_error("avahi_s_entry_group_new() failed: %s", avahi_strerror(err));
- return;
- }
-
- if (!avahi_address_parse (h->ip, AVAHI_PROTO_UNSPEC, &a)) {
- avahi_log_error("Static host name %s: avahi_address_parse failed", h->host);
- return;
- }
-
- if ((err = avahi_server_add_address(avahi_server, h->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, h->host, &a))) {
- avahi_log_error ("Static host name %s: avahi_server_add_address failure: %s", h->host, avahi_strerror(err));
- return;
- }
-
- avahi_s_entry_group_commit (h->group);
-}
-
-static void remove_static_host_from_server(StaticHost *h)
-{
- if (h->group)
- avahi_s_entry_group_reset (h->group);
-}
-
-void static_hosts_add_to_server(void) {
- StaticHost *h;
-
- for (h = hosts; h; h = h->hosts_next) {
- add_static_host_to_server(h);
- }
-}
-
-void static_hosts_remove_from_server(void) {
- StaticHost *h;
-
- for (h = hosts; h; h = h->hosts_next) {
- remove_static_host_from_server(h);
- }
-}
-
-void static_hosts_load(int in_chroot) {
- FILE *f;
- unsigned int line = 0;
- const char *filename = (in_chroot ? "/hosts" : AVAHI_CONFIG_DIR "/hosts");
-
- if (!(f = fopen(filename, "r")))
- {
- if (errno != ENOENT)
- avahi_log_error ("Failed to open static hosts file: %s", strerror (errno));
- return;
- }
-
- while (!feof(f)) {
- unsigned int len;
- char ln[256], *s;
- char *host, *ip;
- StaticHost *h;
-
- if (!fgets(ln, sizeof (ln), f))
- break;
-
- line++;
-
- /* Find the start of the line, ignore whitespace */
- s = ln + strspn(ln, " \t");
- /* Set the end of the string to NULL */
- s[strcspn(s, "#\r\n")] = 0;
-
- /* Ignore blank lines */
- if (*s == 0)
- continue;
-
- /* Read the first string (ip) up to the next whitespace */
- len = strcspn(s, " \t");
- ip = avahi_strndup(s, len);
-
- /* Skip past it */
- s += len;
-
- /* Find the next token */
- s += strspn(s, " \t");
- len = strcspn(s, " \t");
- host = avahi_strndup(s, len);
-
- if (*host == 0)
- {
- avahi_log_error("%s:%d: Error, unexpected end of line!", filename, line);
- avahi_free(host);
- avahi_free(ip);
- break;
- }
-
- /* Skip over the host */
- s += len;
-
- /* Skip past any more spaces */
- s += strspn(s, " \t");
-
- /* Anything left? */
- if (*s != 0) {
- avahi_log_error ("%s:%d: Junk on the end of the line!", filename, line);
- avahi_free(host);
- avahi_free(ip);
- break;
- }
-
- h = static_host_new();
- h->host = host;
- h->ip = ip;
- }
-
- fclose(f);
-}
-
-void static_hosts_free_all (void)
-{
- while(hosts)
- static_host_free(hosts);
-}
diff --git a/trunk/avahi-daemon/static-hosts.h b/trunk/avahi-daemon/static-hosts.h
deleted file mode 100644
index 2fdb0bd..0000000
--- a/trunk/avahi-daemon/static-hosts.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foostatichostshfoo
-#define foostatichostshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-void static_hosts_load(int in_chroot);
-void static_hosts_free_all(void);
-void static_hosts_add_to_server(void);
-void static_hosts_remove_from_server(void);
-
-#endif
diff --git a/trunk/avahi-daemon/static-services.c b/trunk/avahi-daemon/static-services.c
deleted file mode 100644
index 4df6047..0000000
--- a/trunk/avahi-daemon/static-services.c
+++ /dev/null
@@ -1,727 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/stat.h>
-#include <glob.h>
-#include <limits.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <expat.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/error.h>
-#include <avahi-core/log.h>
-#include <avahi-core/publish.h>
-
-#include "main.h"
-#include "static-services.h"
-
-typedef struct StaticService StaticService;
-typedef struct StaticServiceGroup StaticServiceGroup;
-
-struct StaticService {
- StaticServiceGroup *group;
-
- char *type;
- char *domain_name;
- char *host_name;
- uint16_t port;
- int protocol;
-
- AvahiStringList *subtypes;
-
- AvahiStringList *txt_records;
-
- AVAHI_LLIST_FIELDS(StaticService, services);
-};
-
-struct StaticServiceGroup {
- char *filename;
- time_t mtime;
-
- char *name, *chosen_name;
- int replace_wildcards;
-
- AvahiSEntryGroup *entry_group;
- AVAHI_LLIST_HEAD(StaticService, services);
- AVAHI_LLIST_FIELDS(StaticServiceGroup, groups);
-};
-
-static AVAHI_LLIST_HEAD(StaticServiceGroup, groups) = NULL;
-
-static char *replacestr(const char *pattern, const char *a, const char *b) {
- char *r = NULL, *e, *n;
-
- while ((e = strstr(pattern, a))) {
- char *k;
-
- k = avahi_strndup(pattern, e - pattern);
- if (r)
- n = avahi_strdup_printf("%s%s%s", r, k, b);
- else
- n = avahi_strdup_printf("%s%s", k, b);
-
- avahi_free(k);
- avahi_free(r);
- r = n;
-
- pattern = e + strlen(a);
- }
-
- if (!r)
- return avahi_strdup(pattern);
-
- n = avahi_strdup_printf("%s%s", r, pattern);
- avahi_free(r);
-
- return n;
-}
-
-static void add_static_service_group_to_server(StaticServiceGroup *g);
-static void remove_static_service_group_from_server(StaticServiceGroup *g);
-
-static StaticService *static_service_new(StaticServiceGroup *group) {
- StaticService *s;
-
- assert(group);
- s = avahi_new(StaticService, 1);
- s->group = group;
-
- s->type = s->host_name = s->domain_name = NULL;
- s->port = 0;
- s->protocol = AVAHI_PROTO_UNSPEC;
-
- s->txt_records = NULL;
- s->subtypes = NULL;
-
- AVAHI_LLIST_PREPEND(StaticService, services, group->services, s);
-
- return s;
-}
-
-static StaticServiceGroup *static_service_group_new(char *filename) {
- StaticServiceGroup *g;
- assert(filename);
-
- g = avahi_new(StaticServiceGroup, 1);
- g->filename = avahi_strdup(filename);
- g->mtime = 0;
- g->name = g->chosen_name = NULL;
- g->replace_wildcards = 0;
- g->entry_group = NULL;
-
- AVAHI_LLIST_HEAD_INIT(StaticService, g->services);
- AVAHI_LLIST_PREPEND(StaticServiceGroup, groups, groups, g);
-
- return g;
-}
-
-static void static_service_free(StaticService *s) {
- assert(s);
-
- AVAHI_LLIST_REMOVE(StaticService, services, s->group->services, s);
-
- avahi_free(s->type);
- avahi_free(s->host_name);
- avahi_free(s->domain_name);
-
- avahi_string_list_free(s->txt_records);
- avahi_string_list_free(s->subtypes);
-
- avahi_free(s);
-}
-
-static void static_service_group_free(StaticServiceGroup *g) {
- assert(g);
-
- if (g->entry_group)
- avahi_s_entry_group_free(g->entry_group);
-
- while (g->services)
- static_service_free(g->services);
-
- AVAHI_LLIST_REMOVE(StaticServiceGroup, groups, groups, g);
-
- avahi_free(g->filename);
- avahi_free(g->name);
- avahi_free(g->chosen_name);
- avahi_free(g);
-}
-
-static void entry_group_callback(AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGroup *eg, AvahiEntryGroupState state, void* userdata) {
- StaticServiceGroup *g = userdata;
-
- assert(s);
- assert(g);
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
-
- remove_static_service_group_from_server(g);
-
- n = avahi_alternative_service_name(g->chosen_name);
- avahi_free(g->chosen_name);
- g->chosen_name = n;
-
- avahi_log_notice("Service name conflict for \"%s\" (%s), retrying with \"%s\".", g->name, g->filename, g->chosen_name);
-
- add_static_service_group_to_server(g);
- break;
- }
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
- avahi_log_info("Service \"%s\" (%s) successfully established.", g->chosen_name, g->filename);
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
- avahi_log_warn("Failed to publish service \"%s\" (%s): %s", g->chosen_name, g->filename, avahi_strerror(avahi_server_errno(s)));
- remove_static_service_group_from_server(g);
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void add_static_service_group_to_server(StaticServiceGroup *g) {
- StaticService *s;
-
- assert(g);
-
- if (g->entry_group && !avahi_s_entry_group_is_empty(g->entry_group))
- /* This service group is already registered in the server */
- return;
-
- if (!g->chosen_name || (g->replace_wildcards && strstr(g->name, "%h"))) {
-
- avahi_free(g->chosen_name);
-
- if (g->replace_wildcards)
- g->chosen_name = replacestr(g->name, "%h", avahi_server_get_host_name(avahi_server));
- else
- g->chosen_name = avahi_strdup(g->name);
-
- }
-
- if (!g->entry_group)
- g->entry_group = avahi_s_entry_group_new(avahi_server, entry_group_callback, g);
-
- assert(avahi_s_entry_group_is_empty(g->entry_group));
-
- for (s = g->services; s; s = s->services_next) {
- AvahiStringList *i;
-
- if (avahi_server_add_service_strlst(
- avahi_server,
- g->entry_group,
- AVAHI_IF_UNSPEC, s->protocol,
- 0,
- g->chosen_name, s->type, s->domain_name,
- s->host_name, s->port,
- s->txt_records) < 0) {
- avahi_log_error("Failed to add service '%s' of type '%s', ignoring service group (%s): %s",
- g->chosen_name, s->type, g->filename,
- avahi_strerror(avahi_server_errno(avahi_server)));
- remove_static_service_group_from_server(g);
- return;
- }
-
- for (i = s->subtypes; i; i = i->next) {
-
- if (avahi_server_add_service_subtype(
- avahi_server,
- g->entry_group,
- AVAHI_IF_UNSPEC, s->protocol,
- 0,
- g->chosen_name, s->type, s->domain_name,
- (char*) i->text) < 0) {
-
- avahi_log_error("Failed to add subtype '%s' for service '%s' of type '%s', ignoring subtype (%s): %s",
- i->text, g->chosen_name, s->type, g->filename,
- avahi_strerror(avahi_server_errno(avahi_server)));
- }
- }
- }
-
- avahi_s_entry_group_commit(g->entry_group);
-}
-
-static void remove_static_service_group_from_server(StaticServiceGroup *g) {
- assert(g);
-
- if (g->entry_group)
- avahi_s_entry_group_reset(g->entry_group);
-}
-
-typedef enum {
- XML_TAG_INVALID,
- XML_TAG_SERVICE_GROUP,
- XML_TAG_NAME,
- XML_TAG_SERVICE,
- XML_TAG_TYPE,
- XML_TAG_SUBTYPE,
- XML_TAG_DOMAIN_NAME,
- XML_TAG_HOST_NAME,
- XML_TAG_PORT,
- XML_TAG_TXT_RECORD
-} xml_tag_name;
-
-struct xml_userdata {
- StaticServiceGroup *group;
- StaticService *service;
- xml_tag_name current_tag;
- int failed;
- char *buf;
-};
-
-#ifndef XMLCALL
-#define XMLCALL
-#endif
-
-static void XMLCALL xml_start(void *data, const char *el, const char *attr[]) {
- struct xml_userdata *u = data;
-
- assert(u);
-
- if (u->failed)
- return;
-
- if (u->current_tag == XML_TAG_INVALID && strcmp(el, "service-group") == 0) {
-
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_SERVICE_GROUP;
- } else if (u->current_tag == XML_TAG_SERVICE_GROUP && strcmp(el, "name") == 0) {
- u->current_tag = XML_TAG_NAME;
-
- if (attr[0]) {
- if (strcmp(attr[0], "replace-wildcards") == 0)
- u->group->replace_wildcards = strcmp(attr[1], "yes") == 0;
- else
- goto invalid_attr;
-
- if (attr[2])
- goto invalid_attr;
- }
-
- } else if (u->current_tag == XML_TAG_SERVICE_GROUP && strcmp(el, "service") == 0) {
- u->current_tag = XML_TAG_SERVICE;
-
- assert(!u->service);
- u->service = static_service_new(u->group);
-
- if (attr[0]) {
- if (strcmp(attr[0], "protocol") == 0) {
- AvahiProtocol protocol;
-
- if (strcmp(attr[1], "ipv4") == 0) {
- protocol = AVAHI_PROTO_INET;
- } else if (strcmp(attr[1], "ipv6") == 0) {
- protocol = AVAHI_PROTO_INET6;
- } else if (strcmp(attr[1], "any") == 0) {
- protocol = AVAHI_PROTO_UNSPEC;
- } else {
- avahi_log_error("%s: parse failure: invalid protocol specification \"%s\".", u->group->filename, attr[1]);
- u->failed = 1;
- return;
- }
-
- u->service->protocol = protocol;
- } else
- goto invalid_attr;
-
- if (attr[2])
- goto invalid_attr;
- }
-
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "type") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_TYPE;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "subtype") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_SUBTYPE;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "domain-name") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_DOMAIN_NAME;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "host-name") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_HOST_NAME;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "port") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_PORT;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "txt-record") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_TXT_RECORD;
- } else {
- avahi_log_error("%s: parse failure: didn't expect element <%s>.", u->group->filename, el);
- u->failed = 1;
- }
-
- return;
-
-invalid_attr:
- avahi_log_error("%s: parse failure: invalid attribute for element <%s>.", u->group->filename, el);
- u->failed = 1;
- return;
-}
-
-static void XMLCALL xml_end(void *data, AVAHI_GCC_UNUSED const char *el) {
- struct xml_userdata *u = data;
- assert(u);
-
- if (u->failed)
- return;
-
- switch (u->current_tag) {
- case XML_TAG_SERVICE_GROUP:
-
- if (!u->group->name || !u->group->services) {
- avahi_log_error("%s: parse failure: service group incomplete.", u->group->filename);
- u->failed = 1;
- return;
- }
-
- u->current_tag = XML_TAG_INVALID;
- break;
-
- case XML_TAG_SERVICE:
-
- if (!u->service->type) {
- avahi_log_error("%s: parse failure: service incomplete.", u->group->filename);
- u->failed = 1;
- return;
- }
-
- u->service = NULL;
- u->current_tag = XML_TAG_SERVICE_GROUP;
- break;
-
- case XML_TAG_NAME:
- u->current_tag = XML_TAG_SERVICE_GROUP;
- break;
-
- case XML_TAG_PORT: {
- int p;
- assert(u->service);
-
- p = u->buf ? atoi(u->buf) : 0;
-
- if (p < 0 || p > 0xFFFF) {
- avahi_log_error("%s: parse failure: invalid port specification \"%s\".", u->group->filename, u->buf);
- u->failed = 1;
- return;
- }
-
- u->service->port = (uint16_t) p;
-
- u->current_tag = XML_TAG_SERVICE;
- break;
- }
-
- case XML_TAG_TXT_RECORD: {
- assert(u->service);
-
- u->service->txt_records = avahi_string_list_add(u->service->txt_records, u->buf ? u->buf : "");
- u->current_tag = XML_TAG_SERVICE;
- break;
- }
-
- case XML_TAG_SUBTYPE: {
- assert(u->service);
-
- u->service->subtypes = avahi_string_list_add(u->service->subtypes, u->buf ? u->buf : "");
- u->current_tag = XML_TAG_SERVICE;
- break;
- }
-
- case XML_TAG_TYPE:
- case XML_TAG_DOMAIN_NAME:
- case XML_TAG_HOST_NAME:
- u->current_tag = XML_TAG_SERVICE;
- break;
-
- case XML_TAG_INVALID:
- ;
- }
-
- avahi_free(u->buf);
- u->buf = NULL;
-}
-
-static char *append_cdata(char *t, const char *n, int length) {
- char *r, *k;
-
- if (!length)
- return t;
-
-
- k = avahi_strndup(n, length);
-
- if (t) {
- r = avahi_strdup_printf("%s%s", t, k);
- avahi_free(k);
- avahi_free(t);
- } else
- r = k;
-
- return r;
-}
-
-static void XMLCALL xml_cdata(void *data, const XML_Char *s, int len) {
- struct xml_userdata *u = data;
- assert(u);
-
- if (u->failed)
- return;
-
- switch (u->current_tag) {
- case XML_TAG_NAME:
- u->group->name = append_cdata(u->group->name, s, len);
- break;
-
- case XML_TAG_TYPE:
- assert(u->service);
- u->service->type = append_cdata(u->service->type, s, len);
- break;
-
- case XML_TAG_DOMAIN_NAME:
- assert(u->service);
- u->service->domain_name = append_cdata(u->service->domain_name, s, len);
- break;
-
- case XML_TAG_HOST_NAME:
- assert(u->service);
- u->service->host_name = append_cdata(u->service->host_name, s, len);
- break;
-
- case XML_TAG_PORT:
- case XML_TAG_TXT_RECORD:
- case XML_TAG_SUBTYPE:
- assert(u->service);
- u->buf = append_cdata(u->buf, s, len);
- break;
-
- case XML_TAG_SERVICE_GROUP:
- case XML_TAG_SERVICE:
- case XML_TAG_INVALID:
- ;
- }
-}
-
-static int static_service_group_load(StaticServiceGroup *g) {
- XML_Parser parser = NULL;
- int fd = -1;
- struct xml_userdata u;
- int r = -1;
- struct stat st;
- ssize_t n;
-
- assert(g);
-
- u.buf = NULL;
- u.group = g;
- u.service = NULL;
- u.current_tag = XML_TAG_INVALID;
- u.failed = 0;
-
- /* Cleanup old data in this service group, if available */
- remove_static_service_group_from_server(g);
- while (g->services)
- static_service_free(g->services);
-
- avahi_free(g->name);
- avahi_free(g->chosen_name);
- g->name = g->chosen_name = NULL;
- g->replace_wildcards = 0;
-
- if (!(parser = XML_ParserCreate(NULL))) {
- avahi_log_error("XML_ParserCreate() failed.");
- goto finish;
- }
-
- if ((fd = open(g->filename, O_RDONLY)) < 0) {
- avahi_log_error("open(\"%s\", O_RDONLY): %s", g->filename, strerror(errno));
- goto finish;
- }
-
- if (fstat(fd, &st) < 0) {
- avahi_log_error("fstat(): %s", strerror(errno));
- goto finish;
- }
-
- g->mtime = st.st_mtime;
-
- XML_SetUserData(parser, &u);
-
- XML_SetElementHandler(parser, xml_start, xml_end);
- XML_SetCharacterDataHandler(parser, xml_cdata);
-
- do {
- void *buffer;
-
-#define BUFSIZE (10*1024)
-
- if (!(buffer = XML_GetBuffer(parser, BUFSIZE))) {
- avahi_log_error("XML_GetBuffer() failed.");
- goto finish;
- }
-
- if ((n = read(fd, buffer, BUFSIZE)) < 0) {
- avahi_log_error("read(): %s\n", strerror(errno));
- goto finish;
- }
-
- if (!XML_ParseBuffer(parser, n, n == 0)) {
- avahi_log_error("XML_ParseBuffer() failed at line %d: %s.\n", (int) XML_GetCurrentLineNumber(parser), XML_ErrorString(XML_GetErrorCode(parser)));
- goto finish;
- }
-
- } while (n != 0);
-
- if (!u.failed)
- r = 0;
-
-finish:
-
- if (fd >= 0)
- close(fd);
-
- if (parser)
- XML_ParserFree(parser);
-
- avahi_free(u.buf);
-
- return r;
-}
-
-static void load_file(char *n) {
- StaticServiceGroup *g;
- assert(n);
-
- for (g = groups; g; g = g->groups_next)
- if (strcmp(g->filename, n) == 0)
- return;
-
- avahi_log_info("Loading service file %s.", n);
-
- g = static_service_group_new(n);
- if (static_service_group_load(g) < 0) {
- avahi_log_error("Failed to load service group file %s, ignoring.", g->filename);
- static_service_group_free(g);
- }
-}
-
-void static_service_load(int in_chroot) {
- StaticServiceGroup *g, *n;
- glob_t globbuf;
- int globret;
- char **p;
-
- for (g = groups; g; g = n) {
- struct stat st;
-
- n = g->groups_next;
-
- if (stat(g->filename, &st) < 0) {
-
- if (errno == ENOENT)
- avahi_log_info("Service group file %s vanished, removing services.", g->filename);
- else
- avahi_log_warn("Failed to stat() file %s, ignoring: %s", g->filename, strerror(errno));
-
- static_service_group_free(g);
- } else if (st.st_mtime != g->mtime) {
- avahi_log_info("Service group file %s changed, reloading.", g->filename);
-
- if (static_service_group_load(g) < 0) {
- avahi_log_warn("Failed to load service group file %s, removing service.", g->filename);
- static_service_group_free(g);
- }
- }
- }
-
- memset(&globbuf, 0, sizeof(globbuf));
- if ((globret = glob(in_chroot ? "/services/*.service" : AVAHI_SERVICE_DIR "/*.service", GLOB_ERR, NULL, &globbuf)) != 0)
- switch (globret) {
- case GLOB_NOSPACE:
- avahi_log_error("Not enough memory to read service directory.");
- break;
-
- case GLOB_ABORTED:
- avahi_log_error("Failed to read %s.", AVAHI_SERVICE_DIR);
- break;
-
- case GLOB_NOMATCH:
- avahi_log_info("No service found in %s.", AVAHI_SERVICE_DIR);
- break;
- }
- else {
- for (p = globbuf.gl_pathv; *p; p++)
- load_file(*p);
-
- globfree(&globbuf);
- }
-}
-
-void static_service_free_all(void) {
-
- while (groups)
- static_service_group_free(groups);
-}
-
-void static_service_add_to_server(void) {
- StaticServiceGroup *g;
-
- for (g = groups; g; g = g->groups_next)
- add_static_service_group_to_server(g);
-}
-
-void static_service_remove_from_server(void) {
- StaticServiceGroup *g;
-
- for (g = groups; g; g = g->groups_next)
- remove_static_service_group_from_server(g);
-}
diff --git a/trunk/avahi-daemon/static-services.h b/trunk/avahi-daemon/static-services.h
deleted file mode 100644
index a2bc355..0000000
--- a/trunk/avahi-daemon/static-services.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foostaticserviceshfoo
-#define foostaticserviceshfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-void static_service_load(int in_chroot);
-void static_service_free_all(void);
-void static_service_add_to_server(void);
-void static_service_remove_from_server(void);
-
-#endif
diff --git a/trunk/avahi-discover-standalone/Makefile.am b/trunk/avahi-discover-standalone/Makefile.am
deleted file mode 100644
index e20797b..0000000
--- a/trunk/avahi-discover-standalone/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-interfaces = \
- avahi-discover.glade
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_GTK
-bin_PROGRAMS = \
- avahi-discover-standalone
-
-avahi_discover_standalone_SOURCES = \
- main.c
-
-avahi_discover_standalone_CFLAGS = \
- $(AM_CFLAGS) \
- $(GLIB20_CFLAGS) $(GTK20_CFLAGS) $(GLADE20_CFLAGS)\
- -DAVAHI_INTERFACES_DIR=\"$(interfacesdir)\"
-
-avahi_discover_standalone_LDADD = \
- $(AM_LDADD) \
- ../avahi-common/libavahi-common.la \
- ../avahi-glib/libavahi-glib.la \
- ../avahi-core/libavahi-core.la \
- $(GLIB20_LIBS) $(GTK20_LIBS) $(GLADE20_LIBS)
-
-interfaces_DATA = $(interfaces)
-
-else
-
-if HAVE_PYTHON_DBUS
-
-interfaces_DATA = $(interfaces)
-
-endif
-endif
-
-EXTRA_DIST = \
- $(interfaces) \
- avahi-discover.gladep
diff --git a/trunk/avahi-discover-standalone/avahi-discover.glade b/trunk/avahi-discover-standalone/avahi-discover.glade
deleted file mode 100644
index bb456c2..0000000
--- a/trunk/avahi-discover-standalone/avahi-discover.glade
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkWindow" id="main_window">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Avahi Discovery</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="default_width">500</property>
- <property name="default_height">400</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <signal handler="gtk_main_quit" name="destroy" after="False"/>
-
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkTreeView" id="tree_view">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</property>
- <signal name="cursor_changed" handler="on_tree_view_cursor_changed" last_modification_time="Sat, 30 Jul 2005 21:39:13 GMT"/>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="info_label">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">&lt;i&gt;No service currently selected.&lt;/i&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/trunk/avahi-discover-standalone/avahi-discover.gladep b/trunk/avahi-discover-standalone/avahi-discover.gladep
deleted file mode 100644
index a9feaa6..0000000
--- a/trunk/avahi-discover-standalone/avahi-discover.gladep
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
-
-<glade-project>
- <name>Avahi-discover</name>
- <program_name>avahi-discover</program_name>
- <gnome_support>FALSE</gnome_support>
-</glade-project>
diff --git a/trunk/avahi-discover-standalone/main.c b/trunk/avahi-discover-standalone/main.c
deleted file mode 100644
index 90c74f3..0000000
--- a/trunk/avahi-discover-standalone/main.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/ioctl.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <unistd.h>
-
-#include <gtk/gtk.h>
-#include <glade/glade.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/lookup.h>
-
-#include <avahi-common/strlst.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/error.h>
-
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
-
-struct ServiceType;
-
-struct Service {
- struct ServiceType *service_type;
- gchar *service_name;
- gchar *domain_name;
-
- AvahiIfIndex interface;
- AvahiProtocol protocol;
-
- GtkTreeRowReference *tree_ref;
-};
-
-struct ServiceType {
- gchar *service_type;
- AvahiSServiceBrowser *browser;
-
- GList *services;
- GtkTreeRowReference *tree_ref;
-};
-
-static GtkWidget *main_window = NULL;
-static GtkTreeView *tree_view = NULL;
-static GtkTreeStore *tree_store = NULL;
-static GtkLabel *info_label = NULL;
-static AvahiServer *server = NULL;
-static AvahiSServiceTypeBrowser *service_type_browser = NULL;
-static GHashTable *service_type_hash_table = NULL;
-static AvahiSServiceResolver *service_resolver = NULL;
-static struct Service *current_service = NULL;
-
-static struct Service *get_service(const gchar *service_type, const gchar *service_name, const gchar*domain_name, AvahiIfIndex interface, AvahiProtocol protocol) {
- struct ServiceType *st;
- GList *l;
-
- if (!(st = g_hash_table_lookup(service_type_hash_table, service_type)))
- return NULL;
-
- for (l = st->services; l; l = l->next) {
- struct Service *s = l->data;
-
- if (s->interface == interface &&
- s->protocol == protocol &&
- avahi_domain_equal(s->service_name, service_name) &&
- avahi_domain_equal(s->domain_name, domain_name))
- return s;
- }
-
- return NULL;
-}
-
-static void free_service(struct Service *s) {
- GtkTreeIter iter;
- GtkTreePath *path;
-
- if (current_service == s) {
- current_service = NULL;
-
- if (service_resolver) {
- avahi_s_service_resolver_free(service_resolver);
- service_resolver = NULL;
- }
-
- gtk_label_set_text(info_label, "<i>Service removed</i>");
- }
-
- s->service_type->services = g_list_remove(s->service_type->services, s);
-
- if ((path = gtk_tree_row_reference_get_path(s->tree_ref))) {
- gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &iter, path);
- gtk_tree_path_free(path);
- }
-
- gtk_tree_store_remove(tree_store, &iter);
-
- gtk_tree_row_reference_free(s->tree_ref);
-
- g_free(s->service_name);
- g_free(s->domain_name);
- g_free(s);
-}
-
-static void service_browser_callback(
- AVAHI_GCC_UNUSED AvahiSServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *service_name,
- const char *service_type,
- const char *domain_name,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- if (event == AVAHI_BROWSER_NEW) {
- struct Service *s;
- GtkTreeIter iter, piter;
- GtkTreePath *path, *ppath;
- gchar iface[256];
- char name[IF_NAMESIZE];
-
- s = g_new(struct Service, 1);
- s->service_name = g_strdup(service_name);
- s->domain_name = g_strdup(domain_name);
- s->interface = interface;
- s->protocol = protocol;
- s->service_type = g_hash_table_lookup(service_type_hash_table, service_type);
- g_assert(s->service_type);
-
- s->service_type->services = g_list_prepend(s->service_type->services, s);
-
- ppath = gtk_tree_row_reference_get_path(s->service_type->tree_ref);
- gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &piter, ppath);
-
- snprintf(iface, sizeof(iface), "%s %s", if_indextoname(interface, name), avahi_proto_to_string(protocol));
-
- gtk_tree_store_append(tree_store, &iter, &piter);
- gtk_tree_store_set(tree_store, &iter, 0, s->service_name, 1, iface, 2, s, -1);
-
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store), &iter);
- s->tree_ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(tree_store), path);
- gtk_tree_path_free(path);
-
- gtk_tree_view_expand_row(tree_view, ppath, FALSE);
- gtk_tree_path_free(ppath);
-
-
- } else if (event == AVAHI_BROWSER_REMOVE) {
- struct Service* s;
-
- if ((s = get_service(service_type, service_name, domain_name, interface, protocol)))
- free_service(s);
- }
-}
-
-static void service_type_browser_callback(
- AVAHI_GCC_UNUSED AvahiSServiceTypeBrowser *b,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *service_type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void * userdata) {
-
- struct ServiceType *st;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- if (event != AVAHI_BROWSER_NEW)
- return;
-
- if (g_hash_table_lookup(service_type_hash_table, service_type))
- return;
-
- st = g_new(struct ServiceType, 1);
- st->service_type = g_strdup(service_type);
- st->services = NULL;
-
- gtk_tree_store_append(tree_store, &iter, NULL);
- gtk_tree_store_set(tree_store, &iter, 0, st->service_type, 1, "", 2, NULL, -1);
-
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(tree_store), &iter);
- st->tree_ref = gtk_tree_row_reference_new(GTK_TREE_MODEL(tree_store), path);
- gtk_tree_path_free(path);
-
- g_hash_table_insert(service_type_hash_table, st->service_type, st);
-
- st->browser = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, st->service_type, domain, 0, service_browser_callback, NULL);
-}
-
-static void update_label(struct Service *s, const gchar *hostname, const AvahiAddress *a, guint16 port, AvahiStringList *txt) {
- gchar t[512], address[64], *txt_s;
- char name[IF_NAMESIZE];
-
- if (a && hostname) {
- char na[AVAHI_ADDRESS_STR_MAX];
- avahi_address_snprint(na, sizeof(na), a);
- snprintf(address, sizeof(address), "%s/%s:%u", hostname, na, port);
-
- if (txt)
- txt_s = avahi_string_list_to_string(txt);
- else
- txt_s = g_strdup("<i>empty</i>");
- } else {
- snprintf(address, sizeof(address), "<i>n/a</i>");
- txt_s = g_strdup("<i>n/a</i>");
- }
-
- snprintf(t, sizeof(t),
- "<b>Service Type:</b> %s\n"
- "<b>Service Name:</b> %s\n"
- "<b>Domain Name:</b> %s\n"
- "<b>Interface:</b> %s %s\n"
- "<b>Address:</b> %s\n"
- "<b>TXT Data:</b> %s",
- s->service_type->service_type,
- s->service_name,
- s->domain_name,
- if_indextoname(s->interface,name), avahi_proto_to_string(s->protocol),
- address,
- txt_s);
-
- gtk_label_set_markup(info_label, t);
-
- g_free(txt_s);
-}
-
-static struct Service *get_service_on_cursor(void) {
- GtkTreePath *path;
- struct Service *s;
- GtkTreeIter iter;
-
- gtk_tree_view_get_cursor(tree_view, &path, NULL);
-
- if (!path)
- return NULL;
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(tree_store), &iter, path);
- gtk_tree_model_get(GTK_TREE_MODEL(tree_store), &iter, 2, &s, -1);
- gtk_tree_path_free(path);
-
- return s;
-}
-
-static void service_resolver_callback(
- AvahiSServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- AVAHI_GCC_UNUSED const char *name,
- AVAHI_GCC_UNUSED const char *type,
- AVAHI_GCC_UNUSED const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- struct Service *s;
- g_assert(r);
-
- if (!(s = get_service_on_cursor()) || userdata != s) {
- g_assert(r == service_resolver);
- avahi_s_service_resolver_free(service_resolver);
- service_resolver = NULL;
- return;
- }
-
- if (event == AVAHI_RESOLVER_FAILURE) {
- char t[256];
- snprintf(t, sizeof(t), "<i>Failed to resolve: %s.</i>", avahi_strerror(avahi_server_errno(server)));
- gtk_label_set_markup(info_label, t);
- } else if (event == AVAHI_RESOLVER_FOUND)
- update_label(s, host_name, a, port, txt);
-}
-
-static void tree_view_on_cursor_changed(AVAHI_GCC_UNUSED GtkTreeView *tv, AVAHI_GCC_UNUSED gpointer userdata) {
- struct Service *s;
-
- if (!(s = get_service_on_cursor()))
- return;
-
- if (service_resolver)
- avahi_s_service_resolver_free(service_resolver);
-
- update_label(s, NULL, NULL, 0, NULL);
-
- service_resolver = avahi_s_service_resolver_new(server, s->interface, s->protocol, s->service_name, s->service_type->service_type, s->domain_name, AVAHI_PROTO_UNSPEC, 0, service_resolver_callback, s);
-}
-
-static gboolean main_window_on_delete_event(AVAHI_GCC_UNUSED GtkWidget *widget, AVAHI_GCC_UNUSED GdkEvent *event, AVAHI_GCC_UNUSED gpointer user_data) {
- gtk_main_quit();
- return FALSE;
-}
-
-int main(int argc, char *argv[]) {
- GladeXML *xml;
- AvahiServerConfig config;
- GtkTreeViewColumn *c;
- gint error;
- AvahiGLibPoll *poll_api;
-
- gtk_init(&argc, &argv);
- glade_init();
-
- avahi_set_allocator(avahi_glib_allocator());
-
- poll_api = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
-
- xml = glade_xml_new(AVAHI_INTERFACES_DIR"avahi-discover.glade", NULL, NULL);
- main_window = glade_xml_get_widget(xml, "main_window");
- g_signal_connect(main_window, "delete-event", (GCallback) main_window_on_delete_event, NULL);
-
- tree_view = GTK_TREE_VIEW(glade_xml_get_widget(xml, "tree_view"));
- g_signal_connect(GTK_WIDGET(tree_view), "cursor-changed", (GCallback) tree_view_on_cursor_changed, NULL);
-
- info_label = GTK_LABEL(glade_xml_get_widget(xml, "info_label"));
-
- tree_store = gtk_tree_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
- gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(tree_store));
- gtk_tree_view_insert_column_with_attributes(tree_view, -1, "Name", gtk_cell_renderer_text_new(), "text", 0, NULL);
- gtk_tree_view_insert_column_with_attributes(tree_view, -1, "Interface", gtk_cell_renderer_text_new(), "text", 1, NULL);
-
- gtk_tree_view_column_set_resizable(c = gtk_tree_view_get_column(tree_view, 0), TRUE);
- gtk_tree_view_column_set_sizing(c, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
- gtk_tree_view_column_set_expand(c, TRUE);
-
- service_type_hash_table = g_hash_table_new((GHashFunc) avahi_domain_hash, (GEqualFunc) avahi_domain_equal);
-
- avahi_server_config_init(&config);
- config.publish_hinfo = config.publish_addresses = config.publish_domain = config.publish_workstation = FALSE;
- server = avahi_server_new(avahi_glib_poll_get(poll_api), &config, NULL, NULL, &error);
- avahi_server_config_free(&config);
-
- g_assert(server);
-
- service_type_browser = avahi_s_service_type_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, argc >= 2 ? argv[1] : NULL, 0, service_type_browser_callback, NULL);
-
- gtk_main();
-
- avahi_server_free(server);
- avahi_glib_poll_free(poll_api);
-
- return 0;
-}
diff --git a/trunk/avahi-dnsconfd/Makefile.am b/trunk/avahi-dnsconfd/Makefile.am
deleted file mode 100644
index 18b3adf..0000000
--- a/trunk/avahi-dnsconfd/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-if HAVE_EXPAT
-if HAVE_LIBDAEMON
-
-pkgsysconfdir=$(sysconfdir)/avahi
-
-AM_CFLAGS= \
- -I$(top_srcdir) \
- -DAVAHI_RUNTIME_DIR=\"$(avahi_runtime_dir)/\" \
- -DAVAHI_SOCKET=\"$(avahi_socket)\" \
- -DAVAHI_DNSCONF_SCRIPT=\"$(pkgsysconfdir)/avahi-dnsconfd.action\"
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-sbin_PROGRAMS = avahi-dnsconfd
-
-avahi_dnsconfd_SOURCES = main.c
-avahi_dnsconfd_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
-avahi_dnsconfd_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(LIBDAEMON_LIBS)
-
-pkgsysconf_SCRIPTS=avahi-dnsconfd.action
-
-endif
-endif
-
-EXTRA_DIST=avahi-dnsconfd.action
diff --git a/trunk/avahi-dnsconfd/avahi-dnsconfd.action b/trunk/avahi-dnsconfd/avahi-dnsconfd.action
deleted file mode 100755
index 9337a6d..0000000
--- a/trunk/avahi-dnsconfd/avahi-dnsconfd.action
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-set -e
-
-test "x$AVAHI_INTERFACE" != "x"
-
-# Command line arguments:
-# $1 "+" if a new DNS server was found, "-" if one was removed
-# $2 DNS Server address
-# $3 interface index where this server was found on
-# $4 protocol number where this server was found on
-
-# Available environment variables:
-#
-# $AVAHI_INTERFACE The interface name where this DNS server was found on
-# $AVAHI_INTERFACE_DNS_SERVERS A whitespace seperated list of DNS servers on $AVAHI_INTERFACE
-# $AVAHI_DNS_SERVERS The complete list of all DNS servers found on all interfaces
-
-if [ -x /sbin/resolvconf ] ; then
-
- # We have Debian's resolvconf tool
-
- if [ "x$AVAHI_INTERFACE_DNS_SERVERS" = "x" ] ; then
- /sbin/resolvconf -d "$AVAHI_INTERFACE.avahi"
- else
- for n in $AVAHI_INTERFACE_DNS_SERVERS ; do
- echo "nameserver $n"
- done | /sbin/resolvconf -a "$AVAHI_INTERFACE.avahi"
- fi
-else
-
- # No resolvconf tool available
-
- if [ "x$AVAHI_DNS_SERVERS" = "x" ] ; then
- test -f /etc/resolv.conf.avahi && mv /etc/resolv.conf.avahi /etc/resolv.conf
- else
- test -f /etc/resolv.conf.avahi || mv /etc/resolv.conf /etc/resolv.conf.avahi
-
- for n in $AVAHI_DNS_SERVERS ; do
- echo "nameserver $n"
- done > /etc/resolv.conf
- fi
-fi
diff --git a/trunk/avahi-dnsconfd/main.c b/trunk/avahi-dnsconfd/main.c
deleted file mode 100644
index d2fcf71..0000000
--- a/trunk/avahi-dnsconfd/main.c
+++ /dev/null
@@ -1,663 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/select.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include <getopt.h>
-#include <assert.h>
-#include <inttypes.h>
-#include <stdlib.h>
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/address.h>
-
-#include <libdaemon/dfork.h>
-#include <libdaemon/dsignal.h>
-#include <libdaemon/dlog.h>
-#include <libdaemon/dpid.h>
-#include <libdaemon/dexec.h>
-
-#define BROWSE_DNS_SERVERS "BROWSE-DNS-SERVERS\n"
-
-#define ENV_INTERFACE_DNS_SERVERS "AVAHI_INTERFACE_DNS_SERVERS"
-#define ENV_DNS_SERVERS "AVAHI_DNS_SERVERS"
-#define ENV_INTERFACE "AVAHI_INTERFACE"
-
-static enum {
- ACKWAIT,
- BROWSING
-} state = ACKWAIT;
-
-static enum {
- DAEMON_RUN,
- DAEMON_KILL,
- DAEMON_REFRESH,
- DAEMON_VERSION,
- DAEMON_HELP,
- DAEMON_CHECK
-} command = DAEMON_RUN;
-
-static int quit = 0;
-static int daemonize = 0;
-
-#if !HAVE_DECL_ENVIRON
-extern char **environ;
-#endif
-
-typedef struct DNSServerInfo DNSServerInfo;
-
-struct DNSServerInfo {
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- char *address;
- AVAHI_LLIST_FIELDS(DNSServerInfo, servers);
-};
-
-static AVAHI_LLIST_HEAD(DNSServerInfo, servers);
-
-static void server_info_free(DNSServerInfo *i) {
- assert(i);
-
- avahi_free(i->address);
-
- AVAHI_LLIST_REMOVE(DNSServerInfo, servers, servers, i);
- avahi_free(i);
-}
-
-static DNSServerInfo* get_server_info(AvahiIfIndex interface, AvahiProtocol protocol, const char *address) {
- DNSServerInfo *i;
- assert(address);
-
- for (i = servers; i; i = i->servers_next)
- if (i->interface == interface &&
- i->protocol == protocol &&
- strcmp(i->address, address) == 0)
- return i;
-
- return NULL;
-}
-
-static DNSServerInfo* new_server_info(AvahiIfIndex interface, AvahiProtocol protocol, const char *address) {
- DNSServerInfo *i;
-
- assert(address);
-
- i = avahi_new(DNSServerInfo, 1);
- i->interface = interface;
- i->protocol = protocol;
- i->address = avahi_strdup(address);
-
- AVAHI_LLIST_PREPEND(DNSServerInfo, servers, servers, i);
-
- return i;
-}
-
-static int set_cloexec(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFD)) < 0)
- return -1;
-
- if (n & FD_CLOEXEC)
- return 0;
-
- return fcntl(fd, F_SETFD, n|FD_CLOEXEC);
-}
-
-static int open_socket(void) {
- int fd = -1;
- struct sockaddr_un sa;
-
- if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- daemon_log(LOG_ERR, "socket(): %s", strerror(errno));
- goto fail;
- }
-
- if (set_cloexec(fd) < 0) {
- daemon_log(LOG_ERR, "fcntl(): %s", strerror(errno));
- goto fail;
- }
-
- memset(&sa, 0, sizeof(sa));
- sa.sun_family = AF_UNIX;
- strncpy(sa.sun_path, AVAHI_SOCKET, sizeof(sa.sun_path)-1);
- sa.sun_path[sizeof(sa.sun_path)-1] = 0;
-
- if (connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
- daemon_log(LOG_ERR, "connect(): %s", strerror(errno));
- daemon_log(LOG_INFO, "Failed to connect to the daemon. This probably means that you");
- daemon_log(LOG_INFO, "didn't start avahi-daemon before avahi-dnsconfd.");
- goto fail;
- }
-
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-static ssize_t loop_write(int fd, const void*data, size_t size) {
-
- ssize_t ret = 0;
- assert(fd >= 0 && data && size);
-
- while (size > 0) {
- ssize_t r;
-
- if ((r = write(fd, data, size)) < 0)
- return r;
-
- if (r == 0)
- break;
-
- ret += r;
- data = (const uint8_t*) data + r;
- size -= r;
- }
-
- return ret;
-}
-
-static char *concat_dns_servers(AvahiIfIndex interface) {
- DNSServerInfo *i;
- char *r = NULL;
-
- for (i = servers; i; i = i->servers_next)
- if (i->interface == interface || interface <= 0) {
- DNSServerInfo *j;
- char *t;
-
- /* Filter out double entries */
- for (j = servers; j != i; j = j->servers_next)
- if (j->interface == interface || interface <= 0)
- if (strcmp(i->address, j->address) == 0)
- break;
-
- if (j != i)
- continue;
-
- if (!r)
- t = avahi_strdup(i->address);
- else
- t = avahi_strdup_printf("%s %s", r, i->address);
-
- avahi_free(r);
- r = t;
- }
-
- return r;
-}
-
-static void set_env(const char *name, const char *value) {
- char **e;
- size_t l;
-
- assert(name);
- assert(value);
-
- l = strlen(name);
-
- for (e = environ; *e; e++) {
- /* Search for the variable */
- if (strlen(*e) < l+1)
- continue;
-
- if (strncmp(*e, name, l) != 0 || (*e)[l] != '=')
- continue;
-
- /* We simply free the record, sicne we know that we created it previously */
- avahi_free(*e);
- *e = avahi_strdup_printf("%s=%s", name, value);
- return;
- }
-
- assert(0);
-}
-
-static void run_script(int new, AvahiIfIndex interface, AvahiProtocol protocol, const char *address) {
- char *p;
- int ret;
- char ia[16], pa[16];
- char name[IF_NAMESIZE];
-
- assert(interface > 0);
-
- if (!if_indextoname(interface, name))
- return;
-
- p = concat_dns_servers(interface);
- set_env(ENV_INTERFACE_DNS_SERVERS, p ? p : "");
- avahi_free(p);
-
- p = concat_dns_servers(-1);
- set_env(ENV_DNS_SERVERS, p ? p : "");
- avahi_free(p);
-
- set_env(ENV_INTERFACE, name);
-
- snprintf(ia, sizeof(ia), "%i", (int) interface);
- snprintf(pa, sizeof(pa), "%i", (int) protocol);
-
- if (daemon_exec("/", &ret, AVAHI_DNSCONF_SCRIPT, AVAHI_DNSCONF_SCRIPT, new ? "+" : "-", address, ia, pa, avahi_proto_to_string(protocol), NULL) < 0)
- daemon_log(LOG_WARNING, "Failed to run script");
- else if (ret != 0)
- daemon_log(LOG_WARNING, "Script returned with non-zero exit code %i", ret);
-}
-
-static int new_line(const char *l) {
- assert(l);
-
- if (state == ACKWAIT) {
- if (*l != '+') {
- daemon_log(LOG_ERR, "Avahi command failed: %s", l);
- return -1;
- }
-
- daemon_log(LOG_INFO, "Successfully connected to Avahi daemon.");
- state = BROWSING;
- } else {
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- int i_interface, i_protocol, port;
- char a[AVAHI_ADDRESS_STR_MAX];
-
- assert(state == BROWSING);
-
- if (*l != '<' && *l != '>') {
- daemon_log(LOG_ERR, "Avahi sent us an invalid browsing line: %s", l);
- return -1;
- }
-
- if (sscanf(l+1, "%i %i %39s %i", &i_interface, &i_protocol, a, &port) != 4) {
- daemon_log(LOG_ERR, "Failed to parse browsing line: %s", l);
- return -1;
- }
-
- interface = (AvahiIfIndex) i_interface;
- protocol = (AvahiProtocol) i_protocol;
-
- if (*l == '>') {
- if (port != 53)
- daemon_log(LOG_WARNING, "DNS server with port address != 53 found, ignoring");
- else {
- daemon_log(LOG_INFO, "New DNS Server %s (interface: %i.%s)", a, interface, avahi_proto_to_string(protocol));
- new_server_info(interface, protocol, a);
- run_script(1, interface, protocol, a);
- }
- } else {
- DNSServerInfo *i;
-
- if (port == 53)
- if ((i = get_server_info(interface, protocol, a))) {
- daemon_log(LOG_INFO, "DNS Server %s removed (interface: %i.%s)", a, interface, avahi_proto_to_string(protocol));
- server_info_free(i);
- run_script(0, interface, protocol, a);
- }
- }
-
- }
-
- return 0;
-}
-
-static int do_connect(void) {
- int fd = -1;
-
- if ((fd = open_socket()) < 0)
- goto fail;
-
- if (loop_write(fd, BROWSE_DNS_SERVERS, sizeof(BROWSE_DNS_SERVERS)-1) < 0) {
- daemon_log(LOG_ERR, "write(): %s", strerror(errno));
- goto fail;
- }
-
- state = ACKWAIT;
- return fd;
-
-fail:
- if (fd >= 0)
- close(fd);
-
- return -1;
-}
-
-static void free_dns_server_info_list(void) {
- while (servers) {
- AvahiIfIndex interface = servers->interface;
- AvahiProtocol protocol = servers->protocol;
- char *address = avahi_strdup(servers->address);
- server_info_free(servers);
-
- run_script(0, interface, protocol, address);
- avahi_free(address);
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- fprintf(f,
- "%s [options]\n"
- " -h --help Show this help\n"
- " -D --daemonize Daemonize after startup\n"
- " -k --kill Kill a running daemon\n"
- " -r --refresh Request a running daemon to refresh DNS server data\n"
- " -c --check Return 0 if a daemon is already running\n"
- " -V --version Show version\n",
- argv0);
-}
-
-static int parse_command_line(int argc, char *argv[]) {
- int c;
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "daemonize", no_argument, NULL, 'D' },
- { "kill", no_argument, NULL, 'k' },
- { "version", no_argument, NULL, 'V' },
- { "refresh", no_argument, NULL, 'r' },
- { "check", no_argument, NULL, 'c' },
- { NULL, 0, NULL, 0 }
- };
-
- opterr = 0;
- while ((c = getopt_long(argc, argv, "hDkVrc", long_options, NULL)) >= 0) {
-
- switch(c) {
- case 'h':
- command = DAEMON_HELP;
- break;
- case 'D':
- daemonize = 1;
- break;
- case 'k':
- command = DAEMON_KILL;
- break;
- case 'V':
- command = DAEMON_VERSION;
- break;
- case 'r':
- command = DAEMON_REFRESH;
- break;
- case 'c':
- command = DAEMON_CHECK;
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", c);
- return -1;
- }
- }
-
- if (optind < argc) {
- fprintf(stderr, "Too many arguments\n");
- return -1;
- }
-
- return 0;
-}
-
-static int run_daemon(void) {
- int fd = -1, ret = -1;
- char buf[1024];
- size_t buflen = 0;
-
- AVAHI_LLIST_HEAD_INIT(DNSServerInfo, servers);
-
- daemon_signal_init(SIGINT, SIGTERM, SIGCHLD, SIGHUP, 0);
-
- /* Allocate some memory for our environment variables */
- putenv(avahi_strdup(ENV_INTERFACE"="));
- putenv(avahi_strdup(ENV_DNS_SERVERS"="));
- putenv(avahi_strdup(ENV_INTERFACE_DNS_SERVERS"="));
-
- if ((fd = do_connect()) < 0)
- goto finish;
-
- if (daemonize)
- daemon_retval_send(0);
-
- ret = 0;
-
- while (!quit) {
- fd_set rfds, wfds;
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
-
- FD_SET(fd, &rfds);
- FD_SET(daemon_signal_fd(), &rfds);
-
- for (;;) {
- if (select(fd+1, &rfds, NULL, NULL, NULL) < 0) {
- if (errno == EINTR)
- continue;
-
- daemon_log(LOG_ERR, "select(): %s", strerror(errno));
- goto finish;
- }
-
- break;
- }
-
- if (FD_ISSET(daemon_signal_fd(), &rfds)) {
-
- int sig;
-
- if ((sig = daemon_signal_next()) <= 0) {
- daemon_log(LOG_ERR, "daemon_signal_next() failed");
- goto finish;
- }
-
- switch(sig) {
- case SIGINT:
- case SIGTERM:
- daemon_log(LOG_INFO, "Got %s, quitting.", sig == SIGINT ? "SIGINT" : "SIGTERM");
- ret = 0;
- goto finish;
-
- case SIGCHLD:
- waitpid(-1, NULL, WNOHANG);
- break;
-
- case SIGHUP:
- daemon_log(LOG_INFO, "Refreshing DNS Server list");
-
- close(fd);
- free_dns_server_info_list();
-
- if ((fd = do_connect()) < 0)
- goto finish;
-
- break;
- }
-
- } else if (FD_ISSET(fd, &rfds)) {
- ssize_t r;
- char *n;
-
- if ((r = read(fd, buf, sizeof(buf) - buflen - 1)) <= 0) {
- daemon_log(LOG_ERR, "read(): %s", r < 0 ? strerror(errno) : "EOF");
- goto finish;
- }
-
- buflen += r;
- assert(buflen <= sizeof(buf)-1);
-
- while ((n = memchr(buf, '\n', buflen))) {
- *(n++) = 0;
-
- if (new_line(buf) < 0)
- goto finish;
-
- buflen -= (n - buf);
- memmove(buf, n, buflen);
- }
-
- if (buflen >= sizeof(buf)-1) {
- /* The incoming line is horribly long */
- buf[sizeof(buf)-1] = 0;
-
- if (new_line(buf) < 0)
- goto finish;
-
- buflen = 0;
- }
- }
- }
-
-finish:
-
- free_dns_server_info_list();
-
- if (fd >= 0)
- close(fd);
-
- daemon_signal_done();
-
- if (ret != 0 && daemonize)
- daemon_retval_send(1);
-
- return ret;
-}
-
-static const char* pid_file_proc(void) {
- return AVAHI_RUNTIME_DIR"/avahi-dnsconfd.pid";
-}
-
-int main(int argc, char *argv[]) {
- char *argv0;
- int r = 1;
- int wrote_pid_file = 0;
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- daemon_pid_file_ident = daemon_log_ident = argv0;
- daemon_pid_file_proc = pid_file_proc;
-
- if (parse_command_line(argc, argv) < 0)
- goto finish;
-
- if (command == DAEMON_RUN) {
- pid_t pid;
-
- if (getuid() != 0) {
- daemon_log(LOG_ERR, "This program is intended to be run as root.");
- goto finish;
- }
-
- if ((pid = daemon_pid_file_is_running()) >= 0) {
- daemon_log(LOG_ERR, "Daemon already running on PID %u", pid);
- goto finish;
- }
-
- if (daemonize) {
- daemon_retval_init();
-
- if ((pid = daemon_fork()) < 0)
- goto finish;
- else if (pid != 0) {
- int ret;
- /** Parent **/
-
- if ((ret = daemon_retval_wait(20)) < 0) {
- daemon_log(LOG_ERR, "Could not receive return value from daemon process.");
- goto finish;
- }
-
- r = ret;
- goto finish;
- }
-
- /* Child */
- }
-
- chdir("/");
-
- if (daemon_pid_file_create() < 0) {
- daemon_log(LOG_ERR, "Failed to create PID file: %s", strerror(errno));
-
- if (daemonize)
- daemon_retval_send(1);
- goto finish;
- } else
- wrote_pid_file = 1;
-
- if (run_daemon() < 0)
- goto finish;
-
- r = 0;
- } else if (command == DAEMON_HELP) {
- help(stdout, argv0);
-
- r = 0;
- } else if (command == DAEMON_VERSION) {
- printf("%s "PACKAGE_VERSION"\n", argv0);
-
- r = 0;
- } else if (command == DAEMON_KILL) {
- if (daemon_pid_file_kill_wait(SIGTERM, 5) < 0) {
- daemon_log(LOG_WARNING, "Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
- } else if (command == DAEMON_REFRESH) {
- if (daemon_pid_file_kill(SIGHUP) < 0) {
- daemon_log(LOG_WARNING, "Failed to kill daemon: %s", strerror(errno));
- goto finish;
- }
-
- r = 0;
- } else if (command == DAEMON_CHECK)
- r = (daemon_pid_file_is_running() >= 0) ? 0 : 1;
-
-
-finish:
-
- if (daemonize)
- daemon_retval_done();
-
- if (wrote_pid_file)
- daemon_pid_file_remove();
-
- return r;
-}
diff --git a/trunk/avahi-glib.pc.in b/trunk/avahi-glib.pc.in
deleted file mode 100644
index f163e89..0000000
--- a/trunk/avahi-glib.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-glib
-Description: Avahi Multicast DNS Responder (GLib Support)
-Version: @PACKAGE_VERSION@
-Requires: glib-2.0
-Libs: -L${libdir} -lavahi-glib
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/trunk/avahi-glib/Makefile.am b/trunk/avahi-glib/Makefile.am
deleted file mode 100644
index 69bd51e..0000000
--- a/trunk/avahi-glib/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_GLIB
-
-avahiincludedir=$(includedir)/avahi-glib
-
-avahiinclude_HEADERS = \
- glib-watch.h \
- glib-malloc.h
-
-lib_LTLIBRARIES = \
- libavahi-glib.la
-
-if ENABLE_TESTS
-
-noinst_PROGRAMS = \
- glib-watch-test
-
-endif
-
-libavahi_glib_la_SOURCES = \
- glib-watch.c glib-watch.h \
- glib-malloc.h glib-malloc.c
-libavahi_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-libavahi_glib_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
-libavahi_glib_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_GLIB_VERSION_INFO)
-
-glib_watch_test_SOURCES = \
- glib-watch.c glib-watch.h \
- glib-watch-test.c
-glib_watch_test_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-glib_watch_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
-
-endif
diff --git a/trunk/avahi-glib/glib-malloc.c b/trunk/avahi-glib/glib-malloc.c
deleted file mode 100644
index 2968abc..0000000
--- a/trunk/avahi-glib/glib-malloc.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-
-#include "glib-malloc.h"
-
-static void* malloc_glue(size_t l) {
- return g_malloc(l);
-}
-
-static void* realloc_glue(void *p, size_t l) {
- return g_realloc(p, l);
-}
-
-static void* calloc_glue(size_t nmemb, size_t size) {
- return g_malloc0(nmemb * size);
-}
-
-const AvahiAllocator *avahi_glib_allocator(void) {
-
- static AvahiAllocator allocator;
- static int allocator_initialized = 0;
-
- if (!allocator_initialized) {
- allocator.malloc = malloc_glue;
- allocator.free = g_free;
- allocator.realloc = realloc_glue;
- allocator.calloc = calloc_glue;
- allocator_initialized = 1;
- }
-
- return &allocator;
-}
diff --git a/trunk/avahi-glib/glib-malloc.h b/trunk/avahi-glib/glib-malloc.h
deleted file mode 100644
index 675ccb5..0000000
--- a/trunk/avahi-glib/glib-malloc.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef fooglibmallochfoo
-#define fooglibmallochfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file glib-malloc.h GLib's memory allocator for Avahi */
-
-#include <glib.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/malloc.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Return a pointer to a memory allocator that uses GLib's g_malloc()
- and friends. The returned structure is statically allocated, and needs
- not to be copied or freed. Pass this directly to avahi_set_allocator(). */
-const AvahiAllocator * avahi_glib_allocator(void);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-glib/glib-watch-test.c b/trunk/avahi-glib/glib-watch-test.c
deleted file mode 100644
index 733c81f..0000000
--- a/trunk/avahi-glib/glib-watch-test.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-
-#include <avahi-common/watch.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/gccmacro.h>
-
-#include "glib-watch.h"
-
-static const AvahiPoll *api = NULL;
-static GMainLoop *loop = NULL;
-
-static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
-
- if (event & AVAHI_WATCH_IN) {
- ssize_t r;
- char c;
-
- if ((r = read(fd, &c, 1)) <= 0) {
- fprintf(stderr, "read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
- api->watch_free(w);
- return;
- }
-
- printf("Read: %c\n", c >= 32 && c < 127 ? c : '.');
- }
-}
-
-static void wakeup(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) {
- struct timeval tv;
- static int i = 0;
-
- printf("Wakeup #%i\n", i++);
-
- if (i > 10)
- g_main_loop_quit(loop);
-
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_update(t, &tv);
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
- AvahiGLibPoll *g;
- struct timeval tv;
-
- g = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
- assert(g);
-
- api = avahi_glib_poll_get(g);
-
- api->watch_new(api, 0, AVAHI_WATCH_IN, callback, NULL);
-
- avahi_elapse_time(&tv, 1000, 0);
- api->timeout_new(api, &tv, wakeup, NULL);
-
- loop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(loop);
- g_main_loop_unref(loop);
-
- avahi_glib_poll_free(g);
-
- return 0;
-}
diff --git a/trunk/avahi-glib/glib-watch.c b/trunk/avahi-glib/glib-watch.c
deleted file mode 100644
index f0fd934..0000000
--- a/trunk/avahi-glib/glib-watch.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/timeval.h>
-
-#include "glib-watch.h"
-
-struct AvahiWatch {
- AvahiGLibPoll *glib_poll;
- int dead;
-
- GPollFD pollfd;
- int pollfd_added;
-
- AvahiWatchCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiWatch, watches);
-};
-
-struct AvahiTimeout {
- AvahiGLibPoll *glib_poll;
- gboolean dead;
-
- gboolean enabled;
- struct timeval expiry;
-
- AvahiTimeoutCallback callback;
- void *userdata;
-
- AVAHI_LLIST_FIELDS(AvahiTimeout, timeouts);
-};
-
-struct AvahiGLibPoll {
- GSource source;
- AvahiPoll api;
- GMainContext *context;
-
- gboolean timeout_req_cleanup;
- gboolean watch_req_cleanup;
-
- AVAHI_LLIST_HEAD(AvahiWatch, watches);
- AVAHI_LLIST_HEAD(AvahiTimeout, timeouts);
-};
-
-static void destroy_watch(AvahiWatch *w) {
- assert(w);
-
- if (w->pollfd_added)
- g_source_remove_poll(&w->glib_poll->source, &w->pollfd);
-
- AVAHI_LLIST_REMOVE(AvahiWatch, watches, w->glib_poll->watches, w);
-
- avahi_free(w);
-}
-
-static void cleanup_watches(AvahiGLibPoll *g, int all) {
- AvahiWatch *w, *next;
- assert(g);
-
- for (w = g->watches; w; w = next) {
- next = w->watches_next;
-
- if (all || w->dead)
- destroy_watch(w);
- }
-
- g->watch_req_cleanup = 0;
-}
-
-static gushort map_events_to_glib(AvahiWatchEvent events) {
- return
- (events & AVAHI_WATCH_IN ? G_IO_IN : 0) |
- (events & AVAHI_WATCH_OUT ? G_IO_OUT : 0) |
- (events & AVAHI_WATCH_ERR ? G_IO_ERR : 0) |
- (events & AVAHI_WATCH_HUP ? G_IO_HUP : 0);
-}
-
-static AvahiWatchEvent map_events_from_glib(gushort events) {
- return
- (events & G_IO_IN ? AVAHI_WATCH_IN : 0) |
- (events & G_IO_OUT ? AVAHI_WATCH_OUT : 0) |
- (events & G_IO_ERR ? AVAHI_WATCH_ERR : 0) |
- (events & G_IO_HUP ? AVAHI_WATCH_HUP : 0);
-}
-
-static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent events, AvahiWatchCallback callback, void *userdata) {
- AvahiWatch *w;
- AvahiGLibPoll *g;
-
- assert(api);
- assert(fd >= 0);
- assert(callback);
-
- g = api->userdata;
- assert(g);
-
- if (!(w = avahi_new(AvahiWatch, 1)))
- return NULL;
-
- w->glib_poll = g;
- w->pollfd.fd = fd;
- w->pollfd.events = map_events_to_glib(events);
- w->pollfd.revents = 0;
- w->callback = callback;
- w->userdata = userdata;
- w->dead = FALSE;
-
- g_source_add_poll(&g->source, &w->pollfd);
- w->pollfd_added = TRUE;
-
- AVAHI_LLIST_PREPEND(AvahiWatch, watches, g->watches, w);
-
- return w;
-}
-
-static void watch_update(AvahiWatch *w, AvahiWatchEvent events) {
- assert(w);
- assert(!w->dead);
-
- w->pollfd.events = map_events_to_glib(events);
-}
-
-static AvahiWatchEvent watch_get_events(AvahiWatch *w) {
- assert(w);
- assert(!w->dead);
-
- return map_events_from_glib(w->pollfd.revents);
-}
-
-static void watch_free(AvahiWatch *w) {
- assert(w);
- assert(!w->dead);
-
- if (w->pollfd_added) {
- g_source_remove_poll(&w->glib_poll->source, &w->pollfd);
- w->pollfd_added = FALSE;
- }
-
- w->dead = TRUE;
- w->glib_poll->timeout_req_cleanup = TRUE;
-}
-
-static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
- AvahiTimeout *t;
- AvahiGLibPoll *g;
-
- assert(api);
- assert(callback);
-
- g = api->userdata;
- assert(g);
-
- if (!(t = avahi_new(AvahiTimeout, 1)))
- return NULL;
-
- t->glib_poll = g;
- t->dead = FALSE;
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-
- t->callback = callback;
- t->userdata = userdata;
-
- AVAHI_LLIST_PREPEND(AvahiTimeout, timeouts, g->timeouts, t);
-
- return t;
-}
-
-static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
- assert(t);
- assert(!t->dead);
-
- if ((t->enabled = !!tv))
- t->expiry = *tv;
-}
-
-static void timeout_free(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
-
- t->dead = TRUE;
- t->glib_poll->timeout_req_cleanup = TRUE;
-}
-
-static void destroy_timeout(AvahiTimeout *t) {
- assert(t);
-
- AVAHI_LLIST_REMOVE(AvahiTimeout, timeouts, t->glib_poll->timeouts, t);
- avahi_free(t);
-}
-
-static void cleanup_timeouts(AvahiGLibPoll *g, int all) {
- AvahiTimeout *t, *next;
- assert(g);
-
- for (t = g->timeouts; t; t = next) {
- next = t->timeouts_next;
-
- if (all || t->dead)
- destroy_timeout(t);
- }
-
- g->timeout_req_cleanup = FALSE;
-}
-
-static AvahiTimeout* find_next_timeout(AvahiGLibPoll *g) {
- AvahiTimeout *t, *n = NULL;
- assert(g);
-
- for (t = g->timeouts; t; t = t->timeouts_next) {
-
- if (t->dead || !t->enabled)
- continue;
-
- if (!n || avahi_timeval_compare(&t->expiry, &n->expiry) < 0)
- n = t;
- }
-
- return n;
-}
-
-static void start_timeout_callback(AvahiTimeout *t) {
- assert(t);
- assert(!t->dead);
- assert(t->enabled);
-
- t->enabled = 0;
- t->callback(t, t->userdata);
-}
-
-static gboolean prepare_func(GSource *source, gint *timeout) {
- AvahiGLibPoll *g = (AvahiGLibPoll*) source;
- AvahiTimeout *next_timeout;
-
- g_assert(g);
- g_assert(timeout);
-
- if (g->watch_req_cleanup)
- cleanup_watches(g, 0);
-
- if (g->timeout_req_cleanup)
- cleanup_timeouts(g, 0);
-
- if ((next_timeout = find_next_timeout(g))) {
- GTimeVal now;
- struct timeval tvnow;
- AvahiUsec usec;
-
- g_source_get_current_time(source, &now);
- tvnow.tv_sec = now.tv_sec;
- tvnow.tv_usec = now.tv_usec;
-
- usec = avahi_timeval_diff(&next_timeout->expiry, &tvnow);
-
- if (usec <= 0) {
- *timeout = 0;
- return TRUE;
- }
-
- *timeout = (gint) (usec / 1000);
- } else
- *timeout = -1;
-
- return FALSE;
-}
-
-static gboolean check_func(GSource *source) {
- AvahiGLibPoll *g = (AvahiGLibPoll*) source;
- AvahiWatch *w;
- AvahiTimeout *next_timeout;
-
- g_assert(g);
-
- if ((next_timeout = find_next_timeout(g))) {
- GTimeVal now;
- struct timeval tvnow;
- g_source_get_current_time(source, &now);
- tvnow.tv_sec = now.tv_sec;
- tvnow.tv_usec = now.tv_usec;
-
- if (avahi_timeval_compare(&next_timeout->expiry, &tvnow) <= 0)
- return TRUE;
- }
-
- for (w = g->watches; w; w = w->watches_next)
- if (w->pollfd.revents > 0)
- return TRUE;
-
- return FALSE;
-}
-
-static gboolean dispatch_func(GSource *source, AVAHI_GCC_UNUSED GSourceFunc callback, AVAHI_GCC_UNUSED gpointer userdata) {
- AvahiGLibPoll* g = (AvahiGLibPoll*) source;
- AvahiWatch *w;
- AvahiTimeout *next_timeout;
-
- g_assert(g);
-
- if ((next_timeout = find_next_timeout(g))) {
- GTimeVal now;
- struct timeval tvnow;
- g_source_get_current_time(source, &now);
- tvnow.tv_sec = now.tv_sec;
- tvnow.tv_usec = now.tv_usec;
-
- if (avahi_timeval_compare(&next_timeout->expiry, &tvnow) < 0) {
- start_timeout_callback(next_timeout);
- return TRUE;
- }
- }
-
- for (w = g->watches; w; w = w->watches_next)
- if (w->pollfd.revents > 0) {
- assert(w->callback);
- w->callback(w, w->pollfd.fd, map_events_from_glib(w->pollfd.revents), w->userdata);
- w->pollfd.revents = 0;
- return TRUE;
- }
-
- return TRUE;
-}
-
-AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority) {
- AvahiGLibPoll *g;
-
- static GSourceFuncs source_funcs = {
- prepare_func,
- check_func,
- dispatch_func,
- NULL,
- NULL,
- NULL
- };
-
- g = (AvahiGLibPoll*) g_source_new(&source_funcs, sizeof(AvahiGLibPoll));
- g_main_context_ref(g->context = context ? context : g_main_context_default());
-
- g->api.userdata = g;
-
- g->api.watch_new = watch_new;
- g->api.watch_free = watch_free;
- g->api.watch_update = watch_update;
- g->api.watch_get_events = watch_get_events;
-
- g->api.timeout_new = timeout_new;
- g->api.timeout_free = timeout_free;
- g->api.timeout_update = timeout_update;
-
- g->watch_req_cleanup = FALSE;
- g->timeout_req_cleanup = FALSE;
-
- AVAHI_LLIST_HEAD_INIT(AvahiWatch, g->watches);
- AVAHI_LLIST_HEAD_INIT(AvahiTimeout, g->timeouts);
-
- g_source_attach(&g->source, g->context);
- g_source_set_priority(&g->source, priority);
- g_source_set_can_recurse(&g->source, FALSE);
-
- return g;
-}
-
-void avahi_glib_poll_free(AvahiGLibPoll *g) {
- GSource *s = &g->source;
- assert(g);
-
- cleanup_watches(g, 1);
- cleanup_timeouts(g, 1);
-
- g_main_context_unref(g->context);
- g_source_destroy(s);
- g_source_unref(s);
-}
-
-const AvahiPoll* avahi_glib_poll_get(AvahiGLibPoll *g) {
- assert(g);
-
- return &g->api;
-}
diff --git a/trunk/avahi-glib/glib-watch.h b/trunk/avahi-glib/glib-watch.h
deleted file mode 100644
index 78f7742..0000000
--- a/trunk/avahi-glib/glib-watch.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef fooglibwatchhfoo
-#define fooglibwatchhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file glib-watch.h GLib main loop adapter */
-
-/** \example glib-integration.c Example of how to integrate
- * avahi use with GLIB/GTK applications */
-
-#include <glib.h>
-
-#include <avahi-common/cdecl.h>
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** GLib main loop adapter. You can safely cast this into a GSource */
-typedef struct AvahiGLibPoll AvahiGLibPoll;
-
-/** Create a new GLib main loop adapter attached to the specified
- context. If context is NULL, the default main loop context is
- used. You can attach as many AvahiGLibPoll objects to the same context
- as you want. priority takes one of GLib's G_PRIORITY constants. */
-AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority);
-
-/** Free GLib main loop adapter */
-void avahi_glib_poll_free(AvahiGLibPoll *g);
-
-/** Return the abstract poll API structure for this object. This will
- * return the same pointer to a internally allocated structure on each
- * call */
-const AvahiPoll *avahi_glib_poll_get(AvahiGLibPoll *g);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-python/Makefile.am b/trunk/avahi-python/Makefile.am
deleted file mode 100644
index 7f4980a..0000000
--- a/trunk/avahi-python/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-EXTRA_DIST = \
- avahi-bookmarks.in \
- avahi-discover.in \
- avahi-discover.desktop.in
-
-SUBDIRS=avahi
-
-if HAVE_PYTHON
-if HAVE_PYTHON_DBUS
-if HAVE_PYGTK
-
-pythonscripts = \
- avahi-bookmarks \
- avahi-discover
-
-desktopdir = $(datadir)/applications
-desktop_DATA = avahi-discover.desktop
-
-avahi-discover.desktop: avahi-discover.desktop.in
- sed -e 's,@bindir\@,$(bindir),g' $< > $@
- chmod +x $@
-
-avahi-discover: avahi-discover.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@interfacesdir\@,$(interfacesdir),g' $< > $@
- chmod +x $@
-
-avahi-bookmarks: avahi-bookmarks.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' $< > $@
- chmod +x $@
-
-bin_SCRIPTS = $(pythonscripts)
-CLEANFILES = $(pythonscripts) $(desktop_DATA)
-
-endif
-endif
-endif
diff --git a/trunk/avahi-python/avahi-bookmarks.in b/trunk/avahi-python/avahi-bookmarks.in
deleted file mode 100755
index 6466a22..0000000
--- a/trunk/avahi-python/avahi-bookmarks.in
+++ /dev/null
@@ -1,183 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import sys, getopt
-
-try:
- import avahi, gobject, dbus
-except ImportError:
- print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus."
- sys.exit(1)
-
-try:
- import dbus.glib
-except ImportError:
- pass
-
-try:
- from twisted.internet import glib2reactor
- glib2reactor.install()
- from twisted.internet import reactor
- from twisted.web import server, resource
-except ImportError:
- print "Sorry, to use this tool you need to install twisted and twisted.web."
- sys.exit(1)
-
-urlproto = { "_http._tcp" : "http", "_https._tcp" : "https", "_ftp._tcp" : "ftp" }
-
-port = 8080
-address = "127.0.0.1"
-use_host_names = None
-domain = "local"
-
-class AvahiBookmarks(resource.Resource):
- isLeaf = True
-
- services = {}
-
- def __init__(self, use_host_names):
- resource.Resource.__init__(self)
-
- self.bus = dbus.SystemBus()
- self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
-
- self.version_string = self.server.GetVersionString()
-
- self.browse_service_type("_http._tcp")
- self.browse_service_type("_https._tcp")
- self.browse_service_type("_ftp._tcp")
-
- if use_host_names is None:
- try:
- self.use_host_names = self.server.IsNSSSupportAvailable()
- except:
- self.use_host_names = False
- else:
- self.use_host_names = use_host_names
-
- def browse_service_type(self, stype):
-
- global domain
-
- browser = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, stype, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
- browser.connect_to_signal('ItemNew', self.new_service)
- browser.connect_to_signal('ItemRemove', self.remove_service)
-
- def find_path(self, txt):
-
- l = avahi.txt_array_to_string_array(txt)
-
- for k in l:
- if k[:5] == "path=":
- if k[5:].startswith("/"):
- return k[5:]
- else:
- return "/" + k[5:]
-
- return "/"
-
- def render_GET(self, request):
-
- t = '<html><head><title>Zeroconf Bookmarks</title></head><body><h1>Zeroconf Bookmarks</h1>'
-
- if len(self.services) == 0:
- t += '<p>Sorry, no web services have been registered on the local LAN.</p>'
- else:
- t += '<ul style="padding: 0px; margin: 20px; list-style-type: none">'
-
- for k, v in self.services.iteritems():
-
- if v[3] == 80:
- port = ''
- else:
- port = ':%i' % v[3]
-
- path = self.find_path(v[4])
- t += '<li><a href="%s://%s%s%s">%s</a></li>' % (urlproto[k[3]], v[2], port, path, k[2])
-
- t += '</ul>'
-
- t += '<hr noshade/><p style="font-size: 8; font-family: sans-serif">Served by %s</p></body></html>' % self.version_string
-
- return str(t)
-
-
- def new_service(self, interface, protocol, name, type, domain, flags):
-
- interface, protocol, name, type, domain, host, aprotocol, address, port, txt, flags = self.server.ResolveService(interface, protocol, name, type, domain, avahi.PROTO_UNSPEC, dbus.UInt32(0))
-
- if self.use_host_names:
- h = host
- else:
- if aprotocol == avahi.PROTO_INET6:
- h = "[" + address + "]"
- else:
- h = address
-
- self.services[(interface, protocol, name, type, domain)] = (host, aprotocol, h, port, txt)
-
- def remove_service(self, interface, protocol, name, type, domain):
- del self.services[(interface, protocol, name, type, domain)]
-
-
-def usage(retval = 0):
- print "%s [options]\n" % sys.argv[0]
- print " -h --help Show this help"
- print " -p --port PORT Specify the port to use (default %u)" % port
- print " -a --address ADDRESS Specify the address to bind to (default %s)" % address
- print " -H --host-names Show links with real hostnames"
- print " -A --addresses Show links with numeric IP addresses"
- print " -d --domain DOMAIN Specify the domain to browse"
- sys.exit(retval)
-
-try:
- opts, args = getopt.getopt(sys.argv[1:], "hp:a:HAd:", ["help", "port=", "address=", "host-names", "addresses", "domain="])
-except getopt.GetoptError:
- usage(2)
-
-for o, a in opts:
- if o in ("-h", "--help"):
- usage()
-
- if o in ("-p", "--port"):
- port = int(a)
-
- if o in ("-a", "--address"):
- address = a
-
- if o in ("-H", "--host-names"):
- use_host_names = True
-
- if o in ("-A", "--addresses"):
- use_host_names = False
-
- if o in ("-d", "--domain"):
- domain = a
-
-site = server.Site(AvahiBookmarks(use_host_names))
-reactor.listenTCP(port, site, interface=address)
-
-print "Now point your web browser to http://%s:%u/!" % (address, port)
-
-try:
- reactor.run()
-except KeyboardInterrupt, k:
- pass
diff --git a/trunk/avahi-python/avahi-discover.desktop.in b/trunk/avahi-python/avahi-discover.desktop.in
deleted file mode 100644
index c5d0d82..0000000
--- a/trunk/avahi-python/avahi-discover.desktop.in
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Encoding=UTF-8
-Name=Avahi Zeroconf Browser
-Comment=Browse for Zeroconf services available on your network
-Exec=@bindir@/avahi-discover
-Terminal=false
-Type=Application
-Icon=gnome-nettool
-Categories=GNOME;Application;System;Utility;
-StartupNotify=false
diff --git a/trunk/avahi-python/avahi-discover.in b/trunk/avahi-python/avahi-discover.in
deleted file mode 100755
index ce7ecf3..0000000
--- a/trunk/avahi-python/avahi-discover.in
+++ /dev/null
@@ -1,272 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import os, sys
-
-try:
- import avahi, gtk, gobject, dbus, avahi.ServiceTypeDatabase
- from avahi.SimpleGladeApp import SimpleGladeApp
-except ImportError, e:
- print "Sorry, to use this tool you need to install Avahi, pygtk and python-dbus.\n Error: %s" % e
- sys.exit(1)
-
-
-## !!NOTE!! ##
-# It's really important to do this, else you won't see any events
-##
-try:
-from dbus.dbus_bindings import DBusException
-
- import dbus.glib
-except ImportError, e:
- pass
-
-service_type_browsers = {}
-service_browsers = {}
-
-def error_msg(msg):
- d = gtk.MessageDialog(parent=None, flags=gtk.DIALOG_MODAL,
- type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
- d.set_markup(msg)
- d.show_all()
- d.run()
- d.destroy()
-
-glade_dir = "@interfacesdir@"
-
-service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase()
-
-class Main_window(SimpleGladeApp):
- def __init__(self, path="avahi-discover.glade", root="main_window", domain=None, **kwargs):
- path = os.path.join(glade_dir, path)
- gtk.window_set_default_icon_name("gnome-networktool")
- SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
-
- def on_tree_view_cursor_changed(self, widget, *args):
- (model, iter) = widget.get_selection().get_selected()
- (name,interface,protocol,stype,domain) = self.treemodel.get(iter,1,2,3,4,5)
- if stype == None:
- self.info_label.set_markup("<i>No service currently selected.</i>")
- return
- #Asynchronous resolving
- self.server.ResolveService( int(interface), int(protocol), name, stype, domain, avahi.PROTO_UNSPEC, dbus.UInt32(0), reply_handler=self.service_resolved, error_handler=self.print_error)
-
- def protoname(self,protocol):
- if protocol == avahi.PROTO_INET:
- return "IPv4"
- if protocol == avahi.PROTO_INET6:
- return "IPv6"
- return "n/a"
-
- def siocgifname(self, interface):
- if interface <= 0:
- return "n/a"
- else:
- return self.server.GetNetworkInterfaceNameByIndex(interface)
-
- def get_interface_name(self, interface, protocol):
- if interface == avahi.IF_UNSPEC and protocol == avahi.PROTO_UNSPEC:
- return "Wide Area"
- else:
- return str(self.siocgifname(interface)) + " " + str(self.protoname(protocol))
-
- def service_resolved(self, interface, protocol, name, stype, domain, host, aprotocol, address, port, txt, flags):
- print "Service data for service '%s' of type '%s' in domain '%s' on %i.%i:" % (name, stype, domain, interface, protocol)
-
- print "\tHost %s (%s), port %i, TXT data: %s" % (host, address, port, str(avahi.txt_array_to_string_array(txt)))
-
- self.update_label(interface, protocol, name, stype, domain, host, aprotocol, address, port, avahi.txt_array_to_string_array(txt))
-
- def print_error(self, err):
- error_label = "<b>Error:</b> %s" % (err)
- self.info_label.set_markup(error_label)
- print "Error:", str(err)
-
- def lookup_type(self, stype):
- global service_type_db
-
- try:
- return service_type_db[stype]
- except KeyError:
- return stype
-
- def new_service(self, interface, protocol, name, stype, domain, flags):
- print "Found service '%s' of type '%s' in domain '%s' on %i.%i." % (name, stype, domain, interface, protocol)
- if self.zc_ifaces.has_key((interface,protocol)) == False:
-
- ifn = self.get_interface_name(interface, protocol)
-
- self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, ifn, None,interface,protocol,None,domain)
- if self.zc_domains.has_key((interface,protocol,domain)) == False:
- self.zc_domains[(interface,protocol,domain)] = self.insert_row(self.treemodel, self.zc_ifaces[(interface,protocol)], domain,None,interface,protocol,None,domain)
- if self.zc_types.has_key((interface,protocol,stype,domain)) == False:
- thisDomain = self.zc_domains[(interface,protocol,domain)]
- self.zc_types[(interface,protocol,stype,domain)] = self.insert_row(self.treemodel, thisDomain, self.lookup_type(stype), name, interface,None,None,None)
- treeiter = self.insert_row(self.treemodel,self.zc_types[(interface,protocol,stype,domain)], name, name, interface,protocol,stype,domain)
- self.services_browsed[(interface, protocol, name, stype, domain)] = treeiter
- # expand the tree of this path
- self.tree_view.expand_to_path(self.treemodel.get_path(treeiter))
-
- def remove_service(self, interface, protocol, name, stype, domain, flags):
- print "Service '%s' of type '%s' in domain '%s' on %i.%i disappeared." % (name, stype, domain, interface, protocol)
- self.info_label.set_markup("")
- treeiter=self.services_browsed[(interface, protocol, name, stype, domain)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.services_browsed[(interface, protocol, name, stype, domain)]
- if self.treemodel.iter_has_child(parent) == False:
- treeiter=self.zc_types[(interface,protocol,stype,domain)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.zc_types[(interface,protocol,stype,domain)]
- if self.treemodel.iter_has_child(parent) == False:
- treeiter=self.zc_domains[(interface,protocol,domain)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.zc_domains[(interface,protocol,domain)]
- if self.treemodel.iter_has_child(parent) == False:
- treeiter=self.zc_ifaces[(interface,protocol)]
- parent = self.treemodel.iter_parent(treeiter)
- self.treemodel.remove(treeiter)
- del self.zc_ifaces[(interface,protocol)]
-
- def new_service_type(self, interface, protocol, stype, domain, flags):
- global service_browsers
-
- # Are we already browsing this domain for this type?
- if service_browsers.has_key((interface, protocol, stype, domain)):
- return
-
- print "Browsing for services of type '%s' in domain '%s' on %i.%i ..." % (stype, domain, interface, protocol)
-
- b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceBrowserNew(interface, protocol, stype, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_BROWSER)
- b.connect_to_signal('ItemNew', self.new_service)
- b.connect_to_signal('ItemRemove', self.remove_service)
-
- service_browsers[(interface, protocol, stype, domain)] = b
-
- def browse_domain(self, interface, protocol, domain):
- global service_type_browsers
-
- # Are we already browsing this domain?
- if service_type_browsers.has_key((interface, protocol, domain)):
- return
-
- if self.stype is None:
- print "Browsing domain '%s' on %i.%i ..." % (domain, interface, protocol)
-
- try:
- b = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.ServiceTypeBrowserNew(interface, protocol, domain, dbus.UInt32(0))), avahi.DBUS_INTERFACE_SERVICE_TYPE_BROWSER)
- except DBusException, e:
- print e
- error_msg("You should check that the avahi daemon is running.\n\nError : %s" % e)
- sys.exit(0)
-
- b.connect_to_signal('ItemNew', self.new_service_type)
-
- service_type_browsers[(interface, protocol, domain)] = b
- else:
- new_service_type(interface, protocol, stype, domain)
-
- def new_domain(self,interface, protocol, domain, flags):
- if self.zc_ifaces.has_key((interface,protocol)) == False:
- ifn = self.get_interface_name(interface, protocol)
- self.zc_ifaces[(interface,protocol)] = self.insert_row(self.treemodel, None, ifn,None,interface,protocol,None,domain)
- if self.zc_domains.has_key((interface,protocol,domain)) == False:
- self.zc_domains[(interface,protocol,domain)] = self.insert_row(self.treemodel, self.zc_ifaces[(interface,protocol)], domain,None,interface,protocol,None,domain)
- if domain != "local":
- self.browse_domain(interface, protocol, domain)
-
- def pair_to_dict(self, l):
- res = dict()
- for el in l:
- if "=" not in el:
- res[el]=''
- else:
- tmp = el.split('=',1)
- if len(tmp[0]) > 0:
- res[tmp[0]] = tmp[1]
- return res
-
-
- def update_label(self,interface, protocol, name, stype, domain, host, aprotocol, address, port, txt):
- if len(txt) != 0:
- txts = ""
- txtd = self.pair_to_dict(txt)
- for k,v in txtd.items():
- txts+="<b>TXT <i>%s</i></b> = %s\n" % (k,v)
- else:
- txts = "<b>TXT Data:</b> <i>empty</i>"
-
- infos = "<b>Service Type:</b> %s\n<b>Service Name:</b> %s\n<b>Domain Name:</b> %s\n<b>Interface:</b> %s %s\n<b>Address:</b> %s/%s:%i\n%s" % (stype, name, domain, self.siocgifname(interface), self.protoname(protocol), host, address, port, txts.strip())
- self.info_label.set_markup(infos)
-
- def insert_row(self, model,parent,
- content, name, interface,protocol,stype,domain):
- myiter=model.insert_after(parent,None)
- model.set(myiter,0,content,1,name,2,interface,3,protocol,4,stype,5,domain)
- return myiter
-
- def new(self):
- print "A new main_window has been created"
- self.treemodel=gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
- self.tree_view.set_model(self.treemodel)
-
- #creating the columns headers
- self.tree_view.set_headers_visible(False)
- renderer=gtk.CellRendererText()
- column=gtk.TreeViewColumn("",renderer, text=0)
- column.set_resizable(True)
- column.set_sizing("GTK_TREE_VIEW_COLUMN_GROW_ONLY");
- column.set_expand(True);
- self.tree_view.append_column(column)
-
- self.domain = None
- self.stype = None
- self.zc_ifaces = {}
- self.zc_domains = {}
- self.zc_types = {}
- self.services_browsed = {}
-
- self.bus = dbus.SystemBus()
- self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
-
- if self.domain is None:
- # Explicitly browse .local
- self.browse_domain(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "local")
-
- # Browse for other browsable domains
- db = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, self.server.DomainBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, "", avahi.DOMAIN_BROWSER_BROWSE, dbus.UInt32(0))), avahi.DBUS_INTERFACE_DOMAIN_BROWSER)
- db.connect_to_signal('ItemNew', self.new_domain)
- else:
- # Just browse the domain the user wants us to browse
- self.browse_domain(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, domain)
-
-
-def main():
- main_window = Main_window()
-
- main_window.run()
-
-if __name__ == "__main__":
- main()
-
-
diff --git a/trunk/avahi-python/avahi/Makefile.am b/trunk/avahi-python/avahi/Makefile.am
deleted file mode 100644
index db604bc..0000000
--- a/trunk/avahi-python/avahi/Makefile.am
+++ /dev/null
@@ -1,64 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-EXTRA_DIST = __init__.py SimpleGladeApp.py ServiceTypeDatabase.py.in
-
-if HAVE_PYTHON
-
-avahidir = $(pythondir)/avahi
-
-
-if HAVE_GDBM
-avahi_SCRIPTS = ServiceTypeDatabase.py
-
-ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,gdbm,g' \
- -e 's,@FIRST_KEY\@,key = self.db.firstkey(),g' \
- -e 's,@CHECK_KEY\@,while key is not None:,g' \
- -e 's,@NEXT_KEY\@,key = self.db.nextkey(key),g' \
- -e 's,@pkgdatadir\@,$(pkgdatadir),g' $< > $@
- chmod +x $@
-endif
-
-if HAVE_DBM
-avahi_SCRIPTS = ServiceTypeDatabase.py
-
-ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,dbm,g' \
- -e 's,@FIRST_KEY\@,keys = self.db.keys(),g' \
- -e 's,@CHECK_KEY\@,for key in keys:,g' \
- -e 's,@NEXT_KEY\@,,g' \
- -e 's,@pkgdatadir\@,$(pkgdatadir),g' $< > $@
- chmod +x $@
-endif
-
-if HAVE_PYGTK
-if HAVE_PYTHON_DBUS
-
-avahi_PYTHON = __init__.py SimpleGladeApp.py
-
-endif
-endif
-endif
-
-CLEANFILES=*.pyc *.pyo ServiceTypeDatabase.py
-
-
diff --git a/trunk/avahi-python/avahi/ServiceTypeDatabase.py.in b/trunk/avahi-python/avahi/ServiceTypeDatabase.py.in
deleted file mode 100644
index 95c03a4..0000000
--- a/trunk/avahi-python/avahi/ServiceTypeDatabase.py.in
+++ /dev/null
@@ -1,110 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import @DBM@
-import locale
-import re
-
-locale.setlocale(locale.LC_ALL, '')
-
-class ServiceTypeDatabase:
-
- def __init__(self, filename = "@pkgdatadir@/service-types.db"):
-
- self.db = @DBM@.open(filename, "r")
-
- l = locale.getlocale(locale.LC_MESSAGES)
-
- self.suffixes = ()
-
- if not l[0] is None:
-
- if not l[1] is None:
- self.suffixes += (l[0] + "@" + l[1], )
-
- self.suffixes += (l[0], )
-
- i = l[0].find("_")
-
- if i >= 0:
-
- k = l[0][:i]
-
- if not l[1] is None:
- self.suffixes += (k + "@" + l[1], )
-
- self.suffixes += (k, )
-
-
- self.suffixes = tuple(map(lambda x: "["+x+"]", self.suffixes)) + ("", )
-
- def __getitem__(self, key):
-
- for suffix in self.suffixes:
- try:
- return self.db[key + suffix]
- except KeyError:
- pass
-
- raise KeyError()
-
- def items(self):
-
- items = []
- @FIRST_KEY@
- @CHECK_KEY@
- if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key) and not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key):
- localized_service_name = self[key]
- items.append((key, localized_service_name))
- @NEXT_KEY@
- return items
-
- def has_key(self, key):
-
- for suffix in self.suffixes:
-
- if self.db.has_key(key + suffix):
- return True
-
- return False
-
- def __contains__(self, item):
-
- for suffix in self.suffixes:
-
- if item+suffix in self.db:
- return True
-
- return False
-
-
-
-if __name__ == "__main__":
-
- b = ServiceTypeDatabase()
- print b.items()
-
- print b["_http._tcp"]
- print b["_ftp._tcp"]
- print b["_webdav._tcp"]
- print b["_webdavs._tcp"]
-
- print b["gurki._tcp"]
diff --git a/trunk/avahi-python/avahi/SimpleGladeApp.py b/trunk/avahi-python/avahi/SimpleGladeApp.py
deleted file mode 100644
index 90c598c..0000000
--- a/trunk/avahi-python/avahi/SimpleGladeApp.py
+++ /dev/null
@@ -1,341 +0,0 @@
-"""
- SimpleGladeApp.py
- Module that provides an object oriented abstraction to pygtk and libglade.
- Copyright (C) 2004 Sandino Flores Moreno
-"""
-
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import sys
-import re
-
-import tokenize
-import gtk
-import gtk.glade
-import weakref
-import inspect
-
-__version__ = "1.0"
-__author__ = 'Sandino "tigrux" Flores-Moreno'
-
-def bindtextdomain(app_name, locale_dir=None):
- """
- Bind the domain represented by app_name to the locale directory locale_dir.
- It has the effect of loading translations, enabling applications for different
- languages.
-
- app_name:
- a domain to look for translations, tipically the name of an application.
-
- locale_dir:
- a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
- If omitted or None, then the current binding for app_name is used.
- """
- try:
- import locale
- import gettext
- locale.setlocale(locale.LC_ALL, "")
- gtk.glade.bindtextdomain(app_name, locale_dir)
- gettext.install(app_name, locale_dir, unicode=1)
- except (IOError,locale.Error), e:
- print "Warning", app_name, e
- __builtins__.__dict__["_"] = lambda x : x
-
-
-class SimpleGladeApp:
-
- def __init__(self, path, root=None, domain=None, **kwargs):
- """
- Load a glade file specified by glade_filename, using root as
- root widget and domain as the domain for translations.
-
- If it receives extra named arguments (argname=value), then they are used
- as attributes of the instance.
-
- path:
- path to a glade filename.
- If glade_filename cannot be found, then it will be searched in the
- same directory of the program (sys.argv[0])
-
- root:
- the name of the widget that is the root of the user interface,
- usually a window or dialog (a top level widget).
- If None or ommited, the full user interface is loaded.
-
- domain:
- A domain to use for loading translations.
- If None or ommited, no translation is loaded.
-
- **kwargs:
- a dictionary representing the named extra arguments.
- It is useful to set attributes of new instances, for example:
- glade_app = SimpleGladeApp("ui.glade", foo="some value", bar="another value")
- sets two attributes (foo and bar) to glade_app.
- """
- if os.path.isfile(path):
- self.glade_path = path
- else:
- glade_dir = os.path.dirname( sys.argv[0] )
- self.glade_path = os.path.join(glade_dir, path)
- for key, value in kwargs.items():
- try:
- setattr(self, key, weakref.proxy(value) )
- except TypeError:
- setattr(self, key, value)
- self.glade = None
- self.install_custom_handler(self.custom_handler)
- self.glade = self.create_glade(self.glade_path, root, domain)
- if root:
- self.main_widget = self.get_widget(root)
- else:
- self.main_widget = None
- self.normalize_names()
- self.add_callbacks(self)
- self.new()
-
- def __repr__(self):
- class_name = self.__class__.__name__
- if self.main_widget:
- root = gtk.Widget.get_name(self.main_widget)
- repr = '%s(path="%s", root="%s")' % (class_name, self.glade_path, root)
- else:
- repr = '%s(path="%s")' % (class_name, self.glade_path)
- return repr
-
- def new(self):
- """
- Method called when the user interface is loaded and ready to be used.
- At this moment, the widgets are loaded and can be refered as self.widget_name
- """
- pass
-
- def add_callbacks(self, callbacks_proxy):
- """
- It uses the methods of callbacks_proxy as callbacks.
- The callbacks are specified by using:
- Properties window -> Signals tab
- in glade-2 (or any other gui designer like gazpacho).
-
- Methods of classes inheriting from SimpleGladeApp are used as
- callbacks automatically.
-
- callbacks_proxy:
- an instance with methods as code of callbacks.
- It means it has methods like on_button1_clicked, on_entry1_activate, etc.
- """
- self.glade.signal_autoconnect(callbacks_proxy)
-
- def normalize_names(self):
- """
- It is internally used to normalize the name of the widgets.
- It means a widget named foo:vbox-dialog in glade
- is refered self.vbox_dialog in the code.
-
- It also sets a data "prefixes" with the list of
- prefixes a widget has for each widget.
- """
- for widget in self.get_widgets():
- widget_name = gtk.Widget.get_name(widget)
- prefixes_name_l = widget_name.split(":")
- prefixes = prefixes_name_l[ : -1]
- widget_api_name = prefixes_name_l[-1]
- widget_api_name = "_".join( re.findall(tokenize.Name, widget_api_name) )
- gtk.Widget.set_name(widget, widget_api_name)
- if hasattr(self, widget_api_name):
- raise AttributeError("instance %s already has an attribute %s" % (self,widget_api_name))
- else:
- setattr(self, widget_api_name, widget)
- if prefixes:
- gtk.Widget.set_data(widget, "prefixes", prefixes)
-
- def add_prefix_actions(self, prefix_actions_proxy):
- """
- By using a gui designer (glade-2, gazpacho, etc)
- widgets can have a prefix in theirs names
- like foo:entry1 or foo:label3
- It means entry1 and label3 has a prefix action named foo.
-
- Then, prefix_actions_proxy must have a method named prefix_foo which
- is called everytime a widget with prefix foo is found, using the found widget
- as argument.
-
- prefix_actions_proxy:
- An instance with methods as prefix actions.
- It means it has methods like prefix_foo, prefix_bar, etc.
- """
- prefix_s = "prefix_"
- prefix_pos = len(prefix_s)
-
- is_method = lambda t : callable( t[1] )
- is_prefix_action = lambda t : t[0].startswith(prefix_s)
- drop_prefix = lambda (k,w): (k[prefix_pos:],w)
-
- members_t = inspect.getmembers(prefix_actions_proxy)
- methods_t = filter(is_method, members_t)
- prefix_actions_t = filter(is_prefix_action, methods_t)
- prefix_actions_d = dict( map(drop_prefix, prefix_actions_t) )
-
- for widget in self.get_widgets():
- prefixes = gtk.Widget.get_data(widget, "prefixes")
- if prefixes:
- for prefix in prefixes:
- if prefix in prefix_actions_d:
- prefix_action = prefix_actions_d[prefix]
- prefix_action(widget)
-
- def custom_handler(self,
- glade, function_name, widget_name,
- str1, str2, int1, int2):
- """
- Generic handler for creating custom widgets, internally used to
- enable custom widgets (custom widgets of glade).
-
- The custom widgets have a creation function specified in design time.
- Those creation functions are always called with str1,str2,int1,int2 as
- arguments, that are values specified in design time.
-
- Methods of classes inheriting from SimpleGladeApp are used as
- creation functions automatically.
-
- If a custom widget has create_foo as creation function, then the
- method named create_foo is called with str1,str2,int1,int2 as arguments.
- """
- try:
- handler = getattr(self, function_name)
- return handler(str1, str2, int1, int2)
- except AttributeError:
- return None
-
- def gtk_widget_show(self, widget, *args):
- """
- Predefined callback.
- The widget is showed.
- Equivalent to widget.show()
- """
- widget.show()
-
- def gtk_widget_hide(self, widget, *args):
- """
- Predefined callback.
- The widget is hidden.
- Equivalent to widget.hide()
- """
- widget.hide()
-
- def gtk_widget_grab_focus(self, widget, *args):
- """
- Predefined callback.
- The widget grabs the focus.
- Equivalent to widget.grab_focus()
- """
- widget.grab_focus()
-
- def gtk_widget_destroy(self, widget, *args):
- """
- Predefined callback.
- The widget is destroyed.
- Equivalent to widget.destroy()
- """
- widget.destroy()
-
- def gtk_window_activate_default(self, window, *args):
- """
- Predefined callback.
- The default widget of the window is activated.
- Equivalent to window.activate_default()
- """
- widget.activate_default()
-
- def gtk_true(self, *args):
- """
- Predefined callback.
- Equivalent to return True in a callback.
- Useful for stopping propagation of signals.
- """
- return True
-
- def gtk_false(self, *args):
- """
- Predefined callback.
- Equivalent to return False in a callback.
- """
- return False
-
- def gtk_main_quit(self, *args):
- """
- Predefined callback.
- Equivalent to self.quit()
- """
- self.quit()
-
- def main(self):
- """
- Starts the main loop of processing events.
- The default implementation calls gtk.main()
-
- Useful for applications that needs a non gtk main loop.
- For example, applications based on gstreamer needs to override
- this method with gst.main()
-
- Do not directly call this method in your programs.
- Use the method run() instead.
- """
- gtk.main()
-
- def quit(self):
- """
- Quit processing events.
- The default implementation calls gtk.main_quit()
-
- Useful for applications that needs a non gtk main loop.
- For example, applications based on gstreamer needs to override
- this method with gst.main_quit()
- """
- gtk.main_quit()
-
- def run(self):
- """
- Starts the main loop of processing events checking for Control-C.
-
- The default implementation checks wheter a Control-C is pressed,
- then calls on_keyboard_interrupt().
-
- Use this method for starting programs.
- """
- try:
- self.main()
- except KeyboardInterrupt:
- self.on_keyboard_interrupt()
-
- def on_keyboard_interrupt(self):
- """
- This method is called by the default implementation of run()
- after a program is finished by pressing Control-C.
- """
- pass
-
- def install_custom_handler(self, custom_handler):
- gtk.glade.set_custom_handler(custom_handler)
-
- def create_glade(self, glade_path, root, domain):
- return gtk.glade.XML(self.glade_path, root, domain)
-
- def get_widget(self, widget_name):
- return self.glade.get_widget(widget_name)
-
- def get_widgets(self):
- return self.glade.get_widget_prefix("")
diff --git a/trunk/avahi-python/avahi/__init__.py b/trunk/avahi-python/avahi/__init__.py
deleted file mode 100644
index 81e2754..0000000
--- a/trunk/avahi-python/avahi/__init__.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Some definitions matching those in avahi-common/defs.h
-
-import dbus
-
-SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION, SERVER_FAILURE = range(0, 5)
-
-ENTRY_GROUP_UNCOMMITED, ENTRY_GROUP_REGISTERING, ENTRY_GROUP_ESTABLISHED, ENTRY_GROUP_COLLISION, ENTRY_GROUP_FAILURE = range(0, 5)
-
-DOMAIN_BROWSER_BROWSE, DOMAIN_BROWSER_BROWSE_DEFAULT, DOMAIN_BROWSER_REGISTER, DOMAIN_BROWSER_REGISTER_DEFAULT, DOMAIN_BROWSER_BROWSE_LEGACY = range(0, 5)
-
-PROTO_UNSPEC, PROTO_INET, PROTO_INET6 = -1, 0, 1
-
-IF_UNSPEC = -1
-
-PUBLISH_UNIQUE = 1
-PUBLISH_NO_PROBE = 2
-PUBLISH_NO_ANNOUNCE = 4
-PUBLISH_ALLOW_MULTIPLE = 8
-PUBLISH_NO_REVERSE = 16
-PUBLISH_NO_COOKIE = 32
-PUBLISH_UPDATE = 64
-PUBLISH_USE_WIDE_AREA = 128
-PUBLISH_USE_MULTICAST = 256
-
-LOOKUP_USE_WIDE_AREA = 1
-LOOKUP_USE_MULTICAST = 2
-LOOKUP_NO_TXT = 4
-LOOKUP_NO_ADDRESS = 8
-
-LOOKUP_RESULT_CACHED = 1
-LOOKUP_RESULT_WIDE_AREA = 2
-LOOKUP_RESULT_MULTICAST = 4
-LOOKUP_RESULT_LOCAL = 8
-LOOKUP_RESULT_OUR_OWN = 16
-LOOKUP_RESULT_STATIC = 32
-
-SERVICE_COOKIE = "org.freedesktop.Avahi.cookie"
-SERVICE_COOKIE_INVALID = 0
-
-DBUS_NAME = "org.freedesktop.Avahi"
-DBUS_INTERFACE_SERVER = DBUS_NAME + ".Server"
-DBUS_PATH_SERVER = "/"
-DBUS_INTERFACE_ENTRY_GROUP = DBUS_NAME + ".EntryGroup"
-DBUS_INTERFACE_DOMAIN_BROWSER = DBUS_NAME + ".DomainBrowser"
-DBUS_INTERFACE_SERVICE_TYPE_BROWSER = DBUS_NAME + ".ServiceTypeBrowser"
-DBUS_INTERFACE_SERVICE_BROWSER = DBUS_NAME + ".ServiceBrowser"
-DBUS_INTERFACE_ADDRESS_RESOLVER = DBUS_NAME + ".AddressResolver"
-DBUS_INTERFACE_HOST_NAME_RESOLVER = DBUS_NAME + ".HostNameResolver"
-DBUS_INTERFACE_SERVICE_RESOLVER = DBUS_NAME + ".ServiceResolver"
-DBUS_INTERFACE_RECORD_BROWSER = DBUS_NAME + ".RecordBrowser"
-
-def byte_array_to_string(s):
- r = ""
-
- for c in s:
-
- if c >= 32 and c < 127:
- r += "%c" % c
- else:
- r += "."
-
- return r
-
-def txt_array_to_string_array(t):
- l = []
-
- for s in t:
- l.append(byte_array_to_string(s))
-
- return l
-
-
-def string_to_byte_array(s):
- r = []
-
- for c in s:
- r.append(dbus.Byte(ord(c)))
-
- return r
-
-def string_array_to_txt_array(t):
- l = []
-
- for s in t:
- l.append(string_to_byte_array(s))
-
- return l
-
-def dict_to_txt_array(txt_dict):
- l = []
-
- for k,v in txt_dict.items():
- l.append(string_to_byte_array("%s=%s" % (k,v)))
-
- return l
diff --git a/trunk/avahi-qt/Makefile.am b/trunk/avahi-qt/Makefile.am
deleted file mode 100644
index 4cd047b..0000000
--- a/trunk/avahi-qt/Makefile.am
+++ /dev/null
@@ -1,72 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-lib_LTLIBRARIES =
-BUILT_SOURCES =
-
-if HAVE_QT3
-
-avahiqt3includedir=$(includedir)/avahi-qt3
-
-avahiqt3include_HEADERS = \
- qt-watch.h
-
-lib_LTLIBRARIES += \
- libavahi-qt3.la
-
-BUILT_SOURCES += qt-watch.moc3
-
-libavahi_qt3_la_SOURCES = \
- qt-watch.cpp
-
-qt-watch.moc3: qt-watch.cpp
- $(MOC_QT3) $^ > $@
-
-libavahi_qt3_la_CPPFLAGS = $(AM_CFLAGS) $(QT3_CFLAGS)
-libavahi_qt3_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT3_LIBS)
-libavahi_qt3_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_QT3_VERSION_INFO)
-
-endif
-
-if HAVE_QT4
-
-avahiqt4includedir=$(includedir)/avahi-qt4
-avahiqt4include_HEADERS = \
- qt-watch.h
-
-lib_LTLIBRARIES += \
- libavahi-qt4.la
-
-BUILT_SOURCES += qt-watch.moc4
-
-libavahi_qt4_la_SOURCES = \
- qt-watch.cpp
-
-qt-watch.moc4: qt-watch.cpp
- $(MOC_QT4) $^ > $@
-
-libavahi_qt4_la_CPPFLAGS = $(AM_CFLAGS) $(QT4_CFLAGS) -DQT4
-libavahi_qt4_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT4_LIBS)
-libavahi_qt4_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info $(LIBAVAHI_QT4_VERSION_INFO)
-
-endif
-
-CLEANFILES = $(BUILT_SOURCES)
diff --git a/trunk/avahi-qt/qt-watch.cpp b/trunk/avahi-qt/qt-watch.cpp
deleted file mode 100644
index f29b517..0000000
--- a/trunk/avahi-qt/qt-watch.cpp
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <sys/time.h>
-#ifdef QT4
-#include <Qt/qsocketnotifier.h>
-#include <Qt/qobject.h>
-#include <Qt/qtimer.h>
-#else
-#include <qsocketnotifier.h>
-#include <qobject.h>
-#include <qtimer.h>
-#endif
-#include <avahi-common/timeval.h>
-#include "qt-watch.h"
-
-class AvahiWatch : public QObject
-{
- Q_OBJECT
-public:
- AvahiWatch(int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void* userdata);
- ~AvahiWatch() {}
- AvahiWatchEvent getEvents() const { return m_incallback ? m_lastEvent : (AvahiWatchEvent)0; }
- void setWatchedEvents(AvahiWatchEvent event);
-
-private slots:
- void gotIn();
- void gotOut();
-
-private:
- QSocketNotifier* m_in;
- QSocketNotifier* m_out;
- //FIXME: ERR and HUP?
- AvahiWatchCallback m_callback;
- AvahiWatchEvent m_lastEvent;
- int m_fd;
- void* m_userdata;
- bool m_incallback;
-};
-
-class AvahiTimeout : public QObject
-{
- Q_OBJECT
-
-public:
- AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callback, void* userdata);
- ~AvahiTimeout() {}
- void update(const struct timeval* tv);
-
-private slots:
- void timeout();
-
-private:
- QTimer m_timer;
- AvahiTimeoutCallback m_callback;
- void* m_userdata;
-};
-
-
-
-AvahiWatch::AvahiWatch(int fd, AvahiWatchEvent event, AvahiWatchCallback callback, void* userdata) :
- m_in(0), m_out(0), m_callback(callback), m_fd(fd), m_userdata(userdata), m_incallback(false)
-{
- setWatchedEvents(event);
-}
-
-void AvahiWatch::gotIn()
-{
- m_lastEvent = AVAHI_WATCH_IN;
- m_incallback=true;
- m_callback(this,m_fd,m_lastEvent,m_userdata);
- m_incallback=false;
-}
-
-void AvahiWatch::gotOut()
-{
- m_lastEvent = AVAHI_WATCH_IN;
- m_incallback=true;
- m_callback(this,m_fd,m_lastEvent,m_userdata);
- m_incallback=false;
-}
-
-void AvahiWatch::setWatchedEvents(AvahiWatchEvent event)
-{
- if (!(event & AVAHI_WATCH_IN)) { delete m_in; m_in=0; }
- if (!(event & AVAHI_WATCH_OUT)) { delete m_out; m_out=0; }
- if (event & AVAHI_WATCH_IN) {
- m_in = new QSocketNotifier(m_fd,QSocketNotifier::Read, this);
- connect(m_in,SIGNAL(activated(int)),SLOT(gotIn()));
- }
- if (event & AVAHI_WATCH_OUT) {
- m_out = new QSocketNotifier(m_fd,QSocketNotifier::Write, this);
- connect(m_out,SIGNAL(activated(int)),SLOT(gotOut()));
- }
-}
-
-AvahiTimeout::AvahiTimeout(const struct timeval* tv, AvahiTimeoutCallback callback, void *userdata) :
- m_callback(callback), m_userdata(userdata)
-{
- connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
-#ifdef QT4
- m_timer.setSingleShot(true);
-#endif
- update(tv);
-}
-
-void AvahiTimeout::update(const struct timeval *tv)
-{
- m_timer.stop();
- if (tv) {
- AvahiUsec u = avahi_age(tv)/1000;
-#ifdef QT4
- m_timer.start( (u>0) ? 0 : -u);
-#else
- m_timer.start( (u>0) ? 0 : -u,true);
-#endif
- }
-}
-
-void AvahiTimeout::timeout()
-{
- m_callback(this,m_userdata);
-}
-
-static AvahiWatch* q_watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event, AvahiWatchCallback callback,
- void *userdata)
-{
- return new AvahiWatch(fd, event, callback, userdata);
-}
-
-static void q_watch_update(AvahiWatch *w, AvahiWatchEvent events)
-{
- w->setWatchedEvents(events);
-}
-
-static AvahiWatchEvent q_watch_get_events(AvahiWatch *w)
-{
- return w->getEvents();
-}
-
-static void q_watch_free(AvahiWatch *w)
-{
- delete w;
-}
-
-static AvahiTimeout* q_timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback,
- void *userdata)
-{
- return new AvahiTimeout(tv, callback, userdata);
-}
-
-static void q_timeout_update(AvahiTimeout *t, const struct timeval *tv)
-{
- t->update(tv);
-}
-
-static void q_timeout_free(AvahiTimeout *t)
-{
- delete t;
-}
-
-const AvahiPoll* avahi_qt_poll_get(void)
-{
- static const AvahiPoll qt_poll = {
- NULL,
- q_watch_new,
- q_watch_update,
- q_watch_get_events,
- q_watch_free,
- q_timeout_new,
- q_timeout_update,
- q_timeout_free
- };
-
- return &qt_poll;
-}
-
-#ifdef QT4
-#include "qt-watch.moc4"
-#else
-#include "qt-watch.moc3"
-#endif
diff --git a/trunk/avahi-qt/qt-watch.h b/trunk/avahi-qt/qt-watch.h
deleted file mode 100644
index 0a3476d..0000000
--- a/trunk/avahi-qt/qt-watch.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef QAVAHI_H
-#define QAVAHI_H
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-/** \file qt-watch.h Qt main loop adapter */
-
-#include <avahi-common/watch.h>
-
-AVAHI_C_DECL_BEGIN
-
-/** Setup abstract poll structure for integration with Qt main loop */
-const AvahiPoll* avahi_qt_poll_get(void);
-
-AVAHI_C_DECL_END
-
-#endif
diff --git a/trunk/avahi-qt3.pc.in b/trunk/avahi-qt3.pc.in
deleted file mode 100644
index c18f080..0000000
--- a/trunk/avahi-qt3.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-qt3
-Description: Avahi Multicast DNS Responder (QT3 Support)
-Version: @PACKAGE_VERSION@
-Requires.private: qt-mt >= 3.0.0
-Libs: -L${libdir} -lavahi-qt3
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/trunk/avahi-qt4.pc.in b/trunk/avahi-qt4.pc.in
deleted file mode 100644
index f62f717..0000000
--- a/trunk/avahi-qt4.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=${prefix}
-libdir=@libdir@
-includedir=${prefix}/include
-
-Name: avahi-qt4
-Description: Avahi Multicast DNS Responder (QT4 Support)
-Version: @PACKAGE_VERSION@
-Requires.private: QtCore >= 4.0.0
-Libs: -L${libdir} -lavahi-qt4
-Cflags: -D_REENTRANT -I${includedir}
diff --git a/trunk/avahi-sharp.pc.in b/trunk/avahi-sharp.pc.in
deleted file mode 100644
index 3cc78b6..0000000
--- a/trunk/avahi-sharp.pc.in
+++ /dev/null
@@ -1,8 +0,0 @@
-prefix=@prefix@
-exec_prefix=@prefix@
-libdir=@libdir@
-
-Name: avahi-sharp
-Description: Mono bindings for the Avahi mDNS/DNS-SD stack
-Version: @PACKAGE_VERSION@
-Libs: -r:${libdir}/mono/avahi-sharp/avahi-sharp.dll
diff --git a/trunk/avahi-sharp/AddressResolver.cs b/trunk/avahi-sharp/AddressResolver.cs
deleted file mode 100644
index 3025102..0000000
--- a/trunk/avahi-sharp/AddressResolver.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Net;
-using System.Runtime.InteropServices;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- internal delegate void AddressResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr address,
- IntPtr hostname, LookupResultFlags flags, IntPtr userdata);
-
- public delegate void HostAddressHandler (object o, HostAddressArgs args);
-
- public class HostAddressArgs : EventArgs
- {
- private string host;
- private IPAddress address;
-
- public string Host
- {
- get { return host; }
- }
-
- public IPAddress Address
- {
- get { return address; }
- }
-
- public HostAddressArgs (string host, IPAddress address)
- {
- this.host = host;
- this.address = address;
- }
- }
-
- public class AddressResolver : ResolverBase, IDisposable
- {
- private IntPtr handle;
- private Client client;
- private int iface;
- private Protocol proto;
- private IPAddress address;
- private LookupFlags flags;
- private AddressResolverCallback cb;
-
- private IPAddress currentAddress;
- private string currentHost;
-
- private ArrayList foundListeners = new ArrayList ();
- private ArrayList timeoutListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_address_resolver_new (IntPtr client, int iface, Protocol proto,
- IntPtr address, LookupFlags flags,
- AddressResolverCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_address_resolver_free (IntPtr handle);
-
- public event HostAddressHandler Found
- {
- add {
- foundListeners.Add (value);
- Start ();
- }
- remove {
- foundListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event EventHandler Timeout
- {
- add {
- timeoutListeners.Add (value);
- Start ();
- }
- remove {
- timeoutListeners.Remove (value);
- Stop (false);
- }
- }
-
- public IPAddress Address
- {
- get { return currentAddress; }
- }
-
- public string HostName
- {
- get { return currentHost; }
- }
-
- public AddressResolver (Client client, IPAddress address) : this (client, -1, Protocol.Unspecified,
- address, LookupFlags.None)
- {
- }
-
- public AddressResolver (Client client, int iface, Protocol proto, IPAddress address, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.address = address;
- this.flags = flags;
- cb = OnAddressResolverCallback;
- }
-
- ~AddressResolver ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (foundListeners.Count == 0 && timeoutListeners.Count == 0))
- return;
-
- IntPtr addrPtr = Utility.AddressToPtr (address);
-
- lock (client) {
- handle = avahi_address_resolver_new (client.Handle, iface, proto, addrPtr, flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
-
- Utility.Free (addrPtr);
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (foundListeners.Count == 0 && timeoutListeners.Count == 0))) {
-
- lock (client) {
- avahi_address_resolver_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnAddressResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr address,
- IntPtr hostname, LookupResultFlags flags, IntPtr userdata)
- {
- switch (revent) {
- case ResolverEvent.Found:
- currentAddress = Utility.PtrToAddress (address);
- currentHost = Utility.PtrToString (hostname);
-
- foreach (HostAddressHandler handler in foundListeners)
- handler (this, new HostAddressArgs (currentHost, currentAddress));
- break;
- case ResolverEvent.Failure:
- EmitFailure (client.LastError);
- break;
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/AssemblyInfo.cs b/trunk/avahi-sharp/AssemblyInfo.cs
deleted file mode 100644
index f8dd4ed..0000000
--- a/trunk/avahi-sharp/AssemblyInfo.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-//
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-//
-[assembly: AssemblyTitle("avahi-sharp")]
-[assembly: AssemblyDescription("Mono bindings for the Avahi mDNS/DNS-SD stack")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("(C) 2005 James Willcox <snorp@snorp.net>")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Revision and Build Numbers
-// by using the '*' as shown below:
-
-[assembly: AssemblyVersion("1.0.0")]
diff --git a/trunk/avahi-sharp/AvahiTest.cs b/trunk/avahi-sharp/AvahiTest.cs
deleted file mode 100644
index ba4d59b..0000000
--- a/trunk/avahi-sharp/AvahiTest.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Text;
-using System.Net;
-using Avahi;
-
-public class AvahiTest {
- private static Client client;
- private static ArrayList objects = new ArrayList ();
-
- public static void Main () {
- client = new Client ();
-
- Console.WriteLine ("joined service name: " + Client.JoinServiceName ("FooBar", "_foo", "local"));
-
- EntryGroup eg = new EntryGroup (client);
- eg.StateChanged += OnEntryGroupChanged;
- eg.AddService ("foobar2", "_dingdong._tcp", client.DomainName,
- 444, new string[] { "foo=stuff", "bar=stuff2", "baz=stuff3" });
- eg.Commit ();
- BrowseServiceTypes ("local");
- Console.WriteLine ("Press enter to quit");
- Console.ReadLine ();
- client.Dispose ();
- }
-
- private static void OnEntryGroupChanged (object o, EntryGroupStateArgs args)
- {
- Console.WriteLine ("Entry group status: " + args.State);
- if (args.State == EntryGroupState.Established) {
- DomainBrowser browser = new DomainBrowser (client);
- objects.Add (browser);
-
- browser.DomainAdded += OnDomainAdded;
- }
- }
-
- private static void OnDomainAdded (object o, DomainInfoArgs args)
- {
- Console.WriteLine ("Got domain added: " + args.Domain.Domain);
- // BrowseServiceTypes (args.Domain.Domain);
- }
-
- private static void BrowseServiceTypes (string domain)
- {
- ServiceTypeBrowser stb = new ServiceTypeBrowser (client, domain);
- objects.Add (stb);
-
- stb.CacheExhausted += OnCacheExhausted;
- stb.ServiceTypeAdded += OnServiceTypeAdded;
- }
-
- private static void OnCacheExhausted (object o, EventArgs args)
- {
- Console.WriteLine ("Cache is exhausted");
- }
-
- private static void OnServiceTypeAdded (object o, ServiceTypeInfoArgs args)
- {
- Console.WriteLine ("Got service type: " + args.ServiceType.ServiceType);
- ServiceBrowser sb = new ServiceBrowser (client, args.ServiceType.ServiceType, args.ServiceType.Domain);
- objects.Add (sb);
-
- sb.ServiceAdded += OnServiceAdded;
- }
-
- private static void OnServiceAdded (object o, ServiceInfoArgs args)
- {
- // Console.WriteLine ("Got service: " + info.Name);
- ServiceResolver resolver = new ServiceResolver (client, args.Service);
- objects.Add (resolver);
- resolver.Found += OnServiceResolved;
- }
-
- private static void OnServiceResolved (object o, ServiceInfoArgs args)
- {
- objects.Remove (o);
-
- Console.WriteLine ("Service '{0}' at {1}:{2}", args.Service.Name, args.Service.HostName, args.Service.Port);
- foreach (byte[] bytes in args.Service.Text) {
- Console.WriteLine ("Text: " + Encoding.UTF8.GetString (bytes));
- }
-
- AddressResolver ar = new AddressResolver (client, args.Service.Address);
- objects.Add (ar);
-
- ar.Found += OnAddressResolved;
- ar.Failed += OnAddressResolverFailed;
- }
-
- private static void OnAddressResolverFailed (object o, ErrorCodeArgs args)
- {
- Console.WriteLine ("Failed to resolve '{0}': {1}", (o as AddressResolver).Address, args.ErrorCode);
- }
-
- private static void OnAddressResolved (object o, HostAddressArgs args)
- {
- objects.Remove (o);
-
- Console.WriteLine ("Resolved {0} to {1}", args.Address, args.Host);
- HostNameResolver hr = new HostNameResolver (client, args.Host);
- objects.Add (hr);
-
- hr.Found += OnHostNameResolved;
- }
-
- private static void OnHostNameResolved (object o, HostAddressArgs args)
- {
- objects.Remove (o);
- Console.WriteLine ("Resolved {0} to {1}", args.Host, args.Address);
- }
-}
diff --git a/trunk/avahi-sharp/BrowserBase.cs b/trunk/avahi-sharp/BrowserBase.cs
deleted file mode 100644
index 0a1e3a7..0000000
--- a/trunk/avahi-sharp/BrowserBase.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-
-namespace Avahi
-{
- public abstract class BrowserBase
- {
- public event EventHandler CacheExhausted;
- public event EventHandler AllForNow;
- public event EventHandler Failed;
-
- internal void EmitBrowserEvent (BrowserEvent bevent)
- {
- switch (bevent) {
- case BrowserEvent.CacheExhausted:
- if (CacheExhausted != null)
- CacheExhausted (this, new EventArgs ());
- break;
- case BrowserEvent.AllForNow:
- if (AllForNow != null)
- AllForNow (this, new EventArgs ());
- break;
- case BrowserEvent.Failure:
- if (Failed != null)
- Failed (this, new EventArgs ());
- break;
- default:
- break;
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/Client.cs b/trunk/avahi-sharp/Client.cs
deleted file mode 100644
index 02763d4..0000000
--- a/trunk/avahi-sharp/Client.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-using System;
-using System.Threading;
-using System.Collections;
-using System.Runtime.InteropServices;
-using Mono.Unix;
-using Mono.Unix.Native;
-
-using Stdlib = Mono.Unix.Native.Stdlib;
-
-namespace Avahi
-{
- internal enum ResolverEvent {
- Found,
- Failure
- }
-
- internal enum BrowserEvent {
- Added,
- Removed,
- CacheExhausted,
- AllForNow,
- Failure
- }
-
- internal delegate int PollCallback (IntPtr ufds, uint nfds, int timeout);
- internal delegate void ClientCallback (IntPtr client, ClientState state, IntPtr userData);
-
- public delegate void ClientStateHandler (object o, ClientStateArgs state);
-
- public class ClientStateArgs : EventArgs
- {
- private ClientState state;
- private ErrorCode error;
-
- public ClientState State
- {
- get { return state; }
- }
-
- public ErrorCode Error
- {
- get { return error; }
- }
-
- public ClientStateArgs (ClientState state, ErrorCode error)
- {
- this.state = state;
- this.error = error;
- }
- }
-
- public enum Protocol {
- Unspecified = -1,
- IPv4 = 0,
- IPv6 = 1
- }
-
- internal enum ServerState {
- Invalid,
- Registering,
- Running,
- Collision
- }
-
- public enum ClientState {
- Registering = ServerState.Registering,
- Running = ServerState.Running,
- Collision = ServerState.Collision,
- Failure = 100,
- Connecting = 101
- }
-
- [Flags]
- public enum LookupFlags {
- None = 0,
- UseWideArea = 1,
- UseMulticast = 2,
- NoTxt = 4,
- NoAddress = 8
- }
-
- [Flags]
- public enum LookupResultFlags {
- None = 0,
- Cached = 1,
- WideArea = 2,
- Multicast = 4,
- Local = 8,
- OurOwn = 16,
- }
-
- [Flags]
- public enum ClientFlags {
- None = 0,
- IgnoreUserConfig = 1,
- NoFail = 2
- }
-
- public class Client : IDisposable
- {
- private IntPtr handle;
- private ClientCallback cb;
- private PollCallback pollcb;
- private IntPtr spoll;
-
- private Thread thread;
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_new (IntPtr poll, ClientFlags flags, ClientCallback handler,
- IntPtr userData, out int error);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_client_free (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_version_string (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_host_name (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_domain_name (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_client_get_host_name_fqdn (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern ClientState avahi_client_get_state (IntPtr handle);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_client_errno (IntPtr handle);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_simple_poll_new ();
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_simple_poll_get (IntPtr spoll);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_simple_poll_free (IntPtr spoll);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_simple_poll_loop (IntPtr spoll);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_simple_poll_set_func (IntPtr spoll, PollCallback cb);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_simple_poll_quit (IntPtr spoll);
-
- [DllImport ("avahi-client")]
- private static extern uint avahi_client_get_local_service_cookie (IntPtr client);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_service_name_join (IntPtr buf, int len, byte[] name, byte[] type,
- byte[] domain);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_service_name_split (byte[] service, IntPtr name, int name_len,
- IntPtr type, int type_len,
- IntPtr domain, int domain_len);
-
-
- [DllImport ("libc")]
- private static extern int poll(IntPtr ufds, uint nfds, int timeout);
-
- public event ClientStateHandler StateChanged;
-
- internal IntPtr Handle
- {
- get { return handle; }
- }
-
- public string Version
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_version_string (handle));
- }
- }
- }
-
- public string HostName
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_host_name (handle));
- }
- }
- }
-
- public string DomainName
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_domain_name (handle));
- }
- }
- }
-
- public string HostNameFqdn
- {
- get {
- lock (this) {
- return Utility.PtrToString (avahi_client_get_host_name_fqdn (handle));
- }
- }
- }
-
- public ClientState State
- {
- get {
- lock (this) {
- return (ClientState) avahi_client_get_state (handle);
- }
- }
- }
-
- public uint LocalServiceCookie
- {
- get {
- lock (this) {
- return avahi_client_get_local_service_cookie (handle);
- }
- }
- }
-
- internal ErrorCode LastError
- {
- get {
- lock (this) {
- return (ErrorCode) avahi_client_errno (handle);
- }
- }
- }
-
- public Client (ClientFlags flags)
- {
- spoll = avahi_simple_poll_new ();
-
- pollcb = OnPollCallback;
- avahi_simple_poll_set_func (spoll, pollcb);
- IntPtr poll = avahi_simple_poll_get (spoll);
- cb = OnClientCallback;
-
- int error;
- handle = avahi_client_new (poll, flags, cb, IntPtr.Zero, out error);
- if (error != 0)
- throw new ClientException (error);
-
- thread = new Thread (PollLoop);
- thread.IsBackground = true;
- thread.Start ();
- }
-
- public Client () : this (ClientFlags.None) {
- }
-
- ~Client ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- if (handle != IntPtr.Zero) {
- lock (this) {
- avahi_client_free (handle);
- handle = IntPtr.Zero;
-
- avahi_simple_poll_quit (spoll);
- Monitor.Wait (this);
-
- avahi_simple_poll_free (spoll);
- }
- }
- }
-
- public static string JoinServiceName (string name, string type, string domain)
- {
- int len = 4 * (name.Length + type.Length + domain.Length) + 4;
- IntPtr buf = Stdlib.malloc ((ulong) len);
-
- int ret = avahi_service_name_join (buf, len,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain));
-
- if (ret < 0) {
- Utility.Free (buf);
- return null; // FIXME, should throw exception
- }
-
- string service = Utility.PtrToString (buf);
- Utility.Free (buf);
-
- return service;
- }
-
- public static void SplitServiceName (string service, out string name, out string type, out string domain)
- {
- int len = 1024;
-
- IntPtr namePtr = Stdlib.malloc ((ulong) len);
- IntPtr typePtr = Stdlib.malloc ((ulong) len);
- IntPtr domainPtr = Stdlib.malloc ((ulong) len);
-
- int ret = avahi_service_name_split (Utility.StringToBytes (service), namePtr, len, typePtr, len,
- domainPtr, len);
-
- if (ret < 0) {
- Utility.Free (namePtr);
- Utility.Free (typePtr);
- Utility.Free (domainPtr);
-
- name = null;
- type = null;
- domain = null;
- return;
- }
-
- name = Utility.PtrToString (namePtr);
- type = Utility.PtrToString (typePtr);
- domain = Utility.PtrToString (domainPtr);
-
- Utility.Free (namePtr);
- Utility.Free (typePtr);
- Utility.Free (domainPtr);
- }
-
- internal void ThrowError ()
- {
- ErrorCode error = LastError;
-
- if (error != ErrorCode.Ok)
- throw new ClientException (error);
- }
-
- private void OnClientCallback (IntPtr client, ClientState state, IntPtr userData)
- {
- if (StateChanged != null)
- StateChanged (this, new ClientStateArgs (state, LastError));
- }
-
- private int OnPollCallback (IntPtr ufds, uint nfds, int timeout) {
- Monitor.Exit (this);
- int result = poll (ufds, nfds, timeout);
- Monitor.Enter (this);
- return result;
- }
-
- private void PollLoop () {
- try {
- lock (this) {
- avahi_simple_poll_loop (spoll);
- Monitor.Pulse (this);
- }
- } catch (Exception e) {
- Console.Error.WriteLine ("Error in avahi-sharp event loop: " + e);
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/ClientException.cs b/trunk/avahi-sharp/ClientException.cs
deleted file mode 100644
index fadcce9..0000000
--- a/trunk/avahi-sharp/ClientException.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace Avahi
-{
- public enum ErrorCode {
- Ok = 0,
- Failure = -1,
- BadState = -2,
- InvalidHostName = - 3,
- InvalidDomainName = -4,
- NoNetwork = -5,
- InvalidTTL = -6,
- IsPattern = -7,
- Collision = -8,
- InvalidRecord = -9,
- InvalidServiceName = -10,
- InvalidServiceType = -11,
- InvalidPort = -12,
- InvalidKey = -13,
- InvalidAddress = -14,
- Timeout = -15,
- TooManyClients = -16,
- TooManyObjects = -17,
- TooManyEntries = -18,
- OS = -19,
- AccessDenied = -20,
- InvalidOperation = -21,
- DBusError = -22,
- Disconnected = -23,
- NoMemory = -24,
- InvalidObject = -25,
- NoDaemon = -26,
- InvalidInterface = -27,
- InvalidProtocol = -28,
- InvalidFlags = -29,
- NotFound = -30,
- InvalidConfig = -31,
- VersionMismatch = -32,
- InvalidServiceSubtype = -33,
- InvalidPacket = -34,
- InvalidDnsError = -35,
- DnsFormErr = -36,
- DnsServFail = -37,
- DnsNxDomain = -38,
- DnsNoTimp = -39,
- DnsRefused = -40,
- DnsYxDomain = -41,
- DnsYxRrSet = -42,
- DnsNxRrSet = -43,
- DnsNotAuth = -44,
- DnsNotZone = -45,
- InvalidRData = -46,
- InvalidDnsClass = -47,
- InvalidDnsType = -48,
- NotSupported = -49,
- NotPermitted = -50
- }
-
- public delegate void ErrorCodeHandler (object o, ErrorCodeArgs args);
-
- public class ErrorCodeArgs : EventArgs
- {
- private ErrorCode code;
-
- public ErrorCode ErrorCode
- {
- get { return code; }
- }
-
- public ErrorCodeArgs (ErrorCode code)
- {
- this.code = code;
- }
- }
-
- public class ClientException : ApplicationException
- {
- private ErrorCode code;
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_strerror (ErrorCode code);
-
- public ErrorCode ErrorCode
- {
- get { return code; }
- }
-
- internal ClientException (int code) : this ((ErrorCode) code) {
- }
-
- internal ClientException (ErrorCode code) : base (GetErrorString (code))
- {
- this.code = code;
- }
-
- private static string GetErrorString (ErrorCode code)
- {
- IntPtr str = avahi_strerror (code);
- return Utility.PtrToString (str);
- }
- }
-}
diff --git a/trunk/avahi-sharp/DomainBrowser.cs b/trunk/avahi-sharp/DomainBrowser.cs
deleted file mode 100644
index 50da54e..0000000
--- a/trunk/avahi-sharp/DomainBrowser.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
- internal delegate void DomainBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr domain, LookupResultFlags flags, IntPtr userdata);
-
- public enum DomainBrowserType {
- Browse,
- BrowseDefault,
- Register,
- RegisterDefault,
- BrowseLegacy
- }
-
- public struct DomainInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Domain;
- public LookupResultFlags Flags;
- }
-
- public class DomainInfoArgs : EventArgs
- {
- private DomainInfo domain;
-
- public DomainInfo Domain
- {
- get { return domain; }
- }
-
- public DomainInfoArgs (DomainInfo domain)
- {
- this.domain = domain;
- }
- }
-
- public delegate void DomainInfoHandler (object o, DomainInfoArgs args);
-
- public class DomainBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string domain;
- private DomainBrowserType btype;
- private LookupFlags flags;
- private DomainBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_domain_browser_new (IntPtr client, int iface, int proto,
- byte[] domain, int btype, LookupFlags flags,
- DomainBrowserCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_domain_browser_free (IntPtr handle);
-
- public event DomainInfoHandler DomainAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event DomainInfoHandler DomainRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public DomainInfo[] Domains
- {
- get { return (DomainInfo[]) infos.ToArray (typeof (DomainInfo)); }
- }
-
- public DomainBrowser (Client client) : this (client, -1, Protocol.Unspecified, client.DomainName,
- DomainBrowserType.Browse, LookupFlags.None) {
- }
-
- public DomainBrowser (Client client, int iface, Protocol proto, string domain,
- DomainBrowserType btype, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.domain = domain;
- this.btype = btype;
- this.flags = flags;
- cb = OnDomainBrowserCallback;
- }
-
- ~DomainBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero && handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_domain_browser_new (client.Handle, iface, (int) proto,
- Utility.StringToBytes (domain), (int) btype, flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
- lock (client) {
- avahi_domain_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnDomainBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr domain, LookupResultFlags flags, IntPtr userdata)
- {
-
- DomainInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.Flags = flags;
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (DomainInfoHandler handler in addListeners)
- handler (this, new DomainInfoArgs (info));
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (DomainInfoHandler handler in removeListeners)
- handler (this, new DomainInfoArgs (info));
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/EntryGroup.cs b/trunk/avahi-sharp/EntryGroup.cs
deleted file mode 100644
index 02be643..0000000
--- a/trunk/avahi-sharp/EntryGroup.cs
+++ /dev/null
@@ -1,378 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Runtime.InteropServices;
-using System.Text;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- [Flags]
- public enum PublishFlags {
- None = 0,
- Unique = 1,
- NoProbe = 2,
- NoAnnounce = 4,
- AllowMultiple = 8,
- NoReverse = 16,
- NoCookie = 32,
- Update = 64,
- UseWideArea = 128,
- UseMulticast = 256
- }
-
- public enum EntryGroupState {
- Uncommited,
- Registering,
- Established,
- Collision,
- Failure
- }
-
- public class EntryGroupStateArgs : EventArgs
- {
- private EntryGroupState state;
-
- public EntryGroupState State
- {
- get { return state; }
- }
-
- public EntryGroupStateArgs (EntryGroupState state)
- {
- this.state = state;
- }
- }
-
- internal delegate void EntryGroupCallback (IntPtr group, EntryGroupState state, IntPtr userdata);
- public delegate void EntryGroupStateHandler (object o, EntryGroupStateArgs args);
-
- public class EntryGroup : IDisposable
- {
- private Client client;
- private IntPtr handle;
- private EntryGroupCallback cb;
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_entry_group_new (IntPtr client, EntryGroupCallback cb, IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_commit (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_reset (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern EntryGroupState avahi_entry_group_get_state (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern bool avahi_entry_group_is_empty (IntPtr group);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_service_strlst (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, byte[] type,
- byte[] domain, byte[] host, UInt16 port,
- IntPtr strlst);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_update_service_strlst (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name,
- byte[] type, byte[] domain, IntPtr strlst);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_service_subtype (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, byte[] type,
- byte[] domain, byte[] subtype);
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_address (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, IntPtr address);
-
-
- [DllImport ("avahi-client")]
- private static extern int avahi_entry_group_add_record (IntPtr group, int iface, Protocol proto,
- PublishFlags flags, byte[] name, RecordClass clazz,
- RecordType type, uint ttl, byte[] rdata, int size);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_entry_group_free (IntPtr group);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_new (IntPtr txt);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_add (IntPtr list, byte[] txt);
-
- [DllImport ("avahi-common")]
- private static extern void avahi_string_list_free (IntPtr list);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_alternative_service_name (byte[] name);
-
- public event EntryGroupStateHandler StateChanged;
-
- public EntryGroupState State
- {
- get {
- lock (client) {
- return avahi_entry_group_get_state (handle);
- }
- }
- }
-
- public bool IsEmpty
- {
- get {
- lock (client) {
- return avahi_entry_group_is_empty (handle);
- }
- }
- }
-
- public EntryGroup (Client client)
- {
- this.client = client;
- cb = OnEntryGroupCallback;
-
- lock (client) {
- handle = avahi_entry_group_new (client.Handle, cb, IntPtr.Zero);
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- ~EntryGroup ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero) {
- lock (client) {
- avahi_entry_group_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- public void Commit ()
- {
- lock (client) {
- if (avahi_entry_group_commit (handle) < 0)
- client.ThrowError ();
- }
- }
-
- public void Reset ()
- {
- lock (client) {
- if (avahi_entry_group_reset (handle) < 0)
- client.ThrowError ();
- }
- }
-
- public void AddService (string name, string type, string domain,
- UInt16 port, params string[] txt)
- {
- AddService (PublishFlags.None, name, type, domain, port, txt);
- }
-
- public void AddService (PublishFlags flags, string name, string type, string domain,
- UInt16 port, params string[] txt)
- {
- AddService (-1, Protocol.Unspecified, flags, name, type, domain, null, port, txt);
- }
-
- public void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type, string domain,
- string host, UInt16 port, params string[] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (string item in txt) {
- list = avahi_string_list_add (list, Utility.StringToBytes (item));
- }
- }
-
- AddService (iface, proto, flags, name, type, domain, host, port, list);
- }
-
- public void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type, string domain,
- string host, UInt16 port, params byte[][] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (byte[] item in txt) {
- list = avahi_string_list_add (list, item);
- }
- }
-
- AddService (iface, proto, flags, name, type, domain, host, port, list);
- }
-
- private void AddService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, string host, UInt16 port, IntPtr list)
- {
- int ret;
-
- lock (client) {
- ret = avahi_entry_group_add_service_strlst (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain),
- Utility.StringToBytes (host), port, list);
- }
-
- avahi_string_list_free (list);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
-
- public void UpdateService (string name, string type, string domain, params string[] txt)
- {
- UpdateService (-1, Protocol.Unspecified, PublishFlags.None, name, type, domain, txt);
- }
-
- public void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, params string[] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (string item in txt) {
- list = avahi_string_list_add (list, Utility.StringToBytes (item));
- }
- }
-
- UpdateService (iface, proto, flags, name, type, domain, list);
- }
-
- public void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, params byte[][] txt)
- {
- IntPtr list = avahi_string_list_new (IntPtr.Zero);
-
- if (txt != null) {
- foreach (byte[] item in txt) {
- list = avahi_string_list_add (list, item);
- }
- }
-
- UpdateService (iface, proto, flags, name, type, domain, list);
- }
-
- private void UpdateService (int iface, Protocol proto, PublishFlags flags, string name, string type,
- string domain, IntPtr list)
- {
- lock (client) {
- int ret = avahi_entry_group_update_service_strlst (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain),
- list);
-
- avahi_string_list_free (list);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public void AddServiceSubtype (string name, string type, string domain, string subtype)
- {
- AddServiceSubtype (-1, Protocol.Unspecified, PublishFlags.None, name, type, domain, subtype);
- }
-
- public void AddServiceSubtype (int iface, Protocol proto, PublishFlags flags, string name,
- string type, string domain, string subtype)
- {
- lock (client) {
- int ret = avahi_entry_group_add_service_subtype (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- Utility.StringToBytes (type),
- Utility.StringToBytes (domain),
- Utility.StringToBytes (subtype));
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public void AddAddress (string name, IPAddress address)
- {
- AddAddress (-1, Protocol.Unspecified, PublishFlags.None, name, address);
- }
-
- public void AddAddress (int iface, Protocol proto, PublishFlags flags, string name, IPAddress address)
- {
- IntPtr addressPtr = Utility.AddressToPtr (address);
-
- lock (client) {
- int ret = avahi_entry_group_add_address (handle, iface, proto, flags,
- Utility.StringToBytes (name), addressPtr);
-
- Utility.Free (addressPtr);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public void AddRecord (string name, RecordClass clazz, RecordType type, uint ttl, byte[] rdata, int length)
- {
- AddRecord (-1, Protocol.Unspecified, PublishFlags.None, name, clazz, type, ttl, rdata, length);
- }
-
- public void AddRecord (int iface, Protocol proto, PublishFlags flags, string name,
- RecordClass clazz, RecordType type, uint ttl, byte[] rdata, int length)
- {
- lock (client) {
- int ret = avahi_entry_group_add_record (handle, iface, proto, flags,
- Utility.StringToBytes (name),
- clazz, type, ttl, rdata, length);
-
- if (ret < 0) {
- client.ThrowError ();
- }
- }
- }
-
- public static string GetAlternativeServiceName (string name) {
- return Utility.PtrToStringFree (avahi_alternative_service_name (Utility.StringToBytes (name)));
- }
-
- private void OnEntryGroupCallback (IntPtr group, EntryGroupState state, IntPtr userdata)
- {
- if (StateChanged != null)
- StateChanged (this, new EntryGroupStateArgs (state));
- }
- }
-}
diff --git a/trunk/avahi-sharp/HostNameResolver.cs b/trunk/avahi-sharp/HostNameResolver.cs
deleted file mode 100644
index 81305fd..0000000
--- a/trunk/avahi-sharp/HostNameResolver.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Net;
-using System.Runtime.InteropServices;
-using System.Text;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- internal delegate void HostNameResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr hostname, IntPtr address,
- LookupResultFlags flags, IntPtr userdata);
-
- public class HostNameResolver : ResolverBase, IDisposable
- {
- private IntPtr handle;
- private Client client;
- private int iface;
- private Protocol proto;
- private string hostname;
- private Protocol aproto;
- private LookupFlags flags;
- private HostNameResolverCallback cb;
-
- private IPAddress currentAddress;
- private string currentHost;
-
- private ArrayList foundListeners = new ArrayList ();
- private ArrayList timeoutListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_host_name_resolver_new (IntPtr client, int iface, Protocol proto,
- byte[] hostname, Protocol aproto, LookupFlags flags,
- HostNameResolverCallback cb, IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_host_name_resolver_free (IntPtr handle);
-
- public event HostAddressHandler Found
- {
- add {
- foundListeners.Add (value);
- Start ();
- }
- remove {
- foundListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event EventHandler Timeout
- {
- add {
- timeoutListeners.Add (value);
- Start ();
- }
- remove {
- timeoutListeners.Remove (value);
- Stop (false);
- }
- }
-
- public IPAddress Address
- {
- get { return currentAddress; }
- }
-
- public string HostName
- {
- get { return currentHost; }
- }
-
- public HostNameResolver (Client client, string hostname) : this (client, -1, Protocol.Unspecified,
- hostname, Protocol.Unspecified,
- LookupFlags.None)
- {
- }
-
- public HostNameResolver (Client client, int iface, Protocol proto, string hostname,
- Protocol aproto, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.hostname = hostname;
- this.aproto = aproto;
- this.flags = flags;
- cb = OnHostNameResolverCallback;
- }
-
- ~HostNameResolver ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (foundListeners.Count == 0 && timeoutListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_host_name_resolver_new (client.Handle, iface, proto,
- Utility.StringToBytes (hostname), aproto, flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (foundListeners.Count == 0 && timeoutListeners.Count == 0))) {
-
- lock (client) {
- avahi_host_name_resolver_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnHostNameResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr hostname, IntPtr address,
- LookupResultFlags flags, IntPtr userdata)
- {
- switch (revent) {
- case ResolverEvent.Found:
- currentAddress = Utility.PtrToAddress (address);
- currentHost = Utility.PtrToString (hostname);
-
- foreach (HostAddressHandler handler in foundListeners)
- handler (this, new HostAddressArgs (currentHost, currentAddress));
- break;
- case ResolverEvent.Failure:
- EmitFailure (client.LastError);
- break;
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/Makefile.am b/trunk/avahi-sharp/Makefile.am
deleted file mode 100644
index 43ab428..0000000
--- a/trunk/avahi-sharp/Makefile.am
+++ /dev/null
@@ -1,84 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-ASSEMBLY = avahi-sharp.dll
-
-CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config
-
-AVAHISOURCES = \
- $(srcdir)/AddressResolver.cs \
- $(srcdir)/AssemblyInfo.cs \
- $(srcdir)/BrowserBase.cs \
- $(srcdir)/Client.cs \
- $(srcdir)/ClientException.cs \
- $(srcdir)/DomainBrowser.cs \
- $(srcdir)/EntryGroup.cs \
- $(srcdir)/HostNameResolver.cs \
- $(srcdir)/RecordBrowser.cs \
- $(srcdir)/ResolverBase.cs \
- $(srcdir)/ServiceBrowser.cs \
- $(srcdir)/ServiceResolver.cs \
- $(srcdir)/ServiceTypeBrowser.cs \
- $(srcdir)/Utility.cs
-
-EXTRA_DIST = \
- $(AVAHISOURCES) \
- $(srcdir)/AvahiTest.cs \
- $(srcdir)/avahi.snk \
- $(srcdir)/$(ASSEMBLY).config.in \
- $(srcdir)/avahi-sharp-docs.source \
- $(srcdir)/en/*.xml \
- $(srcdir)/en/*/*.xml \
- $(srcdir)/gencfg.sh
-
-$(ASSEMBLY): $(AVAHISOURCES)
- mcs -keyfile:$(srcdir)/avahi.snk -target:library -out:$@ -debug $(AVAHISOURCES) -r:Mono.Posix
-
-
-$(ASSEMBLY).config: $(ASSEMBLY).config.in
- $(srcdir)/gencfg.sh $(top_builddir)/avahi-client/libavahi-client.la \
- $(top_builddir)/avahi-common/libavahi-common.la \
- $(top_builddir)/avahi-glib/libavahi-glib.la < $< > $@
-
-if HAVE_MONO
-if HAVE_DBUS
-all: $(ASSEMBLY) $(ASSEMBLY).config
-
-if HAVE_MONODOC
-update-docs: $(ASSEMBLY)
- $(MONODOCER) -assembly:$(ASSEMBLY) -path:en
-
-avahi-sharp-docs.zip: avahi-sharp-docs.tree
-
-avahi-sharp-docs.tree: $(srcdir)/en/*/*
- $(MDASSEMBLER) --out avahi-sharp-docs --ecma $(srcdir)/en
-
-monodocdir = $(MONODOC_DIR)
-monodoc_DATA = avahi-sharp-docs.zip avahi-sharp-docs.tree avahi-sharp-docs.source
-
-endif
-
-install-data-hook: $(ASSEMBLY)
- $(GACUTIL) /i $(ASSEMBLY) /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
-
-uninstall-hook: $(ASSEMBLY)
- $(GACUTIL) /u avahi-sharp /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
-
-endif
-endif
diff --git a/trunk/avahi-sharp/RecordBrowser.cs b/trunk/avahi-sharp/RecordBrowser.cs
deleted file mode 100644
index f65f8ac..0000000
--- a/trunk/avahi-sharp/RecordBrowser.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-/* $Id: ServiceBrowser.cs 635 2005-09-26 03:57:30Z snorp $ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
-
- public delegate void RecordInfoHandler (object o, RecordInfoArgs args);
-
- internal delegate void RecordBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, ushort clazz, ushort type, IntPtr rdata, int size,
- LookupResultFlags flags, IntPtr userdata);
-
- public enum RecordClass {
- In = 1
- }
-
- public enum RecordType {
- A = 1,
- Ns = 2,
- Cname = 5,
- Soa = 6,
- Ptr = 12,
- Hinfo = 13,
- Mx = 15,
- Txt = 16,
- Aaa = 28,
- Srv = 33
- }
-
- public struct RecordInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Name;
- public RecordClass Class;
- public RecordType Type;
- public byte[] Data;
- public LookupResultFlags Flags;
- }
-
- public class RecordInfoArgs : EventArgs
- {
- private RecordInfo record;
-
- public RecordInfo Record {
- get { return record; }
- }
-
- public RecordInfoArgs (RecordInfo record)
- {
- this.record = record;
- }
- }
-
- public class RecordBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string name;
- private RecordClass clazz;
- private RecordType type;
- private LookupFlags flags;
- private RecordBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_record_browser_new (IntPtr client, int iface, Protocol proto,
- byte[] name, ushort clazz, ushort type,
- LookupFlags flags, RecordBrowserCallback cb,
- IntPtr userdata);
-
-
- [DllImport ("avahi-client")]
- private static extern void avahi_record_browser_free (IntPtr handle);
-
- public event RecordInfoHandler RecordAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event RecordInfoHandler RecordRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public RecordInfo[] Records
- {
- get { return (RecordInfo[]) infos.ToArray (typeof (RecordInfo)); }
- }
-
- public RecordBrowser (Client client, string name, RecordType type) :
- this (client, -1, Protocol.Unspecified, name, RecordClass.In, type, LookupFlags.None)
- {
- }
-
- public RecordBrowser (Client client, int iface, Protocol proto, string name, RecordClass clazz,
- RecordType type, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.name = name;
- this.clazz = clazz;
- this.type = type;
- this.flags = flags;
- cb = OnRecordBrowserCallback;
- }
-
- ~RecordBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_record_browser_new (client.Handle, iface, proto, Utility.StringToBytes (name),
- (ushort) clazz, (ushort) type, flags, cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
-
- lock (client) {
- avahi_record_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnRecordBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, ushort clazz, ushort type, IntPtr rdata, int size,
- LookupResultFlags flags, IntPtr userdata)
- {
- RecordInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Name = Utility.PtrToString (name);
- info.Class = (RecordClass) clazz;
- info.Type = (RecordType) type;
- info.Flags = flags;
- info.Data = new byte[size];
-
- if (rdata != IntPtr.Zero) {
- Marshal.Copy (rdata, info.Data, 0, size);
- }
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (RecordInfoHandler handler in addListeners)
- handler (this, new RecordInfoArgs (info));
-
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (RecordInfoHandler handler in removeListeners)
- handler (this, new RecordInfoArgs (info));
-
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/ResolverBase.cs b/trunk/avahi-sharp/ResolverBase.cs
deleted file mode 100644
index 0a5a2a8..0000000
--- a/trunk/avahi-sharp/ResolverBase.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-
-namespace Avahi
-{
- public abstract class ResolverBase
- {
- public event ErrorCodeHandler Failed;
-
- internal void EmitFailure (ErrorCode code)
- {
- if (Failed != null)
- Failed (this, new ErrorCodeArgs (code));
- }
- }
-}
diff --git a/trunk/avahi-sharp/ServiceBrowser.cs b/trunk/avahi-sharp/ServiceBrowser.cs
deleted file mode 100644
index 520e339..0000000
--- a/trunk/avahi-sharp/ServiceBrowser.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
- internal delegate void ServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata);
-
- public struct ServiceInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Domain;
- public string ServiceType;
- public string Name;
-
- public string HostName;
- public IPAddress Address;
- public UInt16 Port;
- public byte[][] Text;
- public LookupResultFlags Flags;
-
- public static ServiceInfo Zero = new ServiceInfo ();
- }
-
- public class ServiceInfoArgs : EventArgs
- {
- private ServiceInfo service;
-
- public ServiceInfo Service {
- get { return service; }
- }
-
- public ServiceInfoArgs (ServiceInfo service)
- {
- this.service = service;
- }
- }
-
- public delegate void ServiceInfoHandler (object o, ServiceInfoArgs args);
-
- public class ServiceBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string domain;
- private string type;
- private LookupFlags flags;
- private ServiceBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_service_browser_new (IntPtr client, int iface, int proto, byte[] type,
- byte[] domain, LookupFlags flags,
- ServiceBrowserCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_service_browser_free (IntPtr handle);
-
- public event ServiceInfoHandler ServiceAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event ServiceInfoHandler ServiceRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public ServiceInfo[] Services
- {
- get { return (ServiceInfo[]) infos.ToArray (typeof (ServiceInfo)); }
- }
-
- public ServiceBrowser (Client client, string type) : this (client, type, client.DomainName)
- {
- }
-
- public ServiceBrowser (Client client, string type, string domain) : this (client, -1, Protocol.Unspecified,
- type, domain, LookupFlags.None)
- {
- }
-
- public ServiceBrowser (Client client, int iface, Protocol proto, string type, string domain, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.domain = domain;
- this.type = type;
- this.flags = flags;
- cb = OnServiceBrowserCallback;
- }
-
- ~ServiceBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_service_browser_new (client.Handle, iface, (int) proto,
- Utility.StringToBytes (type), Utility.StringToBytes (domain),
- flags, cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
-
- lock (client) {
- avahi_service_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnServiceBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr name, IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata)
- {
-
- ServiceInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.ServiceType = Utility.PtrToString (type);
- info.Name = Utility.PtrToString (name);
- info.HostName = null;
- info.Address = null;
- info.Port = 0;
- info.Text = null;
- info.Flags = flags;
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (ServiceInfoHandler handler in addListeners)
- handler (this, new ServiceInfoArgs (info));
-
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (ServiceInfoHandler handler in removeListeners)
- handler (this, new ServiceInfoArgs (info));
-
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/ServiceResolver.cs b/trunk/avahi-sharp/ServiceResolver.cs
deleted file mode 100644
index 945372b..0000000
--- a/trunk/avahi-sharp/ServiceResolver.cs
+++ /dev/null
@@ -1,224 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Net;
-using System.Runtime.InteropServices;
-using System.Text;
-using Mono.Unix;
-
-namespace Avahi
-{
-
- internal delegate void ServiceResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr name, IntPtr type,
- IntPtr domain, IntPtr host, IntPtr address,
- UInt16 port, IntPtr txt, LookupResultFlags flags,
- IntPtr userdata);
-
- public class ServiceResolver : ResolverBase, IDisposable
- {
- private IntPtr handle;
- private ServiceInfo currentInfo;
- private Client client;
- private int iface;
- private Protocol proto;
- private string name;
- private string type;
- private string domain;
- private Protocol aproto;
- private LookupFlags flags;
- private ServiceResolverCallback cb;
-
- private ArrayList foundListeners = new ArrayList ();
- private ArrayList timeoutListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_service_resolver_new (IntPtr client, int iface, Protocol proto,
- byte[] name, byte[] type, byte[] domain,
- Protocol aproto, LookupFlags flags,
- ServiceResolverCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_get_next (IntPtr list);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_string_list_get_text (IntPtr list);
-
- [DllImport ("avahi-common")]
- private static extern int avahi_string_list_get_size (IntPtr list);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_service_resolver_free (IntPtr handle);
-
- public event ServiceInfoHandler Found
- {
- add {
- foundListeners.Add (value);
- Start ();
- }
- remove {
- foundListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event EventHandler Timeout
- {
- add {
- timeoutListeners.Add (value);
- Start ();
- }
- remove {
- timeoutListeners.Remove (value);
- Stop (false);
- }
- }
-
- public ServiceInfo Service
- {
- get { return currentInfo; }
- }
-
- public ServiceResolver (Client client, string name, string type, string domain) : this (client, -1,
- Protocol.Unspecified,
- name, type, domain,
- Protocol.Unspecified,
- LookupFlags.None)
- {
- }
-
- public ServiceResolver (Client client, ServiceInfo service) : this (client, service.NetworkInterface,
- service.Protocol, service.Name,
- service.ServiceType, service.Domain,
- Protocol.Unspecified,
- GetLookupFlags (service.Flags))
- {
- }
-
- public ServiceResolver (Client client, int iface, Protocol proto, string name,
- string type, string domain, Protocol aproto, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.name = name;
- this.type = type;
- this.domain = domain;
- this.aproto = aproto;
- this.flags = flags;
- cb = OnServiceResolverCallback;
- }
-
- ~ServiceResolver ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (foundListeners.Count == 0 && timeoutListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_service_resolver_new (client.Handle, iface, proto,
- Utility.StringToBytes (name), Utility.StringToBytes (type),
- Utility.StringToBytes (domain), aproto, flags, cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (foundListeners.Count == 0 && timeoutListeners.Count == 0))) {
-
- lock (client) {
- avahi_service_resolver_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnServiceResolverCallback (IntPtr resolver, int iface, Protocol proto,
- ResolverEvent revent, IntPtr name, IntPtr type,
- IntPtr domain, IntPtr host, IntPtr address,
- UInt16 port, IntPtr txt, LookupResultFlags flags,
- IntPtr userdata)
- {
- ServiceInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.ServiceType = Utility.PtrToString (type);
- info.Name = Utility.PtrToString (name);
- info.HostName = Utility.PtrToString (host);
- info.Address = Utility.PtrToAddress (address);
- info.Port = port;
-
- ArrayList txtlist = new ArrayList ();
- for (IntPtr l = txt; l != IntPtr.Zero; l = avahi_string_list_get_next (l)) {
- IntPtr buf = avahi_string_list_get_text (l);
- int len = avahi_string_list_get_size (l);
-
- byte[] txtbuf = new byte[len];
- Marshal.Copy (buf, txtbuf, 0, len);
- txtlist.Add (txtbuf);
- }
-
- info.Text = (byte[][]) txtlist.ToArray (typeof (byte[]));
- info.Flags = flags;
-
- switch (revent) {
- case ResolverEvent.Found:
- currentInfo = info;
-
- foreach (ServiceInfoHandler handler in foundListeners)
- handler (this, new ServiceInfoArgs (info));
- break;
- case ResolverEvent.Failure:
- EmitFailure (client.LastError);
- break;
- }
- }
-
- private static LookupFlags GetLookupFlags (LookupResultFlags rflags) {
- LookupFlags ret = LookupFlags.None;
-
- if ((rflags & LookupResultFlags.Multicast) > 0)
- ret |= LookupFlags.UseMulticast;
- if ((rflags & LookupResultFlags.WideArea) > 0)
- ret |= LookupFlags.UseWideArea;
-
- return ret;
- }
- }
-}
diff --git a/trunk/avahi-sharp/ServiceTypeBrowser.cs b/trunk/avahi-sharp/ServiceTypeBrowser.cs
deleted file mode 100644
index 3796d60..0000000
--- a/trunk/avahi-sharp/ServiceTypeBrowser.cs
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Avahi
-{
- internal delegate void ServiceTypeBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata);
-
- public struct ServiceTypeInfo
- {
- public int NetworkInterface;
- public Protocol Protocol;
- public string Domain;
- public string ServiceType;
- public LookupResultFlags Flags;
- }
-
- public class ServiceTypeInfoArgs : EventArgs
- {
- private ServiceTypeInfo type;
-
- public ServiceTypeInfo ServiceType
- {
- get { return type; }
- }
-
- public ServiceTypeInfoArgs (ServiceTypeInfo type)
- {
- this.type = type;
- }
- }
-
- public delegate void ServiceTypeInfoHandler (object o, ServiceTypeInfoArgs args);
-
- public class ServiceTypeBrowser : BrowserBase, IDisposable
- {
- private IntPtr handle;
- private ArrayList infos = new ArrayList ();
- private Client client;
- private int iface;
- private Protocol proto;
- private string domain;
- private LookupFlags flags;
- private ServiceTypeBrowserCallback cb;
-
- private ArrayList addListeners = new ArrayList ();
- private ArrayList removeListeners = new ArrayList ();
-
- [DllImport ("avahi-client")]
- private static extern IntPtr avahi_service_type_browser_new (IntPtr client, int iface, int proto,
- byte[] domain, LookupFlags flags,
- ServiceTypeBrowserCallback cb,
- IntPtr userdata);
-
- [DllImport ("avahi-client")]
- private static extern void avahi_service_type_browser_free (IntPtr handle);
-
- public event ServiceTypeInfoHandler ServiceTypeAdded
- {
- add {
- addListeners.Add (value);
- Start ();
- }
- remove {
- addListeners.Remove (value);
- Stop (false);
- }
- }
-
- public event ServiceTypeInfoHandler ServiceTypeRemoved
- {
- add {
- removeListeners.Add (value);
- Start ();
- }
- remove {
- removeListeners.Remove (value);
- Stop (false);
- }
- }
-
- public ServiceTypeInfo[] ServiceTypes
- {
- get { return (ServiceTypeInfo[]) infos.ToArray (typeof (ServiceTypeInfo)); }
- }
-
- public ServiceTypeBrowser (Client client) : this (client, client.DomainName)
- {
- }
-
- public ServiceTypeBrowser (Client client, string domain) : this (client, -1, Protocol.Unspecified,
- domain, LookupFlags.None)
- {
- }
-
- public ServiceTypeBrowser (Client client, int iface, Protocol proto, string domain, LookupFlags flags)
- {
- this.client = client;
- this.iface = iface;
- this.proto = proto;
- this.domain = domain;
- this.flags = flags;
- cb = OnServiceTypeBrowserCallback;
- }
-
- ~ServiceTypeBrowser ()
- {
- Dispose ();
- }
-
- public void Dispose ()
- {
- Stop (true);
- }
-
- private void Start ()
- {
- if (client.Handle == IntPtr.Zero || handle != IntPtr.Zero ||
- (addListeners.Count == 0 && removeListeners.Count == 0))
- return;
-
- lock (client) {
- handle = avahi_service_type_browser_new (client.Handle, iface, (int) proto,
- Utility.StringToBytes (domain), flags,
- cb, IntPtr.Zero);
-
- if (handle == IntPtr.Zero)
- client.ThrowError ();
- }
- }
-
- private void Stop (bool force)
- {
- if (client.Handle != IntPtr.Zero && handle != IntPtr.Zero &&
- (force || (addListeners.Count == 0 && removeListeners.Count == 0))) {
-
- lock (client) {
- avahi_service_type_browser_free (handle);
- handle = IntPtr.Zero;
- }
- }
- }
-
- private void OnServiceTypeBrowserCallback (IntPtr browser, int iface, Protocol proto, BrowserEvent bevent,
- IntPtr type, IntPtr domain, LookupResultFlags flags,
- IntPtr userdata)
- {
-
- ServiceTypeInfo info;
- info.NetworkInterface = iface;
- info.Protocol = proto;
- info.Domain = Utility.PtrToString (domain);
- info.ServiceType = Utility.PtrToString (type);
- info.Flags = flags;
-
- switch (bevent) {
- case BrowserEvent.Added:
- infos.Add (info);
-
- foreach (ServiceTypeInfoHandler handler in addListeners)
- handler (this, new ServiceTypeInfoArgs (info));
- break;
- case BrowserEvent.Removed:
- infos.Remove (info);
-
- foreach (ServiceTypeInfoHandler handler in removeListeners)
- handler (this, new ServiceTypeInfoArgs (info));
- break;
- default:
- EmitBrowserEvent (bevent);
- break;
- }
- }
- }
-}
diff --git a/trunk/avahi-sharp/Utility.cs b/trunk/avahi-sharp/Utility.cs
deleted file mode 100644
index 9081b01..0000000
--- a/trunk/avahi-sharp/Utility.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-using System;
-using System.Net;
-using System.Text;
-using System.Runtime.InteropServices;
-using Mono.Unix;
-using Mono.Unix.Native;
-
-using Stdlib = Mono.Unix.Native.Stdlib;
-
-namespace Avahi
-{
- internal class Utility
- {
- [DllImport ("libc")]
- private static extern int strlen (IntPtr ptr);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_address_snprint (IntPtr buf, int size, IntPtr address);
-
- [DllImport ("avahi-common")]
- private static extern IntPtr avahi_address_parse (IntPtr str, Protocol proto, IntPtr ret);
-
- public static string PtrToString (IntPtr ptr)
- {
- if (ptr == IntPtr.Zero)
- return null;
-
- int len = strlen (ptr);
- byte[] bytes = new byte[len];
- Marshal.Copy (ptr, bytes, 0, len);
- return Encoding.UTF8.GetString (bytes);
- }
-
- public static string PtrToStringFree (IntPtr ptr)
- {
- if (ptr == IntPtr.Zero)
- return null;
-
- string ret = PtrToString (ptr);
- Free (ptr);
- return ret;
- }
-
- public static byte[] StringToBytes (string str)
- {
- if (str == null)
- return null;
-
- return Encoding.UTF8.GetBytes (str + "\0"); // lame.
- }
-
- private static IntPtr StringToPtr (string str)
- {
- if (str == null)
- return IntPtr.Zero;
-
- byte[] bytes = Utility.StringToBytes (str);
- IntPtr buf = Stdlib.malloc ((uint) bytes.Length + 1);
- Marshal.Copy (bytes, 0, buf, bytes.Length);
- Marshal.WriteByte (buf, bytes.Length, 0);
- return buf;
- }
-
- public static void Free (IntPtr ptr)
- {
- Stdlib.free (ptr);
- }
-
- public static IntPtr AddressToPtr (IPAddress address)
- {
- IntPtr straddr = Utility.StringToPtr (address.ToString ());
- IntPtr addrPtr = Stdlib.malloc (32);
- avahi_address_parse (straddr, Protocol.Unspecified, addrPtr);
- Utility.Free (straddr);
-
- return addrPtr;
- }
-
- public static IPAddress PtrToAddress (IntPtr ptr)
- {
- IPAddress address = null;
-
- if (ptr != IntPtr.Zero) {
- IntPtr buf = Stdlib.malloc (256);
- IntPtr addrPtr = avahi_address_snprint (buf, 256, ptr);
- address = IPAddress.Parse (Utility.PtrToString (addrPtr));
- Utility.Free (addrPtr);
- }
-
- return address;
- }
- }
-}
diff --git a/trunk/avahi-sharp/avahi-sharp-docs.source b/trunk/avahi-sharp/avahi-sharp-docs.source
deleted file mode 100644
index f3b3c75..0000000
--- a/trunk/avahi-sharp/avahi-sharp-docs.source
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<monodoc>
- <source provider="ecma" basefile="avahi-sharp-docs" path="various" title="Avahi" />
-</monodoc>
diff --git a/trunk/avahi-sharp/avahi-sharp.dll.config.in b/trunk/avahi-sharp/avahi-sharp.dll.config.in
deleted file mode 100644
index 5bae58f..0000000
--- a/trunk/avahi-sharp/avahi-sharp.dll.config.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<configuration>
- <dllmap dll="avahi-client" target="@CLIENT_DLNAME@"/>
- <dllmap dll="avahi-common" target="@COMMON_DLNAME@"/>
- <dllmap dll="avahi-glib" target="@GLIB_DLNAME@"/>
-</configuration>
diff --git a/trunk/avahi-sharp/avahi.snk b/trunk/avahi-sharp/avahi.snk
deleted file mode 100644
index 58c23bc..0000000
--- a/trunk/avahi-sharp/avahi.snk
+++ /dev/null
Binary files differ
diff --git a/trunk/avahi-sharp/en/Avahi.xml b/trunk/avahi-sharp/en/Avahi.xml
deleted file mode 100644
index 0739013..0000000
--- a/trunk/avahi-sharp/en/Avahi.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<Namespace Name="Avahi">
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Namespace>
diff --git a/trunk/avahi-sharp/en/Avahi/AddressResolver.xml b/trunk/avahi-sharp/en/Avahi/AddressResolver.xml
deleted file mode 100644
index 064e505..0000000
--- a/trunk/avahi-sharp/en/Avahi/AddressResolver.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<Type Name="AddressResolver" FullName="Avahi.AddressResolver">
- <TypeSignature Language="C#" Value="public class AddressResolver : Avahi.ResolverBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.ResolverBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public AddressResolver (Avahi.Client client, System.Net.IPAddress address);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Found">
- <MemberSignature Language="C#" Value="public event Avahi.HostAddressHandler Found;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.HostAddressHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="public event EventHandler Timeout;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public AddressResolver (Avahi.Client client, int iface, Avahi.Protocol proto, System.Net.IPAddress address, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="address">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/BrowserBase.xml b/trunk/avahi-sharp/en/Avahi/BrowserBase.xml
deleted file mode 100644
index fa6d2ad..0000000
--- a/trunk/avahi-sharp/en/Avahi/BrowserBase.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<Type Name="BrowserBase" FullName="Avahi.BrowserBase">
- <TypeSignature Language="C#" Value="public abstract class BrowserBase" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected BrowserBase ();" />
- <MemberType>Constructor</MemberType>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="CacheExhausted">
- <MemberSignature Language="C#" Value="public event EventHandler CacheExhausted;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AllForNow">
- <MemberSignature Language="C#" Value="public event EventHandler AllForNow;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Failed">
- <MemberSignature Language="C#" Value="public event EventHandler Failed;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/Client.xml b/trunk/avahi-sharp/en/Avahi/Client.xml
deleted file mode 100644
index 0abecf7..0000000
--- a/trunk/avahi-sharp/en/Avahi/Client.xml
+++ /dev/null
@@ -1,178 +0,0 @@
-<Type Name="Client" FullName="Avahi.Client">
- <TypeSignature Language="C#" Value="public class Client : System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public Client ();" />
- <MemberType>Constructor</MemberType>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="StateChanged">
- <MemberSignature Language="C#" Value="public event Avahi.ClientStateHandler StateChanged;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientStateHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Version">
- <MemberSignature Language="C#" Value="public string Version { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DomainName">
- <MemberSignature Language="C#" Value="public string DomainName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostNameFqdn">
- <MemberSignature Language="C#" Value="public string HostNameFqdn { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.ClientState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="LocalServiceCookie">
- <MemberSignature Language="C#" Value="public uint LocalServiceCookie { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.UInt32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public Client (Avahi.ClientFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="flags" Type="Avahi.ClientFlags" />
- </Parameters>
- <Docs>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="JoinServiceName">
- <MemberSignature Language="C#" Value="public static string JoinServiceName (string name, string type, string domain);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="SplitServiceName">
- <MemberSignature Language="C#" Value="public static void SplitServiceName (string service, out string name, out string type, out string domain);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="service" Type="System.String" />
- <Parameter Name="name" Type="System.String&amp;" RefType="out" />
- <Parameter Name="type" Type="System.String&amp;" RefType="out" />
- <Parameter Name="domain" Type="System.String&amp;" RefType="out" />
- </Parameters>
- <Docs>
- <param name="service">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ClientException.xml b/trunk/avahi-sharp/en/Avahi/ClientException.xml
deleted file mode 100644
index 3b8319b..0000000
--- a/trunk/avahi-sharp/en/Avahi/ClientException.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<Type Name="ClientException" FullName="Avahi.ClientException">
- <TypeSignature Language="C#" Value="public class ClientException : System.ApplicationException" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ApplicationException</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="ErrorCode">
- <MemberSignature Language="C#" Value="public Avahi.ErrorCode ErrorCode { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ClientFlags.xml b/trunk/avahi-sharp/en/Avahi/ClientFlags.xml
deleted file mode 100644
index d4ea291..0000000
--- a/trunk/avahi-sharp/en/Avahi/ClientFlags.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<Type Name="ClientFlags" FullName="Avahi.ClientFlags">
- <TypeSignature Language="C#" Value="public enum ClientFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="NoFail">
- <MemberSignature Language="C#" Value="NoFail" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="IgnoreUserConfig">
- <MemberSignature Language="C#" Value="IgnoreUserConfig" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ClientState.xml b/trunk/avahi-sharp/en/Avahi/ClientState.xml
deleted file mode 100644
index c20a02b..0000000
--- a/trunk/avahi-sharp/en/Avahi/ClientState.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<Type Name="ClientState" FullName="Avahi.ClientState">
- <TypeSignature Language="C#" Value="public enum ClientState" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="Collision">
- <MemberSignature Language="C#" Value="Collision" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Registering">
- <MemberSignature Language="C#" Value="Registering" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Running">
- <MemberSignature Language="C#" Value="Running" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Connecting">
- <MemberSignature Language="C#" Value="Connecting" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Failure">
- <MemberSignature Language="C#" Value="Failure" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ClientStateArgs.xml b/trunk/avahi-sharp/en/Avahi/ClientStateArgs.xml
deleted file mode 100644
index e5da11d..0000000
--- a/trunk/avahi-sharp/en/Avahi/ClientStateArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ClientStateArgs" FullName="Avahi.ClientStateArgs">
- <TypeSignature Language="C#" Value="public class ClientStateArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ClientStateArgs (Avahi.ClientState state);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="state" Type="Avahi.ClientState" />
- </Parameters>
- <Docs>
- <param name="state">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.ClientState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ClientState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ClientStateHandler.xml b/trunk/avahi-sharp/en/Avahi/ClientStateHandler.xml
deleted file mode 100644
index 0576975..0000000
--- a/trunk/avahi-sharp/en/Avahi/ClientStateHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ClientStateHandler" FullName="Avahi.ClientStateHandler">
- <TypeSignature Language="C#" Value="public delegate void ClientStateHandler(object o, Avahi.ClientStateArgs state);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="state" Type="Avahi.ClientStateArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="state">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/DomainBrowser.xml b/trunk/avahi-sharp/en/Avahi/DomainBrowser.xml
deleted file mode 100644
index 20536e0..0000000
--- a/trunk/avahi-sharp/en/Avahi/DomainBrowser.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<Type Name="DomainBrowser" FullName="Avahi.DomainBrowser">
- <TypeSignature Language="C#" Value="public class DomainBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public DomainBrowser (Avahi.Client client);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DomainAdded">
- <MemberSignature Language="C#" Value="public event Avahi.DomainInfoHandler DomainAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="DomainRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.DomainInfoHandler DomainRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domains">
- <MemberSignature Language="C#" Value="public Avahi.DomainInfo[] Domains { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public DomainBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string domain, Avahi.DomainBrowserType btype, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="btype" Type="Avahi.DomainBrowserType" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="btype">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/DomainBrowserType.xml b/trunk/avahi-sharp/en/Avahi/DomainBrowserType.xml
deleted file mode 100644
index 9743524..0000000
--- a/trunk/avahi-sharp/en/Avahi/DomainBrowserType.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<Type Name="DomainBrowserType" FullName="Avahi.DomainBrowserType">
- <TypeSignature Language="C#" Value="public enum DomainBrowserType" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="RegisterDefault">
- <MemberSignature Language="C#" Value="RegisterDefault" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="BrowseDefault">
- <MemberSignature Language="C#" Value="BrowseDefault" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Register">
- <MemberSignature Language="C#" Value="Register" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="BrowseLegacy">
- <MemberSignature Language="C#" Value="BrowseLegacy" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Browse">
- <MemberSignature Language="C#" Value="Browse" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainBrowserType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/DomainInfo.xml b/trunk/avahi-sharp/en/Avahi/DomainInfo.xml
deleted file mode 100644
index dddfd60..0000000
--- a/trunk/avahi-sharp/en/Avahi/DomainInfo.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<Type Name="DomainInfo" FullName="Avahi.DomainInfo">
- <TypeSignature Language="C#" Value="public struct DomainInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public string Domain;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/DomainInfoArgs.xml b/trunk/avahi-sharp/en/Avahi/DomainInfoArgs.xml
deleted file mode 100644
index 1967447..0000000
--- a/trunk/avahi-sharp/en/Avahi/DomainInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="DomainInfoArgs" FullName="Avahi.DomainInfoArgs">
- <TypeSignature Language="C#" Value="public class DomainInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public DomainInfoArgs (Avahi.DomainInfo domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="domain" Type="Avahi.DomainInfo" />
- </Parameters>
- <Docs>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public Avahi.DomainInfo Domain { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.DomainInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/DomainInfoHandler.xml b/trunk/avahi-sharp/en/Avahi/DomainInfoHandler.xml
deleted file mode 100644
index 793e2b7..0000000
--- a/trunk/avahi-sharp/en/Avahi/DomainInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="DomainInfoHandler" FullName="Avahi.DomainInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void DomainInfoHandler(object o, Avahi.DomainInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.DomainInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/EntryGroup.xml b/trunk/avahi-sharp/en/Avahi/EntryGroup.xml
deleted file mode 100644
index 93fec22..0000000
--- a/trunk/avahi-sharp/en/Avahi/EntryGroup.xml
+++ /dev/null
@@ -1,491 +0,0 @@
-<Type Name="EntryGroup" FullName="Avahi.EntryGroup">
- <TypeSignature Language="C#" Value="public class EntryGroup : System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public EntryGroup (Avahi.Client client);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="StateChanged">
- <MemberSignature Language="C#" Value="public event Avahi.EntryGroupStateHandler StateChanged;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupStateHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Commit">
- <MemberSignature Language="C#" Value="public void Commit ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Reset">
- <MemberSignature Language="C#" Value="public void Reset ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (string name, string type, string domain, ushort port, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.EntryGroupState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="IsEmpty">
- <MemberSignature Language="C#" Value="public bool IsEmpty { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Boolean</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="GetAlternativeServiceName">
- <MemberSignature Language="C#" Value="public static string GetAlternativeServiceName (string name);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <summary>To be added.</summary>
- <returns>To be added.</returns>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (Avahi.PublishFlags flags, string name, string type, string domain, ushort port, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string host, ushort port, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="host" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="host">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="UpdateService">
- <MemberSignature Language="C#" Value="public void UpdateService (string name, string type, string domain, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="UpdateService">
- <MemberSignature Language="C#" Value="public void UpdateService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string[] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="txt" Type="System.String[]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddServiceSubtype">
- <MemberSignature Language="C#" Value="public void AddServiceSubtype (string name, string type, string domain, string subtype);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="subtype" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="subtype">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddServiceSubtype">
- <MemberSignature Language="C#" Value="public void AddServiceSubtype (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string subtype);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="subtype" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="subtype">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddAddress">
- <MemberSignature Language="C#" Value="public void AddAddress (string name, System.Net.IPAddress address);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddAddress">
- <MemberSignature Language="C#" Value="public void AddAddress (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, System.Net.IPAddress address);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddRecord">
- <MemberSignature Language="C#" Value="public void AddRecord (string name, Avahi.RecordClass clazz, Avahi.RecordType type, uint ttl, byte[] rdata, int length);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="clazz" Type="Avahi.RecordClass" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- <Parameter Name="ttl" Type="System.UInt32" />
- <Parameter Name="rdata" Type="System.Byte[]" />
- <Parameter Name="length" Type="System.Int32" />
- </Parameters>
- <Docs>
- <param name="name">To be added.</param>
- <param name="clazz">To be added.</param>
- <param name="type">To be added.</param>
- <param name="ttl">To be added.</param>
- <param name="rdata">To be added.</param>
- <param name="length">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddRecord">
- <MemberSignature Language="C#" Value="public void AddRecord (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, Avahi.RecordClass clazz, Avahi.RecordType type, uint ttl, byte[] rdata, int length);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="clazz" Type="Avahi.RecordClass" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- <Parameter Name="ttl" Type="System.UInt32" />
- <Parameter Name="rdata" Type="System.Byte[]" />
- <Parameter Name="length" Type="System.Int32" />
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="clazz">To be added.</param>
- <param name="type">To be added.</param>
- <param name="ttl">To be added.</param>
- <param name="rdata">To be added.</param>
- <param name="length">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="AddService">
- <MemberSignature Language="C#" Value="public void AddService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, string host, ushort port, byte[][] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="host" Type="System.String" />
- <Parameter Name="port" Type="System.UInt16" />
- <Parameter Name="txt" Type="System.Byte[][]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="host">To be added.</param>
- <param name="port">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="UpdateService">
- <MemberSignature Language="C#" Value="public void UpdateService (int iface, Avahi.Protocol proto, Avahi.PublishFlags flags, string name, string type, string domain, byte[][] txt);" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters>
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.PublishFlags" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="txt" Type="System.Byte[][]">
- <Attributes>
- <Attribute>
- <AttributeName>System.ParamArray</AttributeName>
- </Attribute>
- </Attributes>
- </Parameter>
- </Parameters>
- <Docs>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="flags">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="txt">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/EntryGroupState.xml b/trunk/avahi-sharp/en/Avahi/EntryGroupState.xml
deleted file mode 100644
index c01e1df..0000000
--- a/trunk/avahi-sharp/en/Avahi/EntryGroupState.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<Type Name="EntryGroupState" FullName="Avahi.EntryGroupState">
- <TypeSignature Language="C#" Value="public enum EntryGroupState" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="Collision">
- <MemberSignature Language="C#" Value="Collision" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Registering">
- <MemberSignature Language="C#" Value="Registering" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Uncommited">
- <MemberSignature Language="C#" Value="Uncommited" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Established">
- <MemberSignature Language="C#" Value="Established" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Failure">
- <MemberSignature Language="C#" Value="Failure" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml b/trunk/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml
deleted file mode 100644
index c7d6f8c..0000000
--- a/trunk/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="EntryGroupStateArgs" FullName="Avahi.EntryGroupStateArgs">
- <TypeSignature Language="C#" Value="public class EntryGroupStateArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public EntryGroupStateArgs (Avahi.EntryGroupState state);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="state" Type="Avahi.EntryGroupState" />
- </Parameters>
- <Docs>
- <param name="state">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="State">
- <MemberSignature Language="C#" Value="public Avahi.EntryGroupState State { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.EntryGroupState</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml b/trunk/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml
deleted file mode 100644
index 427c519..0000000
--- a/trunk/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="EntryGroupStateHandler" FullName="Avahi.EntryGroupStateHandler">
- <TypeSignature Language="C#" Value="public delegate void EntryGroupStateHandler(object o, Avahi.EntryGroupStateArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.EntryGroupStateArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ErrorCode.xml b/trunk/avahi-sharp/en/Avahi/ErrorCode.xml
deleted file mode 100644
index 687f524..0000000
--- a/trunk/avahi-sharp/en/Avahi/ErrorCode.xml
+++ /dev/null
@@ -1,526 +0,0 @@
-<Type Name="ErrorCode" FullName="Avahi.ErrorCode">
- <TypeSignature Language="C#" Value="public enum ErrorCode" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="TooManyEntries">
- <MemberSignature Language="C#" Value="TooManyEntries" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="AccessDenied">
- <MemberSignature Language="C#" Value="AccessDenied" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NotFound">
- <MemberSignature Language="C#" Value="NotFound" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="TooManyClients">
- <MemberSignature Language="C#" Value="TooManyClients" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsYxRrSet">
- <MemberSignature Language="C#" Value="DnsYxRrSet" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidFlags">
- <MemberSignature Language="C#" Value="InvalidFlags" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="BadState">
- <MemberSignature Language="C#" Value="BadState" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNxDomain">
- <MemberSignature Language="C#" Value="DnsNxDomain" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="TooManyObjects">
- <MemberSignature Language="C#" Value="TooManyObjects" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidObject">
- <MemberSignature Language="C#" Value="InvalidObject" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsServFail">
- <MemberSignature Language="C#" Value="DnsServFail" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Disconnected">
- <MemberSignature Language="C#" Value="Disconnected" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidPort">
- <MemberSignature Language="C#" Value="InvalidPort" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Collision">
- <MemberSignature Language="C#" Value="Collision" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidTTL">
- <MemberSignature Language="C#" Value="InvalidTTL" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoNetwork">
- <MemberSignature Language="C#" Value="NoNetwork" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidOperation">
- <MemberSignature Language="C#" Value="InvalidOperation" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NotPermitted">
- <MemberSignature Language="C#" Value="NotPermitted" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDnsType">
- <MemberSignature Language="C#" Value="InvalidDnsType" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDnsError">
- <MemberSignature Language="C#" Value="InvalidDnsError" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNotAuth">
- <MemberSignature Language="C#" Value="DnsNotAuth" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidProtocol">
- <MemberSignature Language="C#" Value="InvalidProtocol" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidConfig">
- <MemberSignature Language="C#" Value="InvalidConfig" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNotZone">
- <MemberSignature Language="C#" Value="DnsNotZone" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Ok">
- <MemberSignature Language="C#" Value="Ok" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidServiceSubtype">
- <MemberSignature Language="C#" Value="InvalidServiceSubtype" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNxRrSet">
- <MemberSignature Language="C#" Value="DnsNxRrSet" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidServiceType">
- <MemberSignature Language="C#" Value="InvalidServiceType" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsFormErr">
- <MemberSignature Language="C#" Value="DnsFormErr" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="IsPattern">
- <MemberSignature Language="C#" Value="IsPattern" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidPacket">
- <MemberSignature Language="C#" Value="InvalidPacket" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidRecord">
- <MemberSignature Language="C#" Value="InvalidRecord" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidKey">
- <MemberSignature Language="C#" Value="InvalidKey" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidRData">
- <MemberSignature Language="C#" Value="InvalidRData" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="VersionMismatch">
- <MemberSignature Language="C#" Value="VersionMismatch" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsRefused">
- <MemberSignature Language="C#" Value="DnsRefused" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidServiceName">
- <MemberSignature Language="C#" Value="InvalidServiceName" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidHostName">
- <MemberSignature Language="C#" Value="InvalidHostName" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidAddress">
- <MemberSignature Language="C#" Value="InvalidAddress" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoDaemon">
- <MemberSignature Language="C#" Value="NoDaemon" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidInterface">
- <MemberSignature Language="C#" Value="InvalidInterface" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Failure">
- <MemberSignature Language="C#" Value="Failure" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsYxDomain">
- <MemberSignature Language="C#" Value="DnsYxDomain" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NotSupported">
- <MemberSignature Language="C#" Value="NotSupported" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoMemory">
- <MemberSignature Language="C#" Value="NoMemory" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="Timeout" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDnsClass">
- <MemberSignature Language="C#" Value="InvalidDnsClass" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DBusError">
- <MemberSignature Language="C#" Value="DBusError" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="DnsNoTimp">
- <MemberSignature Language="C#" Value="DnsNoTimp" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="OS">
- <MemberSignature Language="C#" Value="OS" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="InvalidDomainName">
- <MemberSignature Language="C#" Value="InvalidDomainName" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ErrorCodeArgs.xml b/trunk/avahi-sharp/en/Avahi/ErrorCodeArgs.xml
deleted file mode 100644
index c8a7ccc..0000000
--- a/trunk/avahi-sharp/en/Avahi/ErrorCodeArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ErrorCodeArgs" FullName="Avahi.ErrorCodeArgs">
- <TypeSignature Language="C#" Value="public class ErrorCodeArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ErrorCodeArgs (Avahi.ErrorCode code);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="code" Type="Avahi.ErrorCode" />
- </Parameters>
- <Docs>
- <param name="code">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ErrorCode">
- <MemberSignature Language="C#" Value="public Avahi.ErrorCode ErrorCode { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCode</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ErrorCodeHandler.xml b/trunk/avahi-sharp/en/Avahi/ErrorCodeHandler.xml
deleted file mode 100644
index 04e22d3..0000000
--- a/trunk/avahi-sharp/en/Avahi/ErrorCodeHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ErrorCodeHandler" FullName="Avahi.ErrorCodeHandler">
- <TypeSignature Language="C#" Value="public delegate void ErrorCodeHandler(object o, Avahi.ErrorCodeArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.ErrorCodeArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/HostAddressArgs.xml b/trunk/avahi-sharp/en/Avahi/HostAddressArgs.xml
deleted file mode 100644
index 2b126e3..0000000
--- a/trunk/avahi-sharp/en/Avahi/HostAddressArgs.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<Type Name="HostAddressArgs" FullName="Avahi.HostAddressArgs">
- <TypeSignature Language="C#" Value="public class HostAddressArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public HostAddressArgs (string host, System.Net.IPAddress address);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="host" Type="System.String" />
- <Parameter Name="address" Type="System.Net.IPAddress" />
- </Parameters>
- <Docs>
- <param name="host">To be added.</param>
- <param name="address">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Host">
- <MemberSignature Language="C#" Value="public string Host { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/HostAddressHandler.xml b/trunk/avahi-sharp/en/Avahi/HostAddressHandler.xml
deleted file mode 100644
index f0c195e..0000000
--- a/trunk/avahi-sharp/en/Avahi/HostAddressHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="HostAddressHandler" FullName="Avahi.HostAddressHandler">
- <TypeSignature Language="C#" Value="public delegate void HostAddressHandler(object o, Avahi.HostAddressArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.HostAddressArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/HostNameResolver.xml b/trunk/avahi-sharp/en/Avahi/HostNameResolver.xml
deleted file mode 100644
index 37124fd..0000000
--- a/trunk/avahi-sharp/en/Avahi/HostNameResolver.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-<Type Name="HostNameResolver" FullName="Avahi.HostNameResolver">
- <TypeSignature Language="C#" Value="public class HostNameResolver : Avahi.ResolverBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.ResolverBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public HostNameResolver (Avahi.Client client, string hostname);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="hostname" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="hostname">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Found">
- <MemberSignature Language="C#" Value="public event Avahi.HostAddressHandler Found;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.HostAddressHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="public event EventHandler Timeout;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public HostNameResolver (Avahi.Client client, int iface, Avahi.Protocol proto, string hostname, Avahi.Protocol aproto, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="hostname" Type="System.String" />
- <Parameter Name="aproto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="hostname">To be added.</param>
- <param name="aproto">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/LookupFlags.xml b/trunk/avahi-sharp/en/Avahi/LookupFlags.xml
deleted file mode 100644
index d7882e0..0000000
--- a/trunk/avahi-sharp/en/Avahi/LookupFlags.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<Type Name="LookupFlags" FullName="Avahi.LookupFlags">
- <TypeSignature Language="C#" Value="public enum LookupFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="UseMulticast">
- <MemberSignature Language="C#" Value="UseMulticast" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="UseWideArea">
- <MemberSignature Language="C#" Value="UseWideArea" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoAddress">
- <MemberSignature Language="C#" Value="NoAddress" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoTxt">
- <MemberSignature Language="C#" Value="NoTxt" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/LookupResultFlags.xml b/trunk/avahi-sharp/en/Avahi/LookupResultFlags.xml
deleted file mode 100644
index 0066493..0000000
--- a/trunk/avahi-sharp/en/Avahi/LookupResultFlags.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<Type Name="LookupResultFlags" FullName="Avahi.LookupResultFlags">
- <TypeSignature Language="C#" Value="public enum LookupResultFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="Multicast">
- <MemberSignature Language="C#" Value="Multicast" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="WideArea">
- <MemberSignature Language="C#" Value="WideArea" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Cached">
- <MemberSignature Language="C#" Value="Cached" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Local">
- <MemberSignature Language="C#" Value="Local" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="OurOwn">
- <MemberSignature Language="C#" Value="OurOwn" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/Protocol.xml b/trunk/avahi-sharp/en/Avahi/Protocol.xml
deleted file mode 100644
index 361f034..0000000
--- a/trunk/avahi-sharp/en/Avahi/Protocol.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<Type Name="Protocol" FullName="Avahi.Protocol">
- <TypeSignature Language="C#" Value="public enum Protocol" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="IPv4">
- <MemberSignature Language="C#" Value="IPv4" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Unspecified">
- <MemberSignature Language="C#" Value="Unspecified" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="IPv6">
- <MemberSignature Language="C#" Value="IPv6" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/PublishFlags.xml b/trunk/avahi-sharp/en/Avahi/PublishFlags.xml
deleted file mode 100644
index c21774c..0000000
--- a/trunk/avahi-sharp/en/Avahi/PublishFlags.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<Type Name="PublishFlags" FullName="Avahi.PublishFlags">
- <TypeSignature Language="C#" Value="public enum PublishFlags" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Attributes>
- <Attribute>
- <AttributeName>System.Flags</AttributeName>
- </Attribute>
- </Attributes>
- <Members>
- <Member MemberName="UseMulticast">
- <MemberSignature Language="C#" Value="UseMulticast" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Update">
- <MemberSignature Language="C#" Value="Update" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="AllowMultiple">
- <MemberSignature Language="C#" Value="AllowMultiple" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="UseWideArea">
- <MemberSignature Language="C#" Value="UseWideArea" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Unique">
- <MemberSignature Language="C#" Value="Unique" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoReverse">
- <MemberSignature Language="C#" Value="NoReverse" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="None">
- <MemberSignature Language="C#" Value="None" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoCookie">
- <MemberSignature Language="C#" Value="NoCookie" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoProbe">
- <MemberSignature Language="C#" Value="NoProbe" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="NoAnnounce">
- <MemberSignature Language="C#" Value="NoAnnounce" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.PublishFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/RecordBrowser.xml b/trunk/avahi-sharp/en/Avahi/RecordBrowser.xml
deleted file mode 100644
index fdf32ca..0000000
--- a/trunk/avahi-sharp/en/Avahi/RecordBrowser.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<Type Name="RecordBrowser" FullName="Avahi.RecordBrowser">
- <TypeSignature Language="C#" Value="public class RecordBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public RecordBrowser (Avahi.Client client, string name, Avahi.RecordType type);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public RecordBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string name, Avahi.RecordClass clazz, Avahi.RecordType type, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="clazz" Type="Avahi.RecordClass" />
- <Parameter Name="type" Type="Avahi.RecordType" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="name">To be added.</param>
- <param name="clazz">To be added.</param>
- <param name="type">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="RecordAdded">
- <MemberSignature Language="C#" Value="public event Avahi.RecordInfoHandler RecordAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="RecordRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.RecordInfoHandler RecordRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Records">
- <MemberSignature Language="C#" Value="public Avahi.RecordInfo[] Records { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/RecordClass.xml b/trunk/avahi-sharp/en/Avahi/RecordClass.xml
deleted file mode 100644
index 69787ce..0000000
--- a/trunk/avahi-sharp/en/Avahi/RecordClass.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<Type Name="RecordClass" FullName="Avahi.RecordClass">
- <TypeSignature Language="C#" Value="public enum RecordClass" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="In">
- <MemberSignature Language="C#" Value="In" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordClass</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/RecordInfo.xml b/trunk/avahi-sharp/en/Avahi/RecordInfo.xml
deleted file mode 100644
index 708678e..0000000
--- a/trunk/avahi-sharp/en/Avahi/RecordInfo.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<Type Name="RecordInfo" FullName="Avahi.RecordInfo">
- <TypeSignature Language="C#" Value="public struct RecordInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Name">
- <MemberSignature Language="C#" Value="public string Name;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Class">
- <MemberSignature Language="C#" Value="public Avahi.RecordClass Class;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordClass</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Type">
- <MemberSignature Language="C#" Value="public Avahi.RecordType Type;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Data">
- <MemberSignature Language="C#" Value="public byte[] Data;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Byte[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/RecordInfoArgs.xml b/trunk/avahi-sharp/en/Avahi/RecordInfoArgs.xml
deleted file mode 100644
index 81e6e57..0000000
--- a/trunk/avahi-sharp/en/Avahi/RecordInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="RecordInfoArgs" FullName="Avahi.RecordInfoArgs">
- <TypeSignature Language="C#" Value="public class RecordInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public RecordInfoArgs (Avahi.RecordInfo record);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="record" Type="Avahi.RecordInfo" />
- </Parameters>
- <Docs>
- <param name="record">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Record">
- <MemberSignature Language="C#" Value="public Avahi.RecordInfo Record { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/RecordInfoHandler.xml b/trunk/avahi-sharp/en/Avahi/RecordInfoHandler.xml
deleted file mode 100644
index f9cbc17..0000000
--- a/trunk/avahi-sharp/en/Avahi/RecordInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="RecordInfoHandler" FullName="Avahi.RecordInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void RecordInfoHandler(object o, Avahi.RecordInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.RecordInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/RecordType.xml b/trunk/avahi-sharp/en/Avahi/RecordType.xml
deleted file mode 100644
index 7913cad..0000000
--- a/trunk/avahi-sharp/en/Avahi/RecordType.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<Type Name="RecordType" FullName="Avahi.RecordType">
- <TypeSignature Language="C#" Value="public enum RecordType" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Enum</BaseTypeName>
- </Base>
- <Members>
- <Member MemberName="Cname">
- <MemberSignature Language="C#" Value="Cname" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Ptr">
- <MemberSignature Language="C#" Value="Ptr" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Aaa">
- <MemberSignature Language="C#" Value="Aaa" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Soa">
- <MemberSignature Language="C#" Value="Soa" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Txt">
- <MemberSignature Language="C#" Value="Txt" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Hinfo">
- <MemberSignature Language="C#" Value="Hinfo" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Ns">
- <MemberSignature Language="C#" Value="Ns" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Mx">
- <MemberSignature Language="C#" Value="Mx" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="A">
- <MemberSignature Language="C#" Value="A" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- <Member MemberName="Srv">
- <MemberSignature Language="C#" Value="Srv" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.RecordType</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ResolverBase.xml b/trunk/avahi-sharp/en/Avahi/ResolverBase.xml
deleted file mode 100644
index c7d8549..0000000
--- a/trunk/avahi-sharp/en/Avahi/ResolverBase.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<Type Name="ResolverBase" FullName="Avahi.ResolverBase">
- <TypeSignature Language="C#" Value="public abstract class ResolverBase" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Object</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="protected ResolverBase ();" />
- <MemberType>Constructor</MemberType>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Failed">
- <MemberSignature Language="C#" Value="public event Avahi.ErrorCodeHandler Failed;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ErrorCodeHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceBrowser.xml b/trunk/avahi-sharp/en/Avahi/ServiceBrowser.xml
deleted file mode 100644
index ff4eedb..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceBrowser.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<Type Name="ServiceBrowser" FullName="Avahi.ServiceBrowser">
- <TypeSignature Language="C#" Value="public class ServiceBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceBrowser (Avahi.Client client, string type);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="type" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="type">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceBrowser (Avahi.Client client, string type, string domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceAdded">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceInfoHandler ServiceAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceInfoHandler ServiceRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Services">
- <MemberSignature Language="C#" Value="public Avahi.ServiceInfo[] Services { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string type, string domain, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceInfo.xml b/trunk/avahi-sharp/en/Avahi/ServiceInfo.xml
deleted file mode 100644
index d780085..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceInfo.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-<Type Name="ServiceInfo" FullName="Avahi.ServiceInfo">
- <TypeSignature Language="C#" Value="public struct ServiceInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public string Domain;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceType">
- <MemberSignature Language="C#" Value="public string ServiceType;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Name">
- <MemberSignature Language="C#" Value="public string Name;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="HostName">
- <MemberSignature Language="C#" Value="public string HostName;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Address">
- <MemberSignature Language="C#" Value="public System.Net.IPAddress Address;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Net.IPAddress</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Port">
- <MemberSignature Language="C#" Value="public ushort Port;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.UInt16</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Text">
- <MemberSignature Language="C#" Value="public byte[][] Text;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Byte[][]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Zero">
- <MemberSignature Language="C#" Value="public static Avahi.ServiceInfo Zero;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceInfoArgs.xml b/trunk/avahi-sharp/en/Avahi/ServiceInfoArgs.xml
deleted file mode 100644
index d2ee14d..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ServiceInfoArgs" FullName="Avahi.ServiceInfoArgs">
- <TypeSignature Language="C#" Value="public class ServiceInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceInfoArgs (Avahi.ServiceInfo service);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="service" Type="Avahi.ServiceInfo" />
- </Parameters>
- <Docs>
- <param name="service">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Service">
- <MemberSignature Language="C#" Value="public Avahi.ServiceInfo Service { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceInfoHandler.xml b/trunk/avahi-sharp/en/Avahi/ServiceInfoHandler.xml
deleted file mode 100644
index 91cf630..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ServiceInfoHandler" FullName="Avahi.ServiceInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void ServiceInfoHandler(object o, Avahi.ServiceInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.ServiceInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceResolver.xml b/trunk/avahi-sharp/en/Avahi/ServiceResolver.xml
deleted file mode 100644
index e8ac750..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceResolver.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<Type Name="ServiceResolver" FullName="Avahi.ServiceResolver">
- <TypeSignature Language="C#" Value="public class ServiceResolver : Avahi.ResolverBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.ResolverBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceResolver (Avahi.Client client, string name, string type, string domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceResolver (Avahi.Client client, Avahi.ServiceInfo service);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="service" Type="Avahi.ServiceInfo" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="service">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Found">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceInfoHandler Found;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Timeout">
- <MemberSignature Language="C#" Value="public event EventHandler Timeout;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>System.EventHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Service">
- <MemberSignature Language="C#" Value="public Avahi.ServiceInfo Service { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceResolver (Avahi.Client client, int iface, Avahi.Protocol proto, string name, string type, string domain, Avahi.Protocol aproto, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="name" Type="System.String" />
- <Parameter Name="type" Type="System.String" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="aproto" Type="Avahi.Protocol" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="name">To be added.</param>
- <param name="type">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="aproto">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml b/trunk/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml
deleted file mode 100644
index 5ea64ac..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<Type Name="ServiceTypeBrowser" FullName="Avahi.ServiceTypeBrowser">
- <TypeSignature Language="C#" Value="public class ServiceTypeBrowser : Avahi.BrowserBase, System.IDisposable" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>Avahi.BrowserBase</BaseTypeName>
- </Base>
- <Interfaces>
- <Interface>
- <InterfaceName>System.IDisposable</InterfaceName>
- </Interface>
- </Interfaces>
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeBrowser (Avahi.Client client);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeBrowser (Avahi.Client client, string domain);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="domain" Type="System.String" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="domain">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceTypeAdded">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceTypeInfoHandler ServiceTypeAdded;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceTypeRemoved">
- <MemberSignature Language="C#" Value="public event Avahi.ServiceTypeInfoHandler ServiceTypeRemoved;" />
- <MemberType>Event</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfoHandler</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Dispose">
- <MemberSignature Language="C#" Value="public void Dispose ();" />
- <MemberType>Method</MemberType>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Parameters />
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceTypes">
- <MemberSignature Language="C#" Value="public Avahi.ServiceTypeInfo[] ServiceTypes { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfo[]</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeBrowser (Avahi.Client client, int iface, Avahi.Protocol proto, string domain, Avahi.LookupFlags flags);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="client" Type="Avahi.Client" />
- <Parameter Name="iface" Type="System.Int32" />
- <Parameter Name="proto" Type="Avahi.Protocol" />
- <Parameter Name="domain" Type="System.String" />
- <Parameter Name="flags" Type="Avahi.LookupFlags" />
- </Parameters>
- <Docs>
- <param name="client">To be added.</param>
- <param name="iface">To be added.</param>
- <param name="proto">To be added.</param>
- <param name="domain">To be added.</param>
- <param name="flags">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceTypeInfo.xml b/trunk/avahi-sharp/en/Avahi/ServiceTypeInfo.xml
deleted file mode 100644
index 5b09ae9..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceTypeInfo.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<Type Name="ServiceTypeInfo" FullName="Avahi.ServiceTypeInfo">
- <TypeSignature Language="C#" Value="public struct ServiceTypeInfo" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.ValueType</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName="NetworkInterface">
- <MemberSignature Language="C#" Value="public int NetworkInterface;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.Int32</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Protocol">
- <MemberSignature Language="C#" Value="public Avahi.Protocol Protocol;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.Protocol</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Domain">
- <MemberSignature Language="C#" Value="public string Domain;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceType">
- <MemberSignature Language="C#" Value="public string ServiceType;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>System.String</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="Flags">
- <MemberSignature Language="C#" Value="public Avahi.LookupResultFlags Flags;" />
- <MemberType>Field</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.LookupResultFlags</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml b/trunk/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml
deleted file mode 100644
index fd584cd..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<Type Name="ServiceTypeInfoArgs" FullName="Avahi.ServiceTypeInfoArgs">
- <TypeSignature Language="C#" Value="public class ServiceTypeInfoArgs : System.EventArgs" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.EventArgs</BaseTypeName>
- </Base>
- <Interfaces />
- <Members>
- <Member MemberName=".ctor">
- <MemberSignature Language="C#" Value="public ServiceTypeInfoArgs (Avahi.ServiceTypeInfo type);" />
- <MemberType>Constructor</MemberType>
- <Parameters>
- <Parameter Name="type" Type="Avahi.ServiceTypeInfo" />
- </Parameters>
- <Docs>
- <param name="type">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- <Member MemberName="ServiceType">
- <MemberSignature Language="C#" Value="public Avahi.ServiceTypeInfo ServiceType { get; };" />
- <MemberType>Property</MemberType>
- <ReturnValue>
- <ReturnType>Avahi.ServiceTypeInfo</ReturnType>
- </ReturnValue>
- <Docs>
- <summary>To be added.</summary>
- <value>To be added.</value>
- <remarks>To be added.</remarks>
- </Docs>
- </Member>
- </Members>
- <Docs>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml b/trunk/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml
deleted file mode 100644
index 0fd751f..0000000
--- a/trunk/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<Type Name="ServiceTypeInfoHandler" FullName="Avahi.ServiceTypeInfoHandler">
- <TypeSignature Language="C#" Value="public delegate void ServiceTypeInfoHandler(object o, Avahi.ServiceTypeInfoArgs args);" />
- <AssemblyInfo>
- <AssemblyName>avahi-sharp</AssemblyName>
- <AssemblyVersion>1.0.0.0</AssemblyVersion>
- </AssemblyInfo>
- <Base>
- <BaseTypeName>System.Delegate</BaseTypeName>
- </Base>
- <Parameters>
- <Parameter Name="o" Type="System.Object" />
- <Parameter Name="args" Type="Avahi.ServiceTypeInfoArgs" />
- </Parameters>
- <ReturnValue>
- <ReturnType>System.Void</ReturnType>
- </ReturnValue>
- <Docs>
- <param name="o">To be added.</param>
- <param name="args">To be added.</param>
- <summary>To be added.</summary>
- <remarks>To be added.</remarks>
- </Docs>
-</Type>
diff --git a/trunk/avahi-sharp/en/index.xml b/trunk/avahi-sharp/en/index.xml
deleted file mode 100644
index e180cd0..0000000
--- a/trunk/avahi-sharp/en/index.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<Overview>
- <Assemblies>
- <Assembly Name="avahi-sharp" Version="1.0.0.0">
- <Attributes>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyTrademark(Trademark="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyCopyright(Copyright="(C) 2005 James Willcox &lt;snorp@snorp.net&gt;")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyProduct(Product="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyCompany(Company="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyConfiguration(Configuration="")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyDescription(Description="Mono bindings for the Avahi mDNS/DNS-SD stack")</AttributeName>
- </Attribute>
- <Attribute>
- <AttributeName>System.Reflection.AssemblyTitle(Title="avahi-sharp")</AttributeName>
- </Attribute>
- </Attributes>
- </Assembly>
- </Assemblies>
- <Remarks>To be added.</Remarks>
- <Copyright>To be added.</Copyright>
- <Types>
- <Namespace Name="Avahi">
- <Type Name="AddressResolver" />
- <Type Name="Client" />
- <Type Name="ClientException" />
- <Type Name="DomainInfo" />
- <Type Name="DomainBrowser" />
- <Type Name="EntryGroup" />
- <Type Name="HostNameResolver" />
- <Type Name="ServiceInfo" />
- <Type Name="ServiceBrowser" />
- <Type Name="ServiceResolver" />
- <Type Name="ServiceTypeInfo" />
- <Type Name="ServiceTypeBrowser" />
- <Type Name="HostAddressHandler" />
- <Type Name="ClientStateHandler" />
- <Type Name="DomainInfoHandler" />
- <Type Name="EntryGroupStateHandler" />
- <Type Name="ServiceInfoHandler" />
- <Type Name="ServiceTypeInfoHandler" />
- <Type Name="Protocol" />
- <Type Name="ClientState" />
- <Type Name="DomainBrowserType" />
- <Type Name="EntryGroupState" />
- <Type Name="LookupFlags" />
- <Type Name="LookupResultFlags" />
- <Type Name="HostAddressArgs" />
- <Type Name="ResolverBase" />
- <Type Name="BrowserBase" />
- <Type Name="ClientStateArgs" />
- <Type Name="ErrorCodeArgs" />
- <Type Name="DomainInfoArgs" />
- <Type Name="EntryGroupStateArgs" />
- <Type Name="RecordInfo" />
- <Type Name="RecordInfoArgs" />
- <Type Name="RecordBrowser" />
- <Type Name="ServiceInfoArgs" />
- <Type Name="ServiceTypeInfoArgs" />
- <Type Name="ErrorCodeHandler" />
- <Type Name="RecordInfoHandler" />
- <Type Name="ClientFlags" />
- <Type Name="ErrorCode" />
- <Type Name="PublishFlags" />
- <Type Name="RecordClass" />
- <Type Name="RecordType" />
- </Namespace>
- </Types>
- <Title>avahi-sharp</Title>
-</Overview>
diff --git a/trunk/avahi-sharp/gencfg.sh b/trunk/avahi-sharp/gencfg.sh
deleted file mode 100755
index 3486187..0000000
--- a/trunk/avahi-sharp/gencfg.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-. $1
-client_dlname=$dlname
-. $2
-common_dlname=$dlname
-. $3
-glib_dlname=$dlname
-
-exec sed -e "s,@CLIENT_DLNAME\@,${client_dlname},g" \
- -e "s,@COMMON_DLNAME\@,${common_dlname},g" \
- -e "s,@GLIB_DLNAME\@,${glib_dlname},g"
diff --git a/trunk/avahi-utils/Makefile.am b/trunk/avahi-utils/Makefile.am
deleted file mode 100644
index 3d371b0..0000000
--- a/trunk/avahi-utils/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
-if HAVE_DBUS
-
-bin_PROGRAMS = avahi-browse avahi-resolve avahi-publish avahi-set-host-name
-
-avahi_browse_SOURCES = avahi-browse.c sigint.c sigint.h
-avahi_browse_CFLAGS = $(AM_CFLAGS)
-avahi_browse_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-if HAVE_GDBM
-avahi_browse_SOURCES += stdb.h stdb.c
-avahi_browse_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\"
-avahi_browse_LDADD += -lgdbm
-endif
-
-if HAVE_DBM
-avahi_browse_SOURCES += stdb.h stdb.c
-avahi_browse_CFLAGS += -DDATABASE_FILE=\"$(pkgdatadir)/service-types.db\"
-endif
-
-avahi_resolve_SOURCES = avahi-resolve.c sigint.c sigint.h
-avahi_resolve_CFLAGS = $(AM_CFLAGS)
-avahi_resolve_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-avahi_publish_SOURCES = avahi-publish.c sigint.c sigint.h
-avahi_publish_CFLAGS = $(AM_CFLAGS)
-avahi_publish_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-avahi_set_host_name_SOURCES = avahi-set-host-name.c sigint.c sigint.h
-avahi_set_host_name_CFLAGS = $(AM_CFLAGS)
-avahi_set_host_name_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-install-exec-local:
- cd $(DESTDIR)/$(bindir) && \
- rm -f avahi-resolve-host-name avahi-resolve-address avahi-browse-domains avahi-publish-address avahi-publish-service && \
- $(LN_S) avahi-resolve avahi-resolve-host-name && \
- $(LN_S) avahi-resolve avahi-resolve-address && \
- $(LN_S) avahi-browse avahi-browse-domains && \
- $(LN_S) avahi-publish avahi-publish-address && \
- $(LN_S) avahi-publish avahi-publish-service
-
-endif
diff --git a/trunk/avahi-utils/avahi-browse.c b/trunk/avahi-utils/avahi-browse.c
deleted file mode 100644
index 248b651..0000000
--- a/trunk/avahi-utils/avahi-browse.c
+++ /dev/null
@@ -1,791 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <locale.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/llist.h>
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-
-#include "sigint.h"
-
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
-#include "stdb.h"
-#endif
-
-typedef enum {
- COMMAND_HELP,
- COMMAND_VERSION,
- COMMAND_BROWSE_SERVICES,
- COMMAND_BROWSE_ALL_SERVICES,
- COMMAND_BROWSE_DOMAINS
-} Command;
-
-typedef struct Config {
- int verbose;
- int terminate_on_all_for_now;
- int terminate_on_cache_exhausted;
- char *domain;
- char *stype;
- int ignore_local;
- Command command;
- int resolve;
- int no_fail;
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- int no_db_lookup;
-#endif
-} Config;
-
-typedef struct ServiceInfo ServiceInfo;
-
-struct ServiceInfo {
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- char *name, *type, *domain;
-
- AvahiServiceResolver *resolver;
- Config *config;
-
- AVAHI_LLIST_FIELDS(ServiceInfo, info);
-};
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiClient *client = NULL;
-static int n_all_for_now = 0, n_cache_exhausted = 0, n_resolving = 0;
-static AvahiStringList *browsed_types = NULL;
-static ServiceInfo *services = NULL;
-static int n_columns = 80;
-static int browsing = 0;
-
-static void check_terminate(Config *c) {
-
- assert(n_all_for_now >= 0);
- assert(n_cache_exhausted >= 0);
- assert(n_resolving >= 0);
-
- if (n_all_for_now <= 0 && n_resolving <= 0) {
-
- if (c->verbose) {
- printf(": All for now\n");
- n_all_for_now++; /* Make sure that this event is not repeated */
- }
-
- if (c->terminate_on_all_for_now)
- avahi_simple_poll_quit(simple_poll);
- }
-
- if (n_cache_exhausted <= 0 && n_resolving <= 0) {
-
- if (c->verbose) {
- printf(": Cache exhausted\n");
- n_cache_exhausted++; /* Make sure that this event is not repeated */
- }
-
- if (c->terminate_on_cache_exhausted)
- avahi_simple_poll_quit(simple_poll);
- }
-}
-
-static ServiceInfo *find_service(AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- ServiceInfo *i;
-
- for (i = services; i; i = i->info_next)
- if (i->interface == interface &&
- i->protocol == protocol &&
- strcasecmp(i->name, name) == 0 &&
- avahi_domain_equal(i->type, type) &&
- avahi_domain_equal(i->domain, domain))
-
- return i;
-
- return NULL;
-}
-
-static void print_service_line(Config *config, char c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- char ifname[IF_NAMESIZE];
-
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- if (!config->no_db_lookup)
- type = stdb_lookup(type);
-#endif
-
- printf("%c %4s %4s %-*s %-20s %s\n",
- c,
- interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
- protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a",
- n_columns-35, name, type, domain);
- fflush(stdout);
-}
-
-static void service_resolver_callback(
- AvahiServiceResolver *r,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *a,
- uint16_t port,
- AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- ServiceInfo *i = userdata;
-
- assert(r);
- assert(i);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- char address[AVAHI_ADDRESS_STR_MAX], *t;
-
- avahi_address_snprint(address, sizeof(address), a);
-
- t = avahi_string_list_to_string(txt);
-
- print_service_line(i->config, '=', interface, protocol, name, type, domain);
-
- printf(" hostname = [%s]\n"
- " address = [%s]\n"
- " port = [%i]\n"
- " txt = [%s]\n",
- host_name,
- address,
- port,
- t);
- avahi_free(t);
-
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- fprintf(stderr, "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(client)));
- break;
- }
-
-
- avahi_service_resolver_free(i->resolver);
- i->resolver = NULL;
-
- assert(n_resolving > 0);
- n_resolving--;
- check_terminate(i->config);
- fflush(stdout);
-}
-
-static ServiceInfo *add_service(Config *c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain) {
- ServiceInfo *i;
-
- i = avahi_new(ServiceInfo, 1);
-
- if (c->resolve) {
- if (!(i->resolver = avahi_service_resolver_new(client, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, service_resolver_callback, i))) {
- avahi_free(i);
- fprintf(stderr, "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(client)));
- return NULL;
- }
-
- n_resolving++;
- } else
- i->resolver = NULL;
-
- i->interface = interface;
- i->protocol = protocol;
- i->name = avahi_strdup(name);
- i->type = avahi_strdup(type);
- i->domain = avahi_strdup(domain);
- i->config = c;
-
- AVAHI_LLIST_PREPEND(ServiceInfo, info, services, i);
-
- return i;
-}
-
-static void remove_service(Config *c, ServiceInfo *i) {
- assert(c);
- assert(i);
-
- AVAHI_LLIST_REMOVE(ServiceInfo, info, services, i);
-
- if (i->resolver)
- avahi_service_resolver_free(i->resolver);
-
- avahi_free(i->name);
- avahi_free(i->type);
- avahi_free(i->domain);
- avahi_free(i);
-}
-
-static void service_browser_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AvahiLookupResultFlags flags,
- void *userdata) {
-
- Config *c = userdata;
-
- assert(b);
- assert(c);
-
- switch (event) {
- case AVAHI_BROWSER_NEW: {
- if (c->ignore_local && (flags & AVAHI_LOOKUP_RESULT_LOCAL))
- break;
-
- if (find_service(interface, protocol, name, type, domain))
- return;
-
- add_service(c, interface, protocol, name, type, domain);
-
- print_service_line(c, '+', interface, protocol, name, type, domain);
- break;
-
- }
-
- case AVAHI_BROWSER_REMOVE: {
- ServiceInfo *info;
-
- if (!(info = find_service(interface, protocol, name, type, domain)))
- return;
-
- remove_service(c, info);
-
- print_service_line(c, '-', interface, protocol, name, type, domain);
- break;
- }
-
- case AVAHI_BROWSER_FAILURE:
- fprintf(stderr, "service_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- n_cache_exhausted --;
- check_terminate(c);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- n_all_for_now --;
- check_terminate(c);
- break;
- }
-}
-
-static void browse_service_type(Config *c, const char *stype, const char *domain) {
- AvahiServiceBrowser *b;
- AvahiStringList *i;
-
- assert(c);
- assert(client);
- assert(stype);
-
- for (i = browsed_types; i; i = i->next)
- if (avahi_domain_equal(stype, (char*) i->text))
- return;
-
- if (!(b = avahi_service_browser_new(
- client,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- stype,
- domain,
- 0,
- service_browser_callback,
- c))) {
-
- fprintf(stderr, "avahi_service_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- browsed_types = avahi_string_list_add(browsed_types, stype);
-
- n_all_for_now++;
- n_cache_exhausted++;
-}
-
-static void service_type_browser_callback(
- AvahiServiceTypeBrowser *b,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- Config *c = userdata;
-
- assert(b);
- assert(c);
-
- switch (event) {
-
- case AVAHI_BROWSER_NEW:
- browse_service_type(c, type, domain);
- break;
-
- case AVAHI_BROWSER_REMOVE:
- /* We're dirty and never remove the browser again */
- break;
-
- case AVAHI_BROWSER_FAILURE:
- fprintf(stderr, "service_type_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- n_cache_exhausted --;
- check_terminate(c);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- n_all_for_now --;
- check_terminate(c);
- break;
- }
-}
-
-static void browse_all(Config *c) {
- AvahiServiceTypeBrowser *b;
-
- assert(c);
-
- if (!(b = avahi_service_type_browser_new(
- client,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- c->domain,
- 0,
- service_type_browser_callback,
- c))) {
-
- fprintf(stderr, "avahi_service_type_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- n_cache_exhausted++;
- n_all_for_now++;
-}
-
-static void domain_browser_callback(
- AvahiDomainBrowser *b,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void *userdata) {
-
- Config *c = userdata;
-
- assert(b);
- assert(c);
-
- switch (event) {
-
- case AVAHI_BROWSER_NEW:
- case AVAHI_BROWSER_REMOVE: {
- char ifname[IF_NAMESIZE];
-
- printf("%c %4s %4s %s\n",
- event == AVAHI_BROWSER_NEW ? '+' : '-',
- interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "n/a",
- protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "n/a",
- domain);
- break;
- }
-
- case AVAHI_BROWSER_FAILURE:
- fprintf(stderr, "domain_browser failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- n_cache_exhausted --;
- check_terminate(c);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- n_all_for_now --;
- check_terminate(c);
- break;
- }
-}
-
-static void browse_domains(Config *c) {
- AvahiDomainBrowser *b;
-
- assert(c);
-
- if (!(b = avahi_domain_browser_new(
- client,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- c->domain,
- AVAHI_DOMAIN_BROWSER_BROWSE,
- 0,
- domain_browser_callback,
- c))) {
-
- fprintf(stderr, "avahi_domain_browser_new() failed: %s\n", avahi_strerror(avahi_client_errno(client)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- n_cache_exhausted++;
- n_all_for_now++;
-}
-
-static int start(Config *config) {
-
- assert(!browsing);
-
- if (config->verbose) {
- const char *version, *hn;
-
- if (!(version = avahi_client_get_version_string(client))) {
- fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- if (!(hn = avahi_client_get_host_name_fqdn(client))) {
- fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
-
- if (config->command == COMMAND_BROWSE_DOMAINS)
- fprintf(stderr, "E Ifce Prot Domain\n");
- else
- fprintf(stderr, "E Ifce Prot %-*s %-20s Domain\n", n_columns-35, "Name", "Type");
- }
-
- if (config->command == COMMAND_BROWSE_SERVICES)
- browse_service_type(config, config->stype, config->domain);
- else if (config->command == COMMAND_BROWSE_ALL_SERVICES)
- browse_all(config);
- else {
- assert(config->command == COMMAND_BROWSE_DOMAINS);
- browse_domains(config);
- }
-
- browsing = 1;
- return 0;
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- Config *config = userdata;
-
- /* This function might be called when avahi_client_new() has not
- * returned yet.*/
- client = c;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
-
- if (config->no_fail && avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED) {
- int error;
-
- /* We have been disconnected, so let reconnect */
-
- fprintf(stderr, "Disconnected, reconnecting ...\n");
-
- avahi_client_free(client);
- client = NULL;
-
- avahi_string_list_free(browsed_types);
- browsed_types = NULL;
-
- while (services)
- remove_service(config, services);
-
- browsing = 0;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), AVAHI_CLIENT_NO_FAIL, client_callback, config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- avahi_simple_poll_quit(simple_poll);
- }
-
- } else {
- fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- break;
-
- case AVAHI_CLIENT_S_REGISTERING:
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_S_COLLISION:
-
- if (!browsing)
- if (start(config) < 0)
- avahi_simple_poll_quit(simple_poll);
-
- break;
-
- case AVAHI_CLIENT_CONNECTING:
-
- if (config->verbose)
- fprintf(stderr, "Waiting for daemon ...\n");
-
- break;
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- if (strstr(argv0, "domain"))
- fprintf(f, "%s [options] \n\n", argv0);
- else
- fprintf(f,
- "%s [options] <service type>\n"
- "%s [options] -a\n"
- "%s [options] -D\n\n",
- argv0, argv0, argv0);
-
- fprintf(f,
- " -h --help Show this help\n"
- " -V --version Show version\n"
- " -D --browse-domains Browse for browsing domains instead of services\n"
- " -a --all Show all services, regardless of the type\n"
- " -d --domain=DOMAIN The domain to browse in\n"
- " -v --verbose Enable verbose mode\n"
- " -t --terminate Terminate after dumping a more or less complete list\n"
- " -c --cache Terminate after dumping all entries from the cache\n"
- " -l --ignore-local Ignore local services\n"
- " -r --resolve Resolve services found\n"
- " -f --no-fail Don't fail if the daemon is not available\n"
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- " -k --no-db-lookup Don't lookup service types\n"
-#endif
- );
-}
-
-static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
- int o;
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "browse-domains", no_argument, NULL, 'D' },
- { "domain", required_argument, NULL, 'd' },
- { "all", no_argument, NULL, 'a' },
- { "verbose", no_argument, NULL, 'v' },
- { "terminate", no_argument, NULL, 't' },
- { "cache", no_argument, NULL, 'c' },
- { "ignore-local", no_argument, NULL, 'l' },
- { "resolve", no_argument, NULL, 'r' },
- { "no-fail", no_argument, NULL, 'f' },
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- { "no-db-lookup", no_argument, NULL, 'k' },
-#endif
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- c->command = strstr(argv0, "domain") ? COMMAND_BROWSE_DOMAINS : COMMAND_BROWSE_SERVICES;
- c->verbose =
- c->terminate_on_cache_exhausted =
- c->terminate_on_all_for_now =
- c->ignore_local =
- c->resolve =
- c->no_fail = 0;
- c->domain = c->stype = NULL;
-
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- c->no_db_lookup = 0;
-#endif
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hVd:avtclrDf"
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- "k"
-#endif
- , long_options, NULL)) >= 0) {
-
- switch(o) {
- case 'h':
- c->command = COMMAND_HELP;
- break;
- case 'V':
- c->command = COMMAND_VERSION;
- break;
- case 'a':
- c->command = COMMAND_BROWSE_ALL_SERVICES;
- break;
- case 'D':
- c->command = COMMAND_BROWSE_DOMAINS;
- break;
- case 'd':
- avahi_free(c->domain);
- c->domain = avahi_strdup(optarg);
- break;
- case 'v':
- c->verbose = 1;
- break;
- case 't':
- c->terminate_on_all_for_now = 1;
- break;
- case 'c':
- c->terminate_on_cache_exhausted = 1;
- break;
- case 'l':
- c->ignore_local = 1;
- break;
- case 'r':
- c->resolve = 1;
- break;
- case 'f':
- c->no_fail = 1;
- break;
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- case 'k':
- c->no_db_lookup = 1;
- break;
-#endif
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (c->command == COMMAND_BROWSE_SERVICES) {
- if (optind >= argc) {
- fprintf(stderr, "Too few arguments\n");
- return -1;
- }
-
- c->stype = avahi_strdup(argv[optind]);
- optind++;
- }
-
- if (optind < argc) {
- fprintf(stderr, "Too many arguments\n");
- return -1;
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[]) {
- int ret = 1, error;
- Config config;
- const char *argv0;
- char *ec;
-
- setlocale(LC_ALL, "");
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- if ((ec = getenv("COLUMNS")))
- n_columns = atoi(ec);
-
- if (n_columns < 40)
- n_columns = 40;
-
- if (parse_command_line(&config, argv0, argc, argv) < 0)
- goto fail;
-
- switch (config.command) {
- case COMMAND_HELP:
- help(stdout, argv0);
- ret = 0;
- break;
-
- case COMMAND_VERSION:
- printf("%s "PACKAGE_VERSION"\n", argv0);
- ret = 0;
- break;
-
- case COMMAND_BROWSE_SERVICES:
- case COMMAND_BROWSE_ALL_SERVICES:
- case COMMAND_BROWSE_DOMAINS:
-
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- if (sigint_install(simple_poll) < 0)
- goto fail;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), config.no_fail ? AVAHI_CLIENT_NO_FAIL : 0, client_callback, &config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- avahi_simple_poll_loop(simple_poll);
- ret = 0;
- break;
- }
-
-
-fail:
-
- while (services)
- remove_service(&config, services);
-
- if (client)
- avahi_client_free(client);
-
- sigint_uninstall();
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(config.domain);
- avahi_free(config.stype);
-
- avahi_string_list_free(browsed_types);
-
-#if defined(HAVE_GDBM) || defined(HAVE_DBM)
- stdb_shutdown();
-#endif
-
- return ret;
-}
diff --git a/trunk/avahi-utils/avahi-publish.c b/trunk/avahi-utils/avahi-publish.c
deleted file mode 100644
index 77dc422..0000000
--- a/trunk/avahi-utils/avahi-publish.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <errno.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-
-#include "sigint.h"
-
-typedef enum {
- COMMAND_UNSPEC,
- COMMAND_HELP,
- COMMAND_VERSION,
- COMMAND_PUBLISH_SERVICE,
- COMMAND_PUBLISH_ADDRESS
-} Command;
-
-typedef struct Config {
- int verbose, no_fail;
- Command command;
- char *name, *stype, *domain, *host;
- uint16_t port;
- AvahiStringList *txt, *subtypes;
- AvahiAddress address;
-} Config;
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiClient *client = NULL;
-static AvahiEntryGroup *entry_group = NULL;
-
-static int register_stuff(Config *config);
-
-static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, void *userdata) {
- Config *config = userdata;
-
- assert(g);
- assert(config);
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
-
- fprintf(stderr, "Established under name '%s'\n", config->name);
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE:
-
- fprintf(stderr, "Failed to register: %s\n", avahi_strerror(avahi_client_errno(client)));
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
-
- if (config->command == COMMAND_PUBLISH_SERVICE)
- n = avahi_alternative_service_name(config->name);
- else {
- assert(config->command == COMMAND_PUBLISH_ADDRESS);
- n = avahi_alternative_host_name(config->name);
- }
-
- fprintf(stderr, "Name collision, picking new name '%s'.\n", n);
- avahi_free(config->name);
- config->name = n;
-
- register_stuff(config);
-
- break;
- }
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static int register_stuff(Config *config) {
- assert(config);
-
- if (!entry_group) {
- if (!(entry_group = avahi_entry_group_new(client, entry_group_callback, config))) {
- fprintf(stderr, "Failed to create entry group: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
- }
-
- assert(avahi_entry_group_is_empty(entry_group));
-
- if (config->command == COMMAND_PUBLISH_ADDRESS) {
-
- if (avahi_entry_group_add_address(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, &config->address) < 0) {
- fprintf(stderr, "Failed to add address: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- } else {
- AvahiStringList *i;
-
- assert(config->command == COMMAND_PUBLISH_SERVICE);
-
- if (avahi_entry_group_add_service_strlst(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, config->host, config->port, config->txt) < 0) {
- fprintf(stderr, "Failed to add service: %s\n", avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
-
- for (i = config->subtypes; i; i = i->next)
- if (avahi_entry_group_add_service_subtype(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, (char*) i->text) < 0) {
- fprintf(stderr, "Failed to add subtype '%s': %s\n", i->text, avahi_strerror(avahi_client_errno(client)));
- return -1;
- }
- }
-
- avahi_entry_group_commit(entry_group);
-
- return 0;
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- Config *config = userdata;
-
- client = c;
-
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
-
- if (config->no_fail && avahi_client_errno(c) == AVAHI_ERR_DISCONNECTED) {
- int error;
-
- /* We have been disconnected, so let reconnect */
-
- fprintf(stderr, "Disconnected, reconnecting ...\n");
-
- avahi_client_free(client);
- client = NULL;
- entry_group = NULL;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), AVAHI_CLIENT_NO_FAIL, client_callback, config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- avahi_simple_poll_quit(simple_poll);
- }
-
- } else {
- fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- }
-
- break;
-
- case AVAHI_CLIENT_S_RUNNING:
-
- if (register_stuff(config) < 0)
- avahi_simple_poll_quit(simple_poll);
-
- break;
-
- case AVAHI_CLIENT_S_COLLISION:
-
- if (config->verbose)
- fprintf(stderr, "Host name conflict\n");
-
- /* Fall through */
-
- case AVAHI_CLIENT_S_REGISTERING:
-
- if (entry_group) {
- avahi_entry_group_free(entry_group);
- entry_group = NULL;
- }
- break;
-
- case AVAHI_CLIENT_CONNECTING:
-
- if (config->verbose)
- fprintf(stderr, "Waiting for daemon ...\n");
-
- break;
-
- ;
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- fprintf(f,
- "%s [options] %s <name> <type> <port> [<txt ...>]\n"
- "%s [options] %s <host-name> <address>\n\n"
- " -h --help Show this help\n"
- " -V --version Show version\n"
- " -s --service Publish service\n"
- " -a --address Publish address\n"
- " -v --verbose Enable verbose mode\n"
- " -d --domain=DOMAIN Domain to publish service in\n"
- " -H --host=DOMAIN Host where service resides\n"
- " --subtype=SUBTYPE An additional subtype to register this service with\n"
- " -f --no-fail Don't fail if the daemon is not available\n",
- argv0, strstr(argv0, "service") ? "[-s]" : "-s",
- argv0, strstr(argv0, "address") ? "[-a]" : "-a");
-}
-
-static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
- int o;
-
- enum {
- ARG_SUBTYPE = 256
- };
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "service", no_argument, NULL, 's' },
- { "address", no_argument, NULL, 'a' },
- { "verbose", no_argument, NULL, 'v' },
- { "domain", required_argument, NULL, 'd' },
- { "host", required_argument, NULL, 'H' },
- { "subtype", required_argument, NULL, ARG_SUBTYPE},
- { "no-fail", no_argument, NULL, 'f' },
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- c->command = strstr(argv0, "address") ? COMMAND_PUBLISH_ADDRESS : (strstr(argv0, "service") ? COMMAND_PUBLISH_SERVICE : COMMAND_UNSPEC);
- c->verbose = c->no_fail = 0;
- c->host = c->name = c->domain = c->stype = NULL;
- c->port = 0;
- c->txt = c->subtypes = NULL;
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hVsavd:H:f", long_options, NULL)) >= 0) {
-
- switch(o) {
- case 'h':
- c->command = COMMAND_HELP;
- break;
- case 'V':
- c->command = COMMAND_VERSION;
- break;
- case 's':
- c->command = COMMAND_PUBLISH_SERVICE;
- break;
- case 'a':
- c->command = COMMAND_PUBLISH_ADDRESS;
- break;
- case 'v':
- c->verbose = 1;
- break;
- case 'd':
- avahi_free(c->domain);
- c->domain = avahi_strdup(optarg);
- break;
- case 'H':
- avahi_free(c->host);
- c->host = avahi_strdup(optarg);
- break;
- case 'f':
- c->no_fail = 1;
- break;
- case ARG_SUBTYPE:
- c->subtypes = avahi_string_list_add(c->subtypes, optarg);
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (c->command == COMMAND_PUBLISH_ADDRESS) {
- if (optind+2 != argc) {
- fprintf(stderr, "Bad number of arguments\n");
- return -1;
- }
-
- avahi_free(c->name);
- c->name = avahi_strdup(argv[optind]);
- avahi_address_parse(argv[optind+1], AVAHI_PROTO_UNSPEC, &c->address);
-
- } else if (c->command == COMMAND_PUBLISH_SERVICE) {
-
- char *e;
- long int p;
- int i;
-
- if (optind+3 > argc) {
- fprintf(stderr, "Bad number of arguments\n");
- return -1;
- }
-
- c->name = avahi_strdup(argv[optind]);
- c->stype = avahi_strdup(argv[optind+1]);
-
- errno = 0;
- p = strtol(argv[optind+2], &e, 0);
-
- if (errno != 0 || *e || p < 0 || p > 0xFFFF) {
- fprintf(stderr, "Failed to parse port number: %s\n", argv[optind+2]);
- return -1;
- }
-
- c->port = p;
-
- for (i = optind+3; i < argc; i++)
- c->txt = avahi_string_list_add(c->txt, argv[i]);
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[]) {
- int ret = 1, error;
- Config config;
- const char *argv0;
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- if (parse_command_line(&config, argv0, argc, argv) < 0)
- goto fail;
-
- switch (config.command) {
- case COMMAND_UNSPEC:
- ret = 1;
- fprintf(stderr, "No command specified.\n");
- break;
-
- case COMMAND_HELP:
- help(stdout, argv0);
- ret = 0;
- break;
-
- case COMMAND_VERSION:
- printf("%s "PACKAGE_VERSION"\n", argv0);
- ret = 0;
- break;
-
- case COMMAND_PUBLISH_SERVICE:
- case COMMAND_PUBLISH_ADDRESS:
-
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- if (sigint_install(simple_poll) < 0)
- goto fail;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), config.no_fail ? AVAHI_CLIENT_NO_FAIL : 0, client_callback, &config, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- if (avahi_client_get_state(client) != AVAHI_CLIENT_CONNECTING && config.verbose) {
- const char *version, *hn;
-
- if (!(version = avahi_client_get_version_string(client))) {
- fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- if (!(hn = avahi_client_get_host_name_fqdn(client))) {
- fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
- }
-
- avahi_simple_poll_loop(simple_poll);
- ret = 0;
- break;
- }
-
-fail:
-
- if (client)
- avahi_client_free(client);
-
- sigint_uninstall();
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(config.host);
- avahi_free(config.name);
- avahi_free(config.stype);
- avahi_free(config.domain);
- avahi_string_list_free(config.subtypes);
- avahi_string_list_free(config.txt);
-
- return ret;
-}
diff --git a/trunk/avahi-utils/avahi-resolve.c b/trunk/avahi-utils/avahi-resolve.c
deleted file mode 100644
index 9b1d517..0000000
--- a/trunk/avahi-utils/avahi-resolve.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <getopt.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <locale.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/error.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/llist.h>
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-
-#include "sigint.h"
-
-typedef enum {
- COMMAND_UNSPEC,
- COMMAND_HELP,
- COMMAND_VERSION,
- COMMAND_RESOLVE_HOST_NAME,
- COMMAND_RESOLVE_ADDRESS
-} Command;
-
-typedef struct Config {
- int verbose;
- Command command;
- AvahiProtocol proto;
-} Config;
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiClient *client = NULL;
-
-static int n_resolving = 0;
-
-static void host_name_resolver_callback(
- AvahiHostNameResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- assert(r);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND: {
- char address[AVAHI_ADDRESS_STR_MAX];
-
- avahi_address_snprint(address, sizeof(address), a);
-
- printf("%s\t%s\n", name, address);
-
- break;
- }
-
- case AVAHI_RESOLVER_FAILURE:
-
- fprintf(stderr, "Failed to resolve host name '%s': %s\n", name, avahi_strerror(avahi_client_errno(client)));
- break;
- }
-
-
- avahi_host_name_resolver_free(r);
-
- assert(n_resolving > 0);
- n_resolving--;
-
- if (n_resolving <= 0)
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void address_resolver_callback(
- AvahiAddressResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const AvahiAddress *a,
- const char *name,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void *userdata) {
-
- char address[AVAHI_ADDRESS_STR_MAX];
- assert(r);
-
- avahi_address_snprint(address, sizeof(address), a);
-
- switch (event) {
- case AVAHI_RESOLVER_FOUND:
-
- printf("%s\t%s\n", address, name);
- break;
-
- case AVAHI_RESOLVER_FAILURE:
-
- fprintf(stderr, "Failed to resolve address '%s': %s\n", address, avahi_strerror(avahi_client_errno(client)));
- break;
- }
-
-
- avahi_address_resolver_free(r);
-
- assert(n_resolving > 0);
- n_resolving--;
-
- if (n_resolving <= 0)
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- switch (state) {
- case AVAHI_CLIENT_FAILURE:
- fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_CLIENT_S_REGISTERING:
- case AVAHI_CLIENT_S_RUNNING:
- case AVAHI_CLIENT_S_COLLISION:
- case AVAHI_CLIENT_CONNECTING:
- ;
- }
-}
-
-static void help(FILE *f, const char *argv0) {
- fprintf(f,
- "%s [options] %s <host name ...>\n"
- "%s [options] %s <address ... >\n\n"
- " -h --help Show this help\n"
- " -V --version Show version\n"
- " -n --name Resolve host name\n"
- " -a --address Resolve address\n"
- " -v --verbose Enable verbose mode\n"
- " -6 Lookup IPv6 address\n"
- " -4 Lookup IPv4 address\n",
- argv0, strstr(argv0, "address") ? "[-a]" : "-a",
- argv0, strstr(argv0, "host-name") ? "[-n]" : "-n");
-}
-
-static int parse_command_line(Config *c, const char *argv0, int argc, char *argv[]) {
- int o;
-
- static const struct option long_options[] = {
- { "help", no_argument, NULL, 'h' },
- { "version", no_argument, NULL, 'V' },
- { "name", no_argument, NULL, 'n' },
- { "address", no_argument, NULL, 'a' },
- { "verbose", no_argument, NULL, 'v' },
- { NULL, 0, NULL, 0 }
- };
-
- assert(c);
-
- c->command = strstr(argv0, "address") ? COMMAND_RESOLVE_ADDRESS : (strstr(argv0, "host-name") ? COMMAND_RESOLVE_HOST_NAME : COMMAND_UNSPEC);
- c->proto = AVAHI_PROTO_UNSPEC;
- c->verbose = 0;
-
- opterr = 0;
- while ((o = getopt_long(argc, argv, "hVnav46", long_options, NULL)) >= 0) {
-
- switch(o) {
- case 'h':
- c->command = COMMAND_HELP;
- break;
- case 'V':
- c->command = COMMAND_VERSION;
- break;
- case 'n':
- c->command = COMMAND_RESOLVE_HOST_NAME;
- break;
- case 'a':
- c->command = COMMAND_RESOLVE_ADDRESS;
- break;
- case 'v':
- c->verbose = 1;
- break;
- case '4':
- c->proto = AVAHI_PROTO_INET;
- break;
- case '6':
- c->proto = AVAHI_PROTO_INET6;
- break;
- default:
- fprintf(stderr, "Invalid command line argument: %c\n", o);
- return -1;
- }
- }
-
- if (c->command == COMMAND_RESOLVE_ADDRESS || c->command == COMMAND_RESOLVE_HOST_NAME) {
- if (optind >= argc) {
- fprintf(stderr, "Too few arguments\n");
- return -1;
- }
- }
-
- return 0;
-}
-
-int main(int argc, char *argv[]) {
- int ret = 1, error;
- Config config;
- const char *argv0;
-
- if ((argv0 = strrchr(argv[0], '/')))
- argv0++;
- else
- argv0 = argv[0];
-
- if (parse_command_line(&config, argv0, argc, argv) < 0)
- goto fail;
-
- switch (config.command) {
- case COMMAND_UNSPEC:
- ret = 1;
- fprintf(stderr, "No command specified.\n");
- break;
-
- case COMMAND_HELP:
- help(stdout, argv0);
- ret = 0;
- break;
-
- case COMMAND_VERSION:
- printf("%s "PACKAGE_VERSION"\n", argv0);
- ret = 0;
- break;
-
- case COMMAND_RESOLVE_HOST_NAME:
- case COMMAND_RESOLVE_ADDRESS: {
- int i;
-
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- if (sigint_install(simple_poll) < 0)
- goto fail;
-
- if (!(client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error))) {
- fprintf(stderr, "Failed to create client object: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- if (config.verbose) {
- const char *version, *hn;
-
- if (!(version = avahi_client_get_version_string(client))) {
- fprintf(stderr, "Failed to query version string: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- if (!(hn = avahi_client_get_host_name_fqdn(client))) {
- fprintf(stderr, "Failed to query host name: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- fprintf(stderr, "Server version: %s; Host name: %s\n", version, hn);
- }
-
- n_resolving = 0;
-
- for (i = optind; i < argc; i++) {
-
- if (config.command == COMMAND_RESOLVE_HOST_NAME) {
-
- if (!(avahi_host_name_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, argv[i], config.proto, 0, host_name_resolver_callback, NULL))) {
- fprintf(stderr, "Failed to create host name resolver: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- } else {
- AvahiAddress a;
-
- assert(config.command == COMMAND_RESOLVE_ADDRESS);
-
- if (!avahi_address_parse(argv[i], AVAHI_PROTO_UNSPEC, &a)) {
- fprintf(stderr, "Failed to parse address '%s'\n", argv[i]);
- goto fail;
- }
-
- if (!(avahi_address_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, &a, 0, address_resolver_callback, NULL))) {
- fprintf(stderr, "Failed to create address resolver: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
- }
-
- n_resolving++;
- }
-
- avahi_simple_poll_loop(simple_poll);
- ret = 0;
- break;
- }
- }
-
-fail:
-
- if (client)
- avahi_client_free(client);
-
- sigint_uninstall();
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return ret;
-}
diff --git a/trunk/avahi-utils/sigint.c b/trunk/avahi-utils/sigint.c
deleted file mode 100644
index eb97f38..0000000
--- a/trunk/avahi-utils/sigint.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <assert.h>
-#include <string.h>
-#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <stdio.h>
-
-#include <avahi-common/gccmacro.h>
-#include "sigint.h"
-
-static AvahiSimplePoll *simple_poll = NULL;
-static struct sigaction old_sigint_sa, old_sigterm_sa;
-static int pipe_fds[2] = { -1, -1 };
-static AvahiWatch *watch = NULL;
-
-static int set_nonblock(int fd) {
- int n;
-
- assert(fd >= 0);
-
- if ((n = fcntl(fd, F_GETFL)) < 0)
- return -1;
-
- if (n & O_NONBLOCK)
- return 0;
-
- return fcntl(fd, F_SETFL, n|O_NONBLOCK);
-}
-
-static void handler(int s) {
- write(pipe_fds[1], &s, sizeof(s));
-}
-
-static void close_pipe_fds(void) {
- if (pipe_fds[0] >= 0)
- close(pipe_fds[0]);
- if (pipe_fds[1] >= 0)
- close(pipe_fds[1]);
-
- pipe_fds[0] = pipe_fds[1] = -1;
-}
-
-static void watch_callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
- int s;
- ssize_t l;
-
- assert(w);
- assert(fd == pipe_fds[0]);
- assert(event == AVAHI_WATCH_IN);
-
- l = read(fd, &s, sizeof(s));
- assert(l == sizeof(s));
-
- fprintf(stderr, "Got %s, quitting.\n", s == SIGINT ? "SIGINT" : "SIGTERM");
- avahi_simple_poll_quit(simple_poll);
-}
-
-int sigint_install(AvahiSimplePoll *spoll) {
- struct sigaction sa;
- const AvahiPoll *p;
-
- assert(spoll);
- assert(!simple_poll);
- assert(pipe_fds[0] == -1 && pipe_fds[1] == -1);
-
- if (pipe(pipe_fds) < 0) {
- fprintf(stderr, "pipe() failed: %s\n", strerror(errno));
- return -1;
- }
-
- set_nonblock(pipe_fds[0]);
- set_nonblock(pipe_fds[1]);
-
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = handler;
- sa.sa_flags = SA_RESTART;
-
- if (sigaction(SIGINT, &sa, &old_sigint_sa) < 0) {
- fprintf(stderr, "sigaction() failed: %s\n", strerror(errno));
- close_pipe_fds();
- return -1;
- }
-
- if (sigaction(SIGTERM, &sa, &old_sigterm_sa) < 0) {
- sigaction(SIGINT, &old_sigint_sa, NULL);
- fprintf(stderr, "sigaction() failed: %s\n", strerror(errno));
- close_pipe_fds();
- return -1;
- }
-
- p = avahi_simple_poll_get(spoll);
- watch = p->watch_new(p, pipe_fds[0], AVAHI_WATCH_IN, watch_callback, NULL);
- assert(watch);
-
- simple_poll = spoll;
- return 0;
-}
-
-void sigint_uninstall(void) {
-
- if (!simple_poll)
- return;
-
- sigaction(SIGTERM, &old_sigterm_sa, NULL);
- sigaction(SIGINT, &old_sigint_sa, NULL);
-
- close_pipe_fds();
-
- if (watch) {
- const AvahiPoll *p;
-
- assert(simple_poll);
- p = avahi_simple_poll_get(simple_poll);
-
- p->watch_free(watch);
- watch = NULL;
- }
-
- simple_poll = NULL;
-}
diff --git a/trunk/avahi-utils/sigint.h b/trunk/avahi-utils/sigint.h
deleted file mode 100644
index 0bc5c34..0000000
--- a/trunk/avahi-utils/sigint.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foosigchfoo
-#define foosigchfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/simple-watch.h>
-
-int sigint_install(AvahiSimplePoll *spoll);
-void sigint_uninstall(void);
-
-#endif
diff --git a/trunk/avahi-utils/stdb.c b/trunk/avahi-utils/stdb.c
deleted file mode 100644
index 388bf6b..0000000
--- a/trunk/avahi-utils/stdb.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <config.h>
-#ifdef HAVE_GDBM
-#include <gdbm.h>
-#endif
-#ifdef HAVE_DBM
-#include <ndbm.h>
-#include <fcntl.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <locale.h>
-#include <stdio.h>
-
-#include <avahi-common/malloc.h>
-
-#include "stdb.h"
-
-#ifdef HAVE_GDBM
-static GDBM_FILE gdbm_file = NULL;
-#endif
-#ifdef HAVE_DBM
-static DBM *dbm_file = NULL;
-#endif
-static char *buffer = NULL;
-
-static int init(void) {
-
-#ifdef HAVE_GDBM
- if (gdbm_file)
- return 0;
-
- if (!(gdbm_file = gdbm_open((char*) DATABASE_FILE, 0, GDBM_READER, 0, NULL)))
- return -1;
-#endif
-#ifdef HAVE_DBM
- if (dbm_file)
- return 0;
-
- if (!(dbm_file = dbm_open((char*) DATABASE_FILE, O_RDONLY, 0)))
- return -1;
-#endif
-
- return 0;
-}
-
-const char* stdb_lookup(const char *name) {
- datum key, data;
- const char *loc;
-
- if (init() < 0)
- goto fail;
-
- data.dptr = NULL;
- data.dsize = 0;
-
- if ((loc = setlocale(LC_MESSAGES, NULL))) {
- char k[256];
-
- snprintf(k, sizeof(k), "%s[%s]", name, loc);
- key.dptr = k;
- key.dsize = strlen(k);
-#ifdef HAVE_GDBM
- data = gdbm_fetch(gdbm_file, key);
-#endif
-#ifdef HAVE_DBM
- data = dbm_fetch(dbm_file, key);
-#endif
-
- if (!data.dptr) {
- char l[32], *e;
- snprintf(l, sizeof(l), "%s", loc);
-
- if ((e = strchr(l, '@'))) {
- *e = 0;
- snprintf(k, sizeof(k), "%s[%s]", name, l);
- key.dptr = k;
- key.dsize = strlen(k);
-#ifdef HAVE_GDBM
- data = gdbm_fetch(gdbm_file, key);
-#endif
-#ifdef HAVE_DBM
- data = dbm_fetch(dbm_file, key);
-#endif
- }
-
- if (!data.dptr) {
- if ((e = strchr(l, '_'))) {
- *e = 0;
- snprintf(k, sizeof(k), "%s[%s]", name, l);
- key.dptr = k;
- key.dsize = strlen(k);
-#ifdef HAVE_GDBM
- data = gdbm_fetch(gdbm_file, key);
-#endif
-#ifdef HAVE_DBM
- data = dbm_fetch(dbm_file, key);
-#endif
- }
- }
- }
- }
-
- if (!data.dptr) {
- key.dptr = (char*) name;
- key.dsize = strlen(name);
-#ifdef HAVE_GDBM
- data = gdbm_fetch(gdbm_file, key);
-#endif
-#ifdef HAVE_DBM
- data = dbm_fetch(dbm_file, key);
-#endif
- }
-
- if (!data.dptr)
- goto fail;
-
- avahi_free(buffer);
- buffer = avahi_strndup(data.dptr, data.dsize);
- free(data.dptr);
-
- return buffer;
-
-fail:
-
- return name;
-}
-
-void stdb_shutdown(void) {
-#ifdef HAVE_GDBM
- if (gdbm_file)
- gdbm_close(gdbm_file);
-#endif
-#ifdef HAVE_DBM
- if (dbm_file)
- dbm_close(dbm_file);
-#endif
-
- avahi_free(buffer);
-}
diff --git a/trunk/avahi-utils/stdb.h b/trunk/avahi-utils/stdb.h
deleted file mode 100644
index 92c2651..0000000
--- a/trunk/avahi-utils/stdb.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef foostdbhfoo
-#define foostdbhfoo
-
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#include <avahi-common/simple-watch.h>
-
-const char* stdb_lookup(const char *name);
-void stdb_shutdown(void);
-
-#endif
diff --git a/trunk/bootstrap.sh b/trunk/bootstrap.sh
deleted file mode 100755
index ada993f..0000000
--- a/trunk/bootstrap.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-FLAGS="--sysconfdir=/etc --localstatedir=/var --enable-tests --enable-compat-howl --enable-compat-libdns_sd"
-
-# Feel free to add your own custom flags in here -Lathiat
-
-case `uname -s` in
- Darwin)
- export LIBTOOLIZE=/opt/local/bin/glibtoolize
- export CFLAGS="-I/opt/local/include"
- export LDFLAGS="-L/opt/local/lib"
- export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
- FLAGS="$FLAGS --prefix=/opt/local --disable-pygtk"
- ;;
- FreeBSD)
- cp /usr/local/share/aclocal/libtool15.m4 common
- cp /usr/local/share/aclocal/pkg.m4 common
- export LIBTOOLIZE=/usr/local/bin/libtoolize15
- export CFLAGS="-I/usr/local/include"
- export LDFLAGS="-L/usr/local/lib"
- export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
- FLAGS="$FLAGS --prefix=/opt/ --with-distro=none --disable-python --disable-dbus --disable-glib --disable-gtk"
- ;;
- NetBSD)
- export LIBTOOLIZE=libtoolize
- export CFLAGS="-I/usr/pkg/include"
- export LDFLAGS="-L/usr/pkg/lib"
- export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
- FLAGS="$FLAGS --disable-monodoc --disable-mono --disable-qt3 --disable-qt4 --disable-xmltoman --prefix=/opt --with-distro=none --disable-python --disable-glib --disable-gtk --disable-manpages"
- ;;
- Linux)
- ;;
-esac
-
-case "$USER" in
- lathiat|trentl)
- FLAGS="$FLAGS --disable-qt4"
- ;;
- sebest)
- FLAGS="$FLAGS --disable-monodoc --enable-dbus=no --enable-mono=no --enable-qt3=no --enable-qt4=no --sysconfdir=/etc --localstatedir=/var --prefix=/usr --disable-manpages --disable-xmltoman"
- ;;
-esac
-
-CFLAGS="$CFLAGS -g -O0" exec ./autogen.sh $FLAGS "$@"
diff --git a/trunk/common/Makefile.am b/trunk/common/Makefile.am
deleted file mode 100644
index e51c02a..0000000
--- a/trunk/common/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-EXTRA_DIST = \
- doxygen.m4 \
- doxygen.mk \
- python.m4
diff --git a/trunk/common/acx_pthread.m4 b/trunk/common/acx_pthread.m4
deleted file mode 100644
index dcf6332..0000000
--- a/trunk/common/acx_pthread.m4
+++ /dev/null
@@ -1,348 +0,0 @@
-dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-dnl
-dnl @summary figure out how to build C programs using POSIX threads
-dnl
-dnl This macro figures out how to build C programs using POSIX threads.
-dnl It sets the PTHREAD_LIBS output variable to the threads library and
-dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
-dnl C compiler flags that are needed. (The user can also force certain
-dnl compiler flags/libs to be tested by setting these environment
-dnl variables.)
-dnl
-dnl Also sets PTHREAD_CC to any special C compiler that is needed for
-dnl multi-threaded programs (defaults to the value of CC otherwise).
-dnl (This is necessary on AIX to use the special cc_r compiler alias.)
-dnl
-dnl NOTE: You are assumed to not only compile your program with these
-dnl flags, but also link it with them as well. e.g. you should link
-dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
-dnl $LIBS
-dnl
-dnl If you are only building threads programs, you may wish to use
-dnl these variables in your default LIBS, CFLAGS, and CC:
-dnl
-dnl LIBS="$PTHREAD_LIBS $LIBS"
-dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-dnl CC="$PTHREAD_CC"
-dnl
-dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
-dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-dnl
-dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
-dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
-dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
-dnl default action will define HAVE_PTHREAD.
-dnl
-dnl Please let the authors know if this macro fails on any platform, or
-dnl if you have any other suggestions or comments. This macro was based
-dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
-dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
-dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
-dnl We are also grateful for the helpful feedback of numerous users.
-dnl
-dnl @category InstalledPackages
-dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
-dnl @version 2006-05-29
-dnl @license GPLWithACException
-dnl
-dnl Checks for GCC shared/pthread inconsistency based on work by
-dnl Marcin Owsiany <marcin@owsiany.pl>
-
-
-AC_DEFUN([ACX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_SAVE
-AC_LANG_C
-acx_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
- AC_MSG_RESULT($acx_pthread_ok)
- if test x"$acx_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all, and "pthread-config"
-# which is a program returning the flags for the Pth emulation library.
-
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# ... -mt is also the pthreads flag for HP/aCC
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-# pthread-config: use pthread-config program (for GNU Pth library)
-
-case "${host_cpu}-${host_os}" in
- *solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthreads/-mt/
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
-
- acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
- ;;
-esac
-
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- pthread-config)
- AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
- if test x"$acx_pthread_config" = xno; then continue; fi
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [acx_pthread_ok=yes])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT($acx_pthread_ok)
- if test "x$acx_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- AC_MSG_CHECKING([for joinable pthread attribute])
- attr_name=unknown
- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
- [attr_name=$attr; break])
- done
- AC_MSG_RESULT($attr_name)
- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
- AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
- [Define to necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
- *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
- esac
- AC_MSG_RESULT(${flag})
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
- # More AIX lossage: must compile with xlc_r or cc_r
- if test x"$GCC" != xyes; then
- AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
- else
- PTHREAD_CC=$CC
- fi
-
- # The next part tries to detect GCC inconsistency with -shared on some
- # architectures and systems. The problem is that in certain
- # configurations, when -shared is specified, GCC "forgets" to
- # internally use various flags which are still necessary.
-
- AC_MSG_CHECKING([whether to check for GCC pthread/shared inconsistencies])
- check_inconsistencies=yes
- case "${host_cpu}-${host_os}" in
- *-darwin*) check_inconsistencies=no ;;
- esac
- if test x"$GCC" != xyes -o "x$check_inconsistencies" != xyes ; then
- AC_MSG_RESULT([no])
- else
- AC_MSG_RESULT([yes])
-
- # In order not to create several levels of indentation, we test
- # the value of "$ok" until we find out the cure or run out of
- # ideas.
- ok="no"
-
- #
- # Prepare the flags
- #
- save_CFLAGS="$CFLAGS"
- save_LIBS="$LIBS"
- save_CC="$CC"
- # Try with the flags determined by the earlier checks.
- #
- # -Wl,-z,defs forces link-time symbol resolution, so that the
- # linking checks with -shared actually have any value
- #
- # FIXME: -fPIC is required for -shared on many architectures,
- # so we specify it here, but the right way would probably be to
- # properly detect whether it is actually required.
- CFLAGS="-shared -fPIC -Wl,-z,defs $CFLAGS $PTHREAD_CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CC="$PTHREAD_CC"
-
- AC_MSG_CHECKING([whether -pthread is sufficient with -shared])
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [ok=yes])
-
- if test "x$ok" = xyes; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
-
- #
- # Linux gcc on some architectures such as mips/mipsel forgets
- # about -lpthread
- #
- if test x"$ok" = xno; then
- AC_MSG_CHECKING([whether -lpthread fixes that])
- LIBS="-lpthread $PTHREAD_LIBS $save_LIBS"
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [ok=yes])
-
- if test "x$ok" = xyes; then
- AC_MSG_RESULT([yes])
- PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
- else
- AC_MSG_RESULT([no])
- fi
- fi
- #
- # FreeBSD 4.10 gcc forgets to use -lc_r instead of -lc
- #
- if test x"$ok" = xno; then
- AC_MSG_CHECKING([whether -lc_r fixes that])
- LIBS="-lc_r $PTHREAD_LIBS $save_LIBS"
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [ok=yes])
-
- if test "x$ok" = xyes; then
- AC_MSG_RESULT([yes])
- PTHREAD_LIBS="-lc_r $PTHREAD_LIBS"
- else
- AC_MSG_RESULT([no])
- fi
- fi
- if test x"$ok" = xno; then
- # OK, we have run out of ideas
- AC_MSG_WARN([Impossible to determine how to use pthreads with shared libraries])
-
- # so it's not safe to assume that we may use pthreads
- acx_pthread_ok=no
- fi
-
- CFLAGS="$save_CFLAGS"
- LIBS="$save_LIBS"
- CC="$save_CC"
- fi
-else
- PTHREAD_CC="$CC"
-fi
-
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_CC)
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
- ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
- :
-else
- acx_pthread_ok=no
- $2
-fi
-AC_LANG_RESTORE
-])dnl ACX_PTHREAD
diff --git a/trunk/common/doxygen.m4 b/trunk/common/doxygen.m4
deleted file mode 100644
index e9c56c2..0000000
--- a/trunk/common/doxygen.m4
+++ /dev/null
@@ -1,312 +0,0 @@
-# This file is part of Autoconf. -*- Autoconf -*-
-
-# Copyright (C) 2004 Oren Ben-Kiki
-# This file is distributed under the same terms as the Autoconf macro files.
-
-# Generate automatic documentation using Doxygen. Works in concert with the
-# aminclude.m4 file and a compatible doxygen configuration file. Defines the
-# following public macros:
-#
-# DX_???_FEATURE(ON|OFF) - control the default setting fo a Doxygen feature.
-# Supported features are 'DOXYGEN' itself, 'DOT' for generating graphics,
-# 'HTML' for plain HTML, 'CHM' for compressed HTML help (for MS users), 'CHI'
-# for generating a seperate .chi file by the .chm file, and 'MAN', 'RTF',
-# 'XML', 'PDF' and 'PS' for the appropriate output formats. The environment
-# variable DOXYGEN_PAPER_SIZE may be specified to override the default 'a4wide'
-# paper size.
-#
-# By default, HTML, PDF and PS documentation is generated as this seems to be
-# the most popular and portable combination. MAN pages created by Doxygen are
-# usually problematic, though by picking an appropriate subset and doing some
-# massaging they might be better than nothing. CHM and RTF are specific for MS
-# (note that you can't generate both HTML and CHM at the same time). The XML is
-# rather useless unless you apply specialized post-processing to it.
-#
-# The macro mainly controls the default state of the feature. The use can
-# override the default by specifying --enable or --disable. The macros ensure
-# that contradictory flags are not given (e.g., --enable-doxygen-html and
-# --enable-doxygen-chm, --enable-doxygen-anything with --disable-doxygen, etc.)
-# Finally, each feature will be automatically disabled (with a warning) if the
-# required programs are missing.
-#
-# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN with
-# the following parameters: a one-word name for the project for use as a
-# filename base etc., an optional configuration file name (the default is
-# 'Doxyfile', the same as Doxygen's default), and an optional output directory
-# name (the default is 'doxygen-doc').
-
-## ----------##
-## Defaults. ##
-## ----------##
-
-DX_ENV=""
-AC_DEFUN([DX_FEATURE_doc], ON)
-AC_DEFUN([DX_FEATURE_dot], ON)
-AC_DEFUN([DX_FEATURE_man], OFF)
-AC_DEFUN([DX_FEATURE_html], ON)
-AC_DEFUN([DX_FEATURE_chm], OFF)
-AC_DEFUN([DX_FEATURE_chi], OFF)
-AC_DEFUN([DX_FEATURE_rtf], OFF)
-AC_DEFUN([DX_FEATURE_xml], OFF)
-AC_DEFUN([DX_FEATURE_pdf], ON)
-AC_DEFUN([DX_FEATURE_ps], ON)
-
-## --------------- ##
-## Private macros. ##
-## --------------- ##
-
-# DX_ENV_APPEND(VARIABLE, VALUE)
-# ------------------------------
-# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
-AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
-
-# DX_DIRNAME_EXPR
-# ---------------
-# Expand into a shell expression prints the directory part of a path.
-AC_DEFUN([DX_DIRNAME_EXPR],
- [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
-
-# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
-# -------------------------------------
-# Expands according to the M4 (static) status of the feature.
-AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
-
-# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
-# ----------------------------------
-# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
-AC_DEFUN([DX_REQUIRE_PROG], [
-AC_PATH_TOOL([$1], [$2])
-if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
- AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
- AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0)
-fi
-])
-
-# DX_TEST_FEATURE(FEATURE)
-# ------------------------
-# Expand to a shell expression testing whether the feature is active.
-AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
-
-# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
-# -------------------------------------------------
-# Verify that a required features has the right state before trying to turn on
-# the DX_CURRENT_FEATURE.
-AC_DEFUN([DX_CHECK_DEPEND], [
-test "$DX_FLAG_$1" = "$2" \
-|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
- requires, contradicts) doxygen-DX_CURRENT_FEATURE])
-])
-
-# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
-# ----------------------------------------------------------
-# Turn off the DX_CURRENT_FEATURE if the required feature is off.
-AC_DEFUN([DX_CLEAR_DEPEND], [
-test "$DX_FLAG_$1" = "$2" || AC_SUBST([DX_FLAG_]DX_CURRENT_FEATURE, 0)
-])
-
-# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
-# CHECK_DEPEND, CLEAR_DEPEND,
-# REQUIRE, DO-IF-ON, DO-IF-OFF)
-# --------------------------------------------
-# Parse the command-line option controlling a feature. CHECK_DEPEND is called
-# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
-# otherwise CLEAR_DEPEND is called to turn off the default state if a required
-# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
-# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
-# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
-AC_DEFUN([DX_ARG_ABLE], [
- AC_DEFUN([DX_CURRENT_FEATURE], [$1])
- AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
- AC_ARG_ENABLE(doxygen-$1,
- [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
- [--enable-doxygen-$1]),
- DX_IF_FEATURE([$1], [don't $2], [$2]))],
- [
-case "$enableval" in
-#(
-y|Y|yes|Yes|YES)
- AC_SUBST([DX_FLAG_$1], 1)
- $3
-;; #(
-n|N|no|No|NO)
- AC_SUBST([DX_FLAG_$1], 0)
-;; #(
-*)
- AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
-;;
-esac
-], [
-AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
-$4
-])
-if DX_TEST_FEATURE([$1]); then
- $5
- :
-fi
-if DX_TEST_FEATURE([$1]); then
- AM_CONDITIONAL(DX_COND_$1, :)
- $6
- :
-else
- AM_CONDITIONAL(DX_COND_$1, false)
- $7
- :
-fi
-])
-
-## -------------- ##
-## Public macros. ##
-## -------------- ##
-
-# DX_XXX_FEATURE(DEFAULT_STATE)
-# -----------------------------
-AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])])
-AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])])
-AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])])
-AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])])
-AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])])
-AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])])
-AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])])
-AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])])
-
-# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
-# ---------------------------------------------------------
-# PROJECT also serves as the base name for the documentation files.
-# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
-AC_DEFUN([DX_INIT_DOXYGEN], [
-
-# Files:
-AC_SUBST([DX_PROJECT], [$1])
-AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
-AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
-
-# Environment variables used inside doxygen.cfg:
-DX_ENV_APPEND(SRCDIR, $srcdir)
-DX_ENV_APPEND(PROJECT, $DX_PROJECT)
-DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
-DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
-
-# Doxygen itself:
-DX_ARG_ABLE(doc, [generate any doxygen documentation],
- [],
- [],
- [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
- DX_REQUIRE_PROG([DX_PERL], perl)],
- [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
-
-# Dot for graphics:
-DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_DOT], dot)],
- [DX_ENV_APPEND(HAVE_DOT, YES)
- DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
- [DX_ENV_APPEND(HAVE_DOT, NO)])
-
-# Man pages generation:
-DX_ARG_ABLE(man, [generate doxygen manual pages],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_MAN, YES)],
- [DX_ENV_APPEND(GENERATE_MAN, NO)])
-
-# RTF file generation:
-DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_RTF, YES)],
- [DX_ENV_APPEND(GENERATE_RTF, NO)])
-
-# XML file generation:
-DX_ARG_ABLE(xml, [generate doxygen XML documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_XML, YES)],
- [DX_ENV_APPEND(GENERATE_XML, NO)])
-
-# (Compressed) HTML help generation:
-DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_HHC], hhc)],
- [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
- DX_ENV_APPEND(GENERATE_HTML, YES)
- DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
- [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
-
-# Seperate CHI file generation.
-DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
- [DX_CHECK_DEPEND(chm, 1)],
- [DX_CLEAR_DEPEND(chm, 1)],
- [],
- [DX_ENV_APPEND(GENERATE_CHI, YES)],
- [DX_ENV_APPEND(GENERATE_CHI, NO)])
-
-# Plain HTML pages generation:
-DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
- [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
- [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
- [],
- [DX_ENV_APPEND(GENERATE_HTML, YES)],
- [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
-
-# PostScript file generation:
-DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_LATEX], latex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_DVIPS], dvips)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# PDF file generation:
-DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
- [DX_CHECK_DEPEND(doc, 1)],
- [DX_CLEAR_DEPEND(doc, 1)],
- [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
- DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
- DX_REQUIRE_PROG([DX_EGREP], egrep)])
-
-# LaTeX generation for PS and/or PDF:
-if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
- AM_CONDITIONAL(DX_COND_latex, :)
- DX_ENV_APPEND(GENERATE_LATEX, YES)
-else
- AM_CONDITIONAL(DX_COND_latex, false)
- DX_ENV_APPEND(GENERATE_LATEX, NO)
-fi
-
-# Paper size for PS and/or PDF:
-AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
- [a4wide (default), a4, letter, legal or executive])
-case "$DOXYGEN_PAPER_SIZE" in
-#(
-"")
- AC_SUBST(DOXYGEN_PAPER_SIZE, "")
-;; #(
-a4wide|a4|letter|legal|executive)
- DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
-;; #(
-*)
- AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
-;;
-esac
-
-#For debugging:
-#echo DX_FLAG_doc=$DX_FLAG_doc
-#echo DX_FLAG_dot=$DX_FLAG_dot
-#echo DX_FLAG_man=$DX_FLAG_man
-#echo DX_FLAG_html=$DX_FLAG_html
-#echo DX_FLAG_chm=$DX_FLAG_chm
-#echo DX_FLAG_chi=$DX_FLAG_chi
-#echo DX_FLAG_rtf=$DX_FLAG_rtf
-#echo DX_FLAG_xml=$DX_FLAG_xml
-#echo DX_FLAG_pdf=$DX_FLAG_pdf
-#echo DX_FLAG_ps=$DX_FLAG_ps
-#echo DX_ENV=$DX_ENV
-])
diff --git a/trunk/common/doxygen.mk b/trunk/common/doxygen.mk
deleted file mode 100644
index eca9237..0000000
--- a/trunk/common/doxygen.mk
+++ /dev/null
@@ -1,187 +0,0 @@
-# Copyright (C) 2004 Oren Ben-Kiki
-# This file is distributed under the same terms as the Automake macro files.
-
-# Generate automatic documentation using Doxygen. Goals and variables values
-# are controlled by the various DX_COND_??? conditionals set by autoconf.
-#
-# The provided goals are:
-# doxygen-doc: Generate all doxygen documentation.
-# doxygen-run: Run doxygen, which will generate some of the documentation
-# (HTML, CHM, CHI, MAN, RTF, XML) but will not do the post
-# processing required for the rest of it (PS, PDF, and some MAN).
-# doxygen-man: Rename some doxygen generated man pages.
-# doxygen-ps: Generate doxygen PostScript documentation.
-# doxygen-pdf: Generate doxygen PDF documentation.
-#
-# Note that by default these are not integrated into the automake goals. If
-# doxygen is used to generate man pages, you can achieve this integration by
-# setting man3_MANS to the list of man pages generated and then adding the
-# dependency:
-#
-# $(man3_MANS): doxygen-doc
-#
-# This will cause make to run doxygen and generate all the documentation.
-#
-# The following variable is intended for use in Makefile.am:
-#
-# DX_CLEANFILES = everything to clean.
-#
-# This is usually added to MOSTLYCLEANFILES.
-
-## --------------------------------- ##
-## Format-independent Doxygen rules. ##
-## --------------------------------- ##
-
-if DX_COND_doc
-
-## ------------------------------- ##
-## Rules specific for HTML output. ##
-## ------------------------------- ##
-
-if DX_COND_html
-
-DX_CLEAN_HTML = @DX_DOCDIR@/html
-
-endif DX_COND_html
-
-## ------------------------------ ##
-## Rules specific for CHM output. ##
-## ------------------------------ ##
-
-if DX_COND_chm
-
-DX_CLEAN_CHM = @DX_DOCDIR@/chm
-
-if DX_COND_chi
-
-DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
-
-endif DX_COND_chi
-
-endif DX_COND_chm
-
-## ------------------------------ ##
-## Rules specific for MAN output. ##
-## ------------------------------ ##
-
-if DX_COND_man
-
-DX_CLEAN_MAN = @DX_DOCDIR@/man
-
-endif DX_COND_man
-
-## ------------------------------ ##
-## Rules specific for RTF output. ##
-## ------------------------------ ##
-
-if DX_COND_rtf
-
-DX_CLEAN_RTF = @DX_DOCDIR@/rtf
-
-endif DX_COND_rtf
-
-## ------------------------------ ##
-## Rules specific for XML output. ##
-## ------------------------------ ##
-
-if DX_COND_xml
-
-DX_CLEAN_XML = @DX_DOCDIR@/xml
-
-endif DX_COND_xml
-
-## ----------------------------- ##
-## Rules specific for PS output. ##
-## ----------------------------- ##
-
-if DX_COND_ps
-
-DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
-
-DX_PS_GOAL = doxygen-ps
-
-doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
-
-@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_LATEX) refman.tex; \
- $(MAKEINDEX_PATH) refman.idx; \
- $(DX_LATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_LATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
-
-endif DX_COND_ps
-
-## ------------------------------ ##
-## Rules specific for PDF output. ##
-## ------------------------------ ##
-
-if DX_COND_pdf
-
-DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
-
-DX_PDF_GOAL = doxygen-pdf
-
-doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
-
-@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
- cd @DX_DOCDIR@/latex; \
- rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
- $(DX_PDFLATEX) refman.tex; \
- $(DX_MAKEINDEX) refman.idx; \
- $(DX_PDFLATEX) refman.tex; \
- countdown=5; \
- while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
- refman.log > /dev/null 2>&1 \
- && test $$countdown -gt 0; do \
- $(DX_PDFLATEX) refman.tex; \
- countdown=`expr $$countdown - 1`; \
- done; \
- mv refman.pdf ../@PACKAGE@.pdf
-
-endif DX_COND_pdf
-
-## ------------------------------------------------- ##
-## Rules specific for LaTeX (shared for PS and PDF). ##
-## ------------------------------------------------- ##
-
-if DX_COND_latex
-
-DX_CLEAN_LATEX = @DX_DOCDIR@/latex
-
-endif DX_COND_latex
-
-.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
-
-doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
-
-@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS) $(DX_INPUT) $(DX_EXAMPLE_PATH)/$(DX_EXAMPLE_PATTERNS)
- rm -rf @DX_DOCDIR@
- INPUT='$(DX_INPUT)' EXAMPLE_PATH='$(DX_EXAMPLE_PATH)' EXAMPLE_PATTERNS='$(DX_EXAMPLE_PATTERNS)' \
- $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
-
-DX_CLEANFILES = \
- @DX_DOCDIR@/@PACKAGE@.tag \
- -r \
- $(DX_CLEAN_HTML) \
- $(DX_CLEAN_CHM) \
- $(DX_CLEAN_CHI) \
- $(DX_CLEAN_MAN) \
- $(DX_CLEAN_RTF) \
- $(DX_CLEAN_XML) \
- $(DX_CLEAN_PS) \
- $(DX_CLEAN_PDF) \
- $(DX_CLEAN_LATEX)
-
-endif DX_COND_doc
diff --git a/trunk/common/python.m4 b/trunk/common/python.m4
deleted file mode 100644
index e1c5266..0000000
--- a/trunk/common/python.m4
+++ /dev/null
@@ -1,62 +0,0 @@
-## this one is commonly used with AM_PATH_PYTHONDIR ...
-dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
-dnl Check if a module containing a given symbol is visible to python.
-AC_DEFUN([AM_CHECK_PYMOD],
-[AC_REQUIRE([AM_PATH_PYTHON])
-py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
-AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1)
-AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
-ifelse([$2],[], [prog="
-import sys
-try:
- import $1
-except ImportError:
- sys.exit(1)
-except:
- sys.exit(0)
-sys.exit(0)"], [prog="
-import $1
-$1.$2"])
-if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
- then
- eval "py_cv_mod_$py_mod_var=yes"
- else
- eval "py_cv_mod_$py_mod_var=no"
- fi
-])
-py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
-if test "x$py_val" != xno; then
- AC_MSG_RESULT(yes)
- ifelse([$3], [],, [$3
-])dnl
-else
- AC_MSG_RESULT(no)
- ifelse([$4], [],, [$4
-])dnl
-fi
-])
-
-dnl a macro to check for ability to create python extensions
-dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
-dnl function also defines PYTHON_INCLUDES
-AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
-[AC_REQUIRE([AM_PATH_PYTHON])
-AC_MSG_CHECKING(for headers required to compile python extensions)
-dnl deduce PYTHON_INCLUDES
-py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
-py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
-PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
-if test "$py_prefix" != "$py_exec_prefix"; then
- PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
-fi
-AC_SUBST(PYTHON_INCLUDES)
-dnl check if the headers exist:
-save_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
-AC_TRY_CPP([#include <Python.h>],dnl
-[AC_MSG_RESULT(found)
-$1],dnl
-[AC_MSG_RESULT(not found)
-$2])
-CPPFLAGS="$save_CPPFLAGS"
-])
diff --git a/trunk/configure.ac b/trunk/configure.ac
deleted file mode 100644
index f2dd5f2..0000000
--- a/trunk/configure.ac
+++ /dev/null
@@ -1,982 +0,0 @@
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AC_PREREQ(2.57)
-AC_INIT([avahi],[0.6.15],[avahi (at) lists (dot) freedesktop (dot) org])
-AC_CONFIG_SRCDIR([avahi-core/server.c])
-AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([foreign 1.9 -Wall])
-
-AC_SUBST(PACKAGE_URL, [http://avahi.org/])
-
-AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [7:3:4])
-AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [4:4:0])
-AC_SUBST(LIBAVAHI_CLIENT_VERSION_INFO, [5:1:2])
-AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:1:0])
-AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:1:0])
-AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:1:0])
-AC_SUBST(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO, [1:0:0])
-AC_SUBST(LIBAVAHI_COMPAT_HOWL_VERSION_INFO, [0:0:0])
-AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
-
-if type -p stow > /dev/null && test -d /usr/local/stow ; then
- AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
- ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
-fi
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_CXX
-AC_GNU_SOURCE
-AC_PROG_CPP
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-AC_PROG_GCC_TRADITIONAL
-
-# libtool stuff
-AC_PROG_LIBTOOL
-
-ACX_PTHREAD(,AC_MSG_ERROR([Missing POSIX Threads support]))
-
-#
-# Check for netlink.h
-#
-AC_CHECK_HEADER(linux/netlink.h,
-HAVE_NETLINK=yes
-AC_DEFINE([HAVE_NETLINK],[],[Support for Linux netlink])
-, [], [
-#include <sys/socket.h>
-#include <asm/types.h>
-])
-
-AM_CONDITIONAL(HAVE_NETLINK, [ test x"$HAVE_NETLINK" = xyes ])
-
-#
-# Check for net/route.h
-#
-AC_CHECK_HEADER(net/route.h,
-HAVE_PF_ROUTE=yes
-AC_DEFINE([HAVE_PF_ROUTE],[],[Support for PF_ROUTE])
-, [], [
-#include <sys/types.h>
-#include <sys/socket.h>
-])
-
-AM_CONDITIONAL(HAVE_PF_ROUTE, [ test x"$HAVE_PF_ROUTE" = xyes ])
-
-#
-# Check for sys/filio.h; needed for FIONREAD on Solaris
-#
-AC_CHECK_HEADER(sys/filio.h,
-HAVE_SYS_FILIO_H=yes
-AC_DEFINE([HAVE_SYS_FILIO_H],[],[Support for sys/filio.h])
-, [], [
-])
-
-AM_CONDITIONAL(HAVE_SYS_FILIO_H, [ test x"$HAVE_SYS_FILIO_H" = xyes ])
-
-#
-# Check for sys/sysctl.h; not present on Solaris
-#
-AC_CHECK_HEADER(sys/sysctl.h,
-HAVE_SYS_SYSCTL=yes
-AC_DEFINE([HAVE_SYS_SYSCTL_H],[],[Support for sys/sysctl.h])
-, [], [
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/param.h>
-])
-
-AM_CONDITIONAL(HAVE_SYS_SYSCTL_H, [ test x"$HAVE_SYS_SYSCTL_H" = xyes ])
-
-#
-# Check for lifconf struct; only present on Solaris
-#
-AC_MSG_CHECKING(for struct lifconf)
-AC_CACHE_VAL(avahi_cv_has_struct_lifconf,
-[AC_TRY_COMPILE(
-[#include <sys/socket.h>
-#include <net/if.h>
-],[sizeof (struct lifconf);],
-avahi_cv_has_struct_lifconf=yes,avahi_cv_has_struct_lifconf=no)])
-AC_MSG_RESULT($avahi_cv_has_struct_lifconf)
-if test $avahi_cv_has_struct_lifconf = yes; then
- AC_DEFINE(HAVE_STRUCT_LIFCONF,1,[Define if there is a struct lifconf.])
-fi
-
-#
-# Check for struct ip_mreqn
-#
-AC_MSG_CHECKING(for struct ip_mreqn)
-AC_TRY_COMPILE([#include <netinet/in.h>], [
- struct ip_mreqn mreq;
- mreq.imr_address.s_addr = 0;
-], [
- # Yes, we have it...
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_STRUCT_IP_MREQN],[],[Support for struct ip_mreqn])
-], [
- # We'll just have to try and use struct ip_mreq
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(for struct ip_mreq)
- AC_TRY_COMPILE([#include <netinet/in.h>], [
- struct ip_mreq mreq;
- mreq.imr_interface.s_addr = 0;
- ], [
- # Yes, we have it...
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_STRUCT_IP_MREQ],[],[Support for struct ip_mreq])
- ], [
- # No multicast support
- AC_MSG_RESULT(no)
- ])
-])
-
-#
-# Detecting the linux distribution for specific things like init scripts.
-#
-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of debian, gentoo, archlinux, fedora, mandriva, darwin, netbsd, freebsd, slackware or none]))
-if test "z$with_distro" = "z"; then
- AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
- AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
- AC_CHECK_FILE(/etc/arch-release,with_distro="archlinux")
- AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
- AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
- AC_CHECK_FILE(/etc/mandriva-release,with_distro="mandriva")
- AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
- if test "z$with_distro" = "z"; then
- with_distro=`uname -s`
- fi
-fi
-with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
-
-case $with_distro in
- debian|gentoo|archlinux|suse|fedora|mandriva|darwin|freebsd|slackware|none)
- ;;
- netbsd)
- AC_MSG_WARN([Your distribution (${with_distro}) is supported but no init script exist yet! (patches welcome)])
- ;;
- linux)
- AC_MSG_ERROR([Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO, set DISTRO to none if your distribution is not supported.])
- ;;
- *)
- AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and D-Bus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
- ;;
-esac
-
-AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
-AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
-AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
-AM_CONDITIONAL(TARGET_ARCHLINUX, test x"$with_distro" = xarchlinux)
-AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
-AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
-AM_CONDITIONAL(TARGET_DARWIN, test x"$with_distro" = xdarwin)
-AM_CONDITIONAL(TARGET_NETBSD, test x"$with_distro" = xnetbsd)
-AM_CONDITIONAL(TARGET_FREEBSD, test x"$with_distro" = xfreebsd)
-AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
-
-test_gcc_flag() {
- AC_LANG_CONFTEST([int main() {}])
- $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
- ret=$?
- rm -f conftest.o
- return $ret
-}
-
-# If using GCC specify some additional parameters
-if test "x$GCC" = "xyes" ; then
-
- DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline"
-
- if test "x$HAVE_NETLINK" = "xyes" ; then
- # Test whether rtnetlink.h can be included when compiled with -std=c99
- # some distributions (e.g. archlinux) have broken headers that dont
- # define __u64 with -std=c99
- AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
- OLDCFLAGS="$CFLAGS"
- CFLAGS="-std=c99"
- AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
- use_stdc99=yes, use_stdc99=no)
-
- if test x"$use_stdc99" = xyes; then
- DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
-
- CFLAGS="$OLDCFLAGS"
- else
- DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
- fi
-
- for flag in $DESIRED_FLAGS ; do
- AC_MSG_CHECKING([whether $CC accepts $flag])
- if test_gcc_flag $flag ; then
- CFLAGS="$CFLAGS $flag"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- done
-fi
-
-# Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h netdb.h syslog.h])
-AC_HEADER_STDBOOL
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_HEADER_SYS_WAIT
-
-# Checks for library functions.
-AC_FUNC_MEMCMP
-AC_FUNC_SELECT_ARGTYPES
-AC_FUNC_MALLOC
-AC_FUNC_REALLOC
-AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid setresgid setregid strcasecmp gettimeofday putenv strncasecmp strlcpy gethostbyname seteuid setegid setproctitle getprogname])
-
-AC_FUNC_CHOWN
-AC_FUNC_STAT
-AC_TYPE_MODE_T
-AC_TYPE_PID_T
-
-AC_CHECK_DECLS(environ)
-
-enable_chroot=yes
-AC_CHECK_HEADERS([sys/capability.h],,enable_chroot=no)
-AC_CHECK_HEADERS([sys/prctl.h],,enable_chroot=no)
-AC_CHECK_FUNCS([chroot],,enable_chroot=no)
-
-AM_CONDITIONAL(ENABLE_CHROOT, test "x$enable_chroot" = "xyes")
-
-if test "x$enable_chroot" = "xyes" ; then
- AC_DEFINE([ENABLE_CHROOT], 1, [Enable chroot() usage])
-fi
-
-AC_CHECK_LIB(dl, dlopen, [ AC_CHECK_HEADERS(dlfcn.h, HAVE_DLOPEN=yes, HAVE_DLOPEN=no) ], HAVE_DLOPEN=no)
-if test "x$HAVE_DLOPEN" = "xyes" ; then
- AC_DEFINE([HAVE_DLOPEN],1,[Have dlopen()])
-fi
-AM_CONDITIONAL(HAVE_DLOPEN, test "x$HAVE_DLOPEN" = "xyes")
-
-# Check for pkg-config manually first, as if its not installed the
-# PKG_PROG_PKG_CONFIG macro won't be defined.
-AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
-
-if test x"$have_pkg_config" = "xno"; then
- AC_MSG_ERROR(pkg-config is required to install this program)
-fi
-
-PKG_PROG_PKG_CONFIG
-
-#
-# Check for GLIB 2.0
-#
-AC_ARG_ENABLE(glib,
- AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
- [case "${enableval}" in
- yes) HAVE_GLIB=yes ;;
- no) HAVE_GLIB=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
- esac],
- [HAVE_GLIB=yes])
-
-if test "x$HAVE_GLIB" = "xyes" ; then
- PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
- AC_SUBST(GLIB20_CFLAGS)
- AC_SUBST(GLIB20_LIBS)
-fi
-AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
-
-#
-# Check for Qt 3
-#
-AC_ARG_ENABLE(qt3,
- AS_HELP_STRING([--disable-qt3],[Disable building of Qt3 mainloop integration]),
- [case "${enableval}" in
- yes) HAVE_QT3=yes ;;
- no) HAVE_QT3=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt3) ;;
- esac],
- [HAVE_QT3=yes])
-
-if test "x$HAVE_QT3" = "xyes" ; then
- PKG_CHECK_MODULES( QT3, [ qt-mt >= 3.0.0 ])
- AC_SUBST(QT3_CFLAGS)
- AC_SUBST(QT3_LIBS)
- QT3_PREFIX="`$PKG_CONFIG --variable=prefix qt-mt`/bin"
- MOC_QT3="no"
- AC_CHECK_FILE( "$QT3_PREFIX/moc-qt3", [ MOC_QT3=$QT3_PREFIX/moc-qt3 ], [
- AC_CHECK_FILE("$QT3_PREFIX/moc", [ MOC_QT3=$QT3_PREFIX/moc ], [
- AC_MSG_ERROR([Couldn't find QT3 moc])])])
- AC_SUBST(MOC_QT3)
-fi
-AM_CONDITIONAL(HAVE_QT3, test "x$HAVE_QT3" = "xyes")
-
-#
-# Check for Qt 4
-#
-AC_ARG_ENABLE(qt4,
- AS_HELP_STRING([--disable-qt4],[Disable building of Qt4Core mainloop integration]),
- [case "${enableval}" in
- yes) HAVE_QT4=yes ;;
- no) HAVE_QT4=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt4) ;;
- esac],
- [HAVE_QT4=yes])
-
-if test "x$HAVE_QT4" = "xyes" ; then
- PKG_CHECK_MODULES( QT4, [ QtCore >= 4.0.0 ])
- AC_SUBST(QT4_CFLAGS)
- AC_SUBST(QT4_LIBS)
- QT4_PREFIX="`$PKG_CONFIG --variable=prefix QtCore`/bin"
- MOC_QT4="no"
- AC_CHECK_FILE( "$QT4_PREFIX/moc-qt4", [ MOC_QT4=$QT4_PREFIX/moc-qt4 ], [
- AC_CHECK_FILE("$QT4_PREFIX/moc", [ MOC_QT4=$QT4_PREFIX/moc ], [
- AC_MSG_ERROR([Couldn't find QT4 moc])])])
- AC_SUBST(MOC_QT4)
-fi
-AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
-
-#
-# Check for GTK+
-#
-AC_ARG_ENABLE(gtk,
- AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
- [case "${enableval}" in
- yes) HAVE_GTK=yes ;;
- no) HAVE_GTK=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
- esac],
- [HAVE_GTK=yes])
-
-if test "x$HAVE_GTK" = "xyes" ; then
- # Check for GTK 2.0
- PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
- AC_SUBST(GTK20_CFLAGS)
- AC_SUBST(GTK20_LIBS)
-
- # Check for GLADE 2.0
- PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
- AC_SUBST(GLADE20_CFLAGS)
- AC_SUBST(GLADE20_LIBS)
-fi
-AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
-
-#
-# D-Bus
-#
-AC_ARG_ENABLE(dbus,
- AS_HELP_STRING([--disable-dbus],[Disable use of D-Bus]),
- [case "${enableval}" in
- yes) HAVE_DBUS=yes ;;
- no) HAVE_DBUS=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
- esac],
- [HAVE_DBUS=yes])
-
-AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [Path to D-Bus system.d directory]))
-AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=<address>], [Path to the D-Bus system socket, you probably want to put unix:path= at the start. Only needed for very old D-Bus releases]))
-
-DBUS_VERSION="Disabled"
-DBUS_SYS_DIR="Disabled"
-DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="Disabled"
-if test "x$HAVE_DBUS" = "xyes" ; then
- PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.34 ])
-
- AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-Bus or not])
-
- DBUS_VERSION=`$PKG_CONFIG dbus-1 --modversion`
- DBUS_VERSION_MAJOR=`echo $DBUS_VERSION | awk -F. '{print $1}'`
- DBUS_VERSION_MINOR=`echo $DBUS_VERSION | awk -F. '{print $2}'`
- DBUS_VERSION_MICRO=`echo $DBUS_VERSION | awk -F. '{print $3}'`
- if test "z$DBUS_VERSION_MAJOR" = "z"; then
- DBUS_VERSION_MAJOR="0"
- fi
- if test "z$DBUS_VERSION_MINOR" = "z"; then
- DBUS_VERSION_MINOR="0"
- fi
- if test "z$DBUS_VERSION_MICRO" = "z"; then
- DBUS_VERSION_MICRO="0"
- fi
-
- if test "z$DBUS_VERSION_MAJOR" = "z0" -a "z$DBUS_VERSION_MINOR" = "z0" -a "z$DBUS_VERSION_MICRO" = "z0"; then
- echo "Error: Couldn't determine the version of your D-Bus package."
- echo " This is probably an error in this script, please report it"
- echo " along with the following information:"
- echo " Base D-Buss version ='$DBUS_VERSION'"
- echo " DBUS_VERSION_MAJOR='$DBUS_VERSION_MAJOR'"
- echo " DBUS_VERSION_MINOR='$DBUS_VERSION_MINOR'"
- echo " DBUS_VERSION_MICRO='$DBUS_VERSION_MICRO'"
- exit 1
- else
- echo "Your D-Bus version is $DBUS_VERSION_MAJOR,$DBUS_VERSION_MINOR,$DBUS_VERSION_MICRO."
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MAJOR=$DBUS_VERSION_MAJOR"
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MINOR=$DBUS_VERSION_MINOR"
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_VERSION_MICRO=$DBUS_VERSION_MICRO"
- fi
-
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
- AC_SUBST(DBUS_CFLAGS)
- AC_SUBST(DBUS_LIBS)
-
- if ! test -z "$with_dbus_sys" ; then
- DBUS_SYS_DIR="$with_dbus_sys"
- else
- DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
- fi
- AC_SUBST(DBUS_SYS_DIR)
-
- if ! test -z "$with_dbus_system_address" ; then
- DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$with_dbus_system_address"
- else
- # This is ugly, but D-Bus doesn't export this address for us
- # so we have to guess, pretty much all setups i've seen have
- # it in /var/lib/dbus or /var/run/dbus, and its defaulted to
- # /var/run upstream so we will try guess first then default
- # to /var/run/dbus.
-
- DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"
- TRY_SOCKETS="/var/lib/dbus/system_bus_socket /var/run/dbus/system_bus_socket ${localstatedir}/run/dbus/system_bus_socket ${prefix}/var/run/dbus/system_bus_socket"
- for sock in $TRY_SOCKETS; do
- if test -S $sock; then
- DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$sock"
- fi
- done
- fi
- AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
-
- SAVED_LIBS="$LIBS"
- LIBS="$LIBS $DBUS_LIBS"
- AC_CHECK_FUNCS([dbus_connection_close dbus_bus_get_private])
- LIBS="$SAVED_LIBS"
-fi
-AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
-
-#
-# Expat
-#
-AC_ARG_ENABLE(expat,
- AS_HELP_STRING([--disable-expat],[Disable use of Expat]),
- [case "${enableval}" in
- yes) HAVE_EXPAT=yes ;;
- no) HAVE_EXPAT=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-expat) ;;
- esac],
- [HAVE_EXPAT=yes])
-
-if test "x$HAVE_EXPAT" = "xyes" ; then
- AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
-
- if ! $have_expat ; then
- AC_MSG_ERROR([*** libexpat not found ***])
- fi
-fi
-AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
-
-#
-# GDBM
-#
-#
-# Check for dbm
-#
-AC_ARG_ENABLE(dbm,
- AS_HELP_STRING([--enable-dbm],[Enable use of DBM]),
- [case "${enableval}" in
- yes) HAVE_DBM=yes ;;
- no) HAVE_DBM=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbm) ;;
- esac],
- [HAVE_DBM=no])
-
-AC_ARG_ENABLE(gdbm,
- AS_HELP_STRING([--disable-gdbm],[Disable use of GDBM]),
- [case "${enableval}" in
- yes) HAVE_GDBM=yes ;;
- no) HAVE_GDBM=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --disable-gdbm) ;;
- esac],
- [HAVE_GDBM=yes])
-
-if test "x$HAVE_GDBM" = "xyes" ; then
- if test "x$HAVE_DBM" = "xyes" ; then
- AC_MSG_ERROR([*** --enable-gdbm and --enable-dbm both specified ***])
- fi
- AC_CHECK_LIB(gdbm, gdbm_open, [ AC_CHECK_HEADERS(gdbm.h, have_gdbm=true, have_gdbm=false) ], have_gdbm=false)
-
- if ! $have_gdbm ; then
- AC_MSG_ERROR([*** libgdbm not found ***])
- fi
- AC_DEFINE([HAVE_GDBM],[],[Support for GDBM])
-else
- if test "x$HAVE_DBM" = "xyes" ; then
- AC_CHECK_HEADERS(ndbm.h, have_dbm=true, have_dbm=false)
-
- if ! $have_dbm ; then
- AC_MSG_ERROR([*** dbm not found ***])
- fi
- AC_DEFINE([HAVE_DBM],[],[Support for DBM])
- fi
-fi
-AM_CONDITIONAL(HAVE_GDBM, test "x$HAVE_GDBM" = "xyes")
-AM_CONDITIONAL(HAVE_DBM, test "x$HAVE_DBM" = "xyes")
-
-#
-# libdaemon
-#
-AC_ARG_ENABLE(libdaemon,
- AS_HELP_STRING([--disable-libdaemon],[Disable use of libdaemon]),
- [case "${enableval}" in
- yes) HAVE_LIBDAEMON=yes ;;
- no) HAVE_LIBDAEMON=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
- esac],
- [HAVE_LIBDAEMON=yes])
-
-if test "x$HAVE_LIBDAEMON" = "xyes" ; then
- PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
- AC_SUBST(LIBDAEMON_CFLAGS)
- AC_SUBST(LIBDAEMON_LIBS)
-fi
-AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
-
-#
-# Python stuff
-#
-AC_ARG_ENABLE(python,
- AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
- [case "${enableval}" in
- yes) HAVE_PYTHON=yes ;;
- no) HAVE_PYTHON=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
- esac],[HAVE_PYTHON=yes])
-
-HAVE_PYTHON_DBUS=no
-HAVE_PYGTK=no
-
-if test "x$HAVE_PYTHON" = "xyes" ; then
- AM_PATH_PYTHON([2.4])
-
- AC_ARG_ENABLE(pygtk,
- AS_HELP_STRING([--disable-pygtk],[Disable use of GTK in Python]),
- [case "${enableval}" in
- yes) HAVE_PYGTK=yes ;;
- no) HAVE_PYGTK=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-pygtk) ;;
- esac],
- [HAVE_PYGTK=yes])
-
- if test "x$HAVE_PYGTK" = "xyes" ; then
- AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module gtk)])
- fi
-
-
- if test "x$HAVE_DBUS" = "xyes" ; then
- AC_ARG_ENABLE(python-dbus,
- AS_HELP_STRING([--disable-python-dbus],[Disable use of D-Bus in Python]),
- [case "${enableval}" in
- yes) HAVE_PYTHON_DBUS=yes ;;
- no) HAVE_PYTHON_DBUS=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-python-dbus) ;;
- esac],
- [HAVE_PYTHON_DBUS=yes])
-
- if test "x$HAVE_PYTHON_DBUS" = "xyes"; then
- AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
- fi
-
- AM_CHECK_PYMOD(socket,,,[AC_MSG_ERROR(Could not find Python module socket)])
- if test "x$HAVE_GDBM" = "xyes"; then
- AM_CHECK_PYMOD(gdbm,,,[AC_MSG_ERROR(Could not find Python module gdbm)])
- fi
- if test "x$HAVE_DBM" = "xyes"; then
- AM_CHECK_PYMOD(dbm,,,[AC_MSG_ERROR(Could not find Python module dbm)])
- fi
- fi
-fi
-AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
-AM_CONDITIONAL(HAVE_PYGTK, test "x$HAVE_PYGTK" = "xyes")
-AM_CONDITIONAL(HAVE_PYTHON_DBUS, test "x$HAVE_PYTHON_DBUS" = "xyes")
-
-#
-# Check for mono stuff
-#
-HAVE_MONO=no
-if test "x$HAVE_DBUS" = "xyes" ; then
- AC_ARG_ENABLE(mono,
- AS_HELP_STRING([--disable-mono],[Disable mono bindings]),
- [case "${enableval}" in
- yes) HAVE_MONO=yes ;;
- no) HAVE_MONO=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-mono) ;;
- esac],
- [HAVE_MONO=yes])
-
- if test "x$HAVE_MONO" = "xyes" ; then
- AC_PATH_PROG(MCS, mcs)
- if test "x$MCS" = "x" ; then
- AC_MSG_ERROR([Can not find "mcs" - The Mono C-Sharp Compiler) in your PATH])
- fi
-
- AC_PATH_PROG(GACUTIL, gacutil)
- if test "x$GACUTIL" = "x" ; then
- AC_MSG_ERROR([Can not find "gacutil" in your PATH])
- fi
-
- AC_SUBST(MCS)
- AC_SUBST(GACUTIL)
- fi
-fi
-AM_CONDITIONAL(HAVE_MONO, test "x$HAVE_MONO" = "xyes")
-
-#
-# Check for monodoc stuff
-#
-HAVE_MONODOC=no
-AC_ARG_ENABLE(monodoc,
- AS_HELP_STRING([--disable-monodoc],[Disable documentation for mono bindings]),
- [case "${enableval}" in
- yes) HAVE_MONODOC=yes ;;
- no) HAVE_MONODOC=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-monodoc) ;;
- esac],
- [HAVE_MONODOC=yes])
-
-if test "x$HAVE_MONO" = "xyes" && test "x$HAVE_MONODOC" = "xyes" ; then
- PKG_CHECK_MODULES(MONODOC, [monodoc >= 1.1.8])
- MONODOC_DIR=`$PKG_CONFIG --variable=sourcesdir monodoc`
-
- AC_PATH_PROG(MONODOCER, monodocer)
- AC_PATH_PROG(MDASSEMBLER, mdassembler)
-
- AC_SUBST(MONODOC_DIR)
- AC_SUBST(MONODOCER)
- AC_SUBST(MDASSEMBLER)
-fi
-AM_CONDITIONAL(HAVE_MONODOC, test "x$HAVE_MONODOC" = "xyes")
-
-#
-# Build autoipd?
-#
-AC_ARG_ENABLE(autoipd,
- AS_HELP_STRING([--disable-autoipd],[Disable building of avahi-autoipd]),
- [case "${enableval}" in
- yes) ENABLE_AUTOIPD=yes ;;
- no) ENABLE_AUTOIPD=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --disable-autoipd) ;;
- esac],
- [ENABLE_AUTOIPD=yes])
-
-AM_CONDITIONAL(ENABLE_AUTOIPD, test "x$ENABLE_AUTOIPD" = "xyes")
-
-#
-# Defining users and groups
-#
-AC_ARG_WITH(avahi_user, AS_HELP_STRING([--with-avahi-user=<user>],[User for running avahi-daemon (avahi)]))
-if test -z "$with_avahi_user" ; then
- AVAHI_USER=avahi
-else
- AVAHI_USER=$with_avahi_user
-fi
-AC_SUBST(AVAHI_USER)
-AC_DEFINE_UNQUOTED(AVAHI_USER,"$AVAHI_USER", [User for running the Avahi daemon])
-
-AC_ARG_WITH(avahi_group,AS_HELP_STRING([--with-avahi-group=<group>],[Group for running avahi-daemon (avahi)]))
-if test -z "$with_avahi_group" ; then
- AVAHI_GROUP=avahi
-else
- AVAHI_GROUP=$with_avahi_group
-fi
-AC_SUBST(AVAHI_GROUP)
-AC_DEFINE_UNQUOTED(AVAHI_GROUP,"$AVAHI_GROUP", [Group for Avahi])
-
-AC_ARG_WITH(avahi_priv_access_group,AS_HELP_STRING([--with-avahi-priv-access-group=<group>],[Priviliged access group for Avahi clients (netdev)]))
-if test -z "$with_avahi_priv_access_group" ; then
- AVAHI_PRIV_ACCESS_GROUP=netdev
-else
- AVAHI_PRIV_ACCESS_GROUP=$with_avahi_priv_access_group
-fi
-AC_SUBST(AVAHI_PRIV_ACCESS_GROUP)
-AC_DEFINE_UNQUOTED(AVAHI_PRIV_ACCESS_GROUP,"$AVAHI_PRIV_ACCESS_GROUP", [Privileged access group for Avahi clients])
-
-AC_ARG_WITH(autoipd_user, AS_HELP_STRING([--with-autipd-user=<user>],[User for running the avahi-autoipd daemon (avahi-autoipd)]))
-if test -z "$with_autoipd_user" ; then
- AVAHI_AUTOIPD_USER=avahi-autoipd
-else
- AVAHI_AUTOIPD_USER=$with_autoipd_user
-fi
-AC_SUBST(AVAHI_AUTOIPD_USER)
-AC_DEFINE_UNQUOTED(AVAHI_AUTOIPD_USER,"$AVAHI_AUTOIPD_USER", [User for running the avahi-autoipd daemon])
-
-AC_ARG_WITH(autoipd_group,AS_HELP_STRING([--with-autoipd-group=<group>],[Group for running the avahi-autoipd daemon (avahi-autoipd)]))
-if test -z "$with_autoipd_group" ; then
- AVAHI_AUTOIPD_GROUP=avahi-autoipd
-else
- AVAHI_AUTOIPD_GROUP=$with_autoipd_group
-fi
-AC_SUBST(AVAHI_AUTOIPD_GROUP)
-AC_DEFINE_UNQUOTED(AVAHI_AUTOIPD_GROUP,"$AVAHI_AUTOIPD_GROUP", [Group for running the avahi-autoipd daemon])
-
-#
-# Avahi runtime dir
-#
-avahi_runtime_dir="${localstatedir}/run"
-avahi_socket="${avahi_runtime_dir}/avahi-daemon/socket"
-AC_SUBST(avahi_runtime_dir)
-AC_SUBST(avahi_socket)
-
-#
-# Avahi interfaces dir
-#
-if test "x$HAVE_PYTHON_DBUS" = "xyes" -o "x$HAVE_GTK" = "xyes"; then
- interfacesdir="${datadir}/${PACKAGE}/interfaces/"
- AC_SUBST(interfacesdir)
-fi
-
-#
-# Doxygen
-#
-DX_HTML_FEATURE(ON)
-DX_CHM_FEATURE(OFF)
-DX_CHI_FEATURE(OFF)
-DX_MAN_FEATURE(OFF)
-DX_RTF_FEATURE(OFF)
-DX_XML_FEATURE(OFF)
-DX_PDF_FEATURE(OFF)
-DX_PS_FEATURE(OFF)
-DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
-
-AC_ARG_ENABLE(core-docs,
- AS_HELP_STRING([--enable-core-docs],[Enable building of documentation for avahi-core]),
-[case "${enableval}" in
- yes) ENABLE_CORE_DOCS=yes ;;
- no) ENABLE_CORE_DOCS=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-core-docs]) ;;
-esac],[ENABLE_CORE_DOCS=no])
-
-AM_CONDITIONAL([ENABLE_CORE_DOCS], [test "x$ENABLE_CORE_DOCS" = xyes])
-
-#
-# Build and Install man pages
-#
-AC_ARG_ENABLE(manpages,
- AS_HELP_STRING([--disable-manpages],[Disable building and installation of man pages]),
-[case "${enableval}" in
- yes) manpages=yes ;;
- no) manpages=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-manpages]) ;;
-esac],[manpages=yes])
-
-if test x$manpages = xyes ; then
- #
- # XMLTOMAN manpage generation
- #
- AC_ARG_ENABLE(xmltoman,
- AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
- [case "${enableval}" in
- yes) xmltoman=yes ;;
- no) xmltoman=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
- esac],[xmltoman=yes])
-
- if test x$xmltoman = xyes ; then
- AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
- fi
-
- if test x$have_xmltoman = xno -o x$xmltoman = xno; then
- if ! test -e man/avahi-daemon.8 ; then
- AC_MSG_ERROR([*** xmltoman was not found or was disabled, it is required to build the manpages as they have not been pre-built, install xmltoman, pass --disable-manpages or dont pass --disable-xmltoman])
- exit 1
- fi
- AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
- xmltoman=no
- fi
-fi
-AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
-AM_CONDITIONAL([BUILD_MANPAGES], [test "x$manpages" = xyes])
-
-#
-# Conditionally compile test and example programs
-#
-AC_ARG_ENABLE(tests,
- AS_HELP_STRING([--enable-tests],[Enable building of tests and examples]),
- [case "${enableval}" in
- yes) ENABLE_TESTS=yes ;;
- no) ENABLE_TESTS=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-tests) ;;
- esac],
- [ENABLE_TESTS=no])
-
-AM_CONDITIONAL([ENABLE_TESTS], [test "x$ENABLE_TESTS" = "xyes"])
-
-#
-# Optionally enable libdns_sd compatibility support
-#
-AC_ARG_ENABLE(compat-libdns_sd,
- AS_HELP_STRING([--enable-compat-libdns_sd],[Enable compatibility layer for libdns_sd]),
- [case "${enableval}" in
- yes) ENABLE_COMPAT_LIBDNS_SD=yes ;;
- no) ENABLE_COMPAT_LIBDNS_SD=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-libdns_sd) ;;
- esac],
- [ENABLE_COMPAT_LIBDNS_SD=no])
-
-AM_CONDITIONAL([ENABLE_COMPAT_LIBDNS_SD], [test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes"])
-
-#
-# Optionally enable HOWL compatibility support
-#
-AC_ARG_ENABLE(compat-howl,
- AS_HELP_STRING([--enable-compat-howl],[Enable compatibility layer for HOWL]),
- [case "${enableval}" in
- yes) ENABLE_COMPAT_HOWL=yes ;;
- no) ENABLE_COMPAT_HOWL=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-howl) ;;
- esac],
- [ENABLE_COMPAT_HOWL=no])
-
-AM_CONDITIONAL([ENABLE_COMPAT_HOWL], [test "x$ENABLE_COMPAT_HOWL" = "xyes"])
-
-
-# ==========================================================================
-AC_CONFIG_FILES([
-Makefile
-avahi-common/Makefile
-avahi-core/Makefile
-avahi-glib/Makefile
-avahi-qt/Makefile
-avahi-daemon/Makefile
-avahi-daemon/avahi-dbus.conf
-avahi-discover-standalone/Makefile
-avahi-client/Makefile
-initscript/Makefile
-initscript/debian/Makefile
-initscript/gentoo/Makefile
-initscript/archlinux/Makefile
-initscript/suse/Makefile
-initscript/fedora/Makefile
-initscript/mandriva/Makefile
-initscript/darwin/Makefile
-initscript/freebsd/Makefile
-initscript/slackware/Makefile
-avahi-dnsconfd/Makefile
-avahi-utils/Makefile
-avahi-python/Makefile
-avahi-python/avahi/Makefile
-examples/Makefile
-common/Makefile
-man/Makefile
-tests/Makefile
-service-type-database/Makefile
-avahi-sharp/Makefile
-avahi-compat-libdns_sd/Makefile
-avahi-compat-howl/Makefile
-avahi-compat-howl/samples/Makefile
-avahi-autoipd/Makefile
-])
-AC_OUTPUT
-
-# ==========================================================================
-echo "
- ---{ $PACKAGE_NAME $VERSION }---
-
- prefix: ${prefix}
- sysconfdir: ${sysconfdir}
- localstatedir: ${localstatedir}
- avahi socket: ${avahi_socket}
- dbus-1 system.d dir: ${DBUS_SYS_DIR}
- dbus-1 version: ${DBUS_VERSION}
- dbus-1 system socket: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
- C Compiler: ${CC}
- CFLAGS: ${CFLAGS}
- Enable GLIB: ${HAVE_GLIB}
- Enable GTK: ${HAVE_GTK}
- Enable D-Bus: ${HAVE_DBUS}
- Enable Expat: ${HAVE_EXPAT}
- Enable GDBM: ${HAVE_GDBM}
- Enable DBM: ${HAVE_DBM}
- Enable libdaemon: ${HAVE_LIBDAEMON}
- Enable Python: ${HAVE_PYTHON}
- Enable pygtk: ${HAVE_PYGTK}
- Enable python-dbus: ${HAVE_PYTHON_DBUS}
- Enable QT3: ${HAVE_QT3}
- Enable QT4: ${HAVE_QT4}
- Enable Mono: ${HAVE_MONO}
- Enable Monodoc: ${HAVE_MONODOC}
- Distribution/OS: ${with_distro}
- User for avahi-daemon: ${AVAHI_USER}
- Group for avahi-daemon: ${AVAHI_GROUP}
- Priviliged access group for Avahi clients: ${AVAHI_PRIV_ACCESS_GROUP}
- User for avahi-autopid: ${AVAHI_AUTOIPD_USER}
- Group for avahi-autoipd: ${AVAHI_AUTOIPD_GROUP}
- Enable chroot(): ${enable_chroot}
-"
-
-BUILD_DAEMON="no (You need libdaemon and expat!)"
-
-if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
- BUILD_DAEMON=yes
-fi
-
-BUILD_PYTHON="no (You need python, pygtk and python-dbus!)"
-
-if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" -a "x$HAVE_PYTHON_DBUS" = "xyes" -a "x$HAVE_PYGTK" = "xyes" ; then
- BUILD_PYTHON=yes
-fi
-
-BUILD_CLIENT="no (You need avahi-daemon and D-Bus!)"
-
-if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" ; then
- BUILD_CLIENT=yes
-fi
-
-if test "x$ENABLE_COMPAT_LIBDNS_SD" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
- ENABLE_COMPAT_LIBDNS_SD="no (You need libavahi-client!)"
-fi
-if test "x$ENABLE_COMPAT_HOWL" = "xyes" -a "x$BUILD_CLIENT" != "xyes" ; then
- ENABLE_COMPAT_HOWL="no (You need libavahi-client!)"
-fi
-
-
-echo "\
- Building libavahi-core yes
- Building avahi-daemon: ${BUILD_DAEMON}
- Building avahi-dnsconfd: ${BUILD_DAEMON}
- Building libavahi-client: ${BUILD_CLIENT}
- Building avahi-utils: ${BUILD_CLIENT}
- Building avahi-python: ${BUILD_PYTHON}
- Building libavahi-glib: ${HAVE_GLIB}
- Building avahi-discover-standalone: ${HAVE_GTK}
- Building libavahi-qt3: ${HAVE_QT3}
- Building libavahi-qt4: ${HAVE_QT4}
- Building avahi-sharp: ${HAVE_MONO}
- Building avahi-compat-libdns_sd: ${ENABLE_COMPAT_LIBDNS_SD}
- Building avahi-compat-howl: ${ENABLE_COMPAT_HOWL}
- Building tests: ${ENABLE_TESTS}
- Building avahi-core documentation: ${ENABLE_CORE_DOCS}
- Building avahi-autoipd: ${ENABLE_AUTOIPD}
-"
diff --git a/trunk/docs/API-CHANGES-0.6 b/trunk/docs/API-CHANGES-0.6
deleted file mode 100644
index c29dd56..0000000
--- a/trunk/docs/API-CHANGES-0.6
+++ /dev/null
@@ -1,77 +0,0 @@
--*-text-*-
-
-
-A terse (and incomplete) list of API changes between 0.5.2 and 0.6:
-
- * Most browsing and registration functions and their callbacks gained
- new "flags" parameters. Passing 0 results in similar behaviour as
- in 0.5.2
-
- * avahi-client/client.h has been split into client.h, publish.h and lookup.h
-
- * avahi-core/core.h has been split into core.h publish.h lookup.h
-
- * avahi_client_is_service_local() has been removed. Use instead the special
- flags AVAHI_LOOKUP_RESULT_LOCAL and AVAHI_LOOKUP_RESULT_OUR_OWN which are
- set when resolving or browsing for services. AVAHI_LOOKUP_RESULT_OUR_OWN is
- what most people should use.
-
- * AVAHI_RESOLVER_TIMEOUT and AVAHI_RESOLVER_NOT_FOUND have been
- removed. Instead AVAHI_RESOLVER_FAILURE is used and the exact error
- code is available from avahi_client_errno()/avahi_server_errno()
-
- * The events AVAHI_BROWSER_CACHE_EXHAUSTED, AVAHI_BROWSER_ALL_FOR_NOW
- have been introduced. Failures during browsing are now passed as
- AVAHI_BROWSER_FAILURE and the error code is made available through
- avahi_client_errno()/avahi_server_errno().
-
- * The server gained a new state AVAHI_SERVER_FAILURE if some fatal
- error happens. The reason can be found in
- avahi_server_errno(). Clients can safely ignore this state.
-
- * You can now update existing records by setting the
- AVAHI_PUBLISH_UPDATE flags for add_service() and friends. Consider
- using avahi_server_update_service_txt_strlst() if you need to
- update only the TXT record for a service.
-
- * Proper support for service subtypes is now available. Use
- avahi_server_add_service_subtype() for that.
-
- * Entry groups gained the new state AVAHI_ENTRY_GROUP_FAILURE. The
- reason is available using
- avahi_server_errno()/avahi_client_errno().
-
- * Many superfluous functions have been removed from the public API or
- entirely.
-
- * avahi_simple_poll_iterate() has been split up into three
- functions. avahi_simple_poll_loop() has been introduced.
-
- * Some new limits have been introduced: AVAHI_ADDRESS_STR_MAX,
- AVAHI_DOMAIN_NAME_MAX, AVAHI_LABEL_MAX
-
- * The functions avahi_service_name_join() and
- avahi_service_name_split() have been introduced.
-
- * AVAHI_ERR_LOCAL_COLLISION has been renamed to AVAHI_ERR_COLLSION
-
- * The values of AVAHI_PROTO_xxx have changed, they are no longer
- identical to the BSD AF_xxx constants
-
- * avahi_client_new() now takes an additional flags parameter. Most
- interesting flag here is AVAHI_CLIENT_NO_FAIL, which can be used to
- create an AvahiClient object even when the daemon is not
- running. This is useful to deal with daemon restarts.
-
- * AvahiClient gained a new state AVAHI_CLIENT_FAILURE. (superseding
- AVAHI_CLIENT_DISCONNECTED). If this event happens,
- avahi_client_errno() will return the reason. If the error returned
- is AVAHI_ERR_DISCONNECTED, the situation where
- AVAHI_CLIENT_DISCONNECTED was previously thrown is entered. You may
- choose to reconnect in that case by freeing your AvahiClient new
- and create a new one with passing AVAHI_CLIENT_NO_FAIL.
-
- * There's now a client side AvahiRecordBrowser, and
- avahi_entry_group_add_record().
-
-$Id$
diff --git a/trunk/docs/AUTHORS b/trunk/docs/AUTHORS
deleted file mode 100644
index 69e56f2..0000000
--- a/trunk/docs/AUTHORS
+++ /dev/null
@@ -1,12 +0,0 @@
-If you wish to contact the developers, you can mail our mailing list
- avahi@freedesktop.org
-For more information and how to subscribe, see
- http://lists.freedesktop.org/mailman/listinfo/avahi
-
-Lennart Poettering
-Trent Lloyd <lathiat@bur.st>
-Sebastien Estienne <sebastien.estienne@gmail.com>
-Jakub Stachowski
-James Willcox <snorp@snorp.net>
-
-$Id$
diff --git a/trunk/docs/COMPAT-LAYERS b/trunk/docs/COMPAT-LAYERS
deleted file mode 100644
index 050c988..0000000
--- a/trunk/docs/COMPAT-LAYERS
+++ /dev/null
@@ -1,18 +0,0 @@
-Avahi 0.6.1 and above offer full API and ABI compatibility with HOWL
-and Bonjour out-of-the-box. To enable this you pass
---enable-compat-libdns_sd and/or --enable-compat-howl to the configure
-script. The build system installs both a shared library libdns_sd.so
-and one named libhowl.so. These files might overwrite the original
-implementations, so take care!
-
-Distributors that want full build system compatibility in addition to
-ABI/API compatibility should:
-
- 1) Symlink the pkg-config file avahi-compat-howl.pc to howl.pc
-
- 2) Symlink $(includedir)/avahi-compat-libdns_sd/dns_sd.h to
- $(includedir)/dns_sd.h
-
--- Lennart
-
-$Id$
diff --git a/trunk/docs/DBUS-API b/trunk/docs/DBUS-API
deleted file mode 100644
index 99e16da..0000000
--- a/trunk/docs/DBUS-API
+++ /dev/null
@@ -1,15 +0,0 @@
-$Id$
-
-* NOTE *
-This file used to contain an overview of the DBUS API for Avahi, however
-since it was no longer up to date you should now read the XML-formatted DBUS
-Introspection files, which are fairly easy to understand and kept up to date.
-
-You can see them in the avahi-daemon source directory, named *.introspect.
-
-Opening them in a web browser is a good way to view them as they are formatted
-nicely, you can also view our online copy under "Developing with Avahi" here:
-
-http://avahi.org/
-
- - Lathiat
diff --git a/trunk/docs/HACKING b/trunk/docs/HACKING
deleted file mode 100644
index eec7eb7..0000000
--- a/trunk/docs/HACKING
+++ /dev/null
@@ -1,91 +0,0 @@
-Please comply with the following rules when hacking on Avahi:
-
- * When you add a new textual file to the repository please enable SVN
- keyword expansion for it:
-
- svn ps svn:keywords Id foo.c
-
- * Before commiting check with "svn st" that all built files are ignored
- by svn. To change the list of ignored files use
-
- svn pe svn:ignore .
-
- This is similar to the ".cvsignore" file in CVS times.
-
- * Don't forget to add the autoconf config.h inclusion to all C source files:
-
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
-
- This needs to be placed in in .c files only. NOT IN HEADER FILES!
-
- * Don't hardcode any paths in source files. Either use the -D option of gcc
- for C sources or use "sed" to replace them based on a .in file.
-
- * Never forget that Avahi should be buildable without DBUS, GTK or python!
-
- * Before commiting, test your code! In case of C consider running it
- a few times through valgrind, to make sure that you got everything
- right. You have to call libtool explicitly when running valgrind
- on binaries that depend on shared objects. e.g:
-
- libtool --mode=execute valgrind ./avahi-daemon
-
- Please note that valgrind can't find you all bugs. Please check
- your code thrice with your brain before committing. Valgrind is
- only a final check.
-
- * Whenever you add a new Makefile.am, C (.c or .h) source file, shell or
- python script please add this legal blurb to its header:
-
- For Makefile.am, python and shell code:
-
-<snip>
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-</snip>
-
- For C source code:
-
-<snip>
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-</snip>
-
-
-$Id$
diff --git a/trunk/docs/INSTALL b/trunk/docs/INSTALL
deleted file mode 100644
index 8feac51..0000000
--- a/trunk/docs/INSTALL
+++ /dev/null
@@ -1,55 +0,0 @@
-*** Quick install instructions (tested on Debian/Ubuntu only!) ***
-
-While "configure" and "make" may be run as normal user all other commands
-need to be run as root.
-
-Configure the build system:
- $ ./configure --sysconfdir=/etc --localstatedir=/var
-
-Some configure options available:
-
- --disable-gtk disable GTK+ tools (default: enabled)
- --disable-dbus disable DBUS support (default: enabled)
- --disable-python disable building python modules (default: enabled)
- --with-dbus-sys=<dir> where D-BUS system.d directory is
- --with-distro=<distro> the target Linux distribution (one of redhat,
- suse, gentoo, debian or slackware)
- --with-avahi-user=<user> User for running the Avahi daemon (avahi)
- --with-avahi-group=<grp> Group for Avahi (avahi)
-
- Please note that by disabling DBUS you lose the ability to publish and browse
- services from local applications.
-
- Please note that Avahi currently ships with a init scripts for only a few
- distributions. if yours is not supported right now, YMMV. Patches welcome.
-
- $ make
- # make install
- # ldconfig
-
-Add a user an a group for avahi. (Debian specific)
- # addgroup --system avahi
- # adduser --system --no-create-home --ingroup avahi avahi
-
-Ask DBUS to re-read its policies:
- # kill -HUP `cat /var/run/dbus/pid`
-
-Now start the Avahi daemon:
- # /etc/init.d/avahi-daemon start
-
-Optionally start the unicast DNS configuration daemon:
- # /etc/init.d/avahi-dnsconfd start
-
-To start the two daemons at boot time on Debian based distributions:
- with DBUS support:
- # ln -s /etc/init.d/avahi-daemon /etc/dbus-1/event.d/75avahi-daemon
- # ln -s /etc/init.d/avahi-dnsconfd /etc/dbus-1/event.d/76avahi-dnsconfd
-
- without DBUS support:
- # update-rc.d avahi-daemon defaults 25 15
- # update-rc.d avahi-dnsconfd defaults 26 14
-
-If you plan to use avahi-autoipd you have to create the user/group
-"avahi-autoipd" much the same way as "avahi".
-
-$Id$
diff --git a/trunk/docs/MALLOC b/trunk/docs/MALLOC
deleted file mode 100644
index 5c7db9e..0000000
--- a/trunk/docs/MALLOC
+++ /dev/null
@@ -1,10 +0,0 @@
-Avahi supports pluggable memory allocator implemenations. See
-<avahi-common/malloc.h> for more information.
-
-Currently, Avahi does not deal well with out-of-memory
-situations. Therefore we recommend the usage of memory allocators that
-abort() in case of OOM. The default allocator used by Avahi does this.
-
-Eventually we will improve Avahi to deal with these things better.
-
-$Id$
diff --git a/trunk/docs/NEWS b/trunk/docs/NEWS
deleted file mode 100644
index f6d04c6..0000000
--- a/trunk/docs/NEWS
+++ /dev/null
@@ -1,552 +0,0 @@
-Avahi 0.6.15
-============
-
-This is a bugfix release, this bug is potentially security sensitive
-
- * Check that netlink messages actually originate from the kernel
- and not another process.
- * Fix build on NetBSD (thanks to Daniel S. Haischt)
- * Fix dbus_service_browser not setting AVAHI_LOOKUP_RESULT_OUR_OWN.
-
-This release is backwards compatible with Avahi 0.6.x with x < 15.
-
-Avahi 0.6.14
-============
-
-This release fixes some bugs and includes a new component.
-
-Changes:
-
- * Add new daemon "avahi-autoipd" which is an implementation of
- IPv4LL as defined in RFC3927, a technology for assigning link-local IP
- addresses without DHCP server. The same functionality has been available on
- Windows under the name APIPA. While it is not the first implemenatation of
- this technology for Free operating systems it is clearly the most powerful
- and hopefully even the most secure. (Because it chroot()s and drops
- priviliges and suchlike) For more information, especially about packaging
- this new tool for distributions, please make sure to read:
- http://avahi.org/wiki/AvahiAutoipd
- and of course the man page included in the tarball. For the rationale for
- adding this program to the Avahi toolset please read this mailing list
- thread:
- http://lists.freedesktop.org/archives/avahi/2006-September/000863.html
- * Fix a segfault in the code handling static host name registrations
- * Add a few new entries to the service type database
- * s/D-?BUS/D-Bus/g
- * Documentation updates
- * Fix service type database building on Solaris
- * Make use of newer D-Bus APIs
- * Fix random seed initialization
- * Install SFTP static service file by default
- * Other minor code cleanups
-
-This release is backwards compatible with Avahi 0.6.x with x < 14.
-
-Please note that this version doesn't compile on NetBSD, patches
-welcome.
-
-Please note that avahi-autoipd is available on Linux only for
-now. Patches welcome. It is recommended to pass --disable-autoipd to
-"configure" on non-Linux operating systems, otherwise the build will
-fail.
-
-Avahi 0.6.13
-============
-
-This release fixes some bugs and includes minor enhancements.
-
-Changes:
- * Add a new D-Bus method for changing the mDNS host name during
- runtime. This functionality is only available to members of the
- UNIX group "netdev", which is the same access group that is
- enforced by GNOME's NetworkManager daemon. Since NM will probably
- be the most prominent user of this new method, we decided to limit
- access to the same group. The access group can be set by passing
- --with-avahi-priv-access-group= to "configure". If you need more
- sophisticated access control you can freely edit
- /etc/dbus/system.d/avahi-dbus.conf.
- * Add a new utility "avahi-set-host-name" which is a command line
- wrapper around the aforementioned SetHostName() method.
- * Bonjour API compatibility library:
- * Implement DNSServiceUpdateRecord()
- * Allow passing NULL as callback function for
- DNSServiceRegister()
- * Implement subtype registration in DNSServiceRegister() in a
- way that is compatible with Bonjour.
- * Update to newer copy of dns_sd.h
- * If the host name changes update names of static services wich
- contain wildcards.
- * Don't build documentation about embedding the Avahi mDNS stack into
- other programs by default. This is a feature used only by embedded
- developers. Pass --enable-core-docs to "configure" to enable
- building these docs, like in Avahi <= 0.6.12.
- * Build Qt documentation only when Qt support is enabled in
- the configuration. Same for GLib.
- * Change algorithm used to find a new host name on conflict. In
- Avahi <= 0.6.12 a conflicting host name of "foobar" would be
- changed to the new name "foobar2". With 0.6.13 "foobar-2" will be
- picked instead. This follows Bonjour's behaviour and has the
- advantage not confusing people with regular host names ending in
- digits.
- * Don't disable all static services when SIGHUP is recieved.
- * Fix build when Avahi is configured without Gtk+ but with Python
- support
- * Fix build on MacOS X
- * Support using Solaris DBM instead of gdbm for the service type
- database. The latter is still recommended
- * Minor other fixes and documentation updates
-
-This release is backwards compatible with Avahi 0.6.x with x < 13.
-
-Avahi 0.6.12
-============
-
-This is a bugfix and general cleanups release.
-
-Changes:
- * Compatibility with newer D-Bus releases (0.9x)
- * Compatibility with DBUS builds with --disable-checks
- * Fix an error in the DBUS event loop wrapping which
- caused the avahi client libraries to dispatch some events
- too late when used with D-BUS 0.62 and newer.
- * avahi-daemon: fix a minor memory leak in the DBUS code.
- * avahi-glib: some GLIB adapter cleanups
- * avahi-dnsconfd: fix segfault when passing an invalid command
- line option
- * avahi-test: portability patches for Solaris
- * avahi-browse: flush STDOUT after each line, making it useful
- in shell scripts.
- * update service type database
-
-This release is backwards compatible with Avahi 0.6.x with x < 12.
-
-Avahi 0.6.11
-============
-
-This is a bugfix and portability release.
-
-Changes:
- * Ported to Solaris
- * avahi-sharp: fix a fatal error in object disposal code
- * add a few new entries to the servivce type database
- * fix potential crash when the daemon shuts down
- * compatibility with newer autoconf versions
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.9 and 0.6.10.
-
-Avahi 0.6.10
-============
-
-This is mostly a bugfix release. Two of the bugs fixed are security
-sensitive: a remote denial-of-service vulnerability and a buffer
-overflow that can allow local users to become the 'avahi' user. We do
-not consider either of them major security threats.
-
-The DoS vulnerability can be exploited from a local network only. It
-is not worth much, though, since mDNS can easily be flooded with
-nonsense anyway. It is easy to kick remote mDNS/DNS-SD services by
-provoking a name conflict in perfect accordance with the specs.
-
-The buffer overflow is hard to exploit remotely, only local users can
-become the 'avahi' user. In addition the user is trapped inside a
-chroot() environment (at least on Linux).
-
-Anyhow, our security assessments are possibly as buggy as our
-code. Hence:
-
- *** PLEASE UPDATE YOUR INSTALLATION ASAP! ***
-
-Changes:
- * Fix a buffer overflow in avahi-core
- * Refuse to process invalid UTF8 data
- * Automatically reconnect to the DBUS if we're kicked. (Works only if
- chroot() is disabled)
- * Don't hit an assert() in the client libs when the Avahi daemon is
- terminated
- * Enumerate all service types in the database in the Service
- Discovery Applet for Gnome
- * Improve the Bonjour compatibility layer to make it survive
- GnomeMeeting's broken usage
- * Deal properly with local non-ASCII hostnames
- * AMD64 and FreeBSD portability fixes
- * Filter double DNS server entries in avahi-dnsconfd
- * Fix a locking bug in avahi-sharp's EntryGroup.AddService()
- * Ported to Solaris (incomplete)
- * Add _airport._tcp to our service type database
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7, 0.6.8 and 0.6.9.
-
-Avahi 0.6.9
-===========
-
-This release fixes some bugs and includes minor enhancements.
-
- * Don't allow registration of address records with invalid host names
- * Clean up argument validity checking for AvahiHostNameResolver and
- AvahiAddressResolver
- * Fix Avahi builds without DBUS
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5, 0.6.6, 0.6.7 and 0.6.8.
-
-Avahi 0.6.8
-===========
-
-This release fixes some bugs and adds a few new features. Users of 0.6.7,
-please update ASAP!
-
- * Fix broken parsing of static hosts file
- * Improve out-of-the-box Debian support
- * Add configuration option to allow mDNS over POINTOPOINT links.
- This is a potential security hole and YMMV. See man page for details.
- * Create $(localstatedir)/run on installation
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5, 0.6.6 and 0.6.7.
-
-Avahi 0.6.7
-===========
-
-This release fixes some bugs and adds a few new features
-
- * Add static hosts name mappings
- * Work around kernel bugs regarding multicast group membership
- * ia64 portability fixes
- * Don't require X11 to run avahi-bookmarks
- * API: Return AVAHI_ERR_IS_EMPTY when the user tries to commit an
- empty entry group.
- * Improved Slackware and Fedora suppport
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4, 0.6.5 and 0.6.6.
-
-Avahi 0.6.6
-===========
-
-This release fixes some bugs and includes some documentation updates
-
- * Add a bunch of new types to the service type database
- * Return errors of avahi_entry_group_commit() properly
- * Many doxygen documentation improvements
- * Fix destruction of AvahiEntryGroup objects using
- avahi_entry_group_free().
- * Don't allow commiting of empty entry groups
- * Use a little less memory in avahi-qt
- * Don't accept empty TXT strings
- * Update example "client-publish-service.c" to show how to modify an
- existing service
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3, 0.6.4 and 0.6.5.
-
-Avahi 0.6.5
-===========
-
-This release fixes some bugs and adds a new API function.
-
- * avahi-browse: properly show services that are removed from the
- network
- * fix build on bi-arch platforms, on GNU/kFreeBSD, on MIPS and
- for non-DBUS builds
- * add new API function avahi_nss_support() and DBUS function
- IsNSSSupportAvailable() which may be used to detect whether
- libc's gethostbyname() supports mDNS domain names.
- * patch avahi-bookmarks to make use of
- IsNSSSupportAvailable(). avahi-bookmarks will now generate links
- with real hostnames instead of numeric IP addresses if mDNS support
- is detected for gethostbyname().
- * add init script for Mandriva Linux
- * speed up avahi_client_free()
- * man page updates
- * install missing header thread-watch.h
- * fix avahi-bookmarks to work with certain twisted versions
- * fix record updating
- * Use pkg-config's Requires.private directive where it makes sense
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2,
-0.6.3 and 0.6.4.
-
-Avahi 0.6.4
-===========
-
-This is a bugfix release and adds a new event loop implementation to
-avahi-common's public interface.
-
- * avahi-common: add new AvahiThreadedPool event loop implementation
- * avahi-sharp: compatibility with newer mono versions
- * avahi-publish-service: don't ignore the port number specified
- * avahi-sharp: correct some flags definitions
-
-This release is backwards compatible with Avahi 0.6, 0.6.1, 0.6.2 and
-0.6.3.
-
-A quick introduction how to use the new AvahiThreadedPool interface is
-available in our Wiki:
-
- http://avahi.org/wiki/RunningAvahiClientAsThread
-
-Avahi 0.6.3
-===========
-
-This is a bugfix release. Everyone should update ASAP!
-
- * avahi-sharp: make sure to append a trailing NUL byte to all C strings
- * avahi-core: fix a double free() which occurs when wide area lookups timeout
-
-This release is fully compatible with Avahi 0.6, 0.6.1 and 0.6.2.
-
-Avahi 0.6.2
-===========
-
-This is mostly a bugfix release.
-
- * Compatibility with DBUS 0.60 (Full compatibility with DBUS 0.3x and
- 0.5 is retained)
- * Fix introspection for some auxiliary DBUS objects
- * Miscellaneous documentation updates
- * Improve Autoconf support for detecting PTHREADS library
- * Fix avahi-publish --help
- * Workaround a DBUS limitation which might cause Avahi to die when a
- user sends an empty TXT entry over DBUS
- * Increase number of resolver/browser objects a DBUS client may create
- * Remove fprintf() call in avahi_client_new()
- * Other minor fixes
-
-This release is both up and downwards compatible with Avahi 0.6 and 0.6.1.
-
-Avahi now has its own Domain (http://avahi.org) and a new Website!
-
-And, most importantly, we now have a Logo:
- http://avahi.org/chrome/site/avahi-trac.png
-
-Avahi 0.6.1
-===========
-
-This is mostly a bugfix release.
-
- * Fix a segfault when shutting down the daemon. Please note that this
- issue was not security sensitive in any way but had the ugly side
- effect that the daemon's PID file was not removed properly.
- * Added init scripts for ArchLinux and FreeBSD
- * Add DBUS API versioning through the new method GetAPIVersion()
- * Build the HOWL compatibility library as "libhowl.so", instead of
- "libavahi-compat-howl.so". This will help distributors to ensure
- full API/ABI compatibility with HOWL out-of-the-box.
- * Same for the Bonjour compatibility library
- * Other fixes
-
-We encourage Linux users to update to libdaemon 0.10 since logging
-does not work from a chroot() environment with older versions.
-
-This release is fully API and ABI compatible with Avahi 0.6. This is
-true for both the C libraries and the DBUS interface.
-
-Packagers should read the new documentation file doc/COMPAT-LAYERS
-which contains some information about maintaining full build system
-compatibility in addition to ABI/API compatibility.
-
-Avahi 0.6, the "Goddag" release
-===============================
-
- * Support for (read-only) wide area support. (i.e. DNS-SD over unicast DNS)
- * Ported to FreeBSD, NetBSD, Darwin/MacOSX and to some extent OpenBSD
- * Portability fixes for ARM CPUs
- * Compatibility layers for the HOWL and Bonjour APIs
- * Support for registering/browsing arbitrary records
- * Proper support for DNS-SD service subtypes
- * Native C implementations of the client utilities
- * Now passes the Bonjour conformance test suite without any exceptions
- * "Passive observation of failures"
- * chroot() support
- * Many traffic reduction improvements
- * Bugfixes, cleanups
-
-This release is not API/ABI compatible with Avahi 0.5. Please see
-docs/API-CHANGES-0.6 for a rough overview over the changes.
-
-Avahi 0.5.2
-===========
-
- * Bug fix release.
- * Fix browing in QT applications (was totally broken)
- * Minor documentation update.
-
-Avahi 0.5.1
-===========
-
- * This is a bug fix release, before the big changes coming in 0.6
- * Fix reporting of the NO_DAEMON error
- * Fix commit throttling algorithm for entry groups
- * Fix counting of the number of resources in an entry group
-
-Avahi 0.5, the 'Bom Dia' release
-================================
-
- * New Mono bindings, allowing you to use Avahi from
- any CLI language such as C#
- * Attempt auto-detection of the D-BUS system bus address
- * Include a 'cookie' in all published records which allows us
- to reliably determine if a service is the same as another.
- * Add API to determine if services are local
- * Better support for threading with AvahiSimplePoll
- * Add some new StringList functions to help binding to it in
- other languages
- * Various build and run-time bug fixes
-
-Avahi 0.4, the 'Hyvää päivää' release
-=====================================
-
- * Renamed the include dirs for the Qt bindings to include the
- version number, as they may diverge in future.
- * Fix a critical bug in avahi-daemon triggered by configuring an interface
- with various DHCP clients when you have no other active addresses which
- caused avahi-daemon to abort.
- * Move to using python-gdbm exclusivly for the service type database.
- * Add support for SUSE
- * Various fixes to the build system
-
-Avahi 0.3, the 'Buenos Días' release
-====================================
-
- * New integration library for QT main-loop applications.
- * Fix a crash in avahi-dnsconfd
- * Documentation Updates
- * Fix building when you don't want Python DBUS or GTK
- * avahi-bookmarks
- - Add new help option
- - Fix handling of paths not starting with a /
- - You can now specify the port and IP to bind to
- - Add option to generate links with hostnames instead of IPs
-
-Avahi 0.2, the 'Dzień Dobry' release
-====================================
-
- * Unfortunately this release broke the API/ABI of libavahi-client
- with the following function removals
-
- Removal of these functions may affect users of the 0.1 API
- - avahi_service_resolver_block()
-
- The following functions were simply for debugging information
- and their removal should not affect anyone
- - avahi_entry_group_get_dbus_path()
- - avahi_domain_browser_get_dbus_path()
- - avahi_service_type_browser_get_dbus_path()
- - avahi_service_browser_get_dbus_path()
-
- Note that while the libavahi-client API changed slightly, the DBUS
- API itself has only had additions and no existing definitions
- have changed.
-
- * avahi-daemon will now ignore local IP addresses with the "link" scope
- unless it is the only IP address on the interface.
- * avahi-daemon will no longer fail to start if D-BUS is not
- available (if configured with enable-dbus=warn)
- * Fixed a potential crasher when resolving things in libavahi-core.
- * New example demonstrating integration into glib applications
- * Addtion of a set of convenience functions for AvahiStringList
- avahi_string_list_find()
- avahi_string_list_get_pair()
- avahi_string_list_add_pair()
- avahi_string_list_add_pair_arbitrary()
- * Fixed a typo in avahi-glib.pc that stopped programs using
- the GLIB api from compiling correctly
- * A critical bug in the reflector was fixed where it may go into a
- state of constantly flooding queries out to the network.
- * Introduced new asynchronous resolver API
- * libavahi-client gained an API for resolving HostNames and Addresses
- in addition to the ServiceResolver provided in 0.1
- * Added support for Arch and Gentoo linux distributions.
- * Allowed configuration on non-supported distributions
- * Fixed a critical bug where you cannot use more than one AvahiClient
- or use it in an application already using D-BUS
- * Fixed assembly of empty string lists to RFC compliant TXT records
- * Added a new service type description database with human
- understandable descriptions of services with translations.
- * Fixed various minor memory corruption bugs
- * Fixed an issue where Avahi might think it encountered a conflict
- if the process or machine has been suspended
- * Fixed compilation and runtime issues on 64-bit distributions
- * ...
- * PROFIT!!!
-
-Avahi 0.1, the "Guten Tag" release
-==================================
-
-The Avahi team would like to announce the immediate availability of
-Avahi 0.1 "Guten Tag".
-
-Avahi is a fully LGPL framework for Multicast DNS Service Discovery.
-It allows programs to publish and discover services and hosts
-running on a local network with no specific configuration. For
-example you can plug into a network and instantly find printers to
-print to, files to look at and people to talk to.
-
-Avahi is designed to be compatible with the mDNS/DNS-SD specification
-and boasts the following features
-
- * Fully open source and freely available under the LGPL
- * Full IPv4 and IPv6 support
- * An embeddable mDNS stack
- * Dynamic adjustment to network reconfiguration
- * Daemon with DBUS API for desktop applications
- * C library to interface with the DBUS API
- * Compatible with other mDNS/DNS-SD implementations such as
- Howl and Apple Bonjour (previously Rendezvous)
- * Ability to correctly "reflect" mDNS between two or more LAN segments
- * Ability to configure DNS servers based on mDNS/DNS-SD published
- information, a feature that is very usefull on IPv6
- which has no other mechanism for this.
- * Combined with nss-mdns, allows hostname lookup such as
- 'laptop.local' without the configuration of a DNS server.
- http://0pointer.de/lennart/projects/nss-mdns/
- * Easy integration into GLIB, GTK other mainloop applications.
- * Documentation and examples of both developer APIs and utilities.
-
-mDNS/DNS-SD is part of a larger set of specifications for easy
-configuration of networking known as "ZeroConf"
-(http://www.zeroconf.org/), with the aim of allowing you to plug into
-a network and instantly be able to interact with it's services.
-
-Avahi was designed to be a fully free implementation, and is
-available under the LGPL. Many other implementations of the mDNS/DNS-SD
-specification were previously non-free, restricting their use in many
-platforms such as the GNOME desktop and many distributions.
-
-While Avahi is a 0.1 release, we feel it is feature complete and
-available for immediate use, developers can make use of the Avahi
-client library to provide above mentioned functionality in their
-programs.
-
-We unfortunately do not have a logo yet! We would love if someone
-could suggest ideas for a logo or even design us one. If you think
-you can help us out, you can contact us on our mailing list or by
-emailing Trent Lloyd on lathiat@bur.st.
-
-If you would like more information or help, you can subscribe
-to our mailinglist, goto
- http://lists.freedesktop.org/mailman/listinfo/avahi
-
-You can download Avahi 0.1 here
- http://www.freedesktop.org/~lennart/avahi-0.1.tar.gz
-
-You can also find out more information from our homepage
- http://www.freedesktop.org/Software/Avahi
-
-We would like to thank the following people for their
-contribution to Avahi 0.1.
- Lennart Poeterring
- Trent Lloyd
- Sebastien Estienne
- Ross Burton
- Tommi Vainikainen
- Joe Shaw
- Ikke
- Steev
-
-Cheers,
-The Avahi Team
-
-$Id$
diff --git a/trunk/docs/README b/trunk/docs/README
deleted file mode 100644
index 6c6a586..0000000
--- a/trunk/docs/README
+++ /dev/null
@@ -1,50 +0,0 @@
-Avahi is a free, LGPL mDNS/DNS-SD implementation.
-
-Copyright 2004-2006 by the Avahi developers.
-
- http://avahi.org/
-
-Avahi has a mailing list:
-
- http://lists.freedesktop.org/mailman/listinfo/avahi
-
-You have a chance to meet the developers on
-
- #avahi on irc.freenode.org
-
-Please report bugs to the freedesktop.org bugzilla:
-
- http://bugs.freedesktop.org/
-
-Avahi's SVN repository is freely accessible:
-
- svn checkout svn://svn.0pointer.de/avahi/trunk avahi
-
- http://0pointer.de/cgi-bin/viewcvs.cgi/?root=avahi
-
-Avahi has the following requirements:
- - glib2
- - expat
- - libdaemon (http://0pointer.de/lennart/projects/libdaemon/)
- - Linux 2.4 or 2.6
- - DBUS 0.3x (optional, if you disable this, the daemon is not
- accessible over IPC to other applications!)
- - gtk2 + glade (optional, needed for avahi-discover-standalone)
- - doxygen (optional, needed for he API documentaton)
- - Python 2.4, pygtk2 (optional, needed by all client tools)
- - python-twisted (optional, needed by avahi-bookmarks)
- - xmltoman (if building from SVN rather than a tarball)
- If you are not using debian or ubuntu, the upstream authors page has
- disappeared, but you can get the source from debian here
- http://ftp.debian.org/debian/pool/main/x/xmltoman/xmltoman_0.3.orig.tar.gz
-
-Please make sure to read the currently available documentation for avahi before
-asking for support on the mailing list:
-
- - INSTALL
- - Man pages
- - Homepage http://avahi.org/
- - Mailing list archive http://lists.freedesktop.org/archives/avahi/
-
-
-$Id$
diff --git a/trunk/docs/TODO b/trunk/docs/TODO
deleted file mode 100644
index 9907ec6..0000000
--- a/trunk/docs/TODO
+++ /dev/null
@@ -1,106 +0,0 @@
-later:
-* add simplification routine for adding services
-* support for special domain PTR records based on local IP subnet address
-* Changes resulting in updated RFC of 7th June 2005:
- * Defer responses to replies with TC bit set by 400-500msec
- * Defer unicast responses the same way as multicast responses
-* DNSSEC [federico]
-* Wide area DNS Update [federico]
-* long lived queries
-* libavahi-compat-libdns_sd: implement kDNSServiceFlagsNoAutoRename and missing functions
-* libavahi-compat-howl: implement missing functions
-* add API to allow user to tell the server that some service is not reachable
-
-done:
-* drop glib from avahi-daemon
-* doxygen updates
-* deal with no local interface
-* Probing/Conflict resolution
-* uniqueness
-* respect escaping in name serialization
-* really send goodbye packets
-* refresh subscribed records only
-* FLX_DNS_TYPE_ANY support
-* Known-Answer suppression client part
-* Known-Answer suppression server part
-* make flx_server_add_text() and flx_server_add_service() variadic functions
-* name compression
-* remove expression "rrset" from source files
-* defend our entries on incoming goodbye
-* allow NULL bytes in TXT records
-* add flx_server_add_service_strlst() and friends
-* change flx_* to avahi_*
-* Unicast responses/queries
-* Legacy unicast
-* no flush bit in known answer
-* always set AA
-* check: TC bit is valid for queries ONLY
-* add SRV and TXT records referenced from PTR records automatically to packet
-* add A and AAAA records referenced from SRV records automatically to packet
-* support known answer suppresion for incoming unicast queries
-* check wether RRsets are supported correctly (i.e. that all records of an
- RRset are really sent if it is requested) (rfc 2181)
-* case insensitve comparison
-* drop records from cache only one second after flush cache bit entry was received
-* either send entire RRSET or don't set flush cache bit!
-* mantain flush cache bit correctly in psched
-* Return to probing state on conflict
-* response job dependencies
-* enlarge packet in case a record/query is too large to fit in a normal packet
-* reflector
-* test against apple test suite
-* sensible logging
-* c++ support
-* drop trailing dot on avahi_normalize_name()
-* add entry_group::reset()
-* add internal error codes
-* finish DBUS stuff: allow NUL bytes in TXT records
-* allow srv port == 0
-* avahi-client:
- * service resolving
- * examples
-* publish IP addresses with scope "link" only, unless ther are the only one the interface
-* release 0.2!
-* add identical service detection cookie
-* add API to detect if a service is local
-* make AVAHI_PROTO_xxx well defined constants
-* if two local clients browse for the same RRs, only send out query series once
-* handle multicast/wide area resolving for reverse host name looups
-* add wide area support (i.e. DNS-SD over unicast DNS)
-* add a way to notify the user that all cache entries have been read when browsing
-* allow resolving of services without name
-* add sever version check to avahi-client
-* Passive observation of failures
-* add option to disable SO_REUSEADDR to disallow binding of multiple processes to port 5353
-* add flags argument to disable cookies-setting for local services
-* add API to add addresses without reverse PTR record
-* reset commit throttling for entry groups after a while
-* wrap subtype support for avahi-client
-* add subtype browsing
-* split linux specific parts from iface.c
-* consolidate browsing failure events and add an API to query the reason
-* Add sensible record updating API
-* rename AvahiAnnouncement to AvahiAnnouncer (to match AvahiQuerier)
-* implement avahi_client_add_address
-* remove AVAHI_PUBLISH_IS_PROXY
-* replace avahi_server_is_service_local() by AVAHI_PUBLISH flag
-* drop partially created created entries on failure
-* add error state for server and entry group
-* make sure that all limit definitions end with _MAX
-* generate local CNAME responses
-* remove irrelevant functions from pubic rr.h API
-* unify argument order of functions returning a string in a user supplied buffer
-* add support for subtypes in static services
-* wrap avahi_server_add_record() via DBUS and in avahi-client [lathiat]
-* add service type database support to avahi-browse
-* add domain browsing to avahi-browse
-* always set source address for outgoing packets
-* add support for defining browsing domains with an option in avahi-daemon.onf
-* return an error when the user tries to register a service in a domain != .local, for now
-* introduce AVAHI_CLIENT_FAILURE
-* remove outgoing queries from queue if the browse object they were issued from is destroyed
-* pass *all* Bonjour conformance tests
-* fix python scripts
-* Expose AvahiSRecordBrowser over D-BUS and implement in avahi-client
-* avahi-publish-* rewrites in C, update man pages
-* Add static host configuration like static services [lathiat]
diff --git a/trunk/docs/avahi-poll.dia b/trunk/docs/avahi-poll.dia
deleted file mode 100644
index eae82e2..0000000
--- a/trunk/docs/avahi-poll.dia
+++ /dev/null
@@ -1,1042 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
- <dia:diagramdata>
- <dia:attribute name="background">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="pagebreak">
- <dia:color val="#000099"/>
- </dia:attribute>
- <dia:attribute name="paper">
- <dia:composite type="paper">
- <dia:attribute name="name">
- <dia:string>#A4#</dia:string>
- </dia:attribute>
- <dia:attribute name="tmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="bmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="lmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="rmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="is_portrait">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="scaling">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="fitto">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="grid">
- <dia:composite type="grid">
- <dia:attribute name="width_x">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="width_y">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_x">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_y">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:composite type="color"/>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#d8e5e5"/>
- </dia:attribute>
- <dia:attribute name="guides">
- <dia:composite type="guides">
- <dia:attribute name="hguides"/>
- <dia:attribute name="vguides"/>
- </dia:composite>
- </dia:attribute>
- </dia:diagramdata>
- <dia:layer name="Background" visible="true">
- <dia:object type="Geometric - Perfect Square" version="0" id="O0">
- <dia:attribute name="obj_pos">
- <dia:point val="33,10.783"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="32.95,10.733;46.05,24.2663"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="33,10.783"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="12.999996185288101"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="13.433329391464369"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:group>
- <dia:object type="Standard - Ellipse" version="0" id="O1">
- <dia:attribute name="obj_pos">
- <dia:point val="17,13"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,12.95;26.05,22.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,13"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="9"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="9"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O2">
- <dia:attribute name="obj_pos">
- <dia:point val="21.5,16.4156"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.9,15.8156;23.1,19.1656"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#A
-main loop
-of
-some kind#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="21.5,16.4156"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O3">
- <dia:attribute name="obj_pos">
- <dia:point val="14,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="13.95,15.95;17.05,19.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="14,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O4">
- <dia:attribute name="obj_pos">
- <dia:point val="14.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="14.1164,17.075;16.8164,18.025"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="14.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O5">
- <dia:attribute name="obj_pos">
- <dia:point val="20,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,9.95;23.05,13.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,10"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O6">
- <dia:attribute name="obj_pos">
- <dia:point val="20.1164,11.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.1164,11.075;22.8164,12.025"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="20.1164,11.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O7">
- <dia:attribute name="obj_pos">
- <dia:point val="26,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="25.95,15.95;29.05,19.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="26,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O8">
- <dia:attribute name="obj_pos">
- <dia:point val="26.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.1164,17.075;28.8164,18.025"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26.1164,17.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O9">
- <dia:attribute name="obj_pos">
- <dia:point val="33,14"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="32.95,13.95;39.8242,21.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="33,14"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.7741787962376261"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="6.9999847561122124"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O10">
- <dia:attribute name="obj_pos">
- <dia:point val="33.5371,17.625"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="33.5371,17.025;39.2371,17.975"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiDBusAdapter#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="33.5371,17.625"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O11">
- <dia:attribute name="obj_pos">
- <dia:point val="29,17.55"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.9494,16.9994;33.0562,18.5751"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="29,17.55"/>
- <dia:point val="33,17.5"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O12">
- <dia:attribute name="obj_pos">
- <dia:point val="33,17.5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.9437,16.4749;33.0506,18.0506"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="33,17.5"/>
- <dia:point val="29,17.55"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O13">
- <dia:attribute name="obj_pos">
- <dia:point val="9.93231,17.5817"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.88192,17.0496;14.0539,18.6159"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="9.93231,17.5817"/>
- <dia:point val="14,17.55"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O14">
- <dia:attribute name="obj_pos">
- <dia:point val="14,17.55"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.87841,16.5158;14.0504,18.0821"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="14,17.55"/>
- <dia:point val="9.93231,17.5817"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O15">
- <dia:attribute name="obj_pos">
- <dia:point val="3,14"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="2.95,13.95;9.98231,21.2134"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="3,14"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.9323076131373904"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="7.1633845335753028"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O16">
- <dia:attribute name="obj_pos">
- <dia:point val="6.45678,17.3067"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="4.53178,16.7067;8.38178,18.4567"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Some other
-consumer#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="6.45678,17.3067"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O17">
- <dia:attribute name="obj_pos">
- <dia:point val="18.0795,-1"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.0295,-1.05;24.9028,6.04903"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="18.0795,-1"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.7732533131615504"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="6.9990284236002678"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O18">
- <dia:attribute name="obj_pos">
- <dia:point val="21.4568,2.30669"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.5318,1.70669;23.3818,3.45669"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Some other
-consumer#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="21.4568,2.30669"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O19">
- <dia:attribute name="obj_pos">
- <dia:point val="21.4662,5.99903"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.433,5.94861;22.0004,10.0542"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.4662,5.99903"/>
- <dia:point val="21.5,10"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="0.99999999999999922"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O20">
- <dia:attribute name="obj_pos">
- <dia:point val="21.5,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.9657,5.9448;22.5331,10.0504"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.5,10"/>
- <dia:point val="21.4662,5.99903"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O21">
- <dia:attribute name="obj_pos">
- <dia:point val="20,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,21.95;23.05,25.15"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,22"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.9999923703726461"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="3.0999921160517343"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O22">
- <dia:attribute name="obj_pos">
- <dia:point val="20.1164,23.675"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.1164,23.0562;22.8352,24.0625"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="20.1164,23.675"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Geometric - Perfect Square" version="0" id="O23">
- <dia:attribute name="obj_pos">
- <dia:point val="18,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.95,28.95;24.9532,36.1833"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="18,29"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6.903225806451613"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="7.1333333333333329"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O24">
- <dia:attribute name="obj_pos">
- <dia:point val="19.6516,32.6823"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.6516,32.0635;23.2704,33.0698"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiServer#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="19.6516,32.6823"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:group>
- <dia:object type="Standard - Arc" version="0" id="O25">
- <dia:attribute name="obj_pos">
- <dia:point val="21.5,25.1"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.4257,25.0494;21.9522,29.0562"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.5,25.1"/>
- <dia:point val="21.4516,29"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="0.99999999999999922"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O26">
- <dia:attribute name="obj_pos">
- <dia:point val="21.4516,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.9994,25.0438;22.5259,29.0506"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.4516,29"/>
- <dia:point val="21.5,25.1"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="0.99999999999999833"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- </dia:object>
- </dia:group>
- <dia:object type="Standard - Text" version="0" id="O27">
- <dia:attribute name="obj_pos">
- <dia:point val="6,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="6,5.38125;14.0188,10.3875"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#If you chose
-GMainLoop as main event
-loop, you can use
-AvahiGLibPoll as
-implementation for
-AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="6,6"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O28">
- <dia:attribute name="obj_pos">
- <dia:point val="39,2"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="33.2,1.38125;39.0188,7.9875"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#If you don't have
-a main loop yet
-you can choose
-AvahiSimplePoll
-as implementation
-for the main loop.
-It provides
-*one* AvahiPoll#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="39,2"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="2"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O29">
- <dia:attribute name="obj_pos">
- <dia:point val="41,17.6153"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="41,16.9965;44.3687,18.0028"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#AvahiClient#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="41,17.6153"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- </dia:layer>
-</dia:diagram>
diff --git a/trunk/docs/overview.dia b/trunk/docs/overview.dia
deleted file mode 100644
index 744f04c..0000000
--- a/trunk/docs/overview.dia
+++ /dev/null
@@ -1,1495 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
- <dia:diagramdata>
- <dia:attribute name="background">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="pagebreak">
- <dia:color val="#000099"/>
- </dia:attribute>
- <dia:attribute name="paper">
- <dia:composite type="paper">
- <dia:attribute name="name">
- <dia:string>#A4#</dia:string>
- </dia:attribute>
- <dia:attribute name="tmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="bmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="lmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="rmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="is_portrait">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="scaling">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="fitto">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="grid">
- <dia:composite type="grid">
- <dia:attribute name="width_x">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="width_y">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_x">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_y">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:composite type="color"/>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#d8e5e5"/>
- </dia:attribute>
- <dia:attribute name="guides">
- <dia:composite type="guides">
- <dia:attribute name="hguides"/>
- <dia:attribute name="vguides"/>
- </dia:composite>
- </dia:attribute>
- </dia:diagramdata>
- <dia:layer name="Background" visible="true">
- <dia:object type="Flowchart - Box" version="0" id="O0">
- <dia:attribute name="obj_pos">
- <dia:point val="20,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,5.95;33.05,7.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,6"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="13"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#libavahi-core#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26.5,7.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O1">
- <dia:attribute name="obj_pos">
- <dia:point val="10,12"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,11.95;29.05,16.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,12"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="19"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="4"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-daemon#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="19.5,14.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O2">
- <dia:attribute name="obj_pos">
- <dia:point val="10,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,15.95;16.05,18.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#DBUS protocol#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="13,17.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O3">
- <dia:attribute name="obj_pos">
- <dia:point val="16,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="15.95,15.95;23.05,18.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="16,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#simple protocol#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="19.5,17.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O4">
- <dia:attribute name="obj_pos">
- <dia:point val="21,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="20.95,21.95;26.05,23.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="21,22"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="5"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#nss-mdns#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="23.5,23.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O5">
- <dia:attribute name="obj_pos">
- <dia:point val="27,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.95,21.95;32.9,23.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="27,22"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="5.8499999999999996"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-dnsconfd#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="29.925,23.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O6">
- <dia:attribute name="obj_pos">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,19.95;16.05,22.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#DBUS#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="13,21.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O7">
- <dia:attribute name="obj_pos">
- <dia:point val="6,24"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="5.95,23.95;12.05,26.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="6,24"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#libavahi-client#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="9,25.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O8">
- <dia:attribute name="obj_pos">
- <dia:point val="10,2"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="9.95,1.95;23.05,3.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="10,2"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="13"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#libavahi-common#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="16.5,3.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O9">
- <dia:attribute name="obj_pos">
- <dia:point val="-5,28"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="-5.05,27.95;6.9,29.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="-5,28"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="11.85"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#C based tools: nautilus, rhythmbox, ...#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="0.925,29.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O10">
- <dia:attribute name="obj_pos">
- <dia:point val="16.5,3.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="14.2507,3.84057;16.5594,12.1545"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="16.5,3.9"/>
- <dia:point val="14.75,12"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O8" connection="13"/>
- <dia:connection handle="1" to="O1" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O11">
- <dia:attribute name="obj_pos">
- <dia:point val="23.25,7.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="23.1896,7.83958;24.7476,12.1671"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="23.25,7.9"/>
- <dia:point val="24.25,12"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O0" connection="12"/>
- <dia:connection handle="1" to="O1" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O12">
- <dia:attribute name="obj_pos">
- <dia:point val="13,18"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="12.5,17.95;13.5,20.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="13,18"/>
- <dia:point val="13,20"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O2" connection="13"/>
- <dia:connection handle="1" to="O6" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O13">
- <dia:attribute name="obj_pos">
- <dia:point val="13,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="10.1486,21.9297;13.0703,24.4217"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="13,22"/>
- <dia:point val="10.5,24"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O6" connection="13"/>
- <dia:connection handle="1" to="O7" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O14">
- <dia:attribute name="obj_pos">
- <dia:point val="17.75,18"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.6804,17.9304;23.8266,22.439"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="17.75,18"/>
- <dia:point val="23.5,22"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="12"/>
- <dia:connection handle="1" to="O4" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O15">
- <dia:attribute name="obj_pos">
- <dia:point val="21.25,18"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="21.1837,17.9337;30.1798,22.475"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="21.25,18"/>
- <dia:point val="29.925,22"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="14"/>
- <dia:connection handle="1" to="O5" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O16">
- <dia:attribute name="obj_pos">
- <dia:point val="6,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="0.69516,25.9351;6.06485,28.4835"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="6,26"/>
- <dia:point val="0.925,28"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="11"/>
- <dia:connection handle="1" to="O9" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O17">
- <dia:attribute name="obj_pos">
- <dia:point val="23,3.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="22.7476,3.84444;23.7524,6.10876"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="23,3.9"/>
- <dia:point val="23.25,6"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O8" connection="15"/>
- <dia:connection handle="1" to="O0" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O18">
- <dia:attribute name="obj_pos">
- <dia:point val="23,16"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="22.95,15.95;29.05,18.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="23,16"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="6"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#static services#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26,17.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O19">
- <dia:attribute name="obj_pos">
- <dia:point val="13.25,3.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="6.09937,3.83818;13.3118,24.1856"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="13.25,3.9"/>
- <dia:point val="7.5,24"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="3.7332171462404484"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O8" connection="12"/>
- <dia:connection handle="1" to="O7" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O20">
- <dia:attribute name="obj_pos">
- <dia:point val="17,25"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,24.95;35.05,27.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,25"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="18"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Python/other PL based tools#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="26,26.15"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O21">
- <dia:attribute name="obj_pos">
- <dia:point val="14.5,22"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="14.4343,21.9343;21.7429,25.4793"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="14.5,22"/>
- <dia:point val="21.5,25"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O6" connection="14"/>
- <dia:connection handle="1" to="O20" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O22">
- <dia:attribute name="obj_pos">
- <dia:point val="7.5,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="7.43774,25.9377;9.49328,31.1916"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="7.5,26"/>
- <dia:point val="9,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="12"/>
- <dia:connection handle="1" to="O23" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O23">
- <dia:attribute name="obj_pos">
- <dia:point val="3,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="2.95,30.95;11.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="3,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="8"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-compat-libdns_sd#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="7,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O24">
- <dia:attribute name="obj_pos">
- <dia:point val="12,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="11.95,30.95;19.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="12,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-compat-howl#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="15.5,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O25">
- <dia:attribute name="obj_pos">
- <dia:point val="9,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="8.92988,25.9299;15.8445,31.4268"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="9,26"/>
- <dia:point val="15.5,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="13"/>
- <dia:connection handle="1" to="O24" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O26">
- <dia:attribute name="obj_pos">
- <dia:point val="29,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.95,30.95;40.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="29,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="11"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#kdnssd-avahi#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="34.5,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O27">
- <dia:attribute name="obj_pos">
- <dia:point val="12,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="11.9403,25.9403;34.6573,31.4989"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="12,26"/>
- <dia:point val="34.5,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="15"/>
- <dia:connection handle="1" to="O26" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O28">
- <dia:attribute name="obj_pos">
- <dia:point val="3,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="2.95,33.95;11,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="3,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7.9499999999999993"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Legacy Bonjour Apps#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="6.975,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O29">
- <dia:attribute name="obj_pos">
- <dia:point val="12,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="11.95,33.95;19.05,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="12,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="7"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Legacy HOWL Apps#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="15.5,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O30">
- <dia:attribute name="obj_pos">
- <dia:point val="29,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28.95,33.95;40.05,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="29,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="11"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#KDE Applications using KDNSSD#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="34.5,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O31">
- <dia:attribute name="obj_pos">
- <dia:point val="7,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="6.47399,32.8489;7.47601,34.0613"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="7,32.9"/>
- <dia:point val="6.975,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O23" connection="13"/>
- <dia:connection handle="1" to="O28" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O32">
- <dia:attribute name="obj_pos">
- <dia:point val="15.5,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="15,32.85;16,34.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="15.5,32.9"/>
- <dia:point val="15.5,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O24" connection="13"/>
- <dia:connection handle="1" to="O29" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O33">
- <dia:attribute name="obj_pos">
- <dia:point val="34.5,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="34,32.85;35,34.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="34.5,32.9"/>
- <dia:point val="34.5,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O26" connection="13"/>
- <dia:connection handle="1" to="O30" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O34">
- <dia:attribute name="obj_pos">
- <dia:point val="20,31"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,30.95;28.05,32.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,31"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="8"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#avahi-sharp#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="24,32.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Flowchart - Box" version="0" id="O35">
- <dia:attribute name="obj_pos">
- <dia:point val="20,34"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="19.95,33.95;28.05,35.95"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="20,34"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="8"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1.9000000000000001"/>
- </dia:attribute>
- <dia:attribute name="inner_color">
- <dia:color val="#e5e5e5"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="padding">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Mono/C# based Apps#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="24,35.1"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="1"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O36">
- <dia:attribute name="obj_pos">
- <dia:point val="10.5,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="10.4357,25.9357;24.2205,31.4862"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="10.5,26"/>
- <dia:point val="24,31"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O7" connection="14"/>
- <dia:connection handle="1" to="O34" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O37">
- <dia:attribute name="obj_pos">
- <dia:point val="24,32.9"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="23.5,32.85;24.5,34.05"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="24,32.9"/>
- <dia:point val="24,34"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O34" connection="13"/>
- <dia:connection handle="1" to="O35" connection="2"/>
- </dia:connections>
- </dia:object>
- </dia:layer>
-</dia:diagram>
diff --git a/trunk/docs/server-states.dia b/trunk/docs/server-states.dia
deleted file mode 100644
index 35fe437..0000000
--- a/trunk/docs/server-states.dia
+++ /dev/null
@@ -1,975 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dia:diagram xmlns:dia="http://www.lysator.liu.se/~alla/dia/">
- <dia:diagramdata>
- <dia:attribute name="background">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="pagebreak">
- <dia:color val="#000099"/>
- </dia:attribute>
- <dia:attribute name="paper">
- <dia:composite type="paper">
- <dia:attribute name="name">
- <dia:string>#A4#</dia:string>
- </dia:attribute>
- <dia:attribute name="tmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="bmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="lmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="rmargin">
- <dia:real val="2.8222000598907471"/>
- </dia:attribute>
- <dia:attribute name="is_portrait">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="scaling">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="fitto">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="grid">
- <dia:composite type="grid">
- <dia:attribute name="width_x">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="width_y">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_x">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="visible_y">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:composite type="color"/>
- </dia:composite>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#d8e5e5"/>
- </dia:attribute>
- <dia:attribute name="guides">
- <dia:composite type="guides">
- <dia:attribute name="hguides"/>
- <dia:attribute name="vguides"/>
- </dia:composite>
- </dia:attribute>
- </dia:diagramdata>
- <dia:layer name="Background" visible="true">
- <dia:object type="Geometric - Perfect Circle" version="0" id="O0">
- <dia:attribute name="obj_pos">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,3.95;19.05,6.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O1">
- <dia:attribute name="obj_pos">
- <dia:point val="25,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="24.95,4.95;27.05,7.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="25,5"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O2">
- <dia:attribute name="obj_pos">
- <dia:point val="42,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="41.95,9.95;44.05,12.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="42,10"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O3">
- <dia:attribute name="obj_pos">
- <dia:point val="17,19"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,18.95;19.05,21.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,19"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Perfect Circle" version="0" id="O4">
- <dia:attribute name="obj_pos">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="35.95,25.95;38.05,28.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="2.0000305175199173"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="2.0000305175199173"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#ffffff"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="false"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O5">
- <dia:attribute name="obj_pos">
- <dia:point val="19,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.9425,4.94246;25.1315,6.50142"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="19,5"/>
- <dia:point val="25,6"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O0" connection="3"/>
- <dia:connection handle="1" to="O1" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O6">
- <dia:attribute name="obj_pos">
- <dia:point val="42,11"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.7712,10.9352;42.0648,20.4838"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="42,11"/>
- <dia:point val="19,20"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O2" connection="2"/>
- <dia:connection handle="1" to="O3" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O7">
- <dia:attribute name="obj_pos">
- <dia:point val="18,19"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.9307,6.68105;26.4438,19.0693"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="18,19"/>
- <dia:point val="26,7"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="1"/>
- <dia:connection handle="1" to="O1" connection="0"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O8">
- <dia:attribute name="obj_pos">
- <dia:point val="26,7"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.5562,6.93066;26.0693,19.319"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="26,7"/>
- <dia:point val="18,19"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O1" connection="0"/>
- <dia:connection handle="1" to="O3" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O9">
- <dia:attribute name="obj_pos">
- <dia:point val="18,21"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.9368,20.9368;36.2055,27.4902"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="18,21"/>
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O3" connection="0"/>
- <dia:connection handle="1" to="O4" connection="2"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O10">
- <dia:attribute name="obj_pos">
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="17.7945,20.5098;36.0632,27.0632"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="36,27"/>
- <dia:point val="18,21"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O4" connection="2"/>
- <dia:connection handle="1" to="O3" connection="0"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O11">
- <dia:attribute name="obj_pos">
- <dia:point val="38,27"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="37.9368,11.7945;43.4902,27.0632"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="38,27"/>
- <dia:point val="43,12"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O4" connection="3"/>
- <dia:connection handle="1" to="O2" connection="0"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O12">
- <dia:attribute name="obj_pos">
- <dia:point val="43,12"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="37.5098,11.9368;43.0632,27.2055"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="43,12"/>
- <dia:point val="38,27"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O2" connection="0"/>
- <dia:connection handle="1" to="O4" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O13">
- <dia:attribute name="obj_pos">
- <dia:point val="37,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.5304,5.73167;37.0671,26.0671"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="37,26"/>
- <dia:point val="27,6"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O4" connection="1"/>
- <dia:connection handle="1" to="O1" connection="3"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O14">
- <dia:attribute name="obj_pos">
- <dia:point val="27,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="26.9329,5.93292;37.4696,26.2683"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="27,6"/>
- <dia:point val="37,26"/>
- </dia:attribute>
- <dia:attribute name="arc_color">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O1" connection="3"/>
- <dia:connection handle="1" to="O4" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Arc" version="0" id="O15">
- <dia:attribute name="obj_pos">
- <dia:point val="26,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="25.9379,4.32084;43.1891,10.4938"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="26,5"/>
- <dia:point val="43,10"/>
- </dia:attribute>
- <dia:attribute name="curve_distance">
- <dia:real val="-2.5575097323624019"/>
- </dia:attribute>
- <dia:attribute name="end_arrow">
- <dia:enum val="22"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_length">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:attribute name="end_arrow_width">
- <dia:real val="0.5"/>
- </dia:attribute>
- <dia:connections>
- <dia:connection handle="0" to="O1" connection="1"/>
- <dia:connection handle="1" to="O2" connection="1"/>
- </dia:connections>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O16">
- <dia:attribute name="obj_pos">
- <dia:point val="12,4"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="12,3.4;16.9,4.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_INVALID#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="12,4"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O17">
- <dia:attribute name="obj_pos">
- <dia:point val="28,6"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="28,5.4;34.65,6.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_REGISTERING#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="28,6"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O18">
- <dia:attribute name="obj_pos">
- <dia:point val="45,10"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="45,9.4;50.45,10.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_RUNNING#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="45,10"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O19">
- <dia:attribute name="obj_pos">
- <dia:point val="39,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="39,28.4;46.1,29.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#CLIENT_DISCONNECTED#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="39,29"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O20">
- <dia:attribute name="obj_pos">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="10,19.4;15.7,20.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#SERVER_COLLISION#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="10,20"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O21">
- <dia:attribute name="obj_pos">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,3.95;18.0707,5.07071"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,4"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O22">
- <dia:attribute name="obj_pos">
- <dia:point val="17,5"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="16.95,4.92929;18.0707,6.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="17,5"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#000000"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="true"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Line" version="0" id="O23">
- <dia:attribute name="obj_pos">
- <dia:point val="19,28"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18.9329,13.9329;47.0671,28.0671"/>
- </dia:attribute>
- <dia:attribute name="conn_endpoints">
- <dia:point val="19,28"/>
- <dia:point val="47,14"/>
- </dia:attribute>
- <dia:attribute name="numcp">
- <dia:int val="1"/>
- </dia:attribute>
- <dia:attribute name="line_color">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="4"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O24">
- <dia:attribute name="obj_pos">
- <dia:point val="21,29"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="21,28.4;24.25,29.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Client side#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="21,29"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Standard - Text" version="0" id="O25">
- <dia:attribute name="obj_pos">
- <dia:point val="18,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="18,25.4;21.5,26.35"/>
- </dia:attribute>
- <dia:attribute name="text">
- <dia:composite type="text">
- <dia:attribute name="string">
- <dia:string>#Server side#</dia:string>
- </dia:attribute>
- <dia:attribute name="font">
- <dia:font family="sans" style="0" name="Helvetica"/>
- </dia:attribute>
- <dia:attribute name="height">
- <dia:real val="0.80000000000000004"/>
- </dia:attribute>
- <dia:attribute name="pos">
- <dia:point val="18,26"/>
- </dia:attribute>
- <dia:attribute name="color">
- <dia:color val="#bfbfbf"/>
- </dia:attribute>
- <dia:attribute name="alignment">
- <dia:enum val="0"/>
- </dia:attribute>
- </dia:composite>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O26">
- <dia:attribute name="obj_pos">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="35.95,25.95;37.0707,27.0707"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="36,26"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="false"/>
- </dia:attribute>
- </dia:object>
- <dia:object type="Geometric - Quarter Circle" version="0" id="O27">
- <dia:attribute name="obj_pos">
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="obj_bb">
- <dia:rectangle val="35.95,26.9293;37.0707,28.05"/>
- </dia:attribute>
- <dia:attribute name="elem_corner">
- <dia:point val="36,27"/>
- </dia:attribute>
- <dia:attribute name="elem_width">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="elem_height">
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="line_width">
- <dia:real val="0.10000000000000001"/>
- </dia:attribute>
- <dia:attribute name="line_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="fill_colour">
- <dia:color val="#7f7f7f"/>
- </dia:attribute>
- <dia:attribute name="show_background">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="line_style">
- <dia:enum val="0"/>
- <dia:real val="1"/>
- </dia:attribute>
- <dia:attribute name="flip_horizontal">
- <dia:boolean val="true"/>
- </dia:attribute>
- <dia:attribute name="flip_vertical">
- <dia:boolean val="true"/>
- </dia:attribute>
- </dia:object>
- </dia:layer>
-</dia:diagram>
diff --git a/trunk/doxygen.cfg b/trunk/doxygen.cfg
deleted file mode 100644
index 5c03609..0000000
--- a/trunk/doxygen.cfg
+++ /dev/null
@@ -1,213 +0,0 @@
-# Doxyfile 1.3.7
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-PROJECT_NAME = $(PROJECT)
-PROJECT_NUMBER = $(VERSION)
-OUTPUT_DIRECTORY = $(DOCDIR)
-CREATE_SUBDIRS = NO
-OUTPUT_LANGUAGE = English
-USE_WINDOWS_ENCODING = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = YES
-ABBREVIATE_BRIEF =
-ALWAYS_DETAILED_SEC = NO
-INLINE_INHERITED_MEMB = NO
-STRIP_FROM_INC_PATH = $(SRCDIR)
-FULL_PATH_NAMES = YES
-STRIP_FROM_PATH = $(SRCDIR)
-SHORT_NAMES = NO
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = YES
-INHERIT_DOCS = YES
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 4
-ALIASES =
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = NO
-SUBGROUPING = YES
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = NO
-EXTRACT_STATIC = NO
-EXTRACT_LOCAL_CLASSES = YES
-EXTRACT_LOCAL_METHODS = NO
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
-HIDE_FRIEND_COMPOUNDS = NO
-HIDE_IN_BODY_DOCS = NO
-INTERNAL_DOCS = NO
-CASE_SENSE_NAMES = NO
-HIDE_SCOPE_NAMES = NO
-SHOW_INCLUDE_FILES = YES
-INLINE_INFO = YES
-SORT_MEMBER_DOCS = YES
-SORT_BRIEF_DOCS = NO
-SORT_BY_SCOPE_NAME = NO
-GENERATE_TODOLIST = YES
-GENERATE_TESTLIST = YES
-GENERATE_BUGLIST = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS =
-MAX_INITIALIZER_LINES = 30
-SHOW_USED_FILES = YES
-SHOW_DIRECTORIES = NO
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET = NO
-WARNINGS = YES
-WARN_IF_UNDOCUMENTED = YES
-WARN_IF_DOC_ERROR = YES
-WARN_FORMAT = "$file:$line: $text"
-WARN_LOGFILE =
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT = $(INPUT)
-FILE_PATTERNS =
-RECURSIVE = NO
-EXCLUDE =
-EXCLUDE_SYMLINKS = NO
-EXCLUDE_PATTERNS =
-EXAMPLE_PATH = $(EXAMPLE_PATH)
-EXAMPLE_PATTERNS = $(EXAMPLE_PATTERNS)
-EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
-INPUT_FILTER =
-FILTER_SOURCE_FILES = NO
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER = YES
-INLINE_SOURCES = NO
-STRIP_CODE_COMMENTS = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION = YES
-VERBATIM_HEADERS = YES
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX = YES
-COLS_IN_ALPHA_INDEX = 5
-IGNORE_PREFIX = Avahi AVAHI_ avahi_
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML = $(GENERATE_HTML)
-HTML_OUTPUT = html
-HTML_FILE_EXTENSION = .html
-HTML_HEADER =
-HTML_FOOTER =
-HTML_STYLESHEET =
-HTML_ALIGN_MEMBERS = YES
-GENERATE_HTMLHELP = $(GENERATE_CHM)
-CHM_FILE = ../$(PROJECT).chm
-HHC_LOCATION = $(HHC_PATH)
-GENERATE_CHI = $(GENERATE_CHI)
-BINARY_TOC = NO
-TOC_EXPAND = NO
-DISABLE_INDEX = NO
-ENUM_VALUES_PER_LINE = 1
-GENERATE_TREEVIEW = YES
-TREEVIEW_WIDTH = 250
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX = $(GENERATE_LATEX)
-LATEX_OUTPUT = latex
-LATEX_CMD_NAME = latex
-MAKEINDEX_CMD_NAME = makeindex
-COMPACT_LATEX = NO
-PAPER_TYPE = $(PAPER_SIZE)
-EXTRA_PACKAGES =
-LATEX_HEADER =
-PDF_HYPERLINKS = NO
-USE_PDFLATEX = NO
-LATEX_BATCHMODE = YES
-LATEX_HIDE_INDICES = NO
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF = $(GENERATE_RTF)
-RTF_OUTPUT = rtf
-COMPACT_RTF = NO
-RTF_HYPERLINKS = NO
-RTF_STYLESHEET_FILE =
-RTF_EXTENSIONS_FILE =
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN = $(GENERATE_MAN)
-MAN_OUTPUT = man
-MAN_EXTENSION = .1
-MAN_LINKS = NO
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML = $(GENERATE_XML)
-XML_OUTPUT = xml
-XML_SCHEMA =
-XML_DTD =
-XML_PROGRAMLISTING = YES
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF = NO
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD = NO
-PERLMOD_LATEX = NO
-PERLMOD_PRETTY = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING = YES
-MACRO_EXPANSION = YES
-EXPAND_ONLY_PREDEF = YES
-SEARCH_INCLUDES = YES
-INCLUDE_PATH =
-INCLUDE_FILE_PATTERNS =
-PREDEFINED = "DOXYGEN_SHOULD_SKIP_THIS" "AVAHI_C_DECL_BEGIN=" "AVAHI_C_DECL_END="
-EXPAND_AS_DEFINED =
-SKIP_FUNCTION_MACROS = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-TAGFILES =
-GENERATE_TAGFILE = $(DOCDIR)/$(PROJECT).tag
-ALLEXTERNALS = NO
-EXTERNAL_GROUPS = YES
-PERL_PATH = $(PERL_PATH)
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS = NO
-HIDE_UNDOC_RELATIONS = NO
-HAVE_DOT = $(HAVE_DOT)
-CLASS_GRAPH = NO
-COLLABORATION_GRAPH = NO
-UML_LOOK = NO
-TEMPLATE_RELATIONS = NO
-INCLUDE_GRAPH = NO
-INCLUDED_BY_GRAPH = NO
-CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = NO
-DOT_IMAGE_FORMAT = png
-DOT_PATH = $(DOT_PATH)
-DOTFILE_DIRS =
-MAX_DOT_GRAPH_WIDTH = 1024
-MAX_DOT_GRAPH_HEIGHT = 1024
-MAX_DOT_GRAPH_DEPTH = 0
-GENERATE_LEGEND = YES
-DOT_CLEANUP = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-SEARCHENGINE = NO
diff --git a/trunk/examples/Makefile.am b/trunk/examples/Makefile.am
deleted file mode 100644
index e6e66f5..0000000
--- a/trunk/examples/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS=-I$(top_srcdir)
-
-if ENABLE_TESTS
-noinst_PROGRAMS = \
- core-publish-service \
- core-browse-services
-endif
-
-core_publish_service_SOURCES = core-publish-service.c
-core_publish_service_CFLAGS = $(AM_CFLAGS)
-core_publish_service_LDADD = $(AM_LDADD) ../avahi-core/libavahi-core.la ../avahi-common/libavahi-common.la
-
-core_browse_services_SOURCES = core-browse-services.c
-core_browse_services_CFLAGS = $(AM_CFLAGS)
-core_browse_services_LDADD = $(AM_LDADD) ../avahi-core/libavahi-core.la ../avahi-common/libavahi-common.la
-
-if HAVE_DBUS
-if ENABLE_TESTS
-
-noinst_PROGRAMS += \
- client-publish-service \
- client-browse-services
-endif
-
-client_publish_service_SOURCES = client-publish-service.c
-client_publish_service_CFLAGS = $(AM_CFLAGS)
-client_publish_service_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-client_browse_services_SOURCES = client-browse-services.c
-client_browse_services_CFLAGS = $(AM_CFLAGS)
-client_browse_services_LDADD = $(AM_LDADD) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la
-
-if HAVE_GLIB
-
-if ENABLE_TESTS
-noinst_PROGRAMS += \
- glib-integration
-endif
-
-glib_integration_SOURCES = glib-integration.c
-glib_integration_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-glib_integration_LDADD = $(AM_LDADD) $(GLIB20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la ../avahi-glib/libavahi-glib.la
-
-endif
-
-endif
diff --git a/trunk/examples/client-browse-services.c b/trunk/examples/client-browse-services.c
deleted file mode 100644
index 37550ef..0000000
--- a/trunk/examples/client-browse-services.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-static AvahiSimplePoll *simple_poll = NULL;
-
-static void resolve_callback(
- AvahiServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *address,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- assert(r);
-
- /* Called whenever a service has been resolved successfully or timed out */
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
- fprintf(stderr, "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_client_errno(avahi_service_resolver_get_client(r))));
- break;
-
- case AVAHI_RESOLVER_FOUND: {
- char a[AVAHI_ADDRESS_STR_MAX], *t;
-
- fprintf(stderr, "Service '%s' of type '%s' in domain '%s':\n", name, type, domain);
-
- avahi_address_snprint(a, sizeof(a), address);
- t = avahi_string_list_to_string(txt);
- fprintf(stderr,
- "\t%s:%u (%s)\n"
- "\tTXT=%s\n"
- "\tcookie is %u\n"
- "\tis_local: %i\n"
- "\tour_own: %i\n"
- "\twide_area: %i\n"
- "\tmulticast: %i\n"
- "\tcached: %i\n",
- host_name, port, a,
- t,
- avahi_string_list_get_service_cookie(txt),
- !!(flags & AVAHI_LOOKUP_RESULT_LOCAL),
- !!(flags & AVAHI_LOOKUP_RESULT_OUR_OWN),
- !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA),
- !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST),
- !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
-
- avahi_free(t);
- }
- }
-
- avahi_service_resolver_free(r);
-}
-
-static void browse_callback(
- AvahiServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiClient *c = userdata;
- assert(b);
-
- /* Called whenever a new services becomes available on the LAN or is removed from the LAN */
-
- switch (event) {
- case AVAHI_BROWSER_FAILURE:
-
- fprintf(stderr, "(Browser) %s\n", avahi_strerror(avahi_client_errno(avahi_service_browser_get_client(b))));
- avahi_simple_poll_quit(simple_poll);
- return;
-
- case AVAHI_BROWSER_NEW:
- fprintf(stderr, "(Browser) NEW: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
-
- /* We ignore the returned resolver object. In the callback
- function we free it. If the server is terminated before
- the callback function is called the server will free
- the resolver for us. */
-
- if (!(avahi_service_resolver_new(c, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, resolve_callback, c)))
- fprintf(stderr, "Failed to resolve service '%s': %s\n", name, avahi_strerror(avahi_client_errno(c)));
-
- break;
-
- case AVAHI_BROWSER_REMOVE:
- fprintf(stderr, "(Browser) REMOVE: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- fprintf(stderr, "(Browser) %s\n", event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW");
- break;
- }
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- assert(c);
-
- /* Called whenever the client or server state changes */
-
- if (state == AVAHI_CLIENT_FAILURE) {
- fprintf(stderr, "Server connection failre: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiClient *client = NULL;
- AvahiServiceBrowser *sb = NULL;
- int error;
- int ret = 1;
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- /* Allocate a new client */
- client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error);
-
- /* Check wether creating the client object succeeded */
- if (!client) {
- fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* Create the service browser */
- if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, browse_callback, client))) {
- fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client)));
- goto fail;
- }
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
- if (sb)
- avahi_service_browser_free(sb);
-
- if (client)
- avahi_client_free(client);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return ret;
-}
diff --git a/trunk/examples/client-publish-service.c b/trunk/examples/client-publish-service.c
deleted file mode 100644
index 94dcd1e..0000000
--- a/trunk/examples/client-publish-service.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-client/client.h>
-#include <avahi-client/publish.h>
-
-#include <avahi-common/alternative.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-#include <avahi-common/timeval.h>
-
-static AvahiEntryGroup *group = NULL;
-static AvahiSimplePoll *simple_poll = NULL;
-static char *name = NULL;
-
-static void create_services(AvahiClient *c);
-
-static void entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) {
- assert(g == group || group == NULL);
-
- /* Called whenever the entry group state changes */
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED :
- /* The entry group has been established successfully */
- fprintf(stderr, "Service '%s' successfully established.\n", name);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION : {
- char *n;
-
- /* A service name collision happened. Let's pick a new name */
- n = avahi_alternative_service_name(name);
- avahi_free(name);
- name = n;
-
- fprintf(stderr, "Service name collision, renaming service to '%s'\n", name);
-
- /* And recreate the services */
- create_services(avahi_entry_group_get_client(g));
- break;
- }
-
- case AVAHI_ENTRY_GROUP_FAILURE :
-
- fprintf(stderr, "Entry group failure: %s\n", avahi_strerror(avahi_client_errno(avahi_entry_group_get_client(g))));
-
- /* Some kind of failure happened while we were registering our services */
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void create_services(AvahiClient *c) {
- char r[128];
- int ret;
- assert(c);
-
- /* If this is the first time we're called, let's create a new entry group */
- if (!group)
- if (!(group = avahi_entry_group_new(c, entry_group_callback, NULL))) {
- fprintf(stderr, "avahi_entry_group_new() failed: %s\n", avahi_strerror(avahi_client_errno(c)));
- goto fail;
- }
-
- fprintf(stderr, "Adding service '%s'\n", name);
-
- /* Create some random TXT data */
- snprintf(r, sizeof(r), "random=%i", rand());
-
- /* Add the service for IPP */
- if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
- fprintf(stderr, "Failed to add _ipp._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add the same service for BSD LPR */
- if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
- fprintf(stderr, "Failed to add _printer._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add an additional (hypothetic) subtype */
- if ((ret = avahi_entry_group_add_service_subtype(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, "_magic._sub._printer._tcp") < 0)) {
- fprintf(stderr, "Failed to add subtype _magic._sub._printer._tcp: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Tell the server to register the service */
- if ((ret = avahi_entry_group_commit(group)) < 0) {
- fprintf(stderr, "Failed to commit entry_group: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- return;
-
-fail:
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
- assert(c);
-
- /* Called whenever the client or server state changes */
-
- switch (state) {
- case AVAHI_CLIENT_S_RUNNING:
-
- /* The server has startup successfully and registered its host
- * name on the network, so it's time to create our services */
- if (!group)
- create_services(c);
- break;
-
- case AVAHI_CLIENT_FAILURE:
-
- fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c)));
- avahi_simple_poll_quit(simple_poll);
-
- break;
-
- case AVAHI_CLIENT_S_COLLISION:
-
- /* Let's drop our registered services. When the server is back
- * in AVAHI_SERVER_RUNNING state we will register them
- * again with the new host name. */
-
- case AVAHI_CLIENT_S_REGISTERING:
-
- /* The server records are now being established. This
- * might be caused by a host name change. We need to wait
- * for our own records to register until the host name is
- * properly esatblished. */
-
- if (group)
- avahi_entry_group_reset(group);
-
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- ;
- }
-}
-
-static void modify_callback(AVAHI_GCC_UNUSED AvahiTimeout *e, void *userdata) {
- AvahiClient *client = userdata;
-
- fprintf(stderr, "Doing some weird modification\n");
-
- avahi_free(name);
- name = avahi_strdup("Modified MegaPrinter");
-
- /* If the server is currently running, we need to remove our
- * service and create it anew */
- if (avahi_client_get_state(client) == AVAHI_CLIENT_S_RUNNING) {
-
- /* Remove the old services */
- if (group)
- avahi_entry_group_reset(group);
-
- /* And create them again with the new name */
- create_services(client);
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiClient *client = NULL;
- int error;
- int ret = 1;
- struct timeval tv;
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- name = avahi_strdup("MegaPrinter");
-
- /* Allocate a new client */
- client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0, client_callback, NULL, &error);
-
- /* Check wether creating the client object succeeded */
- if (!client) {
- fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* After 20s do some weird modification to the service */
- avahi_simple_poll_get(simple_poll)->timeout_new(
- avahi_simple_poll_get(simple_poll),
- avahi_elapse_time(&tv, 1000*10, 0),
- modify_callback,
- client);
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
-
- if (client)
- avahi_client_free(client);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(name);
-
- return ret;
-}
diff --git a/trunk/examples/core-browse-services.c b/trunk/examples/core-browse-services.c
deleted file mode 100644
index 53b18ee..0000000
--- a/trunk/examples/core-browse-services.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* $Id$ */
-
-/* PLEASE NOTE *
- * This file demonstrates how to use Avahi's core API, this is
- * the embeddable mDNS stack for embedded applications.
- *
- * End user applications should *not* use this API and should use
- * the D-Bus or C APIs, please see
- * client-browse-services.c and glib-integration.c
- *
- * I repeat, you probably do *not* want to use this example.
- */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <time.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/lookup.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/error.h>
-
-static AvahiSimplePoll *simple_poll = NULL;
-static AvahiServer *server = NULL;
-
-static void resolve_callback(
- AvahiSServiceResolver *r,
- AVAHI_GCC_UNUSED AvahiIfIndex interface,
- AVAHI_GCC_UNUSED AvahiProtocol protocol,
- AvahiResolverEvent event,
- const char *name,
- const char *type,
- const char *domain,
- const char *host_name,
- const AvahiAddress *address,
- uint16_t port,
- AvahiStringList *txt,
- AvahiLookupResultFlags flags,
- AVAHI_GCC_UNUSED void* userdata) {
-
- assert(r);
-
- /* Called whenever a service has been resolved successfully or timed out */
-
- switch (event) {
- case AVAHI_RESOLVER_FAILURE:
- fprintf(stderr, "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, avahi_strerror(avahi_server_errno(server)));
- break;
-
- case AVAHI_RESOLVER_FOUND: {
- char a[AVAHI_ADDRESS_STR_MAX], *t;
-
- fprintf(stderr, "(Resolver) Service '%s' of type '%s' in domain '%s':\n", name, type, domain);
-
- avahi_address_snprint(a, sizeof(a), address);
- t = avahi_string_list_to_string(txt);
- fprintf(stderr,
- "\t%s:%u (%s)\n"
- "\tTXT=%s\n"
- "\tcookie is %u\n"
- "\tis_local: %i\n"
- "\twide_area: %i\n"
- "\tmulticast: %i\n"
- "\tcached: %i\n",
- host_name, port, a,
- t,
- avahi_string_list_get_service_cookie(txt),
- !!(flags & AVAHI_LOOKUP_RESULT_LOCAL),
- !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA),
- !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST),
- !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
- avahi_free(t);
- }
- }
-
- avahi_s_service_resolver_free(r);
-}
-
-static void browse_callback(
- AvahiSServiceBrowser *b,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiBrowserEvent event,
- const char *name,
- const char *type,
- const char *domain,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
- void* userdata) {
-
- AvahiServer *s = userdata;
- assert(b);
-
- /* Called whenever a new services becomes available on the LAN or is removed from the LAN */
-
- switch (event) {
-
- case AVAHI_BROWSER_FAILURE:
-
- fprintf(stderr, "(Browser) %s\n", avahi_strerror(avahi_server_errno(server)));
- avahi_simple_poll_quit(simple_poll);
- return;
-
- case AVAHI_BROWSER_NEW:
- fprintf(stderr, "(Browser) NEW: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
-
- /* We ignore the returned resolver object. In the callback
- function we free it. If the server is terminated before
- the callback function is called the server will free
- the resolver for us. */
-
- if (!(avahi_s_service_resolver_new(s, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, resolve_callback, s)))
- fprintf(stderr, "Failed to resolve service '%s': %s\n", name, avahi_strerror(avahi_server_errno(s)));
-
- break;
-
- case AVAHI_BROWSER_REMOVE:
- fprintf(stderr, "(Browser) REMOVE: service '%s' of type '%s' in domain '%s'\n", name, type, domain);
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- fprintf(stderr, "(Browser) %s\n", event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW");
- break;
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiServerConfig config;
- AvahiSServiceBrowser *sb = NULL;
- int error;
- int ret = 1;
-
- /* Initialize the psuedo-RNG */
- srand(time(NULL));
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- /* Do not publish any local records */
- avahi_server_config_init(&config);
- config.publish_hinfo = 0;
- config.publish_addresses = 0;
- config.publish_workstation = 0;
- config.publish_domain = 0;
-
- /* Set a unicast DNS server for wide area DNS-SD */
- avahi_address_parse("192.168.50.1", AVAHI_PROTO_UNSPEC, &config.wide_area_servers[0]);
- config.n_wide_area_servers = 1;
- config.enable_wide_area = 1;
-
- /* Allocate a new server */
- server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, NULL, NULL, &error);
-
- /* Free the configuration data */
- avahi_server_config_free(&config);
-
- /* Check wether creating the server object succeeded */
- if (!server) {
- fprintf(stderr, "Failed to create server: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* Create the service browser */
- if (!(sb = avahi_s_service_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_http._tcp", NULL, 0, browse_callback, server))) {
- fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_server_errno(server)));
- goto fail;
- }
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
- if (sb)
- avahi_s_service_browser_free(sb);
-
- if (server)
- avahi_server_free(server);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- return ret;
-}
diff --git a/trunk/examples/core-publish-service.c b/trunk/examples/core-publish-service.c
deleted file mode 100644
index 6370383..0000000
--- a/trunk/examples/core-publish-service.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include <avahi-core/core.h>
-#include <avahi-core/publish.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/error.h>
-
-static AvahiSEntryGroup *group = NULL;
-static AvahiSimplePoll *simple_poll = NULL;
-static char *name = NULL;
-
-static void create_services(AvahiServer *s);
-
-static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, AVAHI_GCC_UNUSED void *userdata) {
- assert(s);
- assert(g == group);
-
- /* Called whenever the entry group state changes */
-
- switch (state) {
-
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
-
- /* The entry group has been established successfully */
- fprintf(stderr, "Service '%s' successfully established.\n", name);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION: {
- char *n;
-
- /* A service name collision happened. Let's pick a new name */
- n = avahi_alternative_service_name(name);
- avahi_free(name);
- name = n;
-
- fprintf(stderr, "Service name collision, renaming service to '%s'\n", name);
-
- /* And recreate the services */
- create_services(s);
- break;
- }
-
- case AVAHI_ENTRY_GROUP_FAILURE :
-
- fprintf(stderr, "Entry group failure: %s\n", avahi_strerror(avahi_server_errno(s)));
-
- /* Some kind of failure happened while we were registering our services */
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void create_services(AvahiServer *s) {
- char r[128];
- int ret;
- assert(s);
-
- /* If this is the first time we're called, let's create a new entry group */
- if (!group)
- if (!(group = avahi_s_entry_group_new(s, entry_group_callback, NULL))) {
- fprintf(stderr, "avahi_entry_group_new() failed: %s\n", avahi_strerror(avahi_server_errno(s)));
- goto fail;
- }
-
- fprintf(stderr, "Adding service '%s'\n", name);
-
- /* Create some random TXT data */
- snprintf(r, sizeof(r), "random=%i", rand());
-
- /* Add the service for IPP */
- if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_ipp._tcp", NULL, NULL, 651, "test=blah", r, NULL)) < 0) {
- fprintf(stderr, "Failed to add _ipp._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add the same service for BSD LPR */
- if ((ret = avahi_server_add_service(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, NULL, 515, NULL)) < 0) {
- fprintf(stderr, "Failed to add _printer._tcp service: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Add an additional (hypothetic) subtype */
- if ((ret = avahi_server_add_service_subtype(s, group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, "_printer._tcp", NULL, "_magic._sub._printer._tcp") < 0)) {
- fprintf(stderr, "Failed to add subtype _magic._sub._printer._tcp: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- /* Tell the server to register the service */
- if ((ret = avahi_s_entry_group_commit(group)) < 0) {
- fprintf(stderr, "Failed to commit entry_group: %s\n", avahi_strerror(ret));
- goto fail;
- }
-
- return;
-
-fail:
- avahi_simple_poll_quit(simple_poll);
-}
-
-static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void * userdata) {
- assert(s);
-
- /* Called whenever the server state changes */
-
- switch (state) {
-
- case AVAHI_SERVER_RUNNING:
- /* The serve has startup successfully and registered its host
- * name on the network, so it's time to create our services */
-
- if (!group)
- create_services(s);
-
- break;
-
- case AVAHI_SERVER_COLLISION: {
- char *n;
- int r;
-
- /* A host name collision happened. Let's pick a new name for the server */
- n = avahi_alternative_host_name(avahi_server_get_host_name(s));
- fprintf(stderr, "Host name collision, retrying with '%s'\n", n);
- r = avahi_server_set_host_name(s, n);
- avahi_free(n);
-
- if (r < 0) {
- fprintf(stderr, "Failed to set new host name: %s\n", avahi_strerror(r));
-
- avahi_simple_poll_quit(simple_poll);
- return;
- }
-
- }
-
- /* Fall through */
-
- case AVAHI_SERVER_REGISTERING:
-
- /* Let's drop our registered services. When the server is back
- * in AVAHI_SERVER_RUNNING state we will register them
- * again with the new host name. */
- if (group)
- avahi_s_entry_group_reset(group);
-
- break;
-
- case AVAHI_SERVER_FAILURE:
-
- /* Terminate on failure */
-
- fprintf(stderr, "Server failure: %s\n", avahi_strerror(avahi_server_errno(s)));
- avahi_simple_poll_quit(simple_poll);
- break;
-
- case AVAHI_SERVER_INVALID:
- ;
- }
-}
-
-int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
- AvahiServerConfig config;
- AvahiServer *server = NULL;
- int error;
- int ret = 1;
-
- /* Initialize the pseudo-RNG */
- srand(time(NULL));
-
- /* Allocate main loop object */
- if (!(simple_poll = avahi_simple_poll_new())) {
- fprintf(stderr, "Failed to create simple poll object.\n");
- goto fail;
- }
-
- name = avahi_strdup("MegaPrinter");
-
- /* Let's set the host name for this server. */
- avahi_server_config_init(&config);
- config.host_name = avahi_strdup("gurkiman");
- config.publish_workstation = 0;
-
- /* Allocate a new server */
- server = avahi_server_new(avahi_simple_poll_get(simple_poll), &config, server_callback, NULL, &error);
-
- /* Free the configuration data */
- avahi_server_config_free(&config);
-
- /* Check wether creating the server object succeeded */
- if (!server) {
- fprintf(stderr, "Failed to create server: %s\n", avahi_strerror(error));
- goto fail;
- }
-
- /* Run the main loop */
- avahi_simple_poll_loop(simple_poll);
-
- ret = 0;
-
-fail:
-
- /* Cleanup things */
-
- if (server)
- avahi_server_free(server);
-
- if (simple_poll)
- avahi_simple_poll_free(simple_poll);
-
- avahi_free(name);
-
- return ret;
-}
diff --git a/trunk/examples/glib-integration.c b/trunk/examples/glib-integration.c
deleted file mode 100644
index ab53687..0000000
--- a/trunk/examples/glib-integration.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-
-#include <avahi-client/client.h>
-#include <avahi-common/error.h>
-#include <avahi-common/timeval.h>
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
-
-/* Callback for Avahi API Timeout Event */
-static void
-avahi_timeout_event (AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata)
-{
- g_message ("Avahi API Timeout reached!");
-}
-
-/* Callback for GLIB API Timeout Event */
-static gboolean
-avahi_timeout_event_glib (void *userdata)
-{
- GMainLoop *loop = userdata;
-
- g_message ("GLIB API Timeout reached, quitting main loop!");
-
- /* Quit the application */
- g_main_loop_quit (loop);
-
- return FALSE; /* Don't re-schedule timeout event */
-}
-
-/* Callback for state changes on the Client */
-static void
-avahi_client_callback (AVAHI_GCC_UNUSED AvahiClient *client, AvahiClientState state, void *userdata)
-{
- GMainLoop *loop = userdata;
-
- g_message ("Avahi Client State Change: %d", state);
-
- if (state == AVAHI_CLIENT_FAILURE)
- {
- /* We we're disconnected from the Daemon */
- g_message ("Disconnected from the Avahi Daemon: %s", avahi_strerror(avahi_client_errno(client)));
-
- /* Quit the application */
- g_main_loop_quit (loop);
- }
-}
-
-int
-main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[])
-{
- GMainLoop *loop = NULL;
- const AvahiPoll *poll_api;
- AvahiGLibPoll *glib_poll;
- AvahiClient *client;
- struct timeval tv;
- const char *version;
- int error;
-
- /* Optional: Tell avahi to use g_malloc and g_free */
- avahi_set_allocator (avahi_glib_allocator ());
-
- /* Create the GLIB main loop */
- loop = g_main_loop_new (NULL, FALSE);
-
- /* Create the GLIB Adaptor */
- glib_poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
- poll_api = avahi_glib_poll_get (glib_poll);
-
- /* Example, schedule a timeout event with the Avahi API */
- avahi_elapse_time (&tv, /* timeval structure */
- 1000, /* 1 second */
- 0); /* "jitter" - Random additional delay from 0 to this value */
-
- poll_api->timeout_new (poll_api, /* The AvahiPoll object */
- &tv, /* struct timeval indicating when to go activate */
- avahi_timeout_event, /* Pointer to function to call */
- NULL); /* User data to pass to function */
-
- /* Schedule a timeout event with the glib api */
- g_timeout_add (5000, /* 5 seconds */
- avahi_timeout_event_glib, /* Pointer to function callback */
- loop); /* User data to pass to function */
-
- /* Create a new AvahiClient instance */
- client = avahi_client_new (poll_api, /* AvahiPoll object from above */
- 0,
- avahi_client_callback, /* Callback function for Client state changes */
- loop, /* User data */
- &error); /* Error return */
-
- /* Check the error return code */
- if (client == NULL)
- {
- /* Print out the error string */
- g_warning ("Error initializing Avahi: %s", avahi_strerror (error));
-
- goto fail;
- }
-
- /* Make a call to get the version string from the daemon */
- version = avahi_client_get_version_string (client);
-
- /* Check if the call suceeded */
- if (version == NULL)
- {
- g_warning ("Error getting version string: %s", avahi_strerror (avahi_client_errno (client)));
-
- goto fail;
- }
-
- g_message ("Avahi Server Version: %s", version);
-
- /* Start the GLIB Main Loop */
- g_main_loop_run (loop);
-
-fail:
- /* Clean up */
- g_main_loop_unref (loop);
- avahi_client_free (client);
- avahi_glib_poll_free (glib_poll);
-
- return 0;
-}
diff --git a/trunk/initscript/Makefile.am b/trunk/initscript/Makefile.am
deleted file mode 100644
index 7fcd15f..0000000
--- a/trunk/initscript/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-SUBDIRS =
-
-if TARGET_DEBIAN
-SUBDIRS += debian
-endif
-
-if TARGET_ARCHLINUX
-SUBDIRS += archlinux
-endif
-
-if TARGET_GENTOO
-SUBDIRS += gentoo
-endif
-
-if TARGET_SUSE
-SUBDIRS += suse
-endif
-
-if TARGET_FEDORA
-SUBDIRS += fedora
-endif
-
-if TARGET_MANDRIVA
-SUBDIRS += mandriva
-endif
-
-if TARGET_DARWIN
-SUBDIRS += darwin
-endif
-
-if TARGET_FREEBSD
-SUBDIRS += freebsd
-endif
-
-if TARGET_SLACKWARE
-SUBDIRS += slackware
-endif
diff --git a/trunk/initscript/archlinux/Makefile.am b/trunk/initscript/archlinux/Makefile.am
deleted file mode 100644
index 22096b4..0000000
--- a/trunk/initscript/archlinux/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-# $Id: Makefile.am 267 2005-08-08 10:19:22Z lennart $
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d
-
-EXTRA_DIST = \
- avahi-daemon.in \
- avahi-dnsconfd.in
-
-initd_SCRIPTS = \
- avahi-daemon \
- avahi-dnsconfd
-
-CLEANFILES = \
- avahi-daemon \
- avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/trunk/initscript/archlinux/avahi-daemon.in b/trunk/initscript/archlinux/avahi-daemon.in
deleted file mode 100644
index 1050cb0..0000000
--- a/trunk/initscript/archlinux/avahi-daemon.in
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# Authors: <lathiat@bur.st>
-#
-
-
-# general config
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD Daemon"
-NAME="avahi-daemon"
-DAEMON="@sbindir@/$NAME"
-
-case "$1" in
- start)
- stat_busy "Starting $DESC"
- $DAEMON -D > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon $NAME
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping $DESC"
- $DAEMON -k > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon $NAME
- stat_done
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- reload)
- stat_busy "Reloading services for $DESC"
- $DAEMON -r > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- stat_done
- fi
- ;;
- *)
- echo "usage: $0 {start|stop|restart|reload}"
- ;;
-esac
-exit 0
diff --git a/trunk/initscript/archlinux/avahi-dnsconfd.in b/trunk/initscript/archlinux/avahi-dnsconfd.in
deleted file mode 100755
index 667a0f6..0000000
--- a/trunk/initscript/archlinux/avahi-dnsconfd.in
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# Authors: <lathiat@bur.st>
-#
-
-
-# general config
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD DNS Server Configuration Daemon"
-NAME="avahi-dnsconfd"
-DAEMON="@sbindir@/$NAME"
-
-case "$1" in
- start)
- stat_busy "Starting $DESC"
- $DAEMON -D > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- add_daemon $NAME
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping $DESC"
- $DAEMON -k > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon $NAME
- stat_done
- fi
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- reload)
- stat_busy "Reloading services for $DESC"
- $DAEMON -r > /dev/null 2>&1
- if [ $? -gt 0 ]; then
- stat_fail
- else
- stat_done
- fi
- ;;
- *)
- echo "usage: $0 {start|stop|restart|reload}"
- ;;
-esac
-exit 0
diff --git a/trunk/initscript/darwin/Makefile.am b/trunk/initscript/darwin/Makefile.am
deleted file mode 100644
index facc9d5..0000000
--- a/trunk/initscript/darwin/Makefile.am
+++ /dev/null
@@ -1,40 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = /System/Library/LaunchDaemons/
-
-EXTRA_DIST = \
- org.freedesktop.avahi-daemon.plist.in \
- org.freedesktop.avahi-dnsconfd.plist.in
-
-initd_SCRIPTS = \
- org.freedesktop.avahi-daemon.plist \
- org.freedesktop.avahi-dnsconfd.plist
-
-CLEANFILES = \
- org.freedesktop.avahi-daemon.plist \
- org.freedesktop.avahi-dnsconfd.plist
-
-org.freedesktop.avahi-daemon.plist: org.freedesktop.avahi-daemon.plist.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-org.freedesktop.avahi-dnsconfd.plist: org.freedesktop.avahi-dnsconfd.plist.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/trunk/initscript/darwin/org.freedesktop.avahi-daemon.plist.in b/trunk/initscript/darwin/org.freedesktop.avahi-daemon.plist.in
deleted file mode 100644
index 135e40c..0000000
--- a/trunk/initscript/darwin/org.freedesktop.avahi-daemon.plist.in
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>org.freedesktop.avahi-daemon</string>
- <key>OnDemand</key>
- <false/>
- <key>ProgramArguments</key>
- <array>
- <string>@sbindir@/avahi-daemon</string>
- </array>
- <key>ServiceIPC</key>
- <false/>
-</dict>
-</plist>
diff --git a/trunk/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in b/trunk/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in
deleted file mode 100644
index 822a2c0..0000000
--- a/trunk/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>Label</key>
- <string>org.freedesktop.avahi-dnsconfd</string>
- <key>OnDemand</key>
- <false/>
- <key>ProgramArguments</key>
- <array>
- <string>@sbindir@/avahi-dnsconfd</string>
- </array>
- <key>ServiceIPC</key>
- <false/>
-</dict>
-</plist>
diff --git a/trunk/initscript/debian/Makefile.am b/trunk/initscript/debian/Makefile.am
deleted file mode 100644
index 7991ea6..0000000
--- a/trunk/initscript/debian/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = \
- avahi-daemon.in \
- avahi-dnsconfd.in
-
-initd_SCRIPTS = \
- avahi-daemon \
- avahi-dnsconfd
-
-CLEANFILES = \
- avahi-daemon \
- avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< > $@
- chmod +x $@
diff --git a/trunk/initscript/debian/avahi-daemon.in b/trunk/initscript/debian/avahi-daemon.in
deleted file mode 100755
index 3a68781..0000000
--- a/trunk/initscript/debian/avahi-daemon.in
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/sh
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# avahi avahi daemon
-# Daemon for ZeroConf
-#
-# Authors: <sebastien.estienne@gmail.com>
-#
-
-if [ -f /lib/lsb/init-functions ]
-then
- . /lib/lsb/init-functions
-else
- # int log_begin_message (char *message)
- log_begin_msg () {
- if [ -z "$1" ]; then
- return 1
- fi
- echo " * $@"
- }
-
- # int log_end_message (int exitstatus)
- log_end_msg () {
-
- # If no arguments were passed, return
- [ -z "$1" ] && return 1
-
- # Only do the fancy stuff if we have an appropriate terminal
- # and if /usr is already mounted
- TPUT=/usr/bin/tput
- EXPR=/usr/bin/expr
- if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
- COLS=`$TPUT cols`
- if [ -n "$COLS" ]; then
- COL=`$EXPR $COLS - 7`
- else
- COL=73
- fi
- UP=`$TPUT cuu1`
- END=`$TPUT hpa $COL`
- START=`$TPUT hpa 0`
- RED=`$TPUT setaf 1`
- NORMAL=`$TPUT op`
- if [ $1 -eq 0 ]; then
- echo "$UP$END[ ok ]"
- else
- echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
- fi
- else
- if [ $1 -eq 0 ]; then
- echo " ...done."
- else
- echo " ...fail!"
- fi
- fi
- return $1
- }
-
-fi
-
-#set -e
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD Daemon"
-NAME="avahi-daemon"
-DAEMON="@sbindir@/$NAME"
-
-# Gracefully exit if the package has been removed.
-test -x $DAEMON || exit 0
-
-#
-# Function that starts the daemon/service.
-#
-d_start() {
- modprobe capability >/dev/null 2>&1 || true
-
- $DAEMON -c && return 0
-
- if [ -s /etc/localtime ]; then
- if [ ! -d /etc/avahi/etc ]; then
- mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi
- cp -fp /etc/localtime @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi;
-
- $DAEMON -D
-}
-
-#
-# Function that stops the daemon/service.
-#
-d_stop() {
- $DAEMON -c && $DAEMON -k
-}
-
-#
-# Function that reload the config file for the daemon/service.
-#
-d_reload() {
- $DAEMON -c && $DAEMON -r
-}
-
-#
-# Function that check the status of the daemon/service.
-#
-d_status() {
- $DAEMON -c && echo "$DESC is running" || echo "$DESC is not running"
-}
-
-case "$1" in
- start)
- log_begin_msg "Starting $DESC: $NAME"
- d_start
- log_end_msg $?
- ;;
- stop)
- log_begin_msg "Stopping $DESC: $NAME"
- d_stop
- log_end_msg $?
- ;;
- reload)
- log_begin_msg "Reloading services for $DESC: $NAME"
- d_reload
- log_end_msg $?
- ;;
- restart|force-reload)
- log_begin_msg "Restarting $DESC: $NAME"
- $DAEMON -c && d_stop
- d_start
- log_end_msg $?
- ;;
- status)
- d_status
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/trunk/initscript/debian/avahi-dnsconfd.in b/trunk/initscript/debian/avahi-dnsconfd.in
deleted file mode 100755
index c7cbf05..0000000
--- a/trunk/initscript/debian/avahi-dnsconfd.in
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/bin/sh
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-#
-# avahi-dnsconfd avahi dns configuration daemon
-# Daemon for ZeroConf
-#
-# Authors: <sebastien.estienne@gmail.com>
-#
-
-if [ -f /lib/lsb/init-functions ]
-then
- . /lib/lsb/init-functions
-else
- # int log_begin_message (char *message)
- log_begin_msg () {
- if [ -z "$1" ]; then
- return 1
- fi
- echo " * $@"
- }
-
- # int log_end_message (int exitstatus)
- log_end_msg () {
-
- # If no arguments were passed, return
- [ -z "$1" ] && return 1
-
- # Only do the fancy stuff if we have an appropriate terminal
- # and if /usr is already mounted
- TPUT=/usr/bin/tput
- EXPR=/usr/bin/expr
- if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
- COLS=`$TPUT cols`
- if [ -n "$COLS" ]; then
- COL=`$EXPR $COLS - 7`
- else
- COL=73
- fi
- UP=`$TPUT cuu1`
- END=`$TPUT hpa $COL`
- START=`$TPUT hpa 0`
- RED=`$TPUT setaf 1`
- NORMAL=`$TPUT op`
- if [ $1 -eq 0 ]; then
- echo "$UP$END[ ok ]"
- else
- echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
- fi
- else
- if [ $1 -eq 0 ]; then
- echo " ...done."
- else
- echo " ...fail!"
- fi
- fi
- return $1
- }
-
-fi
-
-#set -e
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi Unicast DNS Configuration Daemon"
-NAME="avahi-dnsconfd"
-DAEMON="@sbindir@/$NAME"
-
-# Gracefully exit if the package has been removed.
-test -x $DAEMON || exit 0
-
-#
-# Function that starts the daemon/service.
-#
-d_start() {
- $DAEMON -c
- [ $? = 0 ] && exit 0
-
- if [ -s /etc/localtime ]; then
- if [ ! -d /etc/avahi/etc ]; then
- mkdir -p @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi
- cp -fp /etc/localtime @sysconfdir@/avahi/etc >/dev/null 2>&1
- fi;
-
- $DAEMON -D
-}
-
-#
-# Function that stops the daemon/service.
-#
-d_stop() {
- $DAEMON -c
- [ $? != 0 ] && exit 0
-
- $DAEMON -k
-}
-
-#
-# Function that reload the config file for the daemon/service.
-#
-d_refresh() {
- $DAEMON -c
- [ $? != 0 ] && exit 0
-
- $DAEMON -r
-}
-
-#
-# Function that check the status of the daemon/service.
-#
-d_status() {
- $DAEMON -c
- [ $? = 0 ] && echo "$DESC is running" || echo "$DESC is not running"
-}
-
-case "$1" in
- start)
- log_begin_msg "Starting $DESC: $NAME"
- d_start
- log_end_msg $?
- ;;
- stop)
- log_begin_msg "Stopping $DESC: $NAME"
- d_stop
- log_end_msg $?
- ;;
- refresh)
- log_begin_msg "Refreshing $DESC: $NAME"
- d_refresh
- log_end_msg $?
- ;;
- reload|restart|force-reload)
- log_begin_msg "Restarting $DESC: $NAME"
- $DAEMON -c && d_stop
- d_start
- log_end_msg $?
- ;;
- status)
- d_status
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/trunk/initscript/fedora/Makefile.am b/trunk/initscript/fedora/Makefile.am
deleted file mode 100644
index e18f0f6..0000000
--- a/trunk/initscript/fedora/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = avahi-daemon avahi-dnsconfd
-
-CLEANFILES = avahi-daemon avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/trunk/initscript/fedora/avahi-daemon.in b/trunk/initscript/fedora/avahi-daemon.in
deleted file mode 100644
index aead1be..0000000
--- a/trunk/initscript/fedora/avahi-daemon.in
+++ /dev/null
@@ -1,102 +0,0 @@
-#! /bin/sh
-#
-# avahi-daemon: Starts the Avahi Daemon
-#
-# chkconfig: 345 98 02
-# description: This is a daemon which runs on client machines to perform \
-# Zeroconf service discovery on a network. avahi-daemon must be \
-# running on systems that use Avahi for service discovery. \
-# Avahi-daemon should not be running otherwise.
-# processname: avahi-daemon
-# config:
-
-OTHER_AVAHI_OPTS=""
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-daemon
-test -x $AVAHI_BIN || exit 5
-
-LOCKFILE=/var/lock/subsys/avahi-daemon
-
-base=${0##*/}
-
-start() {
- echo -n $"Starting Avahi daemon... "
- if [ -s /etc/localtime ]; then
- cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
- fi;
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch $LOCKFILE
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n $"Shutting down Avahi daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
- rm -f $LOCKFILE
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n $"Reloading Avahi daemon... "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base reload" || failure $"$base reload"
- echo
- return $RETVAL
-}
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- if [ -f $LOCKFILE ]; then
- restart
- fi
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
-esac
-
-exit $?
-
diff --git a/trunk/initscript/fedora/avahi-dnsconfd.in b/trunk/initscript/fedora/avahi-dnsconfd.in
deleted file mode 100644
index deb81fb..0000000
--- a/trunk/initscript/fedora/avahi-dnsconfd.in
+++ /dev/null
@@ -1,99 +0,0 @@
-#! /bin/sh
-#
-# avahi-daemon: Starts the Avahi dns configuration daemon
-#
-# chkconfig: - 34 98 02
-# description: avahi-dnsconfd connects to a running avahi-daemon and runs the script
-# /etc/avahi/dnsconf.action for each unicast DNS server that is announced
-# on the local LAN. This is useful for configuring unicast DNS servers in
-# a DHCP-like fashion with mDNS.
-# processname: avahi-dnsconfd
-# config:
-
-OTHER_AVAHI_OPTS=""
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-dnsconfd
-test -x $AVAHI_BIN || exit 5
-
-LOCKFILE=/var/lock/subsys/avahi-daemon
-
-start() {
- echo -n $"Starting Avahi DNS daemon... "
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch $LOCKFILE
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n "Shutting down Avahi DNS daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
- rm -f $LOCKFILE
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n "Reloading Avahi DNS daemon... "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
- echo
- return $RETVAL
-}
-
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo "Avahi DNS daemon is running" || echo "Avahi DNS daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- if [ -f $LOCKFILE ]; then
- restart
- fi
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
- ;;
-esac
-
-exit $?
-
diff --git a/trunk/initscript/freebsd/Makefile.am b/trunk/initscript/freebsd/Makefile.am
deleted file mode 100644
index 0ee75d5..0000000
--- a/trunk/initscript/freebsd/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d
-
-EXTRA_DIST = \
- avahi-daemon.sh.in \
- avahi-dnsconfd.sh.in
-
-initd_SCRIPTS = \
- avahi-daemon.sh \
- avahi-dnsconfd.sh
-
-CLEANFILES = \
- avahi-daemon.sh \
- avahi-dnsconfd.sh
-
-avahi-daemon.sh: avahi-daemon.sh.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd.sh: avahi-dnsconfd.sh.in
- sed \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< > $@
- chmod +x $@
diff --git a/trunk/initscript/freebsd/avahi-daemon.sh.in b/trunk/initscript/freebsd/avahi-daemon.sh.in
deleted file mode 100644
index f3da39f..0000000
--- a/trunk/initscript/freebsd/avahi-daemon.sh.in
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: /repoman/r/pcvs/ports/net/avahi/files/avahi-daemon.sh,v 1.2 2005/11/19 05:55:56 marcus Exp $
-#
-# PROVIDE: avahi_daemon
-# REQUIRE: DAEMON dbus
-# KEYWORD: FreeBSD
-#
-# Avahi's mDNSResponder, a Zeroconf (Bonjour) service advertisement daemon.
-#
-
-avahi_daemon_enable=${avahi_daemon_enable-"NO"}
-avahi_daemon_flags=${avahi_daemon_flags-"-D"}
-
-. /etc/rc.subr
-
-name=avahi_daemon
-rcvar=`set_rcvar`
-
-start_cmd=avahi_daemon_start
-stop_cmd=avahi_daemon_stop
-
-avahi_daemon_bin=@sbindir@/avahi-daemon
-
-avahi_daemon_start() {
- checkyesno avahi_daemon_enable && echo "Starting avahi-daemon." && \
- ${avahi_daemon_bin} ${avahi_daemon_flags}
-}
-
-avahi_daemon_stop() {
- checkyesno avahi_daemon_enable && echo "Stopping avahi-daemon." && \
- ${avahi_daemon_bin} -k
-}
-
-load_rc_config ${name}
-run_rc_command "$1"
diff --git a/trunk/initscript/freebsd/avahi-dnsconfd.sh.in b/trunk/initscript/freebsd/avahi-dnsconfd.sh.in
deleted file mode 100644
index ed01f06..0000000
--- a/trunk/initscript/freebsd/avahi-dnsconfd.sh.in
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: /repoman/r/pcvs/ports/net/avahi/files/avahi-dnsconfd.sh,v 1.4 2005/11/19 06:36:09 ahze Exp $
-#
-# PROVIDE: avahi_dnsconfd
-# REQUIRE: DAEMON dbus avahi_daemon
-# KEYWORD: FreeBSD
-#
-# avahi-dnsconfd connects to a running avahi-daemon and runs the script
-# @sysconfdir@/avahi/dnsconf.action for each unicast DNS server that
-# is announced on the local LAN. This is useful for configuring unicast
-# DNS servers in a DHCP-like fashion with mDNS.
-#
-
-avahi_dnsconfd_enable=${avahi_dnsconfd_enable-"NO"}
-avahi_dnsconfd_flags=${avahi_dnsconfd_flags-"-D"}
-
-. /etc/rc.subr
-
-name=avahi_dnsconfd
-rcvar=`set_rcvar`
-
-start_cmd=avahi_dnsconfd_start
-stop_cmd=avahi_dnsconfd_stop
-
-avahi_dnsconfd_bin=@sbindir@/avahi-dnsconfd
-
-avahi_dnsconfd_start() {
- checkyesno avahi_dnsconfd_enable && echo "Starting avahi-dnsconfd." && \
- ${avahi_dnsconfd_bin} ${avahi_dnsconfd_flags}
-}
-
-avahi_dnsconfd_stop() {
- checkyesno avahi_dnsconfd_enable && echo "Stopping avahi-dnsconfd." && \
- ${avahi_dnsconfd_bin} -k
-}
-
-load_rc_config ${name}
-run_rc_command "$1"
diff --git a/trunk/initscript/gentoo/Makefile.am b/trunk/initscript/gentoo/Makefile.am
deleted file mode 100644
index 398e345..0000000
--- a/trunk/initscript/gentoo/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-if !HAVE_DBUS
-NO_DBUS_DEPENDENCY=/need dbus/d
-endif
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = \
- avahi-daemon.in \
- avahi-dnsconfd.in
-
-initd_SCRIPTS = \
- avahi-daemon \
- avahi-dnsconfd
-
-CLEANFILES = \
- avahi-daemon \
- avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
-
- sed -e 's,@sbindir\@,$(sbindir),g; $(NO_DBUS_DEPENDENCY)' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/trunk/initscript/gentoo/avahi-daemon.in b/trunk/initscript/gentoo/avahi-daemon.in
deleted file mode 100644
index 1ceae13..0000000
--- a/trunk/initscript/gentoo/avahi-daemon.in
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/sbin/runscript
-# $Id$
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-opts="${opts} reload"
-
-depend() {
- use net
- need dbus
-}
-
-start() {
- ebegin "Starting avahi-daemon"
- @sbindir@/avahi-daemon -D
- eend $?
-}
-
-stop() {
- ebegin "Stopping avahi-daemon"
- @sbindir@/avahi-daemon -k
- eend $?
-}
-
-reload() {
- ebegin "Reloading avahi-daemon"
- @sbindir@/avahi-daemon -r
- eend $?
-}
diff --git a/trunk/initscript/gentoo/avahi-dnsconfd.in b/trunk/initscript/gentoo/avahi-dnsconfd.in
deleted file mode 100644
index 54c2aa6..0000000
--- a/trunk/initscript/gentoo/avahi-dnsconfd.in
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/sbin/runscript
-# $Id$
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-opts="${opts} reload"
-
-depend() {
- need avahi-daemon
- use net
-}
-
-start() {
- ebegin "Starting avahi-dnsconfd"
- @sbindir@/avahi-dnsconfd -D
- eend $?
-}
-
-stop() {
- ebegin "Stopping avahi-dnsconfd"
- @sbindir@/avahi-dnsconfd -k
- eend $?
-}
-
-reload() {
- ebegin "Reloading avahi-dnsconfd"
- @sbindir@/avahi-dnsconfd -r
- eend $?
-}
diff --git a/trunk/initscript/mandriva/Makefile.am b/trunk/initscript/mandriva/Makefile.am
deleted file mode 100644
index 10fd4cf..0000000
--- a/trunk/initscript/mandriva/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id: Makefile.am 838 2005-10-22 21:23:02Z lennart $
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d/init.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = avahi-daemon avahi-dnsconfd
-
-CLEANFILES = avahi-daemon avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/trunk/initscript/mandriva/avahi-daemon.in b/trunk/initscript/mandriva/avahi-daemon.in
deleted file mode 100644
index 2efbc6e..0000000
--- a/trunk/initscript/mandriva/avahi-daemon.in
+++ /dev/null
@@ -1,94 +0,0 @@
-#! /bin/sh
-#
-### BEGIN INIT INFO
-# Provides: avahi
-# Required-Start: $network messagebus
-# Required-Stop: $network messagebus
-# Default-Start: 3 5
-# Description: Avahi, a ZeroConf daemon whichs implements an mDNS stack
-### END INIT INFO
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-daemon
-test -x $AVAHI_BIN || exit 5
-
-start() {
- echo -n $"Starting Avahi daemon: "
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch /var/lock/subsys/avahi-daemon
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n "Shutting down Avahi daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- rm -f /var/lock/subsys/avahi-daemon
- success $"$base stop"
- else
- failure $"$base stop"
- fi
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n "Reloading Avahi daemon: "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
- echo
- return $RETVAL
-}
-
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo "Avahi daemon is running" || echo "Avahi daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- $AVAHI_BIN -c
- [ $? = 0 ] && restart || :
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
-esac
-
-exit $?
diff --git a/trunk/initscript/mandriva/avahi-dnsconfd.in b/trunk/initscript/mandriva/avahi-dnsconfd.in
deleted file mode 100644
index 3e8aaaf..0000000
--- a/trunk/initscript/mandriva/avahi-dnsconfd.in
+++ /dev/null
@@ -1,94 +0,0 @@
-#! /bin/sh
-#
-### BEGIN INIT INFO
-# Provides: avahi-dnsconfd
-# Required-Start: avahi
-# Required-Stop: avahi
-# Default-Start: 3 5
-# Description: A DNS configuration daemon using mDNS in a DHCP-like fashion
-### END INIT INFO
-
-# Source function library.
-. /etc/init.d/functions
-
-. /etc/sysconfig/network
-
-# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
-
-AVAHI_BIN=@sbindir@/avahi-dnsconfd
-test -x $AVAHI_BIN || exit 5
-
-start() {
- echo -n $"Starting Avahi DNS daemon: "
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch /var/lock/subsys/avahi-dnsconfd
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
-}
-
-stop() {
- echo -n "Shutting down Avahi DNS daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- rm -f /var/lock/subsys/avahi-dnsconfd
- success $"$base stop"
- else
- failure $"$base stop"
- fi
- echo
- return $RETVAL
-}
-
-reload() {
- echo -n "Reloading Avahi DNS daemon: "
- $AVAHI_BIN -r
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base startup" || failure $"$base startup"
- echo
- return $RETVAL
-}
-
-
-restart() {
- stop
- start
-}
-
-RETVAL=0
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- status)
- $AVAHI_BIN -c
- [ $? = 0 ] && echo "Avahi DNS daemon is running" || echo "Avahi DNS daemon is not running"
- ;;
- restart)
- restart
- ;;
- reload)
- reload
- ;;
- condrestart)
- $AVAHI_BIN -c
- [ $? = 0 ] && restart || :
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- exit 1
-esac
-
-exit $?
diff --git a/trunk/initscript/slackware/Makefile.am b/trunk/initscript/slackware/Makefile.am
deleted file mode 100644
index 3175a15..0000000
--- a/trunk/initscript/slackware/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/rc.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = rc.avahidaemon rc.avahidnsconfd
-
-CLEANFILES = rc.avahidaemon rc.avahidnsconfd
-
-rc.avahidaemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-rc.avahidnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/trunk/initscript/slackware/avahi-daemon.in b/trunk/initscript/slackware/avahi-daemon.in
deleted file mode 100644
index acd377d..0000000
--- a/trunk/initscript/slackware/avahi-daemon.in
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Start/stop/restart the avahi daemon:
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD Daemon"
-NAME="avahi-daemon"
-DAEMON="@sbindir@/$NAME"
-
-avahid_start()
-{
- echo "Starting $DESC: $DAEMON -D"
- $DAEMON -D
-}
-
-avahid_status()
-{
- $DAEMON -c
- [ $? = 0 ]
-}
-
-avahid_stop()
-{
- echo -en "Stopping $DESC: "
- $DAEMON -c
- [ $? != 0 ]
- echo "stopped";
- $DAEMON -k 2>/dev/null
-}
-
-avahid_restart()
-{
- avahid_stop
- avahid_start
-}
-
-case "$1" in
-'start')
- if ( ! avahid_status ); then
- avahid_start
- else
- echo "$DESC is already running (will not start it twice)."
- fi
- ;;
-'stop')
- avahid_stop
- ;;
-'restart')
- avahid_restart
- ;;
-'status')
- if ( avahid_status ); then
- echo "$DESC is currently running"
- else
- echo "$DESC is not running."
- fi
- ;;
-*)
- echo "usage $0 start|stop|status|restart"
-esac
-
diff --git a/trunk/initscript/slackware/avahi-dnsconfd.in b/trunk/initscript/slackware/avahi-dnsconfd.in
deleted file mode 100644
index 4da14fa..0000000
--- a/trunk/initscript/slackware/avahi-dnsconfd.in
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/bash
-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Start/stop/restart the avahi dnsconfd daemon:
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-DESC="Avahi mDNS/DNS-SD DNS Server Configuration Daemon"
-NAME="avahi-dnsconfd"
-DAEMON="@sbindir@/$NAME"
-
-avahidns_start()
-{
- echo "Starting $DESC: $DAEMON -D"
- $DAEMON -D
-}
-
-avahidns_status()
-{
- $DAEMON -c
- [ $? = 0 ]
-}
-
-avahidns_stop()
-{
- echo -en "Stopping $DESC: "
- $DAEMON -c
- [ $? != 0 ]
- echo "stopped";
- $DAEMON -k 2>/dev/null
-}
-
-avahidns_restart()
-{
- avahidns_stop
- avahidns_start
-}
-
-case "$1" in
-'start')
- if ( ! avahidns_status ); then
- avahidns_start
- else
- echo "$DESC is already running (will not start it twice)."
- fi
- ;;
-'stop')
- avahidns_stop
- ;;
-'restart')
- avahidns_restart
- ;;
-'status')
- if ( avahidns_status ); then
- echo "$DESC is currently running"
- else
- echo "$DESC is not running."
- fi
- ;;
-*)
- echo "usage $0 start|stop|status|restart"
-esac
-
diff --git a/trunk/initscript/suse/Makefile.am b/trunk/initscript/suse/Makefile.am
deleted file mode 100644
index e18f0f6..0000000
--- a/trunk/initscript/suse/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-initddir = $(sysconfdir)/init.d
-
-EXTRA_DIST = avahi-daemon.in avahi-dnsconfd.in
-
-initd_SCRIPTS = avahi-daemon avahi-dnsconfd
-
-CLEANFILES = avahi-daemon avahi-dnsconfd
-
-avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
-
-avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/trunk/initscript/suse/avahi-daemon.in b/trunk/initscript/suse/avahi-daemon.in
deleted file mode 100644
index b364a8c..0000000
--- a/trunk/initscript/suse/avahi-daemon.in
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: avahi
-# Required-Start: $network dbus
-# Default-Start: 3 5
-# Default-Stop:
-# Description: Avahi, a ZeroConf daemon for mDNS and service registration
-### END INIT INFO
-
-AVAHI_BIN=@sbindir@/avahi-daemon
-test -x $AVAHI_BIN || exit 5
-
-. /etc/rc.status
-rc_reset
-
-case "$1" in
- start)
- echo -n "Starting Avahi daemon"
- /sbin/startproc $AVAHI_BIN -D
- rc_check
- for (( n=0 ; n<10 ; n++ )) ; do
- if test -f /var/run/avahi-daemon/pid ; then
- break
- else
- echo -n "."
- sleep 1
- fi
- done
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down Avahi daemon"
- $AVAHI_BIN -k || /bin/true
- rc_status -v
- ;;
- restart)
- $0 stop
- $0 start
- rc_status
- ;;
- force-reload|reload)
- echo -n "Reloading Avahi daemon"
- $AVAHI_BIN -r
- rc_status -v
- ;;
- status)
- echo -n "Checking for Avahi daemon: "
- $AVAHI_BIN -c
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|force-reload|reload}"
- exit 1
- ;;
-esac
-
diff --git a/trunk/initscript/suse/avahi-dnsconfd.in b/trunk/initscript/suse/avahi-dnsconfd.in
deleted file mode 100644
index b9de808..0000000
--- a/trunk/initscript/suse/avahi-dnsconfd.in
+++ /dev/null
@@ -1,47 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides: avahi-dnsconfd
-# Required-Start: avahi
-# Default-Start: 3 5
-# Default-Stop:
-# Description: Avahi, a ZeroConf daemon for mDNS and service registration
-### END INIT INFO
-
-AVAHI_BIN=@sbindir@/avahi-dnsconfd
-test -x $AVAHI_BIN || exit 5
-
-. /etc/rc.status
-rc_reset
-
-case "$1" in
- start)
- echo -n "Starting Avahi DNS Configuration daemon"
- /sbin/startproc $AVAHI_BIN -D
- rc_status -v
- ;;
- stop)
- echo -n "Shutting down Avahi DNS Configuration daemon"
- $AVAHI_BIN -k || /bin/true
- rc_status -v
- ;;
- restart)
- $0 stop
- $0 start
- rc_status
- ;;
- force-reload|reload)
- echo -n "Reloading Avahi DNS Configuration daemon"
- $AVAHI_BIN -r
- rc_status -v
- ;;
- status)
- echo -n "Checking for Avahi DNS Configuration daemon: "
- $AVAHI_BIN -c
- rc_status -v
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart|force-reload|reload}"
- exit 1
- ;;
-esac
-
diff --git a/trunk/man/Makefile.am b/trunk/man/Makefile.am
deleted file mode 100644
index 756d481..0000000
--- a/trunk/man/Makefile.am
+++ /dev/null
@@ -1,232 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-pkgsysconfdir=$(sysconfdir)/avahi
-servicedir=$(pkgsysconfdir)/services
-
-if BUILD_MANPAGES
-
-man_MANS = \
- avahi-daemon.8 \
- avahi-dnsconfd.8 \
- avahi-daemon.conf.5 \
- avahi-dnsconfd.action.8 \
- avahi.service.5 \
- avahi.hosts.5
-
-noinst_DATA = \
- avahi-browse.1.xml \
- avahi-publish.1.xml \
- avahi-resolve.1.xml \
- avahi-set-host-name.1.xml \
- avahi-daemon.8.xml \
- avahi-discover.1.xml \
- avahi-bookmarks.1.xml \
- avahi-dnsconfd.8.xml \
- avahi-daemon.conf.5.xml \
- avahi-dnsconfd.action.8.xml \
- avahi.service.5.xml \
- avahi.hosts.5.xml \
- avahi-autoipd.8.xml \
- avahi-autoipd.action.8.xml
-
-CLEANFILES = \
- $(noinst_DATA)
-
-if HAVE_DBUS
-
-man_MANS += \
- avahi-browse.1 \
- avahi-resolve.1 \
- avahi-publish.1 \
- avahi-set-host-name.1
-
-if HAVE_PYTHON
-man_MANS += \
- avahi-discover.1 \
- avahi-bookmarks.1
-endif
-endif
-
-if ENABLE_AUTOIPD
-if HAVE_LIBDAEMON
-
-man_MANS += \
- avahi-autoipd.8 \
- avahi-autoipd.action.8
-
-endif
-endif
-
-avahi-browse.1.xml: avahi-browse.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-publish.1.xml: avahi-publish.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-resolve.1.xml: avahi-resolve.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-set-host-name.1.xml: avahi-set-host-name.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-daemon.8.xml: avahi-daemon.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@servicedir\@,$(servicedir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-discover.1.xml: avahi-discover.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-bookmarks.1.xml: avahi-bookmarks.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-dnsconfd.8.xml: avahi-dnsconfd.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-daemon.conf.5.xml: avahi-daemon.conf.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-dnsconfd.action.8.xml: avahi-dnsconfd.action.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi.service.5.xml: avahi.service.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@servicedir\@,$(servicedir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi.hosts.5.xml: avahi.hosts.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-autoipd.action.8.xml: avahi-autoipd.action.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-autoipd.8.xml: avahi-autoipd.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-
-if USE_XMLTOMAN
-
-CLEANFILES += $(man_MANS)
-
-avahi-browse.1: avahi-browse.1.xml Makefile
- xmltoman $< > $@
-
-avahi-publish.1: avahi-publish.1.xml Makefile
- xmltoman $< > $@
-
-avahi-resolve.1: avahi-resolve.1.xml Makefile
- xmltoman $< > $@
-
-avahi-set-host-name.1: avahi-set-host-name.1.xml Makefile
- xmltoman $< > $@
-
-avahi-daemon.8: avahi-daemon.8.xml Makefile
- xmltoman $< > $@
-
-avahi-discover.1: avahi-discover.1.xml Makefile
- xmltoman $< > $@
-
-avahi-bookmarks.1: avahi-bookmarks.1.xml Makefile
- xmltoman $< > $@
-
-avahi-dnsconfd.8: avahi-dnsconfd.8.xml Makefile
- xmltoman $< > $@
-
-avahi-daemon.conf.5: avahi-daemon.conf.5.xml Makefile
- xmltoman $< > $@
-
-avahi-dnsconfd.action.8: avahi-dnsconfd.action.8.xml Makefile
- xmltoman $< > $@
-
-avahi.service.5: avahi.service.5.xml Makefile
- xmltoman $< > $@
-
-avahi.hosts.5: avahi.hosts.5.xml Makefile
- xmltoman $< > $@
-
-avahi-autoipd.action.8: avahi-autoipd.action.8.xml Makefile
- xmltoman $< > $@
-
-avahi-autoipd.8: avahi-autoipd.8.xml Makefile
- xmltoman $< > $@
-
-xmllint: $(noinst_DATA)
- for f in $(noinst_DATA) ; do \
- xmllint --noout --valid "$$f" || exit 1 ; \
- done
-
-endif
-
-endif
-
-EXTRA_DIST = \
- $(man_MANS) \
- avahi-browse.1.xml.in \
- avahi-publish.1.xml.in \
- avahi-resolve.1.xml.in \
- avahi-set-host-name.1.xml.in \
- avahi-daemon.8.xml.in \
- avahi-discover.1.xml.in \
- avahi-bookmarks.1.xml.in \
- avahi-dnsconfd.8.xml.in \
- avahi-daemon.conf.5.xml.in \
- avahi-dnsconfd.action.8.xml.in \
- avahi.service.5.xml.in \
- avahi.hosts.5.xml.in \
- avahi-autoipd.action.8.xml.in \
- avahi-autoipd.8.xml.in \
- xmltoman.css \
- xmltoman.xsl \
- xmltoman.dtd
-
-
-if HAVE_DBUS
-
-install-exec-local:
- mkdir -p $(DESTDIR)/$(mandir)/man1 && \
- cd $(DESTDIR)/$(mandir)/man1 && \
- rm -f avahi-resolve-host-name.1 avahi-resolve-address.1 avahi-browse-domains.1 avahi-publish-address.1 avahi-publish-service.1 && \
- $(LN_S) avahi-resolve.1 avahi-resolve-host-name.1 && \
- $(LN_S) avahi-resolve.1 avahi-resolve-address.1 && \
- $(LN_S) avahi-browse.1 avahi-browse-domains.1 && \
- $(LN_S) avahi-publish.1 avahi-publish-address.1 && \
- $(LN_S) avahi-publish.1 avahi-publish-service.1
-
-endif
diff --git a/trunk/man/avahi-bookmarks.1.xml.in b/trunk/man/avahi-bookmarks.1.xml.in
deleted file mode 100644
index 9bebd76..0000000
--- a/trunk/man/avahi-bookmarks.1.xml.in
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-bookmarks" section="1" desc="Web service showing mDNS/DNS-SD announced HTTP services using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-bookmarks</cmd>
- </synopsis>
-
- <description>
- <p>A web service for listing HTTP services that are announced
- via mDNS/DNS-SD using the Avahi daemon. avahi-bookmarks opens a
- TCP socket on port 8080 and waits for incoming HTTP connections
- returning a dynamic web site containing links to all services of
- type _http._tcp on the LAN. Point your browser to
- http://localhost:8080/ to make use of avahi-bookmarks.</p>
-
- </description>
-
- <options>
- <option>
- <p><opt>-p | --port=</opt> <arg>PORT</arg></p>
- <optdesc><p>Specify a TCP port number to listen on. If omitted defaults to 8080.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-a | --address=</opt> <arg>address</arg></p>
- <optdesc><p>Specify an IP address to listen on. If omitted defaults to 127.0.0.1. Specify 0.0.0.0 if you want to allow remote access.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-H | --host-names</opt></p>
- <optdesc><p>Create links pointing to mDNS host names instead
- of resolved IP addreses. This is only compatible with your
- browser if you run some kind of local NSS module to resolve
- mDNS host names (e.g. nss-mdns). If both -A and -H are ommited
- avahi-bookmarks detects whether NSS support is available
- locally. This option conflicts with -A.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-A | --addresses</opt></p>
- <optdesc><p>Create links pointing to numeric IP addresses
- instead of mDNS host names. This will break access to hosts
- running virtual servers. If both -A and -H are ommited
- avahi-bookmarks detects whether NSS support is available
- locally. This option conflicts with -H.</p></optdesc>
- </option>
-
-
- <option>
- <p><opt>-d | --domain</opt>=<arg>DOMAIN</arg></p>
- <optdesc><p>The domain to browse for services in.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- </options>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-browse" section="1"/>, <manref name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-browse.1.xml.in b/trunk/man/avahi-browse.1.xml.in
deleted file mode 100644
index 07b7557..0000000
--- a/trunk/man/avahi-browse.1.xml.in
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-browse" section="1" desc="Browse for mDNS/DNS-SD services using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-browse [<arg>options</arg>] <arg>service-type</arg></cmd>
- <cmd>avahi-browse [<arg>options</arg>] <opt>--all</opt></cmd>
- <cmd>avahi-browse [<arg>options</arg>] <opt>--browse-domains</opt></cmd>
- <cmd>avahi-browse-domains [<arg>options</arg>]</cmd>
- </synopsis>
-
- <description>
- <p>Browse for mDNS/DNS-SD network services and browsing domains using the Avahi daemon.</p>
-
- </description>
-
- <options>
-
- <p>Specify a DNS-SD service type (e.g. _http._tcp) to browse for
- on the command line, or <opt>-a</opt> to browse for all
- available service types. Items that appear on the network are prefixed with "+", items that disappear are prefixed with "-".</p>
-
- <option>
- <p><opt>-a | --all</opt></p>
- <optdesc><p>Browse for all service types registered on the LAN, not just the one specified on the command line.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-D | --browse-domains</opt></p>
- <optdesc><p>Browse for browsing domains instead for services. avahi-browse-domains is equivalent to avahi-browse --browse-domains</p></optdesc>
- </option>
-
- <option>
- <p><opt>-d | --domain=</opt> <arg>DOMAIN</arg></p>
- <optdesc><p>Browse in the specified domain. If omitted
- avahi-browse will browse in the default browsing domain
- (usually .local)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --verbose</opt></p>
- <optdesc><p>Enable verbose mode.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-t | --terminate</opt></p>
- <optdesc><p>Terminate after dumping a more or less complete list.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-c | --cache</opt></p>
- <optdesc><p>Terminate after dumping all entries available in the cache.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-l | --ignore-local</opt></p>
- <optdesc><p>Ignore local services, show only remote services.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-r | --resolve</opt></p>
- <optdesc><p>Automatically resolve services found.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-f | --no-fail</opt></p>
- <optdesc><p>Don't fail if the daemon is not found running. Instead, wait until it appears. If it disconnects, try to reconnect.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-k | --no-db-lookup</opt></p>
- <optdesc><p>Don't lookup services types in service type database.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-V | --version</opt></p>
- <optdesc><p>Show version information.</p></optdesc>
- </option>
-
- </options>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-publish" section="1"/>, <manref name="avahi-resolve" section="1"/>, <manref name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-daemon.8.xml.in b/trunk/man/avahi-daemon.8.xml.in
deleted file mode 100644
index e9732d6..0000000
--- a/trunk/man/avahi-daemon.8.xml.in
+++ /dev/null
@@ -1,170 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-daemon" section="8" desc="The Avahi mDNS/DNS-SD daemon">
-
- <synopsis>
- <cmd>avahi-daemon [<arg>options</arg>]</cmd>
- <cmd>avahi-daemon <opt>--kill</opt></cmd>
- <cmd>avahi-daemon <opt>--reload</opt></cmd>
- <cmd>avahi-daemon <opt>--check</opt></cmd>
- </synopsis>
-
- <description>
- <p>The Avahi mDNS/DNS-SD daemon implementing Apple's ZeroConf
- architecture (also known as "Rendezvous" or "Bonjour"). The daemon
- registers local IP addresses and static services using
- mDNS/DNS-SD and provides two IPC APIs for local programs to make
- use of the mDNS record cache the avahi-daemon maintains. First
- there is the so called "simple protocol" which is used
- exclusively by avahi-dnsconfd (a daemon which configures unicast
- DNS servers using server info published via mDNS) and nss-mdns
- (a libc NSS plugin, providing name resolution via mDNS). Finally
- there is the D-Bus interface which provides a rich object
- oriented interface to D-Bus enabled applications.</p>
-
- <p>Upon startup avahi-daemon interprets its configuration file
- <file>@pkgsysconfdir@/avahi-daemon.conf</file> and reads XML
- fragments from <file>@servicedir@/*.service</file> which may
- define static DNS-SD services. If you enable
- <opt>publish-resolv-conf-dns-servers</opt> in
- <file>avahi-daemon.conf</file> the file
- <file>/etc/resolv.conf</file> will be read, too.</p>
- </description>
-
- <options>
-
- <option>
- <p><opt>-f | --file=</opt> <arg>FILE</arg></p>
- <optdesc><p>Specify the configuration file to read. (default: @pkgsysconfdir@/avahi-daemon.conf)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-D | --daemonize</opt></p>
- <optdesc><p>Daemonize after startup. Implies <opt>--syslog</opt>.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-s | --syslog</opt></p>
- <optdesc><p>Log to syslog instead of STDERR. Implied by <opt>--daemonize</opt>.</p></optdesc>
- </option>
-
- <option>
- <p><opt>--debug</opt></p>
- <optdesc><p>Increase verbosity to debug level.</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-rlimits</opt></p>
- <optdesc><p>Don't enforce resource limits as specified in the configuration file. (See <manref section="2" name="setrlimit"/> for more information)</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-drop-root</opt></p>
- <optdesc><p>Don't drop root priviliges after startup and don't require daemon to be started as root. We recommend not to use this option.</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-chroot</opt></p>
- <optdesc><p>Don't <manref section="2" name="chroot"/> the daemon. This option is only available when compiled with chroot() support.</p></optdesc>
- </option>
-
- <option>
- <p><opt>--no-proc-title</opt></p>
- <optdesc><p>Don't change the process name while
- running. Unless this option is specified avahi-daemon will reflect
- it's current state and the selected host name in the process
- title.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-k | --kill</opt></p>
- <optdesc><p>Kill an already running avahi-daemon. (equivalent to sending a SIGTERM)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-r | --reload</opt></p>
- <optdesc><p>Tell an already running avahi-daemon to reread
- <file>/etc/resolv.conf</file> (in case you enabled
- <opt>publish-resolv-conf-dns-servers</opt> in
- <file>avahi-daemon.conf</file>) the files from
- <file>@servicedir@/</file>. Please note that this will not
- reload the
- <file>@pkgsysconfdir@/avahi-daemon.conf</file>. (equivalent to
- sending a SIGHUP)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-c | --check</opt></p>
- <optdesc><p>Return 0 as return code when avahi-daemon is already running.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --version</opt></p>
- <optdesc><p>Show version information </p></optdesc>
- </option>
-
- </options>
-
- <section name="Files">
-
- <p><file>@pkgsysconfdir@/avahi-daemon.conf</file>: the default configuration file for avahi-daemon, <manref name="avahi-daemon.conf" section="5"/> for more information.</p>
-
- <p><file>@pkgsysconfdir@/hosts</file>: additional static hostname mappings to publish in mDNS, see <manref name="avahi.hosts" section="5"/> for more information.</p>
-
- <p><file>@servicedir@/*.service</file>: static service definitions, see <manref name="avahi.service" section="5"/> for more information.</p>
-
- </section>
-
- <section name="Signals">
- <p><arg>SIGINT, SIGTERM, SIGQUIT</arg>: avahi-daemon will shutdown. (Same as <opt>--kill</opt>).</p>
- <p><arg>SIGHUP</arg>: avahi-daemon will reload unicast DNS
- server data from <file>/etc/resolv.conf</file> and static
- service definitions from <file>@servicedir@/</file>. (Same as <opt>--reload</opt>)</p>
- <p><arg>SIGUSR1</arg>: avahi-daemon will dump local and remote cached resource record data to syslog.</p>
- </section>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon.conf" section="5"/>, <manref name="avahi.hosts" section="5"/>, <manref name="avahi.service" section="5"/>, <manref name="avahi-dnsconfd" section="8"/>, <manref name="avahi-set-host-name" section="1"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-daemon.conf.5.xml.in b/trunk/man/avahi-daemon.conf.5.xml.in
deleted file mode 100644
index bfbd0e5..0000000
--- a/trunk/man/avahi-daemon.conf.5.xml.in
+++ /dev/null
@@ -1,305 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-daemon.conf" section="5" desc="avahi-daemon configuration file">
-
- <synopsis>
- <cmd>@pkgsysconfdir@/avahi-daemon.conf</cmd>
- </synopsis>
-
- <description>
- <p><file>avahi-daemon.conf</file> is the configuration file for avahi-daemon.</p>
- </description>
-
- <section name="Section [Server]">
-
- <option>
- <p><opt>host-name=</opt> Set the host name avahi-daemon tries
- to register on the LAN. If omited defaults to the system host
- name as set with the sethostname() system call.</p>
- </option>
-
- <option>
- <p><opt>domain-name=</opt> Set the default domain name avahi-daemon
- tries to register its host name and services on the LAN in. If
- omitted defaults to ".local".</p>
- </option>
-
- <option>
- <p><opt>browse-domains=</opt> Set a comma seperated list of
- browsing domains (in addition to the default one and those
- announced inside the default browsing domain). Please note
- that the user may specify additional browsing domains on the
- client side, either by setting $AVAHI_BROWSE_DOMAINS to a list
- of colon seperated domains or by adding them to the XDG config
- file <file>~/.config/avahi/browse-domains</file> (seperated by
- newlines).</p>
-
- </option>
-
- <option>
- <p><opt>use-ipv4=</opt> Takes a boolean value ("yes" or
- "no"). If set to "no" avahi-daemon will not use IPv4
- sockets. Default is "yes".</p>
- </option>
-
- <option>
- <p><opt>use-ipv6=</opt> Takes a boolean value ("yes" or
- "no"). If set to "no" avahi-daemon will not use IPv6
- sockets. Default is "yes".</p>
- </option>
-
- <option>
- <p><opt>check-response-ttl=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes", an additional security check is
- activated: incoming IP packets will be ignored unless the IP
- TTL is 255. Earlier mDNS specifications required this
- check. Since this feature may be incompatible with newer
- implementations of mDNS it defaults to "no". On the other hand
- it provides extra security.</p>
- </option>
-
- <option>
- <p><opt>use-iff-running=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" avahi-daemon monitors the IFF_RUNNING
- flag bit which is used by some (modern) network drivers to
- tell user space if a network cable is plugged in (in case of
- copper ethernet), or the network card is associated with some
- kind of network (in case of WLAN). If IFF_RUNNING is set
- avahi-daemon will automatically announce its services on that
- network. Unfortunately far too many network drivers do not
- support this flag or support it in a broken way. Therefore
- this option defaults to "no".</p>
- </option>
-
- <option>
- <p><opt>enable-dbus=</opt> Takes either "yes", "no" or
- "warn". If set to "yes" avahi-daemon connects to D-Bus,
- offering an object oriented client API. It is only available
- if Avahi has been compiled with <opt>--enable-dbus</opt> in
- which case it defaults to "yes". "warn" behaves like "yes",
- but the daemon starts up even when it fails to connect to a
- D-Bus daemon. In addition, if the connection to the D-Bus
- daemon is terminated we try to reconnect. (Unless we are in a
- chroot() environment where this definitely will fail.) </p>
- </option>
-
- <option>
- <p><opt>disallow-other-stacks=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes" no other process is allowed
- to bind to UDP port 5353. This effectively impedes other mDNS
- stacks from running on the host. Use this as a security
- measure to make sure that only Avahi is responsible for mDNS
- traffic. Please note that we do no recommend running multiple
- mDNS stacks on the same host simultaneously. This hampers
- reliability and is a waste of resources. However, to not annoy
- people this option defaults to "no".</p>
- </option>
-
- <option>
- <p><opt>allow-point-to-point=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes" avahi-daemon will make use of
- interfaces with the POINTOPOINT flag set. This option defaults
- to "no" as it might make mDNS unreliable due to usually large
- latencies with such links and opens a potential security hole
- by allowing mDNS access from Internet connections. Use with
- care and YMMV!</p>
- </option>
-
- </section>
-
- <section name="Section [wide-area]">
- <option>
- <p><opt>enable-wide-area=</opt> Takes a boolean value
- ("yes" or "no"). Enable wide-area DNS-SD, aka
- DNS-SD over unicast DNS. If this is enabled only domains
- ending in .local will be resolved on mDNS, all other domains
- are resolved via unicast DNS. If you want to maintain multiple
- different multicast DNS domains even with this option enabled
- we encourage you to use subdomains of .local, such as
- "kitchen.local". This option defaults to "yes".</p>
- </option>
-
- </section>
-
- <section name="Section [publish]">
-
- <option><p><opt>disable-publishing=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes", no record will be published by
- Avahi, not even address records for the local host. Avahi will
- be started in a querying-only mode. Use this is a security
- measure. This option defaults to "no"</p></option>
-
- <option><p><opt>disable-user-service-publishing=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes", Avahi will still publish
- address records and suchlike but will not allow user
- applications to publish services. Use this is a security
- measure. This option defaults to "no"</p></option>
-
- <option>
- <p><opt>add-service-cookie=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes" an implicit TXT entry will be added
- to all locally registered services, containing a cookie value
- which is chosen randomly on daemon startup. This can be used
- to detect if two services on two different
- interfaces/protocols are actually identical. Defaults to
- "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-addresses=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes" avahi-daemon will register mDNS
- address records for all local IP addresses. Unless you want to
- use avahi-daemon exclusively for browsing it's recommended to
- enable this. If you plan to register local services you need
- to enable this option. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-hinfo=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" avahi-daemon will register an mDNS
- HINFO record on all interfaces which contains information
- about the local operating system and CPU, which might be
- useful for administrative purposes. This is recommended by the
- mDNS specification but not required. For the sake of privacy
- you might choose to disable this feature. Defaults to
- "yes."</p>
- </option>
-
- <option>
- <p><opt>publish-workstation=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes" avahi-daemon will register a
- service of type "_workstation._tcp" on the local LAN. This
- might be useful for administrative purposes (i.e. browse for
- all PCs on the LAN), but is not required or recommended by any
- specification. Newer MacOS X releases register a service of
- this type. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-domain=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" avahi-daemon will announce the locally
- used domain name (see above) for browsing by other
- hosts. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-dns-servers=</opt> Takes a comma seperated
- list of IP addresses for unicast DNS servers. You can use this
- to announce unicast DNS servers via mDNS. When used in
- conjunction with avahi-dnsconfd on the client
- side this allows DHCP-like configuration of unicast DNS
- servers.</p>
- </option>
-
- <option>
- <p><opt>publish-resolv-conf-dns-servers=</opt> Takes a boolean
- value ("yes" or "no"). If set to "yes" avahi-daemon will
- publish the unicast DNS servers specified in
- <file>/etc/resolv.conf</file> in addition to those specified
- with <opt>publish-dns-servers</opt>. Send avahi-daemon a
- SIGHUP to have it reload this file. Defaults to "no".</p>
- </option>
-
- </section>
-
- <section name="Section [reflector]">
- <option>
- <p><opt>enable-reflector=</opt> Takes a boolean value ("yes"
- or "no"). If set to "yes" avahi-daemon will reflect incoming
- mDNS requests to all local network interfaces, effectively
- allowing clients to browse mDNS/DNS-SD services on all
- networks connected to the gateway. The gateway is somewhat
- intelligent and should work with all kinds of mDNS traffic,
- though some functionality is lost (specifically the unicast
- reply bit, which is used rarely anyway). Make sure to not run
- multiple reflectors between the same networks, this might
- cause them to play Ping Pong with mDNS packets. Defaults to
- "no".</p>
- </option>
-
- <option>
- <p><opt>reflect-ipv=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" and <opt>enable-reflector</opt> is
- enabled, avahi-daemon will forward mDNS traffic between IPv4
- and IPv6, which is usually not recommended. Defaults to "no".</p>
- </option>
- </section>
-
- <section name="Section [rlimits]">
- <p>This section is used to define system resource limits for the
- daemon. See <manref section="2" name="setrlimit"/> for more
- information. If any of the options is not specified in the configuration
- file, avahi-daemon does not change it from the system
- defaults.</p>
-
-
- <option>
- <p><opt>rlimit-as=</opt> Value in bytes for RLIMIT_AS (maximum size of the process's virtual memory). Sensible values are heavily system dependent.</p>
- </option>
-
- <option>
- <p><opt>rlimit-core=</opt> Value in bytes for RLIMIT_CORE (maximum core file size). Unless you want to debug avahi-daemon, it is safe to set this to 0.</p>
- </option>
-
- <option>
- <p><opt>rlimit-data=</opt> Value in bytes for RLIMIT_DATA (maximum size of the process's data segment). Sensible values are heavily system dependent.</p>
- </option>
-
- <option>
- <p><opt>rlimit-fsize=</opt> Value for RLIMIT_FSIZE (maximum size of files the process may create). Since avahi-daemon shouldn't write any files to disk, it is safe to set this to 0.</p>
- </option>
-
- <option>
- <p><opt>rlimit-nofile=</opt> Value for RLIMIT_NOFILE (open file descriptors). avahi-daemon shouldn't need more than 15 to 20 open file descriptors concurrently.</p>
- </option>
-
- <option>
- <p><opt>rlimit-stack=</opt> Value in bytes for RLIMIT_STACK (maximum size of the process stack). Sensible values are heavily system dependent.</p>
- </option>
-
- <option>
- <p><opt>rlimit-nproc=</opt> Value for RLIMIT_NPROC (number of process of user). avahi-daemon forks of a helper process on systems where <manref name="chroot" section="2"/> is available. Therefore this value should not be set below 2.</p>
- </option>
-
- </section>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi-dnsconfd" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-discover.1.xml.in b/trunk/man/avahi-discover.1.xml.in
deleted file mode 100644
index 5d4f878..0000000
--- a/trunk/man/avahi-discover.1.xml.in
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-discover" section="1" desc="Browse for mDNS/DNS-SD services using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-discover</cmd>
- </synopsis>
-
- <description>
- <p>Show a real-time graphical browse list for mDNS/DNS-SD
- network services running on the local LAN using the Avahi
- daemon.</p>
-
- </description>
-
- <options>
-
- <p>avahi-discover takes no command line arguments at the moment.</p>
-
- </options>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi-browse" section="1"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-dnsconfd.8.xml.in b/trunk/man/avahi-dnsconfd.8.xml.in
deleted file mode 100644
index c74e1ba..0000000
--- a/trunk/man/avahi-dnsconfd.8.xml.in
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-dnsconfd" section="8" desc="Unicast DNS server from mDNS/DNS-SD configuration daemon">
-
- <synopsis>
- <cmd>avahi-dnsconfd [<arg>options</arg>]</cmd>
- <cmd>avahi-dnsconfd <opt>--kill</opt></cmd>
- <cmd>avahi-dnsconfd <opt>--refresh</opt></cmd>
- <cmd>avahi-dnsconfd <opt>--check</opt></cmd>
- </synopsis>
-
- <description>
- <p>avahi-dnsconfd connects to a running avahi-daemon and runs
- the script <file>@pkgsysconfdir@/dnsconfd.action</file> for each unicast DNS
- server that is announced on the local LAN. This is useful for
- configuring unicast DNS servers in a DHCP-like fashion with
- mDNS.</p>
- </description>
-
- <options>
-
- <option>
- <p><opt>-D | --daemonize</opt></p>
- <optdesc><p>Daemonize after startup and redirect log messages to syslog.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-k | --kill</opt></p>
- <optdesc><p>Kill an already running avahi-dnsconfd. (equivalent to sending a SIGTERM)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-r | --refresh</opt></p>
- <optdesc><p>Tell an already running avahi-dnsconfd to refresh the DNS server data. (equivalent to sending a SIGHUP)</p></optdesc>
- </option>
-
- <option>
- <p><opt>-c | --check</opt></p>
- <optdesc><p>Return 0 as return code when avahi-dnsconfd is already running.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --version</opt></p>
- <optdesc><p>Show version information </p></optdesc>
- </option>
-
- </options>
-
- <section name="Files">
-
- <p><file>@pkgsysconfdir@/avahi-dnsconfd.action</file>: the script to run when a DNS server is found or removed.</p>
-
- </section>
-
- <section name="Signals">
- <p><arg>SIGINT, SIGTERM, SIGQUIT</arg>: avahi-dnsconfd will shutdown. This is issued by passing --kill to avahi-daemon.</p>
- <p><arg>SIGHUP</arg>: avahi-dnsconfd will refresh the DNS server data.</p>
- </section>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi-dnsconfd.action" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-dnsconfd.action.8.xml.in b/trunk/man/avahi-dnsconfd.action.8.xml.in
deleted file mode 100644
index 6811422..0000000
--- a/trunk/man/avahi-dnsconfd.action.8.xml.in
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-dnsconfd.action" section="8" desc="avahi-dnsconfd action script">
-
- <synopsis>
- <cmd>@pkgsysconfdir@/avahi-dnsconfd.action</cmd>
- </synopsis>
-
- <description>
- <p><file>avahi-dnsconfd.action</file> is the action script that
- is called whenever a new unicast DNS server is found or
- removed by avahi-dnsconfd. The default script as shipped
- with avahi patches <file>/etc/resolv.conf</file> to reflect the
- changed unicast DNS server configuration.</p>
- </description>
-
- <section name="Parameters">
-
- <option>
- <p><opt>argv[1]</opt> Contains the character "+" if the DNS server is new, "-" when it shall be removed from the DNS server list.</p>
- </option>
-
- <option>
- <p><opt>argv[2]</opt> The IP address of the DNS server.</p>
- </option>
-
- <option>
- <p><opt>argv[3]</opt> Numerical network interface number this DNS server was found on.</p>
- </option>
-
- <option>
- <p><opt>argv[4]</opt> Numerical protocol number this DNS server was found on. (usually 2 for IPv4 and 10 for IPv6) </p>
- </option>
-
- </section>
-
- <section name="Environment">
- <option>
- <p><opt>AVAHI_INTERFACE</opt> Contains the textual interface name the corresponds with argv[3]. (e.g. "eth0")</p>
- </option>
-
- <option><p><opt>AVAHI_INTERFACE_DNS_SERVERS</opt> Contains a
- list of all DNS servers that avahi-dnsconfd found on the
- interface <opt>$AVAHI_INTERFACE</opt>, separated by
- spaces.</p></option>
-
- <option><p><opt>AVAHI_DNS_SERVERS</opt> Contains a list of all
- DNS server that avahi-dnsconfd found on all interfaces,
- separated by spaces.</p></option>
-
- </section>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-dnsconfd" section="8"/>, <manref name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-publish.1.xml.in b/trunk/man/avahi-publish.1.xml.in
deleted file mode 100644
index c68f60d..0000000
--- a/trunk/man/avahi-publish.1.xml.in
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-publish-service" section="1" desc="Register an mDNS/DNS-SD service or host name or address mapping using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-publish -s [<arg>options</arg>] <arg>name</arg> <arg>service-type</arg> <arg>port</arg> [<arg>TXT data</arg> ...]</cmd>
- <cmd>avahi-publish-service [<arg>options</arg>] <arg>name</arg> <arg>service-type</arg> <arg>port</arg> [<arg>TXT data</arg> ...]</cmd>
- <cmd>avahi-publish -a [<arg>options</arg>] <arg>host name</arg> <arg>address</arg></cmd>
- <cmd>avahi-publish-address [<arg>options</arg>] <arg>host name</arg> <arg>address</arg></cmd>
- </synopsis>
-
- <description>
- <p>Register an mDNS/DNS-SD service or host name/address mapping using the Avahi daemon.</p>
- </description>
-
- <options>
-
- <p>When calling in service registration mode, specify a DNS-SD
- service name (e.g. "Lennart's Files"), a service type
- (e.g. _http._tcp) and an IP port number for the service,
- optionally followed by any number of TXT record strings on the
- command line. When calling in address/host name registration
- mode specify a fully qualified host name and an address (IPv4 or
- IPv6).</p>
-
- <option>
- <p><opt>-s | --service</opt></p>
- <optdesc><p>Register a service. avahi-publish-service is equivalent to avahi-publish -s.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-a | --address</opt></p>
- <optdesc><p>Register an address/host name maping. avahi-publish-address is equivalent to avahi-publish -a.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --verbose</opt></p>
- <optdesc><p>Enable verbose mode.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-H | --host=</opt> <arg>HOSTNAME</arg></p>
- <optdesc><p>Specify a host name for this service, in case it
- doesn't reside on the local host. This host name needs to be
- fully qualified and resolvable using mDNS or unicast
- DNS.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-d | --domain=</opt> <arg>DOMAIN</arg></p>
- <optdesc><p>Publish the service in the specified domain. If
- omitted the Avahi daemon will publish it in its default domain
- (usually .local).</p></optdesc>
- </option>
-
- <option>
- <p><opt>--subtype=</opt> <arg>SUBTYPE</arg></p>
- <optdesc><p>Register the service with an additional subtype in
- addition to the main type. DNS-SD subtypes have the form
- _anon._sub._ftp._tcp, where _anon is the identifier of the
- subtype and _ftp._tcp is the main type. You may pass this
- option multiple times to register the service with multiple
- subtypes.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-f | --no-fail</opt></p>
- <optdesc><p>Don't fail if the daemon is not found running. Instead, wait until it appears. If it disconnects, try to reconnect.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help</p></optdesc>
- </option>
-
- <option>
- <p><opt>-V | --version</opt></p>
- <optdesc><p>Show version information.</p></optdesc>
- </option>
-
- </options>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-resolve" section="1"/>, <manref
- name="avahi-browse" section="1"/>, <manref
- name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi-resolve.1.xml.in b/trunk/man/avahi-resolve.1.xml.in
deleted file mode 100644
index dbfccc0..0000000
--- a/trunk/man/avahi-resolve.1.xml.in
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi-resolve" section="1" desc="Resolve one or more mDNS/DNS host name(s) to IP address(es) (and vice versa) using the Avahi daemon">
-
- <synopsis>
- <cmd>avahi-resolve --name <arg>host-name ...</arg></cmd>
- <cmd>avahi-resolve-host-name <arg>host-name ...</arg></cmd>
- <cmd>avahi-resolve --address <arg>address ...</arg></cmd>
- <cmd>avahi-resolve-address <arg>address ...</arg></cmd>
- </synopsis>
-
- <description>
- <p>Resolve one or more mDNS/DNS host name(s) to IP address(es) (and vice versa) using the Avahi daemon.</p>
- </description>
-
- <options>
-
- <p>When passing -n, specify one or more fully qualified mDNS/DNS host name(s)
- (e.g. "foo.local") to resolve into IP addresses on the
- command line. When passing -a, specifiy one or more IP address
- to resolve into host names.</p>
-
- <p>avahi-resolve-host-name is equivalent to avahi-resolve --name.</p>
-
- <p>avahi-resolve-address is equivalent to avahi-resolve --address.</p>
-
- <option>
- <p><opt>-n | --name</opt></p>
- <optdesc><p>Translate one or more fully qualified host names into addresses.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-a | --address</opt></p>
- <optdesc><p>Translate one or more addresses into fully qualified host names.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-v | --verbose</opt></p>
- <optdesc><p>Enable verbose mode.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-6</opt></p>
- <optdesc><p>When resolving a host name, look for IPv6 addresses exclusively.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-4</opt></p>
- <optdesc><p>When resolving a host name, look for IPv4 addresses exclusively.</p></optdesc>
- </option>
-
- <option>
- <p><opt>-h | --help</opt></p>
- <optdesc><p>Show help.</p></optdesc>
- </option>
-
-
- <option>
- <p><opt>-V | --version</opt></p>
- <optdesc><p>Show version information.</p></optdesc>
- </option>
-
-
- </options>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-publish-address" section="1"/>,
- <manref
- name="avahi-daemon" section="8"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man" section="1"
- href="http://masqmail.cx/xml2man/"/> by Oliver Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi.hosts.5.xml.in b/trunk/man/avahi.hosts.5.xml.in
deleted file mode 100644
index 5a92547..0000000
--- a/trunk/man/avahi.hosts.5.xml.in
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi.hosts" section="5" desc="avahi-daemon static host name file">
-
- <synopsis>
- <cmd>@pkgsysconfdir@/hosts</cmd>
- </synopsis>
-
- <description>
- <p><file>@pkgsysconfdir@/hosts</file> is a file which may be used
- to define static host name to IP address mappings for multicast
- DNS. This is especially useful when publishing DNS-SD services
- on behalf of other hosts. See <manref name="avahi.service"
- section="5"/> for more information.</p>
-
- <p>The file format is similar to the one of
- <file>/etc/hosts</file>: on each line an IP address and the
- corresponding host name. The host names should be in FQDN form,
- i.e. with appended .local suffix.</p>
- </description>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi.service" section="5"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man"
- section="1" href="http://masqmail.cx/xml2man/"/> by Oliver
- Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/avahi.service.5.xml.in b/trunk/man/avahi.service.5.xml.in
deleted file mode 100644
index aeaeb05..0000000
--- a/trunk/man/avahi.service.5.xml.in
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0"?><!--*-nxml-*-->
-<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
-<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
--->
-
- <manpage name="avahi.service" section="5" desc="avahi-daemon static service file">
-
- <synopsis>
- <cmd>@servicedir@/*.service</cmd>
- </synopsis>
-
- <description> <p><file>@servicedir@/*.service</file> are XML
- fragments containing static DNS-SD service data. Every service
- file can contain multiple service definitions which share the
- same name. This is useful for publishing service data for
- services which implement multiple protocols. (i.e. a printer
- implementing _ipp._tcp and _printer.tcp)</p> </description>
-
- <section name="XML Tags">
-
- <option>
- <p><opt>&lt;service-group&gt;</opt> The document tag of avahi
- service files. Should contain one <opt>&lt;name&gt;</opt> and one or more
- <opt>&lt;service&gt;</opt> elements.</p>
- </option>
-
- <option>
- <p><opt>&lt;name replace-wildcards="yes|no"&gt;</opt> The
- service name. If <opt>replace-wildcards</opt> is "yes", any
- occurence of the string "%h" will be replaced by the local
- host name. This can be used for service names like "Remote
- Terminal on %h". If <opt>replace-wildcards</opt> is not
- specified, defaults to "no".</p>
- </option>
-
- <option>
- <p><opt>&lt;service protocol="ipv4|ipv6|any"&gt;</opt>
- Contains the service information for exactly one service
- type. Should contain one <opt>&lt;type&gt;</opt> and one
- <opt>&lt;port&gt;</opt> element. Optionally it may contain one
- <opt>&lt;domain-name&gt;</opt>, one
- <opt>&lt;host-name&gt;</opt>, any number of
- <opt>&lt;subtype&gt;</opt> and any number of
- <opt>&lt;txt-record&gt;</opt> elements. The attribute
- <opt>protocol</opt> specifies the protocol to advertise the
- service on. If <opt>any</opt> is used (which is the default),
- the service will be advertised on both IPv4 and IPv6.</p>
- </option>
-
- <option>
- <p><opt>&lt;type&gt;</opt> Contains the DNS-SD service type for this service. e.g. "_http._tcp".</p>
- </option>
-
- <option>
- <p><opt>&lt;subtype&gt;</opt> Contains an additional DNS-SD service subtype for this service. e.g. "_anon._sub._ftp._tcp".</p>
- </option>
-
- <option>
- <p><opt>&lt;domain-name&gt;</opt> The domain name this service
- should be registered. If omited defaults to the default domain
- of the avahi daemon. (probably .local)</p>
- </option>
-
- <option>
- <p><opt>&lt;host-name&gt;</opt> The host name of the host that
- provides this service. This should be a host that is
- resolvable by multicast or unicast DNS. Please note that you
- need to specify a fully-qualified domain name (FQDN) here,
- i.e. .local is not appended implicitly! The host name doesn't
- need to be part of the domain specified in
- <opt>&lt;domain-name&gt;</opt>. See <manref name="avahi.hosts"
- section="5"/> for more information how to publish additional
- host name mappings.</p>
- </option>
-
- <option>
- <p><opt>&lt;port&gt;</opt> The IP port number the service listens on.</p>
- </option>
-
- <option>
- <p><opt>&lt;txt-record&gt;</opt> DNS-SD TXT record data.</p>
- </option>
-
-
- </section>
-
- <section name="Authors">
- <p>The Avahi Developers &lt;@PACKAGE_BUGREPORT@&gt;; Avahi is
- available from <url href="@PACKAGE_URL@"/></p>
- </section>
-
- <section name="See also">
- <p>
- <manref name="avahi-daemon" section="8"/>, <manref name="avahi.hosts" section="5"/>
- </p>
- </section>
-
- <section name="Comments">
- <p>This man page was written using <manref name="xml2man"
- section="1" href="http://masqmail.cx/xml2man/"/> by Oliver
- Kurth.</p>
- </section>
-
- </manpage>
diff --git a/trunk/man/xmltoman.css b/trunk/man/xmltoman.css
deleted file mode 100644
index 4c80847..0000000
--- a/trunk/man/xmltoman.css
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-***/
-
-body { color: black; background-color: white; }
-a:link, a:visited { color: #900000; }
-h1 { text-transform:uppercase; font-size: 18pt; }
-p { margin-left:1cm; margin-right:1cm; }
-.cmd { font-family:monospace; }
-.file { font-family:monospace; }
-.arg { text-transform:uppercase; font-family:monospace; font-style: italic; }
-.opt { font-family:monospace; font-weight: bold; }
-.manref { font-family:monospace; }
-.option .optdesc { margin-left:2cm; }
diff --git a/trunk/man/xmltoman.dtd b/trunk/man/xmltoman.dtd
deleted file mode 100644
index 50158dc..0000000
--- a/trunk/man/xmltoman.dtd
+++ /dev/null
@@ -1,39 +0,0 @@
-<!-- $Id$ -->
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
--->
-
-<!ELEMENT manpage (synopsis | description | section | options | seealso)*>
-<!ATTLIST manpage name CDATA #REQUIRED section CDATA #REQUIRED desc CDATA #IMPLIED>
-<!ELEMENT arg (#PCDATA)>
-<!ELEMENT p (#PCDATA | arg | url | manref | opt | file )*>
-<!ELEMENT synopsis (cmd | p)+>
-<!ELEMENT description (p)+>
-<!ELEMENT section (p | option)*>
-<!ATTLIST section name CDATA #REQUIRED>
-<!ELEMENT option (#PCDATA | p | optdesc)*>
-<!ELEMENT optdesc (#PCDATA | p )*>
-<!ELEMENT cmd (#PCDATA | arg | opt)*>
-<!ELEMENT options (p | option)*>
-<!ELEMENT seealso (p)*>
-<!ELEMENT opt (#PCDATA)>
-<!ELEMENT file (#PCDATA)>
-<!ELEMENT manref EMPTY>
-<!ATTLIST manref name CDATA #REQUIRED section CDATA #REQUIRED href CDATA #IMPLIED>
-<!ELEMENT url EMPTY>
-<!ATTLIST url href CDATA #REQUIRED>
diff --git a/trunk/man/xmltoman.xsl b/trunk/man/xmltoman.xsl
deleted file mode 100644
index 96c9d81..0000000
--- a/trunk/man/xmltoman.xsl
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-15"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
-
-<!--
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with avahi; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
--->
-
-<!-- $Id$ -->
-
-<xsl:output method="xml" version="1.0" encoding="iso-8859-15" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
-
-<xsl:template match="/manpage">
-
- <html>
-
- <head>
- <title><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</title>
- <style type="text/css">
- body { color: black; background-color: white; }
- a:link, a:visited { color: #900000; }
- h1 { text-transform:uppercase; font-size: 18pt; }
- p { margin-left:1cm; margin-right:1cm; }
- .cmd { font-family:monospace; }
- .file { font-family:monospace; }
- .arg { text-transform:uppercase; font-family:monospace; font-style: italic; }
- .opt { font-family:monospace; font-weight: bold; }
- .manref { font-family:monospace; }
- .option .optdesc { margin-left:2cm; }
- </style>
- </head>
- <body>
- <h1>Name</h1>
- <p><xsl:value-of select="@name"/>
- <xsl:if test="string-length(@desc) &gt; 0"> - <xsl:value-of select="@desc"/></xsl:if>
- </p>
- <xsl:apply-templates />
- </body>
- </html>
-</xsl:template>
-
-<xsl:template match="p">
- <p>
- <xsl:apply-templates/>
- </p>
-</xsl:template>
-
-<xsl:template match="cmd">
- <p class="cmd">
- <xsl:apply-templates/>
- </p>
-</xsl:template>
-
-<xsl:template match="arg">
- <span class="arg"><xsl:apply-templates/></span>
-</xsl:template>
-
-<xsl:template match="opt">
- <span class="opt"><xsl:apply-templates/></span>
-</xsl:template>
-
-<xsl:template match="file">
- <span class="file"><xsl:apply-templates/></span>
-</xsl:template>
-
-<xsl:template match="optdesc">
- <div class="optdesc">
- <xsl:apply-templates/>
- </div>
-</xsl:template>
-
-<xsl:template match="synopsis">
- <h1>Synopsis</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="seealso">
- <h1>Synopsis</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="description">
- <h1>Description</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="options">
- <h1>Options</h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="section">
- <h1><xsl:value-of select="@name"/></h1>
- <xsl:apply-templates/>
-</xsl:template>
-
-<xsl:template match="option">
- <div class="option"><xsl:apply-templates/></div>
-</xsl:template>
-
-<xsl:template match="manref">
- <xsl:choose>
- <xsl:when test="string-length(@href) &gt; 0">
- <a class="manref"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</a>
- </xsl:when>
- <xsl:otherwise>
- <span class="manref"><xsl:value-of select="@name"/>(<xsl:value-of select="@section"/>)</span>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template match="url">
- <a class="url"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@href"/></a>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/trunk/service-type-database/Makefile.am b/trunk/service-type-database/Makefile.am
deleted file mode 100644
index d25f1a2..0000000
--- a/trunk/service-type-database/Makefile.am
+++ /dev/null
@@ -1,59 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-EXTRA_DIST=build-db.in service-types
-
-pkgdata_DATA=service-types
-
-if HAVE_PYTHON
-if HAVE_GDBM
-
-noinst_SCRIPTS=build-db
-pkgdata_DATA+=service-types.db
-
-build-db: build-db.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,gdbm,g' $< > $@
- chmod +x $@
-
-service-types.db: service-types build-db
- $(PYTHON) build-db $(srcdir)/$< $@
-
-CLEANFILES = service-types.db build-db
-
-endif
-if HAVE_DBM
-
-noinst_SCRIPTS=build-db
-pkgdata_DATA+=service-types.db.pag service-types.db.dir
-
-build-db: build-db.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,dbm,g' $< > $@
- chmod +x $@
-
-service-types.db.pag: service-types.db
-service-types.db.dir: service-types.db
-service-types.db: service-types build-db
- $(PYTHON) build-db $(srcdir)/$< $@
-
-CLEANFILES = service-types.db* build-db
-
-endif
-endif
diff --git a/trunk/service-type-database/build-db.in b/trunk/service-type-database/build-db.in
deleted file mode 100755
index 44f6068..0000000
--- a/trunk/service-type-database/build-db.in
+++ /dev/null
@@ -1,46 +0,0 @@
-#!@PYTHON@
-# -*-python-*-
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import @DBM@, sys
-
-if len(sys.argv) > 1:
- infn = sys.argv[1]
-else:
- infn = "service-types"
-
-if len(sys.argv) > 2:
- outfn = sys.argv[2]
-else:
- outfn = infn + ".db"
-
-db = @DBM@.open(outfn, "n")
-
-for ln in file(infn, "r"):
- ln = ln.strip(" \r\n\t")
-
- if ln == "" or ln.startswith("#"):
- continue
-
- t, n = ln.split(":", 1)
-
- db[t.strip()] = n.strip()
-
-db.close()
diff --git a/trunk/service-type-database/service-types b/trunk/service-type-database/service-types
deleted file mode 100644
index e501072..0000000
--- a/trunk/service-type-database/service-types
+++ /dev/null
@@ -1,136 +0,0 @@
-# $Id$
-
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-# Feel free to add more service types or translatons to this database.
-# Please refrain from copying bulk service type data from any publicly
-# available database unless its license is known and compatible with
-# our project! The database available on
-#
-# http://www.dns-sd.org/ServiceTypes.html
-#
-# is not a source that complies with the criterion!
-
-### This list is NOT intended to be used as developer
-### documentation. If you're looking for the correct service type to
-### use for your application please refer to the URL mentioned above.
-
-_http._tcp:Web Site
-_http._tcp[de]:Web-Angebot
-
-_https._tcp:Secure Web Site
-_https._tcp[de]:Sicheres Web-Angebot
-
-_ftp._tcp:FTP File Transfer
-_ftp._tcp[de]:FTP Dateifreigabe
-
-_h323._tcp:H.323 Telephony
-_h323._tcp[de]:H.323 Telefonie
-
-_sip._udp:SIP Telephony
-_sip._udp[de]:SIP Telefonie
-
-_ssh._tcp:SSH Remote Terminal
-_ssh._tcp[de]:SSH Fernzugriff
-
-_distcc._tcp:Distributed Compiler
-_distcc._tcp[de]:Verteilter Compiler
-
-_daap._tcp:iTunes Audio Access
-_daap._tcp[de]:iTunes Audio-Zugriff
-
-_domain._udp:DNS Server
-_domain._udp[de]: DNS Dienst
-
-_imap._tcp:IMAP Mail Access
-
-_pop3._tcp:POP3 Mail Access
-
-_rfb._tcp:VNC Remote Access
-
-_sftp-ssh._tcp:SFTP File Transfer
-
-_telnet._tcp:Telnet Remote Terminal
-
-_presence._tcp:iChat Presence
-
-_webdav._tcp:WebDAV File Share
-
-_webdavs._tcp:Secure WebDAV File Share
-
-_workstation._tcp:Workstation
-_workstation._tcp[de]:Arbeitsplatzrechner
-
-_printer._tcp:UNIX Printer
-
-_afpovertcp._tcp:Apple File Sharing
-
-_pdl-datastream._tcp:PDL Printer
-
-_ipp._tcp:Internet Printer
-
-_rss._tcp:Web Syndication RSS
-
-_dacp._tcp:iTunes Remote Control
-
-_realplayfavs._tcp:RealPlayer Shared Favorites
-
-_timbuktu._tcp:Timbuktu Remote Desktop Control
-
-_see._tcp:SubEthaEdit Collaborative Text Editor
-
-_postgresql._tcp:PostgreSQL Server
-
-_ksysguard._tcp:KDE System Guard
-
-_omni-bookmark._tcp:OmniWeb Bookmark Sharing
-
-_MacOSXDupSuppress._tcp:MacOS X Duplicate Machine Suppression
-
-_lobby._tcp:Gobby Collaborative Editor Session
-
-_dpap._tcp:Digital Photo Sharing
-
-_skype._tcp:Skype VoIP
-
-_airport._tcp:Apple AirPort
-
-_pulse-server._tcp:PulseAudio Sound Server
-_pulse-sink._tcp:PulseAudio Sound Sink
-_pulse-source._tcp:PulseAudio Sound Source
-
-_mpd._tcp:Music Player Daemon
-_smb._tcp:Microsoft Windows Network
-
-_pgpkey-hkp._tcp:GnuPG/PGP HKP Key Server
-
-_ldap._tcp:LDAP Directory Server
-
-_iax._udp:Asterisk Exchange
-
-_nfs._tcp:Network File System
-
-_ntp._udp:NTP Time Server
-
-_raop._tcp:AirTunes Remote Audio
-
-_rtsp._tcp:RTSP Realtime Streaming Server
-_rtp._udp:RTP Realtime Streaming Server
-
-_svn._tcp:Subversion Revision Control
-
diff --git a/trunk/specs/draft-cheshire-dnsext-dns-sd-02.txt b/trunk/specs/draft-cheshire-dnsext-dns-sd-02.txt
deleted file mode 100644
index bebc28d..0000000
--- a/trunk/specs/draft-cheshire-dnsext-dns-sd-02.txt
+++ /dev/null
@@ -1,1798 +0,0 @@
-Document: draft-cheshire-dnsext-dns-sd-02.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 14th August 2004 Marc Krochmal
- Apple Computer, Inc.
- 14th February 2004
-
- DNS-Based Service Discovery
-
- <draft-cheshire-dnsext-dns-sd-02.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 1]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-Table of Contents
-
- 1. Introduction....................................................3
- 2. Conventions and Terminology Used in this Document...............3
- 3. Design Goals....................................................4
- 4. Service Instance Enumeration....................................5
- 4.1 Structured Instance Names.......................................5
- 4.2 User Interface Presentation.....................................7
- 4.3 Internal Handling of Names......................................7
- 4.4 What You See Is What You Get....................................7
- 4.5 Ordering of Service Instance Name Components....................9
- 5. Service Name Resolution........................................11
- 6. Data Syntax for DNS-SD TXT Records.............................12
- 6.1 General Format Rules for DNS TXT Records.......................12
- 6.2 DNS TXT Record Format Rules for use in DNS-SD..................12
- 6.3 DNS-SD TXT Record Size.........................................14
- 6.4 Rules for Names in DNS-SD Name/Value Pairs.....................14
- 6.5 Rules for Values in DNS-SD Name/Value Pairs....................16
- 6.6 Example TXT Record.............................................16
- 6.7 Version Tag....................................................17
- 7. Application Protocol Names.....................................18
- 8. Selective Instance Enumeration.................................19
- 9. Flagship Naming................................................10
- 10. Service Type Enumeration.......................................21
- 11. Populating the DNS with Information............................22
- 12. Relationship to Multicast DNS..................................22
- 13. Discovery of Browsing and Registration Domains.................23
- 14. DNS Additional Record Generation...............................24
- 15. Comparison with Alternative Service Discovery Protocols........25
- 16. Real Example...................................................27
- 17. IPv6 Considerations............................................28
- 18. Security Considerations........................................28
- 19. IANA Considerations............................................28
- 20. Acknowledgements...............................................29
- 21. Copyright......................................................29
- 22. Normative References...........................................30
- 23. Informative References.........................................30
- 24. Author's Addresses.............................................31
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 2]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-1. Introduction
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of a that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, resource record types,
- or any other new DNS protocol values. This document simply proposes
- a convention for how existing resource record types can be named and
- structured to facilitate service discovery.
-
- This proposal is entirely compatible with today's existing unicast
- DNS server and client software.
-
- Note that the DNS-SD service does NOT have to be provided by the same
- DNS server hardware that is currently providing an organization's
- conventional host name lookup service (the service we traditionally
- think of when we say "DNS"). By delegating the "_tcp" subdomain, all
- the workload related to DNS-SD can be offloaded to a different
- machine. This flexibility, to handle DNS-SD on the main DNS server,
- or not, at the network administrator's discretion, is one of the
- things that makes DNS-SD so compelling.
-
- Even when the DNS-SD functions are delegated to a different machine,
- the benefits of using DNS remain: It is mature technology, well
- understood, with multiple independent implementations from different
- vendors, a wide selection of books published on the subject, and an
- established workforce experienced in its operation. In contrast,
- adopting some other service discovery technology would require every
- site in the world to install, learn, configure, operate and maintain
- some entirely new and unfamiliar server software. Faced with these
- obstacles, it seems unlikely that any other service discovery
- technology could hope to compete with the ubiquitous deployment
- that DNS already enjoys.
-
- This proposal is also compatible with (but not dependent on) the
- proposal outlined in "Multicast DNS" [mDNS].
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 3]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-3. Design Goals
-
- A good service discovery protocol needs to have many properties,
- three of which are mentioned below:
-
- (i) The ability to query for services of a certain type in a certain
- logical domain and receive in response a list of named instances
- (network browsing, or "Service Instance Enumeration").
-
- (ii) Given a particular named instance, the ability to efficiently
- resolve that instance name to the required information a client needs
- to actually use the service, i.e. IP address and port number, at the
- very least (Service Name Resolution).
-
- (iii) Instance names should be relatively persistent. If a user
- selects their default printer from a list of available choices today,
- then tomorrow they should still be able to print on that printer --
- even if the IP address and/or port number where the service resides
- have changed -- without the user (or their software) having to repeat
- the network browsing step a second time.
-
- In addition, if it is to become successful, a service discovery
- protocol should be so simple to implement that virtually any
- device capable of implementing IP should not have any trouble
- implementing the service discovery software as well.
-
- These goals are discussed in more detail in the remainder of this
- document. A more thorough treatment of service discovery requirements
- may be found in "Requirements for a Protocol to Replace AppleTalk
- NBP" [NBP]. That document draws upon examples from two decades of
- operational experience with AppleTalk Name Binding Protocol to
- develop a list of universal requirements which are broadly applicable
- to any potential service discovery protocol.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 4]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-4. Service Instance Enumeration
-
- DNS SRV records [RFC 2782] are useful for locating instances of a
- particular type of service when all the instances are effectively
- indistinguishable and provide the same service to the client.
-
- For example, SRV records with the (hypothetical) name
- "_http._tcp.example.com." would allow a client to discover a list of
- all servers implementing the "_http._tcp" service (i.e. Web servers)
- for the "example.com." domain. The unstated assumption is that all
- these servers offer an identical set of Web pages, and it doesn't
- matter to the client which of the servers it uses, as long as it
- selects one at random according to the weight and priority rules laid
- out in RFC 2782.
-
- Instances of other kinds of service are less easily interchangeable.
- If a word processing application were to look up the (hypothetical)
- SRV record "_ipp._tcp.example.com." to find the list of IPP printers
- at Example Co., then picking one at random and printing on it would
- probably not be what the user wanted.
-
- The remainder of this section describes how SRV records may be used
- in a slightly different way to allow a user to discover the names
- of all available instances of a given type of service, in order to
- select the particular instance the user desires.
-
-
-4.1 Structured Instance Names
-
- This document borrows the logical service naming syntax and semantics
- from DNS SRV records, but adds one level of indirection. Instead of
- requesting records of type "SRV" with name "_ipp._tcp.example.com.",
- the client requests records of type "PTR" (pointer from one name to
- another in the DNS namespace).
-
- In effect, if one thinks of the domain name "_ipp._tcp.example.com."
- as being analogous to an absolute path to a directory in a file
- system then the PTR lookup is akin to performing a listing of that
- directory to find all the files it contains. (Remember that domain
- names are expressed in reverse order compared to path names: An
- absolute path name is read from left to right, beginning with a
- leading slash on the left, and then the top level directory, then the
- next level directory, and so on. A fully-qualified domain name is
- read from right to left, beginning with the dot on the right -- the
- root label -- and then the top level domain to the left of that, and
- the second level domain to the left of that, and so on. If the fully-
- qualified domain name "_ipp._tcp.example.com." were expressed as a
- file system path name, it would be "/com/example/_tcp/_ipp".)
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 5]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The result of this PTR lookup for the name "<Service>.<Domain>" is a
- list of zero or more PTR records giving Service Instance Names of the
- form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- The <Instance> portion of the Service Instance Name is a single DNS
- label, containing arbitrary UTF-8-encoded text [RFC 2279]. It is a
- user-friendly name, meaning that it is allowed to contain any
- characters, without restriction, including spaces, upper case, lower
- case, punctuation -- including dots -- accented characters, non-roman
- text, and anything else that may be represented using UTF-8.
- DNS recommends guidelines for allowable characters for host names
- [RFC 1033][RFC 1034][RFC 1035], but Service Instance Names are not
- host names. Service Instance Names are not intended to ever be typed
- in by a normal user; the user selects a Service Instance Name by
- selecting it from a list of choices presented on the screen.
-
- Note that just because this protocol supports arbitrary UTF-8-encoded
- names doesn't mean that any particular user or administrator is
- obliged to make use of that capability. Any user is free, if they
- wish, to continue naming their services using only letters, digits
- and hyphens, with no spaces, capital letters, or other punctuation.
-
- DNS labels are currently limited to 63 octets in length. UTF-8
- encoding can require up to four octets per Unicode character, which
- means that in the worst case, the <Instance> portion of a name could
- be limited to fifteen Unicode characters. However, the Unicode
- characters with longer UTF-8 encodings tend to be the more obscure
- ones, and tend to be the ones that convey greater meaning per
- character.
-
- Note that any character in the commonly-used 16-bit Unicode space can
- be encoded with no more than three octets of UTF-8 encoding. This
- means that an Instance name can contain up to 21 Kanji characters,
- which is a sufficiently expressive name for most purposes.
-
- The <Service> portion of the Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the service pair is the
- application protocol name, as recorded in the IANA list of assigned
- application protocol names and port numbers [ports]. The second label
- of the service pair is either "_tcp" or "_udp", depending on the
- transport protocol used by the application.
-
- The <Domain> portion of the Service Instance Name is a conventional
- DNS domain name, consisting of as many labels as appropriate. For
- example, "apple.com.", "cs.stanford.edu.", and "eng.us.ibm.com." are
- all valid domain names for the <Domain> portion of the Service
- Instance Name.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 6]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-4.2 User Interface Presentation
-
- The names resulting from the PTR lookup are presented to the user in
- a list for the user to select one (or more). Typically only the first
- label is shown (the user-friendly <Instance> portion of the name). In
- the common case, the <Service> and <Domain> are already known to the
- user, these having been provided by the user in the first place, by
- the act of indicating the service being sought, and the domain in
- which to look for it. Note: The software handling the response
- should be careful not to make invalid assumptions though, since it
- *is* possible, though rare, for a service enumeration in one domain
- to return the names of services in a different domain. Similarly,
- when using subtypes (see "Selective Instance Enumeration") the
- <Service> of the discovered instance my not be exactly the same as
- the <Service> that was requested.
-
- Having chosen the desired named instance, the Service Instance Name
- may then be used immediately, or saved away in some persistent
- user-preference data structure for future use, depending on what is
- appropriate for the application in question.
-
-
-4.3 Internal Handling of Names
-
- If the <Instance>, <Service> and <Domain> portions are internally
- concatenated together into a single string, then care must be taken
- with the <Instance> portion, since it is allowed to contain any
- characters, including dots.
-
- Any dots in the <Instance> portion should be escaped by preceeding
- them with a backslash ("." becomes "\."). Likewise, any backslashes
- in the <Instance> portion should also be escaped by preceeding them
- with a backslash ("\" becomes "\\"). Having done this, the three
- components of the name may be safely concatenated. The
- backslash-escaping allows literal dots in the name (escaped) to be
- distinguished from label-separator dots (not escaped).
-
- The resulting concatenated string may be safely passed to standard
- DNS APIs like res_query(), which will interpret the string correctly
- provided it has been escaped correctly, as described here.
-
-
-4.4 What You See Is What You Get
-
- Some service discovery protocols decouple the true service identifier
- from the name presented to the user. The true service identifier used
- by the protocol is an opaque unique id, often represented using a
- long string of hexadecimal digits, and should never be seen by the
- typical user. The name presented to the user is merely one of the
- ephemeral attributes attached to this opaque identifier.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 7]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The problem with this approach is that it decouples user perception
- from reality:
-
- * What happens if there are two service instances, with different
- unique ids, but they have inadvertently been given the same
- user-visible name? If two instances appear in an on-screen list
- with the same name, how does the user know which is which?
-
- * Suppose a printer breaks down, and the user replaces it with
- another printer of the same make and model, and configures the new
- printer with the exact same name as the one being replaced:
- "Stuart's Printer". Now, when the user tries to print, the
- on-screen print dialog tells them that their selected default
- printer is "Stuart's Printer". When they browse the network to see
- what is there, they see a printer called "Stuart's Printer", yet
- when the user tries to print, they are told that the printer
- "Stuart's Printer" can't be found. The hidden internal unique id
- that the software is trying to find on the network doesn't match
- the hidden internal unique id of the new printer, even though its
- apparent "name" and its logical purpose for being there are the
- same. To remedy this, the user typically has to delete the print
- queue they have created, and then create a new (apparently
- identical) queue for the new printer, so that the new queue will
- contain the right hidden internal unique id. Having all this hidden
- information that the user can't see makes for a confusing and
- frustrating user experience, and exposing long ugly hexadecimal
- strings to the user and forcing them to understand what they mean
- is even worse.
-
- * Suppose an existing printer is moved to a new department, and given
- a new name and a new function. Changing the user-visible name of
- that piece of hardware doesn't change its hidden internal unique
- id. Users who had previously created print queues for that printer
- will still be accessing the same hardware by its unique id, even
- though the logical service that used to be offered by that hardware
- has ceased to exist.
-
- To solve these problems requires the user or administrator to be
- aware of the supposedly hidden unique id, and to set its value
- correctly as hardware is moved around, repurposed, or replaced,
- thereby contradicting the notion that it is a hidden identifier that
- human users never need to deal with. Requiring the user to unserstand
- this expert behind-the-scenes knowledge of what is *really* going on
- is just one more burden placed on the user when they are trying to
- diagnose why their computers and network devices are not working as
- expected.
-
- These anomalies and counter-intuitive behaviours can be eliminated by
- maintaining a tight bidirectional one-to-one mapping between what the
- user sees on the screen and what is really happening "behind the
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 8]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- curtain". If something is configured incorrectly, then that is
- apparent in the familiar day-to-day user interface that everyone
- understands, not in some little-known rarely-used "expert" interface.
-
- In summary: The user-visible name is the primary identifier for a
- service. If the user-visible name is changed, then conceptually the
- service being offered is a different logical service -- even though
- the hardware offering the service stayed the same. If the
- user-visible name doesn't change, then conceptually the service being
- offered is the same logical service -- even if the hardware offering
- the service is new hardware brought in to replace some old equipment.
-
- There are certainly arguments on both sides of this debate.
- Nonetheless, the designers of any service discovery protocol have
- to make a choice between between having the primary identifiers be
- hidden, or having them be visible, and these are the reasons that we
- chose to make them visible. We're not claiming that there are no
- disadvantages of having primary identifiers be visible. We considered
- both alternatives, and we believe that the few disadvantages
- of visible identifiers are far outweighed by the many problems
- caused by use of hidden identifiers.
-
-
-4.5 Ordering of Service Instance Name Components
-
- There have been questions about why services are named using DNS
- Service Instance Names of the form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- instead of:
-
- Service Instance Name = <Service> . <Instance> . <Domain>
-
- There are three reasons why it is beneficial to name service
- instances with the parent domain as the most-significant (rightmost)
- part of the name, then the abstract service type as the nextmost
- significant, and then the specific instance name as the
- least-significant (leftmost) part of the name:
-
-
-4.5.1. Semantic Structure
-
- The facility being provided by browsing ("Service Instance
- Enumeration") is effectively enumerating the leaves of a tree
- structure. A given domain offers zero or more services. For each of
- those service types, there may be zero or more instances of that
- service.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 9]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The user knows what type of service they are seeking. (If they are
- running an FTP client, they are looking for FTP servers. If they have
- a document to print, they are looking for entities that speak some
- known printing protocol.) The user knows in which organizational or
- geographical domain they wish to search. (The user does not want a
- single flat list of every single printer on the planet, even if such
- a thing were possible.) What the user does not know in advance is
- whether the service they seek is offered in the given domain, or if
- so, how many instances are offered, and the names of those instances.
- Hence having the instance names be the leaves of the tree is
- consistent with this semantic model.
-
- Having the service types be the terminal leaves of the tree would
- imply that the user knows the domain name, and already knows the
- name of the service instance, but doesn't have any idea what the
- service does. We would argue that this is a less useful model.
-
-
-4.5.2. Network Efficiency
-
- When a DNS response contains multiple answers, name compression works
- more effectively if all the names contain a common suffix. If many
- answers in the packet have the same <Service> and <Domain>, then each
- occurrence of a Service Instance Name can be expressed using only the
- <Instance> part followed by a two-byte compression pointer
- referencing a previous appearance of "<Service>.<Domain>". This
- efficiency would not be possible if the <Service> component appeared
- first in each name.
-
-
-4.5.3. Operational Flexibility
-
- This name structure allows subdomains to be delegated along logical
- service boundaries. For example, the network administrator at Example
- Co. could choose to delegate the "_tcp.example.com." subdomain to a
- different machine, so that the machine handling service discovery
- doesn't have to be the same as the machine handling other day-to-day
- DNS operations. (It *can* be the same machine if the administrator so
- chooses, but the point is that the administrator is free to make that
- choice.) Furthermore, if the network administrator wishes to delegate
- all information related to IPP printers to a machine dedicated to
- that specific task, this is easily done by delegating the
- "_ipp._tcp.example.com." subdomain to the desired machine. It is also
- convenient to set security policies on a per-zone/per-subdomain
- basis. For example, the administrator may choose to enable DNS
- Dynamic Update [RFC 2136] [RFC 3007] for printers registering in the
- "_ipp._tcp.example.com." subdomain, but not for other
- zones/subdomains. This easy flexibility would not exist if the
- <Service> component appeared first in each name.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 10]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-5. Service Name Resolution
-
- Given a particular Service Instance Name, when a client needs to
- contact that service, it sends a DNS query for the SRV record of
- that name.
-
- The result of the DNS query is a SRV record giving the port number
- and target host where the service may be found.
-
- The use of SRV records is very important. There are only 65535 TCP
- port numbers available. These port numbers are being allocated
- one-per-application-protocol at an alarming rate. Some protocols like
- the X Window System have a block of 64 TCP ports allocated
- (6000-6063). If we start allocating blocks of 64 TCP ports at a time,
- we will run out even faster. Using a different TCP port for each
- different instance of a given service on a given machine is entirely
- sensible, but allocating large static ranges, as was done for X, is a
- very inefficient way to manage a limited resource. On any given host,
- most TCP ports are reserved for services that will never run on that
- particular host. This is very poor utilization of the limited port
- space. Using SRV records allows each host to allocate its available
- port numbers dynamically to those services running on that host that
- need them, and then advertise the allocated port numbers via SRV
- records. Allocating the available listening port numbers locally
- on a per-host basis as needed allows much better utilization of the
- available port space than today's centralized global allocation.
-
- In some environments there may be no compelling reason to assign
- managed names to every host, since every available service is
- accessible by name anyway, as a first-class entity in its own right.
- However, the DNS packet format and record format still require a host
- name to link the target host referenced in the SRV record to the
- address records giving the IPv4 and/or IPv6 addresses for that
- hardware. In the case where no natural host name is available, the
- SRV record may give its own name as the name of the target host, and
- then the requisite address records may be attached to that same name.
- It is perfectly permissible for a single name in the DNS hierarchy to
- have multiple records of different type attached. (The only
- restriction being that a given name may not have both a CNAME record
- and other records at the same time.)
-
- In the event that more than one SRV is returned, clients MUST
- correctly interpret the priority and weight fields -- i.e. Lower
- numbered priority servers should be used in preference to higher
- numbered priority servers, and servers with equal priority should be
- selected randomly in proportion to their relative weights.
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 11]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6. Data Syntax for DNS-SD TXT Records
-
- Some services discovered via Service Instance Enumeration may need
- more than just an IP address and port number to properly identify the
- service. For example, printing via the LPR protocol often specifies a
- queue name. This queue name is typically short and cryptic, and need
- not be shown to the user. It should be regarded the same way as the
- IP address and port number -- it is one component of the addressing
- information required to identify a specific instance of a service
- being offered by some piece of hardware. Similarly, a file server may
- have multiple volumes, each identified by its own volume name. A Web
- server typically has multiple pages, each identified by its own URL.
- In these cases, the necessary additional data is stored in a TXT
- record with the same name as the SRV record. The specific nature of
- that additional data, and how it is to be used, is service-dependent,
- but the overall syntax of the data in the TXT record is standardized,
- as described below.
-
-
-6.1 General Format Rules for DNS TXT Records
-
- A DNS TXT record can be up to 65535 (0xFFFF) bytes long. The total
- length is indicated by the length given in the resource record header
- in the DNS message. There is no way to tell directly from the data
- alone how long it is (e.g. there is no length count at the start, or
- terminating NULL byte at the end). (Note that when using Multicast
- DNS [mDNS] the maximum packet size is 9000 bytes, which imposes an
- upper limit on the size of TXT records of about 8800 bytes.)
-
- The format of the data within a DNS TXT record is zero or more
- strings, packed together in memory without any intervening gaps or
- padding bytes for word alignment.
-
- The format of each constituent string within the DNS TXT record is a
- single length byte, followed by 0-255 bytes of text data.
-
- These format rules are defined in Section 3.3.14 of RFC 1035, and are
- not specific to DNS-SD. DNS-SD simply specifies a usage convention
- for what data should be stored in those constituent strings.
-
-
-6.2 DNS TXT Record Format Rules for use in DNS-SD
-
- DNS-SD uses DNS TXT records to store arbitrary name/value pairs
- conveying additional information about the named service. Each
- name/value pair is encoded as its own constituent string within the
- DNS TXT record, in the form "name=value". Everything up to the first
- '=' character is the name. Everything after the first '=' character
- to the end of the string (including subsequent '=' characters, if
- any) is the value. Specific rules governing names and values are
- given below. Each author defining a DNS-SD profile for discovering
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 12]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- instances of a particular type of service should define the base set
- of name/value attributes that are valid for that type of service.
-
- Using this standardized name/value syntax within the TXT record makes
- it easier for these base definitions to be expanded later by defining
- additional named attributes. If an implementation sees unknown
- attribute names in a service TXT record, it MUST silently ignore them.
-
- The TCP (or UDP) port number of the service, and target host name,
- are given in the SRV record. This information -- target host name and
- port number -- MUST NOT be duplicated using name/value attributes in
- the TXT record.
-
- The intention of DNS-SD TXT records is to convey a small amount of
- useful additional information about a service. Ideally it SHOULD NOT
- be necessary for a client to retrieve this additional information
- before it can usefully establish a connection to the service. For a
- well-designed TCP-based application protocol, it should be possible,
- knowing only the host name and port number, to open a connection to
- that listening process, and then perform version- or feature-
- negotiation to determine the capabilities of the service instance.
- For example, when connecting to an AppleShare server over TCP, the
- client enters into a protocol exchange with the server to determine
- which version of the AppleShare protocol the server implements, and
- which optional features or capabilities (if any) are available. For a
- well-designed application protocol, clients should be able to connect
- and use the service even if there is no information at all in the TXT
- record. In this case, the information in the TXT record should be
- viewed as a performance optimization -- when a client discovers many
- instances of a service, the TXT record allows the client to know some
- rudimentary information about each instance without having to open a
- TCP connection to each one and interrogate every service instance
- separately. Extreme care should be taken when doing this to ensure
- that the information in the TXT record is in agreement with the
- information retrieved by a client connecting over TCP.
-
- There are legacy protocols which provide no feature negotiation
- capability, and in these cases it may be useful to convey necessary
- information in the TXT record. For example, when printing using the
- old Unix LPR (port 515) protocol, the LPR service provides no way for
- the client to determine whether a particular printer accepts
- PostScript, or what version of PostScript, etc. In this case it is
- appropriate to embed this information in the TXT record, because the
- alternative is worse -- passing around written instructions to the
- users, arcane manual configuration of "/etc/printcap" files, etc.
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 13]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6.3 DNS-SD TXT Record Size
-
- The total size of a typical DNS-SD TXT record is intended to be small
- -- 200 bytes or less.
-
- In cases where more data is justified (e.g. LPR printing), keeping
- the total size under 400 bytes should allow it to fit in a single
- standard 512-byte DNS message. (This standard DNS message size is
- defined in RFC 1035.)
-
- In extreme cases where even this is not enough, keeping the size of
- the TXT record under 1300 bytes should allow it to fit in a single
- 1500-byte Ethernet packet.
-
- Using TXT records larger than 1300 bytes is NOT RECOMMENDED at this
- time.
-
-
-6.4 Rules for Names in DNS-SD Name/Value Pairs
-
- The "Name" MUST be at least one character. Strings beginning with an
- '=' character (i.e. the name is missing) SHOULD be silently ignored.
-
- The characters of "Name" MUST be printable US-ASCII values
- (0x20-0x7E), excluding '=' (0x3D).
-
- Spaces in the name are significant, whether leading, trailing, or in
- the middle -- so don't include any spaces unless you really intend
- that!
-
- Case is ignored when interpreting a name, so "papersize=A4",
- "PAPERSIZE=A4" and "Papersize=A4" are all identical.
-
- If there is no '=', then it is a boolean attribute, and is simply
- identified as being present, with no value.
-
- Unless specified otherwise by a particular DNS-SD profile, a given
- attribute name may appear at most once in a TXT record. If a client
- receives a TXT record containing the same attribute name more than
- once, then the client SHOULD silently ignore all but the first
- occurrence of that attribute. For client implementations that process
- a DNS-SD TXT record from start to end, placing name/value pairs into
- a hash table, using the name as the hash table key, this means that
- if the implementation attempts to add a new name/value pair into the
- table and finds an entry with the same name already present, then the
- new entry being added should be silently discarded instead. For
- client implementations that retrieve name/value pairs by searching
- the TXT record for the requested name, they should search the TXT
- record from the start, and simply return the first matching name they
- find.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 14]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- When examining a TXT record for a given named attribute, there are
- therefore four broad categories of results which may be returned:
-
- * Attribute not present (Absent)
-
- * Attribute present, with no value
- (e.g. "Anon Allowed" -- server allows anonymous connections)
-
- * Attribute present, with empty value (e.g. "Installed PlugIns=" --
- server supports plugins, but none are presently installed)
-
- * Attribute present, with non-empty value
- (e.g. "Installed PlugIns=JPEG,MPEG2,MPEG4")
-
- Each author defining a DNS-SD profile for discovering instances of a
- particular type of service should define the interpretation of these
- different kinds of result. For example, for some keys, there may be
- a natural true/false boolean interpretation:
-
- * Present implies 'true'
- * Absent implies 'false'
-
- For other keys it may be sensible to define other semantics, such as
- value/no-value/unknown:
-
- * Present with value implies that value.
- E.g. "Color=4" for a four-color ink-jet printer,
- or "Color=6" for a six-color ink-jet printer.
-
- * Present with empty value implies 'false'. E.g. Not a color printer.
-
- * Absent implies 'Unknown'. E.g. A print server connected to some
- unknown printer where the print server doesn't actually know if the
- printer does color or not -- which gives a very bad user experience
- and should be avoided wherever possible.
-
- (Note that this is a hypothetical example, not an example of actual
- name/value keys used by DNS-SD network printers.)
-
- As a general rule, attribute names that contain no dots are defined
- as part of the open-standard definition written by the person or
- group defining the DNS-SD profile for discovering that particular
- service type. Vendor-specific extensions should be given names of the
- form "keyname.company.com=value", using a domain name legitimately
- registered to the person or organization creating the vendor-specific
- key. This reduces the risk of accidental conflict if different
- organizations each define their own vendor-specific keys.
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 15]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6.5 Rules for Values in DNS-SD Name/Value Pairs
-
- If there is an '=', then everything after the first '=' to the end of
- the string is the value. The value can contain any eight-bit values
- including '='. Leading or trailing spaces are part of the value, so
- don't put them there unless you intend them to be there. Any
- quotation marks around the value are part of the value, so don't put
- them there unless you intend them to be part of the value.
-
- The value is opaque binary data. Often the value for a particular
- attribute will be US-ASCII (or UTF-8) text, but it is legal for a
- value to be any binary data. For example, if the value of a key is an
- IPv4 address, that address should simply be stored as four bytes of
- binary data, not as a variable-length 7-15 byte ASCII string giving
- the address represented in textual dotted decimal notation.
-
- Generic debugging tools should generally display all attribute values
- as a hex dump, with accompanying text alongside displaying the UTF-8
- interpretation of those bytes, except for attributes where the
- debugging tool has embedded knowledge that the value is some other
- kind of data.
-
- Authors defining DNS-SD profiles SHOULD NOT convert binary attribute
- data types into printable text (e.g. using hexadecimal, Base64 or UU
- encoding) merely for the sake of making the data be printable text
- when seen in a generic debugging tool. Doing this simply bloats the
- size of the TXT record, without atually making the data any more
- understandable to someone looking at it in a generic debugging tool.
-
-
-6.6 Example TXT Record
-
- The TXT record below contains three syntactically valid name/value
- pairs. (The meaning of these name/value pairs, if any, would depend
- on the definitions pertaining to the service in question that is
- using them.)
-
- ---------------------------------------------------------------
- | 0x0A | name=value | 0x08 | paper=A4 | 0x0E | DNS-SD Is Cool |
- ---------------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 16]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-6.7 Version Tag
-
- It is recommended that authors defining DNS-SD profiles include an
- attribute of the form "txtvers=xxx" in their definition, and require
- it to be the first name/value pair in the TXT record. This
- information in the TXT record can be useful to help clients maintain
- backwards compatibility with older implementations if it becomes
- necessary to change or update the specification over time. Even if
- the profile author doesn't anticipate the need for any future
- incompatible changes, having a version number in the specification
- provides useful insurance should incompatible changes become
- unavoidable. Clients SHOULD ignore TXT records with a txtvers number
- higher (or lower) than the version(s) they know how to interpret.
-
- Note that the version number in the txtvers tag describes the version
- of the TXT record specification being used to create this TXT record,
- not the version of the application protocol that will be used if the
- client subsequently decides to contact that service. Ideally, every
- DNS-SD TXT record specification starts at txtvers=1 and stays that
- way forever. Improvements can be made by defining new keys that older
- clients silently ignore. The only reason to increment the version
- number is if the old specification is subsequently found to be so
- horribly broken that there's no way to do a compatible forward
- revision, so the txtvers number has to be incremented to tell all the
- old clients they should just not even try to understand this new TXT
- record.
-
- If there is a need to indicate which version number(s) of the
- application protocol the service implements, the recommended key
- name for this is "protovers".
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 17]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-7. Application Protocol Names
-
- The <Service> portion of a Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the pair is the Application
- Protocol Name, and the second label is either "_tcp" or "_udp".
-
- Wise selection of the Application Protocol Name is very important,
- and the choice is not always as obvious as it may appear.
-
- In some cases, the Application Protocol Name merely names and refers
- to the on-the-wire message format and semantics being used. FTP is
- "ftp", IPP printing is "ipp", and so on.
-
- However, it is common to "borrow" an existing protocol and repurpose
- it for a new task. This is entirely sensible and sound engineering
- practice, but that doesn't mean that the new protocol is providing
- the same semantic service as the old one, even if it borrows the same
- message formats. For example, the local network music playing
- protocol implemented by iTunes on Macintosh and Windows is little
- more than "HTTP GET" commands. However, that does *not* mean that it
- is sensible or useful to try to access one of these music servers by
- connecting to it with a standard web browser. Consequently, the
- DNS-SD service advertised (and browsed for) by iTunes is "_daap._tcp"
- (Digital Audio Access Procol), not "_http._tcp". Advertising
- "_http._tcp" service would cause iTunes servers to show up in
- conventional Web browsers (Safari, Camino, OmniWeb, Opera, Netscape,
- Internet Explorer, etc.) which is little use since it offers no pages
- containing human-readable content. Similarly, browsing for
- "_http._tcp" service would cause iTunes to find generic web servers,
- such as the embedded web servers in devices like printers, which is
- little use since printers generally don't have much music to offer.
-
- Similarly, NFS is built on top of SUN RPC, but that doesn't mean it
- makes sense for an NFS server to advertise that it provides "SUN RPC"
- service. Likewise, Microsoft SMB file service is built on top of
- Netbios running over IP, but that doesn't mean it makes sense for an
- SMB file server to advertise that it provides "Netbios-over-IP"
- service. The DNS-SD name of a service needs to encapsulate both the
- "what" (semantics) and the "how" (protocol implementation) of the
- service, since knowledge of both is necessary for a client to
- usefully use the service. Merely advertising that a service was built
- on top of SUN RPC is no use if the client has no idea what the
- service actually does.
-
- Another common mistake is to assume that the service type advertised
- by iTunes should be "_daap._http._tcp." This is also incorrect. Part
- of the confusion here is that the presence of "_tcp" or "_udp" in the
- <Service> portion of a Service Instance Name has led people to assume
- that the structure of a service name has to reflect the internal
- structure of how the protocol was implemented. This is not correct.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 18]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- The "_tcp" or "_udp" should be regarded as little more than
- boilerplate text, and care should be taken not to attach too much
- importance to it. Some might argue that the "_tcp" or "_udp" should
- not be there at all, but this format is defined by RFC 2782, and
- that's not going to change. In addition, the presence of "_tcp" has
- the useful side-effect that it provides a convenient delegation point
- to hand off control to a different DNS server, if so desired.
-
-
-8. Selective Instance Enumeration
-
- This document does not attempt to define an arbitrary query language
- for service discovery, nor do we believe one is necessary.
-
- However, there are some circumstances where narrowing the list of
- results may be useful. A Web browser client that is able to retrieve
- HTML documents via HTTP and display them may also be able to retrieve
- HTML documents via FTP and display them, but only in the case of FTP
- servers that allow anonymous login. For that Web browser, discovering
- all FTP servers on the network is not useful. The Web browser only
- wants to discover FTP servers that it is able to talk to. In this
- case, a subtype of "_ftp._tcp" could be defined. Instead of issuing a
- query for "_ftp._tcp.<Domain>", the Web browser issues a query for
- "_anon._ftp._tcp.<Domain>", where "_anon" is a defined subtype of
- "_ftp._tcp". The response to this query only includes the names of
- SRV records for FTP servers that are willing to allow anonymous
- login.
-
- Note that the FTP server's Service Instance Name is unchanged -- it
- is still something of the form "The Server._ftp._tcp.example.com."
- The subdomain in which FTP server SRV records are registered defines
- the namespace within which FTP server names are unique. Additional
- subtypes (e.g. "_anon") of the basic service type (e.g. "_ftp._tcp")
- serve to narrow the list of results, not to create more namespace.
-
- As with the TXT record name/value pairs, the list of possible
- subtypes, if any, are defined and specified separately for each basic
- service type.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 19]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-9. Flagship Naming
-
- In some cases, there may be several network protocols available which
- all perform roughly the same logical function. For example, the
- printing world has the LPR protocol, and the Internet Printing
- Protocol (IPP), both of which cause printed sheets to be emitted from
- printers in much the same way. In addition, many printer vendors send
- their own proprietary page description language (PDL) data over a TCP
- connection to TCP port 9100, herein referred to as the
- "pdl-datastream" protocol. In an ideal world we would have only one
- network printing protocol, and it would be sufficiently good that no
- one felt a compelling need to invent a different one. However, in
- practice, multiple legacy protocols do exist, and a service discovery
- protocol has to accommodate that.
-
- Many printers implement all three printing protocols: LPR, IPP, and
- pdl-datastream. For the benefit of clients that may speak only one of
- those protocols, all three are advertised.
-
- However, some clients may implement two, or all three of those
- printing protocols. When a client looks for all three service types
- on the network, it will find three distinct services -- an LPR
- service, an IPP service, and a pdl-datastream service -- all of which
- cause printed sheets to be emitted from the same physical printer.
-
- In the case of multiple protocols like this that all perform
- effectively the same function, the client should suppress duplicate
- names and display each name only once. When the user prints to a
- given named printer, the printing client is responsible for choosing
- the protocol which will best achieve the desired effect, without, for
- example, requiring the user to make a manual choice between LPR and
- IPP.
-
- As described so far, this all works very well. However, consider some
- future printer that only supports IPP printing, and some other future
- printer that only supports pdl-datastream printing. The name spaces
- for different service types are intentionally disjoint -- it is
- acceptable and desirable to be able to have both a file server called
- "Sales Department" and a printer called "Sales Department". However,
- it is not desirable, in the common case, to have two different
- printers both called "Sales Department", just because those printers
- are implementing different protocols.
-
- To help guard against this, when there are two or more network
- protocols which perform roughly the same logical function, one of the
- protocols is declared the "flagship" of the fleet of related
- protocols. Typically the flagship protocol is the oldest and/or
- best-known protocol of the set.
-
- If a device does not implement the flagship protocol, then it instead
- creates a placeholder SRV record (priority=0, weight=0, port=0,
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 20]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- target host = hostname of device) with that name. If, when it
- attempts to create this SRV record, it finds that a record with the
- same name already exists, then it knows that this name is already
- taken by some entity implementing at least one of the protocols from
- the class, and it must choose another. If no SRV record already
- exists, then the act of creating it stakes a claim to that name so
- that future devices in the same class will detect a conflict when
- they try to use it. The SRV record needs to contain the target host
- name in order for the conflict detection rules to operate. If two
- different devices were to create placeholder SRV records both using a
- null target host name (just the root label), then the two SRV records
- would be seen to be in agreement so no conflict would be registered.
-
- By defining a common well-known flagship protocol for the class,
- future devices that may not even know about each other's protocols
- establish a common ground where they can coordinate to verify
- uniqueness of names.
-
- No PTR record is created advertising the presence of empty flagship
- SRV records, since they do not represent a real service being
- advertised.
-
-
-10. Service Type Enumeration
-
- In general, clients are not interested in finding *every* service on
- the network, just the services that the client knows how to talk to.
- (Software designers may *think* there's some value to finding *every*
- service on the network, but that's just wooly thinking.)
-
- However, for problem diagnosis and network management tools, it may
- be useful for network administrators to find the list of advertised
- service types on the network, even if those service names are just
- opaque identifiers and not particularly informative in isolation.
-
- For this reason, a special meta-query is defined. A DNS query for
- PTR records with the name "_services._dns-sd._udp.<Domain>" yields
- a list of PTR records, where the rdata of each PTR record is the
- name of a service type. A subsequent query for PTR records with
- one of those names yields a list of instances of that service type.
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 21]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-11. Populating the DNS with Information
-
- How the SRV and PTR records that describe services and allow them to
- be enumerated make their way into the DNS is outside the scope of
- this document. However, it can happen easily in any of a number of
- ways, for example:
-
- On some networks, the administrator might manually enter the records
- into the name server's configuration file.
-
- A network monitoring tool could output a standard zone file to be
- read into a conventional DNS server. For example, a tool that can
- find Apple LaserWriters using AppleTalk NBP could find the list of
- printers, communicate with each one to find its IP address,
- PostScript version, installed options, etc., and then write out a DNS
- zone file describing those printers and their capabilities using DNS
- resource records. That information would then be available to DNS-SD
- clients that don't implement AppleTalk NBP, and don't want to.
-
- Future IP printers could use Dynamic DNS Update [RFC 2136] to
- automatically register their own SRV and PTR records with the DNS
- server.
-
- A printer manager device which has knowledge of printers on the
- network through some other management protocol could also use Dynamic
- DNS Update [RFC 2136].
-
- Alternatively, a printer manager device could implement enough of the
- DNS protocol that it is able to answer DNS queries directly, and
- Example Co.'s main DNS server could delegate the
- _ipp._tcp.example.com subdomain to the printer manager device.
-
- Zeroconf printers answer Multicast DNS queries on the local link
- for appropriate PTR and SRV names ending with ".local." [mDNS]
-
-
-12. Relationship to Multicast DNS
-
- DNS-Based Service Discovery is only peripherally related to Multicast
- DNS, in that the standard unicast DNS queries used by DNS-SD may also
- be performed using multicast when appropriate, which is particularly
- beneficial in Zeroconf environments [ZC].
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 22]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-13. Discovery of Browsing and Registration Domains (Domain Enumeration)
-
- One of the main reasons for DNS-Based Service Discovery is so that
- when a visiting client (e.g. a laptop computer) arrives at a new
- network, it can discover what services are available on that network
- without manual configuration. This logic that applies to discovering
- services without manual configuration also applies to discovering the
- domains in which services are registered without requiring manual
- configuration.
-
- This discovery is performed recursively, using Unicast or Multicast
- DNS. Four special RR names are reserved for this purpose:
-
- _browse._dns-sd._udp.<domain>
- _default._browse._dns-sd._udp.<domain>
- _register._dns-sd._udp.<domain>
- _default._register._dns-sd._udp.<domain>
-
- By performing PTR queries for these names, a client can learn,
- respectively:
-
- o A list of domains recommended for browsing
-
- o A single recommended default domain for browsing
-
- o A list of domains recommended for registering services using
- Dynamic Update
-
- o A single recommended default domain for registering services.
-
- These domains are purely advisory. The client or user is free to
- browse and/or register services in any domains. The purpose of these
- special queries is to allow software to create a user-interface that
- displays a useful list of suggested choices to the user, from which
- they may make a suitable selection, or ignore the offered suggestions
- and manually enter their own choice.
-
- The <domain> part of the name may be ".local." (meaning "perform the
- query using link-local multicast) or it may be learned through some
- other mechanism, such as the DHCP "Domain" option (option code 15)
- [RFC 2132] or the DHCP "Domain Search" option (option code 119)
- [RFC 3397]. Sophisticated clients may perform these queries both in
- ".local." and in one or more unicast domains, and then present the
- user with an aggregate result, combining the information received
- from all sources.
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 23]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-14. DNS Additional Record Generation
-
- DNS has an efficiency feature whereby a DNS server may place
- additional records in the Additional Section of the DNS Message.
- These additional records are typically records that the client did
- not explicitly request, but the server has reasonable grounds to
- expect that the client might request them shortly.
-
- This section recommends which additional records should be generated
- to improve network efficiency for both unicast and multicast DNS-SD
- responses.
-
-
-14.1 PTR Records
-
- When including a PTR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o The SRV record(s) named in the PTR rdata.
- o The TXT record(s) named in the PTR rdata.
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-14.2 SRV Records
-
- When including an SVR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-14.3 TXT Records
-
- When including a TXT record in a response packet, no additional
- records are required.
-
-
-14.4 Other Record Types
-
- In response to address queries, or other record types, no additional
- records are required by this document.
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 24]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-15. Comparison with Alternative Service Discovery Protocols
-
- Over the years there have been many proposed ways to do network
- service discovery with IP, but none achieved ubiquity in the
- marketplace. Certainly none has achieved anything close to the
- ubiquity of today's deployment of DNS servers, clients, and other
- infrastructure.
-
- The advantage of using DNS as the basis for service discovery is that
- it makes use of those existing servers, clients, protocols,
- infrastructure, and expertise. Existing network analyser tools
- already know how to decode and display DNS packets for network
- debugging.
-
- For ad-hoc networks such as Zeroconf environments, peer-to-peer
- multicast protocols are appropriate. The Zeroconf host profile [ZCHP]
- requires the use of a DNS-like protocol over IP Multicast for host
- name resolution in the absence of DNS servers. Given that Zeroconf
- hosts will have to implement this Multicast-based DNS-like protocol
- anyway, it makes sense for them to also perform service discovery
- using that same Multicast-based DNS-like software, instead of also
- having to implement an entirely different service discovery protocol.
-
- In larger networks, a high volume of enterprise-wide IP multicast
- traffic may not be desirable, so any credible service discovery
- protocol intended for larger networks has to provide some facility to
- aggregate registrations and lookups at a central server (or servers)
- instead of working exclusively using multicast. This requires some
- service discovery aggregation server software to be written,
- debugged, deployed, and maintained. This also requires some service
- discovery registration protocol to be implemented and deployed for
- clients to register with the central aggregation server. Virtually
- every company with an IP network already runs a DNS server, and DNS
- already has a dynamic registration protocol [RFC 2136]. Given that
- virtually every company already has to operate and maintain a DNS
- server anyway, it makes sense to take advantage of this instead of
- also having to learn, operate and maintain a different service
- registration server. It should be stressed again that using the same
- software and protocols doesn't necessarily mean using the same
- physical piece of hardware. The DNS-SD service discovery functions
- do not have to be provided by the same piece of hardware that
- is currently providing the company's DNS name service. The
- "_tcp.<Domain>" subdomain may be delegated to a different piece of
- hardware. However, even when the DNS-SD service is being provided by
- a different piece of hardware, it is still the same familiar DNS
- server software that is running, with the same configuration file
- syntax, the same log file format, and so forth.
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 25]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- Service discovery needs to be able to provide appropriate security.
- DNS already has existing mechanisms for security [RFC 2535].
-
- In summary:
-
- Service discovery requires a central aggregation server.
- DNS already has one: It's called a DNS server.
-
- Service discovery requires a service registration protocol.
- DNS already has one: It's called DNS Dynamic Update.
-
- Service discovery requires a query protocol
- DNS already has one: It's called DNS.
-
- Service discovery requires security mechanisms.
- DNS already has security mechanisms: DNSSEC.
-
- Service discovery requires a multicast mode for ad-hoc networks.
- Zeroconf environments already require a multicast-based DNS-like
- name lookup protocol for mapping host names to addresses, so it
- makes sense to let one multicast-based protocol do both jobs.
-
- It makes more sense to use the existing software that every network
- needs already, instead of deploying an entire parallel system just
- for service discovery.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 26]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-16. Real Example
-
- The following examples were prepared using standard unmodified
- nslookup and standard unmodified BIND running on GNU/Linux.
-
- Note: In real products, this information is obtained and presented to
- the user using graphical network browser software, not command-line
- tools, but if you wish you can try these examples for yourself as you
- read along, using the command-line tools already available on your
- own Unix machine.
-
-
-16.1 Question: What FTP servers are being advertised from dns-sd.org?
-
- nslookup -q=ptr _ftp._tcp.dns-sd.org.
- _ftp._tcp.dns-sd.org name=Apple\032QuickTime\032Files.dns-sd.org
- _ftp._tcp.dns-sd.org name=Microsoft\032Developer\032Files.dns-sd.org
- _ftp._tcp.dns-sd.org name=Registered\032Users'\032Only.dns-sd.org
-
- Answer: There are three, called "Apple QuickTime Files",
- "Microsoft Developer Files" and "Registered Users' Only".
-
- Note that nslookup escapes spaces as "\032" for display purposes,
- but a graphical DNS-SD browser does not.
-
-
-16.2 Question: What FTP servers allow anonymous access?
-
- nslookup -q=ptr _anon._ftp._tcp.dns-sd.org
- _anon._ftp._tcp.dns-sd.org
- name=Apple\032QuickTime\032Files.dns-sd.org
- _anon._ftp._tcp.dns-sd.org
- name=Microsoft\032Developer\032Files.dns-sd.org
-
- Answer: Only "Apple QuickTime Files" and "Microsoft Developer Files"
- allow anonymous access.
-
-
-16.3 Question: How do I access "Apple QuickTime Files"?
-
- nslookup -q=any "Apple\032QuickTime\032Files.dns-sd.org."
- Apple\032QuickTime\032Files.dns-sd.org text = "path=/quicktime"
- Apple\032QuickTime\032Files.dns-sd.org
- priority = 0, weight = 0, port= 21 host = ftp.apple.com
- ftp.apple.com internet address = 17.254.0.27
- ftp.apple.com internet address = 17.254.0.31
- ftp.apple.com internet address = 17.254.0.26
-
- Answer: You need to connect to ftp.apple.com, port 21, path
- "/quicktime". The addresses for ftp.apple.com are also given.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 27]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
-17. IPv6 Considerations
-
- IPv6 has no significant differences, except that the address of the
- SRV record's target host is given by the appropriate IPv6 address
- records instead of the IPv4 "A" record.
-
-
-18. Security Considerations
-
- DNSSEC [RFC 2535] should be used where the authenticity of
- information is important. Since DNS-SD is just a naming and usage
- convention for records in the existing DNS system, it has no specific
- additional security requirements over and above those that already
- apply to DNS queries and DNS updates.
-
-
-19. IANA Considerations
-
- This protocol builds on DNS SRV records [RFC 2782], and similarly
- requires IANA to assign unique application protocol names.
- Unfortunately, the "IANA Considerations" section of RFC 2782 says
- simply, "The IANA has assigned RR type value 33 to the SRV RR.
- No other IANA services are required by this document."
- Due to this oversight, IANA is currently prevented from carrying
- out the necessary function of assigning these unique identifiers.
-
- This document proposes the following IANA allocation policy for
- unique application protocol names:
-
- Allowable names:
- * Must be no more than fourteen characters long
- * Must consist only of:
- - lower-case letters 'a' - 'z'
- - digits '0' - '9'
- - the hyphen character '-'
- * Must begin and end with a lower-case letter or digit.
- * Must not already be assigned to some other protocol in the
- existing IANA "list of assigned application protocol names
- and port numbers" [ports].
-
- These identifiers are allocated on a First Come First Served basis.
- In the event of abuse (e.g. automatated mass registrations, etc.),
- the policy may be changed without notice to Expert Review [RFC 2434].
-
- The textual nature of service/protocol names means that there are
- almost infinitely many more of them available than the finite set of
- 65535 possible port numbers. This means that developers can produce
- experimental implementations using unregistered service names with
- little chance of accidental collision, providing service names are
- chosen with appropriate care. However, this document strongly
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 28]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- advocates that on or before the date a product ships, developers
- should properly register their service names.
-
- Some developers have expressed concern that publicly registering
- their service names (and port numbers today) with IANA before a
- product ships may give away clues about that product to competitors.
- For this reason, IANA should consider allowing service name
- applications to remain secret for some period of time, much as US
- patent applications remain secret for two years after the date of
- filing.
-
- This proposed IANA allocation policy is not in force until this
- document is published as an RFC. In the meantime, unique application
- protocol names may be registered according to the instructions at
- <http://www.dns-sd.org/ServiceNames.html>. As of January 2004, there
- are roughly 100 application protocols in currently shipping products
- that have been so registered as using DNS-SD for service discovery.
-
-
-20. Acknowledgements
-
- We would like to thank (in alphabetical order) Richard Brown, Josh
- Graessley, Erik Guttman, Paul Vixie, and Bill Woodcock, for their
- contributions.
-
-
-21. Copyright
-
- Copyright (C) The Internet Society 2004.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 29]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-22. Normative References
-
- [ports] IANA list of assigned application protocol names and port
- numbers <http://www.iana.org/assignments/port-numbers>
-
- [RFC 1033] Lottor, M., "Domain Administrators Operations Guide",
- RFC 1033, November 1987.
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
- [RFC 2782] Gulbrandsen, A., et al., "A DNS RR for specifying the
- location of services (DNS SRV)", RFC 2782, February 2000.
-
-
-23. Informative References
-
- [mDNS] Cheshire, S., and M. Krochmal, "Multicast DNS",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-multicastdns-04.txt, February 2004.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-03.txt, February 2004.
-
- [RFC 2132] Alexander, S., and Droms, R., "DHCP Options and BOOTP
- Vendor Extensions", RFC 2132, March 1997.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2434] Narten, T., and H. Alvestrand, "Guidelines for Writing
- an IANA Considerations Section in RFCs", RFC 2434,
- October 1998.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 30]
-
-Internet Draft DNS-Based Service Discovery 14th February 2004
-
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [RFC 3007] Wellington, B., et al., "Secure Domain Name System (DNS)
- Dynamic Update", RFC 3007, November 2000.
-
- [RFC 3397] Aboba, B., and Cheshire, S., "Dynamic Host Configuration
- Protocol (DHCP) Domain Search Option", RFC 3397, November
- 2002.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
- [ZCHP] Guttman, E., "Zeroconf Host Profile Applicability
- Statement", Internet-Draft (work in progress),
- draft-ietf-zeroconf-host-prof-01.txt, July 2001.
-
-
-24. Author's Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 31]
diff --git a/trunk/specs/draft-cheshire-dnsext-dns-sd-03.txt b/trunk/specs/draft-cheshire-dnsext-dns-sd-03.txt
deleted file mode 100644
index c412806..0000000
--- a/trunk/specs/draft-cheshire-dnsext-dns-sd-03.txt
+++ /dev/null
@@ -1,1856 +0,0 @@
-Document: draft-cheshire-dnsext-dns-sd-03.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 7th December 2005 Marc Krochmal
- Apple Computer, Inc.
- 7th June 2005
-
- DNS-Based Service Discovery
-
- <draft-cheshire-dnsext-dns-sd-03.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 1]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-Table of Contents
-
- 1. Introduction....................................................3
- 2. Conventions and Terminology Used in this Document...............3
- 3. Design Goals....................................................4
- 4. Service Instance Enumeration....................................5
- 4.1 Structured Instance Names.......................................5
- 4.2 User Interface Presentation.....................................7
- 4.3 Internal Handling of Names......................................7
- 4.4 What You See Is What You Get....................................7
- 4.5 Ordering of Service Instance Name Components....................9
- 5. Service Name Resolution........................................11
- 6. Data Syntax for DNS-SD TXT Records.............................12
- 6.1 General Format Rules for DNS TXT Records.......................12
- 6.2 DNS TXT Record Format Rules for use in DNS-SD..................13
- 6.3 DNS-SD TXT Record Size.........................................14
- 6.4 Rules for Names in DNS-SD Name/Value Pairs.....................14
- 6.5 Rules for Values in DNS-SD Name/Value Pairs....................16
- 6.6 Example TXT Record.............................................16
- 6.7 Version Tag....................................................17
- 7. Application Protocol Names.....................................17
- 7.1 Service Name Length Limits.....................................19
- 8. Selective Instance Enumeration.................................20
- 9. Flagship Naming................................................20
- 10. Service Type Enumeration.......................................22
- 11. Populating the DNS with Information............................23
- 12. Relationship to Multicast DNS..................................23
- 13. Discovery of Browsing and Registration Domains.................24
- 14. DNS Additional Record Generation...............................25
- 15. Comparison with Alternative Service Discovery Protocols........26
- 16. Real Example...................................................28
- 17. IPv6 Considerations............................................29
- 18. Security Considerations........................................29
- 19. IANA Considerations............................................29
- 20. Acknowledgments................................................30
- 21. Copyright......................................................30
- 22. Normative References...........................................31
- 23. Informative References.........................................31
- 24. Authors' Addresses.............................................32
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 2]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-1. Introduction
-
- This document describes a convention for naming and structuring DNS
- resource records. Given a type of service that a client is looking
- for, and a domain in which the client is looking for that service,
- this convention allows clients to discover a list of named instances
- of a that desired service, using only standard DNS queries. In short,
- this is referred to as DNS-based Service Discovery, or DNS-SD.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, resource record types,
- or any other new DNS protocol values. This document simply proposes
- a convention for how existing resource record types can be named and
- structured to facilitate service discovery.
-
- This proposal is entirely compatible with today's existing unicast
- DNS server and client software.
-
- Note that the DNS-SD service does NOT have to be provided by the same
- DNS server hardware that is currently providing an organization's
- conventional host name lookup service (the service we traditionally
- think of when we say "DNS"). By delegating the "_tcp" subdomain, all
- the workload related to DNS-SD can be offloaded to a different
- machine. This flexibility, to handle DNS-SD on the main DNS server,
- or not, at the network administrator's discretion, is one of the
- things that makes DNS-SD so compelling.
-
- Even when the DNS-SD functions are delegated to a different machine,
- the benefits of using DNS remain: It is mature technology, well
- understood, with multiple independent implementations from different
- vendors, a wide selection of books published on the subject, and an
- established workforce experienced in its operation. In contrast,
- adopting some other service discovery technology would require every
- site in the world to install, learn, configure, operate and maintain
- some entirely new and unfamiliar server software. Faced with these
- obstacles, it seems unlikely that any other service discovery
- technology could hope to compete with the ubiquitous deployment
- that DNS already enjoys.
-
- This proposal is also compatible with (but not dependent on) the
- proposal outlined in "Multicast DNS" [mDNS].
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 3]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-3. Design Goals
-
- A good service discovery protocol needs to have many properties,
- three of which are mentioned below:
-
- (i) The ability to query for services of a certain type in a certain
- logical domain and receive in response a list of named instances
- (network browsing, or "Service Instance Enumeration").
-
- (ii) Given a particular named instance, the ability to efficiently
- resolve that instance name to the required information a client needs
- to actually use the service, i.e. IP address and port number, at the
- very least (Service Name Resolution).
-
- (iii) Instance names should be relatively persistent. If a user
- selects their default printer from a list of available choices today,
- then tomorrow they should still be able to print on that printer --
- even if the IP address and/or port number where the service resides
- have changed -- without the user (or their software) having to repeat
- the network browsing step a second time.
-
- In addition, if it is to become successful, a service discovery
- protocol should be so simple to implement that virtually any
- device capable of implementing IP should not have any trouble
- implementing the service discovery software as well.
-
- These goals are discussed in more detail in the remainder of this
- document. A more thorough treatment of service discovery requirements
- may be found in "Requirements for a Protocol to Replace AppleTalk
- NBP" [NBP]. That document draws upon examples from two decades of
- operational experience with AppleTalk Name Binding Protocol to
- develop a list of universal requirements which are broadly applicable
- to any potential service discovery protocol.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 4]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-4. Service Instance Enumeration
-
- DNS SRV records [RFC 2782] are useful for locating instances of a
- particular type of service when all the instances are effectively
- indistinguishable and provide the same service to the client.
-
- For example, SRV records with the (hypothetical) name
- "_http._tcp.example.com." would allow a client to discover a list of
- all servers implementing the "_http._tcp" service (i.e. Web servers)
- for the "example.com." domain. The unstated assumption is that all
- these servers offer an identical set of Web pages, and it doesn't
- matter to the client which of the servers it uses, as long as it
- selects one at random according to the weight and priority rules laid
- out in RFC 2782.
-
- Instances of other kinds of service are less easily interchangeable.
- If a word processing application were to look up the (hypothetical)
- SRV record "_ipp._tcp.example.com." to find the list of IPP printers
- at Example Co., then picking one at random and printing on it would
- probably not be what the user wanted.
-
- The remainder of this section describes how SRV records may be used
- in a slightly different way to allow a user to discover the names
- of all available instances of a given type of service, in order to
- select the particular instance the user desires.
-
-
-4.1 Structured Instance Names
-
- This document borrows the logical service naming syntax and semantics
- from DNS SRV records, but adds one level of indirection. Instead of
- requesting records of type "SRV" with name "_ipp._tcp.example.com.",
- the client requests records of type "PTR" (pointer from one name to
- another in the DNS namespace).
-
- In effect, if one thinks of the domain name "_ipp._tcp.example.com."
- as being analogous to an absolute path to a directory in a file
- system then the PTR lookup is akin to performing a listing of that
- directory to find all the files it contains. (Remember that domain
- names are expressed in reverse order compared to path names: An
- absolute path name is read from left to right, beginning with a
- leading slash on the left, and then the top level directory, then the
- next level directory, and so on. A fully-qualified domain name is
- read from right to left, beginning with the dot on the right -- the
- root label -- and then the top level domain to the left of that, and
- the second level domain to the left of that, and so on. If the fully-
- qualified domain name "_ipp._tcp.example.com." were expressed as a
- file system path name, it would be "/com/example/_tcp/_ipp".)
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 5]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The result of this PTR lookup for the name "<Service>.<Domain>" is a
- list of zero or more PTR records giving Service Instance Names of the
- form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- The <Instance> portion of the Service Instance Name is a single DNS
- label, containing arbitrary precomposed UTF-8-encoded text [RFC
- 2279]. It is a user-friendly name, meaning that it is allowed to
- contain any characters, without restriction, including spaces, upper
- case, lower case, punctuation -- including dots -- accented
- characters, non-roman text, and anything else that may be represented
- using UTF-8. DNS recommends guidelines for allowable characters for
- host names [RFC 1033][RFC 1034][RFC 1035], but Service Instance Names
- are not host names. Service Instance Names are not intended to ever
- be typed in by a normal user; the user selects a Service Instance
- Name by selecting it from a list of choices presented on the screen.
-
- Note that just because this protocol supports arbitrary UTF-8-encoded
- names doesn't mean that any particular user or administrator is
- obliged to make use of that capability. Any user is free, if they
- wish, to continue naming their services using only letters, digits
- and hyphens, with no spaces, capital letters, or other punctuation.
-
- DNS labels are currently limited to 63 octets in length. UTF-8
- encoding can require up to four octets per Unicode character, which
- means that in the worst case, the <Instance> portion of a name could
- be limited to fifteen Unicode characters. However, the Unicode
- characters with longer UTF-8 encodings tend to be the more obscure
- ones, and tend to be the ones that convey greater meaning per
- character.
-
- Note that any character in the commonly-used 16-bit Unicode space can
- be encoded with no more than three octets of UTF-8 encoding. This
- means that an Instance name can contain up to 21 Kanji characters,
- which is a sufficiently expressive name for most purposes.
-
- The <Service> portion of the Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the pair is the Application
- Protocol Name, and the second label is either "_tcp" or "_udp",
- depending on the transport protocol used by the application.
- More details are given in Section 7, "Application Protocol Names".
-
- The <Domain> portion of the Service Instance Name is a conventional
- DNS domain name, consisting of as many labels as appropriate. For
- example, "apple.com.", "cs.stanford.edu.", and "eng.us.ibm.com." are
- all valid domain names for the <Domain> portion of the Service
- Instance Name.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 6]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-4.2 User Interface Presentation
-
- The names resulting from the PTR lookup are presented to the user in
- a list for the user to select one (or more). Typically only the first
- label is shown (the user-friendly <Instance> portion of the name). In
- the common case, the <Service> and <Domain> are already known to the
- user, these having been provided by the user in the first place, by
- the act of indicating the service being sought, and the domain in
- which to look for it. Note: The software handling the response
- should be careful not to make invalid assumptions though, since it
- *is* possible, though rare, for a service enumeration in one domain
- to return the names of services in a different domain. Similarly,
- when using subtypes (see "Selective Instance Enumeration") the
- <Service> of the discovered instance my not be exactly the same as
- the <Service> that was requested.
-
- Having chosen the desired named instance, the Service Instance Name
- may then be used immediately, or saved away in some persistent
- user-preference data structure for future use, depending on what is
- appropriate for the application in question.
-
-
-4.3 Internal Handling of Names
-
- If the <Instance>, <Service> and <Domain> portions are internally
- concatenated together into a single string, then care must be taken
- with the <Instance> portion, since it is allowed to contain any
- characters, including dots.
-
- Any dots in the <Instance> portion should be escaped by preceding
- them with a backslash ("." becomes "\."). Likewise, any backslashes
- in the <Instance> portion should also be escaped by preceding them
- with a backslash ("\" becomes "\\"). Having done this, the three
- components of the name may be safely concatenated. The
- backslash-escaping allows literal dots in the name (escaped) to be
- distinguished from label-separator dots (not escaped).
-
- The resulting concatenated string may be safely passed to standard
- DNS APIs like res_query(), which will interpret the string correctly
- provided it has been escaped correctly, as described here.
-
-
-4.4 What You See Is What You Get
-
- Some service discovery protocols decouple the true service identifier
- from the name presented to the user. The true service identifier used
- by the protocol is an opaque unique id, often represented using a
- long string of hexadecimal digits, and should never be seen by the
- typical user. The name presented to the user is merely one of the
- ephemeral attributes attached to this opaque identifier.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 7]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The problem with this approach is that it decouples user perception
- from reality:
-
- * What happens if there are two service instances, with different
- unique ids, but they have inadvertently been given the same
- user-visible name? If two instances appear in an on-screen list
- with the same name, how does the user know which is which?
-
- * Suppose a printer breaks down, and the user replaces it with
- another printer of the same make and model, and configures the new
- printer with the exact same name as the one being replaced:
- "Stuart's Printer". Now, when the user tries to print, the
- on-screen print dialog tells them that their selected default
- printer is "Stuart's Printer". When they browse the network to see
- what is there, they see a printer called "Stuart's Printer", yet
- when the user tries to print, they are told that the printer
- "Stuart's Printer" can't be found. The hidden internal unique id
- that the software is trying to find on the network doesn't match
- the hidden internal unique id of the new printer, even though its
- apparent "name" and its logical purpose for being there are the
- same. To remedy this, the user typically has to delete the print
- queue they have created, and then create a new (apparently
- identical) queue for the new printer, so that the new queue will
- contain the right hidden internal unique id. Having all this hidden
- information that the user can't see makes for a confusing and
- frustrating user experience, and exposing long ugly hexadecimal
- strings to the user and forcing them to understand what they mean
- is even worse.
-
- * Suppose an existing printer is moved to a new department, and given
- a new name and a new function. Changing the user-visible name of
- that piece of hardware doesn't change its hidden internal unique
- id. Users who had previously created print queues for that printer
- will still be accessing the same hardware by its unique id, even
- though the logical service that used to be offered by that hardware
- has ceased to exist.
-
- To solve these problems requires the user or administrator to be
- aware of the supposedly hidden unique id, and to set its value
- correctly as hardware is moved around, repurposed, or replaced,
- thereby contradicting the notion that it is a hidden identifier that
- human users never need to deal with. Requiring the user to understand
- this expert behind-the-scenes knowledge of what is *really* going on
- is just one more burden placed on the user when they are trying to
- diagnose why their computers and network devices are not working as
- expected.
-
- These anomalies and counter-intuitive behaviors can be eliminated by
- maintaining a tight bidirectional one-to-one mapping between what the
- user sees on the screen and what is really happening "behind the
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 8]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- curtain". If something is configured incorrectly, then that is
- apparent in the familiar day-to-day user interface that everyone
- understands, not in some little-known rarely-used "expert" interface.
-
- In summary: The user-visible name is the primary identifier for a
- service. If the user-visible name is changed, then conceptually the
- service being offered is a different logical service -- even though
- the hardware offering the service stayed the same. If the
- user-visible name doesn't change, then conceptually the service being
- offered is the same logical service -- even if the hardware offering
- the service is new hardware brought in to replace some old equipment.
-
- There are certainly arguments on both sides of this debate.
- Nonetheless, the designers of any service discovery protocol have
- to make a choice between between having the primary identifiers be
- hidden, or having them be visible, and these are the reasons that we
- chose to make them visible. We're not claiming that there are no
- disadvantages of having primary identifiers be visible. We considered
- both alternatives, and we believe that the few disadvantages
- of visible identifiers are far outweighed by the many problems
- caused by use of hidden identifiers.
-
-
-4.5 Ordering of Service Instance Name Components
-
- There have been questions about why services are named using DNS
- Service Instance Names of the form:
-
- Service Instance Name = <Instance> . <Service> . <Domain>
-
- instead of:
-
- Service Instance Name = <Service> . <Instance> . <Domain>
-
- There are three reasons why it is beneficial to name service
- instances with the parent domain as the most-significant (rightmost)
- part of the name, then the abstract service type as the next-most
- significant, and then the specific instance name as the
- least-significant (leftmost) part of the name:
-
-
-4.5.1. Semantic Structure
-
- The facility being provided by browsing ("Service Instance
- Enumeration") is effectively enumerating the leaves of a tree
- structure. A given domain offers zero or more services. For each of
- those service types, there may be zero or more instances of that
- service.
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 9]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The user knows what type of service they are seeking. (If they are
- running an FTP client, they are looking for FTP servers. If they have
- a document to print, they are looking for entities that speak some
- known printing protocol.) The user knows in which organizational or
- geographical domain they wish to search. (The user does not want a
- single flat list of every single printer on the planet, even if such
- a thing were possible.) What the user does not know in advance is
- whether the service they seek is offered in the given domain, or if
- so, how many instances are offered, and the names of those instances.
- Hence having the instance names be the leaves of the tree is
- consistent with this semantic model.
-
- Having the service types be the terminal leaves of the tree would
- imply that the user knows the domain name, and already knows the
- name of the service instance, but doesn't have any idea what the
- service does. We would argue that this is a less useful model.
-
-
-4.5.2. Network Efficiency
-
- When a DNS response contains multiple answers, name compression works
- more effectively if all the names contain a common suffix. If many
- answers in the packet have the same <Service> and <Domain>, then each
- occurrence of a Service Instance Name can be expressed using only the
- <Instance> part followed by a two-byte compression pointer
- referencing a previous appearance of "<Service>.<Domain>". This
- efficiency would not be possible if the <Service> component appeared
- first in each name.
-
-
-4.5.3. Operational Flexibility
-
- This name structure allows subdomains to be delegated along logical
- service boundaries. For example, the network administrator at Example
- Co. could choose to delegate the "_tcp.example.com." subdomain to a
- different machine, so that the machine handling service discovery
- doesn't have to be the same as the machine handling other day-to-day
- DNS operations. (It *can* be the same machine if the administrator so
- chooses, but the point is that the administrator is free to make that
- choice.) Furthermore, if the network administrator wishes to delegate
- all information related to IPP printers to a machine dedicated to
- that specific task, this is easily done by delegating the
- "_ipp._tcp.example.com." subdomain to the desired machine. It is also
- convenient to set security policies on a per-zone/per-subdomain
- basis. For example, the administrator may choose to enable DNS
- Dynamic Update [RFC 2136] [RFC 3007] for printers registering in the
- "_ipp._tcp.example.com." subdomain, but not for other
- zones/subdomains. This easy flexibility would not exist if the
- <Service> component appeared first in each name.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 10]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-5. Service Name Resolution
-
- Given a particular Service Instance Name, when a client needs to
- contact that service, it sends a DNS query for the SRV record of
- that name.
-
- The result of the DNS query is a SRV record giving the port number
- and target host where the service may be found.
-
- The use of SRV records is very important. There are only 65535 TCP
- port numbers available. These port numbers are being allocated
- one-per-application-protocol at an alarming rate. Some protocols like
- the X Window System have a block of 64 TCP ports allocated
- (6000-6063). If we start allocating blocks of 64 TCP ports at a time,
- we will run out even faster. Using a different TCP port for each
- different instance of a given service on a given machine is entirely
- sensible, but allocating large static ranges, as was done for X, is a
- very inefficient way to manage a limited resource. On any given host,
- most TCP ports are reserved for services that will never run on that
- particular host. This is very poor utilization of the limited port
- space. Using SRV records allows each host to allocate its available
- port numbers dynamically to those services running on that host that
- need them, and then advertise the allocated port numbers via SRV
- records. Allocating the available listening port numbers locally
- on a per-host basis as needed allows much better utilization of the
- available port space than today's centralized global allocation.
-
- In some environments there may be no compelling reason to assign
- managed names to every host, since every available service is
- accessible by name anyway, as a first-class entity in its own right.
- However, the DNS packet format and record format still require a host
- name to link the target host referenced in the SRV record to the
- address records giving the IPv4 and/or IPv6 addresses for that
- hardware. In the case where no natural host name is available, the
- SRV record may give its own name as the name of the target host, and
- then the requisite address records may be attached to that same name.
- It is perfectly permissible for a single name in the DNS hierarchy to
- have multiple records of different type attached. (The only
- restriction being that a given name may not have both a CNAME record
- and other records at the same time.)
-
- In the event that more than one SRV is returned, clients MUST
- correctly interpret the priority and weight fields -- i.e. Lower
- numbered priority servers should be used in preference to higher
- numbered priority servers, and servers with equal priority should be
- selected randomly in proportion to their relative weights. However,
- in the overwhelmingly common case, a single advertised DNS-SD service
- instance is described by exactly one SRV record, and in this common
- case the priority and weight fields of the SRV record SHOULD both be
- set to zero.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 11]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-6. Data Syntax for DNS-SD TXT Records
-
- Some services discovered via Service Instance Enumeration may need
- more than just an IP address and port number to properly identify the
- service. For example, printing via the LPR protocol often specifies a
- queue name. This queue name is typically short and cryptic, and need
- not be shown to the user. It should be regarded the same way as the
- IP address and port number -- it is one component of the addressing
- information required to identify a specific instance of a service
- being offered by some piece of hardware. Similarly, a file server may
- have multiple volumes, each identified by its own volume name. A Web
- server typically has multiple pages, each identified by its own URL.
- In these cases, the necessary additional data is stored in a TXT
- record with the same name as the SRV record. The specific nature of
- that additional data, and how it is to be used, is service-dependent,
- but the overall syntax of the data in the TXT record is standardized,
- as described below. Every DNS-SD service MUST have a TXT record in
- addition to its SRV record, with same name, even if the service has
- no additional data to store and the TXT record contains no more than
- a single zero byte.
-
-
-6.1 General Format Rules for DNS TXT Records
-
- A DNS TXT record can be up to 65535 (0xFFFF) bytes long. The total
- length is indicated by the length given in the resource record header
- in the DNS message. There is no way to tell directly from the data
- alone how long it is (e.g. there is no length count at the start, or
- terminating NULL byte at the end). (Note that when using Multicast
- DNS [mDNS] the maximum packet size is 9000 bytes, which imposes an
- upper limit on the size of TXT records of about 8800 bytes.)
-
- The format of the data within a DNS TXT record is one or more
- strings, packed together in memory without any intervening gaps or
- padding bytes for word alignment.
-
- The format of each constituent string within the DNS TXT record is a
- single length byte, followed by 0-255 bytes of text data.
-
- These format rules are defined in Section 3.3.14 of RFC 1035, and are
- not specific to DNS-SD. DNS-SD simply specifies a usage convention
- for what data should be stored in those constituent strings.
-
- An empty TXT record containing zero strings is disallowed by RFC
- 1035. DNS-SD implementations MUST NOT emit empty TXT records. DNS-SD
- implementations receiving empty TXT records MUST treat them as
- equivalent to a one-byte TXT record containing a single zero byte
- (i.e. a single empty string).
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 12]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-6.2 DNS TXT Record Format Rules for use in DNS-SD
-
- DNS-SD uses DNS TXT records to store arbitrary name/value pairs
- conveying additional information about the named service. Each
- name/value pair is encoded as its own constituent string within the
- DNS TXT record, in the form "name=value". Everything up to the first
- '=' character is the name. Everything after the first '=' character
- to the end of the string (including subsequent '=' characters, if
- any) is the value. Specific rules governing names and values are
- given below. Each author defining a DNS-SD profile for discovering
- instances of a particular type of service should define the base set
- of name/value attributes that are valid for that type of service.
-
- Using this standardized name/value syntax within the TXT record makes
- it easier for these base definitions to be expanded later by defining
- additional named attributes. If an implementation sees unknown
- attribute names in a service TXT record, it MUST silently ignore
- them.
-
- The TCP (or UDP) port number of the service, and target host name,
- are given in the SRV record. This information -- target host name and
- port number -- MUST NOT be duplicated using name/value attributes in
- the TXT record.
-
- The intention of DNS-SD TXT records is to convey a small amount of
- useful additional information about a service. Ideally it SHOULD NOT
- be necessary for a client to retrieve this additional information
- before it can usefully establish a connection to the service. For a
- well-designed TCP-based application protocol, it should be possible,
- knowing only the host name and port number, to open a connection to
- that listening process, and then perform version- or feature-
- negotiation to determine the capabilities of the service instance.
- For example, when connecting to an AppleShare server over TCP, the
- client enters into a protocol exchange with the server to determine
- which version of the AppleShare protocol the server implements, and
- which optional features or capabilities (if any) are available. For a
- well-designed application protocol, clients should be able to connect
- and use the service even if there is no information at all in the TXT
- record. In this case, the information in the TXT record should be
- viewed as a performance optimization -- when a client discovers many
- instances of a service, the TXT record allows the client to know some
- rudimentary information about each instance without having to open a
- TCP connection to each one and interrogate every service instance
- separately. Extreme care should be taken when doing this to ensure
- that the information in the TXT record is in agreement with the
- information retrieved by a client connecting over TCP.
-
- There are legacy protocols which provide no feature negotiation
- capability, and in these cases it may be useful to convey necessary
- information in the TXT record. For example, when printing using the
- old Unix LPR (port 515) protocol, the LPR service provides no way for
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 13]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- the client to determine whether a particular printer accepts
- PostScript, or what version of PostScript, etc. In this case it is
- appropriate to embed this information in the TXT record, because the
- alternative is worse -- passing around written instructions to the
- users, arcane manual configuration of "/etc/printcap" files, etc.
-
-
-6.3 DNS-SD TXT Record Size
-
- The total size of a typical DNS-SD TXT record is intended to be small
- -- 200 bytes or less.
-
- In cases where more data is justified (e.g. LPR printing), keeping
- the total size under 400 bytes should allow it to fit in a single
- standard 512-byte DNS message. (This standard DNS message size is
- defined in RFC 1035.)
-
- In extreme cases where even this is not enough, keeping the size of
- the TXT record under 1300 bytes should allow it to fit in a single
- 1500-byte Ethernet packet.
-
- Using TXT records larger than 1300 bytes is NOT RECOMMENDED at this
- time.
-
-
-6.4 Rules for Names in DNS-SD Name/Value Pairs
-
- The "Name" MUST be at least one character. Strings beginning with an
- '=' character (i.e. the name is missing) SHOULD be silently ignored.
-
- The characters of "Name" MUST be printable US-ASCII values
- (0x20-0x7E), excluding '=' (0x3D).
-
- Spaces in the name are significant, whether leading, trailing, or in
- the middle -- so don't include any spaces unless you really intend
- that!
-
- Case is ignored when interpreting a name, so "papersize=A4",
- "PAPERSIZE=A4" and "Papersize=A4" are all identical.
-
- If there is no '=', then it is a boolean attribute, and is simply
- identified as being present, with no value.
-
- A given attribute name may appear at most once in a TXT record. If a
- client receives a TXT record containing the same attribute name more
- than once, then the client MUST silently ignore all but the first
- occurrence of that attribute. For client implementations that process
- a DNS-SD TXT record from start to end, placing name/value pairs into
- a hash table, using the name as the hash table key, this means that
- if the implementation attempts to add a new name/value pair into the
- table and finds an entry with the same name already present, then the
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 14]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- new entry being added should be silently discarded instead. For
- client implementations that retrieve name/value pairs by searching
- the TXT record for the requested name, they should search the TXT
- record from the start, and simply return the first matching name they
- find. The reason for this simplifying rule is to facilitate the
- creation of client libraries that parse the TXT record into an
- internal data structure, such as a hash table or dictionary object
- that maps from names to values, and then make that abstraction
- available to client code.
-
- When examining a TXT record for a given named attribute, there are
- therefore four broad categories of results which may be returned:
-
- * Attribute not present (Absent)
-
- * Attribute present, with no value
- (e.g. "Anon Allowed" -- server allows anonymous connections)
-
- * Attribute present, with empty value (e.g. "Installed PlugIns=" --
- server supports plugins, but none are presently installed)
-
- * Attribute present, with non-empty value
- (e.g. "Installed PlugIns=JPEG,MPEG2,MPEG4")
-
- Each author defining a DNS-SD profile for discovering instances of a
- particular type of service should define the interpretation of these
- different kinds of result. For example, for some keys, there may be
- a natural true/false boolean interpretation:
-
- * Present implies 'true'
- * Absent implies 'false'
-
- For other keys it may be sensible to define other semantics, such as
- value/no-value/unknown:
-
- * Present with value implies that value.
- E.g. "Color=4" for a four-color ink-jet printer,
- or "Color=6" for a six-color ink-jet printer.
-
- * Present with empty value implies 'false'. E.g. Not a color printer.
-
- * Absent implies 'Unknown'. E.g. A print server connected to some
- unknown printer where the print server doesn't actually know if the
- printer does color or not -- which gives a very bad user experience
- and should be avoided wherever possible.
-
- (Note that this is a hypothetical example, not an example of actual
- name/value keys used by DNS-SD network printers.)
-
- As a general rule, attribute names that contain no dots are defined
- as part of the open-standard definition written by the person or
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 15]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- group defining the DNS-SD profile for discovering that particular
- service type. Vendor-specific extensions should be given names of the
- form "keyname.company.com=value", using a domain name legitimately
- registered to the person or organization creating the vendor-specific
- key. This reduces the risk of accidental conflict if different
- organizations each define their own vendor-specific keys.
-
-
-6.5 Rules for Values in DNS-SD Name/Value Pairs
-
- If there is an '=', then everything after the first '=' to the end of
- the string is the value. The value can contain any eight-bit values
- including '='. Leading or trailing spaces are part of the value, so
- don't put them there unless you intend them to be there. Any
- quotation marks around the value are part of the value, so don't put
- them there unless you intend them to be part of the value.
-
- The value is opaque binary data. Often the value for a particular
- attribute will be US-ASCII (or UTF-8) text, but it is legal for a
- value to be any binary data. For example, if the value of a key is an
- IPv4 address, that address should simply be stored as four bytes of
- binary data, not as a variable-length 7-15 byte ASCII string giving
- the address represented in textual dotted decimal notation.
-
- Generic debugging tools should generally display all attribute values
- as a hex dump, with accompanying text alongside displaying the UTF-8
- interpretation of those bytes, except for attributes where the
- debugging tool has embedded knowledge that the value is some other
- kind of data.
-
- Authors defining DNS-SD profiles SHOULD NOT convert binary attribute
- data types into printable text (e.g. using hexadecimal, Base-64 or UU
- encoding) merely for the sake of making the data be printable text
- when seen in a generic debugging tool. Doing this simply bloats the
- size of the TXT record, without actually making the data any more
- understandable to someone looking at it in a generic debugging tool.
-
-
-6.6 Example TXT Record
-
- The TXT record below contains three syntactically valid name/value
- pairs. (The meaning of these name/value pairs, if any, would depend
- on the definitions pertaining to the service in question that is
- using them.)
-
- ---------------------------------------------------------------
- | 0x0A | name=value | 0x08 | paper=A4 | 0x0E | DNS-SD Is Cool |
- ---------------------------------------------------------------
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 16]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-6.7 Version Tag
-
- It is recommended that authors defining DNS-SD profiles include an
- attribute of the form "txtvers=xxx" in their definition, and require
- it to be the first name/value pair in the TXT record. This
- information in the TXT record can be useful to help clients maintain
- backwards compatibility with older implementations if it becomes
- necessary to change or update the specification over time. Even if
- the profile author doesn't anticipate the need for any future
- incompatible changes, having a version number in the specification
- provides useful insurance should incompatible changes become
- unavoidable. Clients SHOULD ignore TXT records with a txtvers number
- higher (or lower) than the version(s) they know how to interpret.
-
- Note that the version number in the txtvers tag describes the version
- of the TXT record specification being used to create this TXT record,
- not the version of the application protocol that will be used if the
- client subsequently decides to contact that service. Ideally, every
- DNS-SD TXT record specification starts at txtvers=1 and stays that
- way forever. Improvements can be made by defining new keys that older
- clients silently ignore. The only reason to increment the version
- number is if the old specification is subsequently found to be so
- horribly broken that there's no way to do a compatible forward
- revision, so the txtvers number has to be incremented to tell all the
- old clients they should just not even try to understand this new TXT
- record.
-
- If there is a need to indicate which version number(s) of the
- application protocol the service implements, the recommended key
- name for this is "protovers".
-
-
-7. Application Protocol Names
-
- The <Service> portion of a Service Instance Name consists of a pair
- of DNS labels, following the established convention for SRV records
- [RFC 2782], namely: the first label of the pair is the Application
- Protocol Name, and the second label is either "_tcp" or "_udp".
-
- Wise selection of the Application Protocol Name is very important,
- and the choice is not always as obvious as it may appear.
-
- Application Protocol Names may be no more than fourteen characters,
- conforming to normal DNS host name rules: Only lower-case letters,
- digits, and hyphens; must begin and end with lower-case letter or
- digit.
-
- In some cases, the Application Protocol Name merely names and refers
- to the on-the-wire message format and semantics being used. FTP is
- "ftp", IPP printing is "ipp", and so on.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 17]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- However, it is common to "borrow" an existing protocol and repurpose
- it for a new task. This is entirely sensible and sound engineering
- practice, but that doesn't mean that the new protocol is providing
- the same semantic service as the old one, even if it borrows the same
- message formats. For example, the local network music playing
- protocol implemented by iTunes on Macintosh and Windows is little
- more than "HTTP GET" commands. However, that does *not* mean that it
- is sensible or useful to try to access one of these music servers by
- connecting to it with a standard web browser. Consequently, the
- DNS-SD service advertised (and browsed for) by iTunes is "_daap._tcp"
- (Digital Audio Access Protocol), not "_http._tcp". Advertising
- "_http._tcp" service would cause iTunes servers to show up in
- conventional Web browsers (Safari, Camino, OmniWeb, Opera, Netscape,
- Internet Explorer, etc.) which is little use since it offers no pages
- containing human-readable content. Similarly, browsing for
- "_http._tcp" service would cause iTunes to find generic web servers,
- such as the embedded web servers in devices like printers, which is
- little use since printers generally don't have much music to offer.
-
- Similarly, NFS is built on top of SUN RPC, but that doesn't mean it
- makes sense for an NFS server to advertise that it provides "SUN RPC"
- service. Likewise, Microsoft SMB file service is built on top of
- Netbios running over IP, but that doesn't mean it makes sense for an
- SMB file server to advertise that it provides "Netbios-over-IP"
- service. The DNS-SD name of a service needs to encapsulate both the
- "what" (semantics) and the "how" (protocol implementation) of the
- service, since knowledge of both is necessary for a client to
- usefully use the service. Merely advertising that a service was built
- on top of SUN RPC is no use if the client has no idea what the
- service actually does.
-
- Another common mistake is to assume that the service type advertised
- by iTunes should be "_daap._http._tcp." This is also incorrect. Part
- of the confusion here is that the presence of "_tcp" or "_udp" in the
- <Service> portion of a Service Instance Name has led people to assume
- that the structure of a service name has to reflect the internal
- structure of how the protocol was implemented. This is not correct.
-
- The "_tcp" or "_udp" should be regarded as little more than
- boilerplate text, and care should be taken not to attach too much
- importance to it. Some might argue that the "_tcp" or "_udp" should
- not be there at all, but this format is defined by RFC 2782, and
- that's not going to change. In addition, the presence of "_tcp" has
- the useful side-effect that it provides a convenient delegation point
- to hand off control to a different DNS server, if so desired.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 18]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-7.1 Service Name Length Limits
-
- As described above, application protocol names are allowed to be up
- to fourteen characters long. The reason for this limit is to leave
- as many bytes of the domain name as possible available for use
- by both the network administrator (choosing service domain names)
- and the end user (choosing instance names).
-
- A domain name may be up to 255 bytes long, including the final
- terminating root label at the end. Domain names used by DNS-SD
- take the following forms:
-
- <Instance>.<app>._tcp.<servicedomain>.<parentdomain>.
- <sub>._sub.<app>._tcp.<servicedomain>.<parentdomain>.
-
- The first example shows a service instance name, i.e. the name of the
- service's SRV and TXT records. The second shows a subtype browsing
- name, i.e. the name of a PTR record pointing to service instance
- names.
-
- The instance name <Instance> may be up to 63 bytes. Including the
- length byte used by the DNS format when the name is stored in a
- packet, that makes 64 bytes.
-
- When using subtypes, the subtype identifier is allowed to be up to
- 63 bytes, plus the length byte, making 64. Including the "_sub"
- and its length byte, this makes 69 bytes.
-
- The application protocol name <app> may be up to 14 bytes, plus the
- underscore and length byte, making 16. Including the "_udp" or "_tcp"
- and its length byte, this makes 21 bytes.
-
- Typically, DNS-SD service records are placed into subdomains of their
- own beneath a company's existing domain name. Since these subdomains
- are intended to be accessed through graphical user interfaces, not
- typed on a command-line they are frequently long and descriptive.
- Including the length byte, the user-visible service domain may be up
- to 64 bytes.
-
- The terminating root label at the end counts as one byte.
-
- Of our available 255 bytes, we have now accounted for 69+21+64+1 =
- 155 bytes. This leaves 100 bytes to accommodate the organization's
- existing domain name <parentdomain>. When used with Multicast DNS,
- <parentdomain> is "local", which easily fits. When used with parent
- domains of 100 bytes or less, the full functionality of DNS-SD is
- available without restriction. When used with parent domains longer
- than 100 bytes, the protocol risks exceeding the maximum possible
- length of domain names, causing failures. In this case, careful
- choice of short <servicedomain> names can help avoid overflows. If
- the <servicedomain> and <parentdomain> are too long, then service
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 19]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- instances with long instance names will not be discoverable or
- resolvable, and applications making use of long subtype names may
- fail.
-
- Because of this constraint, we choose to limit Application Protocol
- Names to 14 characters or less. Allowing more characters would not
- add to the expressive power of the protocol, and would needlessly
- lower the limit on the maximum <parentdomain> length that may be
- safely used.
-
-
-8. Selective Instance Enumeration
-
- This document does not attempt to define an arbitrary query language
- for service discovery, nor do we believe one is necessary.
-
- However, there are some circumstances where narrowing the list of
- results may be useful. A Web browser client that is able to retrieve
- HTML documents via HTTP and display them may also be able to retrieve
- HTML documents via FTP and display them, but only in the case of FTP
- servers that allow anonymous login. For that Web browser, discovering
- all FTP servers on the network is not useful. The Web browser only
- wants to discover FTP servers that it is able to talk to. In this
- case, a subtype of "_ftp._tcp" could be defined. Instead of issuing a
- query for "_ftp._tcp.<Domain>", the Web browser issues a query for
- "_anon._sub._ftp._tcp.<Domain>", where "_anon" is a defined subtype
- of "_ftp._tcp". The response to this query only includes the names of
- SRV records for FTP servers that are willing to allow anonymous
- login.
-
- Note that the FTP server's Service Instance Name is unchanged -- it
- is still something of the form "The Server._ftp._tcp.example.com."
- The subdomain in which FTP server SRV records are registered defines
- the namespace within which FTP server names are unique. Additional
- subtypes (e.g. "_anon") of the basic service type (e.g. "_ftp._tcp")
- serve to narrow the list of results, not to create more namespace.
-
- As with the TXT record name/value pairs, the list of possible
- subtypes, if any, are defined and specified separately for each basic
- service type.
-
-
-9. Flagship Naming
-
- In some cases, there may be several network protocols available which
- all perform roughly the same logical function. For example, the
- printing world has the LPR protocol, and the Internet Printing
- Protocol (IPP), both of which cause printed sheets to be emitted from
- printers in much the same way. In addition, many printer vendors send
- their own proprietary page description language (PDL) data over a TCP
- connection to TCP port 9100, herein referred to as the
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 20]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- "pdl-datastream" protocol. In an ideal world we would have only one
- network printing protocol, and it would be sufficiently good that no
- one felt a compelling need to invent a different one. However, in
- practice, multiple legacy protocols do exist, and a service discovery
- protocol has to accommodate that.
-
- Many printers implement all three printing protocols: LPR, IPP, and
- pdl-datastream. For the benefit of clients that may speak only one of
- those protocols, all three are advertised.
-
- However, some clients may implement two, or all three of those
- printing protocols. When a client looks for all three service types
- on the network, it will find three distinct services -- an LPR
- service, an IPP service, and a pdl-datastream service -- all of which
- cause printed sheets to be emitted from the same physical printer.
-
- In the case of multiple protocols like this that all perform
- effectively the same function, the client should suppress duplicate
- names and display each name only once. When the user prints to a
- given named printer, the printing client is responsible for choosing
- the protocol which will best achieve the desired effect, without, for
- example, requiring the user to make a manual choice between LPR and
- IPP.
-
- As described so far, this all works very well. However, consider some
- future printer that only supports IPP printing, and some other future
- printer that only supports pdl-datastream printing. The name spaces
- for different service types are intentionally disjoint -- it is
- acceptable and desirable to be able to have both a file server called
- "Sales Department" and a printer called "Sales Department". However,
- it is not desirable, in the common case, to have two different
- printers both called "Sales Department", just because those printers
- are implementing different protocols.
-
- To help guard against this, when there are two or more network
- protocols which perform roughly the same logical function, one of the
- protocols is declared the "flagship" of the fleet of related
- protocols. Typically the flagship protocol is the oldest and/or
- best-known protocol of the set.
-
- If a device does not implement the flagship protocol, then it instead
- creates a placeholder SRV record (priority=0, weight=0, port=0,
- target host = hostname of device) with that name. If, when it
- attempts to create this SRV record, it finds that a record with the
- same name already exists, then it knows that this name is already
- taken by some entity implementing at least one of the protocols from
- the class, and it must choose another. If no SRV record already
- exists, then the act of creating it stakes a claim to that name so
- that future devices in the same class will detect a conflict when
- they try to use it. The SRV record needs to contain the target host
- name in order for the conflict detection rules to operate. If two
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 21]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- different devices were to create placeholder SRV records both using a
- null target host name (just the root label), then the two SRV records
- would be seen to be in agreement so no conflict would be registered.
-
- By defining a common well-known flagship protocol for the class,
- future devices that may not even know about each other's protocols
- establish a common ground where they can coordinate to verify
- uniqueness of names.
-
- No PTR record is created advertising the presence of empty flagship
- SRV records, since they do not represent a real service being
- advertised.
-
-
-10. Service Type Enumeration
-
- In general, clients are not interested in finding *every* service on
- the network, just the services that the client knows how to talk to.
- (Software designers may *think* there's some value to finding *every*
- service on the network, but that's just wooly thinking.)
-
- However, for problem diagnosis and network management tools, it may
- be useful for network administrators to find the list of advertised
- service types on the network, even if those service names are just
- opaque identifiers and not particularly informative in isolation.
-
- For this reason, a special meta-query is defined. A DNS query for
- PTR records with the name "_services._dns-sd._udp.<Domain>" yields
- a list of PTR records, where the rdata of each PTR record is the
- name of a service type. A subsequent query for PTR records with
- one of those names yields a list of instances of that service type.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 22]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-11. Populating the DNS with Information
-
- How the SRV and PTR records that describe services and allow them to
- be enumerated make their way into the DNS is outside the scope of
- this document. However, it can happen easily in any of a number of
- ways, for example:
-
- On some networks, the administrator might manually enter the records
- into the name server's configuration file.
-
- A network monitoring tool could output a standard zone file to be
- read into a conventional DNS server. For example, a tool that can
- find Apple LaserWriters using AppleTalk NBP could find the list of
- printers, communicate with each one to find its IP address,
- PostScript version, installed options, etc., and then write out a DNS
- zone file describing those printers and their capabilities using DNS
- resource records. That information would then be available to DNS-SD
- clients that don't implement AppleTalk NBP, and don't want to.
-
- Future IP printers could use Dynamic DNS Update [RFC 2136] to
- automatically register their own SRV and PTR records with the DNS
- server.
-
- A printer manager device which has knowledge of printers on the
- network through some other management protocol could also use Dynamic
- DNS Update [RFC 2136].
-
- Alternatively, a printer manager device could implement enough of the
- DNS protocol that it is able to answer DNS queries directly, and
- Example Co.'s main DNS server could delegate the
- _ipp._tcp.example.com subdomain to the printer manager device.
-
- Zeroconf printers answer Multicast DNS queries on the local link
- for appropriate PTR and SRV names ending with ".local." [mDNS]
-
-
-12. Relationship to Multicast DNS
-
- DNS-Based Service Discovery is only peripherally related to Multicast
- DNS, in that the standard unicast DNS queries used by DNS-SD may also
- be performed using multicast when appropriate, which is particularly
- beneficial in Zeroconf environments [ZC].
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 23]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-13. Discovery of Browsing and Registration Domains (Domain Enumeration)
-
- One of the main reasons for DNS-Based Service Discovery is so that
- when a visiting client (e.g. a laptop computer) arrives at a new
- network, it can discover what services are available on that network
- without manual configuration. This logic that applies to discovering
- services without manual configuration also applies to discovering the
- domains in which services are registered without requiring manual
- configuration.
-
- This discovery is performed recursively, using Unicast or Multicast
- DNS. Five special RR names are reserved for this purpose:
-
- b._dns-sd._udp.<domain>.
- db._dns-sd._udp.<domain>.
- r._dns-sd._udp.<domain>.
- dr._dns-sd._udp.<domain>.
- lb._dns-sd._udp.<domain>.
-
- By performing PTR queries for these names, a client can learn,
- respectively:
-
- o A list of domains recommended for browsing
-
- o A single recommended default domain for browsing
-
- o A list of domains recommended for registering services using
- Dynamic Update
-
- o A single recommended default domain for registering services.
-
- o The final query shown yields the "legacy browsing" domain.
- Sophisticated client applications that care to present choices of
- domain to the user, use the answers learned from the previous four
- queries to discover those domains to present. In contrast, many
- current applications browse without specifying an explicit domain,
- allowing the operating system to automatically select an
- appropriate domain on their behalf. It is for this class of
- application that the "legacy browsing" query is provided, to allow
- the network administrator to communicate to the client operating
- systems which domain should be used for these applications.
-
- These domains are purely advisory. The client or user is free to
- browse and/or register services in any domains. The purpose of these
- special queries is to allow software to create a user-interface that
- displays a useful list of suggested choices to the user, from which
- they may make a suitable selection, or ignore the offered suggestions
- and manually enter their own choice.
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 24]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- The <domain> part of the name may be "local" (meaning "perform the
- query using link-local multicast) or it may be learned through some
- other mechanism, such as the DHCP "Domain" option (option code 15)
- [RFC 2132] or the DHCP "Domain Search" option (option code 119)
- [RFC 3397].
-
- The <domain> part of the name may also be derived from the host's IP
- address. The host takes its IP address, and calculates the logical
- AND of that address and its subnet mask, to derive the 'base' address
- of the subnet. It then constructs the conventional DNS "reverse
- mapping" name corresponding to that base address, and uses that as
- the <domain> part of the name for the queries described above.
- For example, if a host has address 192.168.12.34, with subnet mask
- 255.255.0.0, then the 'base' address of the subnet is 192.168.0.0,
- and to discover the recommended legacy browsing domain for devices
- on this subnet, the host issues a DNS PTR query for the name
- "lb._dns-sd._udp.0.0.168.192.in-addr.arpa."
-
- Sophisticated clients may perform domain enumeration queries both in
- "local" and in one or more unicast domains, and then present the user
- with an aggregate result, combining the information received from all
- sources.
-
-
-14. DNS Additional Record Generation
-
- DNS has an efficiency feature whereby a DNS server may place
- additional records in the Additional Section of the DNS Message.
- These additional records are typically records that the client did
- not explicitly request, but the server has reasonable grounds to
- expect that the client might request them shortly.
-
- This section recommends which additional records should be generated
- to improve network efficiency for both unicast and multicast DNS-SD
- responses.
-
-
-14.1 PTR Records
-
- When including a PTR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o The SRV record(s) named in the PTR rdata.
- o The TXT record(s) named in the PTR rdata.
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 25]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-14.2 SRV Records
-
- When including an SVR record in a response packet, the
- server/responder SHOULD include the following additional records:
-
- o All address records (type "A" and "AAAA") named in the SRV rdata.
-
-
-14.3 TXT Records
-
- When including a TXT record in a response packet, no additional
- records are required.
-
-
-14.4 Other Record Types
-
- In response to address queries, or other record types, no additional
- records are required by this document.
-
-
-15. Comparison with Alternative Service Discovery Protocols
-
- Over the years there have been many proposed ways to do network
- service discovery with IP, but none achieved ubiquity in the
- marketplace. Certainly none has achieved anything close to the
- ubiquity of today's deployment of DNS servers, clients, and other
- infrastructure.
-
- The advantage of using DNS as the basis for service discovery is that
- it makes use of those existing servers, clients, protocols,
- infrastructure, and expertise. Existing network analyzer tools
- already know how to decode and display DNS packets for network
- debugging.
-
- For ad-hoc networks such as Zeroconf environments, peer-to-peer
- multicast protocols are appropriate. The Zeroconf host profile [ZCHP]
- requires the use of a DNS-like protocol over IP Multicast for host
- name resolution in the absence of DNS servers. Given that Zeroconf
- hosts will have to implement this Multicast-based DNS-like protocol
- anyway, it makes sense for them to also perform service discovery
- using that same Multicast-based DNS-like software, instead of also
- having to implement an entirely different service discovery protocol.
-
- In larger networks, a high volume of enterprise-wide IP multicast
- traffic may not be desirable, so any credible service discovery
- protocol intended for larger networks has to provide some facility to
- aggregate registrations and lookups at a central server (or servers)
- instead of working exclusively using multicast. This requires some
- service discovery aggregation server software to be written,
- debugged, deployed, and maintained. This also requires some service
- discovery registration protocol to be implemented and deployed for
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 26]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- clients to register with the central aggregation server. Virtually
- every company with an IP network already runs a DNS server, and DNS
- already has a dynamic registration protocol [RFC 2136]. Given that
- virtually every company already has to operate and maintain a DNS
- server anyway, it makes sense to take advantage of this instead of
- also having to learn, operate and maintain a different service
- registration server. It should be stressed again that using the same
- software and protocols doesn't necessarily mean using the same
- physical piece of hardware. The DNS-SD service discovery functions
- do not have to be provided by the same piece of hardware that
- is currently providing the company's DNS name service. The
- "_tcp.<Domain>" subdomain may be delegated to a different piece of
- hardware. However, even when the DNS-SD service is being provided by
- a different piece of hardware, it is still the same familiar DNS
- server software that is running, with the same configuration file
- syntax, the same log file format, and so forth.
-
- Service discovery needs to be able to provide appropriate security.
- DNS already has existing mechanisms for security [RFC 2535].
-
- In summary:
-
- Service discovery requires a central aggregation server.
- DNS already has one: It's called a DNS server.
-
- Service discovery requires a service registration protocol.
- DNS already has one: It's called DNS Dynamic Update.
-
- Service discovery requires a query protocol
- DNS already has one: It's called DNS.
-
- Service discovery requires security mechanisms.
- DNS already has security mechanisms: DNSSEC.
-
- Service discovery requires a multicast mode for ad-hoc networks.
- Zeroconf environments already require a multicast-based DNS-like
- name lookup protocol for mapping host names to addresses, so it
- makes sense to let one multicast-based protocol do both jobs.
-
- It makes more sense to use the existing software that every network
- needs already, instead of deploying an entire parallel system just
- for service discovery.
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 27]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-16. Real Example
-
- The following examples were prepared using standard unmodified
- nslookup and standard unmodified BIND running on GNU/Linux.
-
- Note: In real products, this information is obtained and presented to
- the user using graphical network browser software, not command-line
- tools, but if you wish you can try these examples for yourself as you
- read along, using the command-line tools already available on your
- own Unix machine.
-
-16.1 Question: What FTP servers are being advertised from dns-sd.org?
-
- nslookup -q=ptr _ftp._tcp.dns-sd.org.
- _ftp._tcp.dns-sd.org
- name = Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- _ftp._tcp.dns-sd.org
- name = Microsoft\032Developer\032Files._ftp._tcp.dns-sd.org
- _ftp._tcp.dns-sd.org
- name = Registered\032Users'\032Only._ftp._tcp.dns-sd.org
-
- Answer: There are three, called "Apple QuickTime Files",
- "Microsoft Developer Files" and "Registered Users' Only".
-
- Note that nslookup escapes spaces as "\032" for display purposes,
- but a graphical DNS-SD browser does not.
-
-16.2 Question: What FTP servers allow anonymous access?
-
- nslookup -q=ptr _anon._sub._ftp._tcp.dns-sd.org
- _anon._sub._ftp._tcp.dns-sd.org
- name = Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- _anon._sub._ftp._tcp.dns-sd.org
- name = Microsoft\032Developer\032Files._ftp._tcp.dns-sd.org
-
- Answer: Only "Apple QuickTime Files" and "Microsoft Developer Files"
- allow anonymous access.
-
-16.3 Question: How do I access "Apple QuickTime Files"?
-
- nslookup -q=any "Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org."
- Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- text = "path=/quicktime"
- Apple\032QuickTime\032Files._ftp._tcp.dns-sd.org
- priority = 0, weight = 0, port= 21 host = ftp.apple.com
- ftp.apple.com internet address = 17.254.0.27
- ftp.apple.com internet address = 17.254.0.31
- ftp.apple.com internet address = 17.254.0.26
-
- Answer: You need to connect to ftp.apple.com, port 21, path
- "/quicktime". The addresses for ftp.apple.com are also given.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 28]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
-17. IPv6 Considerations
-
- IPv6 has no significant differences, except that the address of the
- SRV record's target host is given by the appropriate IPv6 address
- records instead of the IPv4 "A" record.
-
-
-18. Security Considerations
-
- DNSSEC [RFC 2535] should be used where the authenticity of
- information is important. Since DNS-SD is just a naming and usage
- convention for records in the existing DNS system, it has no specific
- additional security requirements over and above those that already
- apply to DNS queries and DNS updates.
-
-
-19. IANA Considerations
-
- This protocol builds on DNS SRV records [RFC 2782], and similarly
- requires IANA to assign unique application protocol names.
- Unfortunately, the "IANA Considerations" section of RFC 2782 says
- simply, "The IANA has assigned RR type value 33 to the SRV RR.
- No other IANA services are required by this document."
- Due to this oversight, IANA is currently prevented from carrying
- out the necessary function of assigning these unique identifiers.
-
- This document proposes the following IANA allocation policy for
- unique application protocol names:
-
- Allowable names:
- * Must be no more than fourteen characters long
- * Must consist only of:
- - lower-case letters 'a' - 'z'
- - digits '0' - '9'
- - the hyphen character '-'
- * Must begin and end with a lower-case letter or digit.
- * Must not already be assigned to some other protocol in the
- existing IANA "list of assigned application protocol names
- and port numbers" [ports].
-
- These identifiers are allocated on a First Come First Served basis.
- In the event of abuse (e.g. automated mass registrations, etc.),
- the policy may be changed without notice to Expert Review [RFC 2434].
-
- The textual nature of service/protocol names means that there are
- almost infinitely many more of them available than the finite set of
- 65535 possible port numbers. This means that developers can produce
- experimental implementations using unregistered service names with
- little chance of accidental collision, providing service names are
- chosen with appropriate care. However, this document strongly
- advocates that on or before the date a product ships, developers
- should properly register their service names.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 29]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- Some developers have expressed concern that publicly registering
- their service names (and port numbers today) with IANA before a
- product ships may give away clues about that product to competitors.
- For this reason, IANA should consider allowing service name
- applications to remain secret for some period of time, much as US
- patent applications remain secret for two years after the date of
- filing.
-
- This proposed IANA allocation policy is not in force until this
- document is published as an RFC. In the meantime, unique application
- protocol names may be registered according to the instructions at
- <http://www.dns-sd.org/ServiceTypes.html>. As of January 2004, there
- are roughly 100 application protocols in currently shipping products
- that have been so registered as using DNS-SD for service discovery.
-
-
-20. Acknowledgments
-
- The concepts described in this document have been explored, developed
- and implemented with help from Richard Brown, Erik Guttman, Paul
- Vixie, and Bill Woodcock.
-
- Special thanks go to Bob Bradley, Josh Graessley, Scott Herscher,
- Roger Pantos and Kiren Sekar for their significant contributions.
-
-
-21. Copyright
-
- Copyright (C) The Internet Society 2005.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 30]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-22. Normative References
-
- [ports] IANA list of assigned application protocol names and port
- numbers <http://www.iana.org/assignments/port-numbers>
-
- [RFC 1033] Lottor, M., "Domain Administrators Operations Guide",
- RFC 1033, November 1987.
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
- [RFC 2782] Gulbrandsen, A., et al., "A DNS RR for specifying the
- location of services (DNS SRV)", RFC 2782, February 2000.
-
-
-23. Informative References
-
- [mDNS] Cheshire, S., and M. Krochmal, "Multicast DNS",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-multicastdns-05.txt, June 2005.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-04.txt, June 2005.
-
- [RFC 2132] Alexander, S., and Droms, R., "DHCP Options and BOOTP
- Vendor Extensions", RFC 2132, March 1997.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2434] Narten, T., and H. Alvestrand, "Guidelines for Writing
- an IANA Considerations Section in RFCs", RFC 2434,
- October 1998.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 31]
-
-Internet Draft DNS-Based Service Discovery 7th June 2005
-
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [RFC 3007] Wellington, B., et al., "Secure Domain Name System (DNS)
- Dynamic Update", RFC 3007, November 2000.
-
- [RFC 3397] Aboba, B., and Cheshire, S., "Dynamic Host Configuration
- Protocol (DHCP) Domain Search Option", RFC 3397, November
- 2002.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
- [ZCHP] Guttman, E., "Zeroconf Host Profile Applicability
- Statement", Internet-Draft (work in progress),
- draft-ietf-zeroconf-host-prof-01.txt, July 2001.
-
-
-24. Authors' Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 32]
diff --git a/trunk/specs/draft-cheshire-dnsext-multicastdns-03.txt b/trunk/specs/draft-cheshire-dnsext-multicastdns-03.txt
deleted file mode 100644
index f9505d9..0000000
--- a/trunk/specs/draft-cheshire-dnsext-multicastdns-03.txt
+++ /dev/null
@@ -1,2494 +0,0 @@
-Document: draft-cheshire-dnsext-multicastdns-03.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 29th July 2004 Marc Krochmal
- Apple Computer, Inc.
- 29th January 2003
-
- Multicast DNS
-
- <draft-cheshire-dnsext-multicastdns-03.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- As networked devices become smaller, more portable, and more
- ubiquitous, the ability to operate with less configured
- infrastructure is increasingly important. In particular, the ability
- to look up DNS resource record data types (including, but not limited
- to, host names) in the absence of a conventional managed DNS server,
- is becoming essential.
-
- Multicast DNS (mDNS) provides the ability to do DNS-like operations
- on the local link in the absense of any conventional unicast DNS
- server. In addition, mDNS designates a portion of the DNS namespace
- to be free for local use, without the need to pay any annual fee, and
- without the need to set up delegations or otherwise configure a
- conventional DNS server to answer for those names.
-
- The primary benefits of mDNS names are that (i) they require little
- or no administration or configuration to set them up, (ii) they work
- when no infrastructure is present, and (iii) they work during
- infrastructure failures.
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 1]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-Table of Contents
-
- 1. Introduction...................................................3
- 2. Conventions and Terminology Used in this Document..............4
- 3. Multicast DNS Names............................................4
- 4. IP TTL Checks..................................................8
- 5. Reverse Address Mapping........................................8
- 6. Querying.......................................................9
- 7. Duplicate Suppression.........................................13
- 8. Responding....................................................15
- 9. Probing and Announcing on Startup.............................17
- 10. Conflict Resolution...........................................21
- 11. Special Characteristics of Multicast DNS Domains..............23
- 12. Multicast DNS for Service Discovery...........................24
- 13. Resource Record TTL Values and Cache Coherency................25
- 14. Enabling and Disabling Multicast DNS..........................30
- 15. Considerations for Multiple Interfaces........................30
- 16. Multicast DNS and Power Management............................31
- 17. Multicast DNS Character Set...................................32
- 18. Multicast DNS Message Size....................................33
- 19. Multicast DNS Message Format..................................33
- 20. Choice of UDP Port Number.....................................36
- 21. Summary of Differences Between Multicast DNS and Unicast DNS..37
- 22. Benefits of Multicast Responses...............................38
- 23. IPv6 Considerations...........................................39
- 24. Security Considerations.......................................40
- 25. IANA Considerations...........................................41
- 26. Acknowledgements..............................................41
- 27. Copyright.....................................................41
- 28. Normative References..........................................42
- 29. Informative References........................................42
- 30. Author's Addresses............................................43
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 2]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-1. Introduction
-
- When reading this document, familiarity with the concepts of Zero
- Configuration Networking [ZC] and automatic link-local addressing
- [v4LL] [RFC 2462] is helpful.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, or resource record types.
- This document simply discusses what needs to happen if DNS clients
- start sending DNS queries to a multicast address, and how a
- collection of hosts can cooperate to collectively answer those
- queries in a useful manner.
-
- There has been discussion of how much burden Multicast DNS might
- impose on a network. It should be remembered that whenever IPv4 hosts
- communicate, they broadcast ARP packets on the network on a regular
- basis, and this is not disastrous. The approximate amount of
- multicast traffic generated by hosts making conventional use of
- Multicast DNS is anticipated to be roughly the same order of
- magnitude as the amount of broadcast ARP traffic those hosts already
- generate.
-
- New applications making new use of Multicast DNS capabilities for
- unconventional purposes may generate more traffic. If some of those
- new applications are "chatty", then work will be needed to help them
- become less chatty. When performing any analysis, it is important to
- make a distinction between the application behavior and the
- underlying protocol behavior. If a chatty application uses UDP, that
- doesn't mean that UDP is chatty, or that IP is chatty, or that
- Ethernet is chatty. What it means is that the application is chatty.
- The same applies to any future applications that may decide to layer
- increasing portions of their functionality over Multicast DNS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 3]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
- This document uses the term "host name" in the strict sense to mean a
- fully qualified domain name that has an address record. It does not
- use the term "host name" in the commonly used but incorrect sense to
- mean just the first DNS label of a host's fully qualified domain
- name.
-
- A DNS (or mDNS) packet contains an IP TTL in the IP header, which
- is effectively a hop-count limit for the packet, to guard against
- routing loops. Each Resource Record also contains a TTL, which is
- the number of seconds for which the Resource Record may be cached.
-
- In any place where there may be potential confusion between these two
- types of TTL, the term "IP TTL" is used to refer to the IP header TTL
- (hop limit), and the term "RR TTL" is used to refer to the Resource
- Record TTL (cache lifetime).
-
- When this document uses the term "Multicast DNS", it should be taken
- to mean: Clients performing DNS-like queries for DNS-like resource
- records by sending DNS-like UDP query and response packets over IP
- Multicast to UDP port 5353."
-
-
-3. Multicast DNS Names
-
- This document proposes that the DNS top-level domain ".local." be
- designated a special domain with special semantics, namely that any
- fully-qualified name ending in ".local." is link-local, and names
- within this domain are meaningful only on the link where they
- originate. This is analogous to IPv4 addresses in the 169.254/16
- prefix, which are link-local and meaningful only on the link where
- they originate.
-
- Any DNS query for a name ending with ".local." MUST be sent
- to the mDNS multicast address (224.0.0.251 or its IPv6 equivalent
- FF02::FB).
-
- It is unimportant whether a name ending with ".local." occurred
- because the user explicitly typed in a fully qualified domain name
- ending in ".local.", or because the user entered an unqualified
- domain name and the host software appended the suffix ".local."
- because that suffix appears in the user's search list. The ".local."
- suffix could appear in the search list because the user manually
- configured it, or because it was received in a DHCP option, or via
- any other valid mechanism for configuring the DNS search list. In
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 4]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- this respect the ".local." suffix is treated no differently to any
- other search domain that might appear in the DNS search list.
-
- DNS queries for names that do not end with ".local." MAY be sent to
- the mDNS multicast address, if no other conventional DNS server is
- available. This can allow hosts on the same link to continue
- communicating using each other's globally unique DNS names during
- network outages which disrupt communication with the greater
- Internet. When resolving global names via local multicast, it is even
- more important to use DNSSEC or other security mechanisms to ensure
- that the response is trustworthy. Resolving global names via local
- multicast is a contentious issue, and this document does not discuss
- it in detail, instead concentrating on the issue of resolving local
- names using DNS packets sent to a multicast address.
-
- A host which belongs to an organization or individual who has control
- over some portion of the DNS namespace can be assigned a globally
- unique name within that portion of the DNS namespace, for example,
- "cheshire.apple.com." For those of us who have this luxury, this
- works very well. However, the majority of home customers do not have
- easy access to any portion of the global DNS namespace within which
- they have the authority to create names as they wish. This leaves the
- majority of home computers effectively anonymous for practical
- purposes.
-
- To remedy this problem, this document allows any computer user to
- elect to give their computers link-local Multicast DNS host names of
- the form: "single-dns-label.local." For example, my Titanium
- PowerBook laptop computer answers to the name "sctibook.local." Any
- computer user is granted the authority to name their computer this
- way, providing that the chosen host name is not already in use on
- that link. Having named their computer this way, the user has the
- authority to continue using that name until such time as a name
- conflict occurs on the link which is not resolved in the user's
- favour. If this happens, the computer (or its human user) SHOULD
- cease using the name, and may choose to attempt to allocate a new
- unique name for use on that link. Like law suits over global DNS
- names, these conflicts are expected to be relatively rare for people
- who choose reasonably imaginative names, but it is still important
- to have a mechanism in place to handle them when they happen.
-
- The point made in the previous paragraph is very important and bears
- repeating. It is easy for those of us in the IETF community who run
- our own name servers at home to forget that the majority of computer
- users do not run their own name server and have no easy way to create
- their own host names. When these users wish to transfer files between
- two laptop computers, they are frequently reduced to typing in
- dotted-decimal IP addresses because they simply have no other way for
- one host to refer to the other by name. This is a sorry state of
- affairs. What is worse, most users don't even bother trying to use
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 5]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- dotted-decimal IP addresses. Most users still move data between
- machines by copying it onto a floppy disk or similar removable media.
-
- In a world of gigabit Ethernet and ubiquitous wireless networking it
- is a sad indictment of the networking community that the preferred
- communication medium for most computer users is still the floppy
- disk.
-
- Allowing ad-hoc allocation of single-label names in a single flat
- ".local." namespace may seem to invite chaos. However, operational
- experience with AppleTalk NBP names, which on any given link are also
- effectively single-label names in a flat namespace, shows that in
- practice name collisions happen extremely rarely and are not a
- problem. Groups of computer users from disparate organizations bring
- Macintosh laptop computers to events such as IETF Meetings, the Mac
- Hack conference, the Apple World Wide Developer Conference, etc., and
- complaints at these events about users suffering conflicts and being
- forced to rename their machines have never been an issue.
-
- Enforcing uniqueness of host names (i.e. the names of DNS address
- records mapping names to IP addresses) is probably desirable in the
- common case, but this document does not mandate that. It is
- permissible for a collection of coordinated hosts to agree to
- maintain multiple DNS address records with the same name, possibly
- for load balancing or fault-tolerance reasons. This document does not
- take a position on whether that is sensible. It is important that
- both modes of operation are supported. The Multicast DNS protocol
- allows hosts to verify and maintain unique names for resource records
- where that behaviour is desired, and it also allows hosts to maintain
- multiple resource records with a single shared name where that
- behaviour is desired. This consideration applies to all resource
- records, not just address records (host names). In summary: It is
- required that the protocol have the ability to detect and handle name
- conflicts, but it is not required that this ability be used for every
- record.
-
-
-3.1 Governing Standards Body
-
- Note that this use of the ".local." suffix falls under IETF
- jurisdiction, not ICANN jurisdiction. DNS is an IETF network
- protocol, governed by protocol rules defined by the IETF. These IETF
- protocol rules dictate character set, maximum name length, packet
- format, etc. ICANN determines additional rules that apply when the
- IETF's DNS protocol is used on the public Internet. In contrast,
- private uses of the DNS protocol on isolated private networks are not
- governed by ICANN. Since this proposed change is a change to the core
- DNS protocol rules, it affects everyone, not just those machines
- using the ICANN-governed Internet. Hence this change falls into the
- category of an IETF protocol rule, not an ICANN usage rule.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 6]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-3.2 Private DNS Namespaces
-
- Note also that the special treatment of names ending in ".local." has
- been implemented in Macintosh computers since the days of Mac OS 9,
- and continues today in Mac OS X. There are also implementations for
- Linux and other platforms [dotlocal]. Operators setting up private
- internal networks ("intranets") are advised that their lives may be
- easier if they avoid using the suffix ".local." in names in their
- private internal DNS server. Alternative possibilities include:
-
- .intranet
- .internal
- .private
- .corp
- .home
-
- Another alternative naming scheme, advocated by Professor D. J.
- Bernstein, is to use a numerical suffix, such as ".6." [djbdl].
-
-
-3.3 Maximum Multicast DNS Name Length
-
- RFC 1034 says:
-
- "the total number of octets that represent a domain name (i.e.,
- the sum of all label octets and label lengths) is limited to 255."
-
- This text implies that the final root label at the end of every name
- is included in this count (a name can't be represented without it),
- but the text does not explicitly state that. Implementations of
- Multicast DNS MUST include the label length byte of the final root
- label at the end of every name when enforcing the rule that no name
- may be longer than 255 bytes. For example, the length of the name
- "apple.com." is considered to be 11, which is the number of bytes it
- takes to represent that name in a packet without using name
- compression:
-
- ------------------------------------------------------
- | 0x05 | a | p | p | l | e | 0x03 | c | o | m | 0x00 |
- ------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 7]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-4. IP TTL Checks
-
- All Multicast DNS responses (including responses sent via unicast)
- MUST be sent with IP TTL set to 255.
-
- A host sending Multicast DNS queries to a link-local destination
- address (including the 224.0.0.251 link-local multicast address) MUST
- verify that the IP TTL in response packets is 255, and silently
- discard any response packets where the IP TTL is not 255. Without
- this check, it could be possible for remote rogue hosts to send
- spoof answer packets (perhaps unicast to the victim host) which the
- receiving machine could misinterpret as having originated on the
- local link.
-
- The authors have heard complaints that some older network stack
- implementations do not implement the IP_RECVTTL socket option
- (or equivalent API) for obtaining the IP TTL of received packets.
- This is unfortunate, and these old network stacks would benefit
- from adding this API support so that they may benefit from this
- enhanced protection against spoof packets arriving from off-link.
-
- Note that Multicast DNS Responders SHOULD NOT discard queries with
- TTLs other than 255. There may be valid future applications of
- Multicast DNS where hosts issue unicast queries directed at Multicast
- DNS Responders more than one hop away, if Multicast DNS Responders
- were to discard queries where the TTL is not 255, they would not
- answer these queries.
-
-
-5. Reverse Address Mapping
-
- Like ".local.", the IPv4 and IPv6 reverse-mapping domains are also
- defined to be link-local.
-
- Any DNS query for a name ending with "254.169.in-addr.arpa." MUST
- be sent to the mDNS multicast address 224.0.0.251. Since names under
- this domain correspond to IPv4 link-local addresses, it is logical
- that the local link is the best place to find information pertaining
- to those names. As an optimization, these queries MAY be first
- unicast directly to the address in question, but if this query is not
- answered, the query MUST also be sent via multicast, to accommodate
- the case where the machine in question is not answering for itself
- (for example, because it is currently sleeping).
-
- Likewise, any DNS query for a name ending with "0.8.e.f.ip6.arpa."
- MUST be sent to the IPv6 mDNS link-local multicast address FF02::FB,
- with or without an optional initial query unicast directly to the
- address in question.
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 8]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-6. Querying
-
- There are three kinds of Multicast DNS Queries, one-shot queries of
- the kind made by today's conventional DNS clients, one-shot queries
- accumulating multiple responses made by multicast-aware DNS clients,
- and continuous ongoing Multicast DNS Queries used by IP network
- browser software.
-
- A Multicast DNS Responder that is offering records that are intended
- to be unique on the local link MUST also implement a Multicast DNS
- Querier so that it can first verify the uniqueness of those records
- before it begins answering queries for them.
-
-
-6.1 One-Shot Queries
-
- An unsophisticated DNS client may simply send its DNS queries
- blindly to the 224.0.0.251 multicast address, without necessarily
- even being aware what a multicast address is.
-
- Such an unsophisticated DNS client may not get ideal behaviour. Such
- a client may simply take the first response it receives and fail to
- wait to see if there are more, but in many instances this may not be
- a serious problem. If a user types "http://stu.local." into their Web
- browser and gets to see the page they were hoping for, then the
- protocol has met the user's needs in this case.
-
-
-6.2 One-Shot Queries, Accumulating Multiple Responses
-
- A more sophisticated DNS client should understand that Multicast DNS
- is not exactly the same as unicast DNS, and should modify its
- behaviour in some simple ways.
-
- As described above, there are some cases, such as looking up the
- address associated with a unique host name, where a single response
- is sufficient, and moreover may be all that is expected. However,
- there are other DNS queries where more than one response is
- possible, and for these queries a more sophisticated Multicast DNS
- client should include the ability to wait for an appropriate period
- of time to collect multiple responses.
-
- A naive DNS client retransmits its query only so long as it has
- received no response. A more sophisticated Multicast DNS client is
- aware that having received one response is not necessarily an
- indication that it might not receive others, and has the ability to
- retransmit its query an appropriate number of times at appropriate
- intervals until it is satisfied with the collection of responses it
- has gathered.
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 9]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- A more sophisticated Multicast DNS client that is retransmitting
- a query for which it has already received some responses, MUST
- implement Known Answer Suppression, as described below in Section
- 7.1. This indicates to responders who have already replied that their
- responses have been received, and they don't need to send them again
- in response to this repeated query. In addition, the interval between
- the first two queries MUST be at least one second, and the
- intervals between subsequent queries MUST double.
-
-
-6.3 Continuous Querying
-
- In One-Shot Queries, with either a single or multiple responses,
- the underlying assumption is that the transaction begins when the
- application issues a query, and ends when all the desired responses
- have been received. There is another type of operation which is more
- akin to continuous monitoring.
-
- Macintosh users are accustomed to opening the "Chooser" window,
- selecting a desired printer, and then closing the Chooser window.
- However, when the desired printer does not appear in the list, the
- user will typically leave the "Chooser" window open while they go and
- check to verify that the printer is plugged in, powered on, connected
- to the Ethernet, etc. While the user jiggles the wires, hits the
- Ethernet hub, and so forth, they keep an eye on the Chooser window,
- and when the printer name appears, they know they have fixed whatever
- the problem was. This can be a useful and intuitive troubleshooting
- technique, but a user who goes home for the weekend leaving the
- Chooser window open places a non-trivial burden on the network.
-
- With continuous querying, multiple queries are sent over a long
- period of time, until the user terminates the operation. It is
- important that an IP network browser window displaying live
- information from the network using Multicast DNS, if left running for
- an extended period of time, should generate significantly less
- multicast traffic on the network than the old AppleTalk Chooser.
- Therefore, the interval between the first two queries MUST be at
- least one second, the intervals between subsequent queries MUST
- double, and the querier MUST implement Known Answer Suppression, as
- described below in Section 7.1.
-
- When a Multicast DNS Querier receives an answer, the answer contains
- a TTL value that indicates for how many seconds this answer is valid.
- After this interval has passed, the answer will no longer be valid
- and should be deleted from the cache. Before this time is reached, a
- Multicast DNS Querier with an ongoing interest in that record SHOULD
- re-issue its query to determine whether the record is still valid,
- and if so update its expiry time.
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 10]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- To perform this cache maintenance, a Multicast DNS Querier should
- plan to issue a query at 80% of the record lifetime, and then if no
- answer is received, at 85%, 90% and 95%. If an answer is received,
- then the remaining TTL is reset to the value given in the answer, and
- this process repeats for as long as the Multicast DNS Querier has an
- ongoing interest in the record. If after four queries no answer is
- received, the record is deleted when it reaches 100% of its lifetime.
-
- To avoid the case where multiple Multicast DNS Queriers on a network
- all issue their queries simultaneously, a random variation of 2% of
- the record TTL should be added, so that queries are scheduled to be
- performed at 80-82%, 85-87%, 90-92% and then 95-97% of the TTL.
-
-
-6.4 Multiple Questions per Query
-
- Multicast DNS allows a querier to place multiple questions in the
- question section of a single Multicast DNS query packet.
-
- The semantics of a Multicast DNS query packet containing multiple
- questions is identical to a series of individual DNS query packets
- containing one question each. Combining multiple questions into a
- single packet is purely an efficiency optimization, and has no other
- semantic significance.
-
- A useful technique for adaptively combining multiple questions into a
- single query is to use a Nagle-style algorithm: When a client issues
- its first question, a Query packet is immediately built and sent,
- without delay. If the client then continues issuing a rapid series of
- questions they are held until either the first query receives at
- least one answer, or 100ms has passed, or there are enough questions
- to fill the question section of a Multicast DNS query packet. At this
- time, all the held questions are placed into a Multicast DNS query
- packet and sent.
-
-
-6.5 Questions Requesting Unicast Responses
-
- Sending Multicast DNS responses via multicast has the benefit that
- all the other hosts on the network get to see those responses, and
- can keep their caches up to date, and detect conflicting responses.
-
- However, there are situations where all the other hosts on the
- network don't need to see every response. One example is a laptop
- computer waking from sleep. At that instant it is a brand new
- participant on a new network. Its Multicast DNS cache is empty, and
- it has no knowledge of its surroundings. It may have a significant
- number of queries that it wants answered right away to discover
- information about its new surroundings and present that information
- to the user. As a new participant on the network, it has no idea
- whether the exact same questions may have been asked and answered
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 11]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- just seconds ago. In this case, trigging a large sudden flood of
- multicast responses may impose an unreasonable burden on the network.
- To avoid this, the Multicast DNS Querier SHOULD set the top bit in
- the class field of its DNS question(s), to indicate that it is
- willing to accept unicast responses instead of the usual multicast
- responses. These questions requesting unicast responses are referred
- to as "QU" questions, to distinguish them from the more usual
- questions requesting multicast responses ("QM" questions).
-
- When retransmitting a question more than once, the 'unicast response'
- bit SHOULD be set only for the first question of the series. After
- the first question has received its responses, the querier should
- have a large known-answer list (see "Known Answer Suppression" below)
- so that subsequent queries should elicit few, if any, further
- responses. Reverting to multicast responses as soon as possible is
- important because of the benefits that multicast responses provide
- (see "Benefits of Multicast Responses" below).
-
- When receiving a question with the 'unicast response' bit set, a
- responder SHOULD usually respond with a unicast packet directed back
- to the querier. If the responder has not multicast that record
- recently (within one quarter of its TTL), then the responder SHOULD
- instead multicast the response so as to keep all the peer caches up
- to date, and to permit passive conflict detection.
-
-
-6.6 Suppressing Initial Query
-
- If a query is issued for which there already exist one or more
- records in the local cache, and those record(s) were received with
- the cache flush bit set, indicating that they form a unique RRSet,
- then the host SHOULD suppress its initial "QU" query, and proceed to
- issue a "QM" query. To avoid the situation where a group of hosts
- are synchronized by some external event and all perform the same
- query simultaneously, a host suppressing its initial "QU" query
- SHOULD impose a random delay from 500-1000ms before transmitting its
- first "QM" query for this question. This means that when the first
- host (selected randomly by this algorithm) transmits its "QM" query,
- all the other hosts that were about to transmit the same query can
- suppress their superfluous query, as described in "Duplicate
- Question Suppression" below.
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 12]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-7. Duplicate Suppression
-
- A variety of techniques are used to reduce the amount of redundant
- traffic on the network.
-
-
-7.1 Known Answer Suppression
-
- When a Multicast DNS Querier sends a query to which it already knows
- some answers, it populates the Answer Section of the DNS message with
- those answers.
-
- A Multicast DNS Responder SHOULD NOT answer a Multicast DNS Query if
- the answer it would give is already included in the Answer Section
- with an RR TTL at least half the correct value. If the RR TTL of the
- answer as given in the Answer Section is less than half of the true
- RR TTL as known by the Multicast DNS Responder, the responder MUST
- send an answer so as to update the Querier's cache before the record
- becomes in danger of expiration.
-
- Because a Multicast DNS Responder will respond if the remaining TTL
- given in the known answer list is less than half the true TTL, it is
- superfluous for the Querier to include such records in the known
- answer list. Therefore a Multicast DNS Querier SHOULD NOT include
- records in the known answer list whose remaining TTL is less than
- half their original TTL. Doing so would simply consume space in the
- packet without achieving the goal of suppressing responses, and would
- therefore be a pointless waste of network bandwidth.
-
- A Multicast DNS Querier MUST NOT cache resource records observed in
- the Known Answer Section of other Multicast DNS Queries. The Answer
- Section of Multicast DNS Queries is not authoritative. By placing
- information in the Answer Section of a Multicast DNS Query the
- querier is stating that it *believes* the information to be true.
- It is not asserting that the information *is* true. Some of those
- records may have come from other hosts that are no longer on the
- network. Propagating that stale information to other Multicast DNS
- Queriers on the network would not be helpful.
-
-
-7.2 Multi-Packet Known Answer Suppression
-
- Sometimes a Multicast DNS Querier will already have too many answers
- to fit in the Known Answer section of its query packets. In this
- case, it should issue a Multicast DNS Query containing a question and
- as many Known Answer records as will fit. It should then set the TC
- (Truncated) bit in the header before sending the Query. It should
- then immediately follow the packet with another query containing no
- questions, and as many more Known Answer records as will fit. If
- there are still too many records remaining to fit in the packet, it
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 13]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- again sets the TC bit and continues until all the Known Answer
- records have been sent.
-
- A Multicast DNS Responder seeing a Multicast DNS Query with the TC
- bit set defers its response for a time period randomly selected in
- the interval 20-120ms. This gives the Multicast DNS Querier time to
- send additional Known Answer packets before the Responder responds.
- If the Responder sees any of its answers listed in the Known Answer
- lists of subsequent packets from the querying host, it should delete
- that answer from the list of answers it is planning to give, provided
- that no other host on the network is also waiting to receive the same
- answer record.
-
-
-7.3 Duplicate Question Suppression
-
- If a host is planning to send a query, and it sees another host on
- the network send a query containing the same question, and the Known
- Answer section of that query does not contain any records which this
- host would not also put in its own Known Answer section, then this
- host should treat its own query as having been sent. When multiple
- clients on the network are querying for the same resource records,
- there is no need for them to all be repeatedly asking the same
- question.
-
-
-7.4 Duplicate Answer Suppression
-
- If a host is planning to send an answer, and it sees another host on
- the network send a response packet containing the same answer record,
- and the TTL in that record is not less than the TTL this host would
- have given, then this host should treat its own answer as having been
- sent. When multiple responders on the network have the same data,
- there is no need for all of them to respond.
-
- This feature is particularly useful when multiple Sleep Proxy Servers
- are deployed (see Section 16. "Multicast DNS and Power Management").
- In the future it is possible that every general-purpose OS (Mac,
- Windows, Linux, etc.) will implement Sleep Proxy Service as a matter
- of course. In this case there could be a large number of Sleep Proxy
- Servers on any given network, which is good for reliability and
- fault-tolerance, but would be bad for the network if every Sleep
- Proxy Server were to answer every query.
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 14]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-8. Responding
-
- A Multicast DNS Responder MUST only respond when it has a positive
- non-null response to send. Error responses must never be sent. The
- non-existence of any name in a Multicast DNS Domain is ascertained by
- the failure of any machine to respond to the Multicast DNS query, not
- by NXDOMAIN errors.
-
- Multicast DNS Responses MUST NOT contain any questions in the
- Question Section. Any questions in the Question Section of a received
- Multicast DNS Response MUST be silently ignored. Multicast DNS
- Queriers receiving Multicast DNS Responses do not care what question
- elicited the response; they care only that the information in the
- response is true and accurate.
-
- A Multicast DNS Responder on Ethernet [IEEE802] and similar shared
- multiple access networks SHOULD delay its responses by a random
- amount of time selected with uniform random distribution in the range
- 20-120ms. If multiple Multicast DNS Responders were all to respond
- immediately to a particular query, a collision would be virtually
- guaranteed. By imposing a small random delay, the number of
- collisions is dramatically reduced. 120ms is a short enough time that
- it is almost imperceptible to a human user, but long enough to
- significantly reduce the risk of Ethernet collisions. On a full-sized
- Ethernet using the maximum cable lengths allowed and the maximum
- number of repeaters allowed, an Ethernet frame is vulnerable to
- collisions during the transmission of its first 256 bits. On 10Mb/s
- Ethernet, this equates to a vulnerable time window of 25.6us.
-
- In the case where a Multicast DNS Responder has good reason to
- believe that it will be the only responder on the link with a
- positive non-null response, it SHOULD NOT impose the random delay
- before responding, and SHOULD normally generate its response within
- 10ms. To do this safely, it MUST have previously verified that the
- requested name, type and class in the DNS query are unique on this
- link. Responding immediately without delay is appropriate for things
- like looking up the address record for a particular host name, when
- the host name has been previously verified unique. Responding
- immediately without delay is *not* appropriate for things like
- looking up PTR records used for DNS Service Discovery [DNS-SD], where
- a large number of responses may be anticipated.
-
- Except when a unicast reply has been explicitly requested via the
- "unicast reply" bit, Multicast DNS Responses MUST be sent to UDP port
- 5353 (the well-known port assigned to mDNS) on the 224.0.0.251
- multicast address (or its IPv6 equivalent FF02::FB). Operating in a
- Zeroconf environment requires constant vigilance. Just because a name
- has been previously verified unique does not mean it will continue to
- be so indefinitely. By allowing all Multicast DNS Responders to
- constantly monitor their peers' responses, conflicts arising out of
- network topology changes can be promptly detected and resolved.
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 15]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- Sending all responses by multicast also facilitates opportunistic
- caching by other hosts on the network.
-
- To protect the network against excessive packet flooding due to
- software bugs or malicious attack, a Multicast DNS Responder MUST NOT
- multicast a given record on a given interface if it has previously
- multicast that record on that interface within the last second. A
- legitimate client on the network should have seen the previous
- transmission and cached it. A client that did not receive and cache
- the previous transmission will retry its request and receive a
- subsequent response. Under no circumstances is there any legitimate
- reason for a Multicast DNS Responder to multicast a given record more
- than once per second on any given interface.
-
-
-8.1 Legacy Unicast Responses
-
- If the source UDP port in a received Multicast DNS Query is not port
- 5353, this indicates that the client originating the query is a
- simple client that does not fully implement all of Multicast DNS. In
- this case, the Multicast DNS Responder MUST send a UDP response
- directly back to the client, via unicast, to the query packet's
- source IP address and port. This unicast response MUST be a
- conventional unicast response as would be generated by a conventional
- unicast DNS server; for example, it must repeat the query ID and the
- question given in the query packet.
-
- The resource record TTL given in a unicast response SHOULD NOT be
- greater than ten seconds, even if the true TTL of the Multicast DNS
- resource record is higher. This is because Multicast DNS Responders
- that fully participate in the protocol use the cache coherency
- mechanisms described in Section 13 to update and invalidate stale
- data. Were unicast responses sent to legacy clients to use the same
- high TTLs, these legacy clients, which do not implement these cache
- coherency mechanisms, could retain stale cached resource record data
- long after it is no longer valid.
-
- Having sent this unicast response, if the Responder has not sent this
- record in any multicast response recently, it SHOULD schedule the
- record to be sent via multicast as well, to facilitate passive
- conflict detection. "Recently" in this context means "if the time
- since the record was last sent via multicast is less than one quarter
- of the record's TTL".
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 16]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-8.2 Multi-Question Queries
-
- Multicast DNS Responders MUST correctly handle DNS query packets
- containing more than one question, by answering any or all of the
- questions to which they have answers. Any answers generated
- in response to query packets containing more than one question
- MUST be randomly delayed in the range 20-120ms, as described above.
-
-
-8.3 Response Aggregation
-
- Having delayed one or more multicast responses by 20-120ms as
- described above in Section 8 "Responding", a Multicast DNS Responder
- SHOULD, for the sake of network efficiency, aggregate as many of its
- pending responses as possible into a single Multicast DNS response
- packet.
-
-
-9. Probing and Announcing on Startup
-
- Typically a Multicast DNS Responder should have, at the very least,
- address records for all of its active interfaces. Creating and
- advertising an HINFO record on each interface as well can be useful
- to network administrators.
-
- Whenever a Multicast DNS Responder starts up, wakes up from sleep,
- receives an indication of an Ethernet "Link Change" event, or has any
- other reason to believe that its network connectivity may have
- changed in some relevant way, it MUST perform the two startup steps
- below.
-
-
-9.1 Probing
-
- The first startup step is that for all those resource records that a
- Multicast DNS Responder desires to be unique on the local link, it
- MUST send a Multicast DNS Query asking for those resource records, to
- see if any of them are already in use. The primary example of this is
- its address record which maps its unique host name to its unique IP
- address. All Probe Queries SHOULD be done using the desired resource
- record name and query type T_ANY (255), to elicit answers for all
- types of records with that name. This allows a single question to be
- used in place of several questions, which is more efficient on the
- network. It also allows a host to verify exclusive ownership of a
- name, which is desirable in most cases. It would be confusing, for
- example, if one host owned the "A" record for "myhost.local.", but a
- different host owned the HINFO record for that name.
-
- The ability to place more than one question in a Multicast DNS Query
- is useful here, because it can allow a host to use a single packet
- for all of its resource records instead of needing a separate packet
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 17]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- for each. For example, a host can simultaneously probe for uniqueness
- of its "A" record and all its SRV records [DNS-SD] in the same query
- packet.
-
- When ready to send its mDNS probe packet(s) the host should first
- wait for a short random delay time, uniformly distributed in the
- range 0-250ms. This random delay is to guard against the case where a
- group of devices are powered on simultaneously, or a group of devices
- are connected to an Ethernet hub which is then powered on, or some
- other external event happens that might cause a group of hosts to all
- send synchronized probes.
-
- 250ms after the first query the host should send a second, then
- 250ms after that a third. If, by 250ms after the third probe, no
- conflicting Multicast DNS responses have been received, the host may
- move to the next step, announcing.
-
- If any conflicting Multicast DNS responses are received, then the
- probing host MUST defer to the existing host, and must choose new
- names for some or all of its resource records as appropriate, to
- avoid conflict with pre-existing hosts on the network. In the case
- of a host probing using query type T_ANY as recommended above, any
- answer containing a record with that name, of any type, MUST be
- considered a conflicting response and handled accordingly.
-
- If ten failures occur within any ten-second period, then the host
- MUST wait at least five seconds before each successive additional
- probe attempt. This is to help ensure that in the event of software
- bugs or other unanticipated problems, errant hosts do not flood the
- network with a continuous stream of multicast traffic. For very
- simple devices, a valid way to comply with this requirement is to
- always wait five seconds after any failed probe attempt.
-
-
-9.2 Simultaneous Probe Tie-Breaking
-
- The astute reader will observe that there is a race condition
- inherent in the previous description. If two hosts are probing for
- the same name simultaneously, neither will receive any response to
- the probe, and the hosts could incorrectly conclude that they may
- both proceed to use the name. To break this symmetry, each host
- populates the Authority Section of its queries with records giving
- the rdata that it would be proposing to use, should its probing be
- successful. The Authority Section is being used here in a way
- analogous to the Update section of a DNS Update packet [RFC 2136].
-
- When a host that is probing for a record sees another host issue a
- query for the same record, it consults the Authority Section of that
- query. If it finds any resource record there which answers the query,
- then it compares the data of that resource record with its own
- tentative data. The lexicographically later data wins. This means
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 18]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- that if the host finds that its own data is lexicographically later,
- it simply ignores the other host's probe. If the host finds that its
- own data is lexicographically earlier, then it treats this exactly
- as if it had received a positive answer to its query, and concludes
- that it may not use the desired name.
-
- The determination of 'lexicographically later' is performed by first
- comparing the record class, then the record type, then raw comparison
- of the binary content of the rdata without regard for meaning or
- structure. If the record classes differ, then the numerically greater
- class is considered 'lexicographically later'. Otherwise, if the
- record types differ, then the numerically greater type is considered
- 'lexicographically later'. If the type and class both match then the
- rdata is compared.
-
- In the case of resource records containing rdata that is subject to
- name compression, the names must be uncompressed before comparison.
- (The details of how a particular name is compressed is an artifact of
- how and where the record is written into the DNS message; it is not
- an intrinsic property of the resource record itself.)
-
- The bytes of the raw uncompressed rdata are compared in turn,
- interpreting the bytes as eight-bit UNSIGNED values, until a byte
- is found whose value is greater than that of its counterpart (in
- which case the rdata whose byte has the greater value is deemed
- lexicographically later) or one of the resource records runs out
- of rdata (in which case the resource record which still has
- remaining data first is deemed lexicographically later).
-
- The following is an example of a conflict:
-
- sctibook.local. A 196.254.100.200
- sctibook.local. A 196.254.200.100
-
- In this case 196.254.200.100 is lexicographically later, so it is
- deemed the winner.
-
- Note that it is vital that the bytes are interpreted as UNSIGNED
- values, or the wrong outcome may result. In the example above, if
- the byte with value 200 had been incorrectly interpreted as a
- signed value then it would be interpreted as value -56, and the
- wrong address record would be deemed the winner.
-
-
-9.3 Announcing
-
- The second startup step is that the Multicast DNS Responder MUST send
- a gratuitous Multicast DNS Response containing, in the Answer
- Section, all of its resource records. If there are too many resource
- records to fit in a single packet, multiple packets should be used.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 19]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- In the case of shared records (e.g. the PTR records used by DNS
- Service Discovery [DNS-SD]), the records are simply placed as-is
- into the answer section of the DNS Response.
-
- In the case of records that have been verified to be unique in the
- previous step, they are placed into the answer section of the DNS
- Response with the most significant bit of the rrclass set to one. The
- most significant bit of the rrclass is the mDNS "cache flush" bit and
- is discussed in more detail below in Section 13.3 "Announcements to
- Flush Outdated Cache Entries".
-
- The Multicast DNS Responder MUST send at least two gratuitous
- responses, one second apart. A Responder MAY send up to ten
- gratuitous Responses, providing that the interval between gratuitous
- responses doubles with every response sent.
-
- A Multicast DNS Responder SHOULD NOT continue sending gratuitous
- Responses for longer than the TTL of the record. The purpose of
- announcing new records via gratuitous Responses is to ensure that
- peer caches are up to date. After a time interval equal to the TTL of
- the record has passed, it is very likely that old stale copies of
- that record in peer caches will have expired naturally, so subsequent
- announcements serve little purpose.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the conflict MUST be resolved as described below in "Conflict
- Resolution".
-
- A Multicast DNS Responder MUST NOT send announcements in the absence
- of information that its network connectivity may have changed in some
- relevant way. In particular, a Multicast DNS Responder MUST NOT send
- regular periodic announcements as a matter of course.
-
-
-9.4 Updating
-
- At any time, if the rdata of any of a host's Multicast DNS records
- changes, the host MUST repeat the Announcing step described above to
- update neighbouring caches. For example, if any of a host's IP
- addresses change, it must re-announce those address records.
-
- A host may update the contents of any of its records at any time,
- though a host SHOULD NOT update records more frequently than ten
- times per minute. Frequent rapid updates impose a burden on the
- network. If a host has information to disseminate which changes more
- frequently than ten times per minute, then Multicast DNS may not be
- the appropriate protocol to disseminate that information.
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 20]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-10. Conflict Resolution
-
- A conflict occurs when two resource records with the same name, type
- and class have inconsistent rdata. What may be considered
- inconsistent is context sensitive, except that resource records with
- identical rdata are never considered inconsistent, even if they
- originate from different hosts. A common example of a resource record
- type that is intended to be unique, not shared between hosts, is the
- address record that maps a host's name to its IP address. Should a
- host witness another host announce an address record with the same
- name but a different IP address, then that is considered
- inconsistent, and that address record is considered to be in
- conflict.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the Multicast DNS Responder MUST immediately reset that
- record to probing state, and go through the startup steps described
- above in Section 9. "Probing and Announcing on Startup". The
- protocol used in the Probing phase will determine a winner and a
- loser, and the loser must cease using the name, and reconfigure.
-
- It is very important that any host that observes an apparent conflict
- MUST take action. In the case of two hosts using the same host name,
- where one has been configured to require a unique host name and the
- other has not, the one that has not been configured to require a
- unique host name will not perceive any conflict, and will not take
- any action. By reverting to Probing state, the host that desires a
- unique host name will go through the necessary steps to ensure that a
- unique host is obtained.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 21]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- The recommended course of action after probing and failing is as
- follows:
-
- o Programmatically change the resource record name in an attempt to
- find a new name that is unique. This could be done by adding some
- further identifying information (e.g. the model name of the
- hardware) if it is not already present in the name, appending the
- digit "2" to the name, or incrementing a number at the end of the
- name if one is already present.
-
- o Probe again, and repeat until a unique name is found.
-
- o Record this newly chosen name in persistent storage so that the
- device will use the same name the next time it is power-cycled.
-
- o Display a message to the user or operator informing them of the
- name change. For example:
-
- The name "Bob's Music" is in use by another iTunes music
- server on the network. Your music has been renamed to
- "Bob's Music (G4 Cube)". If you want to change this name,
- use [describe appropriate menu item or preference dialog].
-
- How the user or operator is informed depends on context. A desktop
- computer with a screen might put up a dialog box. A headless server
- in the closet may write a message to a log file, or use whatever
- mechanism (email, SNMP trap, etc.) it uses to inform the
- administrator of other error conditions. On the other hand a headless
- server in the closet may not inform the user at all -- if the user
- cares, they will notice the name has changed, and connect to the
- server in the usual way (e.g. via Web Browser) to configure a new
- name.
-
- The examples in this section focus on address records (i.e. host
- names), but the same considerations apply to all resource records
- where uniqueness (or maintenance of some other defined constraint) is
- desired.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 22]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-11. Special Characteristics of Multicast DNS Domains
-
- Unlike conventional DNS names, names that end in ".local.",
- "254.169.in-addr.arpa." or "0.8.e.f.ip6.arpa." have only local
- significance. Conventional DNS seeks to provide a single unified
- namespace, where a given DNS query yields the same answer no matter
- where on the planet it is performed or to which recursive DNS server
- the query is sent. (However, split views, firewalls, intranets and
- the like have somewhat interfered with this goal of DNS representing
- a single universal truth.) In contrast, each IP link has its own
- private ".local.", "254.169.in-addr.arpa." and "0.8.e.f.ip6.arpa."
- namespaces, and the answer to any query for a name within those
- domains depends on where that query is asked.
-
- Multicast DNS Domains are not delegated from their parent domain via
- use of NS records. There are no NS records anywhere in Multicast DNS
- Domains. Instead, all Multicast DNS Domains are delegated to the IP
- addresses 224.0.0.251 and FF02::FB by virtue of the individual
- organizations producing DNS client software deciding how to handle
- those names. It would be extremely valuable for the industry if this
- special handling were ratified and recorded by IANA, since otherwise
- the special handling provided by each vendor is likely to be
- inconsistent.
-
- The IPv4 name server for a Multicast DNS Domain is 224.0.0.251. The
- IPv6 name server for a Multicast DNS Domain is FF02::FB. These are
- multicast addresses; therefore they identify not a single host but a
- collection of hosts, working in cooperation to maintain some
- reasonable facsimile of a competently managed DNS zone. Conceptually
- a Multicast DNS Domain is a single DNS zone, however its server is
- implemented as a distributed process running on a cluster of loosely
- cooperating CPUs rather than as a single process running on a single
- CPU.
-
- No delegation is performed within Multicast DNS Domains. Because the
- cluster of loosely coordinated CPUs is cooperating to administer a
- single zone, delegation is neither necessary nor desirable. Just
- because a particular host on the network may answer queries for a
- particular record type with the name "example.local." does not imply
- anything about whether that host will answer for the name
- "child.example.local.", or indeed for other record types with the
- name "example.local."
-
- Multicast DNS Zones have no SOA record. A conventional DNS zone's
- SOA record contains information such as the email address of the zone
- administrator and the monotonically increasing serial number of the
- last zone modification. There is no single human administrator for
- any given Multicast DNS Zone, so there is no email address. Because
- the hosts managing any given Multicast DNS Zone are only loosely
- coordinated, there is no readily available monotonically increasing
- serial number to determine whether or not the zone contents have
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 23]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- changed. A host holding part of the shared zone could crash or be
- disconnected from the network at any time without informing the other
- hosts. There is no reliable way to provide a zone serial number that
- would, whenever such a crash or disconnection occurred, immediately
- change to indicate that the contents of the shared zone had changed.
-
- Zone transfers are not possible for any Multicast DNS Zone.
-
-
-12. Multicast DNS for Service Discovery
-
- This document does not describe using Multicast DNS for network
- browsing or service discovery. However, the mechanisms this document
- describes are compatible with (and support) the browsing and service
- discovery mechanisms proposed in "DNS-Based Service Discovery"
- [DNS-SD].
-
- This document places few limitations on what DNS record types may be
- looked up using local multicast. One particular kind of Multicast DNS
- query that might be useful is a query for the SRV record named
- "_domain._udp.local.", yielding the port number and IP address of a
- conventional DNS server willing to perform general recursive DNS
- lookups. This could solve a particular problem facing the IPv6
- community, which is that IPv6 is able to self-configure almost all of
- the information it needs to operate [RFC 2462], except for the
- address of the DNS server. Bringing in all of the mechanisms of DHCP
- just for that one little additional piece of information is not an
- attractive solution. Using DNS-format messages and DNS-format
- resource records to find the address of the DNS server has an elegant
- self-sufficiency about it. Any host that needs to know the address of
- the DNS server must already have code to generate and parse DNS
- packets, so using that same code and those same packets to find the
- DNS server in the first place is a simple self-reliant solution that
- avoids taking external dependencies on other protocols.
-
-
-13. Resource Record TTL Values and Cache Coherency
-
- The recommended TTL value for Multicast DNS resource records is
- 120 minutes.
-
- A client with an active outstanding query will issue a query packet
- when one or more of the resource record(s) in its cache is (are) 80%
- of the way to expiry. If the TTL on those records is 120 minutes,
- this ongoing cache maintenance process yields a steady-state query
- rate of one query every 96 minutes.
-
- Any distributed cache needs a cache coherency protocol. If Multicast
- DNS resource records follow the recommendation and have a TTL of 120
- minutes, that means that stale data could persist in the system for
- up to two hours. Making the default TTL significantly lower would
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 24]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- reduce the lifetime of stale data, but would produce too much extra
- traffic on the network. Various techniques are available to minimize
- the impact of such stale data.
-
-
-13.1 Cooperating Multicast DNS Responders
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, but different rdata, then:
-
- o If A's resource record is intended to be a shared resource record,
- then this is no conflict, and no action is required.
-
- o If A's resource record is intended to be a unique resource record
- then this is a conflict and MUST be handled as described in Section
- 10 "Conflict Resolution".
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, and identical rdata, then:
-
- o If the TTL of B's resource record given in the packet is at least
- half the true TTL from A's point of view, then no action is
- required.
-
- o If the TTL of B's resource record given in the packet is less than
- half the true TTL from A's point of view, then A MUST mark its
- record to be announced via multicast. Clients receiving the record
- from B would use the TTL given by B, and hence may delete the
- record sooner than A expects. By sending its own multicast response
- correcting the TTL, A ensures that the record will be retained for
- the desired time.
-
- These rules allow multiple Multicast DNS Responders to offer the same
- data on the network (perhaps for fault tolerance reasons) without
- conflicting with each other.
-
-
-13.2 Goodbye Packets
-
- In the case where a host knows that certain resource record data is
- about to become invalid (for example when the host is undergoing a
- clean shutdown) the host SHOULD send a gratuitous announcement mDNS
- response packet, giving the same resource record name, type, class
- and rdata, but an RR TTL of zero. This has the effect of updating the
- TTL stored in neighbouring hosts' cache entries to zero, causing that
- cache entry to be promptly deleted.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 25]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- Clients receiving a Multicast DNS Response with a TTL of zero SHOULD
- NOT immediately delete the record from the cache, but instead record
- a TTL of 1 and then delete the record one second later. In the case
- of multiple Multicast DNS Responders on the network described in
- Section 13.1 above, if one of the Responders shuts down and
- incorrectly sends goodbye packets for its records, it gives the other
- cooperating Responders one second to send out their own response to
- "rescue" the records before they expire and are deleted.
-
- Generally speaking, it is more important to send goodbye packets for
- shared records than unique records. A given shared record name (such
- as a PTR record used for DNS Service Discovery [DNS-SD]) by its
- nature often has many representatives from many different hosts, and
- tends to be the subject of long-lived ongoing queries. Those
- long-lived queries are often concerned not just about being informed
- when records appear, but also about being informed if those records
- vanish again. In contrast, a unique record set (such as an SRV
- record, or a host address record), by its nature, often has far fewer
- members than a shared record set, and is usually the subject of
- one-shot queries which simply retrieve the data and then cease
- querying once they have the answer they are seeking. Therefore,
- sending a goodbye packet for a unique record set is likely to offer
- less benefit, because it is likely at any given moment that no one
- has an active query running for that record set. One example where
- goodbye packets for SRV and address records are useful is when
- transferring control to a Sleep Proxy Server (see Section 16.
- "Multicast DNS and Power Management").
-
-
-13.3 Announcements to Flush Outdated Cache Entries
-
- Whenever a host has a resource record with potentially new data (e.g.
- after rebooting, waking from sleep, connecting to a new network link,
- changing IP address, etc.), the host MUST send a series of gratuitous
- announcements to update cache entries in its neighbour hosts. In
- these gratuitous announcements, if the record is one that is intended
- to be unique, the host sets the most significant bit of the rrclass
- field of the resource record. This bit, the "cache flush" bit, tells
- neighbouring hosts that this is not a shared record type. Instead of
- merging this new record additively into the cache in addition to any
- previous records with the same name, type and class, all old records
- with that name, type and class that were received more than one
- second ago are declared invalid, and marked to expire from the cache
- in one second.
-
- The semantics of the cache flush bit are as follows: Normally when a
- resource record appears in the answer section of the DNS Response, it
- means, "This is an assertion that this information is true." When a
- resource record appears in the answer section of the DNS Response
- with the "cache flush" bit set, it means, "This is an assertion that
- this information is the truth and the whole truth, and anything you
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 26]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- may have heard more than a second ago regarding records of this
- name/type/class is no longer valid".
-
- To accommodate the case where the set of records from one host
- constituting a single unique RRSet is too large to fit in a single
- packet, only cache records that are more than one second old are
- flushed. This allows the announcing host to generate a quick burst of
- packets back-to-back on the wire containing all the members
- of the RRSet. When receiving records with the "cache flush" bit set,
- all records older than one second are marked to be deleted one second
- in the future. One second after the end of the little packet burst,
- any records not represented within that packet burst will then be
- expired from all peer caches.
-
- Any time a host sends a response packet containing some members of a
- unique RRSet, it SHOULD send the entire RRSet, preferably in a single
- packet, or if the entire RRSet will not fit in a single packet, in a
- quick burst of packets sent as close together as possible. The host
- SHOULD set the cache flush bit on all members of the unique RRSet.
- In the event that for some reason the host chooses not to send the
- entire unique RRSet in a single packet or a rapid packet burst,
- it MUST NOT set the cache flush bit on any of those records.
-
- The reason for waiting one second before deleting stale records from
- the cache is to accommodate bridged networks. For example, a host's
- address record announcement on a wireless interface may be bridged
- onto a wired Ethernet, and cause that same host's Ethernet address
- records to be flushed from peer caches. The one-second delay gives
- the host the chance to see its own announcement arrive on the wired
- Ethernet, and immediately re-announce its Ethernet address records
- so that both sets remain valid and live in peer caches.
-
- These rules apply regardless of *why* the response packet is being
- generated. They apply to startup announcements as described in
- Section 9.3, and to responses generated as a result of receiving
- query packets.
-
- The "cache flush" bit is only set in Multicast DNS responses sent to
- UDP port 5353. The "cache flush" bit MUST NOT be set in any resource
- records in a response packet sent in legacy unicast responses to UDP
- ports other than 5353.
-
- The "cache flush" bit MUST NOT be set in any resource records in the
- known-answer list of any query packet.
-
- The "cache flush" bit MUST NOT ever be set in any shared resource
- record. To do so would cause all the other shared versions of this
- resource record with different rdata from different Responders to be
- immediately deleted from all the caches on the network.
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 27]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- Note that the "cache flush" bit is NOT part of the resource record
- class. The "cache flush" bit is the most significant bit of the
- second 16-bit word of a resource record in an mDNS packet (the field
- conventionally referred to as the rrclass field), and the actual
- resource record class is the least-significant fifteen bits of this
- field. There is no mDNS resource record class 0x8001. The value
- 0x8001 in the rrclass field of a resource record in an mDNS response
- packet indicates a resource record with class 1, with the "cache
- flush" bit set. When receiving a resource record with the "cache
- flush" bit set, implementations should take care to mask off that bit
- before storing the resource record in memory.
-
-
-13.4 Cache Flush on Topology change
-
- If the hardware on a given host is able to indicate physical changes
- of connectivity, then when the hardware indicates such a change, the
- host should take this information into account in its mDNS cache
- management strategy. For example, a host may choose to immediately
- flush all cache records received on a particular interface when that
- cable is disconnected. Alternatively, a host may choose to adjust the
- remaining TTL on all those records to a few seconds so that if the
- cable is not reconnected quickly, those records will expire from the
- cache.
-
- Likewise, when a host reboots, or wakes from sleep, or undergoes some
- other similar discontinuous state change, the cache management
- strategy should take that information into account.
-
-
-13.5 Cache Flush on Failure Indication
-
- Sometimes a cache record can be determined to be stale when a client
- attempts to use the rdata it contains, and finds that rdata to be
- incorrect.
-
- For example, the rdata in an address record can be determined to be
- incorrect if attempts to contact that host fail, either because
- ARP/ND requests for that address go unanswered (for an address on a
- local subnet) or because a router returns an ICMP "Host Unreachable"
- error (for an address on a remote subnet).
-
- The rdata in an SRV record can be determined to be incorrect if
- attempts to communicate with the indicated service at the host and
- port number indicated are not successful.
-
- The rdata in a DNS-SD PTR record can be determined to be incorrect if
- attempts to look up the SRV record it references are not successful.
-
- In any such case, the software implementing the mDNS resource record
- cache should provide a mechanism so that clients detecting stale
- rdata can inform the cache.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 28]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- When the cache receives this hint that it should reconfirm some
- record, it MUST issue two or more queries for the resource record in
- question. If no response is received in a reasonable amount of time,
- then, even though its TTL may indicate that it is not yet due to
- expire, that record SHOULD be promptly flushed from the cache.
-
- The end result of this is that if a printer suffers a sudden power
- failure or other abrupt disconnection from the network, its name may
- continue to appear in DNS-SD browser lists displayed on users'
- screens. Eventually that entry will expire from the cache naturally,
- but if a user tries to access the printer before that happens, the
- failure to successfully contact the printer will trigger the more
- hasty demise of its cache entries. This is a sensible trade-off
- between good user-experience and good network efficiency. If we were
- to insist that printers should disappear from the printer list within
- 30 seconds of becoming unavailable, for all failure modes, the only
- way to achieve this would be for the client to poll the printer at
- least every 30 seconds, or for the printer to announce its presence
- at least every 30 seconds, both of which would be an unreasonable
- burden on most networks.
-
-
-13.6 Passive Observation of Failures
-
- A host observes the multicast queries issued by the other hosts on
- the network. One of the major benefits of also sending responses
- using multicast is that it allows all hosts to see the responses (or
- lack thereof) to those queries.
-
- If a host sees queries, for which a record in its cache would be
- expected to be given as an answer in a multicast response, but no
- such answer is seen, then the host may take this as an indication
- that the record may no longer be valid.
-
- After seeing two or more of these queries, and seeing no multicast
- response containing the expected answer within a reasonable amount of
- time, then even though its TTL may indicate that it is not yet due to
- expire, that record MAY be flushed from the cache. The host SHOULD
- NOT perform its own queries to re-confirm that the record is truly
- gone. If every host on a large network were to do this, it would
- cause a lot of unnecessary multicast traffic. If host A sends
- multicast queries that remain unanswered, then there is no reason to
- suppose that host B or any other host is likely to be any more
- successful.
-
- The previous section, "Cache Flush on Failure Indication", describes
- a situation where a user trying to print discovers that the printer
- is no longer available. By implementing the passive observation
- described here, when one user fails to contact the printer, all hosts
- on the network observe that failure and update their caches
- accordingly.
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 29]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-14. Enabling and Disabling Multicast DNS
-
- The option to fail-over to Multicast DNS for names not ending in
- ".local." SHOULD be a user-configured option, and SHOULD
- be disabled by default because of the possible security issues
- related to unintended local resolution of apparently global names.
-
- The option to lookup unqualified (relative) names by appending
- ".local." (or not) is controlled by whether ".local." appears
- (or not) in the client's DNS search list.
-
- No special control is needed for enabling and disabling Multicast DNS
- for names explicitly ending with ".local." as entered by the user.
- The user doesn't need a way to disable Multicast DNS for names ending
- with ".local.", because if the user doesn't want to use Multicast
- DNS, they can achieve this by simply not using those names. If a user
- *does* enter a name ending in ".local.", then we can safely assume
- the user's intention was probably that it should work. Having user
- configuration options that can be (intentionally or unintentionally)
- set so that local names don't work is just one more way of
- frustrating the user's ability to perform the tasks they want,
- perpetuating the view that, "IP networking is too complicated to
- configure and too hard to use." This in turn perpetuates the
- continued use of protocols like AppleTalk. If we want to retire
- AppleTalk, NetBIOS, etc., we need to offer users equivalent IP
- functionality that they can rely on to, "always work, like
- AppleTalk." A little Multicast DNS traffic may be a burden on the
- network, but it is an insignificant burden compared to continued
- widespread use of AppleTalk.
-
-
-15. Considerations for Multiple Interfaces
-
- A host should defend its host name (FQDN) on all active interfaces on
- which it is answering Multicast DNS queries.
-
- In the event of a name conflict on *any* interface, a host should
- configure a new host name, if it wishes to maintain uniqueness of its
- host name.
-
- When answering a Multicast DNS query, a multi-homed host with a
- link-local address (or addresses) should take care to ensure that
- any address going out in a Multicast DNS response is valid for use
- on the interface on which the response is going out.
-
- Just as the same link-local IP address may validly be in use
- simultaneously on different links by different hosts, the same
- link-local host name may validly be in use simultaneously on
- different links, and this is not an error. A multi-homed host with
- connections to two different links may be able to communicate with
- two different hosts that are validly using the same name. While this
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 30]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- kind of name duplication should be rare, it means that a host that
- wants to fully support this case needs network programming APIs that
- allow applications to specify on what interface to perform a
- link-local Multicast DNS query, and to discover on what interface a
- Multicast DNS response was received.
-
-
-16. Multicast DNS and Power Management
-
- Many modern network devices have the ability to go into a low-power
- mode where only a small part of the Ethernet hardware remains
- powered, and the device can be woken up by sending a specially
- formatted Ethernet frame which the device's power-management hardware
- recognizes.
-
- To make use of this in conjunction with Multicast DNS, the device
- first uses DNS-SD to determine if Sleep Proxy Service is available on
- the local network. In some networks there may be more than one piece
- of hardware implementing Sleep Proxy Service, for fault-tolerance
- reasons.
-
- If the device finds the network has Sleep Proxy Service, the device
- transmits two or more gratuitous mDNS announcements setting the TTL
- of its relevant resource records to zero, to delete them from
- neighbouring caches. The relevant resource records include address
- records and SRV records, and other resource records as may apply to a
- particular device. The device then communicates all of its remaining
- active records, plus the names, types and classes of the deleted
- records, to the Sleep Proxy Service(s), along with a copy of the
- specific "magic packet" required to wake the device up.
-
- When a Sleep Proxy Service sees an mDNS query for one of the
- device's active records (e.g. a DNS-SD PTR record), it answers on
- behalf of the device without waking it up. When a Sleep Proxy Service
- sees an mDNS query for one of the device's deleted resource
- records, it deduces that some client on the network needs to make an
- active connection to the device, and sends the specified "magic
- packet" to wake the device up. The device then wakes up, reactivates
- its deleted resource records, and re-announces them to the network.
- The client waiting to connect sees the announcements, learns the
- current IP address and port number of the desired service on the
- device, and proceeds to connect to it.
-
- The connecting client does not need to be aware of how Sleep Proxy
- Service works. Only devices that implement low power mode and wish to
- make use of Sleep Proxy Service need to be aware of how that protocol
- works.
-
- The reason that a device using a Sleep Proxy Service should send more
- than one goodbye packet is that the wakeup message is caused by the
- Sleep Proxy Service seeing queries for the device's SRV and/or
- address records, and those queries are in turn caused by the records
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 31]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- being absent from peer caches. If the records are not deleted from
- peer caches, then those peers may use the cached value directly
- without querying, and no wakeup message would be generated.
-
- The full specification of mDNS / DNS-SD Sleep Proxy Service
- is described in another document [not yet published].
-
-
-17. Multicast DNS Character Set
-
- Unicast DNS has been plagued by the lack of any support for non-US
- characters. Indeed, conventional DNS is usually limited to just
- letters, digits and hyphens, with no spaces or other punctuation.
- Attempts to remedy this have made slow progress because of the need
- to accommodate old buggy legacy implementations.
-
- Multicast DNS is a new protocol and doesn't (yet) have old buggy
- legacy implementations to constrain the design choices. Accordingly,
- it adopts the obvious simple solution: all names in Multicast DNS are
- encoded using UTF-8 [RFC 2279]. For names that are restricted to
- letters, digits and hyphens, the UTF-8 encoding is identical to the
- US-ASCII encoding, so this is entirely compatible with existing host
- names. For characters outside the US-ASCII range, UTF-8 encoding is
- used.
-
- Multicast DNS implementations MUST NOT use any other encodings apart
- from UTF-8 (US-ASCII being considered a compatible subset of UTF-8).
-
- This point bears repeating: There are various baroque representations
- of international text being proposed for Unicast DNS. None of these
- representations may be used in Multicast DNS packets. Any text being
- represented internally in some other representation MUST be converted
- to canonical UTF-8 before being placed in any Multicast DNS packet.
-
- The simple rules for case-insensitivity in Unicast DNS also apply in
- Multicast DNS; that is to say, in name comparisons, the lower-case
- letters "a" to "z" match their upper-case equivalents "A" to "Z".
- Hence, if a client issues a query for an address record with the name
- "stuartcheshire.local", then a responder having an address record
- with the name "StuartCheshire.local" should issue a response.
-
- No other automatic character equivalence is defined in Multicast DNS.
- For example, accented characters are not defined to be automatically
- equivalent to their unaccented counterparts. Where automatic
- equivalences are desired, this may be achieved through the use of
- programmatically-generated CNAME records. For example, if a responder
- has an address record for an accented name Y, and a client issues a
- query for a name X, where X is the same as Y with all the accents
- removed, then the responder may issue a response containing two
- resource records: A CNAME record "X CNAME Y", asserting that the
- requested name X (unaccented) is an alias for the true (accented)
- name Y, followed by the address record for Y.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 32]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-18. Multicast DNS Message Size
-
- RFC 1035 restricts DNS Messages carried by UDP to no more than 512
- bytes (not counting the IP or UDP headers). For UDP packets carried
- over the wide-area Internet in 1987, this was appropriate. For
- link-local multicast packets on today's networks, there is no reason
- to retain this restriction. Given that the packets are by definition
- link-local, there are no Path MTU issues to consider.
-
- Multicast DNS Messages carried by UDP may be up to the IP MTU of the
- physical interface, less the space required for the IP header (20
- bytes for IPv4; 40 bytes for IPv6) and the UDP header (8 bytes).
-
- In the case of a single mDNS Resource Record which is too large to
- fit in a single MTU-sized multicast response packet, a Multicast DNS
- Responder SHOULD send the Resource Record alone, in a single IP
- datagram, sent using multiple IP fragments. Resource Records this
- large SHOULD be avoided, except in the very rare cases where they
- really are the appropriate solution to the problem at hand.
- Implementers should be aware that many simple devices do not
- re-assemble fragmented IP datagrams, so large Resource Records SHOULD
- only be used in specialized cases where the implementer knows that
- all receivers implement reassembly.
-
- A Multicast DNS packet larger than the interface MTU, which is sent
- using fragments, MUST NOT contain more than one Resource Record.
-
- Even when fragmentation is used, a Multicast DNS packet, including IP
- and UDP headers, MUST NOT exceed 9000 bytes.
-
-
-19. Multicast DNS Message Format
-
- This section describes specific restrictions on the allowable
- values for the header fields of a Multicast DNS message.
-
-19.1. ID (Query Identifier)
-
- Multicast DNS clients SHOULD listen for gratuitous responses
- issued by hosts booting up (or waking up from sleep or otherwise
- joining the network). Since these gratuitous responses may contain a
- useful answer to a question for which the client is currently
- awaiting an answer, Multicast DNS clients SHOULD examine all received
- Multicast DNS response messages for useful answers, without regard to
- the contents of the ID field or the question section. In Multicast
- DNS, knowing which particular query message (if any) is responsible
- for eliciting a particular response message is less interesting than
- knowing whether the response message contains useful information.
-
- Multicast DNS clients MAY cache any or all Multicast DNS response
- messages they receive, for possible future use, providing of course
- that normal TTL aging is performed on these cashed resource records.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 33]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
- In multicast query messages, the Query ID SHOULD be set to zero on
- transmission.
-
- In multicast responses, including gratuitous multicast responses, the
- Query ID MUST be set to zero on transmission, and MUST be ignored on
- reception.
-
- In unicast response messages generated specifically in response to a
- particular (unicast or multicast) query, the Query ID MUST match the
- ID from the query message.
-
-
-19.2. QR (Query/Response) Bit
-
- In query messages, MUST be zero.
-
- In response messages, MUST be one.
-
-
-19.3. OPCODE
-
- In both multicast query and multicast response messages, MUST be zero
- (only standard queries are currently supported over multicast, unless
- other queries are allowed by future IETF Standards Action).
-
-
-19.4. AA (Authoritative Answer) Bit
-
- In query messages, the Authoritative Answer bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages for Multicast Domains, the Authoritative Answer
- bit MUST be set to one (not setting this bit implies there's some
- other place where "better" information may be found) and MUST be
- ignored on reception.
-
-
-19.5. TC (Truncated) Bit
-
- In query messages, if the TC bit is set, it means that additional
- Known Answer records may be following shortly. A responder MAY choose
- to record this fact, and wait for those additional Known Answer
- records, before deciding whether to respond. If the TC bit is clear,
- it means that the querying host has no additional Known Answers.
-
- In multicast response messages, the TC bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In legacy unicast response messages, the TC bit has the same meaning
- as in conventional unicast DNS: it means that the response was too
- large to fit in a single packet, so the client SHOULD re-issue its
- query using TCP in order to receive the larger response.
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 34]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-19.6. RD (Recursion Desired) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Desired bit SHOULD be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.7. RA (Recursion Available) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Available bit MUST be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.8. Z (Zero) Bit
-
- In both query and response messages, the Zero bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.9. AD (Authentic Data) Bit [RFC 2535]
-
- In query messages the Authentic Data bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages, the Authentic Data bit MAY be set. Resolvers
- receiving response messages with the AD bit set MUST NOT trust the AD
- bit unless they trust the source of the message and either have a
- secure path to it or use DNS transaction security.
-
-
-19.10. CD (Checking Disabled) Bit [RFC 2535]
-
- In query messages, a resolver willing to do cryptography SHOULD set
- the Checking Disabled bit to permit it to impose its own policies.
-
- In response messages, the Checking Disabled bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.11. RCODE (Response Code)
-
- In both multicast query and multicast response messages, the Response
- Code MUST be zero on transmission. Multicast DNS messages received
- with non-zero Response Codes MUST be silently ignored.
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 35]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-20. Choice of UDP Port Number
-
- Arguments were made for and against using Multicast on UDP port 53.
- The final decision was to use UDP port 5353. Some of the arguments
- for and against are given below.
-
-
-20.1 Arguments for using UDP port 53:
-
- * This is "just DNS", so it should be the same port.
-
- * There is less work to be done updating old clients to do simple
- mDNS queries. Only the destination address need be changed.
- In some cases, this can be achieved without any code changes,
- just by adding the address 224.0.0.251 to a configuration file.
-
-
-20.2 Arguments for using a different port (UDP port 5353):
-
- * This is not "just DNS". This is a DNS-like protocol, but different.
-
- * Changing client code to use a different port number is not hard.
-
- * Using the same port number makes it hard to run an mDNS Responder
- and a conventional unicast DNS server on the same machine. If a
- conventional unicast DNS server wishes to implement mDNS as well,
- it can still do that, by opening two sockets. Having two different
- port numbers is important to allow this flexibility.
-
- * Some VPN software hijacks all outgoing traffic to port 53 and
- redirects it to a special DNS server set up to serve those VPN
- clients while they are connected to the corporate network. It is
- questionable whether this is the right thing to do, but it is
- common, and redirecting link-local multicast DNS packets to a
- remote server rarely produces any useful results. It does mean, for
- example, that the user becomes unable to access their local network
- printer sitting on their desk right next to their computer. Using
- a different UDP port eliminates this particular problem.
-
- * On many operating systems, unprivileged clients may not send or
- receive packets on low-numbered ports. This means that any client
- sending or receiving mDNS packets on port 53 would have to run as
- "root", which is an undesirable security risk. Using a higher-
- numbered UDP port eliminates this particular problem.
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 36]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-21. Summary of Differences Between Multicast DNS and Unicast DNS
-
- The value of Multicast DNS is that it shares, as much as possible,
- the familiar APIs, naming syntax, resource record types, etc., of
- Unicast DNS. There are of course necessary differences by virtue of
- it using Multicast, and by virtue of it operating in a community of
- cooperating peers, rather than a precisely defined authoritarian
- hierarchy controlled by a strict chain of formal delegations from the
- top. These differences are listed below:
-
- Multicast DNS...
- * uses multicast
- * uses UDP port 5353 instead of port 53
- * operates in well-defined parts of the DNS namespace
- * uses UTF-8, and only UTF-8, to encode resource record names
- * defines a clear limit on the maximum legal domain name (255 bytes)
- * allows larger UDP packets
- * allows more than one question in a query packet
- * uses the Answer Section of a query to list Known Answers
- * uses the TC bit in a query to indicate additional Known Answers
- * uses the Authority Section of a query for probe tie-breaking
- * ignores the Query ID field (except for generating legacy responses)
- * doesn't require the question to be repeated in the response packet
- * uses gratuitous responses to announce new records to the peer group
- * defines a "unicast response" bit in the rrclass of query questions
- * defines a "cache flush" bit in the rrclass of responses
- * uses DNS TTL 0 to indicate that a record has been deleted
- * uses IP TTL 255 to verify that answers originated on the local link
- * monitors queries to perform Duplicate Question Suppression
- * monitors responses to perform Duplicate Answer Suppression...
- * ... and Ongoing Conflict Detection
- * ... and Opportunistic Caching
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 37]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-22. Benefits of Multicast Responses
-
- Some people have argued that sending responses via multicast is
- inefficient on the network. In fact the benefits of using multicast
- responses result in a net lowering of overall multicast traffic, for
- a variety of reasons.
-
- * One multicast response can update the cache on all machines on the
- network. If another machine later wants to issue the same query, it
- already has the answer in its cache, so it may not need to even
- transmit that multicast query on the network at all.
-
- * When more than one machine has the same ongoing long-lived query
- running, every machine does not have to transmit its own
- independent query. When one machine transmits a query, all the
- other hosts see the answers, so they can suppress their own
- queries.
-
- * When a host sees a multicast query, but does not see the
- corresponding multicast response, it can use this information to
- promptly delete stale data from its cache. To achieve the same
- level of user-interface quality and responsiveness without
- multicast responses would require lower cache lifetimes and more
- frequent network polling, resulting in a significantly higher
- packet rate.
-
- * Multicast responses allow passive conflict detection. Without this
- ability, some other conflict detection mechanism would be needed,
- imposing its own additional burden on the network.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 38]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-23. IPv6 Considerations
-
- An IPv4-only host and an IPv6-only host behave as "ships that pass in
- the night". Even if they are on the same Ethernet, neither is aware
- of the other's traffic. For this reason, each physical link may have
- *two* unrelated ".local." zones, one for IPv4 and one for IPv6.
- Since for practical purposes, a group of IPv4-only hosts and a group
- of IPv6-only hosts on the same Ethernet act as if they were on two
- entirely separate Ethernet segments, it is unsurprising that their
- use of the ".local." zone should occur exactly as it would if
- they really were on two entirely separate Ethernet segments.
-
- A dual-stack (v4/v6) host can participate in both ".local."
- zones, and should register its name(s) and perform its lookups both
- using IPv4 and IPv6. This enables it to reach, and be reached by,
- both IPv4-only and IPv6-only hosts. In effect this acts like a
- multi-homed host, with one connection to the logical "IPv4 Ethernet
- segment", and a connection to the logical "IPv6 Ethernet segment".
-
-23.1 IPv6 Multicast Addresses by Hashing
-
- Some discovery protocols use a range of multicast addresses, and
- determine the address to be used by a hash function of the name being
- sought. Queries are sent via multicast to the address as indicated by
- the hash function, and responses are returned to the querier via
- unicast. Particularly in IPv6, where multicast addresses are
- extremely plentiful, this approach is frequently advocated.
-
- There are some problems with this:
-
- * When a host has a large number of records with different names, the
- host may have to join a large number of multicast groups. This can
- place undue burden on the Ethernet hardware, which typically
- supports a limited number of multicast addresses efficiently. When
- this number is exceeded, the Ethernet hardware may have to resort
- to receiving all multicasts and passing them up to the host
- software for filtering, thereby defeating the point of using a
- multicast address range in the first place.
-
- * Multiple questions cannot be placed in one packet if they don't all
- hash to the same multicast address.
-
- * Duplicate Question Suppression doesn't work if queriers are not
- seeing each other's queries.
-
- * Duplicate Answer Suppression doesn't work if responders are not
- seeing each other's responses.
-
- * Opportunistic Caching doesn't work.
-
- * Ongoing Conflict Detection doesn't work.
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 39]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-24. Security Considerations
-
- The algorithm for detecting and resolving name conflicts is, by its
- very nature, an algorithm that assumes cooperating participants. Its
- purpose is to allow a group of hosts to arrive at a mutually disjoint
- set of host names and other DNS resource record names, in the absence
- of any central authority to coordinate this or mediate disputes. In
- the absence of any higher authority to resolve disputes, the only
- alternative is that the participants must work together cooperatively
- to arrive at a resolution.
-
- In an environment where the participants are mutually antagonistic
- and unwilling to cooperate, other mechanisms are appropriate, like
- manually administered DNS.
-
- In an environment where there is a group of cooperating participants,
- but there may be other antagonistic participants on the same physical
- link, the cooperating participants need to use IPSEC signatures
- and/or DNSSEC [RFC 2535] signatures so that they can distinguish mDNS
- messages from trusted participants (which they process as usual) from
- mDNS messages from untrusted participants (which they silently
- discard).
-
- When DNS queries for *global* DNS names are sent to the mDNS
- multicast address (during network outages which disrupt communication
- with the greater Internet) it is *especially* important to use
- DNSSEC, because the user may have the impression that he or she is
- communicating with some authentic host, when in fact he or she is
- really communicating with some local host that is merely masquerading
- as that name. This is less critical for names ending with ".local.",
- because the user should be aware that those names have only local
- significance and no global authority is implied.
-
- Most computer users neglect to type the trailing dot at the end of a
- fully qualified domain name, making it a relative domain name (e.g.
- "www.example.com"). In the event of network outage, attempts to
- positively resolve the name as entered will fail, resulting in
- application of the search list, including ".local.", if present.
- A malicious host could masquerade as "www.example.com" by answering
- the resulting Multicast DNS query for "www.example.com.local."
- To avoid this, a host MUST NOT append the search suffix
- ".local.", if present, to any relative (partially qualified)
- domain name containing two or more labels. Appending ".local." to
- single-label relative domain names is acceptable, since the user
- should have no expectation that a single-label domain name will
- resolve as-is.
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 40]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-25. IANA Considerations
-
- The IANA has allocated the IPv4 link-local multicast address
- 224.0.0.251 for the use described in this document.
-
- The IANA has allocated the IPv6 multicast address set FF0X::FB
- for the use described in this document.
-
- When this document is published, IANA should designate a list
- of domains which are deemed to have only link-local significance,
- as described in this document.
-
- No other IANA services are required by this document.
-
-
-26. Acknowledgements
-
- The concepts described in this document have been explored and
- developed with help from Erik Guttman, Paul Vixie, Bill Woodcock,
- and others.
-
-
-27. Copyright
-
- Copyright (C) The Internet Society January 2004.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 41]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-28. Normative References
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
-
-29. Informative References
-
- [dotlocal] <http://www.dotlocal.org/>
-
- [djbdl] <http://cr.yp.to/djbdns/dot-local.html>
-
- [IEEE802] IEEE Standards for Local and Metropolitan Area Networks:
- Overview and Architecture.
- Institute of Electrical and Electronic Engineers,
- IEEE Standard 802, 1990.
-
- [DNS-SD] Cheshire, S., and M. Krochmal, "DNS-Based Service
- Discovery", Internet-Draft (work in progress),
- draft-cheshire-dnsext-dns-sd-03.txt, January 2004.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2462] S. Thomson and T. Narten, "IPv6 Stateless Address
- Autoconfiguration", RFC 2462, December 1998.
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [v4LL] Cheshire, S., B. Aboba, and E. Guttman, "Dynamic
- Configuration of IPv4 Link-Local Addresses",
- Internet-Draft (work in progress),
- draft-ietf-zeroconf-ipv4-linklocal-11.txt, January 2004.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 42]
-
-Internet Draft Multicast DNS 29th January 2003
-
-
-30. Author's Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 29th July 2004 Cheshire & Krochmal [Page 43]
diff --git a/trunk/specs/draft-cheshire-dnsext-multicastdns-04.txt b/trunk/specs/draft-cheshire-dnsext-multicastdns-04.txt
deleted file mode 100644
index 8750583..0000000
--- a/trunk/specs/draft-cheshire-dnsext-multicastdns-04.txt
+++ /dev/null
@@ -1,2494 +0,0 @@
-Document: draft-cheshire-dnsext-multicastdns-04.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 14th August 2004 Marc Krochmal
- Apple Computer, Inc.
- 14th February 2004
-
- Multicast DNS
-
- <draft-cheshire-dnsext-multicastdns-04.txt>
-
-
-Status of this Memo
-
- This document is an Internet-Draft and is in full conformance with
- all provisions of Section 10 of RFC2026. Internet-Drafts are
- working documents of the Internet Engineering Task Force (IETF),
- its areas, and its working groups. Note that other groups may
- also distribute working documents as Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six
- months and may be updated, replaced, or obsoleted by other documents
- at any time. It is inappropriate to use Internet-Drafts as
- reference material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html
-
- Distribution of this memo is unlimited.
-
-
-Abstract
-
- As networked devices become smaller, more portable, and more
- ubiquitous, the ability to operate with less configured
- infrastructure is increasingly important. In particular, the ability
- to look up DNS resource record data types (including, but not limited
- to, host names) in the absence of a conventional managed DNS server,
- is becoming essential.
-
- Multicast DNS (mDNS) provides the ability to do DNS-like operations
- on the local link in the absense of any conventional unicast DNS
- server. In addition, mDNS designates a portion of the DNS namespace
- to be free for local use, without the need to pay any annual fee, and
- without the need to set up delegations or otherwise configure a
- conventional DNS server to answer for those names.
-
- The primary benefits of mDNS names are that (i) they require little
- or no administration or configuration to set them up, (ii) they work
- when no infrastructure is present, and (iii) they work during
- infrastructure failures.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 1]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-Table of Contents
-
- 1. Introduction...................................................3
- 2. Conventions and Terminology Used in this Document..............4
- 3. Multicast DNS Names............................................4
- 4. IP TTL Checks..................................................8
- 5. Reverse Address Mapping........................................8
- 6. Querying.......................................................9
- 7. Duplicate Suppression.........................................13
- 8. Responding....................................................15
- 9. Probing and Announcing on Startup.............................17
- 10. Conflict Resolution...........................................21
- 11. Special Characteristics of Multicast DNS Domains..............23
- 12. Multicast DNS for Service Discovery...........................24
- 13. Resource Record TTL Values and Cache Coherency................25
- 14. Enabling and Disabling Multicast DNS..........................30
- 15. Considerations for Multiple Interfaces........................30
- 16. Multicast DNS and Power Management............................31
- 17. Multicast DNS Character Set...................................32
- 18. Multicast DNS Message Size....................................33
- 19. Multicast DNS Message Format..................................33
- 20. Choice of UDP Port Number.....................................36
- 21. Summary of Differences Between Multicast DNS and Unicast DNS..37
- 22. Benefits of Multicast Responses...............................38
- 23. IPv6 Considerations...........................................39
- 24. Security Considerations.......................................40
- 25. IANA Considerations...........................................41
- 26. Acknowledgements..............................................41
- 27. Copyright.....................................................41
- 28. Normative References..........................................42
- 29. Informative References........................................42
- 30. Author's Addresses............................................43
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 2]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-1. Introduction
-
- When reading this document, familiarity with the concepts of Zero
- Configuration Networking [ZC] and automatic link-local addressing
- [v4LL] [RFC 2462] is helpful.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, or resource record types.
- This document simply discusses what needs to happen if DNS clients
- start sending DNS queries to a multicast address, and how a
- collection of hosts can cooperate to collectively answer those
- queries in a useful manner.
-
- There has been discussion of how much burden Multicast DNS might
- impose on a network. It should be remembered that whenever IPv4 hosts
- communicate, they broadcast ARP packets on the network on a regular
- basis, and this is not disastrous. The approximate amount of
- multicast traffic generated by hosts making conventional use of
- Multicast DNS is anticipated to be roughly the same order of
- magnitude as the amount of broadcast ARP traffic those hosts already
- generate.
-
- New applications making new use of Multicast DNS capabilities for
- unconventional purposes may generate more traffic. If some of those
- new applications are "chatty", then work will be needed to help them
- become less chatty. When performing any analysis, it is important to
- make a distinction between the application behavior and the
- underlying protocol behavior. If a chatty application uses UDP, that
- doesn't mean that UDP is chatty, or that IP is chatty, or that
- Ethernet is chatty. What it means is that the application is chatty.
- The same applies to any future applications that may decide to layer
- increasing portions of their functionality over Multicast DNS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 3]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
- This document uses the term "host name" in the strict sense to mean a
- fully qualified domain name that has an address record. It does not
- use the term "host name" in the commonly used but incorrect sense to
- mean just the first DNS label of a host's fully qualified domain
- name.
-
- A DNS (or mDNS) packet contains an IP TTL in the IP header, which
- is effectively a hop-count limit for the packet, to guard against
- routing loops. Each Resource Record also contains a TTL, which is
- the number of seconds for which the Resource Record may be cached.
-
- In any place where there may be potential confusion between these two
- types of TTL, the term "IP TTL" is used to refer to the IP header TTL
- (hop limit), and the term "RR TTL" is used to refer to the Resource
- Record TTL (cache lifetime).
-
- When this document uses the term "Multicast DNS", it should be taken
- to mean: Clients performing DNS-like queries for DNS-like resource
- records by sending DNS-like UDP query and response packets over IP
- Multicast to UDP port 5353."
-
-
-3. Multicast DNS Names
-
- This document proposes that the DNS top-level domain ".local." be
- designated a special domain with special semantics, namely that any
- fully-qualified name ending in ".local." is link-local, and names
- within this domain are meaningful only on the link where they
- originate. This is analogous to IPv4 addresses in the 169.254/16
- prefix, which are link-local and meaningful only on the link where
- they originate.
-
- Any DNS query for a name ending with ".local." MUST be sent
- to the mDNS multicast address (224.0.0.251 or its IPv6 equivalent
- FF02::FB).
-
- It is unimportant whether a name ending with ".local." occurred
- because the user explicitly typed in a fully qualified domain name
- ending in ".local.", or because the user entered an unqualified
- domain name and the host software appended the suffix ".local."
- because that suffix appears in the user's search list. The ".local."
- suffix could appear in the search list because the user manually
- configured it, or because it was received in a DHCP option, or via
- any other valid mechanism for configuring the DNS search list. In
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 4]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- this respect the ".local." suffix is treated no differently to any
- other search domain that might appear in the DNS search list.
-
- DNS queries for names that do not end with ".local." MAY be sent to
- the mDNS multicast address, if no other conventional DNS server is
- available. This can allow hosts on the same link to continue
- communicating using each other's globally unique DNS names during
- network outages which disrupt communication with the greater
- Internet. When resolving global names via local multicast, it is even
- more important to use DNSSEC or other security mechanisms to ensure
- that the response is trustworthy. Resolving global names via local
- multicast is a contentious issue, and this document does not discuss
- it in detail, instead concentrating on the issue of resolving local
- names using DNS packets sent to a multicast address.
-
- A host which belongs to an organization or individual who has control
- over some portion of the DNS namespace can be assigned a globally
- unique name within that portion of the DNS namespace, for example,
- "cheshire.apple.com." For those of us who have this luxury, this
- works very well. However, the majority of home customers do not have
- easy access to any portion of the global DNS namespace within which
- they have the authority to create names as they wish. This leaves the
- majority of home computers effectively anonymous for practical
- purposes.
-
- To remedy this problem, this document allows any computer user to
- elect to give their computers link-local Multicast DNS host names of
- the form: "single-dns-label.local." For example, my Titanium
- PowerBook laptop computer answers to the name "sctibook.local." Any
- computer user is granted the authority to name their computer this
- way, providing that the chosen host name is not already in use on
- that link. Having named their computer this way, the user has the
- authority to continue using that name until such time as a name
- conflict occurs on the link which is not resolved in the user's
- favour. If this happens, the computer (or its human user) SHOULD
- cease using the name, and may choose to attempt to allocate a new
- unique name for use on that link. Like law suits over global DNS
- names, these conflicts are expected to be relatively rare for people
- who choose reasonably imaginative names, but it is still important
- to have a mechanism in place to handle them when they happen.
-
- The point made in the previous paragraph is very important and bears
- repeating. It is easy for those of us in the IETF community who run
- our own name servers at home to forget that the majority of computer
- users do not run their own name server and have no easy way to create
- their own host names. When these users wish to transfer files between
- two laptop computers, they are frequently reduced to typing in
- dotted-decimal IP addresses because they simply have no other way for
- one host to refer to the other by name. This is a sorry state of
- affairs. What is worse, most users don't even bother trying to use
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 5]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- dotted-decimal IP addresses. Most users still move data between
- machines by copying it onto a floppy disk or similar removable media.
-
- In a world of gigabit Ethernet and ubiquitous wireless networking it
- is a sad indictment of the networking community that the preferred
- communication medium for most computer users is still the floppy
- disk.
-
- Allowing ad-hoc allocation of single-label names in a single flat
- ".local." namespace may seem to invite chaos. However, operational
- experience with AppleTalk NBP names [NBP], which on any given link
- are also effectively single-label names in a flat namespace, shows
- that in practice name collisions happen extremely rarely and are not
- a problem. Groups of computer users from disparate organizations
- bring Macintosh laptop computers to events such as IETF Meetings, the
- Mac Hack conference, the Apple World Wide Developer Conference, etc.,
- and complaints at these events about users suffering conflicts and
- being forced to rename their machines have never been an issue.
-
- Enforcing uniqueness of host names (i.e. the names of DNS address
- records mapping names to IP addresses) is probably desirable in the
- common case, but this document does not mandate that. It is
- permissible for a collection of coordinated hosts to agree to
- maintain multiple DNS address records with the same name, possibly
- for load balancing or fault-tolerance reasons. This document does not
- take a position on whether that is sensible. It is important that
- both modes of operation are supported. The Multicast DNS protocol
- allows hosts to verify and maintain unique names for resource records
- where that behaviour is desired, and it also allows hosts to maintain
- multiple resource records with a single shared name where that
- behaviour is desired. This consideration applies to all resource
- records, not just address records (host names). In summary: It is
- required that the protocol have the ability to detect and handle name
- conflicts, but it is not required that this ability be used for every
- record.
-
-
-3.1 Governing Standards Body
-
- Note that this use of the ".local." suffix falls under IETF
- jurisdiction, not ICANN jurisdiction. DNS is an IETF network
- protocol, governed by protocol rules defined by the IETF. These IETF
- protocol rules dictate character set, maximum name length, packet
- format, etc. ICANN determines additional rules that apply when the
- IETF's DNS protocol is used on the public Internet. In contrast,
- private uses of the DNS protocol on isolated private networks are not
- governed by ICANN. Since this proposed change is a change to the core
- DNS protocol rules, it affects everyone, not just those machines
- using the ICANN-governed Internet. Hence this change falls into the
- category of an IETF protocol rule, not an ICANN usage rule.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 6]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-3.2 Private DNS Namespaces
-
- Note also that the special treatment of names ending in ".local." has
- been implemented in Macintosh computers since the days of Mac OS 9,
- and continues today in Mac OS X. There are also implementations for
- Linux and other platforms [dotlocal]. Operators setting up private
- internal networks ("intranets") are advised that their lives may be
- easier if they avoid using the suffix ".local." in names in their
- private internal DNS server. Alternative possibilities include:
-
- .intranet
- .internal
- .private
- .corp
- .home
-
- Another alternative naming scheme, advocated by Professor D. J.
- Bernstein, is to use a numerical suffix, such as ".6." [djbdl].
-
-
-3.3 Maximum Multicast DNS Name Length
-
- RFC 1034 says:
-
- "the total number of octets that represent a domain name (i.e.,
- the sum of all label octets and label lengths) is limited to 255."
-
- This text implies that the final root label at the end of every name
- is included in this count (a name can't be represented without it),
- but the text does not explicitly state that. Implementations of
- Multicast DNS MUST include the label length byte of the final root
- label at the end of every name when enforcing the rule that no name
- may be longer than 255 bytes. For example, the length of the name
- "apple.com." is considered to be 11, which is the number of bytes it
- takes to represent that name in a packet without using name
- compression:
-
- ------------------------------------------------------
- | 0x05 | a | p | p | l | e | 0x03 | c | o | m | 0x00 |
- ------------------------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 7]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-4. IP TTL Checks
-
- All Multicast DNS responses (including responses sent via unicast)
- MUST be sent with IP TTL set to 255.
-
- A host sending Multicast DNS queries to a link-local destination
- address (including the 224.0.0.251 link-local multicast address) MUST
- verify that the IP TTL in response packets is 255, and silently
- discard any response packets where the IP TTL is not 255. Without
- this check, it could be possible for remote rogue hosts to send
- spoof answer packets (perhaps unicast to the victim host) which the
- receiving machine could misinterpret as having originated on the
- local link.
-
- The authors have heard complaints that some older network stack
- implementations do not implement the IP_RECVTTL socket option
- (or equivalent API) for obtaining the IP TTL of received packets.
- This is unfortunate, and these old network stacks would benefit
- from adding this API support so that they may benefit from this
- enhanced protection against spoof packets arriving from off-link.
-
- Note that Multicast DNS Responders SHOULD NOT discard queries with
- TTLs other than 255. There may be valid future applications of
- Multicast DNS where hosts issue unicast queries directed at Multicast
- DNS Responders more than one hop away, if Multicast DNS Responders
- were to discard queries where the TTL is not 255, they would not
- answer these queries.
-
-
-5. Reverse Address Mapping
-
- Like ".local.", the IPv4 and IPv6 reverse-mapping domains are also
- defined to be link-local.
-
- Any DNS query for a name ending with "254.169.in-addr.arpa." MUST
- be sent to the mDNS multicast address 224.0.0.251. Since names under
- this domain correspond to IPv4 link-local addresses, it is logical
- that the local link is the best place to find information pertaining
- to those names. As an optimization, these queries MAY be first
- unicast directly to the address in question, but if this query is not
- answered, the query MUST also be sent via multicast, to accommodate
- the case where the machine in question is not answering for itself
- (for example, because it is currently sleeping).
-
- Likewise, any DNS query for a name ending with "0.8.e.f.ip6.arpa."
- MUST be sent to the IPv6 mDNS link-local multicast address FF02::FB,
- with or without an optional initial query unicast directly to the
- address in question.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 8]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-6. Querying
-
- There are three kinds of Multicast DNS Queries, one-shot queries of
- the kind made by today's conventional DNS clients, one-shot queries
- accumulating multiple responses made by multicast-aware DNS clients,
- and continuous ongoing Multicast DNS Queries used by IP network
- browser software.
-
- A Multicast DNS Responder that is offering records that are intended
- to be unique on the local link MUST also implement a Multicast DNS
- Querier so that it can first verify the uniqueness of those records
- before it begins answering queries for them.
-
-
-6.1 One-Shot Queries
-
- An unsophisticated DNS client may simply send its DNS queries
- blindly to the 224.0.0.251 multicast address, without necessarily
- even being aware what a multicast address is.
-
- Such an unsophisticated DNS client may not get ideal behaviour. Such
- a client may simply take the first response it receives and fail to
- wait to see if there are more, but in many instances this may not be
- a serious problem. If a user types "http://stu.local." into their Web
- browser and gets to see the page they were hoping for, then the
- protocol has met the user's needs in this case.
-
-
-6.2 One-Shot Queries, Accumulating Multiple Responses
-
- A more sophisticated DNS client should understand that Multicast DNS
- is not exactly the same as unicast DNS, and should modify its
- behaviour in some simple ways.
-
- As described above, there are some cases, such as looking up the
- address associated with a unique host name, where a single response
- is sufficient, and moreover may be all that is expected. However,
- there are other DNS queries where more than one response is
- possible, and for these queries a more sophisticated Multicast DNS
- client should include the ability to wait for an appropriate period
- of time to collect multiple responses.
-
- A naive DNS client retransmits its query only so long as it has
- received no response. A more sophisticated Multicast DNS client is
- aware that having received one response is not necessarily an
- indication that it might not receive others, and has the ability to
- retransmit its query an appropriate number of times at appropriate
- intervals until it is satisfied with the collection of responses it
- has gathered.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 9]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- A more sophisticated Multicast DNS client that is retransmitting
- a query for which it has already received some responses, MUST
- implement Known Answer Suppression, as described below in Section
- 7.1. This indicates to responders who have already replied that their
- responses have been received, and they don't need to send them again
- in response to this repeated query. In addition, the interval between
- the first two queries MUST be at least one second, and the
- intervals between subsequent queries MUST double.
-
-
-6.3 Continuous Querying
-
- In One-Shot Queries, with either a single or multiple responses,
- the underlying assumption is that the transaction begins when the
- application issues a query, and ends when all the desired responses
- have been received. There is another type of operation which is more
- akin to continuous monitoring.
-
- Macintosh users are accustomed to opening the "Chooser" window,
- selecting a desired printer, and then closing the Chooser window.
- However, when the desired printer does not appear in the list, the
- user will typically leave the "Chooser" window open while they go and
- check to verify that the printer is plugged in, powered on, connected
- to the Ethernet, etc. While the user jiggles the wires, hits the
- Ethernet hub, and so forth, they keep an eye on the Chooser window,
- and when the printer name appears, they know they have fixed whatever
- the problem was. This can be a useful and intuitive troubleshooting
- technique, but a user who goes home for the weekend leaving the
- Chooser window open places a non-trivial burden on the network.
-
- With continuous querying, multiple queries are sent over a long
- period of time, until the user terminates the operation. It is
- important that an IP network browser window displaying live
- information from the network using Multicast DNS, if left running for
- an extended period of time, should generate significantly less
- multicast traffic on the network than the old AppleTalk Chooser.
- Therefore, the interval between the first two queries MUST be at
- least one second, the intervals between subsequent queries MUST
- double, and the querier MUST implement Known Answer Suppression, as
- described below in Section 7.1.
-
- When a Multicast DNS Querier receives an answer, the answer contains
- a TTL value that indicates for how many seconds this answer is valid.
- After this interval has passed, the answer will no longer be valid
- and should be deleted from the cache. Before this time is reached, a
- Multicast DNS Querier with an ongoing interest in that record SHOULD
- re-issue its query to determine whether the record is still valid,
- and if so update its expiry time.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 10]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- To perform this cache maintenance, a Multicast DNS Querier should
- plan to issue a query at 80% of the record lifetime, and then if no
- answer is received, at 85%, 90% and 95%. If an answer is received,
- then the remaining TTL is reset to the value given in the answer, and
- this process repeats for as long as the Multicast DNS Querier has an
- ongoing interest in the record. If after four queries no answer is
- received, the record is deleted when it reaches 100% of its lifetime.
-
- To avoid the case where multiple Multicast DNS Queriers on a network
- all issue their queries simultaneously, a random variation of 2% of
- the record TTL should be added, so that queries are scheduled to be
- performed at 80-82%, 85-87%, 90-92% and then 95-97% of the TTL.
-
-
-6.4 Multiple Questions per Query
-
- Multicast DNS allows a querier to place multiple questions in the
- question section of a single Multicast DNS query packet.
-
- The semantics of a Multicast DNS query packet containing multiple
- questions is identical to a series of individual DNS query packets
- containing one question each. Combining multiple questions into a
- single packet is purely an efficiency optimization, and has no other
- semantic significance.
-
- A useful technique for adaptively combining multiple questions into a
- single query is to use a Nagle-style algorithm: When a client issues
- its first question, a Query packet is immediately built and sent,
- without delay. If the client then continues issuing a rapid series of
- questions they are held until either the first query receives at
- least one answer, or 100ms has passed, or there are enough questions
- to fill the question section of a Multicast DNS query packet. At this
- time, all the held questions are placed into a Multicast DNS query
- packet and sent.
-
-
-6.5 Questions Requesting Unicast Responses
-
- Sending Multicast DNS responses via multicast has the benefit that
- all the other hosts on the network get to see those responses, and
- can keep their caches up to date, and detect conflicting responses.
-
- However, there are situations where all the other hosts on the
- network don't need to see every response. One example is a laptop
- computer waking from sleep. At that instant it is a brand new
- participant on a new network. Its Multicast DNS cache is empty, and
- it has no knowledge of its surroundings. It may have a significant
- number of queries that it wants answered right away to discover
- information about its new surroundings and present that information
- to the user. As a new participant on the network, it has no idea
- whether the exact same questions may have been asked and answered
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 11]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- just seconds ago. In this case, trigging a large sudden flood of
- multicast responses may impose an unreasonable burden on the network.
- To avoid this, the Multicast DNS Querier SHOULD set the top bit in
- the class field of its DNS question(s), to indicate that it is
- willing to accept unicast responses instead of the usual multicast
- responses. These questions requesting unicast responses are referred
- to as "QU" questions, to distinguish them from the more usual
- questions requesting multicast responses ("QM" questions).
-
- When retransmitting a question more than once, the 'unicast response'
- bit SHOULD be set only for the first question of the series. After
- the first question has received its responses, the querier should
- have a large known-answer list (see "Known Answer Suppression" below)
- so that subsequent queries should elicit few, if any, further
- responses. Reverting to multicast responses as soon as possible is
- important because of the benefits that multicast responses provide
- (see "Benefits of Multicast Responses" below).
-
- When receiving a question with the 'unicast response' bit set, a
- responder SHOULD usually respond with a unicast packet directed back
- to the querier. If the responder has not multicast that record
- recently (within one quarter of its TTL), then the responder SHOULD
- instead multicast the response so as to keep all the peer caches up
- to date, and to permit passive conflict detection.
-
-
-6.6 Suppressing Initial Query
-
- If a query is issued for which there already exist one or more
- records in the local cache, and those record(s) were received with
- the cache flush bit set, indicating that they form a unique RRSet,
- then the host SHOULD suppress its initial "QU" query, and proceed to
- issue a "QM" query. To avoid the situation where a group of hosts
- are synchronized by some external event and all perform the same
- query simultaneously, a host suppressing its initial "QU" query
- SHOULD impose a random delay from 500-1000ms before transmitting its
- first "QM" query for this question. This means that when the first
- host (selected randomly by this algorithm) transmits its "QM" query,
- all the other hosts that were about to transmit the same query can
- suppress their superfluous query, as described in "Duplicate
- Question Suppression" below.
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 12]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-7. Duplicate Suppression
-
- A variety of techniques are used to reduce the amount of redundant
- traffic on the network.
-
-
-7.1 Known Answer Suppression
-
- When a Multicast DNS Querier sends a query to which it already knows
- some answers, it populates the Answer Section of the DNS message with
- those answers.
-
- A Multicast DNS Responder SHOULD NOT answer a Multicast DNS Query if
- the answer it would give is already included in the Answer Section
- with an RR TTL at least half the correct value. If the RR TTL of the
- answer as given in the Answer Section is less than half of the true
- RR TTL as known by the Multicast DNS Responder, the responder MUST
- send an answer so as to update the Querier's cache before the record
- becomes in danger of expiration.
-
- Because a Multicast DNS Responder will respond if the remaining TTL
- given in the known answer list is less than half the true TTL, it is
- superfluous for the Querier to include such records in the known
- answer list. Therefore a Multicast DNS Querier SHOULD NOT include
- records in the known answer list whose remaining TTL is less than
- half their original TTL. Doing so would simply consume space in the
- packet without achieving the goal of suppressing responses, and would
- therefore be a pointless waste of network bandwidth.
-
- A Multicast DNS Querier MUST NOT cache resource records observed in
- the Known Answer Section of other Multicast DNS Queries. The Answer
- Section of Multicast DNS Queries is not authoritative. By placing
- information in the Answer Section of a Multicast DNS Query the
- querier is stating that it *believes* the information to be true.
- It is not asserting that the information *is* true. Some of those
- records may have come from other hosts that are no longer on the
- network. Propagating that stale information to other Multicast DNS
- Queriers on the network would not be helpful.
-
-
-7.2 Multi-Packet Known Answer Suppression
-
- Sometimes a Multicast DNS Querier will already have too many answers
- to fit in the Known Answer section of its query packets. In this
- case, it should issue a Multicast DNS Query containing a question and
- as many Known Answer records as will fit. It should then set the TC
- (Truncated) bit in the header before sending the Query. It should
- then immediately follow the packet with another query containing no
- questions, and as many more Known Answer records as will fit. If
- there are still too many records remaining to fit in the packet, it
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 13]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- again sets the TC bit and continues until all the Known Answer
- records have been sent.
-
- A Multicast DNS Responder seeing a Multicast DNS Query with the TC
- bit set defers its response for a time period randomly selected in
- the interval 20-120ms. This gives the Multicast DNS Querier time to
- send additional Known Answer packets before the Responder responds.
- If the Responder sees any of its answers listed in the Known Answer
- lists of subsequent packets from the querying host, it should delete
- that answer from the list of answers it is planning to give, provided
- that no other host on the network is also waiting to receive the same
- answer record.
-
-
-7.3 Duplicate Question Suppression
-
- If a host is planning to send a query, and it sees another host on
- the network send a query containing the same question, and the Known
- Answer section of that query does not contain any records which this
- host would not also put in its own Known Answer section, then this
- host should treat its own query as having been sent. When multiple
- clients on the network are querying for the same resource records,
- there is no need for them to all be repeatedly asking the same
- question.
-
-
-7.4 Duplicate Answer Suppression
-
- If a host is planning to send an answer, and it sees another host on
- the network send a response packet containing the same answer record,
- and the TTL in that record is not less than the TTL this host would
- have given, then this host should treat its own answer as having been
- sent. When multiple responders on the network have the same data,
- there is no need for all of them to respond.
-
- This feature is particularly useful when multiple Sleep Proxy Servers
- are deployed (see Section 16. "Multicast DNS and Power Management").
- In the future it is possible that every general-purpose OS (Mac,
- Windows, Linux, etc.) will implement Sleep Proxy Service as a matter
- of course. In this case there could be a large number of Sleep Proxy
- Servers on any given network, which is good for reliability and
- fault-tolerance, but would be bad for the network if every Sleep
- Proxy Server were to answer every query.
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 14]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-8. Responding
-
- A Multicast DNS Responder MUST only respond when it has a positive
- non-null response to send. Error responses must never be sent. The
- non-existence of any name in a Multicast DNS Domain is ascertained by
- the failure of any machine to respond to the Multicast DNS query, not
- by NXDOMAIN errors.
-
- Multicast DNS Responses MUST NOT contain any questions in the
- Question Section. Any questions in the Question Section of a received
- Multicast DNS Response MUST be silently ignored. Multicast DNS
- Queriers receiving Multicast DNS Responses do not care what question
- elicited the response; they care only that the information in the
- response is true and accurate.
-
- A Multicast DNS Responder on Ethernet [IEEE802] and similar shared
- multiple access networks SHOULD delay its responses by a random
- amount of time selected with uniform random distribution in the range
- 20-120ms. If multiple Multicast DNS Responders were all to respond
- immediately to a particular query, a collision would be virtually
- guaranteed. By imposing a small random delay, the number of
- collisions is dramatically reduced. 120ms is a short enough time that
- it is almost imperceptible to a human user, but long enough to
- significantly reduce the risk of Ethernet collisions. On a full-sized
- Ethernet using the maximum cable lengths allowed and the maximum
- number of repeaters allowed, an Ethernet frame is vulnerable to
- collisions during the transmission of its first 256 bits. On 10Mb/s
- Ethernet, this equates to a vulnerable time window of 25.6us.
-
- In the case where a Multicast DNS Responder has good reason to
- believe that it will be the only responder on the link with a
- positive non-null response, it SHOULD NOT impose the random delay
- before responding, and SHOULD normally generate its response within
- 10ms. To do this safely, it MUST have previously verified that the
- requested name, type and class in the DNS query are unique on this
- link. Responding immediately without delay is appropriate for things
- like looking up the address record for a particular host name, when
- the host name has been previously verified unique. Responding
- immediately without delay is *not* appropriate for things like
- looking up PTR records used for DNS Service Discovery [DNS-SD], where
- a large number of responses may be anticipated.
-
- Except when a unicast reply has been explicitly requested via the
- "unicast reply" bit, Multicast DNS Responses MUST be sent to UDP port
- 5353 (the well-known port assigned to mDNS) on the 224.0.0.251
- multicast address (or its IPv6 equivalent FF02::FB). Operating in a
- Zeroconf environment requires constant vigilance. Just because a name
- has been previously verified unique does not mean it will continue to
- be so indefinitely. By allowing all Multicast DNS Responders to
- constantly monitor their peers' responses, conflicts arising out of
- network topology changes can be promptly detected and resolved.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 15]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- Sending all responses by multicast also facilitates opportunistic
- caching by other hosts on the network.
-
- To protect the network against excessive packet flooding due to
- software bugs or malicious attack, a Multicast DNS Responder MUST NOT
- multicast a given record on a given interface if it has previously
- multicast that record on that interface within the last second. A
- legitimate client on the network should have seen the previous
- transmission and cached it. A client that did not receive and cache
- the previous transmission will retry its request and receive a
- subsequent response. Under no circumstances is there any legitimate
- reason for a Multicast DNS Responder to multicast a given record more
- than once per second on any given interface.
-
-
-8.1 Legacy Unicast Responses
-
- If the source UDP port in a received Multicast DNS Query is not port
- 5353, this indicates that the client originating the query is a
- simple client that does not fully implement all of Multicast DNS. In
- this case, the Multicast DNS Responder MUST send a UDP response
- directly back to the client, via unicast, to the query packet's
- source IP address and port. This unicast response MUST be a
- conventional unicast response as would be generated by a conventional
- unicast DNS server; for example, it must repeat the query ID and the
- question given in the query packet.
-
- The resource record TTL given in a unicast response SHOULD NOT be
- greater than ten seconds, even if the true TTL of the Multicast DNS
- resource record is higher. This is because Multicast DNS Responders
- that fully participate in the protocol use the cache coherency
- mechanisms described in Section 13 to update and invalidate stale
- data. Were unicast responses sent to legacy clients to use the same
- high TTLs, these legacy clients, which do not implement these cache
- coherency mechanisms, could retain stale cached resource record data
- long after it is no longer valid.
-
- Having sent this unicast response, if the Responder has not sent this
- record in any multicast response recently, it SHOULD schedule the
- record to be sent via multicast as well, to facilitate passive
- conflict detection. "Recently" in this context means "if the time
- since the record was last sent via multicast is less than one quarter
- of the record's TTL".
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 16]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-8.2 Multi-Question Queries
-
- Multicast DNS Responders MUST correctly handle DNS query packets
- containing more than one question, by answering any or all of the
- questions to which they have answers. Any answers generated
- in response to query packets containing more than one question
- MUST be randomly delayed in the range 20-120ms, as described above.
-
-
-8.3 Response Aggregation
-
- Having delayed one or more multicast responses by 20-120ms as
- described above in Section 8 "Responding", a Multicast DNS Responder
- SHOULD, for the sake of network efficiency, aggregate as many of its
- pending responses as possible into a single Multicast DNS response
- packet.
-
-
-9. Probing and Announcing on Startup
-
- Typically a Multicast DNS Responder should have, at the very least,
- address records for all of its active interfaces. Creating and
- advertising an HINFO record on each interface as well can be useful
- to network administrators.
-
- Whenever a Multicast DNS Responder starts up, wakes up from sleep,
- receives an indication of an Ethernet "Link Change" event, or has any
- other reason to believe that its network connectivity may have
- changed in some relevant way, it MUST perform the two startup steps
- below.
-
-
-9.1 Probing
-
- The first startup step is that for all those resource records that a
- Multicast DNS Responder desires to be unique on the local link, it
- MUST send a Multicast DNS Query asking for those resource records, to
- see if any of them are already in use. The primary example of this is
- its address record which maps its unique host name to its unique IP
- address. All Probe Queries SHOULD be done using the desired resource
- record name and query type T_ANY (255), to elicit answers for all
- types of records with that name. This allows a single question to be
- used in place of several questions, which is more efficient on the
- network. It also allows a host to verify exclusive ownership of a
- name, which is desirable in most cases. It would be confusing, for
- example, if one host owned the "A" record for "myhost.local.", but a
- different host owned the HINFO record for that name.
-
- The ability to place more than one question in a Multicast DNS Query
- is useful here, because it can allow a host to use a single packet
- for all of its resource records instead of needing a separate packet
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 17]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- for each. For example, a host can simultaneously probe for uniqueness
- of its "A" record and all its SRV records [DNS-SD] in the same query
- packet.
-
- When ready to send its mDNS probe packet(s) the host should first
- wait for a short random delay time, uniformly distributed in the
- range 0-250ms. This random delay is to guard against the case where a
- group of devices are powered on simultaneously, or a group of devices
- are connected to an Ethernet hub which is then powered on, or some
- other external event happens that might cause a group of hosts to all
- send synchronized probes.
-
- 250ms after the first query the host should send a second, then
- 250ms after that a third. If, by 250ms after the third probe, no
- conflicting Multicast DNS responses have been received, the host may
- move to the next step, announcing.
-
- If any conflicting Multicast DNS responses are received, then the
- probing host MUST defer to the existing host, and must choose new
- names for some or all of its resource records as appropriate, to
- avoid conflict with pre-existing hosts on the network. In the case
- of a host probing using query type T_ANY as recommended above, any
- answer containing a record with that name, of any type, MUST be
- considered a conflicting response and handled accordingly.
-
- If ten failures occur within any ten-second period, then the host
- MUST wait at least five seconds before each successive additional
- probe attempt. This is to help ensure that in the event of software
- bugs or other unanticipated problems, errant hosts do not flood the
- network with a continuous stream of multicast traffic. For very
- simple devices, a valid way to comply with this requirement is to
- always wait five seconds after any failed probe attempt.
-
-
-9.2 Simultaneous Probe Tie-Breaking
-
- The astute reader will observe that there is a race condition
- inherent in the previous description. If two hosts are probing for
- the same name simultaneously, neither will receive any response to
- the probe, and the hosts could incorrectly conclude that they may
- both proceed to use the name. To break this symmetry, each host
- populates the Authority Section of its queries with records giving
- the rdata that it would be proposing to use, should its probing be
- successful. The Authority Section is being used here in a way
- analogous to the Update section of a DNS Update packet [RFC 2136].
-
- When a host that is probing for a record sees another host issue a
- query for the same record, it consults the Authority Section of that
- query. If it finds any resource record there which answers the query,
- then it compares the data of that resource record with its own
- tentative data. The lexicographically later data wins. This means
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 18]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- that if the host finds that its own data is lexicographically later,
- it simply ignores the other host's probe. If the host finds that its
- own data is lexicographically earlier, then it treats this exactly
- as if it had received a positive answer to its query, and concludes
- that it may not use the desired name.
-
- The determination of 'lexicographically later' is performed by first
- comparing the record class, then the record type, then raw comparison
- of the binary content of the rdata without regard for meaning or
- structure. If the record classes differ, then the numerically greater
- class is considered 'lexicographically later'. Otherwise, if the
- record types differ, then the numerically greater type is considered
- 'lexicographically later'. If the type and class both match then the
- rdata is compared.
-
- In the case of resource records containing rdata that is subject to
- name compression, the names must be uncompressed before comparison.
- (The details of how a particular name is compressed is an artifact of
- how and where the record is written into the DNS message; it is not
- an intrinsic property of the resource record itself.)
-
- The bytes of the raw uncompressed rdata are compared in turn,
- interpreting the bytes as eight-bit UNSIGNED values, until a byte
- is found whose value is greater than that of its counterpart (in
- which case the rdata whose byte has the greater value is deemed
- lexicographically later) or one of the resource records runs out
- of rdata (in which case the resource record which still has
- remaining data first is deemed lexicographically later).
-
- The following is an example of a conflict:
-
- sctibook.local. A 196.254.100.200
- sctibook.local. A 196.254.200.100
-
- In this case 196.254.200.100 is lexicographically later, so it is
- deemed the winner.
-
- Note that it is vital that the bytes are interpreted as UNSIGNED
- values, or the wrong outcome may result. In the example above, if
- the byte with value 200 had been incorrectly interpreted as a
- signed value then it would be interpreted as value -56, and the
- wrong address record would be deemed the winner.
-
-
-9.3 Announcing
-
- The second startup step is that the Multicast DNS Responder MUST send
- a gratuitous Multicast DNS Response containing, in the Answer
- Section, all of its resource records. If there are too many resource
- records to fit in a single packet, multiple packets should be used.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 19]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- In the case of shared records (e.g. the PTR records used by DNS
- Service Discovery [DNS-SD]), the records are simply placed as-is
- into the answer section of the DNS Response.
-
- In the case of records that have been verified to be unique in the
- previous step, they are placed into the answer section of the DNS
- Response with the most significant bit of the rrclass set to one. The
- most significant bit of the rrclass is the mDNS "cache flush" bit and
- is discussed in more detail below in Section 13.3 "Announcements to
- Flush Outdated Cache Entries".
-
- The Multicast DNS Responder MUST send at least two gratuitous
- responses, one second apart. A Responder MAY send up to ten
- gratuitous Responses, providing that the interval between gratuitous
- responses doubles with every response sent.
-
- A Multicast DNS Responder SHOULD NOT continue sending gratuitous
- Responses for longer than the TTL of the record. The purpose of
- announcing new records via gratuitous Responses is to ensure that
- peer caches are up to date. After a time interval equal to the TTL of
- the record has passed, it is very likely that old stale copies of
- that record in peer caches will have expired naturally, so subsequent
- announcements serve little purpose.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the conflict MUST be resolved as described below in "Conflict
- Resolution".
-
- A Multicast DNS Responder MUST NOT send announcements in the absence
- of information that its network connectivity may have changed in some
- relevant way. In particular, a Multicast DNS Responder MUST NOT send
- regular periodic announcements as a matter of course.
-
-
-9.4 Updating
-
- At any time, if the rdata of any of a host's Multicast DNS records
- changes, the host MUST repeat the Announcing step described above to
- update neighbouring caches. For example, if any of a host's IP
- addresses change, it must re-announce those address records.
-
- A host may update the contents of any of its records at any time,
- though a host SHOULD NOT update records more frequently than ten
- times per minute. Frequent rapid updates impose a burden on the
- network. If a host has information to disseminate which changes more
- frequently than ten times per minute, then Multicast DNS may not be
- the appropriate protocol to disseminate that information.
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 20]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-10. Conflict Resolution
-
- A conflict occurs when two resource records with the same name, type
- and class have inconsistent rdata. What may be considered
- inconsistent is context sensitive, except that resource records with
- identical rdata are never considered inconsistent, even if they
- originate from different hosts. A common example of a resource record
- type that is intended to be unique, not shared between hosts, is the
- address record that maps a host's name to its IP address. Should a
- host witness another host announce an address record with the same
- name but a different IP address, then that is considered
- inconsistent, and that address record is considered to be in
- conflict.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the Multicast DNS Responder MUST immediately reset that
- record to probing state, and go through the startup steps described
- above in Section 9. "Probing and Announcing on Startup". The
- protocol used in the Probing phase will determine a winner and a
- loser, and the loser must cease using the name, and reconfigure.
-
- It is very important that any host that observes an apparent conflict
- MUST take action. In the case of two hosts using the same host name,
- where one has been configured to require a unique host name and the
- other has not, the one that has not been configured to require a
- unique host name will not perceive any conflict, and will not take
- any action. By reverting to Probing state, the host that desires a
- unique host name will go through the necessary steps to ensure that a
- unique host is obtained.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 21]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- The recommended course of action after probing and failing is as
- follows:
-
- o Programmatically change the resource record name in an attempt to
- find a new name that is unique. This could be done by adding some
- further identifying information (e.g. the model name of the
- hardware) if it is not already present in the name, appending the
- digit "2" to the name, or incrementing a number at the end of the
- name if one is already present.
-
- o Probe again, and repeat until a unique name is found.
-
- o Record this newly chosen name in persistent storage so that the
- device will use the same name the next time it is power-cycled.
-
- o Display a message to the user or operator informing them of the
- name change. For example:
-
- The name "Bob's Music" is in use by another iTunes music
- server on the network. Your music has been renamed to
- "Bob's Music (G4 Cube)". If you want to change this name,
- use [describe appropriate menu item or preference dialog].
-
- How the user or operator is informed depends on context. A desktop
- computer with a screen might put up a dialog box. A headless server
- in the closet may write a message to a log file, or use whatever
- mechanism (email, SNMP trap, etc.) it uses to inform the
- administrator of other error conditions. On the other hand a headless
- server in the closet may not inform the user at all -- if the user
- cares, they will notice the name has changed, and connect to the
- server in the usual way (e.g. via Web Browser) to configure a new
- name.
-
- The examples in this section focus on address records (i.e. host
- names), but the same considerations apply to all resource records
- where uniqueness (or maintenance of some other defined constraint) is
- desired.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 22]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-11. Special Characteristics of Multicast DNS Domains
-
- Unlike conventional DNS names, names that end in ".local.",
- "254.169.in-addr.arpa." or "0.8.e.f.ip6.arpa." have only local
- significance. Conventional DNS seeks to provide a single unified
- namespace, where a given DNS query yields the same answer no matter
- where on the planet it is performed or to which recursive DNS server
- the query is sent. (However, split views, firewalls, intranets and
- the like have somewhat interfered with this goal of DNS representing
- a single universal truth.) In contrast, each IP link has its own
- private ".local.", "254.169.in-addr.arpa." and "0.8.e.f.ip6.arpa."
- namespaces, and the answer to any query for a name within those
- domains depends on where that query is asked.
-
- Multicast DNS Domains are not delegated from their parent domain via
- use of NS records. There are no NS records anywhere in Multicast DNS
- Domains. Instead, all Multicast DNS Domains are delegated to the IP
- addresses 224.0.0.251 and FF02::FB by virtue of the individual
- organizations producing DNS client software deciding how to handle
- those names. It would be extremely valuable for the industry if this
- special handling were ratified and recorded by IANA, since otherwise
- the special handling provided by each vendor is likely to be
- inconsistent.
-
- The IPv4 name server for a Multicast DNS Domain is 224.0.0.251. The
- IPv6 name server for a Multicast DNS Domain is FF02::FB. These are
- multicast addresses; therefore they identify not a single host but a
- collection of hosts, working in cooperation to maintain some
- reasonable facsimile of a competently managed DNS zone. Conceptually
- a Multicast DNS Domain is a single DNS zone, however its server is
- implemented as a distributed process running on a cluster of loosely
- cooperating CPUs rather than as a single process running on a single
- CPU.
-
- No delegation is performed within Multicast DNS Domains. Because the
- cluster of loosely coordinated CPUs is cooperating to administer a
- single zone, delegation is neither necessary nor desirable. Just
- because a particular host on the network may answer queries for a
- particular record type with the name "example.local." does not imply
- anything about whether that host will answer for the name
- "child.example.local.", or indeed for other record types with the
- name "example.local."
-
- Multicast DNS Zones have no SOA record. A conventional DNS zone's
- SOA record contains information such as the email address of the zone
- administrator and the monotonically increasing serial number of the
- last zone modification. There is no single human administrator for
- any given Multicast DNS Zone, so there is no email address. Because
- the hosts managing any given Multicast DNS Zone are only loosely
- coordinated, there is no readily available monotonically increasing
- serial number to determine whether or not the zone contents have
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 23]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- changed. A host holding part of the shared zone could crash or be
- disconnected from the network at any time without informing the other
- hosts. There is no reliable way to provide a zone serial number that
- would, whenever such a crash or disconnection occurred, immediately
- change to indicate that the contents of the shared zone had changed.
-
- Zone transfers are not possible for any Multicast DNS Zone.
-
-
-12. Multicast DNS for Service Discovery
-
- This document does not describe using Multicast DNS for network
- browsing or service discovery. However, the mechanisms this document
- describes are compatible with (and support) the browsing and service
- discovery mechanisms proposed in "DNS-Based Service Discovery"
- [DNS-SD].
-
- This document places few limitations on what DNS record types may be
- looked up using local multicast. One particular kind of Multicast DNS
- query that might be useful is a query for the SRV record named
- "_domain._udp.local.", yielding the port number and IP address of a
- conventional DNS server willing to perform general recursive DNS
- lookups. This could solve a particular problem facing the IPv6
- community, which is that IPv6 is able to self-configure almost all of
- the information it needs to operate [RFC 2462], except for the
- address of the DNS server. Bringing in all of the mechanisms of DHCP
- just for that one little additional piece of information is not an
- attractive solution. Using DNS-format messages and DNS-format
- resource records to find the address of the DNS server has an elegant
- self-sufficiency about it. Any host that needs to know the address of
- the DNS server must already have code to generate and parse DNS
- packets, so using that same code and those same packets to find the
- DNS server in the first place is a simple self-reliant solution that
- avoids taking external dependencies on other protocols.
-
-
-13. Resource Record TTL Values and Cache Coherency
-
- The recommended TTL value for Multicast DNS resource records is
- 120 minutes.
-
- A client with an active outstanding query will issue a query packet
- when one or more of the resource record(s) in its cache is (are) 80%
- of the way to expiry. If the TTL on those records is 120 minutes,
- this ongoing cache maintenance process yields a steady-state query
- rate of one query every 96 minutes.
-
- Any distributed cache needs a cache coherency protocol. If Multicast
- DNS resource records follow the recommendation and have a TTL of 120
- minutes, that means that stale data could persist in the system for
- up to two hours. Making the default TTL significantly lower would
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 24]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- reduce the lifetime of stale data, but would produce too much extra
- traffic on the network. Various techniques are available to minimize
- the impact of such stale data.
-
-
-13.1 Cooperating Multicast DNS Responders
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, but different rdata, then:
-
- o If A's resource record is intended to be a shared resource record,
- then this is no conflict, and no action is required.
-
- o If A's resource record is intended to be a unique resource record
- then this is a conflict and MUST be handled as described in Section
- 10 "Conflict Resolution".
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name type and class as one of A's
- resource records, and identical rdata, then:
-
- o If the TTL of B's resource record given in the packet is at least
- half the true TTL from A's point of view, then no action is
- required.
-
- o If the TTL of B's resource record given in the packet is less than
- half the true TTL from A's point of view, then A MUST mark its
- record to be announced via multicast. Clients receiving the record
- from B would use the TTL given by B, and hence may delete the
- record sooner than A expects. By sending its own multicast response
- correcting the TTL, A ensures that the record will be retained for
- the desired time.
-
- These rules allow multiple Multicast DNS Responders to offer the same
- data on the network (perhaps for fault tolerance reasons) without
- conflicting with each other.
-
-
-13.2 Goodbye Packets
-
- In the case where a host knows that certain resource record data is
- about to become invalid (for example when the host is undergoing a
- clean shutdown) the host SHOULD send a gratuitous announcement mDNS
- response packet, giving the same resource record name, type, class
- and rdata, but an RR TTL of zero. This has the effect of updating the
- TTL stored in neighbouring hosts' cache entries to zero, causing that
- cache entry to be promptly deleted.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 25]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- Clients receiving a Multicast DNS Response with a TTL of zero SHOULD
- NOT immediately delete the record from the cache, but instead record
- a TTL of 1 and then delete the record one second later. In the case
- of multiple Multicast DNS Responders on the network described in
- Section 13.1 above, if one of the Responders shuts down and
- incorrectly sends goodbye packets for its records, it gives the other
- cooperating Responders one second to send out their own response to
- "rescue" the records before they expire and are deleted.
-
- Generally speaking, it is more important to send goodbye packets for
- shared records than unique records. A given shared record name (such
- as a PTR record used for DNS Service Discovery [DNS-SD]) by its
- nature often has many representatives from many different hosts, and
- tends to be the subject of long-lived ongoing queries. Those
- long-lived queries are often concerned not just about being informed
- when records appear, but also about being informed if those records
- vanish again. In contrast, a unique record set (such as an SRV
- record, or a host address record), by its nature, often has far fewer
- members than a shared record set, and is usually the subject of
- one-shot queries which simply retrieve the data and then cease
- querying once they have the answer they are seeking. Therefore,
- sending a goodbye packet for a unique record set is likely to offer
- less benefit, because it is likely at any given moment that no one
- has an active query running for that record set. One example where
- goodbye packets for SRV and address records are useful is when
- transferring control to a Sleep Proxy Server (see Section 16.
- "Multicast DNS and Power Management").
-
-
-13.3 Announcements to Flush Outdated Cache Entries
-
- Whenever a host has a resource record with potentially new data (e.g.
- after rebooting, waking from sleep, connecting to a new network link,
- changing IP address, etc.), the host MUST send a series of gratuitous
- announcements to update cache entries in its neighbour hosts. In
- these gratuitous announcements, if the record is one that is intended
- to be unique, the host sets the most significant bit of the rrclass
- field of the resource record. This bit, the "cache flush" bit, tells
- neighbouring hosts that this is not a shared record type. Instead of
- merging this new record additively into the cache in addition to any
- previous records with the same name, type and class, all old records
- with that name, type and class that were received more than one
- second ago are declared invalid, and marked to expire from the cache
- in one second.
-
- The semantics of the cache flush bit are as follows: Normally when a
- resource record appears in the answer section of the DNS Response, it
- means, "This is an assertion that this information is true." When a
- resource record appears in the answer section of the DNS Response
- with the "cache flush" bit set, it means, "This is an assertion that
- this information is the truth and the whole truth, and anything you
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 26]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- may have heard more than a second ago regarding records of this
- name/type/class is no longer valid".
-
- To accommodate the case where the set of records from one host
- constituting a single unique RRSet is too large to fit in a single
- packet, only cache records that are more than one second old are
- flushed. This allows the announcing host to generate a quick burst of
- packets back-to-back on the wire containing all the members
- of the RRSet. When receiving records with the "cache flush" bit set,
- all records older than one second are marked to be deleted one second
- in the future. One second after the end of the little packet burst,
- any records not represented within that packet burst will then be
- expired from all peer caches.
-
- Any time a host sends a response packet containing some members of a
- unique RRSet, it SHOULD send the entire RRSet, preferably in a single
- packet, or if the entire RRSet will not fit in a single packet, in a
- quick burst of packets sent as close together as possible. The host
- SHOULD set the cache flush bit on all members of the unique RRSet.
- In the event that for some reason the host chooses not to send the
- entire unique RRSet in a single packet or a rapid packet burst,
- it MUST NOT set the cache flush bit on any of those records.
-
- The reason for waiting one second before deleting stale records from
- the cache is to accommodate bridged networks. For example, a host's
- address record announcement on a wireless interface may be bridged
- onto a wired Ethernet, and cause that same host's Ethernet address
- records to be flushed from peer caches. The one-second delay gives
- the host the chance to see its own announcement arrive on the wired
- Ethernet, and immediately re-announce its Ethernet address records
- so that both sets remain valid and live in peer caches.
-
- These rules apply regardless of *why* the response packet is being
- generated. They apply to startup announcements as described in
- Section 9.3, and to responses generated as a result of receiving
- query packets.
-
- The "cache flush" bit is only set in Multicast DNS responses sent to
- UDP port 5353. The "cache flush" bit MUST NOT be set in any resource
- records in a response packet sent in legacy unicast responses to UDP
- ports other than 5353.
-
- The "cache flush" bit MUST NOT be set in any resource records in the
- known-answer list of any query packet.
-
- The "cache flush" bit MUST NOT ever be set in any shared resource
- record. To do so would cause all the other shared versions of this
- resource record with different rdata from different Responders to be
- immediately deleted from all the caches on the network.
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 27]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- Note that the "cache flush" bit is NOT part of the resource record
- class. The "cache flush" bit is the most significant bit of the
- second 16-bit word of a resource record in an mDNS packet (the field
- conventionally referred to as the rrclass field), and the actual
- resource record class is the least-significant fifteen bits of this
- field. There is no mDNS resource record class 0x8001. The value
- 0x8001 in the rrclass field of a resource record in an mDNS response
- packet indicates a resource record with class 1, with the "cache
- flush" bit set. When receiving a resource record with the "cache
- flush" bit set, implementations should take care to mask off that bit
- before storing the resource record in memory.
-
-
-13.4 Cache Flush on Topology change
-
- If the hardware on a given host is able to indicate physical changes
- of connectivity, then when the hardware indicates such a change, the
- host should take this information into account in its mDNS cache
- management strategy. For example, a host may choose to immediately
- flush all cache records received on a particular interface when that
- cable is disconnected. Alternatively, a host may choose to adjust the
- remaining TTL on all those records to a few seconds so that if the
- cable is not reconnected quickly, those records will expire from the
- cache.
-
- Likewise, when a host reboots, or wakes from sleep, or undergoes some
- other similar discontinuous state change, the cache management
- strategy should take that information into account.
-
-
-13.5 Cache Flush on Failure Indication
-
- Sometimes a cache record can be determined to be stale when a client
- attempts to use the rdata it contains, and finds that rdata to be
- incorrect.
-
- For example, the rdata in an address record can be determined to be
- incorrect if attempts to contact that host fail, either because
- ARP/ND requests for that address go unanswered (for an address on a
- local subnet) or because a router returns an ICMP "Host Unreachable"
- error (for an address on a remote subnet).
-
- The rdata in an SRV record can be determined to be incorrect if
- attempts to communicate with the indicated service at the host and
- port number indicated are not successful.
-
- The rdata in a DNS-SD PTR record can be determined to be incorrect if
- attempts to look up the SRV record it references are not successful.
-
- In any such case, the software implementing the mDNS resource record
- cache should provide a mechanism so that clients detecting stale
- rdata can inform the cache.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 28]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- When the cache receives this hint that it should reconfirm some
- record, it MUST issue two or more queries for the resource record in
- question. If no response is received in a reasonable amount of time,
- then, even though its TTL may indicate that it is not yet due to
- expire, that record SHOULD be promptly flushed from the cache.
-
- The end result of this is that if a printer suffers a sudden power
- failure or other abrupt disconnection from the network, its name may
- continue to appear in DNS-SD browser lists displayed on users'
- screens. Eventually that entry will expire from the cache naturally,
- but if a user tries to access the printer before that happens, the
- failure to successfully contact the printer will trigger the more
- hasty demise of its cache entries. This is a sensible trade-off
- between good user-experience and good network efficiency. If we were
- to insist that printers should disappear from the printer list within
- 30 seconds of becoming unavailable, for all failure modes, the only
- way to achieve this would be for the client to poll the printer at
- least every 30 seconds, or for the printer to announce its presence
- at least every 30 seconds, both of which would be an unreasonable
- burden on most networks.
-
-
-13.6 Passive Observation of Failures
-
- A host observes the multicast queries issued by the other hosts on
- the network. One of the major benefits of also sending responses
- using multicast is that it allows all hosts to see the responses (or
- lack thereof) to those queries.
-
- If a host sees queries, for which a record in its cache would be
- expected to be given as an answer in a multicast response, but no
- such answer is seen, then the host may take this as an indication
- that the record may no longer be valid.
-
- After seeing two or more of these queries, and seeing no multicast
- response containing the expected answer within a reasonable amount of
- time, then even though its TTL may indicate that it is not yet due to
- expire, that record MAY be flushed from the cache. The host SHOULD
- NOT perform its own queries to re-confirm that the record is truly
- gone. If every host on a large network were to do this, it would
- cause a lot of unnecessary multicast traffic. If host A sends
- multicast queries that remain unanswered, then there is no reason to
- suppose that host B or any other host is likely to be any more
- successful.
-
- The previous section, "Cache Flush on Failure Indication", describes
- a situation where a user trying to print discovers that the printer
- is no longer available. By implementing the passive observation
- described here, when one user fails to contact the printer, all hosts
- on the network observe that failure and update their caches
- accordingly.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 29]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-14. Enabling and Disabling Multicast DNS
-
- The option to fail-over to Multicast DNS for names not ending in
- ".local." SHOULD be a user-configured option, and SHOULD
- be disabled by default because of the possible security issues
- related to unintended local resolution of apparently global names.
-
- The option to lookup unqualified (relative) names by appending
- ".local." (or not) is controlled by whether ".local." appears
- (or not) in the client's DNS search list.
-
- No special control is needed for enabling and disabling Multicast DNS
- for names explicitly ending with ".local." as entered by the user.
- The user doesn't need a way to disable Multicast DNS for names ending
- with ".local.", because if the user doesn't want to use Multicast
- DNS, they can achieve this by simply not using those names. If a user
- *does* enter a name ending in ".local.", then we can safely assume
- the user's intention was probably that it should work. Having user
- configuration options that can be (intentionally or unintentionally)
- set so that local names don't work is just one more way of
- frustrating the user's ability to perform the tasks they want,
- perpetuating the view that, "IP networking is too complicated to
- configure and too hard to use." This in turn perpetuates the
- continued use of protocols like AppleTalk. If we want to retire
- AppleTalk, NetBIOS, etc., we need to offer users equivalent IP
- functionality that they can rely on to, "always work, like
- AppleTalk." A little Multicast DNS traffic may be a burden on the
- network, but it is an insignificant burden compared to continued
- widespread use of AppleTalk.
-
-
-15. Considerations for Multiple Interfaces
-
- A host should defend its host name (FQDN) on all active interfaces on
- which it is answering Multicast DNS queries.
-
- In the event of a name conflict on *any* interface, a host should
- configure a new host name, if it wishes to maintain uniqueness of its
- host name.
-
- When answering a Multicast DNS query, a multi-homed host with a
- link-local address (or addresses) should take care to ensure that
- any address going out in a Multicast DNS response is valid for use
- on the interface on which the response is going out.
-
- Just as the same link-local IP address may validly be in use
- simultaneously on different links by different hosts, the same
- link-local host name may validly be in use simultaneously on
- different links, and this is not an error. A multi-homed host with
- connections to two different links may be able to communicate with
- two different hosts that are validly using the same name. While this
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 30]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- kind of name duplication should be rare, it means that a host that
- wants to fully support this case needs network programming APIs that
- allow applications to specify on what interface to perform a
- link-local Multicast DNS query, and to discover on what interface a
- Multicast DNS response was received.
-
-
-16. Multicast DNS and Power Management
-
- Many modern network devices have the ability to go into a low-power
- mode where only a small part of the Ethernet hardware remains
- powered, and the device can be woken up by sending a specially
- formatted Ethernet frame which the device's power-management hardware
- recognizes.
-
- To make use of this in conjunction with Multicast DNS, the device
- first uses DNS-SD to determine if Sleep Proxy Service is available on
- the local network. In some networks there may be more than one piece
- of hardware implementing Sleep Proxy Service, for fault-tolerance
- reasons.
-
- If the device finds the network has Sleep Proxy Service, the device
- transmits two or more gratuitous mDNS announcements setting the TTL
- of its relevant resource records to zero, to delete them from
- neighbouring caches. The relevant resource records include address
- records and SRV records, and other resource records as may apply to a
- particular device. The device then communicates all of its remaining
- active records, plus the names, types and classes of the deleted
- records, to the Sleep Proxy Service(s), along with a copy of the
- specific "magic packet" required to wake the device up.
-
- When a Sleep Proxy Service sees an mDNS query for one of the
- device's active records (e.g. a DNS-SD PTR record), it answers on
- behalf of the device without waking it up. When a Sleep Proxy Service
- sees an mDNS query for one of the device's deleted resource
- records, it deduces that some client on the network needs to make an
- active connection to the device, and sends the specified "magic
- packet" to wake the device up. The device then wakes up, reactivates
- its deleted resource records, and re-announces them to the network.
- The client waiting to connect sees the announcements, learns the
- current IP address and port number of the desired service on the
- device, and proceeds to connect to it.
-
- The connecting client does not need to be aware of how Sleep Proxy
- Service works. Only devices that implement low power mode and wish to
- make use of Sleep Proxy Service need to be aware of how that protocol
- works.
-
- The reason that a device using a Sleep Proxy Service should send more
- than one goodbye packet is that the wakeup message is caused by the
- Sleep Proxy Service seeing queries for the device's SRV and/or
- address records, and those queries are in turn caused by the records
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 31]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- being absent from peer caches. If the records are not deleted from
- peer caches, then those peers may use the cached value directly
- without querying, and no wakeup message would be generated.
-
- The full specification of mDNS / DNS-SD Sleep Proxy Service
- is described in another document [not yet published].
-
-
-17. Multicast DNS Character Set
-
- Unicast DNS has been plagued by the lack of any support for non-US
- characters. Indeed, conventional DNS is usually limited to just
- letters, digits and hyphens, with no spaces or other punctuation.
- Attempts to remedy this have made slow progress because of the need
- to accommodate old buggy legacy implementations.
-
- Multicast DNS is a new protocol and doesn't (yet) have old buggy
- legacy implementations to constrain the design choices. Accordingly,
- it adopts the obvious simple solution: all names in Multicast DNS are
- encoded using UTF-8 [RFC 2279]. For names that are restricted to
- letters, digits and hyphens, the UTF-8 encoding is identical to the
- US-ASCII encoding, so this is entirely compatible with existing host
- names. For characters outside the US-ASCII range, UTF-8 encoding is
- used.
-
- Multicast DNS implementations MUST NOT use any other encodings apart
- from UTF-8 (US-ASCII being considered a compatible subset of UTF-8).
-
- This point bears repeating: There are various baroque representations
- of international text being proposed for Unicast DNS. None of these
- representations may be used in Multicast DNS packets. Any text being
- represented internally in some other representation MUST be converted
- to canonical UTF-8 before being placed in any Multicast DNS packet.
-
- The simple rules for case-insensitivity in Unicast DNS also apply in
- Multicast DNS; that is to say, in name comparisons, the lower-case
- letters "a" to "z" match their upper-case equivalents "A" to "Z".
- Hence, if a client issues a query for an address record with the name
- "stuartcheshire.local", then a responder having an address record
- with the name "StuartCheshire.local" should issue a response.
-
- No other automatic character equivalence is defined in Multicast DNS.
- For example, accented characters are not defined to be automatically
- equivalent to their unaccented counterparts. Where automatic
- equivalences are desired, this may be achieved through the use of
- programmatically-generated CNAME records. For example, if a responder
- has an address record for an accented name Y, and a client issues a
- query for a name X, where X is the same as Y with all the accents
- removed, then the responder may issue a response containing two
- resource records: A CNAME record "X CNAME Y", asserting that the
- requested name X (unaccented) is an alias for the true (accented)
- name Y, followed by the address record for Y.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 32]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-18. Multicast DNS Message Size
-
- RFC 1035 restricts DNS Messages carried by UDP to no more than 512
- bytes (not counting the IP or UDP headers). For UDP packets carried
- over the wide-area Internet in 1987, this was appropriate. For
- link-local multicast packets on today's networks, there is no reason
- to retain this restriction. Given that the packets are by definition
- link-local, there are no Path MTU issues to consider.
-
- Multicast DNS Messages carried by UDP may be up to the IP MTU of the
- physical interface, less the space required for the IP header (20
- bytes for IPv4; 40 bytes for IPv6) and the UDP header (8 bytes).
-
- In the case of a single mDNS Resource Record which is too large to
- fit in a single MTU-sized multicast response packet, a Multicast DNS
- Responder SHOULD send the Resource Record alone, in a single IP
- datagram, sent using multiple IP fragments. Resource Records this
- large SHOULD be avoided, except in the very rare cases where they
- really are the appropriate solution to the problem at hand.
- Implementers should be aware that many simple devices do not
- re-assemble fragmented IP datagrams, so large Resource Records SHOULD
- only be used in specialized cases where the implementer knows that
- all receivers implement reassembly.
-
- A Multicast DNS packet larger than the interface MTU, which is sent
- using fragments, MUST NOT contain more than one Resource Record.
-
- Even when fragmentation is used, a Multicast DNS packet, including IP
- and UDP headers, MUST NOT exceed 9000 bytes.
-
-
-19. Multicast DNS Message Format
-
- This section describes specific restrictions on the allowable
- values for the header fields of a Multicast DNS message.
-
-19.1. ID (Query Identifier)
-
- Multicast DNS clients SHOULD listen for gratuitous responses
- issued by hosts booting up (or waking up from sleep or otherwise
- joining the network). Since these gratuitous responses may contain a
- useful answer to a question for which the client is currently
- awaiting an answer, Multicast DNS clients SHOULD examine all received
- Multicast DNS response messages for useful answers, without regard to
- the contents of the ID field or the question section. In Multicast
- DNS, knowing which particular query message (if any) is responsible
- for eliciting a particular response message is less interesting than
- knowing whether the response message contains useful information.
-
- Multicast DNS clients MAY cache any or all Multicast DNS response
- messages they receive, for possible future use, providing of course
- that normal TTL aging is performed on these cashed resource records.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 33]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
- In multicast query messages, the Query ID SHOULD be set to zero on
- transmission.
-
- In multicast responses, including gratuitous multicast responses, the
- Query ID MUST be set to zero on transmission, and MUST be ignored on
- reception.
-
- In unicast response messages generated specifically in response to a
- particular (unicast or multicast) query, the Query ID MUST match the
- ID from the query message.
-
-
-19.2. QR (Query/Response) Bit
-
- In query messages, MUST be zero.
-
- In response messages, MUST be one.
-
-
-19.3. OPCODE
-
- In both multicast query and multicast response messages, MUST be zero
- (only standard queries are currently supported over multicast, unless
- other queries are allowed by future IETF Standards Action).
-
-
-19.4. AA (Authoritative Answer) Bit
-
- In query messages, the Authoritative Answer bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages for Multicast Domains, the Authoritative Answer
- bit MUST be set to one (not setting this bit implies there's some
- other place where "better" information may be found) and MUST be
- ignored on reception.
-
-
-19.5. TC (Truncated) Bit
-
- In query messages, if the TC bit is set, it means that additional
- Known Answer records may be following shortly. A responder MAY choose
- to record this fact, and wait for those additional Known Answer
- records, before deciding whether to respond. If the TC bit is clear,
- it means that the querying host has no additional Known Answers.
-
- In multicast response messages, the TC bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In legacy unicast response messages, the TC bit has the same meaning
- as in conventional unicast DNS: it means that the response was too
- large to fit in a single packet, so the client SHOULD re-issue its
- query using TCP in order to receive the larger response.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 34]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-19.6. RD (Recursion Desired) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Desired bit SHOULD be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.7. RA (Recursion Available) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Available bit MUST be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.8. Z (Zero) Bit
-
- In both query and response messages, the Zero bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.9. AD (Authentic Data) Bit [RFC 2535]
-
- In query messages the Authentic Data bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages, the Authentic Data bit MAY be set. Resolvers
- receiving response messages with the AD bit set MUST NOT trust the AD
- bit unless they trust the source of the message and either have a
- secure path to it or use DNS transaction security.
-
-
-19.10. CD (Checking Disabled) Bit [RFC 2535]
-
- In query messages, a resolver willing to do cryptography SHOULD set
- the Checking Disabled bit to permit it to impose its own policies.
-
- In response messages, the Checking Disabled bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.11. RCODE (Response Code)
-
- In both multicast query and multicast response messages, the Response
- Code MUST be zero on transmission. Multicast DNS messages received
- with non-zero Response Codes MUST be silently ignored.
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 35]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-20. Choice of UDP Port Number
-
- Arguments were made for and against using Multicast on UDP port 53.
- The final decision was to use UDP port 5353. Some of the arguments
- for and against are given below.
-
-
-20.1 Arguments for using UDP port 53:
-
- * This is "just DNS", so it should be the same port.
-
- * There is less work to be done updating old clients to do simple
- mDNS queries. Only the destination address need be changed.
- In some cases, this can be achieved without any code changes,
- just by adding the address 224.0.0.251 to a configuration file.
-
-
-20.2 Arguments for using a different port (UDP port 5353):
-
- * This is not "just DNS". This is a DNS-like protocol, but different.
-
- * Changing client code to use a different port number is not hard.
-
- * Using the same port number makes it hard to run an mDNS Responder
- and a conventional unicast DNS server on the same machine. If a
- conventional unicast DNS server wishes to implement mDNS as well,
- it can still do that, by opening two sockets. Having two different
- port numbers is important to allow this flexibility.
-
- * Some VPN software hijacks all outgoing traffic to port 53 and
- redirects it to a special DNS server set up to serve those VPN
- clients while they are connected to the corporate network. It is
- questionable whether this is the right thing to do, but it is
- common, and redirecting link-local multicast DNS packets to a
- remote server rarely produces any useful results. It does mean, for
- example, that the user becomes unable to access their local network
- printer sitting on their desk right next to their computer. Using
- a different UDP port eliminates this particular problem.
-
- * On many operating systems, unprivileged clients may not send or
- receive packets on low-numbered ports. This means that any client
- sending or receiving mDNS packets on port 53 would have to run as
- "root", which is an undesirable security risk. Using a higher-
- numbered UDP port eliminates this particular problem.
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 36]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-21. Summary of Differences Between Multicast DNS and Unicast DNS
-
- The value of Multicast DNS is that it shares, as much as possible,
- the familiar APIs, naming syntax, resource record types, etc., of
- Unicast DNS. There are of course necessary differences by virtue of
- it using Multicast, and by virtue of it operating in a community of
- cooperating peers, rather than a precisely defined authoritarian
- hierarchy controlled by a strict chain of formal delegations from the
- top. These differences are listed below:
-
- Multicast DNS...
- * uses multicast
- * uses UDP port 5353 instead of port 53
- * operates in well-defined parts of the DNS namespace
- * uses UTF-8, and only UTF-8, to encode resource record names
- * defines a clear limit on the maximum legal domain name (255 bytes)
- * allows larger UDP packets
- * allows more than one question in a query packet
- * uses the Answer Section of a query to list Known Answers
- * uses the TC bit in a query to indicate additional Known Answers
- * uses the Authority Section of a query for probe tie-breaking
- * ignores the Query ID field (except for generating legacy responses)
- * doesn't require the question to be repeated in the response packet
- * uses gratuitous responses to announce new records to the peer group
- * defines a "unicast response" bit in the rrclass of query questions
- * defines a "cache flush" bit in the rrclass of responses
- * uses DNS TTL 0 to indicate that a record has been deleted
- * uses IP TTL 255 to verify that answers originated on the local link
- * monitors queries to perform Duplicate Question Suppression
- * monitors responses to perform Duplicate Answer Suppression...
- * ... and Ongoing Conflict Detection
- * ... and Opportunistic Caching
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 37]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-22. Benefits of Multicast Responses
-
- Some people have argued that sending responses via multicast is
- inefficient on the network. In fact the benefits of using multicast
- responses result in a net lowering of overall multicast traffic, for
- a variety of reasons.
-
- * One multicast response can update the cache on all machines on the
- network. If another machine later wants to issue the same query, it
- already has the answer in its cache, so it may not need to even
- transmit that multicast query on the network at all.
-
- * When more than one machine has the same ongoing long-lived query
- running, every machine does not have to transmit its own
- independent query. When one machine transmits a query, all the
- other hosts see the answers, so they can suppress their own
- queries.
-
- * When a host sees a multicast query, but does not see the
- corresponding multicast response, it can use this information to
- promptly delete stale data from its cache. To achieve the same
- level of user-interface quality and responsiveness without
- multicast responses would require lower cache lifetimes and more
- frequent network polling, resulting in a significantly higher
- packet rate.
-
- * Multicast responses allow passive conflict detection. Without this
- ability, some other conflict detection mechanism would be needed,
- imposing its own additional burden on the network.
-
- * When using delayed responses to reduce network collisions, clients
- need to maintain a list recording to whom each answer should be
- sent. The option of multicast responses allows clients with limited
- storage, which cannot store an arbitrarily long list of response
- addresses, to choose to fail-over to a single multicast response in
- place of multiple unicast respones, when appropriate.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 38]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-23. IPv6 Considerations
-
- An IPv4-only host and an IPv6-only host behave as "ships that pass in
- the night". Even if they are on the same Ethernet, neither is aware
- of the other's traffic. For this reason, each physical link may have
- *two* unrelated ".local." zones, one for IPv4 and one for IPv6.
- Since for practical purposes, a group of IPv4-only hosts and a group
- of IPv6-only hosts on the same Ethernet act as if they were on two
- entirely separate Ethernet segments, it is unsurprising that their
- use of the ".local." zone should occur exactly as it would if
- they really were on two entirely separate Ethernet segments.
-
- A dual-stack (v4/v6) host can participate in both ".local."
- zones, and should register its name(s) and perform its lookups both
- using IPv4 and IPv6. This enables it to reach, and be reached by,
- both IPv4-only and IPv6-only hosts. In effect this acts like a
- multi-homed host, with one connection to the logical "IPv4 Ethernet
- segment", and a connection to the logical "IPv6 Ethernet segment".
-
-23.1 IPv6 Multicast Addresses by Hashing
-
- Some discovery protocols use a range of multicast addresses, and
- determine the address to be used by a hash function of the name being
- sought. Queries are sent via multicast to the address as indicated by
- the hash function, and responses are returned to the querier via
- unicast. Particularly in IPv6, where multicast addresses are
- extremely plentiful, this approach is frequently advocated.
-
- There are some problems with this:
-
- * When a host has a large number of records with different names, the
- host may have to join a large number of multicast groups. This can
- place undue burden on the Ethernet hardware, which typically
- supports a limited number of multicast addresses efficiently. When
- this number is exceeded, the Ethernet hardware may have to resort
- to receiving all multicasts and passing them up to the host
- software for filtering, thereby defeating the point of using a
- multicast address range in the first place.
-
- * Multiple questions cannot be placed in one packet if they don't all
- hash to the same multicast address.
-
- * Duplicate Question Suppression doesn't work if queriers are not
- seeing each other's queries.
-
- * Duplicate Answer Suppression doesn't work if responders are not
- seeing each other's responses.
-
- * Opportunistic Caching doesn't work.
-
- * Ongoing Conflict Detection doesn't work.
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 39]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-24. Security Considerations
-
- The algorithm for detecting and resolving name conflicts is, by its
- very nature, an algorithm that assumes cooperating participants. Its
- purpose is to allow a group of hosts to arrive at a mutually disjoint
- set of host names and other DNS resource record names, in the absence
- of any central authority to coordinate this or mediate disputes. In
- the absence of any higher authority to resolve disputes, the only
- alternative is that the participants must work together cooperatively
- to arrive at a resolution.
-
- In an environment where the participants are mutually antagonistic
- and unwilling to cooperate, other mechanisms are appropriate, like
- manually administered DNS.
-
- In an environment where there is a group of cooperating participants,
- but there may be other antagonistic participants on the same physical
- link, the cooperating participants need to use IPSEC signatures
- and/or DNSSEC [RFC 2535] signatures so that they can distinguish mDNS
- messages from trusted participants (which they process as usual) from
- mDNS messages from untrusted participants (which they silently
- discard).
-
- When DNS queries for *global* DNS names are sent to the mDNS
- multicast address (during network outages which disrupt communication
- with the greater Internet) it is *especially* important to use
- DNSSEC, because the user may have the impression that he or she is
- communicating with some authentic host, when in fact he or she is
- really communicating with some local host that is merely masquerading
- as that name. This is less critical for names ending with ".local.",
- because the user should be aware that those names have only local
- significance and no global authority is implied.
-
- Most computer users neglect to type the trailing dot at the end of a
- fully qualified domain name, making it a relative domain name (e.g.
- "www.example.com"). In the event of network outage, attempts to
- positively resolve the name as entered will fail, resulting in
- application of the search list, including ".local.", if present.
- A malicious host could masquerade as "www.example.com" by answering
- the resulting Multicast DNS query for "www.example.com.local."
- To avoid this, a host MUST NOT append the search suffix
- ".local.", if present, to any relative (partially qualified)
- domain name containing two or more labels. Appending ".local." to
- single-label relative domain names is acceptable, since the user
- should have no expectation that a single-label domain name will
- resolve as-is.
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 40]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-25. IANA Considerations
-
- The IANA has allocated the IPv4 link-local multicast address
- 224.0.0.251 for the use described in this document.
-
- The IANA has allocated the IPv6 multicast address set FF0X::FB
- for the use described in this document.
-
- When this document is published, IANA should designate a list
- of domains which are deemed to have only link-local significance,
- as described in this document.
-
- No other IANA services are required by this document.
-
-
-26. Acknowledgements
-
- The concepts described in this document have been explored and
- developed with help from Erik Guttman, Paul Vixie, Bill Woodcock,
- and others.
-
-
-27. Copyright
-
- Copyright (C) The Internet Society January 2004.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 41]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-28. Normative References
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 2279] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 2279, January 1998.
-
-
-29. Informative References
-
- [dotlocal] <http://www.dotlocal.org/>
-
- [djbdl] <http://cr.yp.to/djbdns/dot-local.html>
-
- [DNS-SD] Cheshire, S., and M. Krochmal, "DNS-Based Service
- Discovery", Internet-Draft (work in progress),
- draft-cheshire-dnsext-dns-sd-02.txt, February 2004.
-
- [IEEE802] IEEE Standards for Local and Metropolitan Area Networks:
- Overview and Architecture.
- Institute of Electrical and Electronic Engineers,
- IEEE Standard 802, 1990.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-03.txt, February 2004.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2462] S. Thomson and T. Narten, "IPv6 Stateless Address
- Autoconfiguration", RFC 2462, December 1998.
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [v4LL] Cheshire, S., B. Aboba, and E. Guttman, "Dynamic
- Configuration of IPv4 Link-Local Addresses",
- Internet-Draft (work in progress),
- draft-ietf-zeroconf-ipv4-linklocal-11.txt, January 2004.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 42]
-
-Internet Draft Multicast DNS 14th February 2004
-
-
-30. Author's Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 14th August 2004 Cheshire & Krochmal [Page 43] \ No newline at end of file
diff --git a/trunk/specs/draft-cheshire-dnsext-multicastdns-05.txt b/trunk/specs/draft-cheshire-dnsext-multicastdns-05.txt
deleted file mode 100644
index 0e2be99..0000000
--- a/trunk/specs/draft-cheshire-dnsext-multicastdns-05.txt
+++ /dev/null
@@ -1,2640 +0,0 @@
-Document: draft-cheshire-dnsext-multicastdns-05.txt Stuart Cheshire
-Category: Standards Track Apple Computer, Inc.
-Expires 7th December 2005 Marc Krochmal
- Apple Computer, Inc.
- 7th June 2005
-
- Multicast DNS
-
- <draft-cheshire-dnsext-multicastdns-05.txt>
-
-
-Status of this Memo
-
- By submitting this Internet-Draft, each author represents
- that any applicable patent or other IPR claims of which he or she is
- aware have been or will be disclosed, and any of which he or she
- become aware will be disclosed, in accordance with RFC 3979.
-
- Internet-Drafts are working documents of the Internet Engineering
- Task Force (IETF), its areas, and its working groups. Note that
- other groups may also distribute working documents as
- Internet-Drafts.
-
- Internet-Drafts are draft documents valid for a maximum of six months
- and may be updated, replaced, or obsoleted by other documents at any
- time. It is inappropriate to use Internet-Drafts as reference
- material or to cite them other than as "work in progress."
-
- The list of current Internet-Drafts can be accessed at
- http://www.ietf.org/ietf/1id-abstracts.txt.
-
- The list of Internet-Draft Shadow Directories can be accessed at
- http://www.ietf.org/shadow.html.
-
-
-Abstract
-
- As networked devices become smaller, more portable, and more
- ubiquitous, the ability to operate with less configured
- infrastructure is increasingly important. In particular, the ability
- to look up DNS resource record data types (including, but not limited
- to, host names) in the absence of a conventional managed DNS server,
- is becoming essential.
-
- Multicast DNS (mDNS) provides the ability to do DNS-like operations
- on the local link in the absence of any conventional unicast DNS
- server. In addition, mDNS designates a portion of the DNS namespace
- to be free for local use, without the need to pay any annual fee, and
- without the need to set up delegations or otherwise configure a
- conventional DNS server to answer for those names.
-
- The primary benefits of mDNS names are that (i) they require little
- or no administration or configuration to set them up, (ii) they work
- when no infrastructure is present, and (iii) they work during
- infrastructure failures.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 1]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-Table of Contents
-
- 1. Introduction...................................................3
- 2. Conventions and Terminology Used in this Document..............4
- 3. Multicast DNS Names............................................5
- 4. Source Address Check...........................................8
- 5. Reverse Address Mapping........................................9
- 6. Querying.......................................................9
- 7. Duplicate Suppression.........................................13
- 8. Responding....................................................15
- 9. Probing and Announcing on Startup.............................18
- 10. Conflict Resolution...........................................22
- 11. Resource Record TTL Values and Cache Coherency................23
- 12. Special Characteristics of Multicast DNS Domains..............28
- 13. Multicast DNS for Service Discovery...........................30
- 14. Enabling and Disabling Multicast DNS..........................30
- 15. Considerations for Multiple Interfaces........................30
- 16. Multicast DNS and Power Management............................31
- 17. Multicast DNS Character Set...................................32
- 18. Multicast DNS Message Size....................................34
- 19. Multicast DNS Message Format..................................34
- 20. Choice of UDP Port Number.....................................37
- 21. Summary of Differences Between Multicast DNS and Unicast DNS..38
- 22. Benefits of Multicast Responses...............................38
- 23. IPv6 Considerations...........................................39
- 24. Security Considerations.......................................40
- 25. IANA Considerations...........................................41
- 26. Acknowledgments...............................................42
- 27. Copyright.....................................................42
- 28. Normative References..........................................42
- 29. Informative References........................................43
- 30. Authors' Addresses............................................44
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 2]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-1. Introduction
-
- When reading this document, familiarity with the concepts of Zero
- Configuration Networking [ZC] and automatic link-local addressing
- [RFC 2462] [RFC 3927] is helpful.
-
- This document proposes no change to the structure of DNS messages,
- and no new operation codes, response codes, or resource record types.
- This document simply discusses what needs to happen if DNS clients
- start sending DNS queries to a multicast address, and how a
- collection of hosts can cooperate to collectively answer those
- queries in a useful manner.
-
- There has been discussion of how much burden Multicast DNS might
- impose on a network. It should be remembered that whenever IPv4 hosts
- communicate, they broadcast ARP packets on the network on a regular
- basis, and this is not disastrous. The approximate amount of
- multicast traffic generated by hosts making conventional use of
- Multicast DNS is anticipated to be roughly the same order of
- magnitude as the amount of broadcast ARP traffic those hosts already
- generate.
-
- New applications making new use of Multicast DNS capabilities for
- unconventional purposes may generate more traffic. If some of those
- new applications are "chatty", then work will be needed to help them
- become less chatty. When performing any analysis, it is important to
- make a distinction between the application behavior and the
- underlying protocol behavior. If a chatty application uses UDP, that
- doesn't mean that UDP is chatty, or that IP is chatty, or that
- Ethernet is chatty. What it means is that the application is chatty.
- The same applies to any future applications that may decide to layer
- increasing portions of their functionality over Multicast DNS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 3]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-2. Conventions and Terminology Used in this Document
-
- The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
- "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
- document are to be interpreted as described in "Key words for use in
- RFCs to Indicate Requirement Levels" [RFC 2119].
-
- This document uses the term "host name" in the strict sense to mean a
- fully qualified domain name that has an address record. It does not
- use the term "host name" in the commonly used but incorrect sense to
- mean just the first DNS label of a host's fully qualified domain
- name.
-
- A DNS (or mDNS) packet contains an IP TTL in the IP header, which
- is effectively a hop-count limit for the packet, to guard against
- routing loops. Each Resource Record also contains a TTL, which is
- the number of seconds for which the Resource Record may be cached.
-
- In any place where there may be potential confusion between these two
- types of TTL, the term "IP TTL" is used to refer to the IP header TTL
- (hop limit), and the term "RR TTL" is used to refer to the Resource
- Record TTL (cache lifetime).
-
- When this document uses the term "Multicast DNS", it should be taken
- to mean: "Clients performing DNS-like queries for DNS-like resource
- records by sending DNS-like UDP query and response packets over IP
- Multicast to UDP port 5353."
-
- This document uses the terms "shared" and "unique" when referring to
- resource record sets.
-
- A "shared" resource record set is one where several Multicast DNS
- responders may have records with that name, rrtype, and rrclass, and
- several responders may respond to a particular query.
-
- A "unique" resource record set is one where all the records with that
- name, rrtype, and rrclass are under the control or ownership of a
- single responder, and at most one responder should respond to any
- given query. Before claiming ownership of a unique resource record
- set, a responder MUST probe to verify that no other responder
- already claims ownership of that set, as described in Section 9.1
- "Probing".
-
- Strictly speaking the terms "shared" and "unique" apply to resource
- record sets, not to individual resource records, but it is sometimes
- convenient to talk of "shared resource records" and "unique resource
- records". When used this way, the terms should be understood to mean
- a record that is a member of a "shared" or "unique" resource record
- set, respectively.
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 4]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-3. Multicast DNS Names
-
- This document proposes that the DNS top-level domain ".local." be
- designated a special domain with special semantics, namely that any
- fully-qualified name ending in ".local." is link-local, and names
- within this domain are meaningful only on the link where they
- originate. This is analogous to IPv4 addresses in the 169.254/16
- prefix, which are link-local and meaningful only on the link where
- they originate.
-
- Any DNS query for a name ending with ".local." MUST be sent
- to the mDNS multicast address (224.0.0.251 or its IPv6 equivalent
- FF02::FB).
-
- It is unimportant whether a name ending with ".local." occurred
- because the user explicitly typed in a fully qualified domain name
- ending in ".local.", or because the user entered an unqualified
- domain name and the host software appended the suffix ".local."
- because that suffix appears in the user's search list. The ".local."
- suffix could appear in the search list because the user manually
- configured it, or because it was received in a DHCP option, or via
- any other valid mechanism for configuring the DNS search list. In
- this respect the ".local." suffix is treated no differently to any
- other search domain that might appear in the DNS search list.
-
- DNS queries for names that do not end with ".local." MAY be sent to
- the mDNS multicast address, if no other conventional DNS server is
- available. This can allow hosts on the same link to continue
- communicating using each other's globally unique DNS names during
- network outages which disrupt communication with the greater
- Internet. When resolving global names via local multicast, it is even
- more important to use DNSSEC or other security mechanisms to ensure
- that the response is trustworthy. Resolving global names via local
- multicast is a contentious issue, and this document does not discuss
- it in detail, instead concentrating on the issue of resolving local
- names using DNS packets sent to a multicast address.
-
- A host which belongs to an organization or individual who has control
- over some portion of the DNS namespace can be assigned a globally
- unique name within that portion of the DNS namespace, for example,
- "cheshire.apple.com." For those of us who have this luxury, this
- works very well. However, the majority of home customers do not have
- easy access to any portion of the global DNS namespace within which
- they have the authority to create names as they wish. This leaves the
- majority of home computers effectively anonymous for practical
- purposes.
-
- To remedy this problem, this document allows any computer user to
- elect to give their computers link-local Multicast DNS host names of
- the form: "single-dns-label.local." For example, a laptop computer
- may answer to the name "cheshire.local." Any computer user is granted
- the authority to name their computer this way, provided that the
- chosen host name is not already in use on that link. Having named
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 5]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- their computer this way, the user has the authority to continue using
- that name until such time as a name conflict occurs on the link which
- is not resolved in the user's favour. If this happens, the computer
- (or its human user) SHOULD cease using the name, and may choose to
- attempt to allocate a new unique name for use on that link. These
- conflicts are expected to be relatively rare for people who choose
- reasonably imaginative names, but it is still important to have a
- mechanism in place to handle them when they happen.
-
- The point made in the previous paragraph is very important and bears
- repeating. It is easy for those of us in the IETF community who run
- our own name servers at home to forget that the majority of computer
- users do not run their own name server and have no easy way to create
- their own host names. When these users wish to transfer files between
- two laptop computers, they are frequently reduced to typing in
- dotted-decimal IP addresses because they simply have no other way for
- one host to refer to the other by name. This is a sorry state of
- affairs. What is worse, most users don't even bother trying to use
- dotted-decimal IP addresses. Most users still move data between
- machines by copying it onto a floppy disk or similar removable media.
-
- In a world of gigabit Ethernet and ubiquitous wireless networking it
- is a sad indictment of the networking community that the preferred
- communication medium for most computer users is still the floppy
- disk.
-
- Allowing ad-hoc allocation of single-label names in a single flat
- ".local." namespace may seem to invite chaos. However, operational
- experience with AppleTalk NBP names [NBP], which on any given link
- are also effectively single-label names in a flat namespace, shows
- that in practice name collisions happen extremely rarely and are not
- a problem. Groups of computer users from disparate organizations
- bring Macintosh laptop computers to events such as IETF Meetings, the
- Mac Hack conference, the Apple World Wide Developer Conference, etc.,
- and complaints at these events about users suffering conflicts and
- being forced to rename their machines have never been an issue.
-
- Enforcing uniqueness of host names (i.e. the names of DNS address
- records mapping names to IP addresses) is probably desirable in the
- common case, but this document does not mandate that. It is
- permissible for a collection of coordinated hosts to agree to
- maintain multiple DNS address records with the same name, possibly
- for load balancing or fault-tolerance reasons. This document does not
- take a position on whether that is sensible. It is important that
- both modes of operation are supported. The Multicast DNS protocol
- allows hosts to verify and maintain unique names for resource records
- where that behavior is desired, and it also allows hosts to maintain
- multiple resource records with a single shared name where that
- behavior is desired. This consideration applies to all resource
- records, not just address records (host names). In summary: It is
- required that the protocol have the ability to detect and handle name
- conflicts, but it is not required that this ability be used for every
- record.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 6]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-3.1 Governing Standards Body
-
- Note that this use of the ".local." suffix falls under IETF
- jurisdiction, not ICANN jurisdiction. DNS is an IETF network
- protocol, governed by protocol rules defined by the IETF. These IETF
- protocol rules dictate character set, maximum name length, packet
- format, etc. ICANN determines additional rules that apply when the
- IETF's DNS protocol is used on the public Internet. In contrast,
- private uses of the DNS protocol on isolated private networks are not
- governed by ICANN. Since this proposed change is a change to the core
- DNS protocol rules, it affects everyone, not just those machines
- using the ICANN-governed Internet. Hence this change falls into the
- category of an IETF protocol rule, not an ICANN usage rule.
-
-3.2 Private DNS Namespaces
-
- Note also that the special treatment of names ending in ".local." has
- been implemented in Macintosh computers since the days of Mac OS 9,
- and continues today in Mac OS X. There are also implementations for
- Linux and other platforms [dotlocal]. Operators setting up private
- internal networks ("intranets") are advised that their lives may be
- easier if they avoid using the suffix ".local." in names in their
- private internal DNS server. Alternative possibilities include:
-
- .intranet
- .internal
- .private
- .corp
- .home
-
- Another alternative naming scheme, advocated by Professor D. J.
- Bernstein, is to use a numerical suffix, such as ".6." [djbdl].
-
-3.3 Maximum Multicast DNS Name Length
-
- RFC 1034 says:
-
- "the total number of octets that represent a domain name (i.e.,
- the sum of all label octets and label lengths) is limited to 255."
-
- This text implies that the final root label at the end of every name
- is included in this count (a name can't be represented without it),
- but the text does not explicitly state that. Implementations of
- Multicast DNS MUST include the label length byte of the final root
- label at the end of every name when enforcing the rule that no name
- may be longer than 255 bytes. For example, the length of the name
- "apple.com." is considered to be 11, which is the number of bytes it
- takes to represent that name in a packet without using name
- compression:
-
- ------------------------------------------------------
- | 0x05 | a | p | p | l | e | 0x03 | c | o | m | 0x00 |
- ------------------------------------------------------
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 7]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-4. Source Address Check
-
- All Multicast DNS responses (including responses sent via unicast)
- SHOULD be sent with IP TTL set to 255. This is recommended to provide
- backwards-compatibility with older Multicast DNS clients that check
- the IP TTL on reception to determine whether the packet originated
- on the local link. These older clients discard all packets with TTLs
- other than 255.
-
- A host sending Multicast DNS queries to a link-local destination
- address (including the 224.0.0.251 link-local multicast address)
- MUST only accept responses to that query that originate from the
- local link, and silently discard any other response packets. Without
- this check, it could be possible for remote rogue hosts to send
- spoof answer packets (perhaps unicast to the victim host) which the
- receiving machine could misinterpret as having originated on the
- local link.
-
- The test for whether a response originated on the local link
- is done in two ways:
-
- * All responses sent to the link-local multicast address 224.0.0.251
- are necessarily deemed to have originated on the local link,
- regardless of source IP address. This is essential to allow devices
- to work correctly and reliably in unusual configurations, such as
- multiple logical IP subnets overlayed on a single link, or in cases
- of severe misconfiguration, where devices are physically connected
- to the same link, but are currently misconfigured with completely
- unrelated IP addresses and subnet masks.
-
- * For responses sent to a unicast destination address, the source IP
- address in the packet is checked to see if it is an address on a
- local subnet. An address is determined to be on a local subnet if,
- for (one of) the address(es) configured on the interface receiving
- the packet, (I & M) == (P & M), where I and M are the interface
- address and subnet mask respectively, P is the source IP address
- from the packet, '&' represents the bitwise logical 'and'
- operation, and '==' represents a bitwise equality test.
-
- Since queriers will ignore responses apparently originating outside
- the local subnet, responders SHOULD avoid generating responses that
- it can reasonably predict will be ignored. This applies particularly
- in the case of overlayed subnets. If a responder receives a query
- addressed to the link-local multicast address 224.0.0.251, from a
- source address not apparently on the same subnet as the responder,
- then even if the query indicates that a unicast response is preferred
- (see Section 6.5, "Questions Requesting Unicast Responses"), the
- responder SHOULD elect to respond by multicast anyway, since it can
- reasonably predict that a unicast response with an apparently
- non-local source address will probably be ignored.
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 8]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-5. Reverse Address Mapping
-
- Like ".local.", the IPv4 and IPv6 reverse-mapping domains are also
- defined to be link-local.
-
- Any DNS query for a name ending with "254.169.in-addr.arpa." MUST
- be sent to the mDNS multicast address 224.0.0.251. Since names under
- this domain correspond to IPv4 link-local addresses, it is logical
- that the local link is the best place to find information pertaining
- to those names. As an optimization, these queries MAY be first
- unicast directly to the address in question, but if this query is not
- answered, the query MUST also be sent via multicast, to accommodate
- the case where the machine in question is not answering for itself
- (for example, because it is currently sleeping).
-
- Likewise, any DNS query for a name ending with "0.8.e.f.ip6.arpa."
- MUST be sent to the IPv6 mDNS link-local multicast address FF02::FB,
- with or without an optional initial query unicast directly to the
- address in question.
-
-
-6. Querying
-
- There are three kinds of Multicast DNS Queries, one-shot queries of
- the kind made by today's conventional DNS clients, one-shot queries
- accumulating multiple responses made by multicast-aware DNS clients,
- and continuous ongoing Multicast DNS Queries used by IP network
- browser software.
-
- A Multicast DNS Responder that is offering records that are intended
- to be unique on the local link MUST also implement a Multicast DNS
- Querier so that it can first verify the uniqueness of those records
- before it begins answering queries for them.
-
-
-6.1 One-Shot Queries
-
- An unsophisticated DNS client may simply send its DNS queries
- blindly to the 224.0.0.251 multicast address, without necessarily
- even being aware what a multicast address is.
-
- Such an unsophisticated DNS client may not get ideal behavior. Such
- a client may simply take the first response it receives and fail to
- wait to see if there are more, but in many instances this may not be
- a serious problem. If a user types "http://cheshire.local." into
- their Web browser and gets to see the page they were hoping for,
- then the protocol has met the user's needs in this case.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 9]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-6.2 One-Shot Queries, Accumulating Multiple Responses
-
- A more sophisticated DNS client should understand that Multicast DNS
- is not exactly the same as unicast DNS, and should modify its
- behavior in some simple ways.
-
- As described above, there are some cases, such as looking up the
- address associated with a unique host name, where a single response
- is sufficient, and moreover may be all that is expected. However,
- there are other DNS queries where more than one response is
- possible, and for these queries a more sophisticated Multicast DNS
- client should include the ability to wait for an appropriate period
- of time to collect multiple responses.
-
- A naive DNS client retransmits its query only so long as it has
- received no response. A more sophisticated Multicast DNS client is
- aware that having received one response is not necessarily an
- indication that it might not receive others, and has the ability to
- retransmit its query an appropriate number of times at appropriate
- intervals until it is satisfied with the collection of responses it
- has gathered.
-
- A more sophisticated Multicast DNS client that is retransmitting
- a query for which it has already received some responses, MUST
- implement Known Answer Suppression, as described below in Section
- 7.1. This indicates to responders who have already replied that their
- responses have been received, and they don't need to send them again
- in response to this repeated query. In addition, the interval between
- the first two queries SHOULD be one second, and the intervals between
- subsequent queries SHOULD double.
-
-
-6.3 Continuous Querying
-
- In One-Shot Queries, with either a single or multiple responses,
- the underlying assumption is that the transaction begins when the
- application issues a query, and ends when all the desired responses
- have been received. There is another type of operation which is more
- akin to continuous monitoring.
-
- Macintosh users are accustomed to opening the "Chooser" window,
- selecting a desired printer, and then closing the Chooser window.
- However, when the desired printer does not appear in the list, the
- user will typically leave the "Chooser" window open while they go and
- check to verify that the printer is plugged in, powered on, connected
- to the Ethernet, etc. While the user jiggles the wires, hits the
- Ethernet hub, and so forth, they keep an eye on the Chooser window,
- and when the printer name appears, they know they have fixed whatever
- the problem was. This can be a useful and intuitive troubleshooting
- technique, but a user who goes home for the weekend leaving the
- Chooser window open places a non-trivial burden on the network.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 10]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- With continuous querying, multiple queries are sent over a long
- period of time, until the user terminates the operation. It is
- important that an IP network browser window displaying live
- information from the network using Multicast DNS, if left running
- for an extended period of time, should generate significantly less
- multicast traffic on the network than the old AppleTalk Chooser.
- Therefore, the interval between the first two queries SHOULD be one
- second, the intervals between subsequent queries SHOULD double, and
- the querier MUST implement Known Answer Suppression, as described
- below in Section 7.1. When the interval between queries reaches or
- exceeds 60 minutes, a querier MAY cap the interval to a maximum of 60
- minutes, and perform subsequent queries at a steady-state rate of one
- query per hour.
-
- When a Multicast DNS Querier receives an answer, the answer contains
- a TTL value that indicates for how many seconds this answer is valid.
- After this interval has passed, the answer will no longer be valid
- and SHOULD be deleted from the cache. Before this time is reached, a
- Multicast DNS Querier with an ongoing interest in that record SHOULD
- re-issue its query to determine whether the record is still valid,
- and if so update its expiry time.
-
- To perform this cache maintenance, a Multicast DNS Querier should
- plan to re-query for records after at least 50% of the record
- lifetime has elapsed. This document recommends the following
- specific strategy:
-
- The Querier should plan to issue a query at 80% of the record
- lifetime, and then if no answer is received, at 85%, 90% and 95%. If
- an answer is received, then the remaining TTL is reset to the value
- given in the answer, and this process repeats for as long as the
- Multicast DNS Querier has an ongoing interest in the record. If after
- four queries no answer is received, the record is deleted when it
- reaches 100% of its lifetime.
-
- To avoid the case where multiple Multicast DNS Queriers on a network
- all issue their queries simultaneously, a random variation of 2% of
- the record TTL should be added, so that queries are scheduled to be
- performed at 80-82%, 85-87%, 90-92% and then 95-97% of the TTL.
-
-
-6.4 Multiple Questions per Query
-
- Multicast DNS allows a querier to place multiple questions in the
- Question Section of a single Multicast DNS query packet.
-
- The semantics of a Multicast DNS query packet containing multiple
- questions is identical to a series of individual DNS query packets
- containing one question each. Combining multiple questions into a
- single packet is purely an efficiency optimization, and has no other
- semantic significance.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 11]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- A useful technique for adaptively combining multiple questions into a
- single query is to use a Nagle-style algorithm: When a client issues
- its first question, a Query packet is immediately built and sent,
- without delay. If the client then continues issuing a rapid series of
- questions they are held until either the first query receives at
- least one answer, or 100ms has passed, or there are enough questions
- to fill the Question Section of a Multicast DNS query packet. At this
- time, all the held questions are placed into a Multicast DNS query
- packet and sent.
-
-6.5 Questions Requesting Unicast Responses
-
- Sending Multicast DNS responses via multicast has the benefit that
- all the other hosts on the network get to see those responses, and
- can keep their caches up to date, and detect conflicting responses.
-
- However, there are situations where all the other hosts on the
- network don't need to see every response. One example is a laptop
- computer waking from sleep. At that instant it is a brand new
- participant on a new network. Its Multicast DNS cache is empty, and
- it has no knowledge of its surroundings. It may have a significant
- number of queries that it wants answered right away to discover
- information about its new surroundings and present that information
- to the user. As a new participant on the network, it has no idea
- whether the exact same questions may have been asked and answered
- just seconds ago. In this case, trigging a large sudden flood of
- multicast responses may impose an unreasonable burden on the network.
- To avoid this, the Multicast DNS Querier SHOULD set the top bit in
- the class field of its DNS question(s), to indicate that it is
- willing to accept unicast responses instead of the usual multicast
- responses. These questions requesting unicast responses are referred
- to as "QU" questions, to distinguish them from the more usual
- questions requesting multicast responses ("QM" questions).
-
- When retransmitting a question more than once, the 'unicast response'
- bit SHOULD be set only for the first question of the series. After
- the first question has received its responses, the querier should
- have a large known-answer list (see "Known Answer Suppression" below)
- so that subsequent queries should elicit few, if any, further
- responses. Reverting to multicast responses as soon as possible is
- important because of the benefits that multicast responses provide
- (see "Benefits of Multicast Responses" below).
-
- When receiving a question with the 'unicast response' bit set, a
- responder SHOULD usually respond with a unicast packet directed back
- to the querier. If the responder has not multicast that record
- recently (within one quarter of its TTL), then the responder SHOULD
- instead multicast the response so as to keep all the peer caches up
- to date, and to permit passive conflict detection.
-
- Unicast replies are subject to all the same packet generation rules
- as multicast replies, including the cache flush bit (see Section
- 11.3, "Announcements to Flush Outdated Cache Entries") and randomized
- delays to reduce network collisions (see Section 8, "Responding").
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 12]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-6.6 Suppressing Initial Query
-
- If a query is issued for which there already exist one or more
- records in the local cache, and those record(s) were received with
- the cache flush bit set (see Section 11.3, "Announcements to Flush
- Outdated Cache Entries"), indicating that they form a unique RRSet,
- then the host SHOULD suppress its initial "QU" query, and proceed to
- issue a "QM" query. To avoid the situation where a group of hosts
- are synchronized by some external event and all perform the same
- query simultaneously, a host suppressing its initial "QU" query
- SHOULD impose a random delay from 500-1000ms before transmitting its
- first "QM" query for this question. This means that when the first
- host (selected randomly by this algorithm) transmits its "QM" query,
- all the other hosts that were about to transmit the same query can
- suppress their superfluous query, as described in "Duplicate
- Question Suppression" below.
-
-7. Duplicate Suppression
-
- A variety of techniques are used to reduce the amount of redundant
- traffic on the network.
-
-7.1 Known Answer Suppression
-
- When a Multicast DNS Querier sends a query to which it already knows
- some answers, it populates the Answer Section of the DNS message with
- those answers.
-
- A Multicast DNS Responder SHOULD NOT answer a Multicast DNS Query if
- the answer it would give is already included in the Answer Section
- with an RR TTL at least half the correct value. If the RR TTL of the
- answer as given in the Answer Section is less than half of the true
- RR TTL as known by the Multicast DNS Responder, the responder MUST
- send an answer so as to update the Querier's cache before the record
- becomes in danger of expiration.
-
- Because a Multicast DNS Responder will respond if the remaining TTL
- given in the known answer list is less than half the true TTL, it is
- superfluous for the Querier to include such records in the known
- answer list. Therefore a Multicast DNS Querier SHOULD NOT include
- records in the known answer list whose remaining TTL is less than
- half their original TTL. Doing so would simply consume space in the
- packet without achieving the goal of suppressing responses, and would
- therefore be a pointless waste of network bandwidth.
-
- A Multicast DNS Querier MUST NOT cache resource records observed in
- the Known Answer Section of other Multicast DNS Queries. The Answer
- Section of Multicast DNS Queries is not authoritative. By placing
- information in the Answer Section of a Multicast DNS Query the
- querier is stating that it *believes* the information to be true.
- It is not asserting that the information *is* true. Some of those
- records may have come from other hosts that are no longer on the
- network. Propagating that stale information to other Multicast DNS
- Queriers on the network would not be helpful.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 13]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-7.2 Multi-Packet Known Answer Suppression
-
- Sometimes a Multicast DNS Querier will already have too many answers
- to fit in the Known Answer Section of its query packets. In this
- case, it should issue a Multicast DNS Query containing a question and
- as many Known Answer records as will fit. It MUST then set the TC
- (Truncated) bit in the header before sending the Query. It MUST then
- immediately follow the packet with another query packet containing no
- questions, and as many more Known Answer records as will fit. If
- there are still too many records remaining to fit in the packet, it
- again sets the TC bit and continues until all the Known Answer
- records have been sent.
-
- A Multicast DNS Responder seeing a Multicast DNS Query with the TC
- bit set defers its response for a time period randomly selected in
- the interval 400-500ms. This gives the Multicast DNS Querier time to
- send additional Known Answer packets before the Responder responds.
- If the Responder sees any of its answers listed in the Known Answer
- lists of subsequent packets from the querying host, it SHOULD delete
- that answer from the list of answers it is planning to give, provided
- that no other host on the network is also waiting to receive the same
- answer record.
-
- Previous versions of this draft specified a delay of 20-120ms before
- answering queries with multi-packet Known Answer lists. However,
- operational experience showed that, while this works well on
- Ethernet, on very busy 802.11 networks, it is not uncommon to observe
- consecutively sent packets arriving separated by as much as
- 200-400ms.
-
-
-7.3 Duplicate Question Suppression
-
- If a host is planning to send a query, and it sees another host on
- the network send a query containing the same question, and the Known
- Answer Section of that query does not contain any records which this
- host would not also put in its own Known Answer Section, then this
- host should treat its own query as having been sent. When multiple
- clients on the network are querying for the same resource records,
- there is no need for them to all be repeatedly asking the same
- question.
-
-
-7.4 Duplicate Answer Suppression
-
- If a host is planning to send an answer, and it sees another host on
- the network send a response packet containing the same answer record,
- and the TTL in that record is not less than the TTL this host would
- have given, then this host should treat its own answer as having been
- sent. When multiple responders on the network have the same data,
- there is no need for all of them to respond.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 14]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- This feature is particularly useful when multiple Sleep Proxy Servers
- are deployed (see Section 16, "Multicast DNS and Power Management").
- In the future it is possible that every general-purpose OS (Mac,
- Windows, Linux, etc.) will implement Sleep Proxy Service as a matter
- of course. In this case there could be a large number of Sleep Proxy
- Servers on any given network, which is good for reliability and
- fault-tolerance, but would be bad for the network if every Sleep
- Proxy Server were to answer every query.
-
-
-8. Responding
-
- When a Multicast DNS Responder constructs and sends a Multicast DNS
- response packet, the Answer Section of that packet must contain only
- records for which that Responder is explicitly authoritative. These
- answers may be generated because the record answers a question
- received in a Multicast DNS query packet, or at certain other times
- that the responder determines than an unsolicited announcement is
- warranted. A Multicast DNS Responder MUST NOT place records from its
- cache, which have been learned from other responders on the network,
- in the Answer Section of outgoing response packets. Only an
- authoritative source for a given record is allowed to issue responses
- containing that record.
-
- The determination of whether a given record answers a given question
- is done using the standard DNS rules: The record name must match the
- question name, the record rrtype must match the question qtype
- (unless the qtype is "ANY"), and the record rrclass must match the
- question qclass (unless the qclass is "ANY").
-
- A Multicast DNS Responder MUST only respond when it has a positive
- non-null response to send. Error responses must never be sent. The
- non-existence of any name in a Multicast DNS Domain is ascertained by
- the failure of any machine to respond to the Multicast DNS query, not
- by NXDOMAIN errors.
-
- Multicast DNS Responses MUST NOT contain any questions in the
- Question Section. Any questions in the Question Section of a received
- Multicast DNS Response MUST be silently ignored. Multicast DNS
- Queriers receiving Multicast DNS Responses do not care what question
- elicited the response; they care only that the information in the
- response is true and accurate.
-
- A Multicast DNS Responder on Ethernet [IEEE802] and similar shared
- multiple access networks SHOULD have the capability of delaying its
- responses by up to 500ms, as determined by the rules described below.
- If multiple Multicast DNS Responders were all to respond immediately
- to a particular query, a collision would be virtually guaranteed. By
- imposing a small random delay, the number of collisions is
- dramatically reduced. On a full-sized Ethernet using the maximum
- cable lengths allowed and the maximum number of repeaters allowed, an
- Ethernet frame is vulnerable to collisions during the transmission of
- its first 256 bits. On 10Mb/s Ethernet, this equates to a vulnerable
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 15]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- time window of 25.6us. On higher-speed variants of Ethernet, the
- vulnerable time window is shorter.
-
- In the case where a Multicast DNS Responder has good reason to
- believe that it will be the only responder on the link with a
- positive non-null response, it SHOULD NOT impose any random delay
- before responding, and SHOULD normally generate its response within
- at most 10ms. In particular, this applies to responding to probe
- queries. Since receiving a probe query gives a clear indication that
- some other Responder is planning to start using this name in the very
- near future, answering such probe queries to defend a unique record
- is a high priority and needs to be done immediately, without delay. A
- probe query can be distinguished from a normal query by the fact that
- a probe query contains a proposed record in the Authority Section
- which answers the question in the Question Section (for more details,
- see Section 9.1, "Probing").
-
- To generate immediate responses safely, it MUST have previously
- verified that the requested name, rrtype and rrclass in the DNS query
- are unique on this link. Responding immediately without delay is
- appropriate for things like looking up the address record for a
- particular host name, when the host name has been previously verified
- unique. Responding immediately without delay is *not* appropriate for
- things like looking up PTR records used for DNS Service Discovery
- [DNS-SD], where a large number of responses may be anticipated.
-
- In any case where there may be multiple responses, such as queries
- where the answer is a member of a shared resource record set, each
- responder SHOULD delay its response by a random amount of time
- selected with uniform random distribution in the range 20-120ms.
-
- In the case where the query has the TC (truncated) bit set,
- indicating that subsequent known answer packets will follow,
- responders SHOULD delay their responses by a random amount of time
- selected with uniform random distribution in the range 400-500ms,
- to allow enough time for all the known answer packets to arrive.
-
- Except when a unicast reply has been explicitly requested via the
- "unicast reply" bit, Multicast DNS Responses MUST be sent to UDP port
- 5353 (the well-known port assigned to mDNS) on the 224.0.0.251
- multicast address (or its IPv6 equivalent FF02::FB). Operating in a
- Zeroconf environment requires constant vigilance. Just because a name
- has been previously verified unique does not mean it will continue to
- be so indefinitely. By allowing all Multicast DNS Responders to
- constantly monitor their peers' responses, conflicts arising out of
- network topology changes can be promptly detected and resolved.
-
- Sending all responses by multicast also facilitates opportunistic
- caching by other hosts on the network.
-
- To protect the network against excessive packet flooding due to
- software bugs or malicious attack, a Multicast DNS Responder MUST NOT
- multicast a given record on a given interface if it has previously
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 16]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- multicast that record on that interface within the last second. A
- legitimate client on the network should have seen the previous
- transmission and cached it. A client that did not receive and cache
- the previous transmission will retry its request and receive a
- subsequent response. Under no circumstances is there any legitimate
- reason for a Multicast DNS Responder to multicast a given record more
- than once per second on any given interface.
-
-
-8.1 Legacy Unicast Responses
-
- If the source UDP port in a received Multicast DNS Query is not port
- 5353, this indicates that the client originating the query is a
- simple client that does not fully implement all of Multicast DNS. In
- this case, the Multicast DNS Responder MUST send a UDP response
- directly back to the client, via unicast, to the query packet's
- source IP address and port. This unicast response MUST be a
- conventional unicast response as would be generated by a conventional
- unicast DNS server; for example, it MUST repeat the query ID and the
- question given in the query packet.
-
- The resource record TTL given in a legacy unicast response SHOULD NOT
- be greater than ten seconds, even if the true TTL of the Multicast
- DNS resource record is higher. This is because Multicast DNS
- Responders that fully participate in the protocol use the cache
- coherency mechanisms described in Section 13 to update and invalidate
- stale data. Were unicast responses sent to legacy clients to use the
- same high TTLs, these legacy clients, which do not implement these
- cache coherency mechanisms, could retain stale cached resource record
- data long after it is no longer valid.
-
- Having sent this unicast response, if the Responder has not sent this
- record in any multicast response recently, it SHOULD schedule the
- record to be sent via multicast as well, to facilitate passive
- conflict detection. "Recently" in this context means "if the time
- since the record was last sent via multicast is less than one quarter
- of the record's TTL".
-
-
-8.2 Multi-Question Queries
-
- Multicast DNS Responders MUST correctly handle DNS query packets
- containing more than one question, by answering any or all of the
- questions to which they have answers. Any (non-defensive) answers
- generated in response to query packets containing more than one
- question SHOULD be randomly delayed in the range 20-120ms, or
- 400-500ms if the TC (truncated) bit is set, as described above.
- (Answers defending a name, in response to a probe for that name,
- are not subject to this delay rule and are still sent immediately.)
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 17]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-8.3 Response Aggregation
-
- When possible, a responder SHOULD, for the sake of network
- efficiency, aggregate as many responses as possible into a single
- Multicast DNS response packet. For example, when a responder has
- several responses it plans to send, each delayed by a different
- interval, then earlier responses SHOULD be delayed by up to an
- additional 500ms if that will permit them to be aggregated with
- other responses scheduled to go out a little later.
-
-
-9. Probing and Announcing on Startup
-
- Typically a Multicast DNS Responder should have, at the very least,
- address records for all of its active interfaces. Creating and
- advertising an HINFO record on each interface as well can be useful
- to network administrators.
-
- Whenever a Multicast DNS Responder starts up, wakes up from sleep,
- receives an indication of an Ethernet "Link Change" event, or has any
- other reason to believe that its network connectivity may have
- changed in some relevant way, it MUST perform the two startup steps
- below.
-
-
-9.1 Probing
-
- The first startup step is that for all those resource records that a
- Multicast DNS Responder desires to be unique on the local link, it
- MUST send a Multicast DNS Query asking for those resource records, to
- see if any of them are already in use. The primary example of this is
- its address record which maps its unique host name to its unique IP
- address. All Probe Queries SHOULD be done using the desired resource
- record name and query type T_ANY (255), to elicit answers for all
- types of records with that name. This allows a single question to be
- used in place of several questions, which is more efficient on the
- network. It also allows a host to verify exclusive ownership of a
- name, which is desirable in most cases. It would be confusing, for
- example, if one host owned the "A" record for "myhost.local.", but a
- different host owned the HINFO record for that name.
-
- The ability to place more than one question in a Multicast DNS Query
- is useful here, because it can allow a host to use a single packet
- for all of its resource records instead of needing a separate packet
- for each. For example, a host can simultaneously probe for uniqueness
- of its "A" record and all its SRV records [DNS-SD] in the same query
- packet.
-
- When ready to send its mDNS probe packet(s) the host should first
- wait for a short random delay time, uniformly distributed in the
- range 0-250ms. This random delay is to guard against the case where a
- group of devices are powered on simultaneously, or a group of devices
- are connected to an Ethernet hub which is then powered on, or some
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 18]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- other external event happens that might cause a group of hosts to all
- send synchronized probes.
-
- 250ms after the first query the host should send a second, then
- 250ms after that a third. If, by 250ms after the third probe, no
- conflicting Multicast DNS responses have been received, the host may
- move to the next step, announcing. (Note that this is the one
- exception from the normal rule that there should be at least one
- second between repetitions of the same question, and the interval
- between subsequent repetitions should double.)
-
- If any conflicting Multicast DNS responses are received, then the
- probing host MUST defer to the existing host, and MUST choose new
- names for some or all of its resource records as appropriate, to
- avoid conflict with pre-existing hosts on the network. In the case
- of a host probing using query type T_ANY as recommended above, any
- answer containing a record with that name, of any type, MUST be
- considered a conflicting response and handled accordingly.
-
- If fifteen failures occur within any ten-second period, then the host
- MUST wait at least five seconds before each successive additional
- probe attempt. This is to help ensure that in the event of software
- bugs or other unanticipated problems, errant hosts do not flood the
- network with a continuous stream of multicast traffic. For very
- simple devices, a valid way to comply with this requirement is to
- always wait five seconds after any failed probe attempt.
-
- If a responder knows by other means, with absolute certainty, that
- its unique resource record set name, rrtype and rrclass cannot
- already be in use by any other responder on the network, then it MAY
- skip the probing step for that resource record set. For example, when
- creating the reverse address mapping PTR records, the host can
- reasonably assume that no other host will be trying to create those
- same PTR records, since that would imply that the two hosts were
- trying to use the same IP address, and if that were the case, the two
- hosts would be suffering communication problems beyond the scope of
- what Multicast DNS is designed to solve.
-
-
-9.2 Simultaneous Probe Tie-Breaking
-
- The astute reader will observe that there is a race condition
- inherent in the previous description. If two hosts are probing for
- the same name simultaneously, neither will receive any response to
- the probe, and the hosts could incorrectly conclude that they may
- both proceed to use the name. To break this symmetry, each host
- populates the Authority Section of its queries with records giving
- the rdata that it would be proposing to use, should its probing be
- successful. The Authority Section is being used here in a way
- analogous to the Update Section of a DNS Update packet [RFC 2136].
-
- When a host that is probing for a record sees another host issue a
- query for the same record, it consults the Authority Section of that
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 19]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- query. If it finds any resource record there which answers the query,
- then it compares the data of that resource record with its own
- tentative data. The lexicographically later data wins. This means
- that if the host finds that its own data is lexicographically later,
- it simply ignores the other host's probe. If the host finds that its
- own data is lexicographically earlier, then it treats this exactly
- as if it had received a positive answer to its query, and concludes
- that it may not use the desired name.
-
- The determination of 'lexicographically later' is performed by first
- comparing the record class, then the record type, then raw comparison
- of the binary content of the rdata without regard for meaning or
- structure. If the record classes differ, then the numerically greater
- class is considered 'lexicographically later'. Otherwise, if the
- record types differ, then the numerically greater type is considered
- 'lexicographically later'. If the rrtype and rrclass both match then
- the rdata is compared.
-
- In the case of resource records containing rdata that is subject to
- name compression, the names MUST be uncompressed before comparison.
- (The details of how a particular name is compressed is an artifact of
- how and where the record is written into the DNS message; it is not
- an intrinsic property of the resource record itself.)
-
- The bytes of the raw uncompressed rdata are compared in turn,
- interpreting the bytes as eight-bit UNSIGNED values, until a byte
- is found whose value is greater than that of its counterpart (in
- which case the rdata whose byte has the greater value is deemed
- lexicographically later) or one of the resource records runs out
- of rdata (in which case the resource record which still has
- remaining data first is deemed lexicographically later).
-
- The following is an example of a conflict:
-
- cheshire.local. A 169.254.99.200
- cheshire.local. A 169.254.200.50
-
- In this case 169.254.200.50 is lexicographically later (the third
- byte, with value 200, is greater than its counterpart with value 99),
- so it is deemed the winner.
-
- Note that it is vital that the bytes are interpreted as UNSIGNED
- values, or the wrong outcome may result. In the example above, if
- the byte with value 200 had been incorrectly interpreted as a
- signed value then it would be interpreted as value -56, and the
- wrong address record would be deemed the winner.
-
-
-9.3 Announcing
-
- The second startup step is that the Multicast DNS Responder MUST send
- a gratuitous Multicast DNS Response containing, in the Answer
- Section, all of its resource records (both shared records, and unique
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 20]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- records that have completed the probing step). If there are too many
- resource records to fit in a single packet, multiple packets should
- be used.
-
- In the case of shared records (e.g. the PTR records used by DNS
- Service Discovery [DNS-SD]), the records are simply placed as-is
- into the Answer Section of the DNS Response.
-
- In the case of records that have been verified to be unique in the
- previous step, they are placed into the Answer Section of the DNS
- Response with the most significant bit of the rrclass set to one.
- The most significant bit of the rrclass for a record in the Answer
- Section of a response packet is the mDNS "cache flush" bit and is
- discussed in more detail below in Section 11.3 "Announcements to
- Flush Outdated Cache Entries".
-
- The Multicast DNS Responder MUST send at least two gratuitous
- responses, one second apart. A Responder MAY send up to ten
- gratuitous Responses, provided that the interval between gratuitous
- responses doubles with every response sent.
-
- A Multicast DNS Responder SHOULD NOT continue sending gratuitous
- Responses for longer than the TTL of the record. The purpose of
- announcing new records via gratuitous Responses is to ensure that
- peer caches are up to date. After a time interval equal to the TTL of
- the record has passed, it is very likely that old stale copies of
- that record in peer caches will have expired naturally, so subsequent
- announcements serve little purpose.
-
- A Multicast DNS Responder MUST NOT send announcements in the absence
- of information that its network connectivity may have changed in some
- relevant way. In particular, a Multicast DNS Responder MUST NOT send
- regular periodic announcements as a matter of course.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record, the conflict MUST be resolved as described below in "Conflict
- Resolution".
-
-9.4 Updating
-
- At any time, if the rdata of any of a host's Multicast DNS records
- changes, the host MUST repeat the Announcing step described above to
- update neighboring caches. For example, if any of a host's IP
- addresses change, it MUST re-announce those address records.
-
- In the case of shared records, a host MUST send a 'goodbye'
- announcement with TTL zero (see Section 11.2 "Goodbye Packets")
- for the old rdata, to cause it to be deleted from peer caches,
- before announcing the new rdata. In the case of unique records,
- a host SHOULD omit the 'goodbye' announcement, since the cache
- flush bit on the newly announced records will cause old rdata
- to be flushed from peer caches anyway.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 21]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- A host may update the contents of any of its records at any time,
- though a host SHOULD NOT update records more frequently than ten
- times per minute. Frequent rapid updates impose a burden on the
- network. If a host has information to disseminate which changes more
- frequently than ten times per minute, then it may be more appropriate
- to design a protocol for that specific purpose.
-
-
-10. Conflict Resolution
-
- A conflict occurs when a Multicast DNS Responder has a unique record
- for which it is authoritative, and it receives, in the Answer Section
- of a Multicast DNS response another record with the same name, rrtype
- and rrclass, but inconsistent rdata. What may be considered
- inconsistent is context sensitive, except that resource records with
- identical rdata are never considered inconsistent, even if they
- originate from different hosts. This is to permit use of proxies and
- other fault-tolerance mechanisms that may cause more than one
- responder to be capable of issuing identical answers on the network.
-
- A common example of a resource record type that is intended to be
- unique, not shared between hosts, is the address record that maps a
- host's name to its IP address. Should a host witness another host
- announce an address record with the same name but a different IP
- address, then that is considered inconsistent, and that address
- record is considered to be in conflict.
-
- Whenever a Multicast DNS Responder receives any Multicast DNS
- response (gratuitous or otherwise) containing a conflicting resource
- record in the Answer Section, the Multicast DNS Responder MUST
- immediately reset its conflicted unique record to probing state, and
- go through the startup steps described above in Section 9. "Probing
- and Announcing on Startup". The protocol used in the Probing phase
- will determine a winner and a loser, and the loser MUST cease using
- the name, and reconfigure.
-
- It is very important that any host receiving a resource record that
- conflicts with one of its own MUST take action as described above.
- In the case of two hosts using the same host name, where one has been
- configured to require a unique host name and the other has not, the
- one that has not been configured to require a unique host name will
- not perceive any conflict, and will not take any action. By reverting
- to Probing state, the host that desires a unique host name will go
- through the necessary steps to ensure that a unique host is obtained.
-
- The recommended course of action after probing and failing is as
- follows:
-
- o Programmatically change the resource record name in an attempt to
- find a new name that is unique. This could be done by adding some
- further identifying information (e.g. the model name of the
- hardware) if it is not already present in the name, appending the
- digit "2" to the name, or incrementing a number at the end of the
- name if one is already present.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 22]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- o Probe again, and repeat until a unique name is found.
-
- o Record this newly chosen name in persistent storage so that the
- device will use the same name the next time it is power-cycled.
-
- o Display a message to the user or operator informing them of the
- name change. For example:
-
- The name "Bob's Music" is in use by another iTunes music
- server on the network. Your music has been renamed to
- "Bob's Music (G4 Cube)". If you want to change this name,
- use [describe appropriate menu item or preference dialog].
-
- How the user or operator is informed depends on context. A desktop
- computer with a screen might put up a dialog box. A headless server
- in the closet may write a message to a log file, or use whatever
- mechanism (email, SNMP trap, etc.) it uses to inform the
- administrator of other error conditions. On the other hand a headless
- server in the closet may not inform the user at all -- if the user
- cares, they will notice the name has changed, and connect to the
- server in the usual way (e.g. via Web Browser) to configure a new
- name.
-
- The examples in this section focus on address records (i.e. host
- names), but the same considerations apply to all resource records
- where uniqueness (or maintenance of some other defined constraint)
- is desired.
-
-
-
-11. Resource Record TTL Values and Cache Coherency
-
- As a general rule, the recommended TTL value for Multicast DNS
- resource records with a host name as the resource record's name
- (e.g. A, AAAA, HINFO, etc.) or contained within the resource record's
- rdata (e.g. SRV, reverse mapping PTR record, etc.) is 120 seconds.
-
- The recommended TTL value for other Multicast DNS resource records
- is 75 minutes.
-
- A client with an active outstanding query will issue a query packet
- when one or more of the resource record(s) in its cache is (are) 80%
- of the way to expiry. If the TTL on those records is 75 minutes,
- this ongoing cache maintenance process yields a steady-state query
- rate of one query every 60 minutes.
-
- Any distributed cache needs a cache coherency protocol. If Multicast
- DNS resource records follow the recommendation and have a TTL of 75
- minutes, that means that stale data could persist in the system for
- a little over an hour. Making the default TTL significantly lower
- would reduce the lifetime of stale data, but would produce too much
- extra traffic on the network. Various techniques are available to
- minimize the impact of such stale data.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 23]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-11.1 Cooperating Multicast DNS Responders
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name, rrtype and rrclass as one of A's
- resource records, but different rdata, then:
-
- o If A's resource record is intended to be a shared resource record,
- then this is no conflict, and no action is required.
-
- o If A's resource record is intended to be a member of a unique
- resource record set owned solely by that responder, then this
- is a conflict and MUST be handled as described in Section 10
- "Conflict Resolution".
-
- If a Multicast DNS Responder ("A") observes some other Multicast DNS
- Responder ("B") send a Multicast DNS Response packet containing a
- resource record with the same name, rrtype and rrclass as one of A's
- resource records, and identical rdata, then:
-
- o If the TTL of B's resource record given in the packet is at least
- half the true TTL from A's point of view, then no action is
- required.
-
- o If the TTL of B's resource record given in the packet is less than
- half the true TTL from A's point of view, then A MUST mark its
- record to be announced via multicast. Clients receiving the record
- from B would use the TTL given by B, and hence may delete the
- record sooner than A expects. By sending its own multicast response
- correcting the TTL, A ensures that the record will be retained for
- the desired time.
-
- These rules allow multiple Multicast DNS Responders to offer the same
- data on the network (perhaps for fault tolerance reasons) without
- conflicting with each other.
-
-
-11.2 Goodbye Packets
-
- In the case where a host knows that certain resource record data is
- about to become invalid (for example when the host is undergoing a
- clean shutdown) the host SHOULD send a gratuitous announcement mDNS
- response packet, giving the same resource record name, rrtype,
- rrclass and rdata, but an RR TTL of zero. This has the effect of
- updating the TTL stored in neighboring hosts' cache entries to zero,
- causing that cache entry to be promptly deleted.
-
- Clients receiving a Multicast DNS Response with a TTL of zero SHOULD
- NOT immediately delete the record from the cache, but instead record
- a TTL of 1 and then delete the record one second later. In the case
- of multiple Multicast DNS Responders on the network described in
- Section 11.1 above, if one of the Responders shuts down and
- incorrectly sends goodbye packets for its records, it gives the other
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 24]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- cooperating Responders one second to send out their own response to
- "rescue" the records before they expire and are deleted.
-
- Generally speaking, it is more important to send goodbye packets for
- shared records than unique records. A given shared record name (such
- as a PTR record used for DNS Service Discovery [DNS-SD]) by its
- nature often has many representatives from many different hosts, and
- tends to be the subject of long-lived ongoing queries. Those
- long-lived queries are often concerned not just about being informed
- when records appear, but also about being informed if those records
- vanish again. In contrast, a unique record set (such as an SRV
- record, or a host address record), by its nature, often has far fewer
- members than a shared record set, and is usually the subject of
- one-shot queries which simply retrieve the data and then cease
- querying once they have the answer they are seeking. Therefore,
- sending a goodbye packet for a unique record set is likely to offer
- less benefit, because it is likely at any given moment that no one
- has an active query running for that record set. One example where
- goodbye packets for SRV and address records are useful is when
- transferring control to a Sleep Proxy Server (see Section 16,
- "Multicast DNS and Power Management").
-
-
-11.3 Announcements to Flush Outdated Cache Entries
-
- Whenever a host has a resource record with potentially new data (e.g.
- after rebooting, waking from sleep, connecting to a new network link,
- changing IP address, etc.), the host MUST send a series of gratuitous
- announcements to update cache entries in its neighbor hosts. In
- these gratuitous announcements, if the record is one that is intended
- to be unique, the host sets the most significant bit of the rrclass
- field of the resource record. This bit, the "cache flush" bit, tells
- neighboring hosts that this is not a shared record type. Instead of
- merging this new record additively into the cache in addition to any
- previous records with the same name, rrtype and rrclass, all old
- records with that name, type and class that were received more than
- one second ago are declared invalid, and marked to expire from the
- cache in one second.
-
- The semantics of the cache flush bit are as follows: Normally when a
- resource record appears in the Answer Section of the DNS Response, it
- means, "This is an assertion that this information is true." When a
- resource record appears in the Answer Section of the DNS Response
- with the "cache flush" bit set, it means, "This is an assertion that
- this information is the truth and the whole truth, and anything you
- may have heard more than a second ago regarding records of this
- name/rrtype/rrclass is no longer valid".
-
- To accommodate the case where the set of records from one host
- constituting a single unique RRSet is too large to fit in a single
- packet, only cache records that are more than one second old are
- flushed. This allows the announcing host to generate a quick burst of
- packets back-to-back on the wire containing all the members
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 25]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- of the RRSet. When receiving records with the "cache flush" bit set,
- all records older than one second are marked to be deleted one second
- in the future. One second after the end of the little packet burst,
- any records not represented within that packet burst will then be
- expired from all peer caches.
-
- Any time a host sends a response packet containing some members of a
- unique RRSet, it SHOULD send the entire RRSet, preferably in a single
- packet, or if the entire RRSet will not fit in a single packet, in a
- quick burst of packets sent as close together as possible. The host
- SHOULD set the cache flush bit on all members of the unique RRSet.
- In the event that for some reason the host chooses not to send the
- entire unique RRSet in a single packet or a rapid packet burst,
- it MUST NOT set the cache flush bit on any of those records.
-
- The reason for waiting one second before deleting stale records from
- the cache is to accommodate bridged networks. For example, a host's
- address record announcement on a wireless interface may be bridged
- onto a wired Ethernet, and cause that same host's Ethernet address
- records to be flushed from peer caches. The one-second delay gives
- the host the chance to see its own announcement arrive on the wired
- Ethernet, and immediately re-announce its Ethernet interface's
- address records so that both sets remain valid and live in peer
- caches.
-
- These rules apply regardless of *why* the response packet is being
- generated. They apply to startup announcements as described in
- Section 9.3, and to responses generated as a result of receiving
- query packets.
-
- The "cache flush" bit is only set in records in the Answer Section of
- Multicast DNS responses sent to UDP port 5353. The "cache flush" bit
- MUST NOT be set in any resource records in a response packet sent in
- legacy unicast responses to UDP ports other than 5353.
-
- The "cache flush" bit MUST NOT be set in any resource records in the
- known-answer list of any query packet.
-
- The "cache flush" bit MUST NOT ever be set in any shared resource
- record. To do so would cause all the other shared versions of this
- resource record with different rdata from different Responders to be
- immediately deleted from all the caches on the network.
-
- The "cache flush" bit does apply to questions listed in the Question
- Section of a Multicast DNS packet. The top bit of the rrclass field
- in questions is used for an entirely different purpose (see Section
- 6.5, "Questions Requesting Unicast Responses").
-
- Note that the "cache flush" bit is NOT part of the resource record
- class. The "cache flush" bit is the most significant bit of the
- second 16-bit word of a resource record in the Answer Section of
- an mDNS packet (the field conventionally referred to as the rrclass
- field), and the actual resource record class is the least-significant
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 26]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- fifteen bits of this field. There is no mDNS resource record class
- 0x8001. The value 0x8001 in the rrclass field of a resource record in
- an mDNS response packet indicates a resource record with class 1,
- with the "cache flush" bit set. When receiving a resource record with
- the "cache flush" bit set, implementations should take care to mask
- off that bit before storing the resource record in memory.
-
-
-11.4 Cache Flush on Topology change
-
- If the hardware on a given host is able to indicate physical changes
- of connectivity, then when the hardware indicates such a change, the
- host should take this information into account in its mDNS cache
- management strategy. For example, a host may choose to immediately
- flush all cache records received on a particular interface when that
- cable is disconnected. Alternatively, a host may choose to adjust the
- remaining TTL on all those records to a few seconds so that if the
- cable is not reconnected quickly, those records will expire from the
- cache.
-
- Likewise, when a host reboots, or wakes from sleep, or undergoes some
- other similar discontinuous state change, the cache management
- strategy should take that information into account.
-
-
-11.5 Cache Flush on Failure Indication
-
- Sometimes a cache record can be determined to be stale when a client
- attempts to use the rdata it contains, and finds that rdata to be
- incorrect.
-
- For example, the rdata in an address record can be determined to be
- incorrect if attempts to contact that host fail, either because
- ARP/ND requests for that address go unanswered (for an address on a
- local subnet) or because a router returns an ICMP "Host Unreachable"
- error (for an address on a remote subnet).
-
- The rdata in an SRV record can be determined to be incorrect if
- attempts to communicate with the indicated service at the host and
- port number indicated are not successful.
-
- The rdata in a DNS-SD PTR record can be determined to be incorrect if
- attempts to look up the SRV record it references are not successful.
-
- In any such case, the software implementing the mDNS resource record
- cache should provide a mechanism so that clients detecting stale
- rdata can inform the cache.
-
- When the cache receives this hint that it should reconfirm some
- record, it MUST issue two or more queries for the resource record in
- question. If no response is received in a reasonable amount of time,
- then, even though its TTL may indicate that it is not yet due to
- expire, that record SHOULD be promptly flushed from the cache.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 27]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- The end result of this is that if a printer suffers a sudden power
- failure or other abrupt disconnection from the network, its name may
- continue to appear in DNS-SD browser lists displayed on users'
- screens. Eventually that entry will expire from the cache naturally,
- but if a user tries to access the printer before that happens, the
- failure to successfully contact the printer will trigger the more
- hasty demise of its cache entries. This is a sensible trade-off
- between good user-experience and good network efficiency. If we were
- to insist that printers should disappear from the printer list within
- 30 seconds of becoming unavailable, for all failure modes, the only
- way to achieve this would be for the client to poll the printer at
- least every 30 seconds, or for the printer to announce its presence
- at least every 30 seconds, both of which would be an unreasonable
- burden on most networks.
-
-
-11.6 Passive Observation of Failures
-
- A host observes the multicast queries issued by the other hosts on
- the network. One of the major benefits of also sending responses
- using multicast is that it allows all hosts to see the responses (or
- lack thereof) to those queries.
-
- If a host sees queries, for which a record in its cache would be
- expected to be given as an answer in a multicast response, but no
- such answer is seen, then the host may take this as an indication
- that the record may no longer be valid.
-
- After seeing two or more of these queries, and seeing no multicast
- response containing the expected answer within a reasonable amount of
- time, then even though its TTL may indicate that it is not yet due to
- expire, that record MAY be flushed from the cache. The host SHOULD
- NOT perform its own queries to re-confirm that the record is truly
- gone. If every host on a large network were to do this, it would
- cause a lot of unnecessary multicast traffic. If host A sends
- multicast queries that remain unanswered, then there is no reason to
- suppose that host B or any other host is likely to be any more
- successful.
-
- The previous section, "Cache Flush on Failure Indication", describes
- a situation where a user trying to print discovers that the printer
- is no longer available. By implementing the passive observation
- described here, when one user fails to contact the printer, all hosts
- on the network observe that failure and update their caches
- accordingly.
-
-
-12. Special Characteristics of Multicast DNS Domains
-
- Unlike conventional DNS names, names that end in ".local.",
- "254.169.in-addr.arpa." or "0.8.e.f.ip6.arpa." have only local
- significance. Conventional DNS seeks to provide a single unified
- namespace, where a given DNS query yields the same answer no matter
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 28]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- where on the planet it is performed or to which recursive DNS server
- the query is sent. (However, split views, firewalls, intranets and
- the like have somewhat interfered with this goal of DNS representing
- a single universal truth.) In contrast, each IP link has its own
- private ".local.", "254.169.in-addr.arpa." and "0.8.e.f.ip6.arpa."
- namespaces, and the answer to any query for a name within those
- domains depends on where that query is asked.
-
- Multicast DNS Domains are not delegated from their parent domain via
- use of NS records. There are no NS records anywhere in Multicast DNS
- Domains. Instead, all Multicast DNS Domains are delegated to the IP
- addresses 224.0.0.251 and FF02::FB by virtue of the individual
- organizations producing DNS client software deciding how to handle
- those names. It would be extremely valuable for the industry if this
- special handling were ratified and recorded by IANA, since otherwise
- the special handling provided by each vendor is likely to be
- inconsistent.
-
- The IPv4 name server for a Multicast DNS Domain is 224.0.0.251. The
- IPv6 name server for a Multicast DNS Domain is FF02::FB. These are
- multicast addresses; therefore they identify not a single host but a
- collection of hosts, working in cooperation to maintain some
- reasonable facsimile of a competently managed DNS zone. Conceptually
- a Multicast DNS Domain is a single DNS zone, however its server is
- implemented as a distributed process running on a cluster of loosely
- cooperating CPUs rather than as a single process running on a single
- CPU.
-
- No delegation is performed within Multicast DNS Domains. Because the
- cluster of loosely coordinated CPUs is cooperating to administer a
- single zone, delegation is neither necessary nor desirable. Just
- because a particular host on the network may answer queries for a
- particular record type with the name "example.local." does not imply
- anything about whether that host will answer for the name
- "child.example.local.", or indeed for other record types with the
- name "example.local."
-
- Multicast DNS Zones have no SOA record. A conventional DNS zone's
- SOA record contains information such as the email address of the zone
- administrator and the monotonically increasing serial number of the
- last zone modification. There is no single human administrator for
- any given Multicast DNS Zone, so there is no email address. Because
- the hosts managing any given Multicast DNS Zone are only loosely
- coordinated, there is no readily available monotonically increasing
- serial number to determine whether or not the zone contents have
- changed. A host holding part of the shared zone could crash or be
- disconnected from the network at any time without informing the other
- hosts. There is no reliable way to provide a zone serial number that
- would, whenever such a crash or disconnection occurred, immediately
- change to indicate that the contents of the shared zone had changed.
-
- Zone transfers are not possible for any Multicast DNS Zone.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 29]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-13. Multicast DNS for Service Discovery
-
- This document does not describe using Multicast DNS for network
- browsing or service discovery. However, the mechanisms this document
- describes are compatible with (and support) the browsing and service
- discovery mechanisms proposed in "DNS-Based Service Discovery"
- [DNS-SD].
-
-
-14. Enabling and Disabling Multicast DNS
-
- The option to fail-over to Multicast DNS for names not ending in
- ".local." SHOULD be a user-configured option, and SHOULD
- be disabled by default because of the possible security issues
- related to unintended local resolution of apparently global names.
-
- The option to lookup unqualified (relative) names by appending
- ".local." (or not) is controlled by whether ".local." appears
- (or not) in the client's DNS search list.
-
- No special control is needed for enabling and disabling Multicast DNS
- for names explicitly ending with ".local." as entered by the user.
- The user doesn't need a way to disable Multicast DNS for names ending
- with ".local.", because if the user doesn't want to use Multicast
- DNS, they can achieve this by simply not using those names. If a user
- *does* enter a name ending in ".local.", then we can safely assume
- the user's intention was probably that it should work. Having user
- configuration options that can be (intentionally or unintentionally)
- set so that local names don't work is just one more way of
- frustrating the user's ability to perform the tasks they want,
- perpetuating the view that, "IP networking is too complicated to
- configure and too hard to use." This in turn perpetuates the
- continued use of protocols like AppleTalk. If we want to retire
- AppleTalk, NetBIOS, etc., we need to offer users equivalent IP
- functionality that they can rely on to, "always work, like
- AppleTalk." A little Multicast DNS traffic may be a burden on the
- network, but it is an insignificant burden compared to continued
- widespread use of AppleTalk.
-
-
-15. Considerations for Multiple Interfaces
-
- A host should defend its host name (FQDN) on all active interfaces on
- which it is answering Multicast DNS queries.
-
- In the event of a name conflict on *any* interface, a host should
- configure a new host name, if it wishes to maintain uniqueness of its
- host name.
-
- A host may choose to use the same name for all of its address records
- on all interfaces, or it may choose to manage its Multicast DNS host
- name(s) independently on each interface, potentially answering to
- different names on different interfaces.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 30]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- When answering a Multicast DNS query, a multi-homed host with a
- link-local address (or addresses) should take care to ensure that
- any address going out in a Multicast DNS response is valid for use
- on the interface on which the response is going out.
-
- Just as the same link-local IP address may validly be in use
- simultaneously on different links by different hosts, the same
- link-local host name may validly be in use simultaneously on
- different links, and this is not an error. A multi-homed host with
- connections to two different links may be able to communicate with
- two different hosts that are validly using the same name. While this
- kind of name duplication should be rare, it means that a host that
- wants to fully support this case needs network programming APIs that
- allow applications to specify on what interface to perform a
- link-local Multicast DNS query, and to discover on what interface a
- Multicast DNS response was received.
-
-
-16. Multicast DNS and Power Management
-
- Many modern network devices have the ability to go into a low-power
- mode where only a small part of the Ethernet hardware remains
- powered, and the device can be woken up by sending a specially
- formatted Ethernet frame which the device's power-management hardware
- recognizes.
-
- To make use of this in conjunction with Multicast DNS, we propose a
- network power management service called Sleep Proxy Service. A device
- that wishes to enter low-power mode first uses DNS-SD to determine if
- Sleep Proxy Service is available on the local network. In some
- networks there may be more than one piece of hardware implementing
- Sleep Proxy Service, for fault-tolerance reasons.
-
- If the device finds the network has Sleep Proxy Service, the device
- transmits two or more gratuitous mDNS announcements setting the TTL
- of its relevant resource records to zero, to delete them from
- neighboring caches. The relevant resource records include address
- records and SRV records, and other resource records as may apply to a
- particular device. The device then communicates all of its remaining
- active records, plus the names, rrtypes and rrclasses of the deleted
- records, to the Sleep Proxy Service(s), along with a copy of the
- specific "magic packet" required to wake the device up.
-
- When a Sleep Proxy Service sees an mDNS query for one of the
- device's active records (e.g. a DNS-SD PTR record), it answers on
- behalf of the device without waking it up. When a Sleep Proxy Service
- sees an mDNS query for one of the device's deleted resource
- records, it deduces that some client on the network needs to make an
- active connection to the device, and sends the specified "magic
- packet" to wake the device up. The device then wakes up, reactivates
- its deleted resource records, and re-announces them to the network.
- The client waiting to connect sees the announcements, learns the
- current IP address and port number of the desired service on the
- device, and proceeds to connect to it.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 31]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- The connecting client does not need to be aware of how Sleep Proxy
- Service works. Only devices that implement low power mode and wish to
- make use of Sleep Proxy Service need to be aware of how that protocol
- works.
-
- The reason that a device using a Sleep Proxy Service should send more
- than one goodbye packet is to ensure deletion of the resource records
- from all peer caches. If resource records were to inadvertently
- remain in some peer caches, then those peers may not issue any query
- packets for those records when attempting to access the sleeping
- device, so the Sleep Proxy Service would not receive any queries for
- the device's SRV and/or address records, and the necessary wake-up
- message would not be triggered.
-
- The full specification of mDNS / DNS-SD Sleep Proxy Service
- is described in another document [not yet published].
-
-
-17. Multicast DNS Character Set
-
- Unicast DNS has been plagued by the lack of any support for non-US
- characters. Indeed, conventional DNS is usually limited to just
- letters, digits and hyphens, with no spaces or other punctuation.
- Attempts to remedy this for unicast DNS have been badly constrained
- by the need to accommodate old buggy legacy DNS implementations.
- In reality, the DNS specification actually imposes no limits on what
- characters may be used in names, and good DNS implementations handle
- any arbitrary eight-bit data without trouble. However, the old rules
- for ARPANET host names back in the 1980s required names to be just
- letters, digits, and hyphens [RFC 1034], and since the predominant
- use of DNS is to store host address records, many have assumed that
- the DNS protocol itself suffers from the same limitation. It would be
- more accurate to say that certain bad implementations may not handle
- eight-bit data correctly, not that the protocol doesn't support it.
-
- Multicast DNS is a new protocol and doesn't (yet) have old buggy
- legacy implementations to constrain the design choices. Accordingly,
- it adopts the simple obvious elegant solution: all names in Multicast
- DNS are encoded using precomposed UTF-8 [RFC 3629]. The
- characters SHOULD conform to Unicode Normalization Form C (NFC): Use
- precomposed characters instead of combining sequences where possible,
- e.g. use U+00C4 ("Latin capital letter A with diaeresis") instead of
- U+0041 U+0308 ("Latin capital letter A", "combining diaeresis").
-
- For names that are restricted to letters, digits and hyphens, the
- UTF-8 encoding is identical to the US-ASCII encoding, so this is
- entirely compatible with existing host names. For characters outside
- the US-ASCII range, UTF-8 encoding is used.
-
- Multicast DNS implementations MUST NOT use any other encodings apart
- from precomposed UTF-8 (US-ASCII being considered a compatible subset
- of UTF-8).
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 32]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- This point bears repeating: After many years of debate, as a result
- of the need to accommodate certain DNS implementations that
- apparently couldn't handle any character that's not a letter, digit
- or hyphen (and apparently never will be updated to remedy this
- limitation) the unicast DNS community settled on an extremely baroque
- encoding called "Punycode" [RFC 3492]. Punycode is a remarkably
- ingenious encoding solution, but it is complicated, hard to
- understand, and hard to implement, using sophisticated techniques
- including insertion unsort coding, generalized variable-length
- integers, and bias adaptation. The resulting encoding is remarkably
- compact given the constraints, but it's still not as good as simple
- straightforward UTF-8, and it's hard even to predict whether a given
- input string will encode to a Punycode string that fits within DNS's
- 63-byte limit, except by simply trying the encoding and seeing
- whether it fits. Indeed, the encoded size depends not only on the
- input characters, but on the order they appear, so the same set of
- characters may or may not encode to a legal Punycode string that fits
- within DNS's 63-byte limit, depending on the order the characters
- appear. This is extremely hard to present in a user interface that
- explains to users why one name is allowed, but another name
- containing the exact same characters is not. Neither Punycode nor any
- other of the "Ascii Compatible Encodings" proposed for Unicast DNS
- may be used in Multicast DNS packets. Any text being represented
- internally in some other representation MUST be converted to
- canonical precomposed UTF-8 before being placed in any Multicast DNS
- packet.
-
- The simple rules for case-insensitivity in Unicast DNS also apply in
- Multicast DNS; that is to say, in name comparisons, the lower-case
- letters "a" to "z" (0x61 to 0x7A) match their upper-case equivalents
- "A" to "Z" (0x41 to 0x5A). Hence, if a client issues a query for an
- address record with the name "cheshire.local", then a responder
- having an address record with the name "Cheshire.local" should
- issue a response. No other automatic equivalences should be assumed.
- In particular all UTF-8 multi-byte characters (codes 0x80 and higher)
- are compared by simple binary comparison of the raw byte values.
-
- No other automatic character equivalence is defined in Multicast DNS.
- For example, accented characters are not defined to be automatically
- equivalent to their unaccented counterparts. Where automatic
- equivalences are desired, this may be achieved through the use of
- programmatically-generated CNAME records. For example, if a responder
- has an address record for an accented name Y, and a client issues a
- query for a name X, where X is the same as Y with all the accents
- removed, then the responder may issue a response containing two
- resource records: A CNAME record "X CNAME Y", asserting that the
- requested name X (unaccented) is an alias for the true (accented)
- name Y, followed by the address record for Y.
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 33]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-18. Multicast DNS Message Size
-
- RFC 1035 restricts DNS Messages carried by UDP to no more than 512
- bytes (not counting the IP or UDP headers). For UDP packets carried
- over the wide-area Internet in 1987, this was appropriate. For
- link-local multicast packets on today's networks, there is no reason
- to retain this restriction. Given that the packets are by definition
- link-local, there are no Path MTU issues to consider.
-
- Multicast DNS Messages carried by UDP may be up to the IP MTU of the
- physical interface, less the space required for the IP header (20
- bytes for IPv4; 40 bytes for IPv6) and the UDP header (8 bytes).
-
- In the case of a single mDNS Resource Record which is too large to
- fit in a single MTU-sized multicast response packet, a Multicast DNS
- Responder SHOULD send the Resource Record alone, in a single IP
- datagram, sent using multiple IP fragments. Resource Records this
- large SHOULD be avoided, except in the very rare cases where they
- really are the appropriate solution to the problem at hand.
- Implementers should be aware that many simple devices do not
- re-assemble fragmented IP datagrams, so large Resource Records SHOULD
- NOT be used except in specialized cases where the implementer knows
- that all receivers implement reassembly.
-
- A Multicast DNS packet larger than the interface MTU, which is sent
- using fragments, MUST NOT contain more than one Resource Record.
-
- Even when fragmentation is used, a Multicast DNS packet, including IP
- and UDP headers, MUST NOT exceed 9000 bytes.
-
-
-19. Multicast DNS Message Format
-
- This section describes specific restrictions on the allowable
- values for the header fields of a Multicast DNS message.
-
-19.1. ID (Query Identifier)
-
- Multicast DNS clients SHOULD listen for gratuitous responses
- issued by hosts booting up (or waking up from sleep or otherwise
- joining the network). Since these gratuitous responses may contain a
- useful answer to a question for which the client is currently
- awaiting an answer, Multicast DNS clients SHOULD examine all received
- Multicast DNS response messages for useful answers, without regard to
- the contents of the ID field or the Question Section. In Multicast
- DNS, knowing which particular query message (if any) is responsible
- for eliciting a particular response message is less interesting than
- knowing whether the response message contains useful information.
-
- Multicast DNS clients MAY cache any or all Multicast DNS response
- messages they receive, for possible future use, provided of course
- that normal TTL aging is performed on these cached resource records.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 34]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- In multicast query messages, the Query ID SHOULD be set to zero on
- transmission.
-
- In multicast responses, including gratuitous multicast responses, the
- Query ID MUST be set to zero on transmission, and MUST be ignored on
- reception.
-
- In unicast response messages generated specifically in response to a
- particular (unicast or multicast) query, the Query ID MUST match the
- ID from the query message.
-
-
-19.2. QR (Query/Response) Bit
-
- In query messages, MUST be zero.
-
- In response messages, MUST be one.
-
-
-19.3. OPCODE
-
- In both multicast query and multicast response messages, MUST be zero
- (only standard queries are currently supported over multicast, unless
- other queries are allowed by future IETF Standards Action).
-
-
-19.4. AA (Authoritative Answer) Bit
-
- In query messages, the Authoritative Answer bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages for Multicast Domains, the Authoritative Answer
- bit MUST be set to one (not setting this bit implies there's some
- other place where "better" information may be found) and MUST be
- ignored on reception.
-
-
-19.5. TC (Truncated) Bit
-
- In query messages, if the TC bit is set, it means that additional
- Known Answer records may be following shortly. A responder MAY choose
- to record this fact, and wait for those additional Known Answer
- records, before deciding whether to respond. If the TC bit is clear,
- it means that the querying host has no additional Known Answers.
-
- In multicast response messages, the TC bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In legacy unicast response messages, the TC bit has the same meaning
- as in conventional unicast DNS: it means that the response was too
- large to fit in a single packet, so the client SHOULD re-issue its
- query using TCP in order to receive the larger response.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 35]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-19.6. RD (Recursion Desired) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Desired bit SHOULD be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.7. RA (Recursion Available) Bit
-
- In both multicast query and multicast response messages, the
- Recursion Available bit MUST be zero on transmission, and MUST be
- ignored on reception.
-
-
-19.8. Z (Zero) Bit
-
- In both query and response messages, the Zero bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.9. AD (Authentic Data) Bit [RFC 2535]
-
- In query messages the Authentic Data bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
- In response messages, the Authentic Data bit MAY be set. Resolvers
- receiving response messages with the AD bit set MUST NOT trust the AD
- bit unless they trust the source of the message and either have a
- secure path to it or use DNS transaction security.
-
-
-19.10. CD (Checking Disabled) Bit [RFC 2535]
-
- In query messages, a resolver willing to do cryptography SHOULD set
- the Checking Disabled bit to permit it to impose its own policies.
-
- In response messages, the Checking Disabled bit MUST be zero on
- transmission, and MUST be ignored on reception.
-
-
-19.11. RCODE (Response Code)
-
- In both multicast query and multicast response messages, the Response
- Code MUST be zero on transmission. Multicast DNS messages received
- with non-zero Response Codes MUST be silently ignored.
-
-
-19.12. Repurposing of top bit of qclass in Question Section
-
- In the Question Section of a Multicast DNS Query, the top bit of the
- qclass field is used to indicate that unicast responses are preferred
- for this particular question.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 36]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-19.12. Repurposing of top bit of rrclass in Answer Section
-
- In the Answer Section of a Multicast DNS Response, the top bit of the
- rrclass field is used to indicate that the record is a member of a
- unique RRSet, and the entire RRSet has been sent together (in the
- same packet, or in consecutive packets if there are too many records
- to fit in a single packet).
-
-
-20. Choice of UDP Port Number
-
- Arguments were made for and against using Multicast on UDP port 53.
- The final decision was to use UDP port 5353. Some of the arguments
- for and against are given below.
-
-
-20.1 Arguments for using UDP port 53:
-
- * This is "just DNS", so it should be the same port.
-
- * There is less work to be done updating old clients to do simple
- mDNS queries. Only the destination address need be changed.
- In some cases, this can be achieved without any code changes,
- just by adding the address 224.0.0.251 to a configuration file.
-
-
-20.2 Arguments for using a different port (UDP port 5353):
-
- * This is not "just DNS". This is a DNS-like protocol, but different.
-
- * Changing client code to use a different port number is not hard.
-
- * Using the same port number makes it hard to run an mDNS Responder
- and a conventional unicast DNS server on the same machine. If a
- conventional unicast DNS server wishes to implement mDNS as well,
- it can still do that, by opening two sockets. Having two different
- port numbers is important to allow this flexibility.
-
- * Some VPN software hijacks all outgoing traffic to port 53 and
- redirects it to a special DNS server set up to serve those VPN
- clients while they are connected to the corporate network. It is
- questionable whether this is the right thing to do, but it is
- common, and redirecting link-local multicast DNS packets to a
- remote server rarely produces any useful results. It does mean, for
- example, that the user becomes unable to access their local network
- printer sitting on their desk right next to their computer. Using
- a different UDP port eliminates this particular problem.
-
- * On many operating systems, unprivileged clients may not send or
- receive packets on low-numbered ports. This means that any client
- sending or receiving mDNS packets on port 53 would have to run as
- "root", which is an undesirable security risk. Using a higher-
- numbered UDP port eliminates this particular problem.
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 37]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- Continuing the previous point, since using an unprivileged port
- allows normal user-level code to bind, a given machine may have more
- than one such user-level application running at a time. Because of
- this, any code binding to UDP port 5353 MUST use the SO_REUSEPORT
- option, so as to be a good citizen and not block other clients on the
- machine from also binding to that port.
-
-
-21. Summary of Differences Between Multicast DNS and Unicast DNS
-
- The value of Multicast DNS is that it shares, as much as possible,
- the familiar APIs, naming syntax, resource record types, etc., of
- Unicast DNS. There are of course necessary differences by virtue of
- it using Multicast, and by virtue of it operating in a community of
- cooperating peers, rather than a precisely defined authoritarian
- hierarchy controlled by a strict chain of formal delegations from the
- top. These differences are listed below:
-
- Multicast DNS...
- * uses multicast
- * uses UDP port 5353 instead of port 53
- * operates in well-defined parts of the DNS namespace
- * uses UTF-8, and only UTF-8, to encode resource record names
- * defines a clear limit on the maximum legal domain name (255 bytes)
- * allows larger UDP packets
- * allows more than one question in a query packet
- * uses the Answer Section of a query to list Known Answers
- * uses the TC bit in a query to indicate additional Known Answers
- * uses the Authority Section of a query for probe tie-breaking
- * ignores the Query ID field (except for generating legacy responses)
- * doesn't require the question to be repeated in the response packet
- * uses gratuitous responses to announce new records to the peer group
- * defines a "unicast response" bit in the rrclass of query questions
- * defines a "cache flush" bit in the rrclass of response answers
- * uses DNS TTL 0 to indicate that a record has been deleted
- * monitors queries to perform Duplicate Question Suppression
- * monitors responses to perform Duplicate Answer Suppression...
- * ... and Ongoing Conflict Detection
- * ... and Opportunistic Caching
-
-
-22. Benefits of Multicast Responses
-
- Some people have argued that sending responses via multicast is
- inefficient on the network. In fact the benefits of using multicast
- responses result in a net lowering of overall multicast traffic, for
- a variety of reasons.
-
- * One multicast response can update the cache on all machines on the
- network. If another machine later wants to issue the same query, it
- already has the answer in its cache, so it may not need to even
- transmit that multicast query on the network at all.
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 38]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- * When more than one machine has the same ongoing long-lived query
- running, every machine does not have to transmit its own
- independent query. When one machine transmits a query, all the
- other hosts see the answers, so they can suppress their own
- queries.
-
- * When a host sees a multicast query, but does not see the
- corresponding multicast response, it can use this information to
- promptly delete stale data from its cache. To achieve the same
- level of user-interface quality and responsiveness without
- multicast responses would require lower cache lifetimes and more
- frequent network polling, resulting in a significantly higher
- packet rate.
-
- * Multicast responses allow passive conflict detection. Without this
- ability, some other conflict detection mechanism would be needed,
- imposing its own additional burden on the network.
-
- * When using delayed responses to reduce network collisions, clients
- need to maintain a list recording to whom each answer should be
- sent. The option of multicast responses allows clients with limited
- storage, which cannot store an arbitrarily long list of response
- addresses, to choose to fail-over to a single multicast response in
- place of multiple unicast responses, when appropriate.
-
- * In the case of overlayed subnets and other misconfigurations,
- multicast responses allow a receiver to know with certainty that
- a response originated on the local link, even when its source
- address may apparently suggest otherwise. This can be extremely
- helpful when diagnosing and rectifying network problems, since
- it facilitates a direct communication channel between client and
- server that works without reliance on ARP, IP routing tables, etc.
- Being able to discover what IP address a device has (or thinks it
- has) is frequently a very valuable first step in diagnosing why
- it unable to communicate on the local network.
-
-
-23. IPv6 Considerations
-
- An IPv4-only host and an IPv6-only host behave as "ships that pass in
- the night". Even if they are on the same Ethernet, neither is aware
- of the other's traffic. For this reason, each physical link may have
- *two* unrelated ".local." zones, one for IPv4 and one for IPv6.
- Since for practical purposes, a group of IPv4-only hosts and a group
- of IPv6-only hosts on the same Ethernet act as if they were on two
- entirely separate Ethernet segments, it is unsurprising that their
- use of the ".local." zone should occur exactly as it would if
- they really were on two entirely separate Ethernet segments.
-
- A dual-stack (v4/v6) host can participate in both ".local."
- zones, and should register its name(s) and perform its lookups both
- using IPv4 and IPv6. This enables it to reach, and be reached by,
- both IPv4-only and IPv6-only hosts. In effect this acts like a
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 39]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- multi-homed host, with one connection to the logical "IPv4 Ethernet
- segment", and a connection to the logical "IPv6 Ethernet segment".
-
-23.1 IPv6 Multicast Addresses by Hashing
-
- Some discovery protocols use a range of multicast addresses, and
- determine the address to be used by a hash function of the name being
- sought. Queries are sent via multicast to the address as indicated by
- the hash function, and responses are returned to the querier via
- unicast. Particularly in IPv6, where multicast addresses are
- extremely plentiful, this approach is frequently advocated.
-
- There are some problems with this:
-
- * When a host has a large number of records with different names, the
- host may have to join a large number of multicast groups. This can
- place undue burden on the Ethernet hardware, which typically
- supports a limited number of multicast addresses efficiently. When
- this number is exceeded, the Ethernet hardware may have to resort
- to receiving all multicasts and passing them up to the host
- software for filtering, thereby defeating the point of using a
- multicast address range in the first place.
-
- * Multiple questions cannot be placed in one packet if they don't all
- hash to the same multicast address.
-
- * Duplicate Question Suppression doesn't work if queriers are not
- seeing each other's queries.
-
- * Duplicate Answer Suppression doesn't work if responders are not
- seeing each other's responses.
-
- * Opportunistic Caching doesn't work.
-
- * Ongoing Conflict Detection doesn't work.
-
-
-24. Security Considerations
-
- The algorithm for detecting and resolving name conflicts is, by its
- very nature, an algorithm that assumes cooperating participants. Its
- purpose is to allow a group of hosts to arrive at a mutually disjoint
- set of host names and other DNS resource record names, in the absence
- of any central authority to coordinate this or mediate disputes. In
- the absence of any higher authority to resolve disputes, the only
- alternative is that the participants must work together cooperatively
- to arrive at a resolution.
-
- In an environment where the participants are mutually antagonistic
- and unwilling to cooperate, other mechanisms are appropriate, like
- manually administered DNS.
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 40]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- In an environment where there is a group of cooperating participants,
- but there may be other antagonistic participants on the same physical
- link, the cooperating participants need to use IPSEC signatures
- and/or DNSSEC [RFC 2535] signatures so that they can distinguish mDNS
- messages from trusted participants (which they process as usual) from
- mDNS messages from untrusted participants (which they silently
- discard).
-
- When DNS queries for *global* DNS names are sent to the mDNS
- multicast address (during network outages which disrupt communication
- with the greater Internet) it is *especially* important to use
- DNSSEC, because the user may have the impression that he or she is
- communicating with some authentic host, when in fact he or she is
- really communicating with some local host that is merely masquerading
- as that name. This is less critical for names ending with ".local.",
- because the user should be aware that those names have only local
- significance and no global authority is implied.
-
- Most computer users neglect to type the trailing dot at the end of a
- fully qualified domain name, making it a relative domain name (e.g.
- "www.example.com"). In the event of network outage, attempts to
- positively resolve the name as entered will fail, resulting in
- application of the search list, including ".local.", if present.
- A malicious host could masquerade as "www.example.com" by answering
- the resulting Multicast DNS query for "www.example.com.local."
- To avoid this, a host MUST NOT append the search suffix
- ".local.", if present, to any relative (partially qualified)
- domain name containing two or more labels. Appending ".local." to
- single-label relative domain names is acceptable, since the user
- should have no expectation that a single-label domain name will
- resolve as-is.
-
-
-25. IANA Considerations
-
- IANA has allocated the IPv4 link-local multicast address 224.0.0.251
- for the use described in this document.
-
- IANA has allocated the IPv6 multicast address set FF0X::FB for the
- use described in this document. Only address FF02::FB (Link-Local
- Scope) is currently in use by deployed software, but it is possible
- that in future implementers may experiment with Multicast DNS using
- larger-scoped addresses, such as FF05::FB (Site-Local Scope).
-
- When this document is published, IANA should designate a list of
- domains which are deemed to have only link-local significance, as
- described in Section 12 of this document ("Special Characteristics of
- Multicast DNS Domains").
-
- The re-use of the top bit of the rrclass field in the Question and
- Answer Sections means that Multicast DNS can only carry DNS records
- with classes in the range 0-32767. Classes in the range 32768 to
- 65535 are incompatible with Multicast DNS. However, since to-date
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 41]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- only three DNS classes have been assigned by IANA (1, 3 and 4),
- and only one (1, "Internet") is actually in widespread use, this
- limitation is likely to remain a purely theoretical one.
-
- No other IANA services are required by this document.
-
-
-26. Acknowledgments
-
- The concepts described in this document have been explored, developed
- and implemented with help from Freek Dijkstra, Erik Guttman, Paul
- Vixie, Bill Woodcock, and others.
-
- Special thanks go to Bob Bradley, Josh Graessley, Scott Herscher,
- Roger Pantos and Kiren Sekar for their significant contributions.
-
-
-27. Copyright
-
- Copyright (C) The Internet Society 2005.
- All Rights Reserved.
-
- This document and translations of it may be copied and furnished to
- others, and derivative works that comment on or otherwise explain it
- or assist in its implementation may be prepared, copied, published
- and distributed, in whole or in part, without restriction of any
- kind, provided that the above copyright notice and this paragraph are
- included on all such copies and derivative works. However, this
- document itself may not be modified in any way, such as by removing
- the copyright notice or references to the Internet Society or other
- Internet organizations, except as needed for the purpose of
- developing Internet standards in which case the procedures for
- copyrights defined in the Internet Standards process must be
- followed, or as required to translate it into languages other than
- English.
-
- The limited permissions granted above are perpetual and will not be
- revoked by the Internet Society or its successors or assigns.
-
- This document and the information contained herein is provided on an
- "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-28. Normative References
-
- [RFC 1034] Mockapetris, P., "Domain Names - Concepts and
- Facilities", STD 13, RFC 1034, November 1987.
-
- [RFC 1035] Mockapetris, P., "Domain Names - Implementation and
- Specifications", STD 13, RFC 1035, November 1987.
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 42]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
- [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate
- Requirement Levels", RFC 2119, March 1997.
-
- [RFC 3629] Yergeau, F., "UTF-8, a transformation format of ISO
- 10646", RFC 3629, November 2003.
-
-
-29. Informative References
-
- [dotlocal] <http://www.dotlocal.org/>
-
- [djbdl] <http://cr.yp.to/djbdns/dot-local.html>
-
- [DNS-SD] Cheshire, S., and M. Krochmal, "DNS-Based Service
- Discovery", Internet-Draft (work in progress),
- draft-cheshire-dnsext-dns-sd-03.txt, June 2005.
-
- [IEEE802] IEEE Standards for Local and Metropolitan Area Networks:
- Overview and Architecture.
- Institute of Electrical and Electronic Engineers,
- IEEE Standard 802, 1990.
-
- [NBP] Cheshire, S., and M. Krochmal,
- "Requirements for a Protocol to Replace AppleTalk NBP",
- Internet-Draft (work in progress),
- draft-cheshire-dnsext-nbp-04.txt, June 2005.
-
- [RFC 2136] Vixie, P., et al., "Dynamic Updates in the Domain Name
- System (DNS UPDATE)", RFC 2136, April 1997.
-
- [RFC 2462] S. Thomson and T. Narten, "IPv6 Stateless Address
- Autoconfiguration", RFC 2462, December 1998.
-
- [RFC 2535] Eastlake, D., "Domain Name System Security Extensions",
- RFC 2535, March 1999.
-
- [RFC 3492] Costello, A., "Punycode: A Bootstring encoding of
- Unicode for use with Internationalized Domain Names
- in Applications (IDNA)", RFC 3492, March 2003.
-
- [RFC 3927] Cheshire, S., B. Aboba, and E. Guttman,
- "Dynamic Configuration of IPv4 Link-Local Addresses",
- RFC 3927, May 2005.
-
- [ZC] Williams, A., "Requirements for Automatic Configuration
- of IP Hosts", Internet-Draft (work in progress),
- draft-ietf-zeroconf-reqts-12.txt, September 2002.
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 43]
-
-Internet Draft Multicast DNS 7th June 2005
-
-
-30. Authors' Addresses
-
- Stuart Cheshire
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 3207
- EMail: rfc@stuartcheshire.org
-
-
- Marc Krochmal
- Apple Computer, Inc.
- 1 Infinite Loop
- Cupertino
- California 95014
- USA
-
- Phone: +1 408 974 4368
- EMail: marc@apple.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Expires 7th December 2005 Cheshire & Krochmal [Page 44]
diff --git a/trunk/tests/Makefile.am b/trunk/tests/Makefile.am
deleted file mode 100644
index c91cea4..0000000
--- a/trunk/tests/Makefile.am
+++ /dev/null
@@ -1,55 +0,0 @@
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-AM_CFLAGS= \
- -I$(top_srcdir)
-
-if HAVE_GLIB
-if HAVE_DBUS
-if HAVE_NETLINK
-
-if ENABLE_TESTS
-noinst_PROGRAMS = c-plus-plus-test
-endif
-
-c_plus_plus_test_SOURCES = c-plus-plus-test.cc
-
-c_plus_plus_test_CXXFLAGS = \
- $(AM_CFLAGS) \
- $(GLIB20_CFLAGS) \
- $(DBUS_CFLAGS)
-
-c_plus_plus_test_LDADD = \
- $(AM_LDADD) \
- ../avahi-common/libavahi-common.la \
- ../avahi-core/libavahi-core.la \
- ../avahi-client/libavahi-client.la \
- ../avahi-glib/libavahi-glib.la \
- $(GLIB20_LIBS) \
- $(DBUS_LIBS)
-
-endif
-endif
-endif
-
-EXTRA_DIST=c-plus-plus-test-gen.py
-
-gen:
- python ./c-plus-plus-test-gen.py avahi-common avahi-core avahi-client avahi-glib > c-plus-plus-test.cc
-
diff --git a/trunk/tests/c-plus-plus-test-gen.py b/trunk/tests/c-plus-plus-test-gen.py
deleted file mode 100755
index 46d6762..0000000
--- a/trunk/tests/c-plus-plus-test-gen.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python
-
-# $Id$
-#
-# This file is part of avahi.
-#
-# avahi is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as
-# published by the Free Software Foundation; either version 2 of the
-# License, or (at your option) any later version.
-#
-# avahi is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with avahi; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA.
-
-import os, sys
-
-def print_includes(dir):
-
- files = os.listdir("../%s" % dir)
- files = filter(lambda fn: fn.endswith(".h") and not fn.startswith("."), files)
- files.sort()
-
- for f in files:
- print "#include <%s/%s>" % (dir, f)
-
-
-print """/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-"""
-
-for f in sys.argv[1:]:
- print_includes(f)
-
-print """
-int main(int argc, char*argv[]) {
- return 0;
-}
-"""
diff --git a/trunk/tests/c-plus-plus-test.cc b/trunk/tests/c-plus-plus-test.cc
deleted file mode 100644
index 947aa44..0000000
--- a/trunk/tests/c-plus-plus-test.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $Id$ */
-
-/***
- This file is part of avahi.
-
- avahi is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- avahi is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
- Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with avahi; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- USA.
-***/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <avahi-common/address.h>
-#include <avahi-common/alternative.h>
-#include <avahi-common/cdecl.h>
-#include <avahi-common/dbus-watch-glue.h>
-#include <avahi-common/dbus.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/domain.h>
-#include <avahi-common/error.h>
-#include <avahi-common/gccmacro.h>
-#include <avahi-common/llist.h>
-#include <avahi-common/malloc.h>
-#include <avahi-common/rlist.h>
-#include <avahi-common/simple-watch.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/watch.h>
-#include <avahi-core/addr-util.h>
-#include <avahi-core/announce.h>
-#include <avahi-core/browse.h>
-#include <avahi-core/cache.h>
-#include <avahi-core/core.h>
-#include <avahi-core/dns-srv-rr.h>
-#include <avahi-core/dns.h>
-#include <avahi-core/domain-util.h>
-#include <avahi-core/fdutil.h>
-#include <avahi-core/hashmap.h>
-#include <avahi-core/iface-linux.h>
-#include <avahi-core/iface.h>
-#include <avahi-core/internal.h>
-#include <avahi-core/log.h>
-#include <avahi-core/lookup.h>
-#include <avahi-core/multicast-lookup.h>
-#include <avahi-core/netlink.h>
-#include <avahi-core/prioq.h>
-#include <avahi-core/probe-sched.h>
-#include <avahi-core/publish.h>
-#include <avahi-core/querier.h>
-#include <avahi-core/query-sched.h>
-#include <avahi-core/response-sched.h>
-#include <avahi-core/rr-util.h>
-#include <avahi-core/rr.h>
-#include <avahi-core/rrlist.h>
-#include <avahi-core/socket.h>
-#include <avahi-core/timeeventq.h>
-#include <avahi-core/util.h>
-#include <avahi-core/wide-area.h>
-#include <avahi-client/client.h>
-#include <avahi-client/internal.h>
-#include <avahi-client/lookup.h>
-#include <avahi-client/publish.h>
-#include <avahi-client/xdg-config.h>
-#include <avahi-glib/glib-malloc.h>
-#include <avahi-glib/glib-watch.h>
-
-int main(int argc, char*argv[]) {
- return 0;
-}
-
diff --git a/trunk/tests/fuzz-mdns.py b/trunk/tests/fuzz-mdns.py
deleted file mode 100755
index aeea295..0000000
--- a/trunk/tests/fuzz-mdns.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/python
-
-from scapy import *
-
-
-sendp(Ether(type=0x800, dst="ff:ff:ff:ff:ff:ff")/IP(dst="224.0.0.251")/fuzz(UDP(dport = 5353, sport = 5353)/DNS(qd = fuzz(DNSQR()))),loop=1, iface="realtek0")
-
-