aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ginda <rginda@google.com>2015-08-07 14:59:25 -0700
committerRobert Ginda <rginda@google.com>2015-08-07 14:59:25 -0700
commite20cc505b5c07fe58ecc9a5b691cbb7be6f9ca89 (patch)
treec2d068abf03960b95021bfa1677b5057b09d7bbc
parentc1b5e2388d4149166c7790ac5adbd719ccc733da (diff)
parent6ae383f24246a37a63c793bf7971d50f05158a4d (diff)
downloadavahi-e20cc505b5c07fe58ecc9a5b691cbb7be6f9ca89.tar.gz
Import avahi into the Android tree.
Import Avahi mDNS library from git://git.0pointer.net/avahi.git. At the time of the import, the avahi HEAD was 147cdce70b22ae7cee9fb4fe123db40952f31c9e Committed on 2013-03-11. Bug: 22827641
-rw-r--r--.dir-locals.el7
-rw-r--r--.gitignore34
-rw-r--r--LICENSE510
-rw-r--r--MODULE_LICENSE_LGPL0
-rw-r--r--Makefile.am243
-rw-r--r--NOTICE508
-rw-r--r--README34
-rw-r--r--acinclude.m41
-rwxr-xr-xautogen.sh77
-rw-r--r--avahi-autoipd/.gitignore9
-rw-r--r--avahi-autoipd/Makefile.am94
-rwxr-xr-xavahi-autoipd/avahi-autoipd.action.bsd48
-rwxr-xr-xavahi-autoipd/avahi-autoipd.action.linux87
-rwxr-xr-xavahi-autoipd/dhclient-enter-hook.in31
-rwxr-xr-xavahi-autoipd/dhclient-exit-hook.in31
-rw-r--r--avahi-autoipd/iface-bsd.c440
-rw-r--r--avahi-autoipd/iface-linux.c332
-rw-r--r--avahi-autoipd/iface.h45
-rw-r--r--avahi-autoipd/main.c1714
-rw-r--r--avahi-autoipd/main.h45
-rw-r--r--avahi-client.pc.in10
-rw-r--r--avahi-client/.gitignore12
-rw-r--r--avahi-client/Makefile.am83
-rw-r--r--avahi-client/browser.c1025
-rw-r--r--avahi-client/check-nss-test.c31
-rw-r--r--avahi-client/check-nss.c55
-rw-r--r--avahi-client/client-test.c328
-rw-r--r--avahi-client/client.c958
-rw-r--r--avahi-client/client.h117
-rw-r--r--avahi-client/entrygroup.c890
-rw-r--r--avahi-client/internal.h172
-rw-r--r--avahi-client/lookup.h314
-rw-r--r--avahi-client/publish.h172
-rw-r--r--avahi-client/resolver.c778
-rw-r--r--avahi-client/rr-test.c111
-rw-r--r--avahi-client/srv-test.c76
-rw-r--r--avahi-client/xdg-config-test.c38
-rw-r--r--avahi-client/xdg-config.c68
-rw-r--r--avahi-client/xdg-config.h27
-rw-r--r--avahi-common/.gitignore14
-rw-r--r--avahi-common/Makefile.am129
-rw-r--r--avahi-common/address.c155
-rw-r--r--avahi-common/address.h119
-rw-r--r--avahi-common/alternative-test.c90
-rw-r--r--avahi-common/alternative.c182
-rw-r--r--avahi-common/alternative.h43
-rw-r--r--avahi-common/cdecl.h38
-rw-r--r--avahi-common/dbus-watch-glue.c357
-rw-r--r--avahi-common/dbus-watch-glue.h33
-rw-r--r--avahi-common/dbus.c138
-rw-r--r--avahi-common/dbus.h119
-rw-r--r--avahi-common/defs.h356
-rw-r--r--avahi-common/domain-test.c123
-rw-r--r--avahi-common/domain.c609
-rw-r--r--avahi-common/domain.h129
-rw-r--r--avahi-common/error.c97
-rw-r--r--avahi-common/error.h107
-rw-r--r--avahi-common/gccmacro.h74
-rw-r--r--avahi-common/i18n.c38
-rw-r--r--avahi-common/i18n.h53
-rw-r--r--avahi-common/llist.h75
-rw-r--r--avahi-common/malloc.c257
-rw-r--r--avahi-common/malloc.h96
-rw-r--r--avahi-common/rlist.c62
-rw-r--r--avahi-common/rlist.h49
-rw-r--r--avahi-common/simple-watch.c649
-rw-r--r--avahi-common/simple-watch.h85
-rw-r--r--avahi-common/strlst-test.c127
-rw-r--r--avahi-common/strlst.c505
-rw-r--r--avahi-common/strlst.h180
-rw-r--r--avahi-common/thread-watch.c186
-rw-r--r--avahi-common/thread-watch.h80
-rw-r--r--avahi-common/timeval-test.c43
-rw-r--r--avahi-common/timeval.c123
-rw-r--r--avahi-common/timeval.h54
-rw-r--r--avahi-common/utf8-test.c37
-rw-r--r--avahi-common/utf8.c110
-rw-r--r--avahi-common/utf8.h33
-rw-r--r--avahi-common/watch-test.c115
-rw-r--r--avahi-common/watch.h97
-rw-r--r--avahi-compat-howl.pc.in10
-rw-r--r--avahi-compat-howl/.gitignore11
-rw-r--r--avahi-compat-howl/Makefile.am109
-rw-r--r--avahi-compat-howl/address-test.c51
-rw-r--r--avahi-compat-howl/address.c212
-rw-r--r--avahi-compat-howl/browse-domain-test.c74
-rw-r--r--avahi-compat-howl/compat.c1182
-rw-r--r--avahi-compat-howl/funcs.txt182
-rw-r--r--avahi-compat-howl/include/corby/buffer.h330
-rw-r--r--avahi-compat-howl/include/corby/channel.h186
-rw-r--r--avahi-compat-howl/include/corby/corby.h68
-rw-r--r--avahi-compat-howl/include/corby/message.h60
-rw-r--r--avahi-compat-howl/include/corby/object.h113
-rw-r--r--avahi-compat-howl/include/corby/orb.h199
-rw-r--r--avahi-compat-howl/include/discovery/discovery.h327
-rw-r--r--avahi-compat-howl/include/discovery/text_record.h143
-rw-r--r--avahi-compat-howl/include/howl.h44
-rw-r--r--avahi-compat-howl/include/rendezvous/rendezvous.h101
-rw-r--r--avahi-compat-howl/include/rendezvous/text_record.h36
-rw-r--r--avahi-compat-howl/include/salt/address.h128
-rw-r--r--avahi-compat-howl/include/salt/debug.h230
-rw-r--r--avahi-compat-howl/include/salt/interface.h115
-rw-r--r--avahi-compat-howl/include/salt/platform.h438
-rw-r--r--avahi-compat-howl/include/salt/salt.h215
-rw-r--r--avahi-compat-howl/include/salt/signal.h61
-rw-r--r--avahi-compat-howl/include/salt/socket.h263
-rw-r--r--avahi-compat-howl/include/salt/time.h100
-rw-r--r--avahi-compat-howl/samples/.gitignore3
-rw-r--r--avahi-compat-howl/samples/Makefile.am51
-rw-r--r--avahi-compat-howl/samples/browse.c184
-rw-r--r--avahi-compat-howl/samples/publish.c110
-rw-r--r--avahi-compat-howl/samples/query.c98
-rw-r--r--avahi-compat-howl/samples/resolve.c111
-rw-r--r--avahi-compat-howl/text-test.c97
-rw-r--r--avahi-compat-howl/text.c259
-rw-r--r--avahi-compat-howl/unsupported.c1019
-rw-r--r--avahi-compat-howl/warn.c29
-rw-r--r--avahi-compat-howl/warn.h33
-rw-r--r--avahi-compat-libdns_sd.pc.in10
-rw-r--r--avahi-compat-libdns_sd/.gitignore9
-rw-r--r--avahi-compat-libdns_sd/Makefile.am73
-rw-r--r--avahi-compat-libdns_sd/compat.c1372
-rw-r--r--avahi-compat-libdns_sd/dns_sd.h1722
-rw-r--r--avahi-compat-libdns_sd/funcs.txt35
-rw-r--r--avahi-compat-libdns_sd/null-test.c71
-rw-r--r--avahi-compat-libdns_sd/txt-test.c128
-rw-r--r--avahi-compat-libdns_sd/txt.c489
-rw-r--r--avahi-compat-libdns_sd/unsupported.c90
-rw-r--r--avahi-compat-libdns_sd/warn.c124
-rw-r--r--avahi-compat-libdns_sd/warn.h36
-rw-r--r--avahi-core.pc.in10
-rw-r--r--avahi-core/.gitignore17
-rw-r--r--avahi-core/Makefile.am173
-rw-r--r--avahi-core/addr-util.c94
-rw-r--r--avahi-core/addr-util.h47
-rw-r--r--avahi-core/announce.c524
-rw-r--r--avahi-core/announce.h69
-rw-r--r--avahi-core/avahi-reflector.c61
-rw-r--r--avahi-core/avahi-test.c402
-rw-r--r--avahi-core/browse-dns-server.c322
-rw-r--r--avahi-core/browse-domain.c235
-rw-r--r--avahi-core/browse-service-type.c157
-rw-r--r--avahi-core/browse-service.c167
-rw-r--r--avahi-core/browse.c613
-rw-r--r--avahi-core/browse.h60
-rw-r--r--avahi-core/cache.c513
-rw-r--r--avahi-core/cache.h101
-rw-r--r--avahi-core/conformance-test.c158
-rw-r--r--avahi-core/core.h165
-rw-r--r--avahi-core/dns-spin-test.c122
-rw-r--r--avahi-core/dns-srv-rr.h87
-rw-r--r--avahi-core/dns-test.c113
-rw-r--r--avahi-core/dns.c877
-rw-r--r--avahi-core/dns.h111
-rw-r--r--avahi-core/domain-util.c188
-rw-r--r--avahi-core/domain-util.h45
-rw-r--r--avahi-core/entry.c1233
-rw-r--r--avahi-core/fdutil.c72
-rw-r--r--avahi-core/fdutil.h33
-rwxr-xr-xavahi-core/findstatic.pl70
-rw-r--r--avahi-core/hashmap-test.c62
-rw-r--r--avahi-core/hashmap.c248
-rw-r--r--avahi-core/hashmap.h53
-rw-r--r--avahi-core/iface-linux.c391
-rw-r--r--avahi-core/iface-linux.h40
-rw-r--r--avahi-core/iface-none.c30
-rw-r--r--avahi-core/iface-pfroute.c543
-rw-r--r--avahi-core/iface-pfroute.h37
-rw-r--r--avahi-core/iface.c865
-rw-r--r--avahi-core/iface.h195
-rw-r--r--avahi-core/internal.h227
-rw-r--r--avahi-core/log.c86
-rw-r--r--avahi-core/log.h73
-rw-r--r--avahi-core/lookup.h235
-rw-r--r--avahi-core/multicast-lookup.c350
-rw-r--r--avahi-core/multicast-lookup.h51
-rw-r--r--avahi-core/netlink.c208
-rw-r--r--avahi-core/netlink.h41
-rw-r--r--avahi-core/prioq-test.c120
-rw-r--r--avahi-core/prioq.c388
-rw-r--r--avahi-core/prioq.h49
-rw-r--r--avahi-core/probe-sched.c397
-rw-r--r--avahi-core/probe-sched.h34
-rw-r--r--avahi-core/publish.h175
-rw-r--r--avahi-core/querier-test.c122
-rw-r--r--avahi-core/querier.c268
-rw-r--r--avahi-core/querier.h48
-rw-r--r--avahi-core/query-sched.c450
-rw-r--r--avahi-core/query-sched.h36
-rw-r--r--avahi-core/resolve-address.c268
-rw-r--r--avahi-core/resolve-host-name.c297
-rw-r--r--avahi-core/resolve-service.c489
-rw-r--r--avahi-core/response-sched.c511
-rw-r--r--avahi-core/response-sched.h37
-rw-r--r--avahi-core/rr-util.h62
-rw-r--r--avahi-core/rr.c733
-rw-r--r--avahi-core/rr.h175
-rw-r--r--avahi-core/rrlist.c188
-rw-r--r--avahi-core/rrlist.h40
-rw-r--r--avahi-core/server.c1805
-rw-r--r--avahi-core/socket.c993
-rw-r--r--avahi-core/socket.h47
-rw-r--r--avahi-core/timeeventq-test.c67
-rw-r--r--avahi-core/timeeventq.c225
-rw-r--r--avahi-core/timeeventq.h46
-rw-r--r--avahi-core/update-test.c91
-rw-r--r--avahi-core/util.c120
-rw-r--r--avahi-core/util.h41
-rw-r--r--avahi-core/wide-area.c723
-rw-r--r--avahi-core/wide-area.h52
-rw-r--r--avahi-daemon/.gitignore11
-rw-r--r--avahi-daemon/Makefile.am176
-rw-r--r--avahi-daemon/avahi-daemon.conf68
-rw-r--r--avahi-daemon/avahi-daemon.service.in32
-rw-r--r--avahi-daemon/avahi-daemon.socket.in25
-rw-r--r--avahi-daemon/avahi-dbus.conf.in32
-rw-r--r--avahi-daemon/avahi-service.dtd18
-rw-r--r--avahi-daemon/caps.c115
-rw-r--r--avahi-daemon/caps.h27
-rw-r--r--avahi-daemon/chroot.c415
-rw-r--r--avahi-daemon/chroot.h34
-rw-r--r--avahi-daemon/dbus-async-address-resolver.c142
-rw-r--r--avahi-daemon/dbus-async-host-name-resolver.c140
-rw-r--r--avahi-daemon/dbus-async-service-resolver.c179
-rw-r--r--avahi-daemon/dbus-domain-browser.c132
-rw-r--r--avahi-daemon/dbus-entry-group.c369
-rw-r--r--avahi-daemon/dbus-internal.h256
-rw-r--r--avahi-daemon/dbus-protocol.c1226
-rw-r--r--avahi-daemon/dbus-protocol.h32
-rw-r--r--avahi-daemon/dbus-record-browser.c164
-rw-r--r--avahi-daemon/dbus-service-browser.c144
-rw-r--r--avahi-daemon/dbus-service-type-browser.c134
-rw-r--r--avahi-daemon/dbus-sync-address-resolver.c96
-rw-r--r--avahi-daemon/dbus-sync-host-name-resolver.c96
-rw-r--r--avahi-daemon/dbus-sync-service-resolver.c135
-rw-r--r--avahi-daemon/dbus-util.c435
-rw-r--r--avahi-daemon/dbus-util.h57
-rw-r--r--avahi-daemon/example.service50
-rw-r--r--avahi-daemon/hosts27
-rw-r--r--avahi-daemon/ini-file-parser-test.c62
-rw-r--r--avahi-daemon/ini-file-parser.c196
-rw-r--r--avahi-daemon/ini-file-parser.h55
-rw-r--r--avahi-daemon/introspect.dtd37
-rw-r--r--avahi-daemon/introspect.xsl102
-rw-r--r--avahi-daemon/main.c1701
-rw-r--r--avahi-daemon/main.h31
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.AddressResolver.xml50
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.DomainBrowser.xml59
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.EntryGroup.xml101
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.HostNameResolver.xml50
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.RecordBrowser.xml65
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.Server.xml219
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.ServiceBrowser.xml63
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.ServiceResolver.xml55
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.ServiceTypeBrowser.xml61
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.service24
-rw-r--r--avahi-daemon/sd-daemon.c436
-rw-r--r--avahi-daemon/sd-daemon.h265
-rw-r--r--avahi-daemon/setproctitle.c111
-rw-r--r--avahi-daemon/setproctitle.h28
-rw-r--r--avahi-daemon/sftp-ssh.service34
-rw-r--r--avahi-daemon/simple-protocol.c568
-rw-r--r--avahi-daemon/simple-protocol.h29
-rw-r--r--avahi-daemon/ssh.service34
-rw-r--r--avahi-daemon/static-hosts.c278
-rw-r--r--avahi-daemon/static-hosts.h28
-rw-r--r--avahi-daemon/static-services.c744
-rw-r--r--avahi-daemon/static-services.h28
-rw-r--r--avahi-discover-standalone/.gitignore8
-rw-r--r--avahi-discover-standalone/Makefile.am69
-rw-r--r--avahi-discover-standalone/avahi-discover.ui84
-rw-r--r--avahi-discover-standalone/main.c368
-rw-r--r--avahi-dnsconfd/.gitignore2
-rw-r--r--avahi-dnsconfd/Makefile.am53
-rwxr-xr-xavahi-dnsconfd/avahi-dnsconfd.action80
-rw-r--r--avahi-dnsconfd/avahi-dnsconfd.service.in29
-rw-r--r--avahi-dnsconfd/main.c668
-rw-r--r--avahi-glib.pc.in11
-rw-r--r--avahi-glib/.gitignore8
-rw-r--r--avahi-glib/Makefile.am53
-rw-r--r--avahi-glib/glib-malloc.c55
-rw-r--r--avahi-glib/glib-malloc.h39
-rw-r--r--avahi-glib/glib-watch-test.c89
-rw-r--r--avahi-glib/glib-watch.c402
-rw-r--r--avahi-glib/glib-watch.h54
-rw-r--r--avahi-gobject.pc.in11
-rw-r--r--avahi-gobject/.gitignore14
-rw-r--r--avahi-gobject/AvahiCore-0.6.gir61
-rw-r--r--avahi-gobject/Makefile.am142
-rw-r--r--avahi-gobject/ga-client.c256
-rw-r--r--avahi-gobject/ga-client.h78
-rw-r--r--avahi-gobject/ga-entry-group.c626
-rw-r--r--avahi-gobject/ga-entry-group.h174
-rw-r--r--avahi-gobject/ga-enums.h70
-rw-r--r--avahi-gobject/ga-error.c32
-rw-r--r--avahi-gobject/ga-error.h33
-rw-r--r--avahi-gobject/ga-record-browser.c381
-rw-r--r--avahi-gobject/ga-record-browser.h74
-rw-r--r--avahi-gobject/ga-service-browser.c372
-rw-r--r--avahi-gobject/ga-service-browser.h71
-rw-r--r--avahi-gobject/ga-service-resolver.c403
-rw-r--r--avahi-gobject/ga-service-resolver.h75
-rw-r--r--avahi-python/.gitignore1
-rw-r--r--avahi-python/Makefile.am42
-rwxr-xr-xavahi-python/avahi-bookmarks.in227
-rw-r--r--avahi-python/avahi-discover/.gitignore3
-rw-r--r--avahi-python/avahi-discover/Makefile.am69
-rwxr-xr-xavahi-python/avahi-discover/__init__.py18
-rw-r--r--avahi-python/avahi-discover/avahi-discover.desktop.in.in11
-rwxr-xr-xavahi-python/avahi-discover/avahi-discover.py288
-rw-r--r--avahi-python/avahi/.gitignore1
-rw-r--r--avahi-python/avahi/Makefile.am61
-rw-r--r--avahi-python/avahi/ServiceTypeDatabase.py.in161
-rw-r--r--avahi-python/avahi/__init__.py112
-rw-r--r--avahi-qt/.gitignore9
-rw-r--r--avahi-qt/Makefile.am68
-rw-r--r--avahi-qt/qt-watch.cpp198
-rw-r--r--avahi-qt/qt-watch.h38
-rw-r--r--avahi-qt3.pc.in11
-rw-r--r--avahi-qt4.pc.in11
-rw-r--r--avahi-sharp.pc.in8
-rw-r--r--avahi-sharp/.gitignore6
-rw-r--r--avahi-sharp/AddressResolver.cs190
-rw-r--r--avahi-sharp/AssemblyInfo.cs48
-rw-r--r--avahi-sharp/AvahiTest.cs131
-rw-r--r--avahi-sharp/BrowserBase.cs50
-rw-r--r--avahi-sharp/Client.cs383
-rw-r--r--avahi-sharp/ClientException.cs123
-rw-r--r--avahi-sharp/DomainBrowser.cs198
-rw-r--r--avahi-sharp/EntryGroup.cs376
-rw-r--r--avahi-sharp/HostNameResolver.cs167
-rw-r--r--avahi-sharp/Makefile.am82
-rw-r--r--avahi-sharp/RecordBrowser.cs225
-rw-r--r--avahi-sharp/ResolverBase.cs34
-rw-r--r--avahi-sharp/ServiceBrowser.cs214
-rw-r--r--avahi-sharp/ServiceResolver.cs225
-rw-r--r--avahi-sharp/ServiceTypeBrowser.cs197
-rw-r--r--avahi-sharp/Utility.cs112
-rw-r--r--avahi-sharp/avahi-sharp-docs.source4
-rw-r--r--avahi-sharp/avahi-sharp.dll.config.in5
-rw-r--r--avahi-sharp/avahi.snkbin0 -> 596 bytes
-rw-r--r--avahi-sharp/en/Avahi.xml6
-rw-r--r--avahi-sharp/en/Avahi/AddressResolver.xml113
-rw-r--r--avahi-sharp/en/Avahi/BrowserBase.xml59
-rw-r--r--avahi-sharp/en/Avahi/Client.xml178
-rw-r--r--avahi-sharp/en/Avahi/ClientException.xml29
-rw-r--r--avahi-sharp/en/Avahi/ClientFlags.xml51
-rw-r--r--avahi-sharp/en/Avahi/ClientState.xml66
-rw-r--r--avahi-sharp/en/Avahi/ClientStateArgs.xml41
-rw-r--r--avahi-sharp/en/Avahi/ClientStateHandler.xml23
-rw-r--r--avahi-sharp/en/Avahi/DomainBrowser.xml101
-rw-r--r--avahi-sharp/en/Avahi/DomainBrowserType.xml66
-rw-r--r--avahi-sharp/en/Avahi/DomainInfo.xml61
-rw-r--r--avahi-sharp/en/Avahi/DomainInfoArgs.xml41
-rw-r--r--avahi-sharp/en/Avahi/DomainInfoHandler.xml23
-rw-r--r--avahi-sharp/en/Avahi/EntryGroup.xml491
-rw-r--r--avahi-sharp/en/Avahi/EntryGroupState.xml66
-rw-r--r--avahi-sharp/en/Avahi/EntryGroupStateArgs.xml41
-rw-r--r--avahi-sharp/en/Avahi/EntryGroupStateHandler.xml23
-rw-r--r--avahi-sharp/en/Avahi/ErrorCode.xml526
-rw-r--r--avahi-sharp/en/Avahi/ErrorCodeArgs.xml41
-rw-r--r--avahi-sharp/en/Avahi/ErrorCodeHandler.xml23
-rw-r--r--avahi-sharp/en/Avahi/HostAddressArgs.xml55
-rw-r--r--avahi-sharp/en/Avahi/HostAddressHandler.xml23
-rw-r--r--avahi-sharp/en/Avahi/HostNameResolver.xml115
-rw-r--r--avahi-sharp/en/Avahi/LookupFlags.xml71
-rw-r--r--avahi-sharp/en/Avahi/LookupResultFlags.xml81
-rw-r--r--avahi-sharp/en/Avahi/Protocol.xml46
-rw-r--r--avahi-sharp/en/Avahi/PublishFlags.xml121
-rw-r--r--avahi-sharp/en/Avahi/RecordBrowser.xml107
-rw-r--r--avahi-sharp/en/Avahi/RecordClass.xml26
-rw-r--r--avahi-sharp/en/Avahi/RecordInfo.xml94
-rw-r--r--avahi-sharp/en/Avahi/RecordInfoArgs.xml41
-rw-r--r--avahi-sharp/en/Avahi/RecordInfoHandler.xml23
-rw-r--r--avahi-sharp/en/Avahi/RecordType.xml116
-rw-r--r--avahi-sharp/en/Avahi/ResolverBase.xml37
-rw-r--r--avahi-sharp/en/Avahi/ServiceBrowser.xml119
-rw-r--r--avahi-sharp/en/Avahi/ServiceInfo.xml138
-rw-r--r--avahi-sharp/en/Avahi/ServiceInfoArgs.xml41
-rw-r--r--avahi-sharp/en/Avahi/ServiceInfoHandler.xml23
-rw-r--r--avahi-sharp/en/Avahi/ServiceResolver.xml125
-rw-r--r--avahi-sharp/en/Avahi/ServiceTypeBrowser.xml113
-rw-r--r--avahi-sharp/en/Avahi/ServiceTypeInfo.xml72
-rw-r--r--avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml41
-rw-r--r--avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml23
-rw-r--r--avahi-sharp/en/index.xml79
-rwxr-xr-xavahi-sharp/gencfg.sh12
-rw-r--r--avahi-ui-gtk3.pc.in11
-rw-r--r--avahi-ui-sharp.pc.in9
-rw-r--r--avahi-ui-sharp/.gitignore6
-rw-r--r--avahi-ui-sharp/Makefile.am70
-rw-r--r--avahi-ui-sharp/ServiceDialog.cs238
-rw-r--r--avahi-ui-sharp/avahi-ui-sharp-docs.source4
-rw-r--r--avahi-ui-sharp/avahi-ui-sharp.dll.config.in4
-rw-r--r--avahi-ui-sharp/bssh.cs39
-rw-r--r--avahi-ui-sharp/en/Avahi.UI.xml6
-rw-r--r--avahi-ui-sharp/en/Avahi.UI/ServiceDialog.xml171
-rw-r--r--avahi-ui-sharp/en/index.xml13
-rwxr-xr-xavahi-ui-sharp/gencfg.sh6
-rw-r--r--avahi-ui.pc.in11
-rw-r--r--avahi-ui/.gitignore13
-rw-r--r--avahi-ui/Makefile.am113
-rw-r--r--avahi-ui/avahi-ui.c1477
-rw-r--r--avahi-ui/avahi-ui.h181
-rw-r--r--avahi-ui/bssh.c256
-rw-r--r--avahi-ui/bssh.desktop.in.in11
-rw-r--r--avahi-ui/bvnc.desktop.in.in11
-rw-r--r--avahi-utils/.gitignore10
-rw-r--r--avahi-utils/Makefile.am66
-rw-r--r--avahi-utils/avahi-browse.c879
-rw-r--r--avahi-utils/avahi-publish.c429
-rw-r--r--avahi-utils/avahi-resolve.c339
-rw-r--r--avahi-utils/avahi-set-host-name.c211
-rw-r--r--avahi-utils/sigint.c144
-rw-r--r--avahi-utils/sigint.h28
-rw-r--r--avahi-utils/stdb.c212
-rw-r--r--avahi-utils/stdb.h30
-rwxr-xr-xbootstrap.sh61
-rw-r--r--common/.gitignore15
-rw-r--r--common/Makefile.am21
-rw-r--r--common/acx_pthread.m4348
-rw-r--r--common/doxygen.m4312
-rw-r--r--common/doxygen.mk187
-rw-r--r--common/gcc_stack_protect.m499
-rw-r--r--common/gcc_visibility.m436
-rw-r--r--common/introspection.m494
-rw-r--r--common/python.m462
-rw-r--r--configure.ac1237
-rw-r--r--docs/API-CHANGES-0.674
-rw-r--r--docs/AUTHORS15
-rw-r--r--docs/COMPAT-LAYERS16
-rw-r--r--docs/DBUS-API13
-rw-r--r--docs/HACKING79
-rw-r--r--docs/INSTALL53
-rw-r--r--docs/MALLOC8
-rw-r--r--docs/NEWS822
-rw-r--r--docs/README47
-rw-r--r--docs/TODO106
-rw-r--r--docs/avahi-favicon.pngbin0 -> 684 bytes
-rw-r--r--docs/avahi-logo.pngbin0 -> 8417 bytes
-rw-r--r--docs/avahi-poll.dia1042
-rw-r--r--docs/avahi-trac.pngbin0 -> 11406 bytes
-rw-r--r--docs/mdns-paket.dia1243
-rw-r--r--docs/multicast.dia651
-rw-r--r--docs/overview.dia1495
-rw-r--r--docs/server-states.dia975
-rw-r--r--docs/socket-auto-port.c49
-rw-r--r--docs/utilities-avahi1.svg1745
-rw-r--r--docs/utilities-avahi2.svg1627
-rw-r--r--docs/zeroconf-stack-de.dia563
-rw-r--r--doxygen.cfg213
-rw-r--r--doxygen_to_devhelp.xsl66
-rw-r--r--examples/.gitignore12
-rw-r--r--examples/Makefile.am63
-rw-r--r--examples/client-browse-services.c197
-rw-r--r--examples/client-publish-service.c280
-rw-r--r--examples/core-browse-services.c213
-rw-r--r--examples/core-publish-service.c244
-rw-r--r--examples/glib-integration.c146
-rw-r--r--initscript/.gitignore2
-rw-r--r--initscript/Makefile.am58
-rw-r--r--initscript/archlinux/Makefile.am38
-rw-r--r--initscript/archlinux/avahi-daemon.in72
-rwxr-xr-xinitscript/archlinux/avahi-dnsconfd.in72
-rw-r--r--initscript/darwin/Makefile.am36
-rw-r--r--initscript/darwin/org.freedesktop.avahi-daemon.plist.in16
-rw-r--r--initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in16
-rw-r--r--initscript/debian/Makefile.am44
-rwxr-xr-xinitscript/debian/avahi-daemon.in178
-rwxr-xr-xinitscript/debian/avahi-dnsconfd.in184
-rw-r--r--initscript/fedora/.gitignore4
-rw-r--r--initscript/fedora/Makefile.am38
-rw-r--r--initscript/fedora/avahi-daemon.in116
-rw-r--r--initscript/fedora/avahi-dnsconfd.in113
-rw-r--r--initscript/freebsd/Makefile.am41
-rw-r--r--initscript/freebsd/avahi-daemon.sh.in36
-rw-r--r--initscript/freebsd/avahi-dnsconfd.sh.in39
-rw-r--r--initscript/gentoo/Makefile.am43
-rw-r--r--initscript/gentoo/avahi-daemon.in29
-rw-r--r--initscript/gentoo/avahi-dnsconfd.in28
-rw-r--r--initscript/lfs/Makefile.am31
-rw-r--r--initscript/lfs/avahi.in49
-rw-r--r--initscript/mandriva/Makefile.am32
-rw-r--r--initscript/mandriva/avahi-daemon.in94
-rw-r--r--initscript/mandriva/avahi-dnsconfd.in94
-rw-r--r--initscript/slackware/Makefile.am32
-rw-r--r--initscript/slackware/avahi-daemon.in78
-rw-r--r--initscript/slackware/avahi-dnsconfd.in78
-rw-r--r--initscript/suse/Makefile.am32
-rw-r--r--initscript/suse/avahi-daemon.in60
-rw-r--r--initscript/suse/avahi-dnsconfd.in60
-rw-r--r--man/.gitignore8
-rw-r--r--man/Makefile.am154
-rw-r--r--man/avahi-autoipd.8.xml.in164
-rw-r--r--man/avahi-autoipd.action.8.xml.in83
-rw-r--r--man/avahi-bookmarks.1.xml.in99
-rw-r--r--man/avahi-browse.1.xml.in135
-rw-r--r--man/avahi-daemon.8.xml.in170
-rw-r--r--man/avahi-daemon.conf.5.xml.in385
-rw-r--r--man/avahi-discover.1.xml.in59
-rw-r--r--man/avahi-dnsconfd.8.xml.in107
-rw-r--r--man/avahi-dnsconfd.action.8.xml.in90
-rw-r--r--man/avahi-publish.1.xml.in122
-rw-r--r--man/avahi-resolve.1.xml.in105
-rw-r--r--man/avahi-set-host-name.1.xml.in73
-rw-r--r--man/avahi.hosts.5.xml.in60
-rw-r--r--man/avahi.service.5.xml.in122
-rw-r--r--man/bssh.1.xml.in88
-rw-r--r--man/xmltoman.css28
-rw-r--r--man/xmltoman.dtd37
-rw-r--r--man/xmltoman.xsl127
-rw-r--r--po/.gitignore17
-rw-r--r--po/LINGUAS33
-rw-r--r--po/POTFILES.in13
-rw-r--r--po/POTFILES.skip4
-rw-r--r--po/bg.po860
-rw-r--r--po/ca.po869
-rw-r--r--po/cs.po867
-rw-r--r--po/da.po878
-rw-r--r--po/de.po1455
-rw-r--r--po/el.po840
-rw-r--r--po/en_AU.po797
-rw-r--r--po/en_CA.po797
-rw-r--r--po/en_GB.po858
-rw-r--r--po/en_NZ.po858
-rw-r--r--po/es.po864
-rw-r--r--po/fi.po853
-rw-r--r--po/fo.po816
-rw-r--r--po/fr.po861
-rw-r--r--po/gl.po870
-rw-r--r--po/he.po806
-rw-r--r--po/hu.po863
-rw-r--r--po/id.po856
-rw-r--r--po/it.po867
-rw-r--r--po/ja.po859
-rw-r--r--po/ms.po851
-rw-r--r--po/nl.po802
-rw-r--r--po/pl.po853
-rw-r--r--po/pt_BR.po863
-rw-r--r--po/ro.po855
-rw-r--r--po/ru.po855
-rw-r--r--po/sl.po817
-rw-r--r--po/sl.si901
-rw-r--r--po/sr.po865
-rw-r--r--po/sr@latin.po865
-rw-r--r--po/sv.po855
-rw-r--r--po/uk.po857
-rw-r--r--po/zh_CN.po850
-rw-r--r--po/zh_TW.po800
-rw-r--r--service-type-database/.gitignore4
-rw-r--r--service-type-database/Makefile.am64
-rwxr-xr-xservice-type-database/build-db.in44
-rw-r--r--service-type-database/service-types233
-rw-r--r--specs/draft-cheshire-dnsext-dns-sd-02.txt1798
-rw-r--r--specs/draft-cheshire-dnsext-dns-sd-03.txt1856
-rw-r--r--specs/draft-cheshire-dnsext-dns-sd-04.txt2205
-rw-r--r--specs/draft-cheshire-dnsext-multicastdns-03.txt2494
-rw-r--r--specs/draft-cheshire-dnsext-multicastdns-04.txt2494
-rw-r--r--specs/draft-cheshire-dnsext-multicastdns-05.txt2640
-rw-r--r--specs/draft-cheshire-dnsext-multicastdns-06.txt3074
-rw-r--r--tests/.gitignore8
-rw-r--r--tests/Makefile.am53
-rwxr-xr-xtests/c-plus-plus-test-gen.py64
-rw-r--r--tests/c-plus-plus-test.cc82
-rwxr-xr-xtests/fuzz-mdns.py8
565 files changed, 139734 insertions, 0 deletions
diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000..9d9f8cd
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,7 @@
+; Sets emacs variables based on mode.
+; A list of (major-mode . ((var1 . value1) (var2 . value2)))
+; Mode can be nil, which gives default values.
+
+((nil . ((indent-tabs-mode . nil)
+ (tab-width . 8)))
+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..beab8d9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,34 @@
+intltool-extract.in
+intltool-merge.in
+intltool-update.in
+*.tar.gz
+doxygen
+Makefile
+Makefile.in
+*~
+*.pc
+*.o
+*.lo
+*.la
+.deps/
+.libs/
+ABOUT-NLS
+ChangeLog
+aclocal.m4
+*.cache
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config.rpath
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+py-compile
+stamp-h1
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..2d2d780
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,510 @@
+
+ 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/MODULE_LICENSE_LGPL b/MODULE_LICENSE_LGPL
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_LGPL
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..8234d69
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,243 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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-gobject.pc.in \
+ avahi-qt3.pc.in \
+ avahi-qt4.pc.in \
+ avahi-sharp.pc.in \
+ avahi-ui-sharp.pc.in \
+ avahi-compat-libdns_sd.pc.in \
+ avahi-compat-howl.pc.in \
+ avahi-ui.pc.in \
+ avahi-ui-gtk3.pc.in \
+ doxygen_to_devhelp.xsl \
+ common/introspection.m4
+
+SUBDIRS = \
+ common \
+ avahi-common \
+ avahi-core \
+ avahi-qt \
+ avahi-client \
+ avahi-glib \
+ avahi-gobject \
+ avahi-discover-standalone \
+ 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 \
+ avahi-ui \
+ avahi-ui-sharp \
+ po
+
+DX_INPUT = \
+ $(srcdir)/avahi-common/address.h \
+ $(srcdir)/avahi-common/malloc.h \
+ $(srcdir)/avahi-common/strlst.h \
+ $(srcdir)/avahi-common/alternative.h \
+ $(srcdir)/avahi-common/defs.h \
+ $(srcdir)/avahi-common/error.h \
+ $(srcdir)/avahi-common/domain.h \
+ $(srcdir)/avahi-common/watch.h \
+ $(srcdir)/avahi-common/simple-watch.h \
+ $(srcdir)/avahi-common/thread-watch.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
+
+if HAVE_GOBJECT
+if HAVE_DBUS
+DX_INPUT += \
+ $(srcdir)/avahi-gobject/ga-client.h \
+ $(srcdir)/avahi-gobject/ga-entry-group.h \
+ $(srcdir)/avahi-gobject/ga-enums.h \
+ $(srcdir)/avahi-gobject/ga-error.h \
+ $(srcdir)/avahi-gobject/ga-record-browser.h \
+ $(srcdir)/avahi-gobject/ga-service-browser.h \
+ $(srcdir)/avahi-gobject/ga-service-resolver.h
+endif
+endif
+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
+
+%.pc: %.pc.in
+ $(AM_V_GEN)sed -e 's,@prefix\@,$(prefix),g' \
+ -e 's,@libdir\@,$(libdir),g' \
+ -e 's,@HOWL_COMPAT_VERSION\@,$(HOWL_COMPAT_VERSION),g' \
+ -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
+
+pkgconfig_DATA = avahi-core.pc
+CLEANFILES = avahi-core.pc
+
+if HAVE_DBUS
+pkgconfig_DATA += avahi-client.pc
+CLEANFILES += avahi-client.pc
+
+if ENABLE_COMPAT_HOWL
+pkgconfig_DATA += avahi-compat-howl.pc
+CLEANFILES += avahi-compat-howl.pc
+endif
+
+if ENABLE_COMPAT_LIBDNS_SD
+pkgconfig_DATA += avahi-compat-libdns_sd.pc
+CLEANFILES += avahi-compat-libdns_sd.pc
+endif
+
+if HAVE_MONO
+pkgconfig_DATA += avahi-sharp.pc avahi-ui-sharp.pc
+CLEANFILES += avahi-sharp.pc avahi-ui-sharp.pc
+endif
+
+endif
+
+if HAVE_GLIB
+pkgconfig_DATA += avahi-glib.pc
+CLEANFILES += avahi-glib.pc
+
+if HAVE_GOBJECT
+pkgconfig_DATA += avahi-gobject.pc
+CLEANFILES += avahi-gobject.pc
+endif
+endif
+
+if HAVE_GTK
+if HAVE_DBUS
+pkgconfig_DATA += avahi-ui.pc
+CLEANFILES += avahi-ui.pc
+endif
+endif
+
+if HAVE_GTK3
+if HAVE_DBUS
+pkgconfig_DATA += avahi-ui-gtk3.pc
+CLEANFILES += avahi-ui-gtk3.pc
+endif
+endif
+
+if HAVE_QT3
+pkgconfig_DATA += avahi-qt3.pc
+CLEANFILES += avahi-qt3.pc
+endif
+
+if HAVE_QT4
+pkgconfig_DATA += avahi-qt4.pc
+CLEANFILES += avahi-qt4.pc
+endif
+
+CLEANFILES += avahi.devhelp
+
+avahi.devhelp: doxygen-run
+ xsltproc -o $@ doxygen_to_devhelp.xsl doxygen/xml/index.xml
+
+MOSTLYCLEANFILES = $(DX_CLEANFILES)
+
+DISTCHECK_CONFIGURE_FLAGS = \
+ --disable-monodoc \
+ --enable-introspection \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
+homepage:
+ $(MAKE) -C man
+ scp avahi-daemon/*.xml 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
+
+DISTCLEANFILES = \
+ po/.intltool-merge-cache
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..5522aa5
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,508 @@
+
+ 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/README b/README
new file mode 100644
index 0000000..832874c
--- /dev/null
+++ b/README
@@ -0,0 +1,34 @@
+AVAHI SERVICE DISCOVERY SUITE
+
+WEB SITE:
+ http://avahi.org/
+
+GIT:
+ git://git.0pointer.de/avahi.git
+
+GITWEB:
+ http://git.0pointer.de/?p=avahi.git;a=summary
+
+MAILING LIST:
+ http://lists.freedesktop.org/mailman/listinfo/avahi
+
+GIT COMMITS MAILING LIST:
+ https://tango.0pointer.de/mailman/listinfo/avahi-commits
+
+TRAC TICKET CHANGES MAILING LIST:
+ https://tango.0pointer.de/mailman/listinfo/avahi-tickets
+
+IRC:
+ #avahi on irc.freenode.org
+
+CIA:
+ http://cia.navi.cx/stats/project/avahi
+
+FRESHMEAT:
+ http://freshmeat.net/projects/avahi/
+
+OHLOH:
+ http://www.ohloh.net/projects/avahi/
+
+AUTHORS:
+ Several
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100644
index 0000000..4d07999
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1 @@
+sinclude(common/doxygen.m4) \ No newline at end of file
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..2c68a6c
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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_VERSION=1.11
+AC_VERSION=2.63
+
+run_versioned() {
+ local P
+ local V
+
+ V=$(echo "$2" | sed -e 's,\.,,g')
+
+ if [ -e "`which $1$V 2> /dev/null`" ] ; then
+ P="$1$V"
+ else
+ if [ -e "`which $1-$2 2> /dev/null`" ] ; then
+ P="$1-$2"
+ else
+ P="$1"
+ fi
+ fi
+
+ shift 2
+ "$P" "$@"
+}
+
+set -ex
+
+if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
+ cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
+ chmod +x .git/hooks/pre-commit && \
+ echo "Activated pre-commit hook."
+fi
+
+if [ "x$1" = "xam" ] ; then
+ run_versioned automake "$AM_VERSION" -a -c --foreign
+ ./config.status
+else
+ rm -rf autom4te.cache
+ rm -f config.cache
+
+ rm -f Makefile.am~ configure.ac~
+ # Evil, evil, evil, evil hack
+ sed 's/read dummy/\#/' `which gettextize` | sh -s -- --copy --force
+ test -f Makefile.am~ && mv Makefile.am~ Makefile.am
+ test -f configure.ac~ && mv configure.ac~ configure.ac
+
+ test "x$LIBTOOLIZE" = "x" && LIBTOOLIZE=libtoolize
+
+ intltoolize --copy --force --automake
+ "$LIBTOOLIZE" -c --force
+ run_versioned aclocal "$AM_VERSION" -I common
+ run_versioned autoconf "$AC_VERSION" -Wall
+ run_versioned autoheader "$AC_VERSION"
+ run_versioned automake "$AM_VERSION" -a -c --foreign
+
+ if test "x$NOCONFIGURE" = "x"; then
+ ./configure "$@"
+ make clean
+ fi
+fi
diff --git a/avahi-autoipd/.gitignore b/avahi-autoipd/.gitignore
new file mode 100644
index 0000000..b8d515c
--- /dev/null
+++ b/avahi-autoipd/.gitignore
@@ -0,0 +1,9 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+avahi-autoipd
+avahi-autoipd.action
diff --git a/avahi-autoipd/Makefile.am b/avahi-autoipd/Makefile.am
new file mode 100644
index 0000000..56f7a35
--- /dev/null
+++ b/avahi-autoipd/Makefile.am
@@ -0,0 +1,94 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 ENABLE_AUTOIPD
+if HAVE_LIBDAEMON
+
+pkgsysconfdir=$(sysconfdir)/avahi
+
+AM_CFLAGS= \
+ -I$(top_srcdir)
+
+# This cool debug trap works on i386/gcc only
+AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")' \
+ -DAVAHI_RUNTIME_DIR=\"$(avahi_runtime_dir)/\" \
+ -DAVAHI_IPCONF_SCRIPT=\"$(pkgsysconfdir)/avahi-autoipd.action\" \
+ -DAVAHI_IPDATA_DIR=\"$(localstatedir)/lib/avahi-autoipd\"
+
+sbin_PROGRAMS = avahi-autoipd
+
+avahi_autoipd_SOURCES = \
+ main.c main.h \
+ ../avahi-daemon/setproctitle.c ../avahi-daemon/setproctitle.h \
+ 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
+
+nodist_pkgsysconf_SCRIPTS = avahi-autoipd.action
+
+if TARGET_FREEBSD
+avahi-autoipd.action: avahi-autoipd.action.bsd
+ $(AM_V_GEN)cp $< $@
+else
+avahi-autoipd.action: avahi-autoipd.action.linux
+ $(AM_V_GEN)cp $< $@
+endif
+
+if TARGET_DEBIAN
+
+noinst_SCRIPTS = dhclient-enter-hook dhclient-exit-hook
+
+dhclient-enter-hook: dhclient-enter-hook.in
+ $(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ && \
+ chmod +x $@
+
+dhclient-exit-hook: dhclient-exit-hook.in
+ $(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ && \
+ chmod +x $@
+
+BUILD = dhclient-exit-hook dhclient-enter-hook
+
+dhcliententerdir = $(sysconfdir)/dhcp/dhclient-enter-hooks.d
+dhclientexitdir = $(sysconfdir)/dhcp/dhclient-exit-hooks.d
+
+install-exec-hook: dhclient-exit-hook dhclient-enter-hook
+ $(MKDIR_P) $(DESTDIR)$(dhcliententerdir) $(DESTDIR)$(dhclientexitdir)
+ $(INSTALL) dhclient-enter-hook $(DESTDIR)$(dhcliententerdir)/avahi-autoipd
+ $(INSTALL) dhclient-exit-hook $(DESTDIR)$(dhclientexitdir)/avahi-autoipd
+
+uninstall-hook:
+ rm -f $(DESTDIR)$(dhcliententerdir)/avahi-autoipd $(DESTDIR)$(dhclientexitdir)/avahi-autoipd
+
+endif
+
+
+endif
+endif
+
+EXTRA_DIST = dhclient-enter-hook.in dhclient-exit-hook.in avahi-autoipd.action.linux avahi-autoipd.action.bsd
+
+CLEANFILES = dhclient-enter-hook dhclient-exit-hook avahi-autoipd.action
diff --git a/avahi-autoipd/avahi-autoipd.action.bsd b/avahi-autoipd/avahi-autoipd.action.bsd
new file mode 100755
index 0000000..06084fb
--- /dev/null
+++ b/avahi-autoipd/avahi-autoipd.action.bsd
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+
+# 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
+
+# We have the BSD ifconfig tool
+
+case "$1" in
+BIND)
+ ifconfig "$2" "$3"/16
+ ;;
+
+CONFLICT|STOP|UNBIND)
+ ifconfig "$2" "$3"/16 delete
+ ;;
+
+*)
+ echo "Unknown event $1" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/avahi-autoipd/avahi-autoipd.action.linux b/avahi-autoipd/avahi-autoipd.action.linux
new file mode 100755
index 0000000..c2db994
--- /dev/null
+++ b/avahi-autoipd/avahi-autoipd.action.linux
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+
+# 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
+
+PATH="$PATH:/usr/bin:/usr/sbin:/bin:/sbin"
+
+# Use a different metric for each interface, so that we can set
+# identical routes to multiple interfaces.
+
+METRIC=$((1000 + `cat "/sys/class/net/$2/ifindex" 2>/dev/null || echo 0`))
+
+if [ -x /bin/ip -o -x /sbin/ip ] ; then
+
+ # We have the Linux ip tool from the iproute package
+
+ case "$1" in
+ BIND)
+ ip addr add "$3"/16 brd 169.254.255.255 label "$2:avahi" scope link dev "$2"
+ ip route add default dev "$2" metric "$METRIC" scope link ||:
+ ;;
+
+ CONFLICT|UNBIND|STOP)
+ ip route del default dev "$2" metric "$METRIC" scope link ||:
+ ip addr del "$3"/16 brd 169.254.255.255 label "$2:avahi" scope link dev "$2"
+ ;;
+
+ *)
+ echo "Unknown event $1" >&2
+ exit 1
+ ;;
+ esac
+
+elif [ -x /bin/ifconfig -o -x /sbin/ifconfig ] ; then
+
+ # We have the old ifconfig tool
+
+ case "$1" in
+ BIND)
+ ifconfig "$2:avahi" inet "$3" netmask 255.255.0.0 broadcast 169.254.255.255 up
+ route add default dev "$2:avahi" metric "$METRIC" ||:
+ ;;
+
+ CONFLICT|STOP|UNBIND)
+ route del default dev "$2:avahi" metric "$METRIC" ||:
+ ifconfig "$2:avahi" down
+ ;;
+
+ *)
+ echo "Unknown event $1" >&2
+ exit 1
+ ;;
+ esac
+
+else
+
+ echo "No network configuration tool found." >&2
+ exit 1
+
+fi
+
+exit 0
diff --git a/avahi-autoipd/dhclient-enter-hook.in b/avahi-autoipd/dhclient-enter-hook.in
new file mode 100755
index 0000000..a746856
--- /dev/null
+++ b/avahi-autoipd/dhclient-enter-hook.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
+
+case "$reason" in
+ MEDIUM|ARPCHECK|ARPSEND|NBI)
+ ;;
+
+ PREINIT|BOUND|RENEW|REBIND|REBOOT|STOP|RELEASE)
+ @sbindir@/avahi-autoipd -k $interface 2> /dev/null
+ ;;
+
+ EXPIRE|FAIL|TIMEOUT)
+ # Starting avahi-autoipd is left for the exit hook
+ ;;
+esac
diff --git a/avahi-autoipd/dhclient-exit-hook.in b/avahi-autoipd/dhclient-exit-hook.in
new file mode 100755
index 0000000..379cb46
--- /dev/null
+++ b/avahi-autoipd/dhclient-exit-hook.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
+
+case "$reason" in
+ MEDIUM|ARPCHECK|ARPSEND|NBI)
+ ;;
+
+ PREINIT|BOUND|RENEW|REBIND|REBOOT|STOP|RELEASE)
+ # Stopping avahi-autoipd is left for the enter hook
+ ;;
+
+ EXPIRE|FAIL|TIMEOUT)
+ @sbindir@/avahi-autoipd -wD $interface 2> /dev/null
+ ;;
+esac
diff --git a/avahi-autoipd/iface-bsd.c b/avahi-autoipd/iface-bsd.c
new file mode 100644
index 0000000..6a1085c
--- /dev/null
+++ b/avahi-autoipd/iface-bsd.c
@@ -0,0 +1,440 @@
+/* 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, AF_INET);
+ 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 routable;
+
+ assert(fd != -1);
+
+ routable = !!addresses;
+
+ if (rtm_dispatch() == -1)
+ return (-1);
+
+ if (routable && !addresses)
+ *event = EVENT_ROUTABLE_ADDR_UNCONFIGURED;
+ else if (!routable && 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:
+ daemon_log(LOG_DEBUG, "%s: rtm_type %d ignored", __func__, rtm->rtm_type);
+ 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);
+
+ daemon_log(LOG_DEBUG, "%s: IFANNOUNCE for ifindex %d",
+ __func__, rtm->ifan.ifan_index);
+
+ 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;
+
+#ifdef SA_SIZE
+ sa_size = SA_SIZE(sa);
+#else
+ /* This is not foolproof, kernel may round. */
+ sa_size = sa->sa_len;
+ if (sa_size < sizeof(u_long))
+ sa_size = sizeof(u_long);
+#endif
+
+ 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;
+ struct ifa_msghdr *ifam;
+ struct sockaddr *sa;
+ struct sockaddr_in *sin;
+ int link_local;
+
+/* macro to skip to next RTA; has side-effects */
+#define SKIPRTA(ifamsgp, rta, sa) \
+ do { \
+ if ((ifamsgp)->ifam_addrs & (rta)) \
+ (sa) = next_sa((sa)); \
+ } while (0)
+
+ ifam = &((rtmunion_t *)di->di_buf)->ifam;
+
+ assert(ifam->ifam_type == RTM_NEWADDR ||
+ ifam->ifam_type == RTM_DELADDR);
+
+ daemon_log(LOG_DEBUG, "%s: %s for iface %d (%s)", __func__,
+ ifam->ifam_type == RTM_NEWADDR ? "NEWADDR" : "DELADDR",
+ ifam->ifam_index, (ifam->ifam_index == ifindex) ? "ours" : "not ours");
+
+ if (ifam->ifam_index != ifindex)
+ return (0);
+
+ if (!(ifam->ifam_addrs & RTA_IFA)) {
+ daemon_log(LOG_ERR, "ifa msg has no RTA_IFA.");
+ return (0);
+ }
+
+ /* skip over rtmsg padding correctly */
+ sa = (struct sockaddr *)(ifam + 1);
+ SKIPRTA(ifam, RTA_DST, sa);
+ SKIPRTA(ifam, RTA_GATEWAY, sa);
+ SKIPRTA(ifam, RTA_NETMASK, sa);
+ SKIPRTA(ifam, RTA_GENMASK, sa);
+ SKIPRTA(ifam, RTA_IFP, sa);
+
+ /*
+ * sa now points to RTA_IFA sockaddr; we are only interested
+ * in updates for routable addresses.
+ */
+ if (sa->sa_family != AF_INET) {
+ daemon_log(LOG_DEBUG, "%s: RTA_IFA family not AF_INET (=%d)", __func__, sa->sa_family);
+ return (0);
+ }
+
+ sin = (struct sockaddr_in *)sa;
+ link_local = IN_LINKLOCAL(ntohl(sin->sin_addr.s_addr));
+
+ daemon_log(LOG_DEBUG, "%s: %s for %s (%s)", __func__,
+ ifam->ifam_type == RTM_NEWADDR ? "NEWADDR" : "DELADDR",
+ inet_ntoa(sin->sin_addr), link_local ? "link local" : "routable");
+
+ if (link_local)
+ return (0);
+
+ for (ap = addresses; ap; ap = ap->addresses_next) {
+ if (ap->address == sin->sin_addr.s_addr)
+ break;
+ }
+ if (ifam->ifam_type == RTM_DELADDR && ap != NULL) {
+ AVAHI_LLIST_REMOVE(Address, addresses, addresses, ap);
+ avahi_free(ap);
+ }
+ if (ifam->ifam_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/avahi-autoipd/iface-linux.c b/avahi-autoipd/iface-linux.c
new file mode 100644
index 0000000..83e9e41
--- /dev/null
+++ b/avahi-autoipd/iface-linux.c
@@ -0,0 +1,332 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/socket.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+
+#include <linux/types.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <linux/if.h>
+#include <linux/if_arp.h>
+
+#include <libdaemon/dlog.h>
+
+#include <avahi-common/llist.h>
+#include <avahi-common/malloc.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
+
+#include "iface.h"
+
+static int fd = -1;
+static int ifindex = -1;
+
+typedef struct Address Address;
+
+struct Address {
+ uint32_t address;
+ AVAHI_LLIST_FIELDS(Address, addresses);
+};
+
+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));
+ goto fail;
+ }
+
+ memset(&addr, 0, sizeof(addr));
+ addr.nl_family = AF_NETLINK;
+ addr.nl_groups = RTMGRP_LINK|RTMGRP_IPV4_IFADDR;
+ addr.nl_pid = getpid();
+
+ if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ 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;
+
+ return fd;
+
+fail:
+ if (fd >= 0) {
+ close(fd);
+ fd = -1;
+ }
+
+ return -1;
+}
+
+static int process_nlmsg(struct nlmsghdr *n) {
+ assert(n);
+
+ if (n->nlmsg_type == RTM_NEWLINK || n->nlmsg_type == RTM_DELLINK) {
+ /* A link appeared or was removed */
+
+ struct ifinfomsg *ifi;
+ ifi = NLMSG_DATA(n);
+
+ if (ifi->ifi_family != AF_UNSPEC || (int) ifi->ifi_index != ifindex)
+ return 0;
+
+ if (n->nlmsg_type == RTM_DELLINK) {
+ daemon_log(LOG_ERR, "Interface vanished.");
+ return -1;
+ }
+
+ assert(n->nlmsg_type == RTM_NEWLINK);
+
+ if ((ifi->ifi_flags & IFF_LOOPBACK) ||
+ (ifi->ifi_flags & IFF_NOARP) ||
+ ifi->ifi_type != ARPHRD_ETHER) {
+ daemon_log(LOG_ERR, "Interface not suitable.");
+ return -1;
+ }
+
+ } else if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
+
+ /* An address was added or removed */
+
+ struct rtattr *a = NULL;
+ struct ifaddrmsg *ifa;
+ int l;
+ uint32_t address = 0;
+ Address *i;
+
+ ifa = NLMSG_DATA(n);
+
+ if (ifa->ifa_family != AF_INET || (int) ifa->ifa_index != ifindex)
+ return 0;
+
+ l = NLMSG_PAYLOAD(n, sizeof(*ifa));
+ a = IFLA_RTA(ifa);
+
+ while(RTA_OK(a, l)) {
+
+ switch(a->rta_type) {
+ case IFA_LOCAL:
+ case IFA_ADDRESS:
+ assert(RTA_PAYLOAD(a) == 4);
+ memcpy(&address, RTA_DATA(a), sizeof(uint32_t));
+ break;
+ }
+
+ a = RTA_NEXT(a, l);
+ }
+
+ if (!address || is_ll_address(address))
+ return 0;
+
+ for (i = addresses; i; i = i->addresses_next)
+ if (i->address == address)
+ break;
+
+ if (n->nlmsg_type == RTM_DELADDR && i) {
+ AVAHI_LLIST_REMOVE(Address, addresses, addresses, i);
+ avahi_free(i);
+ } if (n->nlmsg_type == RTM_NEWADDR && !i) {
+ i = avahi_new(Address, 1);
+ i->address = address;
+ AVAHI_LLIST_PREPEND(Address, addresses, addresses, i);
+ }
+ }
+
+ return 0;
+}
+
+static int process_response(int wait_for_done, unsigned seq) {
+ assert(fd >= 0);
+
+ do {
+ size_t bytes;
+ ssize_t r;
+ 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 (!(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)) {
+
+ if (!NLMSG_OK(p, bytes) || bytes < sizeof(struct nlmsghdr) || bytes < p->nlmsg_len) {
+ daemon_log(LOG_ERR, "Netlink packet too small.");
+ return -1;
+ }
+
+ if (p->nlmsg_type == NLMSG_DONE && wait_for_done && p->nlmsg_seq == seq && (pid_t) p->nlmsg_pid == getpid())
+ return 0;
+
+ if (p->nlmsg_type == NLMSG_ERROR) {
+ struct nlmsgerr *e = (struct nlmsgerr *) NLMSG_DATA (p);
+
+ if (e->error) {
+ daemon_log(LOG_ERR, "Netlink error: %s", strerror(-e->error));
+ return -1;
+ }
+ }
+
+ if (process_nlmsg(p) < 0)
+ return -1;
+ }
+ } while (wait_for_done);
+
+ return 0;
+}
+
+int iface_get_initial_state(State *state) {
+ struct nlmsghdr *n;
+ struct ifinfomsg *ifi;
+ struct ifaddrmsg *ifa;
+ uint8_t req[1024];
+ int seq = 0;
+
+ assert(fd >= 0);
+ assert(state);
+
+ memset(&req, 0, sizeof(req));
+ n = (struct nlmsghdr*) req;
+ n->nlmsg_len = NLMSG_LENGTH(sizeof(*ifi));
+ n->nlmsg_type = RTM_GETLINK;
+ n->nlmsg_seq = seq;
+ n->nlmsg_flags = NLM_F_REQUEST|NLM_F_DUMP;
+ n->nlmsg_pid = 0;
+
+ ifi = NLMSG_DATA(n);
+ ifi->ifi_family = AF_UNSPEC;
+ ifi->ifi_change = -1;
+
+ if (send(fd, n, n->nlmsg_len, 0) < 0) {
+ daemon_log(LOG_ERR, "send(): %s", strerror(errno));
+ return -1;
+ }
+
+ if (process_response(1, 0) < 0)
+ return -1;
+
+ n->nlmsg_type = RTM_GETADDR;
+ n->nlmsg_len = NLMSG_LENGTH(sizeof(*ifa));
+ n->nlmsg_seq = ++seq;
+
+ ifa = NLMSG_DATA(n);
+ ifa->ifa_family = AF_INET;
+ ifa->ifa_index = ifindex;
+
+ if (send(fd, n, n->nlmsg_len, 0) < 0) {
+ daemon_log(LOG_ERR, "send(): %s", strerror(errno));
+ return -1;
+ }
+
+ if (process_response(1, seq) < 0)
+ return -1;
+
+ *state = addresses ? STATE_SLEEPING : STATE_START;
+
+ return 0;
+}
+
+int iface_process(Event *event) {
+ int b;
+ assert(fd >= 0);
+
+ b = !!addresses;
+
+ if (process_response(0, 0) < 0)
+ 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 >= 0) {
+ close(fd);
+ fd = -1;
+ }
+
+ while ((a = addresses)) {
+ AVAHI_LLIST_REMOVE(Address, addresses, addresses, a);
+ avahi_free(a);
+ }
+}
+
+
diff --git a/avahi-autoipd/iface.h b/avahi-autoipd/iface.h
new file mode 100644
index 0000000..95c97fd
--- /dev/null
+++ b/avahi-autoipd/iface.h
@@ -0,0 +1,45 @@
+#ifndef fooavahiifacehfoo
+#define fooavahiifacehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 "main.h"
+
+/* Subscribe to network configuration changes. The only events we are
+ * interested in are when routable addresses are removed/added to the
+ * monitored interface and when our monitored interface disappears. */
+
+
+/* Return a valid fd that we listen on for events */
+int iface_init(int ifindex);
+
+/* Process events */
+int iface_process(Event *event);
+void iface_done(void);
+
+/* Deduce the initial state of our state machine. If a routable
+ * address is configured for the interface, *state should be set to
+ * STATE_SLEEPING, otherwise STATE_START */
+
+int iface_get_initial_state(State *state);
+
+#endif
diff --git a/avahi-autoipd/main.c b/avahi-autoipd/main.c
new file mode 100644
index 0000000..a1bddb2
--- /dev/null
+++ b/avahi-autoipd/main.c
@@ -0,0 +1,1714 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/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 <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 <inttypes.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.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>
+
+/* Old versions of PCAP defined it as D_IN */
+#ifndef PCAP_D_IN
+#define PCAP_D_IN D_IN
+#endif
+
+#endif
+
+#include <avahi-common/malloc.h>
+#include <avahi-common/timeval.h>
+#include <avahi-daemon/setproctitle.h>
+
+#include <libdaemon/dfork.h>
+#include <libdaemon/dsignal.h>
+#include <libdaemon/dlog.h>
+#include <libdaemon/dpid.h>
+#include <libdaemon/dexec.h>
+
+#include "main.h"
+#include "iface.h"
+
+/* An implementation of RFC 3927 */
+
+/* Constants from the RFC */
+#define PROBE_WAIT 1
+#define PROBE_NUM 3
+#define PROBE_MIN 1
+#define PROBE_MAX 2
+#define ANNOUNCE_WAIT 2
+#define ANNOUNCE_NUM 2
+#define ANNOUNCE_INTERVAL 2
+#define MAX_CONFLICTS 10
+#define RATE_LIMIT_INTERVAL 60
+#define DEFEND_INTERVAL 10
+
+#define IPV4LL_NETWORK 0xA9FE0000L
+#define IPV4LL_NETMASK 0xFFFF0000L
+#define IPV4LL_HOSTMASK 0x0000FFFFL
+#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 {
+ ARP_REQUEST = 1,
+ ARP_RESPONSE = 2
+} ArpOperation;
+
+typedef struct ArpPacketInfo {
+ ArpOperation operation;
+
+ uint32_t sender_ip_address, target_ip_address;
+ 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;
+
+static char *interface_name = NULL;
+static char *pid_file_name = NULL;
+static uint32_t start_address = 0;
+static char *argv0 = NULL;
+static int daemonize = 0;
+static int wait_for_address = 0;
+static int use_syslog = 0;
+static int debug = 0;
+static int modify_proc_title = 1;
+static int force_bind = 0;
+#ifdef HAVE_CHROOT
+static int no_chroot = 0;
+#endif
+static int no_drop_root = 0;
+static int wrote_pid_file = 0;
+static char *action_script = NULL;
+
+static enum {
+ DAEMON_RUN,
+ DAEMON_KILL,
+ DAEMON_REFRESH,
+ DAEMON_VERSION,
+ DAEMON_HELP,
+ DAEMON_CHECK
+} command = DAEMON_RUN;
+
+typedef enum CalloutEvent {
+ CALLOUT_BIND,
+ CALLOUT_CONFLICT,
+ CALLOUT_UNBIND,
+ CALLOUT_STOP,
+ CALLOUT_MAX
+} CalloutEvent;
+
+static const char * const callout_event_table[CALLOUT_MAX] = {
+ [CALLOUT_BIND] = "BIND",
+ [CALLOUT_CONFLICT] = "CONFLICT",
+ [CALLOUT_UNBIND] = "UNBIND",
+ [CALLOUT_STOP] = "STOP"
+};
+
+typedef struct CalloutEventInfo {
+ CalloutEvent event;
+ uint32_t address;
+ int ifindex;
+} CalloutEventInfo;
+
+#define RANDOM_DEVICE "/dev/urandom"
+
+#define DEBUG(x) \
+ do { \
+ if (debug) { \
+ x; \
+ } \
+ } while (0)
+
+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);
+}
+
+static uint32_t pick_addr(uint32_t old_addr) {
+ uint32_t addr;
+
+ do {
+ unsigned r = (unsigned) rand();
+
+ /* Reduce to 16 bits */
+ while (r > 0xFFFF)
+ r = (r >> 16) ^ (r & 0xFFFF);
+
+ addr = htonl(IPV4LL_NETWORK | (uint32_t) r);
+
+ } while (addr == old_addr || !is_ll_address(addr));
+
+ return addr;
+}
+
+static int load_address(const char *fn, uint32_t *addr) {
+ FILE *f;
+ unsigned a, b, c, d;
+
+ assert(fn);
+ assert(addr);
+
+ if (!(f = fopen(fn, "r"))) {
+
+ if (errno == ENOENT) {
+ *addr = 0;
+ return 0;
+ }
+
+ daemon_log(LOG_ERR, "fopen() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ if (fscanf(f, "%u.%u.%u.%u\n", &a, &b, &c, &d) != 4) {
+ daemon_log(LOG_ERR, "Parse failure");
+ goto fail;
+ }
+
+ fclose(f);
+
+ *addr = htonl((a << 24) | (b << 16) | (c << 8) | d);
+ return 0;
+
+fail:
+ if (f)
+ fclose(f);
+
+ return -1;
+}
+
+static int save_address(const char *fn, uint32_t addr) {
+ FILE *f;
+ char buf[32];
+ mode_t u;
+
+ assert(fn);
+
+ u = umask(0033);
+ if (!(f = fopen(fn, "w"))) {
+ daemon_log(LOG_ERR, "fopen() failed: %s", strerror(errno));
+ goto fail;
+ }
+ umask(u);
+
+ fprintf(f, "%s\n", inet_ntop(AF_INET, &addr, buf, sizeof (buf)));
+ fclose(f);
+
+ return 0;
+
+fail:
+ if (f)
+ fclose(f);
+
+ umask(u);
+
+ return -1;
+}
+
+/*
+ * 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(info->operation == ARP_REQUEST || info->operation == ARP_RESPONSE);
+ assert(packet_len != NULL);
+
+ *packet_len = ARP_PACKET_SIZE;
+ p = packet_new(*packet_len);
+ r = p->ether_payload;
+
+ r[1] = 1; /* HTYPE */
+ r[2] = 8; /* PTYPE */
+ r[4] = ETHER_ADDRLEN; /* HLEN */
+ r[5] = 4; /* PLEN */
+ r[7] = (uint8_t) info->operation;
+
+ memcpy(r+8, info->sender_hw_address, ETHER_ADDRLEN);
+ memcpy(r+14, &info->sender_ip_address, 4);
+ memcpy(r+18, info->target_hw_address, ETHER_ADDRLEN);
+ memcpy(r+24, &info->target_ip_address, 4);
+
+ return p;
+}
+
+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));
+ info.operation = ARP_REQUEST;
+ memcpy(info.sender_hw_address, hw_address, ETHER_ADDRLEN);
+ info.target_ip_address = ip_address;
+
+ return packet_new_with_info(&info, 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));
+ info.operation = ARP_REQUEST;
+ memcpy(info.sender_hw_address, hw_address, ETHER_ADDRLEN);
+ info.target_ip_address = ip_address;
+ info.sender_ip_address = ip_address;
+
+ return packet_new_with_info(&info, packet_len);
+}
+
+static int packet_parse(const ArpPacket *packet, size_t packet_len, ArpPacketInfo *info) {
+ const uint8_t *p;
+
+ assert(packet);
+ p = (uint8_t *)packet->ether_payload;
+ assert(p);
+
+ if (packet_len < ARP_PACKET_SIZE)
+ return -1;
+
+ /* Check HTYPE and PTYPE */
+ if (p[0] != 0 || p[1] != 1 || p[2] != 8 || p[3] != 0)
+ return -1;
+
+ /* Check HLEN, PLEN, OPERATION */
+ if (p[4] != ETHER_ADDRLEN || p[5] != 4 || p[6] != 0 || (p[7] != 1 && p[7] != 2))
+ return -1;
+
+ info->operation = p[7];
+ memcpy(info->sender_hw_address, p+8, ETHER_ADDRLEN);
+ memcpy(&info->sender_ip_address, p+14, 4);
+ memcpy(info->target_hw_address, p+18, ETHER_ADDRLEN);
+ memcpy(&info->target_ip_address, p+24, 4);
+
+ return 0;
+}
+
+static void set_state(State st, int reset_counter, uint32_t address) {
+ static const char* const state_table[] = {
+ [STATE_START] = "START",
+ [STATE_WAITING_PROBE] = "WAITING_PROBE",
+ [STATE_PROBING] = "PROBING",
+ [STATE_WAITING_ANNOUNCE] = "WAITING_ANNOUNCE",
+ [STATE_ANNOUNCING] = "ANNOUNCING",
+ [STATE_RUNNING] = "RUNNING",
+ [STATE_SLEEPING] = "SLEEPING"
+ };
+ char buf[64];
+
+ assert(st < STATE_MAX);
+
+ if (st == state && !reset_counter) {
+ n_iteration++;
+ DEBUG(daemon_log(LOG_DEBUG, "State iteration %s-%i", state_table[state], n_iteration));
+ } else {
+ DEBUG(daemon_log(LOG_DEBUG, "State transition %s-%i -> %s-0", state_table[state], n_iteration, state_table[st]));
+ state = st;
+ n_iteration = 0;
+ }
+
+ if (state == STATE_SLEEPING)
+ avahi_set_proc_title(argv0, "%s: [%s] sleeping", argv0, interface_name);
+ else if (state == STATE_ANNOUNCING)
+ avahi_set_proc_title(argv0, "%s: [%s] announcing %s", argv0, interface_name, inet_ntop(AF_INET, &address, buf, sizeof(buf)));
+ else if (state == STATE_RUNNING)
+ avahi_set_proc_title(argv0, "%s: [%s] bound %s", argv0, interface_name, inet_ntop(AF_INET, &address, buf, sizeof(buf)));
+ else
+ avahi_set_proc_title(argv0, "%s: [%s] probing %s", argv0, interface_name, inet_ntop(AF_INET, &address, buf, sizeof(buf)));
+}
+
+static int interface_up(int iface) {
+ int fd = -1;
+ struct ifreq ifreq;
+
+ if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
+ daemon_log(LOG_ERR, "socket() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ memset(&ifreq, 0, sizeof(ifreq));
+ if (!if_indextoname(iface, ifreq.ifr_name)) {
+ daemon_log(LOG_ERR, "if_indextoname() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ if (ioctl(fd, SIOCGIFFLAGS, &ifreq) < 0) {
+ daemon_log(LOG_ERR, "SIOCGIFFLAGS failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ ifreq.ifr_flags |= IFF_UP;
+
+ if (ioctl(fd, SIOCSIFFLAGS, &ifreq) < 0) {
+ daemon_log(LOG_ERR, "SIOCSIFFLAGS failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ close(fd);
+
+ return 0;
+
+fail:
+ if (fd >= 0)
+ close(fd);
+
+ 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;
+ socklen_t sa_len;
+
+ if (interface_up(iface) < 0)
+ goto fail;
+
+ if ((fd = socket(PF_PACKET, SOCK_DGRAM, 0)) < 0) {
+ daemon_log(LOG_ERR, "socket() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sll_family = AF_PACKET;
+ sa.sll_protocol = htons(ETH_P_ARP);
+ sa.sll_ifindex = iface;
+
+ if (bind(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
+ daemon_log(LOG_ERR, "bind() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ sa_len = sizeof(sa);
+ if (getsockname(fd, (struct sockaddr*) &sa, &sa_len) < 0) {
+ daemon_log(LOG_ERR, "getsockname() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ if (sa.sll_halen != ETHER_ADDRLEN) {
+ daemon_log(LOG_ERR, "getsockname() returned invalid hardware address.");
+ goto fail;
+ }
+
+ memcpy(hw_address, sa.sll_addr, ETHER_ADDRLEN);
+
+ return fd;
+
+fail:
+ if (fd >= 0)
+ close(fd);
+
+ return -1;
+}
+
+static int send_packet(int fd, int iface, ArpPacket *packet, size_t packet_len) {
+ struct sockaddr_ll sa;
+
+ assert(fd >= 0);
+ assert(packet);
+ assert(packet_len > 0);
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sll_family = AF_PACKET;
+ sa.sll_protocol = htons(ETH_P_ARP);
+ sa.sll_ifindex = iface;
+ sa.sll_halen = ETHER_ADDRLEN;
+ memset(sa.sll_addr, 0xFF, ETHER_ADDRLEN);
+
+ if (sendto(fd, packet->ether_payload, packet_len, 0, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
+ daemon_log(LOG_ERR, "sendto() failed: %s", strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+
+static int recv_packet(int fd, ArpPacket **packet, size_t *packet_len) {
+ int s;
+ struct sockaddr_ll sa;
+ socklen_t sa_len;
+ ssize_t r;
+
+ assert(fd >= 0);
+ assert(packet);
+ assert(packet_len);
+
+ *packet = NULL;
+
+ if (ioctl(fd, FIONREAD, &s) < 0) {
+ daemon_log(LOG_ERR, "FIONREAD failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ if (s <= 0)
+ s = 4096;
+
+ *packet = packet_new(s);
+
+ sa_len = sizeof(sa);
+ 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;
+ }
+
+ *packet_len = (size_t) r;
+
+ return 0;
+
+fail:
+ if (*packet) {
+ avahi_free(*packet);
+ *packet = NULL;
+ }
+
+ 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 = avahi_malloc(len);
+ 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);
+ }
+ }
+ avahi_free(buf);
+
+ return 0;
+}
+
+#define PCAP_TIMEOUT 500 /* 0.5s */
+
+static int open_socket(int iface, uint8_t *hw_address) {
+ struct bpf_program bpf;
+ char *filter;
+ 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;
+
+ /*
+ * Using a timeout for BPF is fairly portable across BSDs. On most
+ * modern versions, using the timeout/nonblock/poll method results in
+ * fairly sane behavior, with the timeout only coming into play during
+ * the next_ex() call itself (so, for us, that's only when there's
+ * data). On older versions, it may result in a PCAP_TIMEOUT busy-wait
+ * on some versions, though, as the poll() may terminate at the
+ * PCAP_TIMEOUT instead of the poll() timeout.
+ */
+ pp = pcap_open_live(ifname, 1500, 0, PCAP_TIMEOUT, __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);
+ }
+
+ /*
+ * Using setnonblock is a portability stop-gap. Using the timeout in
+ * combination with setnonblock will ensure on most BSDs that the
+ * next_ex call returns in a timely fashion.
+ */
+ err = pcap_setnonblock(pp, 1, __pcap_errbuf);
+ if (err == -1) {
+ pcap_close(pp);
+ return (-1);
+ }
+
+ filter = avahi_strdup_printf("arp and (ether dst ff:ff:ff:ff:ff:ff or "
+ "%02x:%02x:%02x:%02x:%02x:%02x)",
+ __lladdr[0], __lladdr[1],
+ __lladdr[2], __lladdr[3],
+ __lladdr[4], __lladdr[5]);
+ DEBUG(daemon_log(LOG_DEBUG, "Using pcap filter '%s'", filter));
+
+ err = pcap_compile(pp, &bpf, filter, 1, 0);
+ avahi_free(filter);
+ 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 AVAHI_GCC_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 AVAHI_GCC_UNUSED, int iface AVAHI_GCC_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 AVAHI_GCC_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 >= 0) {
+ /*
+ * err == 1: Just drop bogus packets (>1500 for an arp packet!?)
+ * on the floor.
+ *
+ * err == 0: We might have had traffic on the pcap fd that
+ * didn't match the filter, in which case we'll get 0 packets.
+ */
+ retval = 0;
+ } else
+ daemon_log(LOG_ERR, "pcap_next_ex(%d): %s",
+ err, pcap_geterr(__pp));
+
+ return (retval);
+}
+#endif /* __linux__ */
+
+int is_ll_address(uint32_t addr) {
+ return
+ ((ntohl(addr) & IPV4LL_NETMASK) == IPV4LL_NETWORK) &&
+ ((ntohl(addr) & 0x0000FF00) != 0x0000) &&
+ ((ntohl(addr) & 0x0000FF00) != 0xFF00);
+}
+
+static struct timeval *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)
+ avahi_timeval_add(tv, (AvahiUsec) (jitter*1000.0*rand()/(RAND_MAX+1.0)));
+
+ return tv;
+}
+
+static FILE* fork_dispatcher(void) {
+ FILE *ret;
+ int fds[2];
+ pid_t pid;
+
+ if (pipe(fds) < 0) {
+ daemon_log(LOG_ERR, "pipe() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ if ((pid = fork()) < 0)
+ goto fail;
+ else if (pid == 0) {
+ FILE *f = NULL;
+ int r = 1;
+
+ /* Please note that the signal pipe is not closed at this
+ * point, signals will thus be dispatched in the main
+ * process. */
+
+ daemon_retval_done();
+
+ avahi_set_proc_title(argv0, "%s: [%s] callout dispatcher", argv0, interface_name);
+
+ close(fds[1]);
+
+ if (!(f = fdopen(fds[0], "r"))) {
+ daemon_log(LOG_ERR, "fdopen() failed: %s", strerror(errno));
+ goto dispatcher_fail;
+ }
+
+ for (;;) {
+ CalloutEventInfo info;
+ char name[IFNAMSIZ], buf[64];
+ int k;
+
+ if (fread(&info, sizeof(info), 1, f) != 1) {
+ if (feof(f))
+ break;
+
+ daemon_log(LOG_ERR, "fread() failed: %s", strerror(errno));
+ goto dispatcher_fail;
+ }
+
+ assert(info.event <= CALLOUT_MAX);
+
+ if (!if_indextoname(info.ifindex, name)) {
+ daemon_log(LOG_ERR, "if_indextoname() failed: %s", strerror(errno));
+ continue;
+ }
+
+ if (daemon_exec("/", &k,
+ action_script, action_script,
+ callout_event_table[info.event],
+ name,
+ inet_ntop(AF_INET, &info.address, buf, sizeof(buf)), NULL) < 0) {
+
+ daemon_log(LOG_ERR, "Failed to run script: %s", strerror(errno));
+ continue;
+ }
+
+ if (k != 0)
+ daemon_log(LOG_WARNING, "Script execution failed with return value %i", k);
+ }
+
+ r = 0;
+
+ dispatcher_fail:
+
+ if (f)
+ fclose(f);
+
+#ifdef HAVE_CHROOT
+ /* If the main process is trapped inside a chroot() we have to
+ * remove the PID file for it */
+
+ if (!no_chroot && wrote_pid_file)
+ daemon_pid_file_remove();
+#endif
+
+ _exit(r);
+ }
+
+ /* parent */
+
+ close(fds[0]);
+ fds[0] = -1;
+
+ if (!(ret = fdopen(fds[1], "w"))) {
+ daemon_log(LOG_ERR, "fdopen() failed: %s", strerror(errno));
+ goto fail;
+ }
+
+ return ret;
+
+fail:
+ if (fds[0] >= 0)
+ close(fds[0]);
+ if (fds[1] >= 0)
+ close(fds[1]);
+
+ return NULL;
+}
+
+static int do_callout(FILE *f, CalloutEvent event, int iface, uint32_t addr) {
+ CalloutEventInfo info;
+ char buf[64], ifname[IFNAMSIZ];
+
+ daemon_log(LOG_INFO, "Callout %s, address %s on interface %s",
+ callout_event_table[event],
+ inet_ntop(AF_INET, &addr, buf, sizeof(buf)),
+ if_indextoname(iface, ifname));
+
+ info.event = event;
+ info.ifindex = iface;
+ info.address = addr;
+
+ if (fwrite(&info, sizeof(info), 1, f) != 1 || fflush(f) != 0) {
+ daemon_log(LOG_ERR, "Failed to write callout event: %s", strerror(errno));
+ return -1;
+ }
+
+ return 0;
+}
+
+#define set_env(key, value) putenv(avahi_strdup_printf("%s=%s", (key), (value)))
+
+static int drop_privs(void) {
+ struct passwd *pw;
+ struct group * gr;
+ int r;
+ mode_t u;
+
+ pw = NULL;
+ gr = NULL;
+
+ /* Get user/group ID */
+
+ if (!no_drop_root) {
+
+ if (!(pw = getpwnam(AVAHI_AUTOIPD_USER))) {
+ daemon_log(LOG_ERR, "Failed to find user '"AVAHI_AUTOIPD_USER"'.");
+ return -1;
+ }
+
+ if (!(gr = getgrnam(AVAHI_AUTOIPD_GROUP))) {
+ daemon_log(LOG_ERR, "Failed to find group '"AVAHI_AUTOIPD_GROUP"'.");
+ return -1;
+ }
+
+ daemon_log(LOG_INFO, "Found user '"AVAHI_AUTOIPD_USER"' (UID %lu) and group '"AVAHI_AUTOIPD_GROUP"' (GID %lu).", (unsigned long) pw->pw_uid, (unsigned long) gr->gr_gid);
+ }
+
+ /* Create directory */
+ u = umask(0000);
+ r = mkdir(AVAHI_IPDATA_DIR, 0755);
+ umask(u);
+
+ if (r < 0 && errno != EEXIST) {
+ daemon_log(LOG_ERR, "mkdir(\""AVAHI_IPDATA_DIR"\"): %s", strerror(errno));
+ return -1;
+ }
+
+ /* Convey working directory */
+
+ if (!no_drop_root) {
+ struct stat st;
+
+ chown(AVAHI_IPDATA_DIR, pw->pw_uid, gr->gr_gid);
+
+ if (stat(AVAHI_IPDATA_DIR, &st) < 0) {
+ daemon_log(LOG_ERR, "stat(): %s\n", strerror(errno));
+ return -1;
+ }
+
+ if (!S_ISDIR(st.st_mode) || st.st_uid != pw->pw_uid || st.st_gid != gr->gr_gid) {
+ daemon_log(LOG_ERR, "Failed to create runtime directory "AVAHI_IPDATA_DIR".");
+ return -1;
+ }
+ }
+
+#ifdef HAVE_CHROOT
+
+ if (!no_chroot) {
+ if (chroot(AVAHI_IPDATA_DIR) < 0) {
+ daemon_log(LOG_ERR, "Failed to chroot(): %s", strerror(errno));
+ return -1;
+ }
+
+ daemon_log(LOG_INFO, "Successfully called chroot().");
+ chdir("/");
+
+ /* Since we are now trapped inside a chroot we cannot remove
+ * the pid file anymore, the helper process will do that for us. */
+ wrote_pid_file = 0;
+ }
+
+#endif
+
+ if (!no_drop_root) {
+
+ if (initgroups(AVAHI_AUTOIPD_USER, gr->gr_gid) != 0) {
+ daemon_log(LOG_ERR, "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 privileges"
+#endif
+
+ if (r < 0) {
+ daemon_log(LOG_ERR, "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 privileges"
+#endif
+
+ if (r < 0) {
+ daemon_log(LOG_ERR, "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);
+
+ daemon_log(LOG_INFO, "Successfully dropped root privileges.");
+ }
+
+ return 0;
+}
+
+static int loop(int iface, uint32_t addr) {
+ enum {
+ FD_ARP,
+ FD_IFACE,
+ FD_SIGNAL,
+ FD_MAX
+ };
+
+ int fd = -1, ret = -1;
+ struct timeval next_wakeup;
+ int next_wakeup_valid = 0;
+ char buf[64];
+ ArpPacket *in_packet = NULL;
+ size_t in_packet_len = 0;
+ ArpPacket *out_packet = NULL;
+ size_t out_packet_len;
+ uint8_t hw_address[ETHER_ADDRLEN];
+ struct pollfd pollfds[FD_MAX];
+ int iface_fd = -1;
+ Event event = EVENT_NULL;
+ int retval_sent = !daemonize;
+ State st;
+ FILE *dispatcher = NULL;
+ char *address_fn = NULL;
+ const char *p;
+
+ daemon_signal_init(SIGINT, SIGTERM, SIGCHLD, SIGHUP, 0);
+
+ if (!(dispatcher = fork_dispatcher()))
+ goto fail;
+
+ if ((fd = open_socket(iface, hw_address)) < 0)
+ goto fail;
+
+ if ((iface_fd = iface_init(iface)) < 0)
+ goto fail;
+
+ if (drop_privs() < 0)
+ goto fail;
+
+ if (force_bind)
+ st = STATE_START;
+ else if (iface_get_initial_state(&st) < 0)
+ goto fail;
+
+#ifdef HAVE_CHROOT
+ if (!no_chroot)
+ p = "";
+ else
+#endif
+ p = AVAHI_IPDATA_DIR;
+
+ address_fn = avahi_strdup_printf(
+ "%s/%02x:%02x:%02x:%02x:%02x:%02x", p,
+ hw_address[0], hw_address[1],
+ hw_address[2], hw_address[3],
+ hw_address[4], hw_address[5]);
+
+ if (!addr)
+ load_address(address_fn, &addr);
+
+ if (addr && !is_ll_address(addr)) {
+ daemon_log(LOG_WARNING, "Requested address %s is not from IPv4LL range 169.254/16 or a reserved address, ignoring.", inet_ntop(AF_INET, &addr, buf, sizeof(buf)));
+ addr = 0;
+ }
+
+ if (!addr) {
+ int i;
+ uint32_t a = 1;
+
+ for (i = 0; i < ETHER_ADDRLEN; i++)
+ a += hw_address[i]*i;
+
+ a = (a % 0xFE00) + 0x0100;
+
+ addr = htonl(IPV4LL_NETWORK | (uint32_t) a);
+ }
+
+ assert(is_ll_address(addr));
+
+ set_state(st, 1, addr);
+
+ daemon_log(LOG_INFO, "Starting with address %s", inet_ntop(AF_INET, &addr, buf, sizeof(buf)));
+
+ if (state == STATE_SLEEPING)
+ daemon_log(LOG_INFO, "Routable address already assigned, sleeping.");
+
+ if (!retval_sent && (!wait_for_address || state == STATE_SLEEPING)) {
+ daemon_retval_send(0);
+ retval_sent = 1;
+ }
+
+ memset(pollfds, 0, sizeof(pollfds));
+ pollfds[FD_ARP].fd = fd;
+ pollfds[FD_ARP].events = POLLIN;
+ pollfds[FD_IFACE].fd = iface_fd;
+ pollfds[FD_IFACE].events = POLLIN;
+ pollfds[FD_SIGNAL].fd = daemon_signal_fd();
+ pollfds[FD_SIGNAL].events = POLLIN;
+
+ for (;;) {
+ int r, timeout;
+ AvahiUsec usec;
+
+ if (state == STATE_START) {
+
+ /* First, wait a random time */
+ set_state(STATE_WAITING_PROBE, 1, addr);
+
+ elapse_time(&next_wakeup, 0, PROBE_WAIT*1000);
+ next_wakeup_valid = 1;
+
+ } else if ((state == STATE_WAITING_PROBE && event == EVENT_TIMEOUT) ||
+ (state == STATE_PROBING && event == EVENT_TIMEOUT && n_iteration < PROBE_NUM-2)) {
+
+ /* Send a probe */
+ out_packet = packet_new_probe(addr, hw_address, &out_packet_len);
+ set_state(STATE_PROBING, 0, addr);
+
+ elapse_time(&next_wakeup, PROBE_MIN*1000, (PROBE_MAX-PROBE_MIN)*1000);
+ next_wakeup_valid = 1;
+
+ } else if (state == STATE_PROBING && event == EVENT_TIMEOUT && n_iteration >= PROBE_NUM-2) {
+
+ /* Send the last probe */
+ out_packet = packet_new_probe(addr, hw_address, &out_packet_len);
+ set_state(STATE_WAITING_ANNOUNCE, 1, addr);
+
+ elapse_time(&next_wakeup, ANNOUNCE_WAIT*1000, 0);
+ next_wakeup_valid = 1;
+
+ } else if ((state == STATE_WAITING_ANNOUNCE && event == EVENT_TIMEOUT) ||
+ (state == STATE_ANNOUNCING && event == EVENT_TIMEOUT && n_iteration < ANNOUNCE_NUM-1)) {
+
+ /* Send announcement packet */
+ out_packet = packet_new_announcement(addr, hw_address, &out_packet_len);
+ set_state(STATE_ANNOUNCING, 0, addr);
+
+ elapse_time(&next_wakeup, ANNOUNCE_INTERVAL*1000, 0);
+ next_wakeup_valid = 1;
+
+ if (n_iteration == 0) {
+ if (do_callout(dispatcher, CALLOUT_BIND, iface, addr) < 0)
+ goto fail;
+
+ n_conflict = 0;
+ }
+
+ } else if ((state == STATE_ANNOUNCING && event == EVENT_TIMEOUT && n_iteration >= ANNOUNCE_NUM-1)) {
+
+ daemon_log(LOG_INFO, "Successfully claimed IP address %s", inet_ntop(AF_INET, &addr, buf, sizeof(buf)));
+ set_state(STATE_RUNNING, 0, addr);
+
+ next_wakeup_valid = 0;
+
+ save_address(address_fn, addr);
+
+ if (!retval_sent) {
+ daemon_retval_send(0);
+ retval_sent = 1;
+ }
+
+ } else if (event == EVENT_PACKET) {
+ ArpPacketInfo info;
+
+ assert(in_packet);
+
+ if (packet_parse(in_packet, in_packet_len, &info) < 0)
+ daemon_log(LOG_WARNING, "Failed to parse incoming ARP packet.");
+ else {
+ int conflict = 0;
+
+ if (info.sender_ip_address == addr) {
+
+ if (memcmp(hw_address, info.sender_hw_address, ETHER_ADDRLEN)) {
+ /* Normal conflict */
+ conflict = 1;
+ daemon_log(LOG_INFO, "Received conflicting normal ARP packet.");
+ } else
+ daemon_log(LOG_DEBUG, "Received ARP packet back on source interface. Ignoring.");
+
+ } else if (state == STATE_WAITING_PROBE || state == STATE_PROBING || state == STATE_WAITING_ANNOUNCE) {
+ /* Probe conflict */
+ conflict = info.target_ip_address == addr && memcmp(hw_address, info.sender_hw_address, ETHER_ADDRLEN);
+
+ if (conflict)
+ daemon_log(LOG_INFO, "Received conflicting probe ARP packet.");
+ }
+
+ if (conflict) {
+
+ if (state == STATE_RUNNING || state == STATE_ANNOUNCING)
+ if (do_callout(dispatcher, CALLOUT_CONFLICT, iface, addr) < 0)
+ goto fail;
+
+ /* Pick a new address */
+ addr = pick_addr(addr);
+
+ daemon_log(LOG_INFO, "Trying address %s", inet_ntop(AF_INET, &addr, buf, sizeof(buf)));
+
+ n_conflict++;
+
+ set_state(STATE_WAITING_PROBE, 1, addr);
+
+ if (n_conflict >= MAX_CONFLICTS) {
+ daemon_log(LOG_WARNING, "Got too many conflicts, rate limiting new probes.");
+ elapse_time(&next_wakeup, RATE_LIMIT_INTERVAL*1000, PROBE_WAIT*1000);
+ } else
+ elapse_time(&next_wakeup, 0, PROBE_WAIT*1000);
+
+ next_wakeup_valid = 1;
+ } else
+ DEBUG(daemon_log(LOG_DEBUG, "Ignoring irrelevant ARP packet."));
+ }
+
+ } else if (event == EVENT_ROUTABLE_ADDR_CONFIGURED && !force_bind) {
+
+ daemon_log(LOG_INFO, "A routable address has been configured.");
+
+ if (state == STATE_RUNNING || state == STATE_ANNOUNCING)
+ if (do_callout(dispatcher, CALLOUT_UNBIND, iface, addr) < 0)
+ goto fail;
+
+ if (!retval_sent) {
+ daemon_retval_send(0);
+ retval_sent = 1;
+ }
+
+ set_state(STATE_SLEEPING, 1, addr);
+ next_wakeup_valid = 0;
+
+ } else if (event == EVENT_ROUTABLE_ADDR_UNCONFIGURED && state == STATE_SLEEPING && !force_bind) {
+
+ daemon_log(LOG_INFO, "No longer a routable address configured, restarting probe process.");
+
+ set_state(STATE_WAITING_PROBE, 1, addr);
+
+ elapse_time(&next_wakeup, 0, PROBE_WAIT*1000);
+ next_wakeup_valid = 1;
+
+ } else if (event == EVENT_REFRESH_REQUEST && state == STATE_RUNNING) {
+
+ /* The user requested a reannouncing of the address by a SIGHUP */
+ daemon_log(LOG_INFO, "Reannouncing address.");
+
+ /* Send announcement packet */
+ out_packet = packet_new_announcement(addr, hw_address, &out_packet_len);
+ set_state(STATE_ANNOUNCING, 1, addr);
+
+ elapse_time(&next_wakeup, ANNOUNCE_INTERVAL*1000, 0);
+ next_wakeup_valid = 1;
+ }
+
+ if (out_packet) {
+ DEBUG(daemon_log(LOG_DEBUG, "sending..."));
+
+ if (send_packet(fd, iface, out_packet, out_packet_len) < 0)
+ goto fail;
+
+ avahi_free(out_packet);
+ out_packet = NULL;
+ }
+
+ if (in_packet) {
+ avahi_free(in_packet);
+ in_packet = NULL;
+ }
+
+ event = EVENT_NULL;
+ timeout = -1;
+
+ if (next_wakeup_valid) {
+ usec = avahi_age(&next_wakeup);
+ timeout = usec < 0 ? (int) (-usec/1000) : 0;
+ }
+
+ DEBUG(daemon_log(LOG_DEBUG, "sleeping %ims", timeout));
+
+ while ((r = poll(pollfds, FD_MAX, timeout)) < 0 && errno == EINTR)
+ ;
+
+ if (r < 0) {
+ daemon_log(LOG_ERR, "poll() failed: %s", strerror(r));
+ goto fail;
+ } else if (r == 0) {
+ event = EVENT_TIMEOUT;
+ next_wakeup_valid = 0;
+ } else {
+
+
+ if (pollfds[FD_ARP].revents) {
+
+ if (pollfds[FD_ARP].revents == POLLERR) {
+ /* The interface is probably down, let's recreate our socket */
+
+ close_socket(fd);
+
+ if ((fd = open_socket(iface, hw_address)) < 0)
+ goto fail;
+
+ pollfds[FD_ARP].fd = fd;
+
+ } else {
+
+ assert(pollfds[FD_ARP].revents == POLLIN);
+
+ if (recv_packet(fd, &in_packet, &in_packet_len) < 0)
+ goto fail;
+
+ if (in_packet)
+ event = EVENT_PACKET;
+ }
+ }
+
+ if (event == EVENT_NULL &&
+ pollfds[FD_IFACE].revents) {
+
+ assert(pollfds[FD_IFACE].revents == POLLIN);
+
+ if (iface_process(&event) < 0)
+ goto fail;
+ }
+
+ if (event == EVENT_NULL &&
+ pollfds[FD_SIGNAL].revents) {
+
+ int sig;
+ assert(pollfds[FD_SIGNAL].revents == POLLIN);
+
+ if ((sig = daemon_signal_next()) <= 0) {
+ daemon_log(LOG_ERR, "daemon_signal_next() failed");
+ goto fail;
+ }
+
+ switch(sig) {
+ case SIGINT:
+ case SIGTERM:
+ daemon_log(LOG_INFO, "Got %s, quitting.", sig == SIGINT ? "SIGINT" : "SIGTERM");
+ ret = 0;
+ goto fail;
+
+ case SIGCHLD:
+ waitpid(-1, NULL, WNOHANG);
+ break;
+
+ case SIGHUP:
+ event = EVENT_REFRESH_REQUEST;
+ break;
+ }
+
+ }
+ }
+ }
+
+ ret = 0;
+
+fail:
+
+ if (state == STATE_RUNNING || state == STATE_ANNOUNCING)
+ do_callout(dispatcher, CALLOUT_STOP, iface, addr);
+
+ avahi_free(out_packet);
+ avahi_free(in_packet);
+
+ if (fd >= 0)
+ close_socket(fd);
+
+ if (iface_fd >= 0)
+ iface_done();
+
+ if (daemonize && !retval_sent)
+ daemon_retval_send(ret);
+
+ if (dispatcher)
+ fclose(dispatcher);
+
+ if (address_fn)
+ avahi_free(address_fn);
+
+ return ret;
+}
+
+
+static void help(FILE *f, const char *a0) {
+ fprintf(f,
+ "%s [options] INTERFACE\n"
+ " -h --help Show this help\n"
+ " -D --daemonize Daemonize after startup\n"
+ " -s --syslog Write log messages to syslog(3) instead of STDERR\n"
+ " -k --kill Kill a running daemon\n"
+ " -r --refresh Request a running daemon refresh its IP address\n"
+ " -c --check Return 0 if a daemon is already running\n"
+ " -V --version Show version\n"
+ " -S --start=ADDRESS Start with this address from the IPv4LL range\n"
+ " 169.254.0.0/16\n"
+ " -t --script=script Action script to run (defaults to\n"
+ " "AVAHI_IPCONF_SCRIPT")\n"
+ " -w --wait Wait until an address has been acquired before\n"
+ " daemonizing\n"
+ " --force-bind Assign an IPv4LL address even if a routable address\n"
+ " is already assigned\n"
+ " --no-drop-root Don't drop privileges\n"
+#ifdef HAVE_CHROOT
+ " --no-chroot Don't chroot()\n"
+#endif
+ " --no-proc-title Don't modify process title\n"
+ " --debug Increase verbosity\n",
+ a0);
+}
+
+static int parse_command_line(int argc, char *argv[]) {
+ int c;
+
+ enum {
+ OPTION_NO_PROC_TITLE = 256,
+ OPTION_FORCE_BIND,
+ OPTION_DEBUG,
+ OPTION_NO_DROP_ROOT,
+#ifdef HAVE_CHROOT
+ OPTION_NO_CHROOT
+#endif
+ };
+
+ static const struct option long_options[] = {
+ { "help", no_argument, NULL, 'h' },
+ { "daemonize", no_argument, NULL, 'D' },
+ { "syslog", no_argument, NULL, 's' },
+ { "kill", no_argument, NULL, 'k' },
+ { "refresh", no_argument, NULL, 'r' },
+ { "check", no_argument, NULL, 'c' },
+ { "version", no_argument, NULL, 'V' },
+ { "start", required_argument, NULL, 'S' },
+ { "script", required_argument, NULL, 't' },
+ { "wait", no_argument, NULL, 'w' },
+ { "force-bind", no_argument, NULL, OPTION_FORCE_BIND },
+ { "no-drop-root", no_argument, NULL, OPTION_NO_DROP_ROOT },
+#ifdef HAVE_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 }
+ };
+
+ while ((c = getopt_long(argc, argv, "hDskrcVS:t:w", long_options, NULL)) >= 0) {
+
+ switch(c) {
+ case 's':
+ use_syslog = 1;
+ break;
+ 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;
+ case 'S':
+
+ if ((start_address = inet_addr(optarg)) == (uint32_t) -1) {
+ fprintf(stderr, "Failed to parse IP address '%s'.", optarg);
+ return -1;
+ }
+ break;
+ case 't':
+ avahi_free(action_script);
+ action_script = avahi_strdup(optarg);
+ break;
+ case 'w':
+ wait_for_address = 1;
+ break;
+
+ case OPTION_NO_PROC_TITLE:
+ modify_proc_title = 0;
+ break;
+
+ case OPTION_DEBUG:
+ debug = 1;
+ break;
+
+ case OPTION_FORCE_BIND:
+ force_bind = 1;
+ break;
+
+ case OPTION_NO_DROP_ROOT:
+ no_drop_root = 1;
+ break;
+
+#ifdef HAVE_CHROOT
+ case OPTION_NO_CHROOT:
+ no_chroot = 1;
+ break;
+#endif
+
+ default:
+ return -1;
+ }
+ }
+
+ if (command == DAEMON_RUN ||
+ command == DAEMON_KILL ||
+ command == DAEMON_REFRESH ||
+ command == DAEMON_CHECK) {
+
+ if (optind >= argc) {
+ fprintf(stderr, "Missing interface name.\n");
+ return -1;
+ }
+
+ interface_name = avahi_strdup(argv[optind++]);
+ }
+
+ if (optind != argc) {
+ fprintf(stderr, "Too many arguments\n");
+ return -1;
+ }
+
+ if (!action_script)
+ action_script = avahi_strdup(AVAHI_IPCONF_SCRIPT);
+
+ return 0;
+}
+
+static const char* pid_file_proc(void) {
+ return pid_file_name;
+}
+
+int main(int argc, char*argv[]) {
+ int r = 1;
+ char *log_ident = NULL;
+
+ signal(SIGPIPE, SIG_IGN);
+
+ if ((argv0 = strrchr(argv[0], '/')))
+ argv0 = avahi_strdup(argv0 + 1);
+ else
+ argv0 = avahi_strdup(argv[0]);
+
+ daemon_log_ident = argv0;
+
+ if (parse_command_line(argc, argv) < 0)
+ goto finish;
+
+ if (modify_proc_title)
+ avahi_init_proc_title(argc, argv);
+
+ daemon_log_ident = log_ident = avahi_strdup_printf("%s(%s)", argv0, interface_name);
+ daemon_pid_file_proc = pid_file_proc;
+ pid_file_name = avahi_strdup_printf(AVAHI_RUNTIME_DIR"/avahi-autoipd.%s.pid", interface_name);
+
+ if (command == DAEMON_RUN) {
+ pid_t pid;
+ int ifindex;
+
+ init_rand_seed();
+
+ if ((ifindex = if_nametoindex(interface_name)) <= 0) {
+ daemon_log(LOG_ERR, "Failed to get index for interface name '%s': %s", interface_name, strerror(errno));
+ goto finish;
+ }
+
+ 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 */
+ }
+
+ if (use_syslog || daemonize)
+ daemon_log_use = DAEMON_LOG_SYSLOG;
+
+ 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;
+
+ avahi_set_proc_title(argv0, "%s: [%s] starting up", argv0, interface_name);
+
+ if (loop(ifindex, start_address) < 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();
+
+ avahi_free(log_ident);
+ avahi_free(pid_file_name);
+ avahi_free(argv0);
+ avahi_free(interface_name);
+ avahi_free(action_script);
+
+ return r;
+}
diff --git a/avahi-autoipd/main.h b/avahi-autoipd/main.h
new file mode 100644
index 0000000..cc02df7
--- /dev/null
+++ b/avahi-autoipd/main.h
@@ -0,0 +1,45 @@
+#ifndef fooavahimainhfoo
+#define fooavahimainhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 enum Event {
+ EVENT_NULL,
+ EVENT_PACKET,
+ EVENT_TIMEOUT,
+ EVENT_ROUTABLE_ADDR_CONFIGURED,
+ EVENT_ROUTABLE_ADDR_UNCONFIGURED,
+ EVENT_REFRESH_REQUEST
+} Event;
+
+typedef enum State {
+ STATE_START,
+ STATE_WAITING_PROBE,
+ STATE_PROBING,
+ STATE_WAITING_ANNOUNCE,
+ STATE_ANNOUNCING,
+ STATE_RUNNING,
+ STATE_SLEEPING,
+ STATE_MAX
+} State;
+
+int is_ll_address(uint32_t addr);
+
+#endif
diff --git a/avahi-client.pc.in b/avahi-client.pc.in
new file mode 100644
index 0000000..65ee8d8
--- /dev/null
+++ b/avahi-client.pc.in
@@ -0,0 +1,10 @@
+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/avahi-client/.gitignore b/avahi-client/.gitignore
new file mode 100644
index 0000000..262943b
--- /dev/null
+++ b/avahi-client/.gitignore
@@ -0,0 +1,12 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+check-nss-test
+client-test
+rr-test
+srv-test
+xdg-config-test
diff --git a/avahi-client/Makefile.am b/avahi-client/Makefile.am
new file mode 100644
index 0000000..f11b11d
--- /dev/null
+++ b/avahi-client/Makefile.am
@@ -0,0 +1,83 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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) -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/avahi-client/browser.c b/avahi-client/browser.c
new file mode 100644
index 0000000..c978d94
--- /dev/null
+++ b/avahi-client/browser.c
@@ -0,0 +1,1025 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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, &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 (!(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/avahi-client/check-nss-test.c b/avahi-client/check-nss-test.c
new file mode 100644
index 0000000..7c15500
--- /dev/null
+++ b/avahi-client/check-nss-test.c
@@ -0,0 +1,31 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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");
+ return 0;
+}
diff --git a/avahi-client/check-nss.c b/avahi-client/check-nss.c
new file mode 100644
index 0000000..ea266c4
--- /dev/null
+++ b/avahi-client/check-nss.c
@@ -0,0 +1,55 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-client/client-test.c b/avahi-client/client-test.c
new file mode 100644
index 0000000..7d04a6a
--- /dev/null
+++ b/avahi-client/client-test.c
@@ -0,0 +1,328 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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, (char*) "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, (char*) "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, (char*) "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, (char*) "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, (char*) "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, (char*) "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, (char*) "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, (char*) "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, (char*) "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/avahi-client/client.c b/avahi-client/client.c
new file mode 100644
index 0000000..70cc35d
--- /dev/null
+++ b/avahi-client/client.c
@@ -0,0 +1,958 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <avahi-common/i18n.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, AvahiClientState 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 (old[0] &&
+ avahi_client_is_connected(client)) {
+
+ /* Regardless if the server lost 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, (AvahiClientState) 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;
+ DBusMessage *message = NULL, *reply = NULL;
+
+ avahi_init_i18n();
+
+ 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 (!(message = dbus_message_new_method_call(AVAHI_DBUS_NAME, AVAHI_DBUS_PATH_SERVER, "org.freedesktop.DBus.Peer", "Ping")))
+ goto fail;
+
+ reply = dbus_connection_send_with_reply_and_block (client->bus, message, -1, &error);
+
+ if (!reply || 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;
+ }
+
+ dbus_message_unref(message);
+
+ if (reply)
+ dbus_message_unref(reply);
+
+ return client;
+
+fail:
+
+ if (message)
+ dbus_message_unref(message);
+ if (reply)
+ dbus_message_unref(reply);
+
+ 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/avahi-client/client.h b/avahi-client/client.h
new file mode 100644
index 0000000..1039da5
--- /dev/null
+++ b/avahi-client/client.h
@@ -0,0 +1,117 @@
+#ifndef fooclienthfoo
+#define fooclienthfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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() */);
+
+/** @{ \name Construction and destruction */
+
+/** 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. 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. */);
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Properties */
+
+/** 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);
+
+/** @{ \name Error Handling */
+
+/** Get the last error number. See avahi_strerror() for converting this error code into a human readable string. */
+int avahi_client_errno (AvahiClient*);
+
+/** @} */
+
+/** \cond fulldocs */
+/** Return the local service cookie. returns AVAHI_SERVICE_COOKIE_INVALID on failure. */
+uint32_t avahi_client_get_local_service_cookie(AvahiClient *client);
+/** \endcond */
+
+/** @{ \name Libc NSS Support */
+
+/** 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/avahi-client/entrygroup.c b/avahi-client/entrygroup.c
new file mode 100644
index 0000000..d809d60
--- /dev/null
+++ b/avahi-client/entrygroup.c
@@ -0,0 +1,890 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-client/internal.h b/avahi-client/internal.h
new file mode 100644
index 0000000..e5f3beb
--- /dev/null
+++ b/avahi-client/internal.h
@@ -0,0 +1,172 @@
+#ifndef foointernalhfoo
+#define foointernalhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-client/lookup.h b/avahi-client/lookup.h
new file mode 100644
index 0000000..52407f4
--- /dev/null
+++ b/avahi-client/lookup.h
@@ -0,0 +1,314 @@
+#ifndef fooclientlookuphfoo
+#define fooclientlookuphfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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
+
+/** @{ \name Domain Browser */
+
+/** A domain browser object */
+typedef struct AvahiDomainBrowser AvahiDomainBrowser;
+
+/** 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);
+
+/** 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 *);
+
+/** @} */
+
+/** @{ \name Service Browser */
+
+/** A service browser object */
+typedef struct AvahiServiceBrowser AvahiServiceBrowser;
+
+/** 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);
+
+/** Browse for services of a type on the network. In most cases you
+ * probably want to pass AVAHI_IF_UNSPEC and AVAHI_PROTO_UNSPED in
+ * interface, resp. protocol to browse on all local networks. The
+ * specified callback will be called whenever a new service appears
+ * or is removed from the network. Please note that events may be
+ * collapsed to minimize traffic (i.e. a REMOVED followed by a NEW for
+ * the same service data is dropped because redundant). If you want to
+ * subscribe to service data changes, you should use
+ * avahi_service_resolver_new() and keep it open, in which case you
+ * will be notified via AVAHI_RESOLVE_FOUND everytime the service data
+ * changes. */
+AvahiServiceBrowser* avahi_service_browser_new (
+ AvahiClient *client,
+ AvahiIfIndex interface, /**< In most cases pass AVAHI_IF_UNSPEC here */
+ AvahiProtocol protocol, /**< In most cases pass AVAHI_PROTO_UNSPEC here */
+ const char *type, /**< A service type such as "_http._tcp" */
+ const char *domain, /**< A domain to browse in. In most cases you want to pass NULL here for the default domain (usually ".local") */
+ 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 *);
+
+/** @} */
+
+/** \cond fulldocs */
+/** A service type browser object */
+typedef struct AvahiServiceTypeBrowser AvahiServiceTypeBrowser;
+
+/** 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);
+
+/** 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 *);
+
+/** \endcond */
+
+/** @{ \name Service Resolver */
+
+/** A service resolver object */
+typedef struct AvahiServiceResolver AvahiServiceResolver;
+
+/** 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);
+
+/** Create a new service resolver object. Please make sure to pass all
+ * the service data you received via avahi_service_browser_new()'s
+ * callback function, especially interface and protocol. The protocol
+ * argument specifies the protocol (IPv4 or IPv6) to use as transport
+ * for the queries which are sent out by this resolver. The
+ * aprotocol argument specifies the adress family (IPv4 or IPv6) of
+ * the address of the service we are looking for. Generally, on
+ * "protocol" you should only pass what was supplied to you as
+ * parameter to your AvahiServiceBrowserCallback. In "aprotocol" you
+ * should pass what your application code can deal with when
+ * connecting to the service. Or, more technically speaking: protocol
+ * specifies if the mDNS queries should be sent as UDP/IPv4
+ * resp. UDP/IPv6 packets. aprotocol specifies whether the query is for a A
+ * resp. AAAA resource record. */
+AvahiServiceResolver * avahi_service_resolver_new(
+ AvahiClient *client,
+ AvahiIfIndex interface, /**< Pass the interface argument you received in AvahiServiceBrowserCallback here. */
+ AvahiProtocol protocol, /**< Pass the protocol argument you received in AvahiServiceBrowserCallback here. */
+ const char *name, /**< Pass the name argument you received in AvahiServiceBrowserCallback here. */
+ const char *type, /**< Pass the type argument you received in AvahiServiceBrowserCallback here. */
+ const char *domain, /**< Pass the domain argument you received in AvahiServiceBrowserCallback here. */
+ AvahiProtocol aprotocol, /**< The desired address family of the service address to resolve. AVAHI_PROTO_UNSPEC if your application can deal with both IPv4 and IPv6 */
+ 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);
+
+/** @} */
+
+/** \cond fulldocs */
+/** A service resolver object */
+typedef struct AvahiHostNameResolver AvahiHostNameResolver;
+
+/** 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);
+
+/** 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);
+
+/** An address resolver object */
+typedef struct AvahiAddressResolver AvahiAddressResolver;
+
+/** 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);
+
+/** 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);
+
+/** \endcond */
+
+/** @{ \name Record Browser */
+
+/** A record browser object */
+typedef struct AvahiRecordBrowser AvahiRecordBrowser;
+
+/** 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 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/avahi-client/publish.h b/avahi-client/publish.h
new file mode 100644
index 0000000..ea731f2
--- /dev/null
+++ b/avahi-client/publish.h
@@ -0,0 +1,172 @@
+#ifndef fooclientpublishhfoo
+#define fooclientpublishhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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()*/);
+
+/** @{ \name Construction and destruction */
+
+/** 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. 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 */
+int avahi_entry_group_free (AvahiEntryGroup *);
+
+/** @} */
+
+/** @{ \name State */
+
+/** 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*);
+
+/** @} */
+
+/** @{ \name Adding and updating entries */
+
+/** 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. Must be valid service name. i.e. a string shorter than 63 characters and valid UTF-8. 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);
+
+/** \cond fulldocs */
+/** 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 */);
+/** \endcond */
+
+/** 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/avahi-client/resolver.c b/avahi-client/resolver.c
new file mode 100644
index 0000000..6ee15e9
--- /dev/null
+++ b/avahi-client/resolver.c
@@ -0,0 +1,778 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+ const uint8_t *k;
+ int n;
+
+ 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);
+
+ 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);
+ }
+
+ 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/avahi-client/rr-test.c b/avahi-client/rr-test.c
new file mode 100644
index 0000000..0402585
--- /dev/null
+++ b/avahi-client/rr-test.c
@@ -0,0 +1,111 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-client/srv-test.c b/avahi-client/srv-test.c
new file mode 100644
index 0000000..650bd77
--- /dev/null
+++ b/avahi-client/srv-test.c
@@ -0,0 +1,76 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-client/xdg-config-test.c b/avahi-client/xdg-config-test.c
new file mode 100644
index 0000000..a7ee63e
--- /dev/null
+++ b/avahi-client/xdg-config-test.c
@@ -0,0 +1,38 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ return 0;
+}
diff --git a/avahi-client/xdg-config.c b/avahi-client/xdg-config.c
new file mode 100644
index 0000000..fc65016
--- /dev/null
+++ b/avahi-client/xdg-config.c
@@ -0,0 +1,68 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+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/avahi-client/xdg-config.h b/avahi-client/xdg-config.h
new file mode 100644
index 0000000..6c855ab
--- /dev/null
+++ b/avahi-client/xdg-config.h
@@ -0,0 +1,27 @@
+#ifndef fooxdgconfighfoo
+#define fooxdgconfighfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/.gitignore b/avahi-common/.gitignore
new file mode 100644
index 0000000..b523810
--- /dev/null
+++ b/avahi-common/.gitignore
@@ -0,0 +1,14 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+alternative-test
+domain-test
+strlst-test
+timeval-test
+utf8-test
+watch-test
+watch-test-thread
diff --git a/avahi-common/Makefile.am b/avahi-common/Makefile.am
new file mode 100644
index 0000000..79d062f
--- /dev/null
+++ b/avahi-common/Makefile.am
@@ -0,0 +1,129 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 \
+ i18n.c i18n.h
+
+libavahi_common_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) -DAVAHI_LOCALEDIR=\"$(avahilocaledir)\"
+libavahi_common_la_LIBADD = $(AM_LDADD) $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(INTLLIBS)
+libavahi_common_la_LDFLAGS = $(AM_LDFLAGS) -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/avahi-common/address.c b/avahi-common/address.c
new file mode 100644
index 0000000..e8f6148
--- /dev/null
+++ b/avahi-common/address.c
@@ -0,0 +1,155 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/address.h b/avahi-common/address.h
new file mode 100644
index 0000000..a14104f
--- /dev/null
+++ b/avahi-common/address.h
@@ -0,0 +1,119 @@
+#ifndef fooaddresshfoo
+#define fooaddresshfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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_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))
+
+/** 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-independent data field */
+ } data;
+} AvahiAddress;
+
+/** @{ \name Comparison */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name String conversion */
+
+/** 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 specified 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);
+
+/** @} */
+
+/** \cond fulldocs */
+/** 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);
+/** \endcond */
+
+/** @{ \name Protocol/address family handling */
+
+/** 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/avahi-common/alternative-test.c b/avahi-common/alternative-test.c
new file mode 100644
index 0000000..9255435
--- /dev/null
+++ b/avahi-common/alternative-test.c
@@ -0,0 +1,90 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+#include "domain.h"
+
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
+ const char* const test_strings[] = {
+ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
+ "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXüüüüüüü",
+ "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 <= 100; 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;
+
+ if (j)
+ assert(avahi_is_valid_service_name(n));
+ else
+ assert(avahi_is_valid_host_name(n));
+
+ printf("%s\n", r);
+ }
+ }
+ }
+
+ avahi_free(r);
+ return 0;
+}
diff --git a/avahi-common/alternative.c b/avahi-common/alternative.c
new file mode 100644
index 0000000..b3d39f0
--- /dev/null
+++ b/avahi-common/alternative.c
@@ -0,0 +1,182 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+#include "domain.h"
+#include "utf8.h"
+
+static void drop_incomplete_utf8(char *c) {
+ char *e;
+
+ e = strchr(c, 0) - 1;
+
+ while (e >= c) {
+
+ if (avahi_utf8_valid(c))
+ break;
+
+ assert(*e & 128);
+ *e = 0;
+
+ e--;
+ }
+}
+
+char *avahi_alternative_host_name(const char *s) {
+ const char *e;
+ char *r;
+
+ assert(s);
+
+ if (!avahi_is_valid_host_name(s))
+ return NULL;
+
+ if ((e = strrchr(s, '-'))) {
+ const char *p;
+
+ e++;
+
+ for (p = e; *p; p++)
+ if (!isdigit(*p)) {
+ e = NULL;
+ break;
+ }
+
+ if (e && (*e == '0' || *e == 0))
+ e = NULL;
+ }
+
+ if (e) {
+ char *c, *m;
+ size_t l;
+ int n;
+
+ n = atoi(e)+1;
+ if (!(m = avahi_strdup_printf("%i", n)))
+ return NULL;
+
+ l = e-s-1;
+
+ if (l >= AVAHI_LABEL_MAX-1-strlen(m)-1)
+ l = AVAHI_LABEL_MAX-1-strlen(m)-1;
+
+ if (!(c = avahi_strndup(s, l))) {
+ avahi_free(m);
+ return NULL;
+ }
+
+ drop_incomplete_utf8(c);
+
+ r = avahi_strdup_printf("%s-%s", c, m);
+ avahi_free(c);
+ avahi_free(m);
+
+ } else {
+ char *c;
+
+ if (!(c = avahi_strndup(s, AVAHI_LABEL_MAX-1-2)))
+ return NULL;
+
+ drop_incomplete_utf8(c);
+
+ r = avahi_strdup_printf("%s-2", c);
+ avahi_free(c);
+ }
+
+ assert(avahi_is_valid_host_name(r));
+
+ return r;
+}
+
+char *avahi_alternative_service_name(const char *s) {
+ const char *e;
+ char *r;
+
+ assert(s);
+
+ if (!avahi_is_valid_service_name(s))
+ return NULL;
+
+ 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, *m;
+ size_t l;
+ int n;
+
+ n = atoi(e)+1;
+ if (!(m = avahi_strdup_printf("%i", n)))
+ return NULL;
+
+ l = e-s-2;
+
+ if (l >= AVAHI_LABEL_MAX-1-strlen(m)-2)
+ l = AVAHI_LABEL_MAX-1-strlen(m)-2;
+
+ if (!(c = avahi_strndup(s, l))) {
+ avahi_free(m);
+ return NULL;
+ }
+
+ drop_incomplete_utf8(c);
+
+ r = avahi_strdup_printf("%s #%s", c, m);
+ avahi_free(c);
+ avahi_free(m);
+ } else {
+ char *c;
+
+ if (!(c = avahi_strndup(s, AVAHI_LABEL_MAX-1-3)))
+ return NULL;
+
+ drop_incomplete_utf8(c);
+
+ r = avahi_strdup_printf("%s #2", c);
+ avahi_free(c);
+ }
+
+ assert(avahi_is_valid_service_name(r));
+
+ return r;
+}
diff --git a/avahi-common/alternative.h b/avahi-common/alternative.h
new file mode 100644
index 0000000..9b044de
--- /dev/null
+++ b/avahi-common/alternative.h
@@ -0,0 +1,43 @@
+#ifndef fooalternativehfoo
+#define fooalternativehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 "foo-2" becomes "foo-3"
+ * 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/avahi-common/cdecl.h b/avahi-common/cdecl.h
new file mode 100644
index 0000000..aef6aba
--- /dev/null
+++ b/avahi-common/cdecl.h
@@ -0,0 +1,38 @@
+#ifndef foocdeclhfoo
+#define foocdeclhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 macro 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 macro switches back to C++ mode, otherwise does nothing */
+#define AVAHI_C_DECL_END
+
+#endif
+
+#endif
diff --git a/avahi-common/dbus-watch-glue.c b/avahi-common/dbus-watch-glue.c
new file mode 100644
index 0000000..b18f555
--- /dev/null
+++ b/avahi-common/dbus-watch-glue.c
@@ -0,0 +1,357 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 "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,
+#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR > 1) || (DBUS_VERSION_MAJOR > 1)
+ dbus_watch_get_unix_fd(dbus_watch),
+#else
+ dbus_watch_get_fd(dbus_watch),
+#endif
+ 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/avahi-common/dbus-watch-glue.h b/avahi-common/dbus-watch-glue.h
new file mode 100644
index 0000000..138ea97
--- /dev/null
+++ b/avahi-common/dbus-watch-glue.h
@@ -0,0 +1,33 @@
+#ifndef foodbuswatchgluehfoo
+#define foodbuswatchgluehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/dbus.c b/avahi-common/dbus.c
new file mode 100644
index 0000000..f19c77c
--- /dev/null
+++ b/avahi-common/dbus.c
@@ -0,0 +1,138 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/dbus.h b/avahi-common/dbus.h
new file mode 100644
index 0000000..ea3e8a2
--- /dev/null
+++ b/avahi-common/dbus.h
@@ -0,0 +1,119 @@
+#ifndef foodbushfoo
+#define foodbushfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/defs.h b/avahi-common/defs.h
new file mode 100644
index 0000000..bb73a9d
--- /dev/null
+++ b/avahi-common/defs.h
@@ -0,0 +1,356 @@
+#ifndef foodefshfoo
+#define foodefshfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 C 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
+ * appliances 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
+ * using this API for software written in any language other than
+ * C (e.g. Python).
+ * \li <b>avahi-client</b>: a simplifying C wrapper around the D-Bus API. We
+ * recommend using this API in C or C++ progams. The D-Bus internals
+ * are hidden completely.
+ * \li <b>avahi-gobject</b>: an object-oriented C wrapper based on
+ * GLib's GObject. We recommd using this API for GNOME/Gtk programs.
+ *
+ * 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 <b>avahi-compat-libdns_sd</b>: the original Bonjour API as documented
+ * in the header file "dns_sd.h" by Apple Computer, Inc.
+ *
+ * \li <b>avahi-compat-howl</b>: 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!
+ *
+ * The native APIs (avahi-client and avahi-core) can be integrated
+ * into external event loops. We provide adapters for the following
+ * event loop implementations:
+ *
+ * \li <b>avahi-glib</b>: The GLIB main loop as used by GTk+/GNOME
+ *
+ * \li <b>avahi-qt</b>: The Qt main loop as used by Qt/KDE
+ *
+ * Finally, we provide a high-level Gtk+ GUI dialog called
+ * <b>avahi-ui</b> for user-friendly browsing for services.
+ *
+ * The doxygen-generated API documentation covers avahi-client
+ * (including its auxiliary APIs), the event loop adapters and
+ * avahi-ui. For the other APIs please consult the original
+ * documentation (for the compatibility APIs) or the header files.
+ *
+ * Please note that the doxygen-generated API documentation of the
+ * native Avahi API is not complete. A few definitions that are part
+ * of the Avahi API have been removed from this documentation, either
+ * because they are only relevant in a very few low-level applications
+ * or because they are considered obsolete. Please consult the C header
+ * files for all definitions that are part of the Avahi API. Please
+ * note that these hidden definitions are considered part of the Avahi
+ * API and will stay available in the API in the future.
+ *
+ * \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 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_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 might not necessarily
+ * be established.
+ * - Remove your services when the server enters
+ * AVAHI_SERVER_COLLISION or AVAHI_SERVER_REGISTERING state. Your
+ * services may not 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 RRs/subtypes (e.g. 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 then read 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_service_resolver_new() to acquire service data for 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.
+ * - 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 all its associated objects
+ * such as entry groups and browser objects prior to that) and
+ * reconnect to the server anew - again with passing
+ * AVAHI_CLIENT_NO_FAIL to avahi_client_new().
+ *
+ * We encourage implementing 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 necessarily 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
+
+/** @{ \name States */
+
+/** 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;
+
+/** 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;
+
+/** @} */
+
+/** @{ \name Flags */
+
+/** 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 */
+/** \cond fulldocs */
+ 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 */
+/** \endcond */
+ AVAHI_PUBLISH_UPDATE = 64, /**< Update existing records instead of adding new ones */
+/** \cond fulldocs */
+ 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 */
+/** \endcond */
+} AvahiPublishFlags;
+
+/** Some flags for lookup functions */
+typedef enum {
+/** \cond fulldocs */
+ AVAHI_LOOKUP_USE_WIDE_AREA = 1, /**< Force lookup via wide area DNS */
+ AVAHI_LOOKUP_USE_MULTICAST = 2, /**< Force lookup via multicast DNS */
+/** \endcond */
+ 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;
+
+/** @} */
+
+/** @{ \name Events */
+
+/** 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 sent */
+ 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;
+
+/** @} */
+
+/** @{ \name Other definitions */
+
+/** 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;
+
+/** @} */
+
+/** \cond fulldocs */
+/** 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)
+/** \endcond fulldocs */
+
+/** @{ \name DNS RR definitions */
+
+/** 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/avahi-common/domain-test.c b/avahi-common/domain-test.c
new file mode 100644
index 0000000..cf763ec
--- /dev/null
+++ b/avahi-common/domain-test.c
@@ -0,0 +1,123 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/domain.c b/avahi-common/domain.c
new file mode 100644
index 0000000..3b1ab68
--- /dev/null
+++ b/avahi-common/domain.c
@@ -0,0 +1,609 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/domain.h b/avahi-common/domain.h
new file mode 100644
index 0000000..a0dcd0f
--- /dev/null
+++ b/avahi-common/domain.h
@@ -0,0 +1,129 @@
+#ifndef foodomainhfoo
+#define foodomainhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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
+
+/** @{ \name Normalization */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Comparison */
+
+/** Return 1 when the specified domain names are equal, 0 otherwise */
+int avahi_domain_equal(const char *a, const char *b);
+
+/** Return some kind of hash value for the domain, useful for using domains as hash table keys. */
+unsigned avahi_domain_hash(const char *name);
+
+/** @} */
+
+/** @{ \name Escaping */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Validity Checks */
+
+/** Return 1 when the specified string contains a valid generic DNS-SD
+ * 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 DNS-SD
+ * 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 DNS-SD 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 DNS-SD 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);
+
+/** @} */
+
+/** @{ \name DNS-SD service name handling */
+
+/** Construct a valid complete DNS-SD 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);
+
+/** @} */
+
+/** @{ \name DNS-SD Subtype handling */
+
+/** 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);
+
+/** @} */
+
+AVAHI_C_DECL_END
+
+#endif
diff --git a/avahi-common/error.c b/avahi-common/error.c
new file mode 100644
index 0000000..63c5033
--- /dev/null
+++ b/avahi-common/error.c
@@ -0,0 +1,97 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+#include "i18n.h"
+
+const char *avahi_strerror(int error) {
+
+ const char * const msg[- AVAHI_ERR_MAX] = {
+ N_("OK"),
+ N_("Operation failed"),
+ N_("Bad state"),
+ N_("Invalid host name"),
+ N_("Invalid domain name"),
+ N_("No suitable network protocol available"),
+ N_("Invalid DNS TTL"),
+ N_("Resource record key is pattern"),
+ N_("Local name collision"),
+ N_("Invalid record"),
+
+ N_("Invalid service name"),
+ N_("Invalid service type"),
+ N_("Invalid port number"),
+ N_("Invalid record key"),
+ N_("Invalid address"),
+ N_("Timeout reached"),
+ N_("Too many clients"),
+ N_("Too many objects"),
+ N_("Too many entries"),
+ N_("OS Error"),
+
+ N_("Access denied"),
+ N_("Invalid operation"),
+ N_("An unexpected D-Bus error occurred"),
+ N_("Daemon connection failed"),
+ N_("Memory exhausted"),
+ N_("The object passed in was not valid"),
+ N_("Daemon not running"),
+ N_("Invalid interface index"),
+ N_("Invalid protocol specification"),
+ N_("Invalid flags"),
+
+ N_("Not found"),
+ N_("Invalid configuration"),
+ N_("Version mismatch"),
+ N_("Invalid service subtype"),
+ N_("Invalid packet"),
+ N_("Invalid DNS return code"),
+ N_("DNS failure: FORMERR"),
+ N_("DNS failure: SERVFAIL"),
+ N_("DNS failure: NXDOMAIN"),
+ N_("DNS failure: NOTIMP"),
+
+ N_("DNS failure: REFUSED"),
+ N_("DNS failure: YXDOMAIN"),
+ N_("DNS failure: YXRRSET"),
+ N_("DNS failure: NXRRSET"),
+ N_("DNS failure: NOTAUTH"),
+ N_("DNS failure: NOTZONE"),
+ N_("Invalid RDATA"),
+ N_("Invalid DNS type"),
+ N_("Invalid DNS class"),
+ N_("Not supported"),
+
+ N_("Not permitted"),
+ N_("Invalid argument"),
+ N_("Is empty"),
+ N_("The requested operation is invalid because redundant")
+ };
+
+ avahi_init_i18n();
+
+ if (-error < 0 || -error >= -AVAHI_ERR_MAX)
+ return _("Invalid Error Code");
+
+ return _(msg[-error]);
+}
diff --git a/avahi-common/error.h b/avahi-common/error.h
new file mode 100644
index 0000000..94511c9
--- /dev/null
+++ b/avahi-common/error.h
@@ -0,0 +1,107 @@
+#ifndef fooerrorhfoo
+#define fooerrorhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 occurred */
+ 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 it is 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/avahi-common/gccmacro.h b/avahi-common/gccmacro.h
new file mode 100644
index 0000000..4c97111
--- /dev/null
+++ b/avahi-common/gccmacro.h
@@ -0,0 +1,74 @@
+#ifndef foogccmacrohfoo
+#define foogccmacrohfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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) && (__GNUC_MINOR__ >= 3)
+#define AVAHI_GCC_ALLOC_SIZE(x) __attribute__ ((__alloc_size__(x)))
+#define AVAHI_GCC_ALLOC_SIZE2(x,y) __attribute__ ((__alloc_size__(x,y)))
+#else
+/** Macro for usage of GCC's alloc_size attribute */
+#define AVAHI_GCC_ALLOC_SIZE(x)
+#define AVAHI_GCC_ALLOC_SIZE2(x,y)
+#endif
+
+#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/avahi-common/i18n.c b/avahi-common/i18n.c
new file mode 100644
index 0000000..51c93e4
--- /dev/null
+++ b/avahi-common/i18n.c
@@ -0,0 +1,38 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 "i18n.h"
+
+void avahi_init_i18n(void) {
+
+ /* Not really thread safe, but this doesn't matter much since
+ * bindtextdomain is supposed to be idempotent anyway. */
+
+ static int done = 0;
+
+ if (!done) {
+ bindtextdomain(GETTEXT_PACKAGE, AVAHI_LOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ done = 1;
+ }
+}
diff --git a/avahi-common/i18n.h b/avahi-common/i18n.h
new file mode 100644
index 0000000..2a613e5
--- /dev/null
+++ b/avahi-common/i18n.h
@@ -0,0 +1,53 @@
+#ifndef fooi18nhfoo
+#define fooi18nhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 !defined(GETTEXT_PACKAGE)
+#error "Something is very wrong here, config.h needs to be included first"
+#endif
+
+#ifdef ENABLE_NLS
+
+#include <libintl.h>
+
+#define _(String) dgettext(GETTEXT_PACKAGE, String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+
+#else /* NLS is disabled */
+
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+
+#endif /* ENABLE_NLS */
+
+void avahi_init_i18n(void);
+
+#endif
diff --git a/avahi-common/llist.h b/avahi-common/llist.h
new file mode 100644
index 0000000..e37056d
--- /dev/null
+++ b/avahi-common/llist.h
@@ -0,0 +1,75 @@
+#ifndef foollistfoo
+#define foollistfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/malloc.c b/avahi-common/malloc.c
new file mode 100644
index 0000000..23b13a9
--- /dev/null
+++ b/avahi-common/malloc.c
@@ -0,0 +1,257 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/malloc.h b/avahi-common/malloc.h
new file mode 100644
index 0000000..ffaac3f
--- /dev/null
+++ b/avahi-common/malloc.h
@@ -0,0 +1,96 @@
+#ifndef foomallochfoo
+#define foomallochfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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) AVAHI_GCC_ALLOC_SIZE(1);
+
+/** Similar to avahi_malloc() but set the memory to zero */
+void *avahi_malloc0(size_t size) AVAHI_GCC_ALLOC_SIZE(1);
+
+/** Free some memory */
+void avahi_free(void *p);
+
+/** Similar to libc's realloc() */
+void *avahi_realloc(void *p, size_t size) AVAHI_GCC_ALLOC_SIZE(2);
+
+/** Internal helper for avahi_new() */
+static inline void* AVAHI_GCC_ALLOC_SIZE2(1,2) 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_GCC_ALLOC_SIZE2(1,2) 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) AVAHI_GCC_ALLOC_SIZE(2);
+
+/** Wraps allocator functions */
+typedef struct AvahiAllocator {
+ void* (*malloc)(size_t size) AVAHI_GCC_ALLOC_SIZE(1);
+ void (*free)(void *p);
+ void* (*realloc)(void *p, size_t size) AVAHI_GCC_ALLOC_SIZE(2);
+ void* (*calloc)(size_t nmemb, size_t size) AVAHI_GCC_ALLOC_SIZE2(1,2); /**< 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;
+
+/** \cond fulldocs */
+/** Same as avahi_strdup_printf() but take a va_list instead of varargs */
+char *avahi_strdup_vprintf(const char *fmt, va_list ap);
+/** \endcond */
+
+AVAHI_C_DECL_END
+
+#endif
diff --git a/avahi-common/rlist.c b/avahi-common/rlist.c
new file mode 100644
index 0000000..17dcb24
--- /dev/null
+++ b/avahi-common/rlist.c
@@ -0,0 +1,62 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/rlist.h b/avahi-common/rlist.h
new file mode 100644
index 0000000..9bcc1d5
--- /dev/null
+++ b/avahi-common/rlist.h
@@ -0,0 +1,49 @@
+#ifndef foorlistfoo
+#define foorlistfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/simple-watch.c b/avahi-common/simple-watch.c
new file mode 100644
index 0000000..8df18dd
--- /dev/null
+++ b/avahi-common/simple-watch.c
@@ -0,0 +1,649 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+
+ for (;;) {
+ errno = 0;
+
+ if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) {
+
+ if (errno == EINTR)
+ continue;
+
+ s->state = STATE_FAILURE;
+ return -1;
+ }
+
+ break;
+ }
+
+ /* The poll events are now valid again */
+ s->events_valid = 1;
+
+ /* 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/avahi-common/simple-watch.h b/avahi-common/simple-watch.h
new file mode 100644
index 0000000..72c1905
--- /dev/null
+++ b/avahi-common/simple-watch.h
@@ -0,0 +1,85 @@
+#ifndef foosimplewatchhfoo
+#define foosimplewatchhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/strlst-test.c b/avahi-common/strlst-test.c
new file mode 100644
index 0000000..0945b37
--- /dev/null
+++ b/avahi-common/strlst-test.c
@@ -0,0 +1,127 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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("%zu\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/avahi-common/strlst.c b/avahi-common/strlst.c
new file mode 100644
index 0000000..b861cf8
--- /dev/null
+++ b/avahi-common/strlst.c
@@ -0,0 +1,505 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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(size == 0 || 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;
+ va_list va2;
+
+ va_copy(va2, va);
+ n = vsnprintf((char*) r->text, len, format, va2);
+ va_end(va2);
+
+ 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/avahi-common/strlst.h b/avahi-common/strlst.h
new file mode 100644
index 0000000..94adcea
--- /dev/null
+++ b/avahi-common/strlst.h
@@ -0,0 +1,180 @@
+#ifndef footxtlisthfoo
+#define footxtlisthfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+
+/** @{ \name Construction and destruction */
+
+/** 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;
+
+/** \cond fulldocs */
+/** Same as avahi_string_list_new() but pass a va_list structure */
+AvahiStringList *avahi_string_list_new_va(va_list va);
+/** \endcond */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Adding strings */
+
+/** 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;
+
+/** \cond fulldocs */
+/** 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);
+/** \endcond */
+
+/** 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;
+
+/** \cond fulldocs */
+/** 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);
+/** \endcond */
+
+/** @} */
+
+/** @{ \name String list operations */
+
+/** 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 strings that contain NUL bytes. */
+char* avahi_string_list_to_string(AvahiStringList *l);
+
+/** \cond fulldocs */
+/** 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);
+/** \endcond */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Accessing items */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name DNS-SD TXT pair handling */
+
+/** 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);
+
+/** @} */
+
+/** \cond fulldocs */
+/** 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);
+/** \endcond */
+
+AVAHI_C_DECL_END
+
+#endif
+
diff --git a/avahi-common/thread-watch.c b/avahi-common/thread-watch.c
new file mode 100644
index 0000000..c0cadeb
--- /dev/null
+++ b/avahi-common/thread-watch.c
@@ -0,0 +1,186 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+
+ p->thread_running = 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/avahi-common/thread-watch.h b/avahi-common/thread-watch.h
new file mode 100644
index 0000000..dec0cf3
--- /dev/null
+++ b/avahi-common/thread-watch.h
@@ -0,0 +1,80 @@
+#ifndef foothreadedwatchhfoo
+#define foothreadedwatchhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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. This will stop the associated event 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/avahi-common/timeval-test.c b/avahi-common/timeval-test.c
new file mode 100644
index 0000000..387c180
--- /dev/null
+++ b/avahi-common/timeval-test.c
@@ -0,0 +1,43 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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", (long long) avahi_timeval_diff(&a, &b));
+
+ return 0;
+}
diff --git a/avahi-common/timeval.c b/avahi-common/timeval.c
new file mode 100644
index 0000000..cdb0f09
--- /dev/null
+++ b/avahi-common/timeval.c
@@ -0,0 +1,123 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 aggregated better */
+
+ avahi_timeval_add(tv, (AvahiUsec) (jitter*1000.0*r/(RAND_MAX+1.0)));
+ }
+
+ return tv;
+}
+
diff --git a/avahi-common/timeval.h b/avahi-common/timeval.h
new file mode 100644
index 0000000..6470f01
--- /dev/null
+++ b/avahi-common/timeval.h
@@ -0,0 +1,54 @@
+#ifndef footimevalhfoo
+#define footimevalhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/utf8-test.c b/avahi-common/utf8-test.c
new file mode 100644
index 0000000..d12ed58
--- /dev/null
+++ b/avahi-common/utf8-test.c
@@ -0,0 +1,37 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"));
+
+ return 0;
+}
diff --git a/avahi-common/utf8.c b/avahi-common/utf8.c
new file mode 100644
index 0000000..ab10ba0
--- /dev/null
+++ b/avahi-common/utf8.c
@@ -0,0 +1,110 @@
+/* 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
+ {
+ 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/avahi-common/utf8.h b/avahi-common/utf8.h
new file mode 100644
index 0000000..dc1ce4b
--- /dev/null
+++ b/avahi-common/utf8.h
@@ -0,0 +1,33 @@
+#ifndef fooutf8hfoo
+#define fooutf8hfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/watch-test.c b/avahi-common/watch-test.c
new file mode 100644
index 0000000..6c178ba
--- /dev/null
+++ b/avahi-common/watch-test.c
@@ -0,0 +1,115 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-common/watch.h b/avahi-common/watch.h
new file mode 100644
index 0000000..86e63d3
--- /dev/null
+++ b/avahi-common/watch.h
@@ -0,0 +1,97 @@
+#ifndef foowatchhfoo
+#define foowatchhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 loosely 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/avahi-compat-howl.pc.in b/avahi-compat-howl.pc.in
new file mode 100644
index 0000000..b3cd02a
--- /dev/null
+++ b/avahi-compat-howl.pc.in
@@ -0,0 +1,10 @@
+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/avahi-compat-howl/.gitignore b/avahi-compat-howl/.gitignore
new file mode 100644
index 0000000..8dffd16
--- /dev/null
+++ b/avahi-compat-howl/.gitignore
@@ -0,0 +1,11 @@
+address-test
+browse-domain-test
+samples/resolve
+text-test
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
diff --git a/avahi-compat-howl/Makefile.am b/avahi-compat-howl/Makefile.am
new file mode 100644
index 0000000..bc67142
--- /dev/null
+++ b/avahi-compat-howl/Makefile.am
@@ -0,0 +1,109 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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) -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/avahi-compat-howl/address-test.c b/avahi-compat-howl/address-test.c
new file mode 100644
index 0000000..d9e152f
--- /dev/null
+++ b/avahi-compat-howl/address-test.c
@@ -0,0 +1,51 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-howl/address.c b/avahi-compat-howl/address.c
new file mode 100644
index 0000000..81b6e6b
--- /dev/null
+++ b/avahi-compat-howl/address.c
@@ -0,0 +1,212 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-howl/browse-domain-test.c b/avahi-compat-howl/browse-domain-test.c
new file mode 100644
index 0000000..b5a4a01
--- /dev/null
+++ b/avahi-compat-howl/browse-domain-test.c
@@ -0,0 +1,74 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-howl/compat.c b/avahi-compat-howl/compat.c
new file mode 100644
index 0000000..9b8b18c
--- /dev/null
+++ b/avahi-compat-howl/compat.c
@@ -0,0 +1,1182 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-howl/funcs.txt b/avahi-compat-howl/funcs.txt
new file mode 100644
index 0000000..fad8ebf
--- /dev/null
+++ b/avahi-compat-howl/funcs.txt
@@ -0,0 +1,182 @@
+-- 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
diff --git a/avahi-compat-howl/include/corby/buffer.h b/avahi-compat-howl/include/corby/buffer.h
new file mode 100644
index 0000000..3c4416e
--- /dev/null
+++ b/avahi-compat-howl/include/corby/buffer.h
@@ -0,0 +1,330 @@
+#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/avahi-compat-howl/include/corby/channel.h b/avahi-compat-howl/include/corby/channel.h
new file mode 100644
index 0000000..9c91fbb
--- /dev/null
+++ b/avahi-compat-howl/include/corby/channel.h
@@ -0,0 +1,186 @@
+#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/avahi-compat-howl/include/corby/corby.h b/avahi-compat-howl/include/corby/corby.h
new file mode 100644
index 0000000..5e069ff
--- /dev/null
+++ b/avahi-compat-howl/include/corby/corby.h
@@ -0,0 +1,68 @@
+#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/avahi-compat-howl/include/corby/message.h b/avahi-compat-howl/include/corby/message.h
new file mode 100644
index 0000000..a06c358
--- /dev/null
+++ b/avahi-compat-howl/include/corby/message.h
@@ -0,0 +1,60 @@
+#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/avahi-compat-howl/include/corby/object.h b/avahi-compat-howl/include/corby/object.h
new file mode 100644
index 0000000..1cfd516
--- /dev/null
+++ b/avahi-compat-howl/include/corby/object.h
@@ -0,0 +1,113 @@
+#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/avahi-compat-howl/include/corby/orb.h b/avahi-compat-howl/include/corby/orb.h
new file mode 100644
index 0000000..76af578
--- /dev/null
+++ b/avahi-compat-howl/include/corby/orb.h
@@ -0,0 +1,199 @@
+#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/avahi-compat-howl/include/discovery/discovery.h b/avahi-compat-howl/include/discovery/discovery.h
new file mode 100644
index 0000000..082373d
--- /dev/null
+++ b/avahi-compat-howl/include/discovery/discovery.h
@@ -0,0 +1,327 @@
+#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/avahi-compat-howl/include/discovery/text_record.h b/avahi-compat-howl/include/discovery/text_record.h
new file mode 100644
index 0000000..a5ee802
--- /dev/null
+++ b/avahi-compat-howl/include/discovery/text_record.h
@@ -0,0 +1,143 @@
+#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/avahi-compat-howl/include/howl.h b/avahi-compat-howl/include/howl.h
new file mode 100644
index 0000000..dac6d43
--- /dev/null
+++ b/avahi-compat-howl/include/howl.h
@@ -0,0 +1,44 @@
+#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/avahi-compat-howl/include/rendezvous/rendezvous.h b/avahi-compat-howl/include/rendezvous/rendezvous.h
new file mode 100644
index 0000000..12c85e8
--- /dev/null
+++ b/avahi-compat-howl/include/rendezvous/rendezvous.h
@@ -0,0 +1,101 @@
+#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/avahi-compat-howl/include/rendezvous/text_record.h b/avahi-compat-howl/include/rendezvous/text_record.h
new file mode 100644
index 0000000..3e2bfc2
--- /dev/null
+++ b/avahi-compat-howl/include/rendezvous/text_record.h
@@ -0,0 +1,36 @@
+#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/avahi-compat-howl/include/salt/address.h b/avahi-compat-howl/include/salt/address.h
new file mode 100644
index 0000000..ea83f8d
--- /dev/null
+++ b/avahi-compat-howl/include/salt/address.h
@@ -0,0 +1,128 @@
+#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/avahi-compat-howl/include/salt/debug.h b/avahi-compat-howl/include/salt/debug.h
new file mode 100644
index 0000000..c53977b
--- /dev/null
+++ b/avahi-compat-howl/include/salt/debug.h
@@ -0,0 +1,230 @@
+#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/avahi-compat-howl/include/salt/interface.h b/avahi-compat-howl/include/salt/interface.h
new file mode 100644
index 0000000..a4b1b1d
--- /dev/null
+++ b/avahi-compat-howl/include/salt/interface.h
@@ -0,0 +1,115 @@
+#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/avahi-compat-howl/include/salt/platform.h b/avahi-compat-howl/include/salt/platform.h
new file mode 100644
index 0000000..6bb9dcc
--- /dev/null
+++ b/avahi-compat-howl/include/salt/platform.h
@@ -0,0 +1,438 @@
+#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 defined(WORDS_BIGENDIAN) && 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/avahi-compat-howl/include/salt/salt.h b/avahi-compat-howl/include/salt/salt.h
new file mode 100644
index 0000000..ddb289b
--- /dev/null
+++ b/avahi-compat-howl/include/salt/salt.h
@@ -0,0 +1,215 @@
+#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/avahi-compat-howl/include/salt/signal.h b/avahi-compat-howl/include/salt/signal.h
new file mode 100644
index 0000000..b36e02f
--- /dev/null
+++ b/avahi-compat-howl/include/salt/signal.h
@@ -0,0 +1,61 @@
+#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/avahi-compat-howl/include/salt/socket.h b/avahi-compat-howl/include/salt/socket.h
new file mode 100644
index 0000000..9eaa102
--- /dev/null
+++ b/avahi-compat-howl/include/salt/socket.h
@@ -0,0 +1,263 @@
+#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/avahi-compat-howl/include/salt/time.h b/avahi-compat-howl/include/salt/time.h
new file mode 100644
index 0000000..8789b3a
--- /dev/null
+++ b/avahi-compat-howl/include/salt/time.h
@@ -0,0 +1,100 @@
+#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/avahi-compat-howl/samples/.gitignore b/avahi-compat-howl/samples/.gitignore
new file mode 100644
index 0000000..8fca691
--- /dev/null
+++ b/avahi-compat-howl/samples/.gitignore
@@ -0,0 +1,3 @@
+browse
+publish
+query
diff --git a/avahi-compat-howl/samples/Makefile.am b/avahi-compat-howl/samples/Makefile.am
new file mode 100644
index 0000000..5efa19e
--- /dev/null
+++ b/avahi-compat-howl/samples/Makefile.am
@@ -0,0 +1,51 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/avahi-compat-howl/samples/browse.c b/avahi-compat-howl/samples/browse.c
new file mode 100644
index 0000000..f55b1cf
--- /dev/null
+++ b/avahi-compat-howl/samples/browse.c
@@ -0,0 +1,184 @@
+/*
+ * 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/avahi-compat-howl/samples/publish.c b/avahi-compat-howl/samples/publish.c
new file mode 100644
index 0000000..931e786
--- /dev/null
+++ b/avahi-compat-howl/samples/publish.c
@@ -0,0 +1,110 @@
+/*
+ * 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/avahi-compat-howl/samples/query.c b/avahi-compat-howl/samples/query.c
new file mode 100644
index 0000000..b1c30eb
--- /dev/null
+++ b/avahi-compat-howl/samples/query.c
@@ -0,0 +1,98 @@
+/*
+ * 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/avahi-compat-howl/samples/resolve.c b/avahi-compat-howl/samples/resolve.c
new file mode 100644
index 0000000..1790849
--- /dev/null
+++ b/avahi-compat-howl/samples/resolve.c
@@ -0,0 +1,111 @@
+/*
+ * 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/avahi-compat-howl/text-test.c b/avahi-compat-howl/text-test.c
new file mode 100644
index 0000000..66ff58b
--- /dev/null
+++ b/avahi-compat-howl/text-test.c
@@ -0,0 +1,97 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 %zu 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", (void*) "\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/avahi-compat-howl/text.c b/avahi-compat-howl/text.c
new file mode 100644
index 0000000..7ef4df3
--- /dev/null
+++ b/avahi-compat-howl/text.c
@@ -0,0 +1,259 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-howl/unsupported.c b/avahi-compat-howl/unsupported.c
new file mode 100644
index 0000000..ff440af
--- /dev/null
+++ b/avahi-compat-howl/unsupported.c
@@ -0,0 +1,1019 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-howl/warn.c b/avahi-compat-howl/warn.c
new file mode 100644
index 0000000..235bb59
--- /dev/null
+++ b/avahi-compat-howl/warn.c
@@ -0,0 +1,29 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-howl/warn.h b/avahi-compat-howl/warn.h
new file mode 100644
index 0000000..04bd0ed
--- /dev/null
+++ b/avahi-compat-howl/warn.h
@@ -0,0 +1,33 @@
+#ifndef foowarnhhowlfoo
+#define foowarnhhowlfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-libdns_sd.pc.in b/avahi-compat-libdns_sd.pc.in
new file mode 100644
index 0000000..d619632
--- /dev/null
+++ b/avahi-compat-libdns_sd.pc.in
@@ -0,0 +1,10 @@
+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/avahi-compat-libdns_sd/.gitignore b/avahi-compat-libdns_sd/.gitignore
new file mode 100644
index 0000000..279828d
--- /dev/null
+++ b/avahi-compat-libdns_sd/.gitignore
@@ -0,0 +1,9 @@
+null-test
+txt-test
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
diff --git a/avahi-compat-libdns_sd/Makefile.am b/avahi-compat-libdns_sd/Makefile.am
new file mode 100644
index 0000000..9a66bc0
--- /dev/null
+++ b/avahi-compat-libdns_sd/Makefile.am
@@ -0,0 +1,73 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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) -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) $(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
+
+endif
+endif
diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c
new file mode 100644
index 0000000..3ea359e
--- /dev/null
+++ b/avahi-compat-libdns_sd/compat.c
@@ -0,0 +1,1372 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+ DNSServiceQueryRecordReply query_resolver_callback;
+
+ AvahiClient *client;
+ AvahiServiceBrowser *service_browser;
+ AvahiServiceResolver *service_resolver;
+ AvahiDomainBrowser *domain_browser;
+ AvahiRecordBrowser *record_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) {
+
+ 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;
+
+ AVAHI_WARN_LINKAGE;
+
+ 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)
+ 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:
+
+ ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
+
+ sdref_unref(sdref);
+
+ 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);
+ else if (sdref->query_resolver_callback)
+ sdref->query_resolver_callback(sdref, 0, 0, error, NULL, 0, 0, 0, NULL, 0, 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;
+
+ if (!ret_sdref || !regtype)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
+
+ 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;
+
+ if (!ret_sdref || !name || !regtype || !domain || !callback)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
+
+ 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;
+
+ if (!fullName || !regtype || !domain)
+ return -1;
+
+ 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;
+
+ if (!ret_sdref || !callback)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
+
+ 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;
+ }
+ }
+
+ if (!sdref->service_name_chosen) {
+
+ assert(sdref->service_name);
+
+ if (!(sdref->service_name_chosen = avahi_strdup(sdref->service_name))) {
+ 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;
+
+ 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 (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;
+
+ 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;
+}
+
+static void query_resolver_callback(
+ AvahiRecordBrowser *r,
+ AvahiIfIndex interface,
+ AVAHI_GCC_UNUSED AvahiProtocol protocol,
+ AvahiBrowserEvent event,
+ const char *name,
+ uint16_t clazz,
+ uint16_t type,
+ const void* rdata,
+ size_t size,
+ AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ void *userdata) {
+
+ DNSServiceRef sdref = userdata;
+
+ assert(r);
+ assert(sdref);
+ assert(sdref->n_ref >= 1);
+
+ switch (event) {
+
+ case AVAHI_BROWSER_NEW:
+ case AVAHI_BROWSER_REMOVE: {
+
+ DNSServiceFlags qflags = 0;
+ if (event == AVAHI_BROWSER_NEW)
+ qflags |= kDNSServiceFlagsAdd;
+
+ sdref->query_resolver_callback(sdref, qflags, interface, kDNSServiceErr_NoError, name, type, clazz, size, rdata, 0, sdref->context);
+ break;
+ }
+
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ /* not implemented */
+ break;
+
+ case AVAHI_BROWSER_FAILURE:
+ sdref->query_resolver_callback(sdref, 0, interface, map_error(avahi_client_errno(sdref->client)), NULL, 0, 0, 0, NULL, 0, sdref->context);
+ break;
+ }
+}
+
+DNSServiceErrorType DNSSD_API DNSServiceQueryRecord (
+ DNSServiceRef *ret_sdref,
+ DNSServiceFlags flags,
+ uint32_t interface,
+ const char *fullname,
+ uint16_t type,
+ uint16_t clazz,
+ DNSServiceQueryRecordReply callback,
+ void *context) {
+
+ DNSServiceErrorType ret = kDNSServiceErr_Unknown;
+ int error;
+ DNSServiceRef sdref = NULL;
+ AvahiIfIndex ifindex;
+
+ AVAHI_WARN_LINKAGE;
+
+ if (!ret_sdref || !fullname)
+ return kDNSServiceErr_BadParam;
+ *ret_sdref = NULL;
+
+ if (interface == kDNSServiceInterfaceIndexLocalOnly || flags != 0) {
+ AVAHI_WARN_UNSUPPORTED;
+ return kDNSServiceErr_Unsupported;
+ }
+
+ if (!(sdref = sdref_new()))
+ return kDNSServiceErr_Unknown;
+
+ sdref->context = context;
+ sdref->query_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->record_browser = avahi_record_browser_new(sdref->client, ifindex, AVAHI_PROTO_UNSPEC, fullname, clazz, type, 0, query_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;
+}
diff --git a/avahi-compat-libdns_sd/dns_sd.h b/avahi-compat-libdns_sd/dns_sd.h
new file mode 100644
index 0000000..66e494e
--- /dev/null
+++ b/avahi-compat-libdns_sd/dns_sd.h
@@ -0,0 +1,1722 @@
+/* -*- 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/avahi-compat-libdns_sd/funcs.txt b/avahi-compat-libdns_sd/funcs.txt
new file mode 100644
index 0000000..bf96aa5
--- /dev/null
+++ b/avahi-compat-libdns_sd/funcs.txt
@@ -0,0 +1,35 @@
+-- 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
diff --git a/avahi-compat-libdns_sd/null-test.c b/avahi-compat-libdns_sd/null-test.c
new file mode 100644
index 0000000..8cfb98f
--- /dev/null
+++ b/avahi-compat-libdns_sd/null-test.c
@@ -0,0 +1,71 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <stdlib.h>
+#include <unistd.h>
+
+#include <avahi-common/gccmacro.h>
+#include <dns_sd.h>
+
+static void reply(
+ AVAHI_GCC_UNUSED DNSServiceRef sdRef,
+ AVAHI_GCC_UNUSED DNSServiceFlags flags,
+ AVAHI_GCC_UNUSED uint32_t interfaceIndex,
+ AVAHI_GCC_UNUSED DNSServiceErrorType errorCode,
+ AVAHI_GCC_UNUSED const char *serviceName,
+ AVAHI_GCC_UNUSED const char *regtype,
+ AVAHI_GCC_UNUSED const char *replyDomain,
+ AVAHI_GCC_UNUSED void *context) {
+}
+
+int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
+
+ DNSServiceRef ref1, ref2, ref3, ref4 = NULL;
+
+ DNSServiceRegister(&ref1, 0, 0, "simple", "_simple._tcp", NULL, NULL, 4711, 0, NULL, NULL, NULL);
+ DNSServiceRegister(&ref2, 0, 0, "subtype #1", "_simple._tcp,_subtype1", NULL, NULL, 4711, 0, NULL, NULL, NULL);
+ DNSServiceRegister(&ref3, 0, 0, "subtype #2", "_simple._tcp,_subtype1,_subtype2", NULL, NULL, 4711, 0, NULL, NULL, NULL);
+
+ DNSServiceRegister(&ref4, 0, 0, "subtype #3", "_simple._tcp,,", NULL, NULL, 4711, 0, NULL, NULL, NULL);
+ assert(!ref4);
+ DNSServiceRegister(&ref4, 0, 0, "subtype #3", "", NULL, NULL, 4711, 0, NULL, NULL, NULL);
+ assert(!ref4);
+ DNSServiceRegister(&ref4, 0, 0, "subtype #3", ",", NULL, NULL, 4711, 0, NULL, NULL, NULL);
+ assert(!ref4);
+ DNSServiceRegister(&ref4, 0, 0, "subtype #3", ",,", NULL, NULL, 4711, 0, NULL, NULL, NULL);
+ assert(!ref4);
+
+ DNSServiceBrowse(&ref4, 0, 0, "_simple._tcp,_gurke", NULL, reply, NULL);
+
+ sleep(20);
+
+ DNSServiceRefDeallocate(ref1);
+ DNSServiceRefDeallocate(ref2);
+ DNSServiceRefDeallocate(ref3);
+ DNSServiceRefDeallocate(ref4);
+
+ return 0;
+}
diff --git a/avahi-compat-libdns_sd/txt-test.c b/avahi-compat-libdns_sd/txt-test.c
new file mode 100644
index 0000000..9bf29b4
--- /dev/null
+++ b/avahi-compat-libdns_sd/txt-test.c
@@ -0,0 +1,128 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 %zu 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/avahi-compat-libdns_sd/txt.c b/avahi-compat-libdns_sd/txt.c
new file mode 100644
index 0000000..9d6c116
--- /dev/null
+++ b/avahi-compat-libdns_sd/txt.c
@@ -0,0 +1,489 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-compat-libdns_sd/unsupported.c b/avahi-compat-libdns_sd/unsupported.c
new file mode 100644
index 0000000..4e94f70
--- /dev/null
+++ b/avahi-compat-libdns_sd/unsupported.c
@@ -0,0 +1,90 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 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/avahi-compat-libdns_sd/warn.c b/avahi-compat-libdns_sd/warn.c
new file mode 100644
index 0000000..b311736
--- /dev/null
+++ b/avahi-compat-libdns_sd/warn.c
@@ -0,0 +1,124 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 program '%s' uses the "COMPAT_LAYER" compatibility 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 program '%s' called '%s()' which is not supported (or only supported partially) in the "COMPAT_LAYER" compatibility 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/avahi-compat-libdns_sd/warn.h b/avahi-compat-libdns_sd/warn.h
new file mode 100644
index 0000000..0a8c2ba
--- /dev/null
+++ b/avahi-compat-libdns_sd/warn.h
@@ -0,0 +1,36 @@
+#ifndef foowarnhfoo
+#define foowarnhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core.pc.in b/avahi-core.pc.in
new file mode 100644
index 0000000..52491b4
--- /dev/null
+++ b/avahi-core.pc.in
@@ -0,0 +1,10 @@
+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/avahi-core/.gitignore b/avahi-core/.gitignore
new file mode 100644
index 0000000..3a5003a
--- /dev/null
+++ b/avahi-core/.gitignore
@@ -0,0 +1,17 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+avahi-reflector
+avahi-test
+conformance-test
+dns-spin-test
+dns-test
+hashmap-test
+prioq-test
+querier-test
+timeeventq-test
+update-test
diff --git a/avahi-core/Makefile.am b/avahi-core/Makefile.am
new file mode 100644
index 0000000..2f09596
--- /dev/null
+++ b/avahi-core/Makefile.am
@@ -0,0 +1,173 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 \
+ dns-spin-test \
+ timeeventq-test \
+ hashmap-test \
+ querier-test \
+ update-test
+
+TESTS = \
+ dns-spin-test \
+ dns-test \
+ hashmap-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
+else
+libavahi_core_la_SOURCES += \
+ iface-none.c
+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) -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 \
+ addr-util.c addr-util.h
+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 \
+ 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/avahi-core/addr-util.c b/avahi-core/addr-util.c
new file mode 100644
index 0000000..979b1b7
--- /dev/null
+++ b/avahi-core/addr-util.c
@@ -0,0 +1,94 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+}
+
+#define IPV4LL_NETWORK 0xA9FE0000L
+#define IPV4LL_NETMASK 0xFFFF0000L
+#define IPV6LL_NETWORK 0xFE80
+#define IPV6LL_NETMASK 0xFFC0
+
+int avahi_address_is_link_local(const AvahiAddress *a) {
+ assert(a);
+
+ if (a->proto == AVAHI_PROTO_INET) {
+ uint32_t n = ntohl(a->data.ipv4.address);
+ return (n & IPV4LL_NETMASK) == IPV4LL_NETWORK;
+ }
+ else if (a->proto == AVAHI_PROTO_INET6) {
+ unsigned n = (a->data.ipv6.address[0] << 8) | (a->data.ipv6.address[1] << 0);
+ return (n & IPV6LL_NETMASK) == IPV6LL_NETWORK;
+ }
+
+ return 0;
+}
diff --git a/avahi-core/addr-util.h b/avahi-core/addr-util.h
new file mode 100644
index 0000000..66a9422
--- /dev/null
+++ b/avahi-core/addr-util.h
@@ -0,0 +1,47 @@
+#ifndef fooaddrutilhfoo
+#define fooaddrutilhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+/** Check whether the specified address is a link-local IPv4 or IPv6 address;
+ * returns 1 if yes, 0 otherwise */
+int avahi_address_is_link_local(const AvahiAddress *a);
+
+AVAHI_C_DECL_END
+
+#endif
diff --git a/avahi-core/announce.c b/avahi-core/announce.c
new file mode 100644
index 0000000..ccdbf15
--- /dev/null
+++ b/avahi-core/announce.c
@@ -0,0 +1,524 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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) || (i->dead))
+ 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 (i->announcing) {
+ 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/avahi-core/announce.h b/avahi-core/announce.h
new file mode 100644
index 0000000..fd23d8b
--- /dev/null
+++ b/avahi-core/announce.h
@@ -0,0 +1,69 @@
+#ifndef fooannouncehfoo
+#define fooannouncehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/avahi-reflector.c b/avahi-core/avahi-reflector.c
new file mode 100644
index 0000000..dee1e93
--- /dev/null
+++ b/avahi-core/avahi-reflector.c
@@ -0,0 +1,61 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/avahi-test.c b/avahi-core/avahi-test.c
new file mode 100644
index 0000000..8b2376f
--- /dev/null
+++ b/avahi-core/avahi-test.c
@@ -0,0 +1,402 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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_domain_browser_free(db);
+ 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/avahi-core/browse-dns-server.c b/avahi-core/browse-dns-server.c
new file mode 100644
index 0000000..a51c38f
--- /dev/null
+++ b/avahi-core/browse-dns-server.c
@@ -0,0 +1,322 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/browse-domain.c b/avahi-core/browse-domain.c
new file mode 100644
index 0000000..9705b2a
--- /dev/null
+++ b/avahi-core/browse-domain.c
@@ -0,0 +1,235 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/browse-service-type.c b/avahi-core/browse-service-type.c
new file mode 100644
index 0000000..6fff071
--- /dev/null
+++ b/avahi-core/browse-service-type.c
@@ -0,0 +1,157 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/browse-service.c b/avahi-core/browse-service.c
new file mode 100644
index 0000000..dde36bc
--- /dev/null
+++ b/avahi-core/browse-service.c
@@ -0,0 +1,167 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/browse.c b/avahi-core/browse.c
new file mode 100644
index 0000000..eabd7ea
--- /dev/null
+++ b/avahi-core/browse.c
@@ -0,0 +1,613 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/browse.h b/avahi-core/browse.h
new file mode 100644
index 0000000..a0dc207
--- /dev/null
+++ b/avahi-core/browse.h
@@ -0,0 +1,60 @@
+#ifndef foobrowsehfoo
+#define foobrowsehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/cache.c b/avahi-core/cache.c
new file mode 100644
index 0000000..454aac5
--- /dev/null
+++ b/avahi-core/cache.c
@@ -0,0 +1,513 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+
+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);
+ --c->n_entries;
+}
+
+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 >= c->server->config.n_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;
+ struct timeval now;
+
+ assert(c);
+ assert(pattern);
+ assert(e);
+ assert(a);
+
+ gettimeofday(&now, NULL);
+
+ 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;
+ e->poof_timestamp = now;
+ e->poof_num = 0;
+
+ break;
+
+ case AVAHI_CACHE_POOF:
+ if (avahi_timeval_diff(&now, &e->poof_timestamp) < 1000000)
+ break;
+
+ e->poof_timestamp = now;
+ e->poof_address = *a;
+ e->poof_num ++;
+
+ /* This is the 4th time we got no response, so let's
+ * fucking remove this entry. */
+ if (e->poof_num > 3)
+ 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/avahi-core/cache.h b/avahi-core/cache.h
new file mode 100644
index 0000000..49ba9b9
--- /dev/null
+++ b/avahi-core/cache.h
@@ -0,0 +1,101 @@
+#ifndef foocachehfoo
+#define foocachehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 poof_timestamp;
+ struct timeval expiry;
+ int cache_flush;
+ int poof_num;
+
+ 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/avahi-core/conformance-test.c b/avahi-core/conformance-test.c
new file mode 100644
index 0000000..632f66b
--- /dev/null
+++ b/avahi-core/conformance-test.c
@@ -0,0 +1,158 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/core.h b/avahi-core/core.h
new file mode 100644
index 0000000..f50c612
--- /dev/null
+++ b/avahi-core/core.h
@@ -0,0 +1,165 @@
+#ifndef foocorehfoo
+#define foocorehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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-common/timeval.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 */
+ AvahiStringList *allow_interfaces;/**< Allow specific interface to be used for Avahi */
+ AvahiStringList *deny_interfaces; /**< Deny specific interfaces to be used for Avahi */
+ 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 */
+ 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 */
+ unsigned n_cache_entries_max; /**< Maximum number of cache entries per interface */
+ AvahiUsec ratelimit_interval; /**< If non-zero, rate-limiting interval parameter. */
+ unsigned ratelimit_burst; /**< If ratelimit_interval is non-zero, rate-limiting burst parameter. */
+} 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);
+
+/** Set the browsing domains */
+int avahi_server_set_browse_domains(AvahiServer *s, AvahiStringList *domains);
+
+/** 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..f50e691
--- /dev/null
+++ b/avahi-core/dns-spin-test.c
@@ -0,0 +1,122 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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-srv-rr.h b/avahi-core/dns-srv-rr.h
new file mode 100644
index 0000000..fdd9010
--- /dev/null
+++ b/avahi-core/dns-srv-rr.h
@@ -0,0 +1,87 @@
+#ifndef foodnssrvhfoo
+#define foodnssrvhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/dns-test.c b/avahi-core/dns-test.c
new file mode 100644
index 0000000..ebe2305
--- /dev/null
+++ b/avahi-core/dns-test.c
@@ -0,0 +1,113 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/dns.c b/avahi-core/dns.c
new file mode 100644
index 0000000..2fcd91f
--- /dev/null
+++ b/avahi-core/dns.c
@@ -0,0 +1,877 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <sys/types.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);
+}
+
+
+static void name_table_cleanup(void *key, void *value, void *user_data) {
+ AvahiDnsPacket *p = user_data;
+
+ if ((uint8_t*) value >= AVAHI_DNS_PACKET_DATA(p) + p->size)
+ avahi_hashmap_remove(p->name_table, key);
+}
+
+void avahi_dns_packet_cleanup_name_table(AvahiDnsPacket *p) {
+ if (p->name_table)
+ avahi_hashmap_foreach(p->name_table, name_table_cleanup, p);
+}
+
+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;
+ avahi_dns_packet_cleanup_name_table(p);
+
+ 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;
+ }
+
+ 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);
+ r->data.generic.size = 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;
+ avahi_dns_packet_cleanup_name_table(p);
+
+ 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 <= AVAHI_DNS_RDATA_MAX);
+
+/* 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;
+ avahi_dns_packet_cleanup_name_table(p);
+
+ 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/avahi-core/dns.h b/avahi-core/dns.h
new file mode 100644
index 0000000..52e8d88
--- /dev/null
+++ b/avahi-core/dns.h
@@ -0,0 +1,111 @@
+#ifndef foodnshfoo
+#define foodnshfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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_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;
+ 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);
+
+void avahi_dns_packet_cleanup_name_table(AvahiDnsPacket *p);
+
+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"
+
+#endif
+
diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c
new file mode 100644
index 0000000..6eed27f
--- /dev/null
+++ b/avahi-core/domain-util.c
@@ -0,0 +1,188 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 "log.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;
+}
+
+#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);
+
+ if (gethostname(ret_s, size) >= 0) {
+ ret_s[size-1] = 0;
+ strip_bad_chars(ret_s);
+ } 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) {
+ /* No hostname was set, so let's take the OS name */
+
+#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)
+#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)
+ 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/avahi-core/domain-util.h b/avahi-core/domain-util.h
new file mode 100644
index 0000000..082fde6
--- /dev/null
+++ b/avahi-core/domain-util.h
@@ -0,0 +1,45 @@
+#ifndef foodomainutilhfoo
+#define foodomainutilhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/entry.c b/avahi-core/entry.c
new file mode 100644
index 0000000..0d86213
--- /dev/null
+++ b/avahi-core/entry.c
@@ -0,0 +1,1233 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ if (s->cleanup_time_event) {
+ avahi_time_event_free(s->cleanup_time_event);
+ s->cleanup_time_event = NULL;
+ }
+}
+
+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 (avahi_record_equal_no_ttl(r, e->record)) {
+ /* The records are the same, not a conflict in any case */
+ 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;
+ } 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)
+
+ /* 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;
+}
+
+static void cleanup_time_event_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* userdata) {
+ AvahiServer *s = userdata;
+
+ assert(s);
+
+ avahi_cleanup_dead_entries(s);
+}
+
+static void schedule_cleanup(AvahiServer *s) {
+ struct timeval tv;
+
+ assert(s);
+
+ if (!s->cleanup_time_event)
+ s->cleanup_time_event = avahi_time_event_new(s->time_event_queue, avahi_elapse_time(&tv, 1000, 0), &cleanup_time_event_callback, s);
+}
+
+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;
+
+ schedule_cleanup(g->server);
+}
+
+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;
+
+ g->n_probing = 0;
+
+ avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED);
+
+ schedule_cleanup(g->server);
+}
+
+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/avahi-core/fdutil.c b/avahi-core/fdutil.c
new file mode 100644
index 0000000..c294754
--- /dev/null
+++ b/avahi-core/fdutil.c
@@ -0,0 +1,72 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/select.h>
+#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/avahi-core/fdutil.h b/avahi-core/fdutil.h
new file mode 100644
index 0000000..68607f8
--- /dev/null
+++ b/avahi-core/fdutil.h
@@ -0,0 +1,33 @@
+#ifndef foofdutilhfoo
+#define foofdutilhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/findstatic.pl b/avahi-core/findstatic.pl
new file mode 100755
index 0000000..43a4916
--- /dev/null
+++ b/avahi-core/findstatic.pl
@@ -0,0 +1,70 @@
+#!/usr/bin/perl -w
+# find a list of fns and variables in the code that could be static
+# usually called with something like this:
+# findstatic.pl `find . -name "*.o"`
+# Andrew Tridgell <tridge@samba.org>
+
+use strict;
+
+# use nm to find the symbols
+my($saved_delim) = $/;
+undef $/;
+my($syms) = `nm -o @ARGV`;
+$/ = $saved_delim;
+
+my(@lines) = split(/\n/s, $syms);
+
+my(%def);
+my(%undef);
+my(%stype);
+
+my(%typemap) = (
+ "T" => "function",
+ "C" => "uninitialised variable",
+ "D" => "initialised variable"
+ );
+
+
+# parse the symbols into defined and undefined
+for (my($i)=0; $i <= $#{@lines}; $i++) {
+ my($line) = $lines[$i];
+ if ($line =~ /(.*):[a-f0-9]* ([TCD]) (.*)/) {
+ my($fname) = $1;
+ my($symbol) = $3;
+ push(@{$def{$fname}}, $symbol);
+ $stype{$symbol} = $2;
+ }
+ if ($line =~ /(.*):\s* U (.*)/) {
+ my($fname) = $1;
+ my($symbol) = $2;
+ push(@{$undef{$fname}}, $symbol);
+ }
+}
+
+# look for defined symbols that are never referenced outside the place they
+# are defined
+foreach my $f (keys %def) {
+ print "Checking $f\n";
+ my($found_one) = 0;
+ foreach my $s (@{$def{$f}}) {
+ my($found) = 0;
+ foreach my $f2 (keys %undef) {
+ if ($f2 ne $f) {
+ foreach my $s2 (@{$undef{$f2}}) {
+ if ($s2 eq $s) {
+ $found = 1;
+ $found_one = 1;
+ }
+ }
+ }
+ }
+ if ($found == 0) {
+ my($t) = $typemap{$stype{$s}};
+ print " '$s' is unique to $f ($t)\n";
+ }
+ }
+ if ($found_one == 0) {
+ print " all symbols in '$f' are unused (main program?)\n";
+ }
+}
+
diff --git a/avahi-core/hashmap-test.c b/avahi-core/hashmap-test.c
new file mode 100644
index 0000000..209d0e5
--- /dev/null
+++ b/avahi-core/hashmap-test.c
@@ -0,0 +1,62 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/hashmap.c b/avahi-core/hashmap.c
new file mode 100644
index 0000000..9b55bd3
--- /dev/null
+++ b/avahi-core/hashmap.c
@@ -0,0 +1,248 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/hashmap.h b/avahi-core/hashmap.h
new file mode 100644
index 0000000..9d7e81f
--- /dev/null
+++ b/avahi-core/hashmap.h
@@ -0,0 +1,53 @@
+#ifndef foohashmaphfoo
+#define foohashmaphfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/iface-linux.c b/avahi-core/iface-linux.c
new file mode 100644
index 0000000..da497bc
--- /dev/null
+++ b/avahi-core/iface-linux.c
@@ -0,0 +1,391 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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_REQUEST|NLM_F_DUMP;
+ 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, rlocal, *r;
+ int raddr_valid = 0, rlocal_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 */
+ rlocal.proto = 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:
+
+ if ((rlocal.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
+ (rlocal.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
+ return;
+
+ memcpy(rlocal.data.data, RTA_DATA(a), RTA_PAYLOAD(a));
+ rlocal_valid = 1;
+
+ break;
+
+ case IFA_LOCAL:
+
+ /* Fill in local address data. Usually this is
+ * preferable over IFA_ADDRESS if both are set,
+ * since this refers to the local address of a PPP
+ * link while IFA_ADDRESS refers to the other
+ * end. */
+
+ 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 (rlocal_valid)
+ r = &rlocal;
+ else if (raddr_valid)
+ r = &raddr;
+ else
+ 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, r)))
+
+ /* Mmm, no object existing yet, so let's create a new one */
+ if (!(addr = avahi_interface_address_new(m, i, r, 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;
+ addr->deprecated = !!(ifaddrmsg->ifa_flags & IFA_F_DEPRECATED);
+ } 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, r)))
+ 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/avahi-core/iface-linux.h b/avahi-core/iface-linux.h
new file mode 100644
index 0000000..677f86d
--- /dev/null
+++ b/avahi-core/iface-linux.h
@@ -0,0 +1,40 @@
+#ifndef fooifacelinuxhfoo
+#define fooifacelinuxhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/iface-none.c b/avahi-core/iface-none.c
new file mode 100644
index 0000000..715e497
--- /dev/null
+++ b/avahi-core/iface-none.c
@@ -0,0 +1,30 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 "iface.h"
+
+int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
+ return 0;
+}
+
+void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *m) {
+}
+
+void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
+}
diff --git a/avahi-core/iface-pfroute.c b/avahi-core/iface-pfroute.c
new file mode 100644
index 0000000..9a2e953
--- /dev/null
+++ b/avahi-core/iface-pfroute.c
@@ -0,0 +1,543 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+ char *cp0;
+ 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
+
+ for (cp0 = cp, i = 0; i < RTAX_MAX; i++) {
+ if (!(ifam->ifam_addrs & (1<<i)))
+ continue;
+ sa = (struct sockaddr *)cp;
+ if (i == RTAX_IFA)
+ break;
+#ifdef SA_SIZE
+ cp += SA_SIZE(sa);
+#else
+ ADVANCE(cp, sa);
+#endif
+ }
+
+ if(sa->sa_family != AF_INET && sa->sa_family != AF_INET6)
+ return;
+
+ if (!(iface = avahi_interface_monitor_get_interface(m, (AvahiIfIndex) ifam->ifam_index, avahi_af_to_proto(sa->sa_family))))
+ return;
+
+ raddr.proto = avahi_af_to_proto(sa->sa_family);
+
+ for(cp = cp0, i = 0; i < RTAX_MAX; i++)
+ {
+ if (!(ifam->ifam_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));
+#ifdef __KAME__
+ if (IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)raddr.data.data))
+ {
+ ((struct in6_addr *)raddr.data.data)->s6_addr[2] = 0;
+ ((struct in6_addr *)raddr.data.data)->s6_addr[3] = 0;
+ }
+#endif
+ 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 */
+ if (raddr.proto == AVAHI_PROTO_INET6)
+ {
+ addriface->global_scope = !(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)raddr.data.data) || IN6_IS_ADDR_MULTICAST((struct in6_addr *)raddr.data.data));
+ }
+ else
+ 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;
+
+ 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;
+ }
+
+ 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/avahi-core/iface-pfroute.h b/avahi-core/iface-pfroute.h
new file mode 100644
index 0000000..3766cb0
--- /dev/null
+++ b/avahi-core/iface-pfroute.h
@@ -0,0 +1,37 @@
+#ifndef fooifacepfroutehfoo
+#define fooifacepfroutehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/iface.c b/avahi-core/iface.c
new file mode 100644
index 0000000..39a860a
--- /dev/null
+++ b/avahi-core/iface.c
@@ -0,0 +1,865 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 (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 ||
+ 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];
+ AvahiProtocol p;
+
+ 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, 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;
+ 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);
+
+ avahi_log_info("Withdrawing address record for %s on %s.", t, a->interface->hardware->name);
+
+ 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_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], unescaped[AVAHI_LABEL_MAX], mac[256];
+ const char *p = m->server->host_name;
+
+ avahi_unescape_label(&p, unescaped, sizeof(unescaped));
+ avahi_format_mac_address(mac, sizeof(mac), hw->mac_address, hw->mac_address_size);
+ snprintf(name, sizeof(name), "%s [%s]", unescaped, 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)) {
+
+ avahi_log_info("Withdrawing workstation service for %s.", hw->name);
+
+ if (avahi_s_entry_group_get_state(hw->entry_group) == AVAHI_ENTRY_GROUP_REGISTERING &&
+ m->server->state == AVAHI_SERVER_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 ((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;
+
+ /* 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)
+ 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;
+ hw->ratelimit_begin.tv_sec = 0;
+ hw->ratelimit_begin.tv_usec = 0;
+ hw->ratelimit_counter = 0;
+
+ 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 || m->server->config.publish_a_on_ipv6)
+ avahi_interface_new(m, hw, AVAHI_PROTO_INET);
+ if (m->server->fd_ipv6 >= 0 || m->server->config.publish_aaaa_on_ipv4)
+ 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->deprecated = 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) {
+ interface_mdns_mcast_join(i, 1);
+
+ 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));
+
+ 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 (!i->announcing)
+ return;
+
+ assert(!a || a->proto == i->protocol);
+
+ if (i->monitor->server->config.ratelimit_interval > 0) {
+ struct timeval now, end;
+
+ gettimeofday(&now, NULL);
+
+ end = i->hardware->ratelimit_begin;
+ avahi_timeval_add(&end, i->monitor->server->config.ratelimit_interval);
+
+ if (i->hardware->ratelimit_begin.tv_sec <= 0 ||
+ avahi_timeval_compare(&end, &now) < 0) {
+
+ i->hardware->ratelimit_begin = now;
+ i->hardware->ratelimit_counter = 0;
+ }
+
+ if (i->hardware->ratelimit_counter > i->monitor->server->config.ratelimit_burst)
+ return;
+
+ i->hardware->ratelimit_counter++;
+ }
+
+ 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 (!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) {
+
+ 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 (!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 (!i->announcing)
+ return 0;
+
+ return avahi_probe_scheduler_post(i->probe_scheduler, record, immediately);
+}
+
+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;
+}
+
+static int avahi_interface_is_relevant_internal(AvahiInterface *i) {
+ AvahiInterfaceAddress *a;
+
+ assert(i);
+
+ if (!i->hardware->flags_ok)
+ return 0;
+
+ for (a = i->addresses; a; a = a->address_next)
+ if (avahi_interface_address_is_relevant(a))
+ return 1;
+
+ return 0;
+}
+
+int avahi_interface_is_relevant(AvahiInterface *i) {
+ AvahiStringList *l;
+ assert(i);
+
+ for (l = i->monitor->server->config.deny_interfaces; l; l = l->next)
+ if (strcasecmp((char*) l->text, i->hardware->name) == 0)
+ return 0;
+
+ if (i->monitor->server->config.allow_interfaces) {
+
+ for (l = i->monitor->server->config.allow_interfaces; l; l = l->next)
+ if (strcasecmp((char*) l->text, i->hardware->name) == 0)
+ goto good;
+
+ return 0;
+ }
+
+good:
+ return avahi_interface_is_relevant_internal(i);
+}
+
+int avahi_interface_address_is_relevant(AvahiInterfaceAddress *a) {
+ AvahiInterfaceAddress *b;
+ assert(a);
+
+ /* Publish public and non-deprecated IP addresses */
+ if (a->global_scope && !a->deprecated)
+ return 1;
+
+ /* Publish link-local and deprecated IP addresses only 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 && !b->deprecated)
+ return 0;
+ }
+
+ return 1;
+}
+
+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 received. 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/avahi-core/iface.h b/avahi-core/iface.h
new file mode 100644
index 0000000..c3f24af
--- /dev/null
+++ b/avahi-core/iface.h
@@ -0,0 +1,195 @@
+#ifndef fooifacehfoo
+#define fooifacehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+
+ /* Packet rate limiting */
+ struct timeval ratelimit_begin;
+ unsigned ratelimit_counter;
+
+ 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;
+ int deprecated;
+
+ 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/avahi-core/internal.h b/avahi-core/internal.h
new file mode 100644
index 0000000..b8f9302
--- /dev/null
+++ b/avahi-core/internal.h
@@ -0,0 +1,227 @@
+#ifndef foointernalhfoo
+#define foointernalhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <avahi-common/timeval.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;
+
+ /* Used for scheduling RR cleanup */
+ AvahiTimeEvent *cleanup_time_event;
+
+ 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;
+};
+
+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/avahi-core/log.c b/avahi-core/log.c
new file mode 100644
index 0000000..d110765
--- /dev/null
+++ b/avahi-core/log.c
@@ -0,0 +1,86 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/log.h b/avahi-core/log.h
new file mode 100644
index 0000000..878f07a
--- /dev/null
+++ b/avahi-core/log.h
@@ -0,0 +1,73 @@
+#ifndef foologhfoo
+#define foologhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/lookup.h b/avahi-core/lookup.h
new file mode 100644
index 0000000..06dec6e
--- /dev/null
+++ b/avahi-core/lookup.h
@@ -0,0 +1,235 @@
+#ifndef foolookuphfoo
+#define foolookuphfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/multicast-lookup.c b/avahi-core/multicast-lookup.c
new file mode 100644
index 0000000..75988bf
--- /dev/null
+++ b/avahi-core/multicast-lookup.c
@@ -0,0 +1,350 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/multicast-lookup.h b/avahi-core/multicast-lookup.h
new file mode 100644
index 0000000..2707666
--- /dev/null
+++ b/avahi-core/multicast-lookup.h
@@ -0,0 +1,51 @@
+#ifndef foomulticastlookuphfoo
+#define foomulticastlookuphfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/netlink.c b/avahi-core/netlink.c
new file mode 100644
index 0000000..4ded5ec
--- /dev/null
+++ b/avahi-core/netlink.c
@@ -0,0 +1,208 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 = 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);
+
+ 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);
+
+ 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__": SO_PASSCRED: %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/avahi-core/netlink.h b/avahi-core/netlink.h
new file mode 100644
index 0000000..9c6eb28
--- /dev/null
+++ b/avahi-core/netlink.h
@@ -0,0 +1,41 @@
+#ifndef foonetlinkhfoo
+#define foonetlinkhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/prioq-test.c b/avahi-core/prioq-test.c
new file mode 100644
index 0000000..6d0fd62
--- /dev/null
+++ b/avahi-core/prioq-test.c
@@ -0,0 +1,120 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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) (long) (p))
+#define INT_TO_POINTER(i) ((void*) (long) (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/avahi-core/prioq.c b/avahi-core/prioq.c
new file mode 100644
index 0000000..28b5018
--- /dev/null
+++ b/avahi-core/prioq.c
@@ -0,0 +1,388 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/prioq.h b/avahi-core/prioq.h
new file mode 100644
index 0000000..b3d31eb
--- /dev/null
+++ b/avahi-core/prioq.h
@@ -0,0 +1,49 @@
+#ifndef fooprioqhfoo
+#define fooprioqhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/probe-sched.c b/avahi-core/probe-sched.c
new file mode 100644
index 0000000..1e63411
--- /dev/null
+++ b/avahi-core/probe-sched.c
@@ -0,0 +1,397 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 (!(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))) {
+ 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/avahi-core/probe-sched.h b/avahi-core/probe-sched.h
new file mode 100644
index 0000000..e47de41
--- /dev/null
+++ b/avahi-core/probe-sched.h
@@ -0,0 +1,34 @@
+#ifndef fooprobeschedhfoo
+#define fooprobeschedhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/publish.h b/avahi-core/publish.h
new file mode 100644
index 0000000..90797de
--- /dev/null
+++ b/avahi-core/publish.h
@@ -0,0 +1,175 @@
+#ifndef foopublishhfoo
+#define foopublishhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/querier-test.c b/avahi-core/querier-test.c
new file mode 100644
index 0000000..e1ce913
--- /dev/null
+++ b/avahi-core/querier-test.c
@@ -0,0 +1,122 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/querier.c b/avahi-core/querier.c
new file mode 100644
index 0000000..d9dc1fb
--- /dev/null
+++ b/avahi-core/querier.c
@@ -0,0 +1,268 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+
+ /* There was no querier for this RR key, or it wasn't referenced
+ * by anyone. */
+ if (!(q = avahi_hashmap_lookup(i->queriers_by_key, key)) || q->n_used <= 0)
+ 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/avahi-core/querier.h b/avahi-core/querier.h
new file mode 100644
index 0000000..6a32a3b
--- /dev/null
+++ b/avahi-core/querier.h
@@ -0,0 +1,48 @@
+#ifndef fooquerierhfoo
+#define fooquerierhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/query-sched.c b/avahi-core/query-sched.c
new file mode 100644
index 0000000..ff833f9
--- /dev/null
+++ b/avahi-core/query-sched.c
@@ -0,0 +1,450 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/query-sched.h b/avahi-core/query-sched.h
new file mode 100644
index 0000000..b45520c
--- /dev/null
+++ b/avahi-core/query-sched.h
@@ -0,0 +1,36 @@
+#ifndef fooqueryschedhfoo
+#define fooqueryschedhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/resolve-address.c b/avahi-core/resolve-address.c
new file mode 100644
index 0000000..dd4adbc
--- /dev/null
+++ b/avahi-core/resolve-address.c
@@ -0,0 +1,268 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/resolve-host-name.c b/avahi-core/resolve-host-name.c
new file mode 100644
index 0000000..08f209b
--- /dev/null
+++ b/avahi-core/resolve-host-name.c
@@ -0,0 +1,297 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/resolve-service.c b/avahi-core/resolve-service.c
new file mode 100644
index 0000000..3377a50
--- /dev/null
+++ b/avahi-core/resolve-service.c
@@ -0,0 +1,489 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/response-sched.c b/avahi-core/response-sched.c
new file mode 100644
index 0000000..abac0a1
--- /dev/null
+++ b/avahi-core/response-sched.c
@@ -0,0 +1,511 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 (!(p = avahi_dns_packet_new_response(size + AVAHI_DNS_PACKET_EXTRA_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/avahi-core/response-sched.h b/avahi-core/response-sched.h
new file mode 100644
index 0000000..548839e
--- /dev/null
+++ b/avahi-core/response-sched.h
@@ -0,0 +1,37 @@
+#ifndef fooresponseschedhfoo
+#define fooresponseschedhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/rr-util.h b/avahi-core/rr-util.h
new file mode 100644
index 0000000..0eebc00
--- /dev/null
+++ b/avahi-core/rr-util.h
@@ -0,0 +1,62 @@
+#ifndef foorrutilhfoo
+#define foorrutilhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/rr.c b/avahi-core/rr.c
new file mode 100644
index 0000000..7fa0bee
--- /dev/null
+++ b/avahi-core/rr.c
@@ -0,0 +1,733 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+#include "addr-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;
+}
+
+static AvahiAddress *get_address(const AvahiRecord *r, AvahiAddress *a) {
+ assert(r);
+
+ switch (r->key->type) {
+ case AVAHI_DNS_TYPE_A:
+ a->proto = AVAHI_PROTO_INET;
+ a->data.ipv4 = r->data.a.address;
+ break;
+
+ case AVAHI_DNS_TYPE_AAAA:
+ a->proto = AVAHI_PROTO_INET6;
+ a->data.ipv6 = r->data.aaaa.address;
+ break;
+
+ default:
+ return NULL;
+ }
+
+ return a;
+}
+
+int avahi_record_is_link_local_address(const AvahiRecord *r) {
+ AvahiAddress a;
+
+ assert(r);
+
+ if (!get_address(r, &a))
+ return 0;
+
+ return avahi_address_is_link_local(&a);
+}
diff --git a/avahi-core/rr.h b/avahi-core/rr.h
new file mode 100644
index 0000000..794b83f
--- /dev/null
+++ b/avahi-core/rr.h
@@ -0,0 +1,175 @@
+#ifndef foorrhfoo
+#define foorrhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+/** Return TRUE if the AvahiRecord object is a link-local A or AAAA address */
+int avahi_record_is_link_local_address(const AvahiRecord *r);
+
+AVAHI_C_DECL_END
+
+#endif
diff --git a/avahi-core/rrlist.c b/avahi-core/rrlist.c
new file mode 100644
index 0000000..0a794ab
--- /dev/null
+++ b/avahi-core/rrlist.c
@@ -0,0 +1,188 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/rrlist.h b/avahi-core/rrlist.h
new file mode 100644
index 0000000..c7b5aba
--- /dev/null
+++ b/avahi-core/rrlist.h
@@ -0,0 +1,40 @@
+#ifndef foorrlisthfoo
+#define foorrlisthfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/server.c b/avahi-core/server.c
new file mode 100644
index 0000000..69a1d02
--- /dev/null
+++ b/avahi-core/server.c
@@ -0,0 +1,1805 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+
+#define AVAHI_DEFAULT_CACHE_ENTRIES_MAX 4096
+
+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("Received conflicting probe [%s]. Local host won.", t);
+ else if (lost) {
+ avahi_log_debug("Received 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("Received 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("Received 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("Received conflicting record [%s] with local record to be. Withdrawing.", t);
+ withdraw_rrset(s, record->key);
+ } else {
+ assert(conflicting_entry);
+ avahi_log_debug("Received 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 + 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))) {
+
+ 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 (!(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)) {
+
+ /* 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;
+ }
+ }
+
+ /* 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;
+ AvahiRecord* r;
+
+ assert(c);
+ assert(pattern);
+ assert(e);
+ assert(s);
+
+ /* Don't reflect cache entry with ipv6 link-local addresses. */
+ r = e->record;
+ if ((r->key->type == AVAHI_DNS_TYPE_AAAA) &&
+ (r->data.aaaa.address.address[0] == 0xFE) &&
+ (r->data.aaaa.address.address[1] == 0x80))
+ return NULL;
+
+ 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 a UTF-8 problem?)");
+ goto fail;
+ }
+
+ if (!legacy_unicast && !from_local_iface) {
+ reflect_query(s, i, key);
+ if (!unicast_response)
+ 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 a UTF-8 problem?)");
+ goto fail;
+ }
+
+ 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 a UTF-8 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;
+
+ if (!(record = avahi_dns_packet_consume_record(p, &cache_flush))) {
+ avahi_log_warn(__FILE__": Packet too short or invalid while reading response record. (Maybe a UTF-8 problem?)");
+ break;
+ }
+
+ if (!avahi_key_is_pattern(record->key)) {
+
+ if (handle_conflict(s, i, record, cache_flush)) {
+ if (!from_local_iface && !avahi_record_is_link_local_address(record))
+ 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 scheduled 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 (j->announcing &&
+ 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 avahi_port_from_sockaddr((struct sockaddr*) &lsa) == 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 avahi_port_from_sockaddr((struct sockaddr*) &lsa) == 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)) ||
+ !i->announcing) {
+ avahi_log_warn("Received packet from invalid interface.");
+ return;
+ }
+
+ if (port <= 0) {
+ /* This fixes RHBZ #475394 */
+ avahi_log_warn("Received packet from invalid source port %u.", (unsigned) port);
+ 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("Received invalid packet.");
+ return;
+ }
+
+ if (avahi_dns_packet_is_query(p)) {
+ int legacy_unicast = 0;
+
+ /* For queries EDNS0 might allow ARCOUNT != 0. We ignore the
+ * AR section completely here, so far. Until the day we add
+ * EDNS0 support. */
+
+ 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 {
+ char t[AVAHI_ADDRESS_STR_MAX];
+
+ if (port != AVAHI_MDNS_PORT) {
+ avahi_log_warn("Received response from host %s with invalid source port %u on interface '%s.%i'", avahi_address_snprint(t, sizeof(t), src_address), port, i->hardware->name, i->protocol);
+ return;
+ }
+
+ if (ttl != 255 && s->config.check_response_ttl) {
+ avahi_log_warn("Received response from host %s with invalid TTL %u on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), 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 from host %s on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), 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 from host %s.", avahi_address_snprint(t, sizeof(t), src_address));
+ 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("Received invalid packet.");
+ return;
+ }
+
+ if (!(slot = find_slot(s, avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ID)))) {
+ avahi_log_warn("Received legacy unicast response with unknown id");
+ return;
+ }
+
+ if (!(j = avahi_interface_monitor_get_interface(s->monitor, slot->interface, slot->address.proto)) ||
+ !j->announcing)
+ 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 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 received on address that isn't local.");
+
+ avahi_dns_packet_free(p);
+
+ avahi_cleanup_dead_entries(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);
+
+ avahi_cleanup_dead_entries(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);
+
+ assert(s->n_host_rr_pending > 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();
+ else
+ hn = avahi_normalize_name_strdup(host_name);
+
+ hn[strcspn(hn, ".")] = 0;
+
+ if (avahi_domain_equal(s->host_name, hn) && 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;
+
+ 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");
+ else
+ dn = avahi_normalize_name_strdup(domain_name);
+
+ 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 = dn;
+ update_fqdn(s);
+
+ register_stuff(s);
+
+ avahi_free(dn);
+ return AVAHI_OK;
+}
+
+static int valid_server_config(const AvahiServerConfig *sc) {
+ AvahiStringList *l;
+
+ assert(sc);
+
+ if (sc->n_wide_area_servers > AVAHI_WIDE_AREA_SERVERS_MAX)
+ return AVAHI_ERR_INVALID_CONFIG;
+
+ 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;
+
+ for (l = sc->browse_domains; l; l = l->next)
+ if (!avahi_is_valid_domain_name((char*) l->text))
+ 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->cleanup_time_event = NULL;
+ 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);
+
+ if (s->cleanup_time_event)
+ avahi_time_event_free(s->cleanup_time_event);
+
+ 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->allow_interfaces = NULL;
+ c->deny_interfaces = NULL;
+ c->host_name = NULL;
+ c->domain_name = NULL;
+ c->check_response_ttl = 0;
+ c->publish_hinfo = 0;
+ c->publish_addresses = 1;
+ c->publish_workstation = 0;
+ c->publish_domain = 1;
+ c->use_iff_running = 0;
+ c->enable_reflector = 0;
+ c->reflect_ipv = 0;
+ c->add_service_cookie = 0;
+ 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;
+ c->publish_aaaa_on_ipv4 = 1;
+ c->publish_a_on_ipv6 = 0;
+ c->n_cache_entries_max = AVAHI_DEFAULT_CACHE_ENTRIES_MAX;
+ c->ratelimit_interval = 0;
+ c->ratelimit_burst = 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);
+ avahi_string_list_free(c->allow_interfaces);
+ avahi_string_list_free(c->deny_interfaces);
+}
+
+AvahiServerConfig* avahi_server_config_copy(AvahiServerConfig *ret, const AvahiServerConfig *c) {
+ char *d = NULL, *h = NULL;
+ AvahiStringList *browse = NULL, *allow = NULL, *deny = 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 (!(browse = avahi_string_list_copy(c->browse_domains)) && c->browse_domains) {
+ avahi_free(h);
+ avahi_free(d);
+ return NULL;
+ }
+
+ if (!(allow = avahi_string_list_copy(c->allow_interfaces)) && c->allow_interfaces) {
+ avahi_string_list_free(browse);
+ avahi_free(h);
+ avahi_free(d);
+ return NULL;
+ }
+
+ if (!(deny = avahi_string_list_copy(c->deny_interfaces)) && c->deny_interfaces) {
+ avahi_string_list_free(allow);
+ avahi_string_list_free(browse);
+ avahi_free(h);
+ avahi_free(d);
+ return NULL;
+ }
+
+ *ret = *c;
+ ret->host_name = h;
+ ret->domain_name = d;
+ ret->browse_domains = browse;
+ ret->allow_interfaces = allow;
+ ret->deny_interfaces = deny;
+
+ 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;
+}
+
+const AvahiServerConfig* avahi_server_get_config(AvahiServer *s) {
+ assert(s);
+
+ return &s->config;
+}
+
+/** Set the browsing domains */
+int avahi_server_set_browse_domains(AvahiServer *s, AvahiStringList *domains) {
+ AvahiStringList *l;
+
+ assert(s);
+
+ for (l = s->config.browse_domains; l; l = l->next)
+ if (!avahi_is_valid_domain_name((char*) l->text))
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_DOMAIN_NAME);
+
+ avahi_string_list_free(s->config.browse_domains);
+ s->config.browse_domains = avahi_string_list_copy(domains);
+
+ return AVAHI_OK;
+}
diff --git a/avahi-core/socket.c b/avahi-core/socket.c
new file mode 100644
index 0000000..17ab6e5
--- /dev/null
+++ b/avahi-core/socket.c
@@ -0,0 +1,993 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 == EINTR)
+ continue;
+
+ if (errno != EAGAIN) {
+ char where[64];
+ struct sockaddr_in *sin = msg->msg_name;
+
+ inet_ntop(sin->sin_family, &sin->sin_addr, where, sizeof(where));
+ avahi_log_debug("sendmsg() to %s failed: %s", where, 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_MULTICAST_IF) && 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));
+ msg.msg_control = cmsg_data;
+ msg.msg_controllen = CMSG_LEN(sizeof(struct in_pktinfo));
+
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_len = msg.msg_controllen;
+ 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;
+ }
+#elif defined(IP_MULTICAST_IF)
+ if (src_address) {
+ struct in_addr any = { INADDR_ANY };
+ if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, src_address ? &src_address->address : &any, sizeof(struct in_addr)) < 0) {
+ avahi_log_warn("IP_MULTICAST_IF failed: %s", strerror(errno));
+ return -1;
+ }
+ }
+#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 = CMSG_LEN(sizeof(struct in_addr));
+
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_len = msg.msg_controllen;
+ cmsg->cmsg_level = IPPROTO_IP;
+ cmsg->cmsg_type = IP_SENDSRCADDR;
+
+ addr = (struct in_addr *)CMSG_DATA(cmsg);
+ addr->s_addr = src_address->address;
+ }
+#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));
+ msg.msg_control = cmsg_data;
+ msg.msg_controllen = CMSG_LEN(sizeof(struct in6_pktinfo));
+
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_len = msg.msg_controllen;
+ 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));
+ } 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;
+ }
+
+ 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);
+ 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) {
+ /* Linux returns EAGAIN when an invalid IP packet has been
+ received. 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;
+ }
+
+ /* For corrupt packets FIONREAD returns zero size (See rhbz #607297). So
+ * fail after having read them. */
+ if (!ms)
+ 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 && i->ipi_ifindex > 0)
+ *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
+ if (*(uint_t*) sdl > 0)
+ *ret_iface = *(uint_t*) sdl;
+#else
+
+ if (sdl->sdl_index > 0)
+ *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;
+ }
+
+ 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);
+ 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) {
+ /* Linux returns EAGAIN when an invalid IP packet has been
+ received. 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;
+ }
+
+ /* For corrupt packets FIONREAD returns zero size (See rhbz #607297). So
+ * fail after having read them. */
+ if (!ms)
+ 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 && i->ipi6_ifindex > 0)
+ *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, 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;
+
+ 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/avahi-core/socket.h b/avahi-core/socket.h
new file mode 100644
index 0000000..92f12d7
--- /dev/null
+++ b/avahi-core/socket.h
@@ -0,0 +1,47 @@
+#ifndef foosockethfoo
+#define foosockethfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/timeeventq-test.c b/avahi-core/timeeventq-test.c
new file mode 100644
index 0000000..d7b2e39
--- /dev/null
+++ b/avahi-core/timeeventq-test.c
@@ -0,0 +1,67 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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) (long) (p))
+#define INT_TO_POINTER(i) ((void*) (long) (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/avahi-core/timeeventq.c b/avahi-core/timeeventq.c
new file mode 100644
index 0000000..2799bf2
--- /dev/null
+++ b/avahi-core/timeeventq.c
@@ -0,0 +1,225 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/timeeventq.h b/avahi-core/timeeventq.h
new file mode 100644
index 0000000..a695b6a
--- /dev/null
+++ b/avahi-core/timeeventq.h
@@ -0,0 +1,46 @@
+#ifndef footimeeventqhfoo
+#define footimeeventqhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/update-test.c b/avahi-core/update-test.c
new file mode 100644
index 0000000..feb884a
--- /dev/null
+++ b/avahi-core/update-test.c
@@ -0,0 +1,91 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+ return 0;
+}
diff --git a/avahi-core/util.c b/avahi-core/util.c
new file mode 100644
index 0000000..21ef94c
--- /dev/null
+++ b/avahi-core/util.c
@@ -0,0 +1,120 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/util.h b/avahi-core/util.h
new file mode 100644
index 0000000..e13c334
--- /dev/null
+++ b/avahi-core/util.h
@@ -0,0 +1,41 @@
+#ifndef fooutilhfoo
+#define fooutilhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-core/wide-area.c b/avahi-core/wide-area.c
new file mode 100644
index 0000000..d5e64e5
--- /dev/null
+++ b/avahi-core/wide-area.c
@@ -0,0 +1,723 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 a UTF-8 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 record. (Maybe a UTF-8 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 = 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));
+
+ 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/avahi-core/wide-area.h b/avahi-core/wide-area.h
new file mode 100644
index 0000000..b1dc570
--- /dev/null
+++ b/avahi-core/wide-area.h
@@ -0,0 +1,52 @@
+#ifndef foowideareahfoo
+#define foowideareahfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/.gitignore b/avahi-daemon/.gitignore
new file mode 100644
index 0000000..f1a6f8d
--- /dev/null
+++ b/avahi-daemon/.gitignore
@@ -0,0 +1,11 @@
+avahi-daemon.service
+avahi-daemon.socket
+avahi-daemon
+avahi-dbus.conf
+ini-file-parser-test
+*.o
+*.lo
+Makefile
+Makefile.in
+.deps
+.libs
diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am
new file mode 100644
index 0000000..b6b5a77
--- /dev/null
+++ b/avahi-daemon/Makefile.am
@@ -0,0 +1,176 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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_XML
+
+pkgsysconfdir=$(sysconfdir)/avahi
+servicedir=$(pkgsysconfdir)/services
+introspectiondir=$(datadir)/dbus-1/interfaces
+dbussystemservicesdir=$(datadir)/dbus-1/system-services
+
+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 \
+ sd-daemon.h sd-daemon.c \
+ ../avahi-client/check-nss.c
+
+avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS) $(XML_CFLAGS)
+avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) $(XML_LIBS)
+
+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
+
+dist_service_DATA = \
+ ssh.service \
+ sftp-ssh.service
+
+dist_pkgdata_DATA = \
+ avahi-service.dtd
+
+%.service: %.service.in
+ $(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
+
+%.socket: %.socket.in
+ $(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' \
+ -e 's,@avahi_runtime_dir\@,$(avahi_runtime_dir),g' $< > $@
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ avahi-daemon.service \
+ avahi-daemon.socket
+
+dist_dbussystemservices_DATA = \
+ org.freedesktop.Avahi.service
+endif
+
+CLEANFILES = $(systemdsystemunit_DATA)
+
+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) -DDBUS_SYSTEM_BUS_DEFAULT_ADDRESS=\"$(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)\"
+
+dist_dbusservice_DATA = avahi-dbus.conf
+
+dist_introspection_DATA = \
+ org.freedesktop.Avahi.Server.xml \
+ org.freedesktop.Avahi.EntryGroup.xml \
+ org.freedesktop.Avahi.DomainBrowser.xml \
+ org.freedesktop.Avahi.ServiceTypeBrowser.xml \
+ org.freedesktop.Avahi.ServiceBrowser.xml \
+ org.freedesktop.Avahi.ServiceResolver.xml \
+ org.freedesktop.Avahi.AddressResolver.xml \
+ org.freedesktop.Avahi.HostNameResolver.xml \
+ org.freedesktop.Avahi.RecordBrowser.xml
+
+endif
+endif
+endif
+
+EXTRA_DIST = \
+ avahi-daemon.conf \
+ example.service \
+ hosts \
+ example.service \
+ introspect.dtd \
+ introspect.xsl \
+ avahi-daemon.service.in \
+ avahi-daemon.socket.in
+
+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"
+
+update-systemd:
+ curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c
+ curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h > sd-daemon.h
diff --git a/avahi-daemon/avahi-daemon.conf b/avahi-daemon/avahi-daemon.conf
new file mode 100644
index 0000000..27e240d
--- /dev/null
+++ b/avahi-daemon/avahi-daemon.conf
@@ -0,0 +1,68 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+#allow-interfaces=eth0
+#deny-interfaces=eth1
+#check-response-ttl=no
+#use-iff-running=no
+#enable-dbus=yes
+#disallow-other-stacks=no
+#allow-point-to-point=no
+#cache-entries-max=4096
+#clients-max=4096
+#objects-per-client-max=1024
+#entries-per-entry-group-max=32
+ratelimit-interval-usec=1000000
+ratelimit-burst=1000
+
+[wide-area]
+enable-wide-area=yes
+
+[publish]
+#disable-publishing=no
+#disable-user-service-publishing=no
+#add-service-cookie=no
+#publish-addresses=yes
+publish-hinfo=no
+publish-workstation=no
+#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
+#reflect-ipv=no
+
+[rlimits]
+#rlimit-as=
+rlimit-core=0
+rlimit-data=4194304
+rlimit-fsize=0
+rlimit-nofile=768
+rlimit-stack=4194304
+rlimit-nproc=3
diff --git a/avahi-daemon/avahi-daemon.service.in b/avahi-daemon/avahi-daemon.service.in
new file mode 100644
index 0000000..548c834
--- /dev/null
+++ b/avahi-daemon/avahi-daemon.service.in
@@ -0,0 +1,32 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
+
+[Unit]
+Description=Avahi mDNS/DNS-SD Stack
+Requires=avahi-daemon.socket
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.Avahi
+ExecStart=@sbindir@/avahi-daemon -s
+ExecReload=@sbindir@/avahi-daemon -r
+NotifyAccess=main
+
+[Install]
+WantedBy=multi-user.target
+Also=avahi-daemon.socket
+Alias=dbus-org.freedesktop.Avahi.service
diff --git a/avahi-daemon/avahi-daemon.socket.in b/avahi-daemon/avahi-daemon.socket.in
new file mode 100644
index 0000000..13309b8
--- /dev/null
+++ b/avahi-daemon/avahi-daemon.socket.in
@@ -0,0 +1,25 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
+
+[Unit]
+Description=Avahi mDNS/DNS-SD Stack Activation Socket
+
+[Socket]
+ListenStream=@avahi_runtime_dir@/avahi-daemon/socket
+
+[Install]
+WantedBy=sockets.target
diff --git a/avahi-daemon/avahi-dbus.conf.in b/avahi-daemon/avahi-dbus.conf.in
new file mode 100644
index 0000000..1df0cc4
--- /dev/null
+++ b/avahi-daemon/avahi-dbus.conf.in
@@ -0,0 +1,32 @@
+<!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_destination="org.freedesktop.Avahi"
+ send_interface="org.freedesktop.Avahi.Server" send_member="SetHostName"/>
+ </policy>
+
+ <!-- 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>
+ <policy user="root">
+ <allow send_destination="org.freedesktop.Avahi"/>
+ <allow receive_sender="org.freedesktop.Avahi"/>
+ </policy>
+</busconfig>
diff --git a/avahi-daemon/avahi-service.dtd b/avahi-daemon/avahi-service.dtd
new file mode 100644
index 0000000..daf9637
--- /dev/null
+++ b/avahi-daemon/avahi-service.dtd
@@ -0,0 +1,18 @@
+<!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/avahi-daemon/caps.c b/avahi-daemon/caps.c
new file mode 100644
index 0000000..0e21acf
--- /dev/null
+++ b/avahi-daemon/caps.c
@@ -0,0 +1,115 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <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 across setuid(). This is called before we drop
+ * privileges. */
+
+ 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 across 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 drop
+ * privileges. */
+
+ /* 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/avahi-daemon/caps.h b/avahi-daemon/caps.h
new file mode 100644
index 0000000..5119bd0
--- /dev/null
+++ b/avahi-daemon/caps.h
@@ -0,0 +1,27 @@
+#ifndef foocapshfoo
+#define foocapshfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/chroot.c b/avahi-daemon/chroot.c
new file mode 100644
index 0000000..ccd56be
--- /dev/null
+++ b/avahi-daemon/chroot.c
@@ -0,0 +1,415 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"/org.freedesktop.Avahi.Server.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.EntryGroup.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.AddressResolver.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.DomainBrowser.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.HostNameResolver.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.ServiceBrowser.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.ServiceResolver.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.ServiceTypeBrowser.xml",
+ AVAHI_DBUS_INTROSPECTION_DIR"/org.freedesktop.Avahi.RecordBrowser.xml",
+#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) {
+
+ /* 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 &&
+ (errno != EPIPE && errno != ECONNRESET)) {
+ avahi_log_error("write() failed: %s\n", strerror(errno));
+ return -1;
+ }
+
+ if ((r = read(helper_fd, &c, sizeof(c))) < 0 &&
+ (errno != EPIPE && errno != ECONNRESET)) {
+ avahi_log_error("read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
+ return -1;
+ }
+
+ return 0;
+
+ } else
+
+ return unlink(fname);
+
+}
diff --git a/avahi-daemon/chroot.h b/avahi-daemon/chroot.h
new file mode 100644
index 0000000..2828d54
--- /dev/null
+++ b/avahi-daemon/chroot.h
@@ -0,0 +1,34 @@
+#ifndef foochroothelperhfoo
+#define foochroothelperhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/dbus-async-address-resolver.c b/avahi-daemon/dbus-async-address-resolver.c
new file mode 100644
index 0000000..a77e03c
--- /dev/null
+++ b/avahi-daemon/dbus-async-address-resolver.c
@@ -0,0 +1,142 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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 (!reply) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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, "org.freedesktop.Avahi.AddressResolver.xml");
+
+ /* 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/avahi-daemon/dbus-async-host-name-resolver.c b/avahi-daemon/dbus-async-host-name-resolver.c
new file mode 100644
index 0000000..7c2d063
--- /dev/null
+++ b/avahi-daemon/dbus-async-host-name-resolver.c
@@ -0,0 +1,140 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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 (!reply) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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, "org.freedesktop.Avahi.HostNameResolver.xml");
+
+ /* 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/avahi-daemon/dbus-async-service-resolver.c b/avahi-daemon/dbus-async-service-resolver.c
new file mode 100644
index 0000000..2b58e2d
--- /dev/null
+++ b/avahi-daemon/dbus-async-service-resolver.c
@@ -0,0 +1,179 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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 (!reply) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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, "org.freedesktop.Avahi.ServiceResolver.xml");
+
+ /* 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/avahi-daemon/dbus-domain-browser.c b/avahi-daemon/dbus-domain-browser.c
new file mode 100644
index 0000000..e51996f
--- /dev/null
+++ b/avahi-daemon/dbus-domain-browser.c
@@ -0,0 +1,132 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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, "org.freedesktop.Avahi.DomainBrowser.xml");
+
+ /* 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 (!m) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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/avahi-daemon/dbus-entry-group.c b/avahi-daemon/dbus-entry-group.c
new file mode 100644
index 0000000..4e879a5
--- /dev/null
+++ b/avahi-daemon/dbus-entry-group.c
@@ -0,0 +1,369 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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");
+
+ if (!m) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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, "org.freedesktop.Avahi.EntryGroup.xml");
+
+ /* 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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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/avahi-daemon/dbus-internal.h b/avahi-daemon/dbus-internal.h
new file mode 100644
index 0000000..0b86578
--- /dev/null
+++ b/avahi-daemon/dbus-internal.h
@@ -0,0 +1,256 @@
+#ifndef foodbusinternalhfoo
+#define foodbusinternalhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 DEFAULT_CLIENTS_MAX 4096
+#define DEFAULT_OBJECTS_PER_CLIENT_MAX 1024
+#define DEFAULT_ENTRIES_PER_ENTRY_GROUP_MAX 32
+
+struct EntryGroupInfo {
+ unsigned id;
+ Client *client;
+ AvahiSEntryGroup *entry_group;
+ char *path;
+
+ unsigned 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;
+ unsigned 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);
+ unsigned n_clients;
+ unsigned current_id;
+
+ AvahiTimeout *reconnect_timeout;
+ int reconnect;
+
+ unsigned n_clients_max;
+ unsigned n_objects_per_client_max;
+ unsigned n_entries_per_entry_group_max;
+
+ int disable_user_service_publishing;
+};
+
+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/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c
new file mode 100644
index 0000000..eb8a662
--- /dev/null
+++ b/avahi-daemon/dbus-protocol.c
@@ -0,0 +1,1226 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 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);
+
+ assert(server->n_clients >= 1);
+ server->n_clients --;
+}
+
+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 >= server->n_clients_max)
+ return NULL;
+
+ /* If not existent 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("Disconnected 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("Disconnected from D-Bus, exiting.");
+ raise(SIGTERM);
+ }
+
+ 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, "org.freedesktop.Avahi.Server.xml");
+
+ 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 (server->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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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 >= server->n_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");
+
+ if (!m) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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);
+
+#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_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;
+ }
+
+ 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) {
+#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;
+ }
+
+ return -1;
+}
+
+static void dbus_disconnect(void) {
+ assert(server);
+
+ while (server->clients)
+ client_free(server->clients);
+
+ 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;
+ }
+}
+
+int dbus_protocol_setup(const AvahiPoll *poll_api,
+ int _disable_user_service_publishing,
+ int _n_clients_max,
+ int _n_objects_per_client_max,
+ int _n_entries_per_entry_group_max,
+ int force) {
+
+
+ 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;
+ server->disable_user_service_publishing = _disable_user_service_publishing;
+ server->n_clients_max = _n_clients_max > 0 ? _n_clients_max : DEFAULT_CLIENTS_MAX;
+ server->n_objects_per_client_max = _n_objects_per_client_max > 0 ? _n_objects_per_client_max : DEFAULT_OBJECTS_PER_CLIENT_MAX;
+ server->n_entries_per_entry_group_max = _n_entries_per_entry_group_max > 0 ? _n_entries_per_entry_group_max : DEFAULT_ENTRIES_PER_ENTRY_GROUP_MAX;
+
+ 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) {
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
+ dbus_connection_close(server->bus);
+#else
+ dbus_connection_disconnect(server->bus);
+#endif
+
+ 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/avahi-daemon/dbus-protocol.h b/avahi-daemon/dbus-protocol.h
new file mode 100644
index 0000000..2184487
--- /dev/null
+++ b/avahi-daemon/dbus-protocol.h
@@ -0,0 +1,32 @@
+#ifndef foodbusprotocolhfoo
+#define foodbusprotocolhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 _n_clients_max,
+ int _n_objects_per_client_max,
+ int _n_entries_per_entry_group_max,
+ int force);
+void dbus_protocol_shutdown(void);
+void dbus_protocol_server_state_changed(AvahiServerState state);
+
+#endif
diff --git a/avahi-daemon/dbus-record-browser.c b/avahi-daemon/dbus-record-browser.c
new file mode 100644
index 0000000..c0337cf
--- /dev/null
+++ b/avahi-daemon/dbus-record-browser.c
@@ -0,0 +1,164 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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, "org.freedesktop.Avahi.RecordBrowser.xml");
+
+ /* 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 (!m) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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/avahi-daemon/dbus-service-browser.c b/avahi-daemon/dbus-service-browser.c
new file mode 100644
index 0000000..962dca0
--- /dev/null
+++ b/avahi-daemon/dbus-service-browser.c
@@ -0,0 +1,144 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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, "org.freedesktop.Avahi.ServiceBrowser.xml");
+
+ /* 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 (!m) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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/avahi-daemon/dbus-service-type-browser.c b/avahi-daemon/dbus-service-type-browser.c
new file mode 100644
index 0000000..20afdbe
--- /dev/null
+++ b/avahi-daemon/dbus-service-type-browser.c
@@ -0,0 +1,134 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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, "org.freedesktop.Avahi.ServiceTypeBrowser.xml");
+
+ /* 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 (!m) {
+ avahi_log_error("Failed allocate message");
+ return;
+ }
+
+ 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/avahi-daemon/dbus-sync-address-resolver.c b/avahi-daemon/dbus-sync-address-resolver.c
new file mode 100644
index 0000000..9845420
--- /dev/null
+++ b/avahi-daemon/dbus-sync-address-resolver.c
@@ -0,0 +1,96 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ goto finish;
+ }
+
+ 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);
+ }
+
+finish:
+ avahi_dbus_sync_address_resolver_free(i);
+}
diff --git a/avahi-daemon/dbus-sync-host-name-resolver.c b/avahi-daemon/dbus-sync-host-name-resolver.c
new file mode 100644
index 0000000..e511327
--- /dev/null
+++ b/avahi-daemon/dbus-sync-host-name-resolver.c
@@ -0,0 +1,96 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ goto finish;
+ }
+
+ 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);
+ }
+
+finish:
+ avahi_dbus_sync_host_name_resolver_free(i);
+}
diff --git a/avahi-daemon/dbus-sync-service-resolver.c b/avahi-daemon/dbus-sync-service-resolver.c
new file mode 100644
index 0000000..ed7276a
--- /dev/null
+++ b/avahi-daemon/dbus-sync-service-resolver.c
@@ -0,0 +1,135 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ assert(i->client->n_objects >= 1);
+ i->client->n_objects--;
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ goto finish;
+ }
+
+ 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);
+ }
+
+finish:
+ avahi_dbus_sync_service_resolver_free(i);
+}
diff --git a/avahi-daemon/dbus-util.c b/avahi-daemon/dbus-util.c
new file mode 100644
index 0000000..2983b29
--- /dev/null
+++ b/avahi-daemon/dbus-util.c
@@ -0,0 +1,435 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+
+ 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);
+
+ if (!reply) {
+ avahi_log_error("Failed allocate message");
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+ }
+
+ 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);
+
+ k = (const uint8_t*) "";
+ n = 0;
+ dbus_message_iter_get_fixed_array(&sub2, &k, &n);
+
+ if (!k)
+ k = (const uint8_t*) "";
+
+ 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/avahi-daemon/dbus-util.h b/avahi-daemon/dbus-util.h
new file mode 100644
index 0000000..a513367
--- /dev/null
+++ b/avahi-daemon/dbus-util.h
@@ -0,0 +1,57 @@
+#ifndef foodbusutilhfoo
+#define foodbusutilhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/example.service b/avahi-daemon/example.service
new file mode 100644
index 0000000..46db2ae
--- /dev/null
+++ b/avahi-daemon/example.service
@@ -0,0 +1,50 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/hosts b/avahi-daemon/hosts
new file mode 100644
index 0000000..4483340
--- /dev/null
+++ b/avahi-daemon/hosts
@@ -0,0 +1,27 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/avahi-daemon/ini-file-parser-test.c b/avahi-daemon/ini-file-parser-test.c
new file mode 100644
index 0000000..6ca6641
--- /dev/null
+++ b/avahi-daemon/ini-file-parser-test.c
@@ -0,0 +1,62 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/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/avahi-daemon/ini-file-parser.c b/avahi-daemon/ini-file-parser.c
new file mode 100644
index 0000000..0a99ce3
--- /dev/null
+++ b/avahi-daemon/ini-file-parser.c
@@ -0,0 +1,196 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <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/avahi-daemon/ini-file-parser.h b/avahi-daemon/ini-file-parser.h
new file mode 100644
index 0000000..dd3aace
--- /dev/null
+++ b/avahi-daemon/ini-file-parser.h
@@ -0,0 +1,55 @@
+#ifndef fooinifileparserhfoo
+#define fooinifileparserhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/introspect.dtd b/avahi-daemon/introspect.dtd
new file mode 100644
index 0000000..15d913a
--- /dev/null
+++ b/avahi-daemon/introspect.dtd
@@ -0,0 +1,37 @@
+<!-- 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/avahi-daemon/introspect.xsl b/avahi-daemon/introspect.xsl
new file mode 100644
index 0000000..5d68560
--- /dev/null
+++ b/avahi-daemon/introspect.xsl
@@ -0,0 +1,102 @@
+<?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.
+-->
+
+<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/avahi-daemon/main.c b/avahi-daemon/main.c
new file mode 100644
index 0000000..8c28fd6
--- /dev/null
+++ b/avahi-daemon/main.c
@@ -0,0 +1,1701 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <sys/ioctl.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>
+
+#ifdef HAVE_INOTIFY
+#include <sys/inotify.h>
+#endif
+
+#ifdef HAVE_KQUEUE
+#include <sys/types.h>
+#include <sys/event.h>
+#include <unistd.h>
+#endif
+
+#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>
+#include <avahi-core/util.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"
+#include "sd-daemon.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;
+ unsigned n_clients_max;
+ unsigned n_objects_per_client_max;
+ unsigned n_entries_per_entry_group_max;
+#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"
+#define BROWSE_DOMAINS_MAX 16
+
+static AvahiSEntryGroup *dns_servers_entry_group = NULL;
+static AvahiSEntryGroup *resolv_conf_entry_group = NULL;
+
+static char **resolv_conf_name_servers = NULL;
+static char **resolv_conf_search_domains = 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, j = 0;
+
+ avahi_strfreev(resolv_conf_name_servers);
+ resolv_conf_name_servers = NULL;
+
+ avahi_strfreev(resolv_conf_search_domains);
+ resolv_conf_search_domains = 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_name_servers = avahi_new0(char*, AVAHI_WIDE_AREA_SERVERS_MAX+1);
+ resolv_conf_search_domains = avahi_new0(char*, BROWSE_DOMAINS_MAX+1);
+
+ while (!feof(f)) {
+ 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 ") || has_prefix(p, "nameserver\t")) && i < AVAHI_WIDE_AREA_SERVERS_MAX) {
+ p += 10;
+ p += strspn(p, "\t ");
+ p[strcspn(p, "\t ")] = 0;
+ resolv_conf_name_servers[i++] = avahi_strdup(p);
+ }
+
+ if ((has_prefix(p, "search ") || has_prefix(p, "search\t") ||
+ has_prefix(p, "domain ") || has_prefix(p, "domain\t"))) {
+
+ p += 6;
+
+ while (j < BROWSE_DOMAINS_MAX) {
+ size_t k;
+
+ p += strspn(p, "\t ");
+ k = strcspn(p, "\t ");
+
+ if (k > 0) {
+ resolv_conf_search_domains[j++] = avahi_strndup(p, k);
+ p += k;
+ }
+
+ if (!*p)
+ break;
+ }
+ }
+ }
+
+ ret = 0;
+
+finish:
+
+ if (ret != 0) {
+ avahi_strfreev(resolv_conf_name_servers);
+ resolv_conf_name_servers = NULL;
+
+ avahi_strfreev(resolv_conf_search_domains);
+ resolv_conf_search_domains = 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_name_servers) {
+ avahi_server_set_wide_area_servers(avahi_server, NULL, 0);
+ return;
+ }
+
+ for (p = resolv_conf_name_servers; *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 AvahiStringList *filter_duplicate_domains(AvahiStringList *l) {
+ AvahiStringList *e, *n, *p;
+
+ if (!l)
+ return l;
+
+ for (p = l, e = l->next; e; e = n) {
+ n = e->next;
+
+ if (avahi_domain_equal((char*) e->text, (char*) l->text)) {
+ p->next = e->next;
+ avahi_free(e);
+ } else
+ p = e;
+ }
+
+ l->next = filter_duplicate_domains(l->next);
+ return l;
+}
+
+static void update_browse_domains(void) {
+ AvahiStringList *l;
+ int n;
+ char **p;
+
+ if (!resolv_conf_search_domains) {
+ avahi_server_set_browse_domains(avahi_server, NULL);
+ return;
+ }
+
+ l = avahi_string_list_copy(config.server_config.browse_domains);
+
+ for (p = resolv_conf_search_domains, n = 0; *p && n < BROWSE_DOMAINS_MAX; p++, n++) {
+ if (!avahi_is_valid_domain_name(*p))
+ avahi_log_warn("'%s' is no valid domain name, ignoring.", *p);
+ else
+ l = avahi_string_list_add(l, *p);
+ }
+
+ l = filter_duplicate_domains(l);
+
+ avahi_server_set_browse_domains(avahi_server, l);
+ avahi_string_list_free(l);
+}
+
+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));
+ sd_notifyf(0, "STATUS=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_name_servers && resolv_conf_name_servers[0])
+ resolv_conf_entry_group = add_dns_servers(s, resolv_conf_entry_group, resolv_conf_name_servers);
+
+ 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);
+ sd_notifyf(0, "STATUS=Host name conflict, retrying with %s", n);
+ avahi_set_proc_title(argv0, "%s: collision [%s]", argv0, 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)));
+ sd_notifyf(0, "STATUS=Server error: %s", avahi_strerror(avahi_server_errno(s)));
+
+ avahi_simple_poll_quit(simple_poll_api);
+ break;
+
+ case AVAHI_SERVER_REGISTERING:
+
+ sd_notifyf(0, "STATUS=Registering host name %s", 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;
+
+ }
+}
+
+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);
+
+ 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:
+ 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' || *s == '1' || *s == 't' || *s == 'T';
+}
+
+static int parse_unsigned(const char *s, unsigned *u) {
+ char *e = NULL;
+ unsigned long ul;
+ unsigned k;
+
+ errno = 0;
+ ul = strtoul(s, &e, 0);
+
+ if (!e || *e || errno != 0)
+ return -1;
+
+ k = (unsigned) ul;
+
+ if ((unsigned long) k != ul)
+ return -1;
+
+ *u = k;
+ return 0;
+}
+
+static int parse_usec(const char *s, AvahiUsec *u) {
+ char *e = NULL;
+ unsigned long long ull;
+ AvahiUsec k;
+
+ errno = 0;
+ ull = strtoull(s, &e, 0);
+
+ if (!e || *e || errno != 0)
+ return -1;
+
+ k = (AvahiUsec) ull;
+
+ if ((unsigned long long) k != ull)
+ return -1;
+
+ *u = k;
+ return 0;
+}
+
+static char *get_machine_id(void) {
+ int fd;
+ char buf[32];
+
+ fd = open("/etc/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
+ if (fd == -1 && errno == ENOENT)
+ fd = open("/var/lib/dbus/machine-id", O_RDONLY|O_CLOEXEC|O_NOCTTY);
+ if (fd == -1)
+ return NULL;
+
+ /* File is on a filesystem so we never get EINTR or partial reads */
+ if (read(fd, buf, sizeof buf) != sizeof buf) {
+ close(fd);
+ return NULL;
+ }
+ close(fd);
+
+ /* Contents can be lower, upper and even mixed case so normalize */
+ avahi_strdown(buf);
+
+ return avahi_strndup(buf, sizeof buf);
+}
+
+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);
+
+ c->server_config.browse_domains = filter_duplicate_domains(c->server_config.browse_domains);
+ } 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);
+ else if (strcasecmp(p->key, "host-name-from-machine-id") == 0) {
+ if (*(p->value) == 'y' || *(p->value) == 'Y') {
+ char *machine_id = get_machine_id();
+ if (machine_id != NULL) {
+ avahi_free(c->server_config.host_name);
+ c->server_config.host_name = machine_id;
+ }
+ }
+ }
+#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 if (strcasecmp(p->key, "allow-interfaces") == 0) {
+ char **e, **t;
+
+ avahi_string_list_free(c->server_config.allow_interfaces);
+ c->server_config.allow_interfaces = NULL;
+ e = avahi_split_csv(p->value);
+
+ for (t = e; *t; t++)
+ c->server_config.allow_interfaces = avahi_string_list_add(c->server_config.allow_interfaces, *t);
+
+ avahi_strfreev(e);
+ } else if (strcasecmp(p->key, "deny-interfaces") == 0) {
+ char **e, **t;
+
+ avahi_string_list_free(c->server_config.deny_interfaces);
+ c->server_config.deny_interfaces = NULL;
+ e = avahi_split_csv(p->value);
+
+ for (t = e; *t; t++)
+ c->server_config.deny_interfaces = avahi_string_list_add(c->server_config.deny_interfaces, *t);
+
+ avahi_strfreev(e);
+ } else if (strcasecmp(p->key, "ratelimit-interval-usec") == 0) {
+ AvahiUsec k;
+
+ if (parse_usec(p->value, &k) < 0) {
+ avahi_log_error("Invalid ratelimit-interval-usec setting %s", p->value);
+ goto finish;
+ }
+
+ c->server_config.ratelimit_interval = k;
+
+ } else if (strcasecmp(p->key, "ratelimit-burst") == 0) {
+ unsigned k;
+
+ if (parse_unsigned(p->value, &k) < 0) {
+ avahi_log_error("Invalid ratelimit-burst setting %s", p->value);
+ goto finish;
+ }
+
+ c->server_config.ratelimit_burst = k;
+
+ } else if (strcasecmp(p->key, "cache-entries-max") == 0) {
+ unsigned k;
+
+ if (parse_unsigned(p->value, &k) < 0) {
+ avahi_log_error("Invalid cache-entries-max setting %s", p->value);
+ goto finish;
+ }
+
+ c->server_config.n_cache_entries_max = k;
+#ifdef HAVE_DBUS
+ } else if (strcasecmp(p->key, "clients-max") == 0) {
+ unsigned k;
+
+ if (parse_unsigned(p->value, &k) < 0) {
+ avahi_log_error("Invalid clients-max setting %s", p->value);
+ goto finish;
+ }
+
+ c->n_clients_max = k;
+ } else if (strcasecmp(p->key, "objects-per-client-max") == 0) {
+ unsigned k;
+
+ if (parse_unsigned(p->value, &k) < 0) {
+ avahi_log_error("Invalid objects-per-client-max setting %s", p->value);
+ goto finish;
+ }
+
+ c->n_objects_per_client_max = k;
+ } else if (strcasecmp(p->key, "entries-per-entry-group-max") == 0) {
+ unsigned k;
+
+ if (parse_unsigned(p->value, &k) < 0) {
+ avahi_log_error("Invalid entries-per-entry-group-max setting %s", p->value);
+ goto finish;
+ }
+
+ c->n_entries_per_entry_group_max = k;
+#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 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;
+ }
+ }
+
+ } 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);
+}
+
+#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
+#ifdef IN_ONLYDIR
+ |IN_ONLYDIR
+#endif
+ );
+ 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
+#ifdef IN_ONLYDIR
+ |IN_ONLYDIR
+#endif
+ );
+}
+
+#endif
+
+#ifdef HAVE_KQUEUE
+
+#define NUM_WATCHES 2
+
+static int kq = -1;
+static int kfds[NUM_WATCHES];
+static int num_kfds = 0;
+
+static void add_kqueue_watch(const char *dir);
+
+static void add_kqueue_watches(void) {
+ int c = 0;
+
+#ifdef ENABLE_CHROOT
+ c = config.use_chroot;
+#endif
+
+ add_kqueue_watch(c ? "/" : AVAHI_CONFIG_DIR);
+ add_kqueue_watch(c ? "/services" : AVAHI_SERVICE_DIR);
+}
+
+static void add_kqueue_watch(const char *dir) {
+ int fd;
+ struct kevent ev;
+
+ if (kq < 0)
+ return;
+
+ if (num_kfds >= NUM_WATCHES)
+ return;
+
+ fd = open(dir, O_RDONLY);
+ if (fd < 0)
+ return;
+ EV_SET(&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
+ NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME,
+ 0, 0);
+ if (kevent(kq, &ev, 1, NULL, 0, NULL) == -1) {
+ close(fd);
+ return;
+ }
+
+ kfds[num_kfds++] = fd;
+}
+
+#endif
+
+static void reload_config(void) {
+
+#ifdef HAVE_INOTIFY
+ /* Refresh in case the config dirs have been removed */
+ add_inotify_watches();
+#endif
+
+#ifdef HAVE_KQUEUE
+ add_kqueue_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();
+ update_browse_domains();
+
+ if (config.publish_resolv_conf && resolv_conf_name_servers && resolv_conf_name_servers[0])
+ resolv_conf_entry_group = add_dns_servers(avahi_server, resolv_conf_entry_group, resolv_conf_name_servers);
+}
+
+#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
+
+#ifdef HAVE_KQUEUE
+
+static void kqueue_callback(AvahiWatch *watch, int fd, AVAHI_GCC_UNUSED AvahiWatchEvent event, AVAHI_GCC_UNUSED void *userdata) {
+ struct kevent ev;
+ struct timespec nullts = { 0, 0 };
+ int res;
+
+ assert(fd == kq);
+ assert(watch);
+
+ res = kevent(kq, NULL, 0, &ev, 1, &nullts);
+
+ if (res > 0) {
+ /* Sleep for a half-second to avoid potential races
+ * during install/uninstall. */
+ usleep(500000);
+ avahi_log_info("Files changed, reloading.");
+ reload_config();
+ } else {
+ avahi_log_error("Failed to read kqueue event: %s", avahi_strerror(errno));
+ }
+}
+
+#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;
+
+ 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 SIGTERM:
+ avahi_log_info(
+ "Got %s, quitting.",
+ sig == SIGINT ? "SIGINT" : "SIGTERM");
+ avahi_simple_poll_quit(simple_poll_api);
+ break;
+
+ case SIGHUP:
+ avahi_log_info("Got SIGHUP, reloading.");
+
+ reload_config();
+ 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 void ignore_signal(int sig) {
+ struct sigaction sa;
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = SA_RESTART;
+
+ sigaction(sig, &sa, NULL);
+}
+
+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;
+#ifdef HAVE_INOTIFY
+ AvahiWatch *inotify_watch = NULL;
+#endif
+#ifdef HAVE_KQUEUE
+ int i;
+ AvahiWatch *kqueue_watch = NULL;
+#endif
+
+ assert(c);
+
+ ignore_signal(SIGPIPE);
+
+ 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, 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,
+ config.n_clients_max,
+ config.n_objects_per_client_max,
+ config.n_entries_per_entry_group_max,
+ !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
+
+#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
+
+#ifdef HAVE_KQUEUE
+ if ((kq = kqueue()) < 0)
+ avahi_log_warn( "Failed to initialize kqueue: %s", strerror(errno));
+ else {
+ add_kqueue_watches();
+
+ if (!(kqueue_watch = poll_api->watch_new(poll_api, kq, AVAHI_WATCH_IN, kqueue_callback, NULL))) {
+ avahi_log_error( "Failed to create kqueue watcher");
+ goto finish;
+ }
+ }
+#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();
+ update_browse_domains();
+
+ 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;
+ }
+
+ r = 0;
+
+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);
+
+#ifdef HAVE_INOTIFY
+ if (inotify_watch)
+ poll_api->watch_free(inotify_watch);
+ if (inotify_fd >= 0)
+ close(inotify_fd);
+#endif
+
+#ifdef HAVE_KQUEUE
+ if (kqueue_watch)
+ poll_api->watch_free(kqueue_watch);
+ if (kq >= 0)
+ close(kq);
+ for (i = 0; i < num_kfds; i++) {
+ if (kfds[i] >= 0)
+ close(kfds[i]);
+ }
+#endif
+
+ 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 privileges"
+#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 privileges"
+#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__) && !defined(__FreeBSD_kernel__)
+ /* 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;
+ config.n_clients_max = 0;
+ config.n_objects_per_client_max = 0;
+ config.n_entries_per_entry_group_max = 0;
+#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 (sd_listen_fds(0) <= 0)
+ if (daemon_close_all(-1) < 0)
+ avahi_log_warn("Failed to close all remaining file descriptors: %s", strerror(errno));
+
+ daemon_reset_sigs(-1);
+ daemon_unblock_sigs(-1);
+
+ 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);
+ sd_notifyf(0, "STATUS=%s "PACKAGE_VERSION" starting up.", argv0);
+ avahi_set_proc_title(argv0, "%s: starting up", argv0);
+
+ if (run_server(&config) == 0)
+ r = 0;
+
+ avahi_log_info("%s "PACKAGE_VERSION" exiting.", argv0);
+ sd_notifyf(0, "STATUS=%s "PACKAGE_VERSION" exiting.", argv0);
+ }
+
+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_name_servers);
+ avahi_strfreev(resolv_conf_search_domains);
+
+ 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/avahi-daemon/main.h b/avahi-daemon/main.h
new file mode 100644
index 0000000..ef04c2d
--- /dev/null
+++ b/avahi-daemon/main.h
@@ -0,0 +1,31 @@
+#ifndef foomainhfoo
+#define foomainhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/org.freedesktop.Avahi.AddressResolver.xml b/avahi-daemon/org.freedesktop.Avahi.AddressResolver.xml
new file mode 100644
index 0000000..bae9c2f
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.AddressResolver.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.DomainBrowser.xml b/avahi-daemon/org.freedesktop.Avahi.DomainBrowser.xml
new file mode 100644
index 0000000..22c614e
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.DomainBrowser.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.EntryGroup.xml b/avahi-daemon/org.freedesktop.Avahi.EntryGroup.xml
new file mode 100644
index 0000000..43fd63c
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.EntryGroup.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.HostNameResolver.xml b/avahi-daemon/org.freedesktop.Avahi.HostNameResolver.xml
new file mode 100644
index 0000000..0b43752
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.HostNameResolver.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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.HostNameResolver">
+
+ <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/avahi-daemon/org.freedesktop.Avahi.RecordBrowser.xml b/avahi-daemon/org.freedesktop.Avahi.RecordBrowser.xml
new file mode 100644
index 0000000..9ba86f4
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.RecordBrowser.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.Server.xml b/avahi-daemon/org.freedesktop.Avahi.Server.xml
new file mode 100644
index 0000000..c291274
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.Server.xml
@@ -0,0 +1,219 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.ServiceBrowser.xml b/avahi-daemon/org.freedesktop.Avahi.ServiceBrowser.xml
new file mode 100644
index 0000000..d80298d
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.ServiceBrowser.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.ServiceResolver.xml b/avahi-daemon/org.freedesktop.Avahi.ServiceResolver.xml
new file mode 100644
index 0000000..623f209
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.ServiceResolver.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.ServiceTypeBrowser.xml b/avahi-daemon/org.freedesktop.Avahi.ServiceTypeBrowser.xml
new file mode 100644
index 0000000..4efec82
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.ServiceTypeBrowser.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
+<!DOCTYPE node SYSTEM "introspect.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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/avahi-daemon/org.freedesktop.Avahi.service b/avahi-daemon/org.freedesktop.Avahi.service
new file mode 100644
index 0000000..30ed2d8
--- /dev/null
+++ b/avahi-daemon/org.freedesktop.Avahi.service
@@ -0,0 +1,24 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
+
+[D-BUS Service]
+Name=org.freedesktop.Avahi
+SystemdService=dbus-org.freedesktop.Avahi.service
+
+# This service should not be bus activated if systemd isn't running,
+# so that activation won't conflict with the init script startup.
+Exec=/bin/false
diff --git a/avahi-daemon/sd-daemon.c b/avahi-daemon/sd-daemon.c
new file mode 100644
index 0000000..6d1eebf
--- /dev/null
+++ b/avahi-daemon/sd-daemon.c
@@ -0,0 +1,436 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
+ Copyright 2010 Lennart Poettering
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+***/
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/fcntl.h>
+#include <netinet/in.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stddef.h>
+
+#include "sd-daemon.h"
+
+int sd_listen_fds(int unset_environment) {
+
+#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
+ return 0;
+#else
+ int r, fd;
+ const char *e;
+ char *p = NULL;
+ unsigned long l;
+
+ if (!(e = getenv("LISTEN_PID"))) {
+ r = 0;
+ goto finish;
+ }
+
+ errno = 0;
+ l = strtoul(e, &p, 10);
+
+ if (errno != 0) {
+ r = -errno;
+ goto finish;
+ }
+
+ if (!p || *p || l <= 0) {
+ r = -EINVAL;
+ goto finish;
+ }
+
+ /* Is this for us? */
+ if (getpid() != (pid_t) l) {
+ r = 0;
+ goto finish;
+ }
+
+ if (!(e = getenv("LISTEN_FDS"))) {
+ r = 0;
+ goto finish;
+ }
+
+ errno = 0;
+ l = strtoul(e, &p, 10);
+
+ if (errno != 0) {
+ r = -errno;
+ goto finish;
+ }
+
+ if (!p || *p) {
+ r = -EINVAL;
+ goto finish;
+ }
+
+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
+ int flags;
+
+ if ((flags = fcntl(fd, F_GETFD)) < 0) {
+ r = -errno;
+ goto finish;
+ }
+
+ if (flags & FD_CLOEXEC)
+ continue;
+
+ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
+ r = -errno;
+ goto finish;
+ }
+ }
+
+ r = (int) l;
+
+finish:
+ if (unset_environment) {
+ unsetenv("LISTEN_PID");
+ unsetenv("LISTEN_FDS");
+ }
+
+ return r;
+#endif
+}
+
+int sd_is_fifo(int fd, const char *path) {
+ struct stat st_fd;
+
+ if (fd < 0)
+ return -EINVAL;
+
+ memset(&st_fd, 0, sizeof(st_fd));
+ if (fstat(fd, &st_fd) < 0)
+ return -errno;
+
+ if (!S_ISFIFO(st_fd.st_mode))
+ return 0;
+
+ if (path) {
+ struct stat st_path;
+
+ memset(&st_path, 0, sizeof(st_path));
+ if (stat(path, &st_path) < 0) {
+
+ if (errno == ENOENT || errno == ENOTDIR)
+ return 0;
+
+ return -errno;
+ }
+
+ return
+ st_path.st_dev == st_fd.st_dev &&
+ st_path.st_ino == st_fd.st_ino;
+ }
+
+ return 1;
+}
+
+static int sd_is_socket_internal(int fd, int type, int listening) {
+ struct stat st_fd;
+
+ if (fd < 0 || type < 0)
+ return -EINVAL;
+
+ if (fstat(fd, &st_fd) < 0)
+ return -errno;
+
+ if (!S_ISSOCK(st_fd.st_mode))
+ return 0;
+
+ if (type != 0) {
+ int other_type = 0;
+ socklen_t l = sizeof(other_type);
+
+ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
+ return -errno;
+
+ if (l != sizeof(other_type))
+ return -EINVAL;
+
+ if (other_type != type)
+ return 0;
+ }
+
+ if (listening >= 0) {
+ int accepting = 0;
+ socklen_t l = sizeof(accepting);
+
+ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
+ return -errno;
+
+ if (l != sizeof(accepting))
+ return -EINVAL;
+
+ if (!accepting != !listening)
+ return 0;
+ }
+
+ return 1;
+}
+
+union sockaddr_union {
+ struct sockaddr sa;
+ struct sockaddr_in in4;
+ struct sockaddr_in6 in6;
+ struct sockaddr_un un;
+ struct sockaddr_storage storage;
+};
+
+int sd_is_socket(int fd, int family, int type, int listening) {
+ int r;
+
+ if (family < 0)
+ return -EINVAL;
+
+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
+ return r;
+
+ if (family > 0) {
+ union sockaddr_union sockaddr;
+ socklen_t l;
+
+ memset(&sockaddr, 0, sizeof(sockaddr));
+ l = sizeof(sockaddr);
+
+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
+ return -errno;
+
+ if (l < sizeof(sa_family_t))
+ return -EINVAL;
+
+ return sockaddr.sa.sa_family == family;
+ }
+
+ return 1;
+}
+
+int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
+ union sockaddr_union sockaddr;
+ socklen_t l;
+ int r;
+
+ if (family != 0 && family != AF_INET && family != AF_INET6)
+ return -EINVAL;
+
+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
+ return r;
+
+ memset(&sockaddr, 0, sizeof(sockaddr));
+ l = sizeof(sockaddr);
+
+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
+ return -errno;
+
+ if (l < sizeof(sa_family_t))
+ return -EINVAL;
+
+ if (sockaddr.sa.sa_family != AF_INET &&
+ sockaddr.sa.sa_family != AF_INET6)
+ return 0;
+
+ if (family > 0)
+ if (sockaddr.sa.sa_family != family)
+ return 0;
+
+ if (port > 0) {
+ if (sockaddr.sa.sa_family == AF_INET) {
+ if (l < sizeof(struct sockaddr_in))
+ return -EINVAL;
+
+ return htons(port) == sockaddr.in4.sin_port;
+ } else {
+ if (l < sizeof(struct sockaddr_in6))
+ return -EINVAL;
+
+ return htons(port) == sockaddr.in6.sin6_port;
+ }
+ }
+
+ return 1;
+}
+
+int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
+ union sockaddr_union sockaddr;
+ socklen_t l;
+ int r;
+
+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
+ return r;
+
+ memset(&sockaddr, 0, sizeof(sockaddr));
+ l = sizeof(sockaddr);
+
+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
+ return -errno;
+
+ if (l < sizeof(sa_family_t))
+ return -EINVAL;
+
+ if (sockaddr.sa.sa_family != AF_UNIX)
+ return 0;
+
+ if (path) {
+ if (length <= 0)
+ length = strlen(path);
+
+ if (length <= 0)
+ /* Unnamed socket */
+ return l == offsetof(struct sockaddr_un, sun_path);
+
+ if (path[0])
+ /* Normal path socket */
+ return
+ (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) &&
+ memcmp(path, sockaddr.un.sun_path, length+1) == 0;
+ else
+ /* Abstract namespace socket */
+ return
+ (l == offsetof(struct sockaddr_un, sun_path) + length) &&
+ memcmp(path, sockaddr.un.sun_path, length) == 0;
+ }
+
+ return 1;
+}
+
+int sd_notify(int unset_environment, const char *state) {
+#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC)
+ return 0;
+#else
+ int fd = -1, r;
+ struct msghdr msghdr;
+ struct iovec iovec;
+ union sockaddr_union sockaddr;
+ const char *e;
+
+ if (!state) {
+ r = -EINVAL;
+ goto finish;
+ }
+
+ if (!(e = getenv("NOTIFY_SOCKET")))
+ return 0;
+
+ /* Must be an abstract socket, or an absolute path */
+ if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
+ r = -EINVAL;
+ goto finish;
+ }
+
+ if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) {
+ r = -errno;
+ goto finish;
+ }
+
+ memset(&sockaddr, 0, sizeof(sockaddr));
+ sockaddr.sa.sa_family = AF_UNIX;
+ strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
+
+ if (sockaddr.un.sun_path[0] == '@')
+ sockaddr.un.sun_path[0] = 0;
+
+ memset(&iovec, 0, sizeof(iovec));
+ iovec.iov_base = (char*) state;
+ iovec.iov_len = strlen(state);
+
+ memset(&msghdr, 0, sizeof(msghdr));
+ msghdr.msg_name = &sockaddr;
+ msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
+
+ if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
+ msghdr.msg_namelen = sizeof(struct sockaddr_un);
+
+ msghdr.msg_iov = &iovec;
+ msghdr.msg_iovlen = 1;
+
+ if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
+ r = -errno;
+ goto finish;
+ }
+
+ r = 1;
+
+finish:
+ if (unset_environment)
+ unsetenv("NOTIFY_SOCKET");
+
+ if (fd >= 0)
+ close(fd);
+
+ return r;
+#endif
+}
+
+int sd_notifyf(int unset_environment, const char *format, ...) {
+#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
+ return 0;
+#else
+ va_list ap;
+ char *p = NULL;
+ int r;
+
+ va_start(ap, format);
+ r = vasprintf(&p, format, ap);
+ va_end(ap);
+
+ if (r < 0 || !p)
+ return -ENOMEM;
+
+ r = sd_notify(unset_environment, p);
+ free(p);
+
+ return r;
+#endif
+}
+
+int sd_booted(void) {
+#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
+ return 0;
+#else
+
+ struct stat a, b;
+
+ /* We simply test whether the systemd cgroup hierarchy is
+ * mounted */
+
+ if (lstat("/sys/fs/cgroup", &a) < 0)
+ return 0;
+
+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
+ return 0;
+
+ return a.st_dev != b.st_dev;
+#endif
+}
diff --git a/avahi-daemon/sd-daemon.h b/avahi-daemon/sd-daemon.h
new file mode 100644
index 0000000..4b853a1
--- /dev/null
+++ b/avahi-daemon/sd-daemon.h
@@ -0,0 +1,265 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+#ifndef foosddaemonhfoo
+#define foosddaemonhfoo
+
+/***
+ Copyright 2010 Lennart Poettering
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation files
+ (the "Software"), to deal in the Software without restriction,
+ including without limitation the rights to use, copy, modify, merge,
+ publish, distribute, sublicense, and/or sell copies of the Software,
+ and to permit persons to whom the Software is furnished to do so,
+ subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+***/
+
+#include <sys/types.h>
+#include <inttypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ Reference implementation of a few systemd related interfaces for
+ writing daemons. These interfaces are trivial to implement. To
+ simplify porting we provide this reference implementation.
+ Applications are welcome to reimplement the algorithms described
+ here if they do not want to include these two source files.
+
+ The following functionality is provided:
+
+ - Support for logging with log levels on stderr
+ - File descriptor passing for socket-based activation
+ - Daemon startup and status notification
+ - Detection of systemd boots
+
+ You may compile this with -DDISABLE_SYSTEMD to disable systemd
+ support. This makes all those calls NOPs that are directly related to
+ systemd (i.e. only sd_is_xxx() will stay useful).
+
+ Since this is drop-in code we don't want any of our symbols to be
+ exported in any case. Hence we declare hidden visibility for all of
+ them.
+
+ You may find an up-to-date version of these source files online:
+
+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h
+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c
+
+ This should compile on non-Linux systems, too, but with the
+ exception of the sd_is_xxx() calls all functions will become NOPs.
+
+ See sd-daemon(7) for more information.
+*/
+
+#ifndef _sd_printf_attr_
+#if __GNUC__ >= 4
+#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
+#else
+#define _sd_printf_attr_(a,b)
+#endif
+#endif
+
+#ifndef _sd_hidden_
+#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS)
+#define _sd_hidden_ __attribute__ ((visibility("hidden")))
+#else
+#define _sd_hidden_
+#endif
+#endif
+
+/*
+ Log levels for usage on stderr:
+
+ fprintf(stderr, SD_NOTICE "Hello World!\n");
+
+ This is similar to printk() usage in the kernel.
+*/
+#define SD_EMERG "<0>" /* system is unusable */
+#define SD_ALERT "<1>" /* action must be taken immediately */
+#define SD_CRIT "<2>" /* critical conditions */
+#define SD_ERR "<3>" /* error conditions */
+#define SD_WARNING "<4>" /* warning conditions */
+#define SD_NOTICE "<5>" /* normal but significant condition */
+#define SD_INFO "<6>" /* informational */
+#define SD_DEBUG "<7>" /* debug-level messages */
+
+/* The first passed file descriptor is fd 3 */
+#define SD_LISTEN_FDS_START 3
+
+/*
+ Returns how many file descriptors have been passed, or a negative
+ errno code on failure. Optionally, removes the $LISTEN_FDS and
+ $LISTEN_PID file descriptors from the environment (recommended, but
+ problematic in threaded environments). If r is the return value of
+ this function you'll find the file descriptors passed as fds
+ SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative
+ errno style error code on failure. This function call ensures that
+ the FD_CLOEXEC flag is set for the passed file descriptors, to make
+ sure they are not passed on to child processes. If FD_CLOEXEC shall
+ not be set, the caller needs to unset it after this call for all file
+ descriptors that are used.
+
+ See sd_listen_fds(3) for more information.
+*/
+int sd_listen_fds(int unset_environment) _sd_hidden_;
+
+/*
+ Helper call for identifying a passed file descriptor. Returns 1 if
+ the file descriptor is a FIFO in the file system stored under the
+ specified path, 0 otherwise. If path is NULL a path name check will
+ not be done and the call only verifies if the file descriptor
+ refers to a FIFO. Returns a negative errno style error code on
+ failure.
+
+ See sd_is_fifo(3) for more information.
+*/
+int sd_is_fifo(int fd, const char *path) _sd_hidden_;
+
+/*
+ Helper call for identifying a passed file descriptor. Returns 1 if
+ the file descriptor is a socket of the specified family (AF_INET,
+ ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If
+ family is 0 a socket family check will not be done. If type is 0 a
+ socket type check will not be done and the call only verifies if
+ the file descriptor refers to a socket. If listening is > 0 it is
+ verified that the socket is in listening mode. (i.e. listen() has
+ been called) If listening is == 0 it is verified that the socket is
+ not in listening mode. If listening is < 0 no listening mode check
+ is done. Returns a negative errno style error code on failure.
+
+ See sd_is_socket(3) for more information.
+*/
+int sd_is_socket(int fd, int family, int type, int listening) _sd_hidden_;
+
+/*
+ Helper call for identifying a passed file descriptor. Returns 1 if
+ the file descriptor is an Internet socket, of the specified family
+ (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM,
+ SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version
+ check is not done. If type is 0 a socket type check will not be
+ done. If port is 0 a socket port check will not be done. The
+ listening flag is used the same way as in sd_is_socket(). Returns a
+ negative errno style error code on failure.
+
+ See sd_is_socket_inet(3) for more information.
+*/
+int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) _sd_hidden_;
+
+/*
+ Helper call for identifying a passed file descriptor. Returns 1 if
+ the file descriptor is an AF_UNIX socket of the specified type
+ (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0
+ a socket type check will not be done. If path is NULL a socket path
+ check will not be done. For normal AF_UNIX sockets set length to
+ 0. For abstract namespace sockets set length to the length of the
+ socket name (including the initial 0 byte), and pass the full
+ socket path in path (including the initial 0 byte). The listening
+ flag is used the same way as in sd_is_socket(). Returns a negative
+ errno style error code on failure.
+
+ See sd_is_socket_unix(3) for more information.
+*/
+int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) _sd_hidden_;
+
+/*
+ Informs systemd about changed daemon state. This takes a number of
+ newline separated environment-style variable assignments in a
+ string. The following variables are known:
+
+ READY=1 Tells systemd that daemon startup is finished (only
+ relevant for services of Type=notify). The passed
+ argument is a boolean "1" or "0". Since there is
+ little value in signaling non-readiness the only
+ value daemons should send is "READY=1".
+
+ STATUS=... Passes a single-line status string back to systemd
+ that describes the daemon state. This is free-from
+ and can be used for various purposes: general state
+ feedback, fsck-like programs could pass completion
+ percentages and failing programs could pass a human
+ readable error message. Example: "STATUS=Completed
+ 66% of file system check..."
+
+ ERRNO=... If a daemon fails, the errno-style error code,
+ formatted as string. Example: "ERRNO=2" for ENOENT.
+
+ BUSERROR=... If a daemon fails, the D-Bus error-style error
+ code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"
+
+ MAINPID=... The main pid of a daemon, in case systemd did not
+ fork off the process itself. Example: "MAINPID=4711"
+
+ Daemons can choose to send additional variables. However, it is
+ recommended to prefix variable names not listed above with X_.
+
+ Returns a negative errno-style error code on failure. Returns > 0
+ if systemd could be notified, 0 if it couldn't possibly because
+ systemd is not running.
+
+ Example: When a daemon finished starting up, it could issue this
+ call to notify systemd about it:
+
+ sd_notify(0, "READY=1");
+
+ See sd_notifyf() for more complete examples.
+
+ See sd_notify(3) for more information.
+*/
+int sd_notify(int unset_environment, const char *state) _sd_hidden_;
+
+/*
+ Similar to sd_notify() but takes a format string.
+
+ Example 1: A daemon could send the following after initialization:
+
+ sd_notifyf(0, "READY=1\n"
+ "STATUS=Processing requests...\n"
+ "MAINPID=%lu",
+ (unsigned long) getpid());
+
+ Example 2: A daemon could send the following shortly before
+ exiting, on failure:
+
+ sd_notifyf(0, "STATUS=Failed to start up: %s\n"
+ "ERRNO=%i",
+ strerror(errno),
+ errno);
+
+ See sd_notifyf(3) for more information.
+*/
+int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3) _sd_hidden_;
+
+/*
+ Returns > 0 if the system was booted with systemd. Returns < 0 on
+ error. Returns 0 if the system was not booted with systemd. Note
+ that all of the functions above handle non-systemd boots just
+ fine. You should NOT protect them with a call to this function. Also
+ note that this function checks whether the system, not the user
+ session is controlled by systemd. However the functions above work
+ for both user and system services.
+
+ See sd_booted(3) for more information.
+*/
+int sd_booted(void) _sd_hidden_;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/avahi-daemon/setproctitle.c b/avahi-daemon/setproctitle.c
new file mode 100644
index 0000000..e6f0941
--- /dev/null
+++ b/avahi-daemon/setproctitle.c
@@ -0,0 +1,111 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 defined(__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/avahi-daemon/setproctitle.h b/avahi-daemon/setproctitle.h
new file mode 100644
index 0000000..3499e2e
--- /dev/null
+++ b/avahi-daemon/setproctitle.h
@@ -0,0 +1,28 @@
+#ifndef foosetproctitlehfoo
+#define foosetproctitlehfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/sftp-ssh.service b/avahi-daemon/sftp-ssh.service
new file mode 100644
index 0000000..dfae4f1
--- /dev/null
+++ b/avahi-daemon/sftp-ssh.service
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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">%h</name>
+
+ <service>
+ <type>_sftp-ssh._tcp</type>
+ <port>22</port>
+ </service>
+
+</service-group>
diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c
new file mode 100644
index 0000000..3e0ebb1
--- /dev/null
+++ b/avahi-daemon/simple-protocol.c
@@ -0,0 +1,568 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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"
+#include "sd-daemon.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 remove_socket;
+};
+
+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;
+ int n;
+
+ assert(!server);
+
+ server = avahi_new(Server, 1);
+ server->poll_api = poll_api;
+ server->remove_socket = 0;
+ server->fd = -1;
+ server->n_clients = 0;
+ AVAHI_LLIST_HEAD_INIT(Client, server->clients);
+ server->watch = NULL;
+
+ u = umask(0000);
+
+ if ((n = sd_listen_fds(1)) < 0) {
+ avahi_log_warn("Failed to acquire systemd file descriptors: %s", strerror(-n));
+ goto fail;
+ }
+
+ if (n > 1) {
+ avahi_log_warn("Too many systemd file descriptors passed.");
+ goto fail;
+ }
+
+ if (n == 1) {
+ int r;
+
+ if ((r = sd_is_socket(SD_LISTEN_FDS_START, AF_LOCAL, SOCK_STREAM, 1)) < 0) {
+ avahi_log_warn("Passed systemd file descriptor is of wrong type: %s", strerror(-r));
+ goto fail;
+ }
+
+ server->fd = SD_LISTEN_FDS_START;
+
+ } else {
+
+ if ((server->fd = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0) {
+ avahi_log_warn("socket(AF_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 daemon 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->remove_socket = 1;
+
+ if (listen(server->fd, SOMAXCONN) < 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->remove_socket)
+#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/avahi-daemon/simple-protocol.h b/avahi-daemon/simple-protocol.h
new file mode 100644
index 0000000..bcbffc3
--- /dev/null
+++ b/avahi-daemon/simple-protocol.h
@@ -0,0 +1,29 @@
+#ifndef foosimpleprotocolhfoo
+#define foosimpleprotocolhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/ssh.service b/avahi-daemon/ssh.service
new file mode 100644
index 0000000..c66e0c1
--- /dev/null
+++ b/avahi-daemon/ssh.service
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
+<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it 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">%h</name>
+
+ <service>
+ <type>_ssh._tcp</type>
+ <port>22</port>
+ </service>
+
+</service-group>
diff --git a/avahi-daemon/static-hosts.c b/avahi-daemon/static-hosts.c
new file mode 100644
index 0000000..34f531f
--- /dev/null
+++ b/avahi-daemon/static-hosts.c
@@ -0,0 +1,278 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+ int iteration;
+
+ 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);
+
+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->iteration = current_iteration;
+
+ 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);
+}
+
+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)
+{
+
+ 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(avahi_server_errno(avahi_server)));
+ 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;
+ }
+
+ 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;
+ StaticHost *h, *next;
+ 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;
+ }
+
+ current_iteration++;
+
+ while (!feof(f)) {
+ unsigned int len;
+ char ln[256], *s;
+ char *host, *ip;
+ AvahiAddress a;
+
+ 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);
+ goto fail;
+ }
+
+ /* 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);
+ 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->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);
+}
+
+void static_hosts_free_all (void)
+{
+ while(hosts)
+ static_host_free(hosts);
+}
diff --git a/avahi-daemon/static-hosts.h b/avahi-daemon/static-hosts.h
new file mode 100644
index 0000000..5d63995
--- /dev/null
+++ b/avahi-daemon/static-hosts.h
@@ -0,0 +1,28 @@
+#ifndef foostatichostshfoo
+#define foostatichostshfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-daemon/static-services.c b/avahi-daemon/static-services.c
new file mode 100644
index 0000000..4c3491f
--- /dev/null
+++ b/avahi-daemon/static-services.c
@@ -0,0 +1,744 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <stdlib.h>
+
+#ifdef USE_EXPAT_H
+#include <expat.h>
+#endif /* USE_EXPAT_H */
+
+#ifdef USE_BSDXML_H
+#include <bsdxml.h>
+#endif /* USE_BSDXML_H */
+
+#include <avahi-common/llist.h>
+#include <avahi-common/malloc.h>
+#include <avahi-common/alternative.h>
+#include <avahi-common/error.h>
+#include <avahi-common/domain.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) {
+ char label[AVAHI_LABEL_MAX];
+ const char *p;
+
+ p = avahi_server_get_host_name(avahi_server);
+ avahi_unescape_label(&p, label, sizeof(label));
+
+ g->chosen_name = replacestr(g->name, "%h", label);
+ } 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) {
+#ifdef GLOB_NOSPACE
+ case GLOB_NOSPACE:
+ avahi_log_error("Not enough memory to read service directory "AVAHI_SERVICE_DIR".");
+ break;
+#endif
+#ifdef GLOB_NOMATCH
+ case GLOB_NOMATCH:
+ 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);
+
+ 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/avahi-daemon/static-services.h b/avahi-daemon/static-services.h
new file mode 100644
index 0000000..62edc36
--- /dev/null
+++ b/avahi-daemon/static-services.h
@@ -0,0 +1,28 @@
+#ifndef foostaticserviceshfoo
+#define foostaticserviceshfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-discover-standalone/.gitignore b/avahi-discover-standalone/.gitignore
new file mode 100644
index 0000000..9864451
--- /dev/null
+++ b/avahi-discover-standalone/.gitignore
@@ -0,0 +1,8 @@
+avahi-discover-standalone
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
diff --git a/avahi-discover-standalone/Makefile.am b/avahi-discover-standalone/Makefile.am
new file mode 100644
index 0000000..3995c0a
--- /dev/null
+++ b/avahi-discover-standalone/Makefile.am
@@ -0,0 +1,69 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.ui
+
+# This cool debug trap works on i386/gcc only
+AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
+
+if HAVE_GTK2OR3
+if HAVE_GLIB
+bin_PROGRAMS = \
+ avahi-discover-standalone
+
+avahi_discover_standalone_SOURCES = \
+ main.c
+
+avahi_discover_standalone_CFLAGS = \
+ $(AM_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
+
+if HAVE_GTK3
+avahi_discover_standalone_CFLAGS += \
+ $(GLIB30_CFLAGS) $(GTK30_CFLAGS)
+avahi_discover_standalone_LDADD += \
+ $(GLIB30_LIBS) $(GTK30_LIBS)
+else
+avahi_discover_standalone_CFLAGS += \
+ $(GLIB20_CFLAGS) $(GTK20_CFLAGS)
+avahi_discover_standalone_LDADD += \
+ $(GLIB20_LIBS) $(GTK20_LIBS)
+endif
+
+interfaces_DATA = $(interfaces)
+
+endif # HAVE_GLIB
+else
+
+if HAVE_PYTHON_DBUS
+
+interfaces_DATA =
+
+endif
+endif
+
+EXTRA_DIST = \
+ $(interfaces)
diff --git a/avahi-discover-standalone/avahi-discover.ui b/avahi-discover-standalone/avahi-discover.ui
new file mode 100644
index 0000000..b4b72f9
--- /dev/null
+++ b/avahi-discover-standalone/avahi-discover.ui
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+ <object 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 after="False" handler="gtk_main_quit" name="destroy"/>
+ <child>
+ <object 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>
+ <object 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>
+ <object 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 handler="on_tree_view_cursor_changed" last_modification_time="Sat, 30 Jul 2005 21:39:13 GMT" name="cursor_changed"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object 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>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/avahi-discover-standalone/main.c b/avahi-discover-standalone/main.c
new file mode 100644
index 0000000..2f000a4
--- /dev/null
+++ b/avahi-discover-standalone/main.c
@@ -0,0 +1,368 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <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[]) {
+ GtkBuilder *ui;
+ AvahiServerConfig config;
+ GtkTreeViewColumn *c;
+ gint error;
+ AvahiGLibPoll *poll_api;
+
+ gtk_init(&argc, &argv);
+
+ avahi_set_allocator(avahi_glib_allocator());
+
+ poll_api = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
+
+ ui = gtk_builder_new();
+ gtk_builder_add_from_file(ui, AVAHI_INTERFACES_DIR"avahi-discover.ui", NULL);
+ main_window = GTK_WIDGET(gtk_builder_get_object(ui, "main_window"));
+ g_signal_connect(main_window, "delete-event", (GCallback) main_window_on_delete_event, NULL);
+
+ tree_view = GTK_TREE_VIEW(gtk_builder_get_object(ui, "tree_view"));
+ g_signal_connect(GTK_WIDGET(tree_view), "cursor-changed", (GCallback) tree_view_on_cursor_changed, NULL);
+
+ info_label = GTK_LABEL(gtk_builder_get_object(ui, "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/avahi-dnsconfd/.gitignore b/avahi-dnsconfd/.gitignore
new file mode 100644
index 0000000..2c6d07f
--- /dev/null
+++ b/avahi-dnsconfd/.gitignore
@@ -0,0 +1,2 @@
+avahi-dnsconfd.service
+avahi-dnsconfd
diff --git a/avahi-dnsconfd/Makefile.am b/avahi-dnsconfd/Makefile.am
new file mode 100644
index 0000000..4e74429
--- /dev/null
+++ b/avahi-dnsconfd/Makefile.am
@@ -0,0 +1,53 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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=avahi-dnsconfd.action avahi-dnsconfd.service.in
+
+if HAVE_XML
+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
+
+%.service: %.service.in
+ $(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ avahi-dnsconfd.service
+endif
+
+CLEANFILES = $(systemdsystemunit_DATA)
+
+endif
+endif
diff --git a/avahi-dnsconfd/avahi-dnsconfd.action b/avahi-dnsconfd/avahi-dnsconfd.action
new file mode 100755
index 0000000..f0ace51
--- /dev/null
+++ b/avahi-dnsconfd/avahi-dnsconfd.action
@@ -0,0 +1,80 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/netconfig ]; then
+ # SUSE method on 11.1+
+ if [ -n "$AVAHI_INTERFACE_DNS_SERVERS" ]; then
+ /sbin/netconfig modify -s avahi -i "$AVAHI_INTERFACE" <<-EOF
+ INTERFACE='$AVAHI_INTERFACE'
+ DNSSERVERS='$AVAHI_INTERFACE_DNS_SERVERS'
+ EOF
+ else
+ /sbin/netconfig remove -s avahi -i "$AVAHI_INTERFACE"
+ fi
+elif [ -x /sbin/modify_resolvconf ] ; then
+ # method for SUSE <= 11.0
+ if [ -n "$AVAHI_DNS_SERVERS" ]; then
+ /sbin/modify_resolvconf modify -s avahi -t - -p avahi-dnsconfd -n "$AVAHI_DNS_SERVERS" <<-EOF
+ if you don't like avahi to update your Nameservers
+ disable the avahi-dnsconfd init script
+ EOF
+ else
+ /sbin/modify_resolvconf restore -s avahi
+ fi
+elif [ -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/avahi-dnsconfd/avahi-dnsconfd.service.in b/avahi-dnsconfd/avahi-dnsconfd.service.in
new file mode 100644
index 0000000..95db79f
--- /dev/null
+++ b/avahi-dnsconfd/avahi-dnsconfd.service.in
@@ -0,0 +1,29 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
+
+[Unit]
+Description=Avahi DNS Configuration Daemon
+Requires=avahi-daemon.socket avahi-daemon.service
+After=avahi-daemon.socket
+
+[Service]
+Type=simple
+ExecStart=@sbindir@/avahi-dnsconfd -s
+
+[Install]
+WantedBy=multi-user.target
+Also=avahi-daemon.socket
diff --git a/avahi-dnsconfd/main.c b/avahi-dnsconfd/main.c
new file mode 100644
index 0000000..719fbeb
--- /dev/null
+++ b/avahi-dnsconfd/main.c
@@ -0,0 +1,668 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+static int use_syslog = 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"
+ " -s --syslog Write log messages to syslog(3) instead of STDERR\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' },
+ { "syslog", no_argument, NULL, 's' },
+ { "kill", no_argument, NULL, 'k' },
+ { "version", no_argument, NULL, 'V' },
+ { "refresh", no_argument, NULL, 'r' },
+ { "check", no_argument, NULL, 'c' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ while ((c = getopt_long(argc, argv, "hDkVrcs", long_options, NULL)) >= 0) {
+
+ switch(c) {
+ case 'h':
+ command = DAEMON_HELP;
+ break;
+ case 'D':
+ daemonize = 1;
+ break;
+ case 's':
+ use_syslog = 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:
+ 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 */
+ }
+
+ if (use_syslog || daemonize)
+ daemon_log_use = DAEMON_LOG_SYSLOG;
+
+ 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/avahi-glib.pc.in b/avahi-glib.pc.in
new file mode 100644
index 0000000..f163e89
--- /dev/null
+++ b/avahi-glib.pc.in
@@ -0,0 +1,11 @@
+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/avahi-glib/.gitignore b/avahi-glib/.gitignore
new file mode 100644
index 0000000..02ec7d3
--- /dev/null
+++ b/avahi-glib/.gitignore
@@ -0,0 +1,8 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+glib-watch-test
diff --git a/avahi-glib/Makefile.am b/avahi-glib/Makefile.am
new file mode 100644
index 0000000..b5d5fba
--- /dev/null
+++ b/avahi-glib/Makefile.am
@@ -0,0 +1,53 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+
+avahiglibincludedir=$(includedir)/avahi-glib
+
+avahiglibinclude_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) -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/avahi-glib/glib-malloc.c b/avahi-glib/glib-malloc.c
new file mode 100644
index 0000000..20ac1d1
--- /dev/null
+++ b/avahi-glib/glib-malloc.c
@@ -0,0 +1,55 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-glib/glib-malloc.h b/avahi-glib/glib-malloc.h
new file mode 100644
index 0000000..8b189d2
--- /dev/null
+++ b/avahi-glib/glib-malloc.h
@@ -0,0 +1,39 @@
+#ifndef fooglibmallochfoo
+#define fooglibmallochfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-glib/glib-watch-test.c b/avahi-glib/glib-watch-test.c
new file mode 100644
index 0000000..53c6683
--- /dev/null
+++ b/avahi-glib/glib-watch-test.c
@@ -0,0 +1,89 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-glib/glib-watch.c b/avahi-glib/glib-watch.c
new file mode 100644
index 0000000..5b60bbc
--- /dev/null
+++ b/avahi-glib/glib-watch.c
@@ -0,0 +1,402 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-glib/glib-watch.h b/avahi-glib/glib-watch.h
new file mode 100644
index 0000000..ffc3aac
--- /dev/null
+++ b/avahi-glib/glib-watch.h
@@ -0,0 +1,54 @@
+#ifndef fooglibwatchhfoo
+#define fooglibwatchhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-gobject.pc.in b/avahi-gobject.pc.in
new file mode 100644
index 0000000..bf38200
--- /dev/null
+++ b/avahi-gobject.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=${prefix}/include
+
+Name: avahi-gobject
+Description: Avahi Multicast DNS Responder (GLib GObject Support)
+Version: @PACKAGE_VERSION@
+Requires.private: glib-2.0 gobject-2.0 avahi-glib avahi-client
+Libs: -L${libdir} -lavahi-gobject
+Cflags: -D_REENTRANT -I${includedir}
diff --git a/avahi-gobject/.gitignore b/avahi-gobject/.gitignore
new file mode 100644
index 0000000..402b45c
--- /dev/null
+++ b/avahi-gobject/.gitignore
@@ -0,0 +1,14 @@
+*.typelib
+Avahi-0.6.gir
+ga-*-enumtypes.c
+ga-*-enumtypes.h
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+signals-marshal.c
+signals-marshal.h
+signals-marshal.list
diff --git a/avahi-gobject/AvahiCore-0.6.gir b/avahi-gobject/AvahiCore-0.6.gir
new file mode 100644
index 0000000..5d7f68b
--- /dev/null
+++ b/avahi-gobject/AvahiCore-0.6.gir
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<repository version="1.2"
+ xmlns="http://www.gtk.org/introspection/core/1.0"
+ xmlns:c="http://www.gtk.org/introspection/c/1.0"
+ xmlns:glib="http://www.gtk.org/introspection/glib/1.0">
+ <namespace name="AvahiCore" version="0.6" shared-library="avahi-core">
+ <alias name="IfIndex" c:type="AvahiIfIndex">
+ <type name="gint" c:type="int"/>
+ </alias>
+ <enumeration name="Protocol" c:type="AvahiProtocol">
+ <member name="inet"
+ value="0"
+ c:identifier="AVAHI_PROTO_INET"/>
+ <member name="inet6"
+ value="1"
+ c:identifier="AVAHI_PROTO_INET6"/>
+ <member name="unspec"
+ value="-1"
+ c:identifier="AVAHI_PROTO_UNSPEC"/>
+ </enumeration>
+ <bitfield name="PublishFlags" c:type="AvahiPublishFlags">
+ <member name="unique"
+ value="1"
+ c:identifier="AVAHI_PUBLISH_UNIQUE"/>
+ <member name="no_probe"
+ value="2"
+ c:identifier="AVAHI_PUBLISH_NO_PROBE"/>
+ <member name="no_announce"
+ value="4"
+ c:identifier="AVAHI_PUBLISH_NO_ANNOUNCE"/>
+ <member name="allow_multiple"
+ value="8"
+ c:identifier="AVAHI_PUBLISH_ALLOW_MULTIPLE"/>
+ <member name="no_reverse"
+ value="16"
+ c:identifier="AVAHI_PUBLISH_NO_reverse"/>
+ <member name="no_cookie"
+ value="32"
+ c:identifier="AVAHI_PUBLISH_NO_cookie"/>
+ <member name="update"
+ value="64"
+ c:identifier="AVAHI_PUBLISH_UPDATE"/>
+ <member name="use_wide_area"
+ value="128"
+ c:identifier="AVAHI_PUBLISH_USE_WIDE_AREA"/>
+ <member name="use_multicast"
+ value="256"
+ c:identifier="AVAHI_PUBLISH_USE_MULTICAST"/>
+ </bitfield>
+ <record name="StringList" c:type="AvahiStringList"/>
+ <record name="Address" c:type="AvahiAddress"/>
+ <record name="Client" c:type="AvahiClient"/>
+ <function name="server_get_host_name" c:identifier="avahi_server_get_host_name">
+ <return-value transfer-ownership="none">
+ <type name="utf8" c:type="char8"/>
+ </return-value>
+ <parameters>
+ </parameters>
+ </function>
+ </namespace>
+</repository>
diff --git a/avahi-gobject/Makefile.am b/avahi-gobject/Makefile.am
new file mode 100644
index 0000000..02f2b94
--- /dev/null
+++ b/avahi-gobject/Makefile.am
@@ -0,0 +1,142 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 = \
+ AvahiCore-0.6.gir
+
+if HAVE_GOBJECT
+if HAVE_DBUS
+
+avahigobjectincludedir=$(includedir)/avahi-gobject
+
+avahigobjectinclude_HEADERS = \
+ ga-client.h \
+ ga-entry-group.h \
+ ga-enums.h \
+ ga-error.h \
+ ga-record-browser.h \
+ ga-service-browser.h \
+ ga-service-resolver.h
+
+lib_LTLIBRARIES = \
+ libavahi-gobject.la
+
+BUILT_SOURCES = \
+ signals-marshal.list \
+ signals-marshal.h \
+ signals-marshal.c \
+ ga-client-enumtypes.h \
+ ga-client-enumtypes.c \
+ ga-entry-group-enumtypes.h \
+ ga-entry-group-enumtypes.c \
+ ga-enums-enumtypes.h \
+ ga-enums-enumtypes.c
+
+CORE_SOURCES = \
+ ga-client.c ga-client.h \
+ ga-entry-group.c ga-entry-group.h \
+ ga-enums.h \
+ ga-error.c ga-error.h \
+ ga-record-browser.c ga-record-browser.h \
+ ga-service-browser.c ga-service-browser.h \
+ ga-service-resolver.c ga-service-resolver.h
+
+libavahi_gobject_la_SOURCES = \
+ $(CORE_SOURCES) \
+ $(BUILT_SOURCES)
+
+libavahi_gobject_la_CFLAGS = $(AM_CFLAGS) $(GOBJECT_CFLAGS)
+libavahi_gobject_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la ../avahi-glib/libavahi-glib.la $(GOBJECT_LIBS)
+libavahi_gobject_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_GOBJECT_VERSION_INFO) -export-symbols-regex '^ga_'
+
+# correctly clean the generated source files
+CLEANFILES = $(BUILT_SOURCES)
+
+dist-hook:
+ $(shell for x in $(BUILT_SOURCES); do rm -f $(distdir)/$$x ; done)
+
+signals-marshal.list: $(CORE_SOURCES) Makefile.am
+ $(AM_V_GEN)( cd $(srcdir) && \
+ sed -n -e 's/.*_ga_signals_marshal_\([A-Z]*__[A-Z_]*\).*/\1/p' \
+ $(CORE_SOURCES) ) \
+ | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp && \
+ if cmp -s $@.tmp $@; then \
+ rm $@.tmp; \
+ else \
+ mv $@.tmp $@; \
+ fi
+
+signals-marshal.h: signals-marshal.list
+ $(AM_V_GEN)glib-genmarshal --header --prefix=_ga_signals_marshal $< > $@
+
+signals-marshal.c: signals-marshal.list
+ $(AM_V_GEN)(echo "#include \"signals-marshal.h\"" ; glib-genmarshal --body --prefix=_ga_signals_marshal $< ) > $@
+
+# rules for making the glib enum objects
+%-enumtypes.h: %.h Makefile.in
+ $(AM_V_GEN)glib-mkenums \
+ --fhead "#ifndef __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__\n#define __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+ --fprod "/* enumerations from \"@filename@\" */\n" \
+ --vhead "GType @enum_name@_get_type (void);\n#define $(shell echo $* | tr [:lower:]- [:upper:]_ | sed 's/_.*//')_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
+ --ftail "G_END_DECLS\n\n#endif /* __$(shell echo $* | tr [:lower:]- [:upper:]_)_ENUM_TYPES_H__ */" \
+ $< > $@
+
+%-enumtypes.c: %.h Makefile.in
+ $(AM_V_GEN)glib-mkenums \
+ --fhead "#include <$*.h>\n#include<$*-enumtypes.h>" \
+ --fprod "\n/* enumerations from \"@filename@\" */" \
+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@VALUENAME@\" }," \
+ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
+ $< > $@
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+introspection_sources = $(libavahi_gobject_la_SOURCES)
+
+Avahi-0.6.gir: $(lib_LTLIBRARIES)
+Avahi_0_6_gir_INCLUDES = GObject-2.0 AvahiCore-0.6
+Avahi_0_6_gir_CFLAGS = $(libavahi_gobject_la_CFLAGS)
+Avahi_0_6_gir_LIBS = $(lib_LTLIBRARIES)
+Avahi_0_6_gir_FILES = $(addprefix $(srcdir)/, $(CORE_SOURCES)) $(BUILT_SOURCES)
+Avahi_0_6_gir_SCANNERFLAGS = --strip-prefix=Ga
+INTROSPECTION_GIRS += Avahi-0.6.gir
+INTROSPECTION_INSTALL_GIRS = AvahiCore-0.6.gir $(INTROSPECTION_GIRS)
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_INSTALL_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_INSTALL_GIRS:.gir=.typelib)
+
+CLEANFILES += $(INTROSPECTION_GIRS) $(typelib_DATA)
+endif
+
+endif
+endif
+
+indent:
+ indent -brf -nbbo -nbc -ip0 -cs -nbfde -npsl -br -brs -bap -i4 -bs -cdw -ce -npcs -hnl -cli4 -nut -ci8 ga-*.[ch]
diff --git a/avahi-gobject/ga-client.c b/avahi-gobject/ga-client.c
new file mode 100644
index 0000000..1874bb1
--- /dev/null
+++ b/avahi-gobject/ga-client.c
@@ -0,0 +1,256 @@
+/*
+ * ga-client.c - Source for GaClient
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ga-client.h"
+
+#include "ga-client-enumtypes.h"
+#include "ga-error.h"
+
+/* FIXME what to do about glib-malloc ? */
+#include <avahi-glib/glib-watch.h>
+#include <avahi-glib/glib-malloc.h>
+#include <avahi-common/error.h>
+#include <avahi-common/timeval.h>
+
+G_DEFINE_TYPE(GaClient, ga_client, G_TYPE_OBJECT)
+
+/* signal enum */
+enum {
+ STATE_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+/* properties */
+enum {
+ PROP_STATE = 1,
+ PROP_FLAGS
+};
+
+/* private structure */
+typedef struct _GaClientPrivate GaClientPrivate;
+
+struct _GaClientPrivate {
+ AvahiGLibPoll *poll;
+ GaClientFlags flags;
+ GaClientState state;
+ gboolean dispose_has_run;
+};
+
+#define GA_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GA_TYPE_CLIENT, GaClientPrivate))
+
+static void ga_client_init(GaClient * self) {
+ GaClientPrivate *priv = GA_CLIENT_GET_PRIVATE(self);
+ /* allocate any data required by the object here */
+ self->avahi_client = NULL;
+ priv->state = GA_CLIENT_STATE_NOT_STARTED;
+ priv->flags = GA_CLIENT_FLAG_NO_FLAGS;
+}
+
+static void ga_client_dispose(GObject * object);
+static void ga_client_finalize(GObject * object);
+
+static void ga_client_set_property(GObject * object,
+ guint property_id,
+ const GValue * value, GParamSpec * pspec) {
+ GaClient *client = GA_CLIENT(object);
+ GaClientPrivate *priv = GA_CLIENT_GET_PRIVATE(client);
+
+ switch (property_id) {
+ case PROP_FLAGS:
+ g_assert(client->avahi_client == NULL);
+ priv->flags = g_value_get_enum(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void ga_client_get_property(GObject * object,
+ guint property_id,
+ GValue * value, GParamSpec * pspec) {
+ GaClient *client = GA_CLIENT(object);
+ GaClientPrivate *priv = GA_CLIENT_GET_PRIVATE(client);
+
+ switch (property_id) {
+ case PROP_STATE:
+ g_value_set_enum(value, priv->state);
+ break;
+ case PROP_FLAGS:
+ g_value_set_enum(value, priv->flags);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void ga_client_class_init(GaClientClass * ga_client_class) {
+ GObjectClass *object_class = G_OBJECT_CLASS(ga_client_class);
+ GParamSpec *param_spec;
+
+ g_type_class_add_private(ga_client_class, sizeof (GaClientPrivate));
+
+
+ object_class->dispose = ga_client_dispose;
+ object_class->finalize = ga_client_finalize;
+
+ object_class->set_property = ga_client_set_property;
+ object_class->get_property = ga_client_get_property;
+
+ param_spec = g_param_spec_enum("state", "Client state",
+ "The state of the Avahi client",
+ GA_TYPE_CLIENT_STATE,
+ GA_CLIENT_STATE_NOT_STARTED,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_STATE, param_spec);
+
+ param_spec = g_param_spec_enum("flags", "Client flags",
+ "The flags the Avahi client is started with",
+ GA_TYPE_CLIENT_FLAGS,
+ GA_CLIENT_FLAG_NO_FLAGS,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_FLAGS, param_spec);
+
+ signals[STATE_CHANGED] =
+ g_signal_new("state-changed",
+ G_OBJECT_CLASS_TYPE(ga_client_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1, GA_TYPE_CLIENT_STATE);
+
+}
+
+void ga_client_dispose(GObject * object) {
+ GaClient *self = GA_CLIENT(object);
+ GaClientPrivate *priv = GA_CLIENT_GET_PRIVATE(self);
+
+ if (priv->dispose_has_run)
+ return;
+
+ priv->dispose_has_run = TRUE;
+
+ if (self->avahi_client) {
+ avahi_client_free(self->avahi_client);
+ self->avahi_client = NULL;
+ }
+ if (priv->poll) {
+ avahi_glib_poll_free(priv->poll);
+ priv->poll = NULL;
+ }
+
+ /* release any references held by the object here */
+ if (G_OBJECT_CLASS(ga_client_parent_class)->dispose)
+ G_OBJECT_CLASS(ga_client_parent_class)->dispose(object);
+}
+
+void ga_client_finalize(GObject * object) {
+
+ /* free any data held directly by the object here */
+ G_OBJECT_CLASS(ga_client_parent_class)->finalize(object);
+}
+
+GaClient *ga_client_new(GaClientFlags flags) {
+ return g_object_new(GA_TYPE_CLIENT, "flags", flags, NULL);
+}
+
+static GQuark detail_for_state(AvahiClientState state) {
+ static struct {
+ AvahiClientState state;
+ const gchar *name;
+ GQuark quark;
+ } states[] = {
+ { AVAHI_CLIENT_S_REGISTERING, "registering", 0},
+ { AVAHI_CLIENT_S_RUNNING, "running", 0},
+ { AVAHI_CLIENT_S_COLLISION, "collistion", 0},
+ { AVAHI_CLIENT_FAILURE, "failure", 0},
+ { AVAHI_CLIENT_CONNECTING, "connecting", 0},
+ { 0, NULL, 0}
+ };
+ int i;
+
+ for (i = 0; states[i].name != NULL; i++) {
+ if (state != states[i].state)
+ continue;
+
+ if (!states[i].quark)
+ states[i].quark = g_quark_from_static_string(states[i].name);
+/* printf("Detail: %s\n", states[i].name); */
+ return states[i].quark;
+ }
+ g_assert_not_reached();
+}
+
+static void _avahi_client_cb(AvahiClient * c, AvahiClientState state, void *data) {
+ GaClient *self = GA_CLIENT(data);
+ GaClientPrivate *priv = GA_CLIENT_GET_PRIVATE(self);
+
+/* printf("CLIENT CB: %d\n", state); */
+
+ /* Avahi can call the callback before return from _client_new */
+ if (self->avahi_client == NULL)
+ self->avahi_client = c;
+
+ g_assert(c == self->avahi_client);
+ priv->state = state;
+ g_signal_emit(self, signals[STATE_CHANGED],
+ detail_for_state(state), state);
+}
+
+gboolean ga_client_start(GaClient * client, GError ** error) {
+ GaClientPrivate *priv = GA_CLIENT_GET_PRIVATE(client);
+ AvahiClient *aclient;
+ int aerror;
+
+ g_assert(client->avahi_client == NULL);
+ g_assert(priv->poll == NULL);
+
+ avahi_set_allocator(avahi_glib_allocator());
+
+ priv->poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
+
+ aclient = avahi_client_new(avahi_glib_poll_get(priv->poll),
+ priv->flags,
+ _avahi_client_cb, client, &aerror);
+ if (aclient == NULL) {
+ if (error != NULL) {
+ *error = g_error_new(GA_ERROR, aerror,
+ "Failed to create avahi client: %s",
+ avahi_strerror(aerror));
+ }
+ return FALSE;
+ }
+ client->avahi_client = aclient;
+ return TRUE;
+}
diff --git a/avahi-gobject/ga-client.h b/avahi-gobject/ga-client.h
new file mode 100644
index 0000000..817db3c
--- /dev/null
+++ b/avahi-gobject/ga-client.h
@@ -0,0 +1,78 @@
+/*
+ * ga-client.h - Header for GaClient
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifndef __GA_CLIENT_H__
+#define __GA_CLIENT_H__
+
+#include <glib-object.h>
+#include <avahi-client/client.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ GA_CLIENT_STATE_NOT_STARTED = -1,
+ GA_CLIENT_STATE_S_REGISTERING = AVAHI_CLIENT_S_REGISTERING,
+ GA_CLIENT_STATE_S_RUNNING = AVAHI_CLIENT_S_RUNNING,
+ GA_CLIENT_STATE_S_COLLISION = AVAHI_CLIENT_S_COLLISION,
+ GA_CLIENT_STATE_FAILURE = AVAHI_CLIENT_FAILURE,
+ GA_CLIENT_STATE_CONNECTING = AVAHI_CLIENT_CONNECTING
+} GaClientState;
+
+typedef enum {
+ GA_CLIENT_FLAG_NO_FLAGS = 0,
+ GA_CLIENT_FLAG_IGNORE_USER_CONFIG = AVAHI_CLIENT_IGNORE_USER_CONFIG,
+ GA_CLIENT_FLAG_NO_FAIL = AVAHI_CLIENT_NO_FAIL
+} GaClientFlags;
+
+typedef struct _GaClient GaClient;
+typedef struct _GaClientClass GaClientClass;
+
+struct _GaClientClass {
+ GObjectClass parent_class;
+};
+
+struct _GaClient {
+ GObject parent;
+ /* Raw avahi_client handle, only reuse if you have reffed this instance */
+ AvahiClient *avahi_client;
+};
+
+GType ga_client_get_type(void);
+
+/* TYPE MACROS */
+#define GA_TYPE_CLIENT \
+ (ga_client_get_type())
+#define GA_CLIENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_CLIENT, GaClient))
+#define GA_CLIENT_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_CLIENT, GaClientClass))
+#define IS_GA_CLIENT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_CLIENT))
+#define IS_GA_CLIENT_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_CLIENT))
+#define GA_CLIENT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_CLIENT, GaClientClass))
+
+GaClient *ga_client_new(GaClientFlags flags);
+
+gboolean ga_client_start(GaClient * client, GError ** error);
+
+G_END_DECLS
+
+#endif /* #ifndef __GA_CLIENT_H__ */
diff --git a/avahi-gobject/ga-entry-group.c b/avahi-gobject/ga-entry-group.c
new file mode 100644
index 0000000..101acbf
--- /dev/null
+++ b/avahi-gobject/ga-entry-group.c
@@ -0,0 +1,626 @@
+/*
+ * ga-entry-group.c - Source for GaEntryGroup
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <avahi-common/malloc.h>
+
+#include "ga-error.h"
+#include "ga-entry-group.h"
+#include "ga-entry-group-enumtypes.h"
+
+G_DEFINE_TYPE(GaEntryGroup, ga_entry_group, G_TYPE_OBJECT)
+
+static void _free_service(gpointer data);
+
+/* signal enum */
+enum {
+ STATE_CHANGED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+/* properties */
+enum {
+ PROP_STATE = 1
+};
+
+/* private structures */
+typedef struct _GaEntryGroupPrivate GaEntryGroupPrivate;
+
+struct _GaEntryGroupPrivate {
+ GaEntryGroupState state;
+ GaClient *client;
+ AvahiEntryGroup *group;
+ GHashTable *services;
+ gboolean dispose_has_run;
+};
+
+typedef struct _GaEntryGroupServicePrivate GaEntryGroupServicePrivate;
+
+struct _GaEntryGroupServicePrivate {
+ GaEntryGroupService public;
+ GaEntryGroup *group;
+ gboolean frozen;
+ GHashTable *entries;
+};
+
+typedef struct _GaEntryGroupServiceEntry GaEntryGroupServiceEntry;
+
+struct _GaEntryGroupServiceEntry {
+ guint8 *value;
+ gsize size;
+};
+
+
+#define GA_ENTRY_GROUP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GA_TYPE_ENTRY_GROUP, GaEntryGroupPrivate))
+
+static void ga_entry_group_init(GaEntryGroup * obj) {
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(obj);
+ /* allocate any data required by the object here */
+ priv->state = GA_ENTRY_GROUP_STATE_UNCOMMITED;
+ priv->client = NULL;
+ priv->group = NULL;
+ priv->services = g_hash_table_new_full(g_direct_hash,
+ g_direct_equal,
+ NULL, _free_service);
+}
+
+static void ga_entry_group_dispose(GObject * object);
+static void ga_entry_group_finalize(GObject * object);
+
+static void ga_entry_group_get_property(GObject * object,
+ guint property_id,
+ GValue * value, GParamSpec * pspec) {
+ GaEntryGroup *group = GA_ENTRY_GROUP(object);
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(group);
+
+ switch (property_id) {
+ case PROP_STATE:
+ g_value_set_enum(value, priv->state);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void ga_entry_group_class_init(GaEntryGroupClass * ga_entry_group_class) {
+ GObjectClass *object_class = G_OBJECT_CLASS(ga_entry_group_class);
+ GParamSpec *param_spec;
+
+ g_type_class_add_private(ga_entry_group_class,
+ sizeof (GaEntryGroupPrivate));
+
+ object_class->dispose = ga_entry_group_dispose;
+ object_class->finalize = ga_entry_group_finalize;
+ object_class->get_property = ga_entry_group_get_property;
+
+ param_spec = g_param_spec_enum("state", "Entry Group state",
+ "The state of the avahi entry group",
+ GA_TYPE_ENTRY_GROUP_STATE,
+ GA_ENTRY_GROUP_STATE_UNCOMMITED,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_STATE, param_spec);
+
+ signals[STATE_CHANGED] =
+ g_signal_new("state-changed",
+ G_OBJECT_CLASS_TYPE(ga_entry_group_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__ENUM,
+ G_TYPE_NONE, 1, GA_TYPE_ENTRY_GROUP_STATE);
+}
+
+void ga_entry_group_dispose(GObject * object) {
+ GaEntryGroup *self = GA_ENTRY_GROUP(object);
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(self);
+
+ if (priv->dispose_has_run)
+ return;
+ priv->dispose_has_run = TRUE;
+
+ /* release any references held by the object here */
+ if (priv->group) {
+ avahi_entry_group_free(priv->group);
+ priv->group = NULL;
+ }
+
+ if (priv->client) {
+ g_object_unref(priv->client);
+ priv->client = NULL;
+ }
+
+ if (G_OBJECT_CLASS(ga_entry_group_parent_class)->dispose)
+ G_OBJECT_CLASS(ga_entry_group_parent_class)->dispose(object);
+}
+
+void ga_entry_group_finalize(GObject * object) {
+ GaEntryGroup *self = GA_ENTRY_GROUP(object);
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(self);
+
+ /* free any data held directly by the object here */
+ g_hash_table_destroy(priv->services);
+ priv->services = NULL;
+
+ G_OBJECT_CLASS(ga_entry_group_parent_class)->finalize(object);
+}
+
+static void _free_service(gpointer data) {
+ GaEntryGroupService *s = (GaEntryGroupService *) data;
+ GaEntryGroupServicePrivate *p = (GaEntryGroupServicePrivate *) s;
+ g_free(s->name);
+ g_free(s->type);
+ g_free(s->domain);
+ g_free(s->host);
+ g_hash_table_destroy(p->entries);
+ g_free(s);
+}
+
+static GQuark detail_for_state(AvahiEntryGroupState state) {
+ static struct {
+ AvahiEntryGroupState state;
+ const gchar *name;
+ GQuark quark;
+ } states[] = {
+ { AVAHI_ENTRY_GROUP_UNCOMMITED, "uncommited", 0},
+ { AVAHI_ENTRY_GROUP_REGISTERING, "registering", 0},
+ { AVAHI_ENTRY_GROUP_ESTABLISHED, "established", 0},
+ { AVAHI_ENTRY_GROUP_COLLISION, "collistion", 0},
+ { AVAHI_ENTRY_GROUP_FAILURE, "failure", 0},
+ { 0, NULL, 0}
+ };
+ int i;
+
+ for (i = 0; states[i].name != NULL; i++) {
+ if (state != states[i].state)
+ continue;
+
+ if (!states[i].quark)
+ states[i].quark = g_quark_from_static_string(states[i].name);
+ return states[i].quark;
+ }
+ g_assert_not_reached();
+}
+
+static void _avahi_entry_group_cb(AvahiEntryGroup * g,
+ AvahiEntryGroupState state, void *data) {
+ GaEntryGroup *self = GA_ENTRY_GROUP(data);
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(self);
+
+ /* Avahi can call the callback before return from _client_new */
+ if (priv->group == NULL)
+ priv->group = g;
+
+ g_assert(g == priv->group);
+ priv->state = state;
+ g_signal_emit(self, signals[STATE_CHANGED],
+ detail_for_state(state), state);
+}
+
+GaEntryGroup *ga_entry_group_new(void) {
+ return g_object_new(GA_TYPE_ENTRY_GROUP, NULL);
+}
+
+static guint _entry_hash(gconstpointer v) {
+ const GaEntryGroupServiceEntry *entry =
+ (const GaEntryGroupServiceEntry *) v;
+ guint32 h = 0;
+ guint i;
+
+ for (i = 0; i < entry->size; i++) {
+ h = (h << 5) - h + entry->value[i];
+ }
+
+ return h;
+}
+
+static gboolean _entry_equal(gconstpointer a, gconstpointer b) {
+ const GaEntryGroupServiceEntry *aentry =
+ (const GaEntryGroupServiceEntry *) a;
+ const GaEntryGroupServiceEntry *bentry =
+ (const GaEntryGroupServiceEntry *) b;
+
+ if (aentry->size != bentry->size) {
+ return FALSE;
+ }
+
+ return memcmp(aentry->value, bentry->value, aentry->size) == 0;
+}
+
+static GaEntryGroupServiceEntry *_new_entry(const guint8 * value, gsize size) {
+ GaEntryGroupServiceEntry *entry;
+
+ if (value == NULL) {
+ return NULL;
+ }
+
+ entry = g_slice_new(GaEntryGroupServiceEntry);
+ entry->value = g_malloc(size + 1);
+ memcpy(entry->value, value, size);
+ /* for string keys, make sure it's NUL-terminated too */
+ entry->value[size] = 0;
+ entry->size = size;
+
+ return entry;
+}
+
+static void _set_entry(GHashTable * table, const guint8 * key, gsize ksize,
+ const guint8 * value, gsize vsize) {
+
+ g_hash_table_insert(table, _new_entry(key, ksize),
+ _new_entry(value, vsize));
+}
+
+static void _free_entry(gpointer data) {
+ GaEntryGroupServiceEntry *entry = (GaEntryGroupServiceEntry *) data;
+
+ if (entry == NULL) {
+ return;
+ }
+
+ g_free(entry->value);
+ g_slice_free(GaEntryGroupServiceEntry, entry);
+}
+
+static GHashTable *_string_list_to_hash(AvahiStringList * list) {
+ GHashTable *ret;
+ AvahiStringList *t;
+
+ ret = g_hash_table_new_full(_entry_hash,
+ _entry_equal, _free_entry, _free_entry);
+
+ for (t = list; t != NULL; t = avahi_string_list_get_next(t)) {
+ gchar *key;
+ gchar *value;
+ gsize size;
+ int r;
+
+ /* list_get_pair only fails if if memory allocation fails. Normal glib
+ * behaviour is to assert/abort when that happens */
+ r = avahi_string_list_get_pair(t, &key, &value, &size);
+ g_assert(r == 0);
+
+ if (value == NULL) {
+ _set_entry(ret, t->text, t->size, NULL, 0);
+ } else {
+ _set_entry(ret, (const guint8 *) key, strlen(key),
+ (const guint8 *) value, size);
+ }
+ avahi_free(key);
+ avahi_free(value);
+ }
+ return ret;
+}
+
+static void _hash_to_string_list_foreach(gpointer key, gpointer value, gpointer data) {
+ AvahiStringList **list = (AvahiStringList **) data;
+ GaEntryGroupServiceEntry *kentry = (GaEntryGroupServiceEntry *) key;
+ GaEntryGroupServiceEntry *ventry = (GaEntryGroupServiceEntry *) value;
+
+ if (value != NULL) {
+ *list = avahi_string_list_add_pair_arbitrary(*list,
+ (gchar *) kentry->value,
+ ventry->value,
+ ventry->size);
+ } else {
+ *list = avahi_string_list_add_arbitrary(*list,
+ kentry->value, kentry->size);
+ }
+}
+
+static AvahiStringList *_hash_to_string_list(GHashTable * table) {
+ AvahiStringList *list = NULL;
+ g_hash_table_foreach(table, _hash_to_string_list_foreach,
+ (gpointer) & list);
+ return list;
+}
+
+GaEntryGroupService *ga_entry_group_add_service_strlist(GaEntryGroup * group,
+ const gchar * name,
+ const gchar * type,
+ guint16 port,
+ GError ** error,
+ AvahiStringList *
+ txt) {
+ return ga_entry_group_add_service_full_strlist(group, AVAHI_IF_UNSPEC,
+ AVAHI_PROTO_UNSPEC, 0,
+ name, type, NULL, NULL,
+ port, error, txt);
+}
+
+GaEntryGroupService *ga_entry_group_add_service_full_strlist(GaEntryGroup *
+ group,
+ AvahiIfIndex
+ interface,
+ AvahiProtocol
+ protocol,
+ AvahiPublishFlags
+ flags,
+ const gchar *
+ name,
+ const gchar *
+ type,
+ const gchar *
+ domain,
+ const gchar *
+ host,
+ guint16 port,
+ GError ** error,
+ AvahiStringList *
+ txt) {
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(group);
+ GaEntryGroupServicePrivate *service = NULL;
+ int ret;
+
+ ret = avahi_entry_group_add_service_strlst(priv->group,
+ interface, protocol,
+ flags,
+ name, type,
+ domain, host, port, txt);
+ if (ret) {
+ if (error != NULL) {
+ *error = g_error_new(GA_ERROR, ret,
+ "Adding service to group failed: %s",
+ avahi_strerror(ret));
+ }
+ goto out;
+ }
+
+ service = g_new0(GaEntryGroupServicePrivate, 1);
+ service->public.interface = interface;
+ service->public.protocol = protocol;
+ service->public.flags = flags;
+ service->public.name = g_strdup(name);
+ service->public.type = g_strdup(type);
+ service->public.domain = g_strdup(domain);
+ service->public.host = g_strdup(host);
+ service->public.port = port;
+ service->group = group;
+ service->frozen = FALSE;
+ service->entries = _string_list_to_hash(txt);
+ g_hash_table_insert(priv->services, group, service);
+ out:
+ return (GaEntryGroupService *) service;
+}
+
+GaEntryGroupService *ga_entry_group_add_service(GaEntryGroup * group,
+ const gchar * name,
+ const gchar * type,
+ guint16 port,
+ GError ** error, ...) {
+ GaEntryGroupService *ret;
+ AvahiStringList *txt = NULL;
+ va_list va;
+ va_start(va, error);
+ txt = avahi_string_list_new_va(va);
+
+ ret = ga_entry_group_add_service_full_strlist(group,
+ AVAHI_IF_UNSPEC,
+ AVAHI_PROTO_UNSPEC,
+ 0,
+ name, type,
+ NULL, NULL,
+ port, error, txt);
+ avahi_string_list_free(txt);
+ va_end(va);
+ return ret;
+}
+
+GaEntryGroupService *ga_entry_group_add_service_full(GaEntryGroup * group,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiPublishFlags flags,
+ const gchar * name,
+ const gchar * type,
+ const gchar * domain,
+ const gchar * host,
+ guint16 port,
+ GError ** error, ...) {
+ GaEntryGroupService *ret;
+ AvahiStringList *txt = NULL;
+ va_list va;
+
+ va_start(va, error);
+ txt = avahi_string_list_new_va(va);
+
+ ret = ga_entry_group_add_service_full_strlist(group,
+ interface, protocol,
+ flags,
+ name, type,
+ domain, host,
+ port, error, txt);
+ avahi_string_list_free(txt);
+ va_end(va);
+ return ret;
+}
+
+gboolean ga_entry_group_add_record(GaEntryGroup * group,
+ AvahiPublishFlags flags,
+ const gchar * name,
+ guint16 type,
+ guint32 ttl,
+ const void *rdata, gsize size, GError ** error) {
+ return ga_entry_group_add_record_full(group,
+ AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
+ flags, name, AVAHI_DNS_CLASS_IN,
+ type, ttl, rdata, size, error);
+}
+
+gboolean ga_entry_group_add_record_full(GaEntryGroup * group,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiPublishFlags flags,
+ const gchar * name,
+ guint16 clazz,
+ guint16 type,
+ guint32 ttl,
+ const void *rdata,
+ gsize size, GError ** error) {
+ int ret;
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(group);
+ g_assert(group != NULL && priv->group != NULL);
+
+ ret = avahi_entry_group_add_record(priv->group, interface, protocol,
+ flags, name, clazz, type, ttl, rdata,
+ size);
+ if (ret) {
+ if (error != NULL) {
+ *error = g_error_new(GA_ERROR, ret,
+ "Setting raw record failed: %s",
+ avahi_strerror(ret));
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+void ga_entry_group_service_freeze(GaEntryGroupService * service) {
+ GaEntryGroupServicePrivate *p = (GaEntryGroupServicePrivate *) service;
+ p->frozen = TRUE;
+}
+
+gboolean ga_entry_group_service_thaw(GaEntryGroupService * service, GError ** error) {
+ GaEntryGroupServicePrivate *priv = (GaEntryGroupServicePrivate *) service;
+ int ret;
+ gboolean result = TRUE;
+
+ AvahiStringList *txt = _hash_to_string_list(priv->entries);
+ ret = avahi_entry_group_update_service_txt_strlst
+ (GA_ENTRY_GROUP_GET_PRIVATE(priv->group)->group,
+ service->interface, service->protocol, service->flags,
+ service->name, service->type, service->domain, txt);
+ if (ret) {
+ if (error != NULL) {
+ *error = g_error_new(GA_ERROR, ret,
+ "Updating txt record failed: %s",
+ avahi_strerror(ret));
+ }
+ result = FALSE;
+ }
+
+ avahi_string_list_free(txt);
+ priv->frozen = FALSE;
+ return result;
+}
+
+gboolean ga_entry_group_service_set(GaEntryGroupService * service,
+ const gchar * key, const gchar * value,
+ GError ** error) {
+ return ga_entry_group_service_set_arbitrary(service, key,
+ (const guint8 *) value,
+ strlen(value), error);
+
+}
+
+gboolean ga_entry_group_service_set_arbitrary(GaEntryGroupService * service,
+ const gchar * key, const guint8 * value,
+ gsize size, GError ** error) {
+ GaEntryGroupServicePrivate *priv = (GaEntryGroupServicePrivate *) service;
+
+ _set_entry(priv->entries, (const guint8 *) key, strlen(key), value, size);
+
+ if (!priv->frozen)
+ return ga_entry_group_service_thaw(service, error);
+ else
+ return TRUE;
+}
+
+gboolean ga_entry_group_service_remove_key(GaEntryGroupService * service,
+ const gchar * key, GError ** error) {
+ GaEntryGroupServicePrivate *priv = (GaEntryGroupServicePrivate *) service;
+ GaEntryGroupServiceEntry entry;
+
+ entry.value = (void*) key;
+ entry.size = strlen(key);
+
+ g_hash_table_remove(priv->entries, &entry);
+
+ if (!priv->frozen)
+ return ga_entry_group_service_thaw(service, error);
+ else
+ return TRUE;
+}
+
+
+gboolean ga_entry_group_attach(GaEntryGroup * group,
+ GaClient * client, GError ** error) {
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(group);
+
+ g_return_val_if_fail(client->avahi_client, FALSE);
+ g_assert(priv->client == NULL || priv->client == client);
+ g_assert(priv->group == NULL);
+
+ priv->client = client;
+ g_object_ref(client);
+
+ priv->group = avahi_entry_group_new(client->avahi_client,
+ _avahi_entry_group_cb, group);
+ if (priv->group == NULL) {
+ if (error != NULL) {
+ int aerrno = avahi_client_errno(client->avahi_client);
+ *error = g_error_new(GA_ERROR, aerrno,
+ "Attaching group failed: %s",
+ avahi_strerror(aerrno));
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
+gboolean ga_entry_group_commit(GaEntryGroup * group, GError ** error) {
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(group);
+ int ret;
+ ret = avahi_entry_group_commit(priv->group);
+ if (ret) {
+ if (error != NULL) {
+ *error = g_error_new(GA_ERROR, ret,
+ "Committing group failed: %s",
+ avahi_strerror(ret));
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
+
+gboolean ga_entry_group_reset(GaEntryGroup * group, GError ** error) {
+ GaEntryGroupPrivate *priv = GA_ENTRY_GROUP_GET_PRIVATE(group);
+ int ret;
+ ret = avahi_entry_group_reset(priv->group);
+ if (ret) {
+ if (error != NULL) {
+ *error = g_error_new(GA_ERROR, ret,
+ "Resetting group failed: %s",
+ avahi_strerror(ret));
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/avahi-gobject/ga-entry-group.h b/avahi-gobject/ga-entry-group.h
new file mode 100644
index 0000000..efb6ede
--- /dev/null
+++ b/avahi-gobject/ga-entry-group.h
@@ -0,0 +1,174 @@
+/*
+ * ga-entry-group.h - Header for GaEntryGroup
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifndef __GA_ENTRY_GROUP_H__
+#define __GA_ENTRY_GROUP_H__
+
+#include <glib-object.h>
+#include <avahi-client/publish.h>
+#include <avahi-client/client.h>
+
+#include "ga-client.h"
+
+G_BEGIN_DECLS
+
+typedef enum {
+ GA_ENTRY_GROUP_STATE_UNCOMMITED = AVAHI_ENTRY_GROUP_UNCOMMITED,
+ GA_ENTRY_GROUP_STATE_REGISTERING = AVAHI_ENTRY_GROUP_REGISTERING,
+ GA_ENTRY_GROUP_STATE_ESTABLISHED = AVAHI_ENTRY_GROUP_ESTABLISHED,
+ GA_ENTRY_GROUP_STATE_COLLISTION = AVAHI_ENTRY_GROUP_COLLISION,
+ GA_ENTRY_GROUP_STATE_FAILURE = AVAHI_ENTRY_GROUP_FAILURE
+} GaEntryGroupState;
+
+typedef struct _GaEntryGroupService GaEntryGroupService;
+typedef struct _GaEntryGroup GaEntryGroup;
+typedef struct _GaEntryGroupClass GaEntryGroupClass;
+
+struct _GaEntryGroupService {
+ AvahiIfIndex interface;
+ AvahiProtocol protocol;
+ AvahiPublishFlags flags;
+ gchar *name;
+ gchar *type;
+ gchar *domain;
+ gchar *host;
+ guint16 port;
+};
+
+struct _GaEntryGroupClass {
+ GObjectClass parent_class;
+};
+
+struct _GaEntryGroup {
+ GObject parent;
+};
+
+GType ga_entry_group_get_type(void);
+
+/* TYPE MACROS */
+#define GA_TYPE_ENTRY_GROUP \
+ (ga_entry_group_get_type())
+#define GA_ENTRY_GROUP(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_ENTRY_GROUP, GaEntryGroup))
+#define GA_ENTRY_GROUP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_ENTRY_GROUP, GaEntryGroupClass))
+#define IS_GA_ENTRY_GROUP(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_ENTRY_GROUP))
+#define IS_GA_ENTRY_GROUP_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_ENTRY_GROUP))
+#define GA_ENTRY_GROUP_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_ENTRY_GROUP, GaEntryGroupClass))
+
+GaEntryGroup *ga_entry_group_new(void);
+
+gboolean ga_entry_group_attach(GaEntryGroup * group,
+ GaClient * client, GError ** error);
+
+GaEntryGroupService *ga_entry_group_add_service_strlist(GaEntryGroup * group,
+ const gchar * name,
+ const gchar * type,
+ guint16 port,
+ GError ** error,
+ AvahiStringList *
+ txt);
+
+GaEntryGroupService *ga_entry_group_add_service_full_strlist(GaEntryGroup *
+ group,
+ AvahiIfIndex
+ interface,
+ AvahiProtocol
+ protocol,
+ AvahiPublishFlags
+ flags,
+ const gchar *
+ name,
+ const gchar *
+ type,
+ const gchar *
+ domain,
+ const gchar *
+ host,
+ guint16 port,
+ GError ** error,
+ AvahiStringList *
+ txt);
+GaEntryGroupService *ga_entry_group_add_service(GaEntryGroup * group,
+ const gchar * name,
+ const gchar * type,
+ guint16 port, GError ** error,
+ ...);
+
+GaEntryGroupService *ga_entry_group_add_service_full(GaEntryGroup * group,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiPublishFlags flags,
+ const gchar * name,
+ const gchar * type,
+ const gchar * domain,
+ const gchar * host,
+ guint16 port,
+ GError ** error, ...);
+
+/* Add raw record */
+gboolean ga_entry_group_add_record(GaEntryGroup * group,
+ AvahiPublishFlags flags,
+ const gchar * name,
+ guint16 type,
+ guint32 ttl,
+ const void *rdata, gsize size, GError ** error);
+gboolean ga_entry_group_add_record_full(GaEntryGroup * group,
+ AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ AvahiPublishFlags flags,
+ const gchar * name,
+ guint16 clazz,
+ guint16 type,
+ guint32 ttl,
+ const void *rdata,
+ gsize size, GError ** error);
+
+
+
+void ga_entry_group_service_freeze(GaEntryGroupService * service);
+
+/* Set a key in the service record. If the service isn't frozen it's committed
+ * immediately */
+gboolean ga_entry_group_service_set(GaEntryGroupService * service,
+ const gchar * key, const gchar * value,
+ GError ** error);
+
+gboolean ga_entry_group_service_set_arbitrary(GaEntryGroupService * service,
+ const gchar * key, const guint8 * value,
+ gsize size, GError ** error);
+
+/* Remove one key from the service record */
+gboolean ga_entry_group_service_remove_key(GaEntryGroupService * service,
+ const gchar * key, GError ** error);
+
+/* Update the txt record of the frozen service */
+gboolean ga_entry_group_service_thaw(GaEntryGroupService * service, GError ** error);
+
+/* Commit all newly added services */
+gboolean ga_entry_group_commit(GaEntryGroup * group, GError ** error);
+
+/* Invalidated all GaEntryGroupServices */
+gboolean ga_entry_group_reset(GaEntryGroup * group, GError ** error);
+
+G_END_DECLS
+#endif /* #ifndef __GA_ENTRY_GROUP_H__ */
diff --git a/avahi-gobject/ga-enums.h b/avahi-gobject/ga-enums.h
new file mode 100644
index 0000000..04a8ac3
--- /dev/null
+++ b/avahi-gobject/ga-enums.h
@@ -0,0 +1,70 @@
+/*
+ * ga-enums.h
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifndef __GA_ENUMS_H__
+#define __GA_ENUMS_H__
+
+#include <glib-object.h>
+#include <avahi-common/defs.h>
+#include <avahi-common/address.h>
+
+G_BEGIN_DECLS
+/** Values for GaProtocol */
+ typedef enum {
+ GA_PROTOCOL_INET = AVAHI_PROTO_INET, /**< IPv4 */
+ GA_PROTOCOL_INET6 = AVAHI_PROTO_INET6, /**< IPv6 */
+ GA_PROTOCOL_UNSPEC = AVAHI_PROTO_UNSPEC /**< Unspecified/all protocol(s) */
+} GaProtocol;
+
+
+/** Some flags for lookup callback functions */
+typedef enum {
+ GA_LOOKUP_RESULT_CACHED = AVAHI_LOOKUP_RESULT_CACHED, /**< This response originates from the cache */
+ GA_LOOKUP_RESULT_WIDE_AREA = AVAHI_LOOKUP_RESULT_WIDE_AREA,
+ /**< This response originates from wide area DNS */
+ GA_LOOKUP_RESULT_MULTICAST = AVAHI_LOOKUP_RESULT_MULTICAST,
+ /**< This response originates from multicast DNS */
+ GA_LOOKUP_RESULT_LOCAL = AVAHI_LOOKUP_RESULT_LOCAL, /**< 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. */
+ GA_LOOKUP_RESULT_OUR_OWN = AVAHI_LOOKUP_RESULT_OUR_OWN, /**< 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. */
+ GA_LOOKUP_RESULT_STATIC = AVAHI_LOOKUP_RESULT_STATIC /**< The returned data has been defined statically by some configuration option */
+} GaLookupResultFlags;
+
+typedef enum {
+ GA_LOOKUP_NO_FLAGS = 0,
+ GA_LOOKUP_USE_WIDE_AREA = AVAHI_LOOKUP_USE_WIDE_AREA, /**< Force lookup via wide area DNS */
+ GA_LOOKUP_USE_MULTICAST = AVAHI_LOOKUP_USE_MULTICAST, /**< Force lookup via multicast DNS */
+ GA_LOOKUP_NO_TXT = AVAHI_LOOKUP_NO_TXT, /**< When doing service resolving, don't lookup TXT record */
+ GA_LOOKUP_NO_ADDRESS = AVAHI_LOOKUP_NO_ADDRESS /**< When doing service resolving, don't lookup A/AAAA record */
+} GaLookupFlags;
+
+typedef enum {
+ GA_RESOLVER_FOUND = AVAHI_RESOLVER_FOUND, /**< RR found, resolving successful */
+ GA_RESOLVER_FAILURE = AVAHI_RESOLVER_FAILURE /**< Resolving failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
+} GaResolverEvent;
+
+typedef enum {
+ GA_BROWSER_NEW = AVAHI_BROWSER_NEW, /**< The object is new on the network */
+ GA_BROWSER_REMOVE = AVAHI_BROWSER_REMOVE, /**< The object has been removed from the network */
+ GA_BROWSER_CACHE_EXHAUSTED = AVAHI_BROWSER_CACHE_EXHAUSTED, /**< One-time event, to notify the user that all entries from the caches have been send */
+ GA_BROWSER_ALL_FOR_NOW = 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 */
+ GA_BROWSER_FAILURE = AVAHI_BROWSER_FAILURE /**< Browsing failed due to some reason which can be retrieved using avahi_server_errno()/avahi_client_errno() */
+} GaBrowserEvent;
+
+G_END_DECLS
+#endif /* #ifndef __GA_CLIENT_H__ */
diff --git a/avahi-gobject/ga-error.c b/avahi-gobject/ga-error.c
new file mode 100644
index 0000000..f6ea9ae
--- /dev/null
+++ b/avahi-gobject/ga-error.c
@@ -0,0 +1,32 @@
+/*
+ * ga-error.c - Source for error types used
+ * Copyright (C) 2006 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib.h>
+#include "ga-error.h"
+
+GQuark ga_error_quark(void) {
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_static_string("ga_error");
+ return quark;
+}
diff --git a/avahi-gobject/ga-error.h b/avahi-gobject/ga-error.h
new file mode 100644
index 0000000..5c83ea7
--- /dev/null
+++ b/avahi-gobject/ga-error.h
@@ -0,0 +1,33 @@
+/*
+ * ga-error.h - Header for Avahi error types
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifndef __GA_ERROR_H__
+#define __GA_ERROR_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+#include <avahi-common/error.h>
+
+GQuark ga_error_quark(void);
+
+#define GA_ERROR ga_error_quark()
+
+G_END_DECLS
+#endif /* #ifndef __GA_ERROR_H__ */
diff --git a/avahi-gobject/ga-record-browser.c b/avahi-gobject/ga-record-browser.c
new file mode 100644
index 0000000..f310506
--- /dev/null
+++ b/avahi-gobject/ga-record-browser.c
@@ -0,0 +1,381 @@
+/*
+ * ga-record-browser.c - Source for GaRecordBrowser
+ * Copyright (C) 2007 Collabora Ltd.
+ * @author Sjoerd Simons <sjoerd@luon.net>
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ga-record-browser.h"
+#include "signals-marshal.h"
+#include "ga-error.h"
+#include "ga-enums-enumtypes.h"
+
+G_DEFINE_TYPE(GaRecordBrowser, ga_record_browser, G_TYPE_OBJECT)
+
+/* signal enum */
+enum {
+ NEW,
+ REMOVED,
+ FAILURE,
+ ALL_FOR_NOW,
+ CACHE_EXHAUSTED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+/* properties */
+enum {
+ PROP_PROTOCOL = 1,
+ PROP_IFINDEX,
+ PROP_NAME,
+ PROP_CLASS,
+ PROP_TYPE,
+ PROP_FLAGS
+};
+
+/* private structure */
+typedef struct _GaRecordBrowserPrivate GaRecordBrowserPrivate;
+
+struct _GaRecordBrowserPrivate {
+ gboolean dispose_has_run;
+ GaClient *client;
+ AvahiRecordBrowser *browser;
+ AvahiProtocol protocol;
+ AvahiIfIndex interface;
+ gchar *name;
+ guint16 class;
+ guint16 type;
+ AvahiLookupFlags flags;
+};
+
+#define GA_RECORD_BROWSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GA_TYPE_RECORD_BROWSER, GaRecordBrowserPrivate))
+
+static void ga_record_browser_init(AVAHI_GCC_UNUSED GaRecordBrowser * obj) {
+ /* allocate any data required by the object here */
+}
+
+static void ga_record_browser_dispose(GObject * object);
+static void ga_record_browser_finalize(GObject * object);
+
+static void ga_record_browser_set_property(GObject * object,
+ guint property_id,
+ const GValue * value, GParamSpec * pspec) {
+ GaRecordBrowser *browser = GA_RECORD_BROWSER(object);
+ GaRecordBrowserPrivate *priv = GA_RECORD_BROWSER_GET_PRIVATE(browser);
+
+ g_assert(priv->browser == NULL);
+
+ switch (property_id) {
+ case PROP_PROTOCOL:
+ priv->protocol = g_value_get_enum(value);
+ break;
+ case PROP_IFINDEX:
+ priv->interface = g_value_get_int(value);
+ break;
+ case PROP_NAME:
+ priv->name = g_value_dup_string(value);
+ break;
+ case PROP_CLASS:
+ priv->class = g_value_get_uint(value);
+ break;
+ case PROP_TYPE:
+ priv->type = g_value_get_uint(value);
+ break;
+ case PROP_FLAGS:
+ priv->flags = g_value_get_enum(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void ga_record_browser_get_property(GObject * object,
+ guint property_id,
+ GValue * value, GParamSpec * pspec) {
+ GaRecordBrowser *browser = GA_RECORD_BROWSER(object);
+ GaRecordBrowserPrivate *priv = GA_RECORD_BROWSER_GET_PRIVATE(browser);
+
+ switch (property_id) {
+ case PROP_PROTOCOL:
+ g_value_set_int(value, priv->protocol);
+ break;
+ case PROP_IFINDEX:
+ g_value_set_int(value, priv->interface);
+ break;
+ case PROP_TYPE:
+ g_value_set_uint(value, priv->type);
+ break;
+ case PROP_CLASS:
+ g_value_set_uint(value, priv->class);
+ break;
+ case PROP_NAME:
+ g_value_set_string(value, priv->name);
+ break;
+ case PROP_FLAGS:
+ g_value_set_enum(value, priv->flags);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void ga_record_browser_class_init(GaRecordBrowserClass * ga_record_browser_class) {
+ GObjectClass *object_class = G_OBJECT_CLASS(ga_record_browser_class);
+ GParamSpec *param_spec;
+
+ g_type_class_add_private(ga_record_browser_class,
+ sizeof (GaRecordBrowserPrivate));
+
+ object_class->dispose = ga_record_browser_dispose;
+ object_class->finalize = ga_record_browser_finalize;
+
+ object_class->set_property = ga_record_browser_set_property;
+ object_class->get_property = ga_record_browser_get_property;
+
+ signals[NEW] =
+ g_signal_new("new-record",
+ G_OBJECT_CLASS_TYPE(ga_record_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _ga_signals_marshal_VOID__INT_ENUM_STRING_UINT_UINT_POINTER_INT_INT,
+ G_TYPE_NONE, 8,
+ G_TYPE_INT,
+ GA_TYPE_PROTOCOL,
+ G_TYPE_STRING,
+ G_TYPE_UINT,
+ G_TYPE_UINT,
+ G_TYPE_POINTER,
+ G_TYPE_INT, GA_TYPE_LOOKUP_RESULT_FLAGS);
+
+ signals[REMOVED] =
+ g_signal_new("removed-record",
+ G_OBJECT_CLASS_TYPE(ga_record_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _ga_signals_marshal_VOID__INT_ENUM_STRING_UINT_UINT_POINTER_INT_INT,
+ G_TYPE_NONE, 8,
+ G_TYPE_INT,
+ GA_TYPE_PROTOCOL,
+ G_TYPE_STRING,
+ G_TYPE_UINT,
+ G_TYPE_UINT,
+ G_TYPE_POINTER,
+ G_TYPE_INT, GA_TYPE_LOOKUP_RESULT_FLAGS);
+
+ signals[ALL_FOR_NOW] =
+ g_signal_new("all-for-now",
+ G_OBJECT_CLASS_TYPE(ga_record_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ signals[CACHE_EXHAUSTED] =
+ g_signal_new("cache-exhausted",
+ G_OBJECT_CLASS_TYPE(ga_record_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ signals[FAILURE] =
+ g_signal_new("failure",
+ G_OBJECT_CLASS_TYPE(ga_record_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ param_spec = g_param_spec_enum("protocol", "Avahi protocol to browse",
+ "Avahi protocol to browse",
+ GA_TYPE_PROTOCOL,
+ GA_PROTOCOL_UNSPEC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_PROTOCOL, param_spec);
+
+ param_spec = g_param_spec_int("interface", "interface index",
+ "Interface use for browser",
+ AVAHI_IF_UNSPEC,
+ G_MAXINT,
+ AVAHI_IF_UNSPEC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_IFINDEX, param_spec);
+
+ param_spec = g_param_spec_string("name", "record name",
+ "Record name to browse for",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_NAME, param_spec);
+
+ param_spec = g_param_spec_uint("type", "record type",
+ "Record type to browse for",
+ 0, G_MAXUINT16, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_TYPE, param_spec);
+
+ param_spec = g_param_spec_uint("class", "record class",
+ "Record class to browse for",
+ 0, G_MAXUINT16, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_CLASS, param_spec);
+
+ param_spec = g_param_spec_enum("flags", "Lookup flags for the browser",
+ "Browser lookup flags",
+ GA_TYPE_LOOKUP_FLAGS,
+ GA_LOOKUP_NO_FLAGS,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_FLAGS, param_spec);
+}
+
+void ga_record_browser_dispose(GObject * object) {
+ GaRecordBrowser *self = GA_RECORD_BROWSER(object);
+ GaRecordBrowserPrivate *priv = GA_RECORD_BROWSER_GET_PRIVATE(self);
+
+ if (priv->dispose_has_run)
+ return;
+
+ priv->dispose_has_run = TRUE;
+
+ /* release any references held by the object here */
+ if (priv->client)
+ g_object_unref(priv->client);
+ priv->client = NULL;
+
+ if (priv->browser)
+ avahi_record_browser_free(priv->browser);
+ priv->browser = NULL;
+
+ if (G_OBJECT_CLASS(ga_record_browser_parent_class)->dispose)
+ G_OBJECT_CLASS(ga_record_browser_parent_class)->dispose(object);
+}
+
+void ga_record_browser_finalize(GObject * object) {
+ GaRecordBrowser *self = GA_RECORD_BROWSER(object);
+ GaRecordBrowserPrivate *priv = GA_RECORD_BROWSER_GET_PRIVATE(self);
+
+ /* free any data held directly by the object here */
+ g_free(priv->name);
+
+ G_OBJECT_CLASS(ga_record_browser_parent_class)->finalize(object);
+}
+
+
+GaRecordBrowser *ga_record_browser_new(const gchar * name, guint16 type) {
+ return ga_record_browser_new_full(AVAHI_IF_UNSPEC,
+ AVAHI_PROTO_UNSPEC, name,
+ AVAHI_DNS_CLASS_IN, type, 0);
+}
+
+GaRecordBrowser *ga_record_browser_new_full(AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ const gchar * name,
+ guint16 clazz,
+ guint16 type,
+ GaLookupFlags flags) {
+ return g_object_new(GA_TYPE_RECORD_BROWSER,
+ "interface", interface,
+ "protocol", protocol,
+ "name", name,
+ "class", clazz, "type", type, "flags", flags, NULL);
+
+}
+
+static void _avahi_record_browser_cb(AVAHI_GCC_UNUSED AvahiRecordBrowser * r, AvahiIfIndex interface,
+ AvahiProtocol protocol, AvahiBrowserEvent event,
+ const char *name, uint16_t clazz, uint16_t type,
+ const void *rdata, size_t rdata_size,
+ AvahiLookupResultFlags flags, void *userdata) {
+ GaRecordBrowser *self = GA_RECORD_BROWSER(userdata);
+ GaRecordBrowserPrivate *priv = GA_RECORD_BROWSER_GET_PRIVATE(userdata);
+
+ switch (event) {
+ case AVAHI_BROWSER_NEW:
+ case AVAHI_BROWSER_REMOVE:{
+ guint signalid = (event == AVAHI_BROWSER_NEW ? NEW : REMOVED);
+ g_signal_emit(self, signals[signalid], 0,
+ interface, protocol, name, clazz, type,
+ rdata, rdata_size, flags);
+ break;
+ }
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ g_signal_emit(self, signals[CACHE_EXHAUSTED], 0);
+ break;
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ g_signal_emit(self, signals[ALL_FOR_NOW], 0);
+ break;
+ case AVAHI_BROWSER_FAILURE:{
+ GError *error;
+ int aerrno = avahi_client_errno(priv->client->avahi_client);
+ error = g_error_new(GA_ERROR, aerrno,
+ "Browsing failed: %s",
+ avahi_strerror(aerrno));
+ g_signal_emit(self, signals[FAILURE], 0, error);
+ g_error_free(error);
+ break;
+ }
+ }
+}
+
+gboolean ga_record_browser_attach(GaRecordBrowser * browser,
+ GaClient * client, GError ** error) {
+ GaRecordBrowserPrivate *priv = GA_RECORD_BROWSER_GET_PRIVATE(browser);
+
+ priv->client = g_object_ref(client);
+ priv->browser = avahi_record_browser_new(client->avahi_client,
+ priv->interface,
+ priv->protocol,
+ priv->name,
+ priv->class,
+ priv->type,
+ priv->flags,
+ _avahi_record_browser_cb,
+ browser);
+ if (priv->browser == NULL) {
+ if (error != NULL) {
+ int aerrno = avahi_client_errno(client->avahi_client);
+ *error = g_error_new(GA_ERROR, aerrno,
+ "Attaching record browser failed: %s",
+ avahi_strerror(aerrno));
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/avahi-gobject/ga-record-browser.h b/avahi-gobject/ga-record-browser.h
new file mode 100644
index 0000000..c27c061
--- /dev/null
+++ b/avahi-gobject/ga-record-browser.h
@@ -0,0 +1,74 @@
+/*
+ * ga-record-browser.h - Header for GaRecordBrowser
+ * Copyright (C) 2007 Collabora Ltd.
+ * @author Sjoerd Simons <sjoerd@luon.net>
+ *
+ * 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
+ */
+
+#ifndef __GA_RECORD_BROWSER_H__
+#define __GA_RECORD_BROWSER_H__
+
+#include <glib-object.h>
+#include <avahi-client/lookup.h>
+#include <avahi-common/defs.h>
+#include "ga-client.h"
+#include "ga-enums.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GaRecordBrowser GaRecordBrowser;
+typedef struct _GaRecordBrowserClass GaRecordBrowserClass;
+
+struct _GaRecordBrowserClass {
+ GObjectClass parent_class;
+};
+
+struct _GaRecordBrowser {
+ GObject parent;
+};
+
+GType ga_record_browser_get_type(void);
+
+/* TYPE MACROS */
+#define GA_TYPE_RECORD_BROWSER \
+ (ga_record_browser_get_type())
+#define GA_RECORD_BROWSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_RECORD_BROWSER, GaRecordBrowser))
+#define GA_RECORD_BROWSER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_RECORD_BROWSER, GaRecordBrowserClass))
+#define IS_GA_RECORD_BROWSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_RECORD_BROWSER))
+#define IS_GA_RECORD_BROWSER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_RECORD_BROWSER))
+#define GA_RECORD_BROWSER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_RECORD_BROWSER, GaRecordBrowserClass))
+
+GaRecordBrowser *ga_record_browser_new(const gchar * name, guint16 type);
+
+GaRecordBrowser *ga_record_browser_new_full(AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ const gchar * name,
+ guint16 clazz,
+ guint16 type,
+ GaLookupFlags flags);
+
+gboolean
+ga_record_browser_attach(GaRecordBrowser * browser,
+ GaClient * client, GError ** error);
+
+
+G_END_DECLS
+#endif /* #ifndef __GA_RECORD_BROWSER_H__ */
diff --git a/avahi-gobject/ga-service-browser.c b/avahi-gobject/ga-service-browser.c
new file mode 100644
index 0000000..3c3b80e
--- /dev/null
+++ b/avahi-gobject/ga-service-browser.c
@@ -0,0 +1,372 @@
+/*
+ * ga-service-browser.c - Source for GaServiceBrowser
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <avahi-client/client.h>
+#include <avahi-client/lookup.h>
+#include <avahi-common/error.h>
+
+#include "ga-service-browser.h"
+#include "signals-marshal.h"
+#include "ga-error.h"
+#include "ga-enums-enumtypes.h"
+
+G_DEFINE_TYPE(GaServiceBrowser, ga_service_browser, G_TYPE_OBJECT)
+
+/* signal enum */
+enum {
+ NEW,
+ REMOVED,
+ CACHE_EXHAUSTED,
+ ALL_FOR_NOW,
+ FAILURE,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+/* properties */
+enum {
+ PROP_PROTOCOL = 1,
+ PROP_IFINDEX,
+ PROP_TYPE,
+ PROP_DOMAIN,
+ PROP_FLAGS
+};
+
+/* private structure */
+typedef struct _GaServiceBrowserPrivate GaServiceBrowserPrivate;
+
+struct _GaServiceBrowserPrivate {
+ GaClient *client;
+ AvahiServiceBrowser *browser;
+ AvahiIfIndex interface;
+ AvahiProtocol protocol;
+ char *type;
+ char *domain;
+ AvahiLookupFlags flags;
+ gboolean dispose_has_run;
+};
+
+#define GA_SERVICE_BROWSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GA_TYPE_SERVICE_BROWSER, GaServiceBrowserPrivate))
+
+static void ga_service_browser_init(GaServiceBrowser * obj) {
+ GaServiceBrowserPrivate *priv = GA_SERVICE_BROWSER_GET_PRIVATE(obj);
+
+ /* allocate any data required by the object here */
+ priv->client = NULL;
+ priv->browser = NULL;
+ priv->type = NULL;
+ priv->domain = NULL;
+
+}
+
+static void ga_service_browser_dispose(GObject * object);
+static void ga_service_browser_finalize(GObject * object);
+
+static void ga_service_browser_set_property(GObject * object,
+ guint property_id,
+ const GValue * value, GParamSpec * pspec) {
+ GaServiceBrowser *browser = GA_SERVICE_BROWSER(object);
+ GaServiceBrowserPrivate *priv = GA_SERVICE_BROWSER_GET_PRIVATE(browser);
+
+ g_assert(priv->browser == NULL);
+ switch (property_id) {
+ case PROP_PROTOCOL:
+ priv->protocol = g_value_get_enum(value);
+ break;
+ case PROP_IFINDEX:
+ priv->interface = g_value_get_int(value);
+ break;
+ case PROP_TYPE:
+ priv->type = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_DOMAIN:
+ priv->domain = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_FLAGS:
+ priv->flags = g_value_get_enum(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void ga_service_browser_get_property(GObject * object,
+ guint property_id,
+ GValue * value, GParamSpec * pspec) {
+ GaServiceBrowser *browser = GA_SERVICE_BROWSER(object);
+ GaServiceBrowserPrivate *priv = GA_SERVICE_BROWSER_GET_PRIVATE(browser);
+
+ switch (property_id) {
+ case PROP_PROTOCOL:
+ g_value_set_int(value, priv->protocol);
+ break;
+ case PROP_IFINDEX:
+ g_value_set_int(value, priv->interface);
+ break;
+ case PROP_TYPE:
+ g_value_set_string(value, priv->type);
+ break;
+ case PROP_DOMAIN:
+ g_value_set_string(value, priv->domain);
+ break;
+ case PROP_FLAGS:
+ g_value_set_enum(value, priv->flags);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void ga_service_browser_class_init(GaServiceBrowserClass *
+ ga_service_browser_class) {
+ GObjectClass *object_class = G_OBJECT_CLASS(ga_service_browser_class);
+ GParamSpec *param_spec;
+
+ g_type_class_add_private(ga_service_browser_class,
+ sizeof (GaServiceBrowserPrivate));
+
+ object_class->dispose = ga_service_browser_dispose;
+ object_class->finalize = ga_service_browser_finalize;
+
+ object_class->set_property = ga_service_browser_set_property;
+ object_class->get_property = ga_service_browser_get_property;
+
+ signals[NEW] =
+ g_signal_new("new-service",
+ G_OBJECT_CLASS_TYPE(ga_service_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _ga_signals_marshal_VOID__INT_ENUM_STRING_STRING_STRING_UINT,
+ G_TYPE_NONE, 6,
+ G_TYPE_INT,
+ GA_TYPE_PROTOCOL,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING, GA_TYPE_LOOKUP_RESULT_FLAGS);
+
+ signals[REMOVED] =
+ g_signal_new("removed-service",
+ G_OBJECT_CLASS_TYPE(ga_service_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _ga_signals_marshal_VOID__INT_ENUM_STRING_STRING_STRING_UINT,
+ G_TYPE_NONE, 6,
+ G_TYPE_INT,
+ GA_TYPE_PROTOCOL,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING, GA_TYPE_LOOKUP_RESULT_FLAGS);
+
+ signals[ALL_FOR_NOW] =
+ g_signal_new("all-for-now",
+ G_OBJECT_CLASS_TYPE(ga_service_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ signals[CACHE_EXHAUSTED] =
+ g_signal_new("cache-exhausted",
+ G_OBJECT_CLASS_TYPE(ga_service_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ signals[FAILURE] =
+ g_signal_new("failure",
+ G_OBJECT_CLASS_TYPE(ga_service_browser_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ param_spec = g_param_spec_enum("protocol", "Avahi protocol to browse",
+ "Avahi protocol to browse",
+ GA_TYPE_PROTOCOL,
+ GA_PROTOCOL_UNSPEC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_PROTOCOL, param_spec);
+
+ param_spec = g_param_spec_int("interface", "interface index",
+ "Interface use for browser",
+ AVAHI_IF_UNSPEC,
+ G_MAXINT,
+ AVAHI_IF_UNSPEC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_IFINDEX, param_spec);
+
+ param_spec = g_param_spec_string("type", "service type",
+ "Service type to browse for",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_TYPE, param_spec);
+
+ param_spec = g_param_spec_string("domain", "service domain",
+ "Domain to browse in",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_DOMAIN, param_spec);
+
+ param_spec = g_param_spec_enum("flags", "Lookup flags for the browser",
+ "Browser lookup flags",
+ GA_TYPE_LOOKUP_FLAGS,
+ GA_LOOKUP_NO_FLAGS,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_FLAGS, param_spec);
+}
+
+void ga_service_browser_dispose(GObject * object) {
+ GaServiceBrowser *self = GA_SERVICE_BROWSER(object);
+ GaServiceBrowserPrivate *priv = GA_SERVICE_BROWSER_GET_PRIVATE(self);
+
+ if (priv->dispose_has_run)
+ return;
+
+ priv->dispose_has_run = TRUE;
+
+ if (priv->browser)
+ avahi_service_browser_free(priv->browser);
+ priv->browser = NULL;
+ if (priv->client)
+ g_object_unref(priv->client);
+ priv->client = NULL;
+
+ /* release any references held by the object here */
+
+ if (G_OBJECT_CLASS(ga_service_browser_parent_class)->dispose)
+ G_OBJECT_CLASS(ga_service_browser_parent_class)->dispose(object);
+}
+
+void ga_service_browser_finalize(GObject * object) {
+ GaServiceBrowser *self = GA_SERVICE_BROWSER(object);
+ GaServiceBrowserPrivate *priv = GA_SERVICE_BROWSER_GET_PRIVATE(self);
+
+ /* free any data held directly by the object here */
+ g_free(priv->type);
+ priv->type = NULL;
+ g_free(priv->domain);
+ priv->domain = NULL;
+
+ G_OBJECT_CLASS(ga_service_browser_parent_class)->finalize(object);
+}
+
+static void _avahi_service_browser_cb(AvahiServiceBrowser * b, AvahiIfIndex interface,
+ AvahiProtocol protocol, AvahiBrowserEvent event,
+ const char *name, const char *type,
+ const char *domain, AvahiLookupResultFlags flags,
+ void *userdata) {
+ GaServiceBrowser *self = GA_SERVICE_BROWSER(userdata);
+ GaServiceBrowserPrivate *priv = GA_SERVICE_BROWSER_GET_PRIVATE(self);
+ if (priv->browser == NULL) {
+ priv->browser = b;
+ }
+ g_assert(priv->browser == b);
+
+ switch (event) {
+ case AVAHI_BROWSER_NEW:
+ case AVAHI_BROWSER_REMOVE:{
+ guint signalid;
+ signalid = (event == AVAHI_BROWSER_NEW ? NEW : REMOVED);
+ g_signal_emit(self, signals[signalid], 0,
+ interface, protocol, name, type, domain, flags);
+ break;
+ }
+ case AVAHI_BROWSER_CACHE_EXHAUSTED:
+ g_signal_emit(self, signals[CACHE_EXHAUSTED], 0);
+ break;
+ case AVAHI_BROWSER_ALL_FOR_NOW:
+ g_signal_emit(self, signals[ALL_FOR_NOW], 0);
+ break;
+ case AVAHI_BROWSER_FAILURE:{
+ GError *error;
+ int aerrno = avahi_client_errno(priv->client->avahi_client);
+ error = g_error_new(GA_ERROR, aerrno,
+ "Browsing failed: %s",
+ avahi_strerror(aerrno));
+ g_signal_emit(self, signals[FAILURE], 0, error);
+ g_error_free(error);
+ break;
+ }
+ }
+}
+
+GaServiceBrowser *ga_service_browser_new(const gchar * type) {
+ return ga_service_browser_new_full(AVAHI_IF_UNSPEC,
+ AVAHI_PROTO_UNSPEC, type, NULL, 0);
+}
+
+GaServiceBrowser *ga_service_browser_new_full(AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ const gchar * type, gchar * domain,
+ GaLookupFlags flags) {
+ return g_object_new(GA_TYPE_SERVICE_BROWSER,
+ "interface", interface,
+ "protocol", protocol,
+ "type", type, "domain", domain, "flags", flags, NULL);
+}
+
+gboolean ga_service_browser_attach(GaServiceBrowser * browser,
+ GaClient * client, GError ** error) {
+ GaServiceBrowserPrivate *priv = GA_SERVICE_BROWSER_GET_PRIVATE(browser);
+
+ g_object_ref(client);
+ priv->client = client;
+
+ priv->browser = avahi_service_browser_new(client->avahi_client,
+ priv->interface,
+ priv->protocol,
+ priv->type, priv->domain,
+ priv->flags,
+ _avahi_service_browser_cb,
+ browser);
+ if (priv->browser == NULL) {
+ if (error != NULL) {
+ int aerrno = avahi_client_errno(client->avahi_client);
+ *error = g_error_new(GA_ERROR, aerrno,
+ "Attaching group failed: %s",
+ avahi_strerror(aerrno));
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/avahi-gobject/ga-service-browser.h b/avahi-gobject/ga-service-browser.h
new file mode 100644
index 0000000..eaead4b
--- /dev/null
+++ b/avahi-gobject/ga-service-browser.h
@@ -0,0 +1,71 @@
+/*
+ * ga-service-browser.h - Header for GaServiceBrowser
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifndef __GA_SERVICE_BROWSER_H__
+#define __GA_SERVICE_BROWSER_H__
+
+#include <glib-object.h>
+#include <avahi-client/lookup.h>
+#include <avahi-common/defs.h>
+#include "ga-client.h"
+#include "ga-enums.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GaServiceBrowser GaServiceBrowser;
+typedef struct _GaServiceBrowserClass GaServiceBrowserClass;
+
+struct _GaServiceBrowserClass {
+ GObjectClass parent_class;
+};
+
+struct _GaServiceBrowser {
+ GObject parent;
+};
+
+GType ga_service_browser_get_type(void);
+
+/* TYPE MACROS */
+#define GA_TYPE_SERVICE_BROWSER \
+ (ga_service_browser_get_type())
+#define GA_SERVICE_BROWSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_SERVICE_BROWSER, GaServiceBrowser))
+#define GA_SERVICE_BROWSER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_SERVICE_BROWSER, GaServiceBrowserClass))
+#define IS_GA_SERVICE_BROWSER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_SERVICE_BROWSER))
+#define IS_GA_SERVICE_BROWSER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_SERVICE_BROWSER))
+#define GA_SERVICE_BROWSER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_SERVICE_BROWSER, GaServiceBrowserClass))
+
+GaServiceBrowser *ga_service_browser_new(const gchar * type);
+
+GaServiceBrowser *ga_service_browser_new_full(AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ const gchar * type, gchar * domain,
+ GaLookupFlags flags);
+
+gboolean
+ga_service_browser_attach(GaServiceBrowser * browser,
+ GaClient * client, GError ** error);
+
+
+G_END_DECLS
+#endif /* #ifndef __GA_SERVICE_BROWSER_H__ */
diff --git a/avahi-gobject/ga-service-resolver.c b/avahi-gobject/ga-service-resolver.c
new file mode 100644
index 0000000..d3cfaa0
--- /dev/null
+++ b/avahi-gobject/ga-service-resolver.c
@@ -0,0 +1,403 @@
+/*
+ * ga-service-resolver.c - Source for GaServiceResolver
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ga-service-resolver.h"
+#include "signals-marshal.h"
+
+#include "ga-error.h"
+
+#include "ga-enums.h"
+#include "ga-enums-enumtypes.h"
+
+#include <avahi-client/lookup.h>
+
+G_DEFINE_TYPE(GaServiceResolver, ga_service_resolver, G_TYPE_OBJECT)
+
+/* signal enum */
+enum {
+ FOUND,
+ FAILURE,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+/* properties */
+enum {
+ PROP_PROTOCOL = 1,
+ PROP_IFINDEX,
+ PROP_NAME,
+ PROP_TYPE,
+ PROP_DOMAIN,
+ PROP_FLAGS,
+ PROP_APROTOCOL
+};
+
+/* private structure */
+typedef struct _GaServiceResolverPrivate GaServiceResolverPrivate;
+
+struct _GaServiceResolverPrivate {
+ GaClient *client;
+ AvahiServiceResolver *resolver;
+ AvahiIfIndex interface;
+ AvahiProtocol protocol;
+ AvahiAddress address;
+ uint16_t port;
+ char *name;
+ char *type;
+ char *domain;
+ AvahiProtocol aprotocol;
+ AvahiLookupFlags flags;
+ gboolean dispose_has_run;
+};
+
+#define GA_SERVICE_RESOLVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GA_TYPE_SERVICE_RESOLVER, GaServiceResolverPrivate))
+
+static void ga_service_resolver_init(GaServiceResolver * obj) {
+ GaServiceResolverPrivate *priv = GA_SERVICE_RESOLVER_GET_PRIVATE(obj);
+
+ /* allocate any data required by the object here */
+ priv->client = NULL;
+ priv->resolver = NULL;
+ priv->name = NULL;
+ priv->type = NULL;
+ priv->domain = NULL;
+ priv->port = 0;
+}
+
+static void ga_service_resolver_dispose(GObject * object);
+static void ga_service_resolver_finalize(GObject * object);
+
+static void ga_service_resolver_set_property(GObject * object,
+ guint property_id,
+ const GValue * value, GParamSpec * pspec) {
+ GaServiceResolver *resolver = GA_SERVICE_RESOLVER(object);
+ GaServiceResolverPrivate *priv =
+ GA_SERVICE_RESOLVER_GET_PRIVATE(resolver);
+
+ g_assert(priv->resolver == NULL);
+ switch (property_id) {
+ case PROP_PROTOCOL:
+ priv->protocol = g_value_get_enum(value);
+ break;
+ case PROP_APROTOCOL:
+ priv->aprotocol = g_value_get_enum(value);
+ break;
+ case PROP_IFINDEX:
+ priv->interface = g_value_get_int(value);
+ break;
+ case PROP_NAME:
+ priv->name = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_TYPE:
+ priv->type = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_DOMAIN:
+ priv->domain = g_strdup(g_value_get_string(value));
+ break;
+ case PROP_FLAGS:
+ priv->flags = g_value_get_enum(value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+static void ga_service_resolver_get_property(GObject * object,
+ guint property_id,
+ GValue * value, GParamSpec * pspec) {
+ GaServiceResolver *resolver = GA_SERVICE_RESOLVER(object);
+ GaServiceResolverPrivate *priv =
+ GA_SERVICE_RESOLVER_GET_PRIVATE(resolver);
+
+ switch (property_id) {
+ case PROP_APROTOCOL:
+ g_value_set_enum(value, priv->aprotocol);
+ break;
+ case PROP_PROTOCOL:
+ g_value_set_enum(value, priv->protocol);
+ break;
+ case PROP_IFINDEX:
+ g_value_set_int(value, priv->interface);
+ break;
+ case PROP_NAME:
+ g_value_set_string(value, priv->name);
+ break;
+ case PROP_TYPE:
+ g_value_set_string(value, priv->type);
+ break;
+ case PROP_DOMAIN:
+ g_value_set_string(value, priv->domain);
+ break;
+ case PROP_FLAGS:
+ g_value_set_enum(value, priv->flags);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void ga_service_resolver_class_init(GaServiceResolverClass *
+ ga_service_resolver_class) {
+ GObjectClass *object_class = G_OBJECT_CLASS(ga_service_resolver_class);
+ GParamSpec *param_spec;
+
+ g_type_class_add_private(ga_service_resolver_class,
+ sizeof (GaServiceResolverPrivate));
+
+ object_class->set_property = ga_service_resolver_set_property;
+ object_class->get_property = ga_service_resolver_get_property;
+
+ object_class->dispose = ga_service_resolver_dispose;
+ object_class->finalize = ga_service_resolver_finalize;
+
+ signals[FOUND] =
+ g_signal_new("found",
+ G_OBJECT_CLASS_TYPE(ga_service_resolver_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _ga_signals_marshal_VOID__INT_ENUM_STRING_STRING_STRING_STRING_POINTER_INT_POINTER_INT,
+ G_TYPE_NONE, 10,
+ G_TYPE_INT,
+ GA_TYPE_PROTOCOL,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_POINTER,
+ G_TYPE_INT,
+ G_TYPE_POINTER, GA_TYPE_LOOKUP_RESULT_FLAGS);
+
+ signals[FAILURE] =
+ g_signal_new("failure",
+ G_OBJECT_CLASS_TYPE(ga_service_resolver_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ param_spec = g_param_spec_enum("protocol", "Avahi protocol to resolve on",
+ "Avahi protocol to resolve on",
+ GA_TYPE_PROTOCOL,
+ GA_PROTOCOL_UNSPEC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_PROTOCOL, param_spec);
+
+ param_spec = g_param_spec_enum("aprotocol", "Address protocol",
+ "Avahi protocol of the address to be resolved",
+ GA_TYPE_PROTOCOL,
+ GA_PROTOCOL_UNSPEC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_APROTOCOL, param_spec);
+
+ param_spec = g_param_spec_int("interface", "interface index",
+ "Interface use for resolver",
+ AVAHI_IF_UNSPEC,
+ G_MAXINT,
+ AVAHI_IF_UNSPEC,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_IFINDEX, param_spec);
+
+ param_spec = g_param_spec_string("name", "service name",
+ "name to resolve",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_NAME, param_spec);
+
+ param_spec = g_param_spec_string("type", "service type",
+ "Service type to browse for",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_TYPE, param_spec);
+
+ param_spec = g_param_spec_string("domain", "service domain",
+ "Domain to browse in",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_DOMAIN, param_spec);
+
+ param_spec = g_param_spec_enum("flags", "Lookup flags for the resolver",
+ "Resolver lookup flags",
+ GA_TYPE_LOOKUP_FLAGS,
+ GA_LOOKUP_NO_FLAGS,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_BLURB);
+ g_object_class_install_property(object_class, PROP_FLAGS, param_spec);
+}
+
+void ga_service_resolver_dispose(GObject * object) {
+ GaServiceResolver *self = GA_SERVICE_RESOLVER(object);
+ GaServiceResolverPrivate *priv = GA_SERVICE_RESOLVER_GET_PRIVATE(self);
+
+ if (priv->dispose_has_run)
+ return;
+
+ priv->dispose_has_run = TRUE;
+
+ if (priv->client)
+ g_object_unref(priv->client);
+ priv->client = NULL;
+
+ if (priv->resolver)
+ avahi_service_resolver_free(priv->resolver);
+ priv->resolver = NULL;
+
+ /* release any references held by the object here */
+
+ if (G_OBJECT_CLASS(ga_service_resolver_parent_class)->dispose)
+ G_OBJECT_CLASS(ga_service_resolver_parent_class)->dispose(object);
+}
+
+void ga_service_resolver_finalize(GObject * object) {
+ GaServiceResolver *self = GA_SERVICE_RESOLVER(object);
+ GaServiceResolverPrivate *priv = GA_SERVICE_RESOLVER_GET_PRIVATE(self);
+
+ /* free any data held directly by the object here */
+ g_free(priv->name);
+ priv->name = NULL;
+
+ g_free(priv->type);
+ priv->type = NULL;
+
+ g_free(priv->domain);
+ priv->domain = NULL;
+
+ G_OBJECT_CLASS(ga_service_resolver_parent_class)->finalize(object);
+}
+
+static void _avahi_service_resolver_cb(AVAHI_GCC_UNUSED AvahiServiceResolver * resolver,
+ 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) {
+ GaServiceResolver *self = GA_SERVICE_RESOLVER(userdata);
+ GaServiceResolverPrivate *priv = GA_SERVICE_RESOLVER_GET_PRIVATE(self);
+
+ switch (event) {
+ case AVAHI_RESOLVER_FOUND:{
+ /* FIXME: Double check if this address is always the same */
+ priv->address = *a;
+ priv->port = port;
+ g_signal_emit(self, signals[FOUND], 0,
+ interface, protocol,
+ name, type,
+ domain, host_name, a, port, txt, flags);
+ break;
+ }
+ case AVAHI_RESOLVER_FAILURE:{
+ GError *error;
+ int aerrno = avahi_client_errno(priv->client->avahi_client);
+ error = g_error_new(GA_ERROR, aerrno,
+ "Resolving failed: %s",
+ avahi_strerror(aerrno));
+ g_signal_emit(self, signals[FAILURE], 0, error);
+ g_error_free(error);
+ break;
+ }
+ }
+}
+
+
+GaServiceResolver *ga_service_resolver_new(AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ const gchar * name,
+ const gchar * type,
+ const gchar * domain,
+ AvahiProtocol address_protocol,
+ GaLookupFlags flags) {
+ return g_object_new(GA_TYPE_SERVICE_RESOLVER, "interface", interface,
+ "protocol", protocol, "name", name, "type", type,
+ "domain", domain, "aprotocol", address_protocol,
+ "flags", flags, NULL);
+}
+
+gboolean ga_service_resolver_attach(GaServiceResolver * resolver,
+ GaClient * client, GError ** error) {
+ GaServiceResolverPrivate *priv =
+ GA_SERVICE_RESOLVER_GET_PRIVATE(resolver);
+
+ g_assert(client != NULL);
+ g_object_ref(client);
+
+ priv->client = client;
+
+ priv->resolver = avahi_service_resolver_new(client->avahi_client,
+ priv->interface,
+ priv->protocol,
+ priv->name,
+ priv->type, priv->domain,
+ priv->aprotocol,
+ priv->flags,
+ _avahi_service_resolver_cb,
+ resolver);
+ if (priv->resolver == NULL) {
+ if (error != NULL) {
+ int aerrno = avahi_client_errno(client->avahi_client);
+ *error = g_error_new(GA_ERROR, aerrno,
+ "Attaching group failed: %s",
+ avahi_strerror(aerrno));
+ }
+/* printf("Failed to add resolver\n"); */
+ return FALSE;
+ }
+ return TRUE;
+}
+
+gboolean ga_service_resolver_get_address(GaServiceResolver * resolver,
+ AvahiAddress * address, uint16_t * port) {
+ GaServiceResolverPrivate *priv =
+ GA_SERVICE_RESOLVER_GET_PRIVATE(resolver);
+ if (priv->port == 0) {
+/* printf("PORT == 0\n"); */
+ return FALSE;
+ }
+
+ *address = priv->address;
+ *port = priv->port;
+ return TRUE;
+}
diff --git a/avahi-gobject/ga-service-resolver.h b/avahi-gobject/ga-service-resolver.h
new file mode 100644
index 0000000..50b4f58
--- /dev/null
+++ b/avahi-gobject/ga-service-resolver.h
@@ -0,0 +1,75 @@
+/*
+ * ga-service-resolver.h - Header for GaServiceResolver
+ * Copyright (C) 2006-2007 Collabora Ltd.
+ *
+ * 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
+ */
+
+#ifndef __GA_SERVICE_RESOLVER_H__
+#define __GA_SERVICE_RESOLVER_H__
+
+
+#include <avahi-common/address.h>
+
+#include <glib-object.h>
+#include "ga-client.h"
+#include "ga-enums.h"
+
+G_BEGIN_DECLS
+
+typedef struct _GaServiceResolver GaServiceResolver;
+typedef struct _GaServiceResolverClass GaServiceResolverClass;
+
+struct _GaServiceResolverClass {
+ GObjectClass parent_class;
+};
+
+struct _GaServiceResolver {
+ GObject parent;
+};
+
+GType ga_service_resolver_get_type(void);
+
+/* TYPE MACROS */
+#define GA_TYPE_SERVICE_RESOLVER \
+ (ga_service_resolver_get_type())
+#define GA_SERVICE_RESOLVER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_SERVICE_RESOLVER, GaServiceResolver))
+#define GA_SERVICE_RESOLVER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_SERVICE_RESOLVER, GaServiceResolverClass))
+#define IS_GA_SERVICE_RESOLVER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_SERVICE_RESOLVER))
+#define IS_GA_SERVICE_RESOLVER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_SERVICE_RESOLVER))
+#define GA_SERVICE_RESOLVER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_SERVICE_RESOLVER, GaServiceResolverClass))
+
+GaServiceResolver *ga_service_resolver_new(AvahiIfIndex interface,
+ AvahiProtocol protocol,
+ const gchar * name,
+ const gchar * type,
+ const gchar * domain,
+ AvahiProtocol address_protocol,
+ GaLookupFlags flags);
+
+gboolean
+ga_service_resolver_attach(GaServiceResolver * resolver,
+ GaClient * client, GError ** error);
+
+gboolean
+ga_service_resolver_get_address(GaServiceResolver * resolver,
+ AvahiAddress * address, uint16_t * port);
+G_END_DECLS
+#endif /* #ifndef __GA_SERVICE_RESOLVER_H__ */
diff --git a/avahi-python/.gitignore b/avahi-python/.gitignore
new file mode 100644
index 0000000..01b90e7
--- /dev/null
+++ b/avahi-python/.gitignore
@@ -0,0 +1 @@
+avahi-bookmarks
diff --git a/avahi-python/Makefile.am b/avahi-python/Makefile.am
new file mode 100644
index 0000000..7381a48
--- /dev/null
+++ b/avahi-python/Makefile.am
@@ -0,0 +1,42 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+
+SUBDIRS=avahi avahi-discover
+
+if HAVE_PYTHON
+if HAVE_PYTHON_DBUS
+
+pythonscripts = \
+ avahi-bookmarks
+
+avahi-bookmarks: avahi-bookmarks.in
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' $< > $@ && \
+ chmod +x $@
+
+bin_SCRIPTS = $(pythonscripts)
+CLEANFILES = $(pythonscripts)
+
+endif
+endif
diff --git a/avahi-python/avahi-bookmarks.in b/avahi-python/avahi-bookmarks.in
new file mode 100755
index 0000000..dea7bef
--- /dev/null
+++ b/avahi-python/avahi-bookmarks.in
@@ -0,0 +1,227 @@
+#!@PYTHON@
+# -*-python-*-
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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, os
+
+try:
+ import avahi, gobject, dbus
+except ImportError:
+ print "Sorry, to use this tool you need to install Avahi and python-dbus."
+ sys.exit(1)
+
+try:
+ import dbus.glib
+except ImportError:
+ pass
+
+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:
+ services = {}
+
+ def __init__(self, use_host_names):
+
+ 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, 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):
+
+ 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_html(self):
+
+ 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 Zeroconf web services have been registered on the %s domain.</p>' % domain
+ 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)]
+
+
+ # 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"
+ 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:], "hct:p:a:HAd:", ["help", "cgi", "port=", "timeout=", "address=", "host-names", "addresses", "domain="])
+except getopt.GetoptError:
+ usage(2)
+
+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)
+
+ 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
+
+if use_CGI is None:
+ use_CGI = os.environ.has_key("GATEWAY_INTERFACE")
+
+if use_CGI:
+ cgi = AvahiBookmarks(use_host_names)
+
+ 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/.gitignore b/avahi-python/avahi-discover/.gitignore
new file mode 100644
index 0000000..f08aa89
--- /dev/null
+++ b/avahi-python/avahi-discover/.gitignore
@@ -0,0 +1,3 @@
+avahi-discover
+avahi-discover.desktop
+avahi-discover.desktop.in
diff --git a/avahi-python/avahi-discover/Makefile.am b/avahi-python/avahi-discover/Makefile.am
new file mode 100644
index 0000000..d16bd11
--- /dev/null
+++ b/avahi-python/avahi-discover/Makefile.am
@@ -0,0 +1,69 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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)
+
+EXTRA_DIST = \
+ __init__.py \
+ avahi-discover.py \
+ avahi-discover.desktop.in.in
+
+if HAVE_PYTHON
+if HAVE_PYTHON_DBUS
+if HAVE_PYGTK
+
+pythonscripts =
+
+desktopdir = $(datadir)/applications
+desktop_DATA =
+
+avahi_discoverdir = $(pythondir)/avahi_discover
+avahi_discover_PYTHON =
+
+if HAVE_GDBM
+pythonscripts += \
+ avahi-discover
+desktop_DATA += avahi-discover.desktop
+@INTLTOOL_DESKTOP_RULE@
+avahi_discover_PYTHON += __init__.py
+endif
+
+if HAVE_DBM
+pythonscripts += \
+ avahi-discover
+desktop_DATA += avahi-discover.desktop
+@INTLTOOL_DESKTOP_RULE@
+avahi_discover_PYTHON += __init__.py
+endif
+
+avahi-discover.desktop.in: avahi-discover.desktop.in.in
+ $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
+
+avahi-discover: avahi-discover.py
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@GETTEXT_PACKAGE\@,"$(GETTEXT_PACKAGE)",g' \
+ -e 's,@LOCALEDIR\@,"$(avahilocaledir)",g' \
+ -e 's,@interfacesdir\@,$(interfacesdir),g' $< > $@ && \
+ chmod +x $@
+
+bin_SCRIPTS = $(pythonscripts)
+
+CLEANFILES = $(pythonscripts) $(desktop_DATA) *.pyc *.pyo avahi-discover.desktop.in
+
+endif
+endif
+endif
diff --git a/avahi-python/avahi-discover/__init__.py b/avahi-python/avahi-discover/__init__.py
new file mode 100755
index 0000000..6f3ec7f
--- /dev/null
+++ b/avahi-python/avahi-discover/__init__.py
@@ -0,0 +1,18 @@
+#!@PYTHON@
+# -*-python-*-
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
diff --git a/avahi-python/avahi-discover/avahi-discover.desktop.in.in b/avahi-python/avahi-discover/avahi-discover.desktop.in.in
new file mode 100644
index 0000000..dac9818
--- /dev/null
+++ b/avahi-python/avahi-discover/avahi-discover.desktop.in.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+_Name=Avahi Zeroconf Browser
+_Comment=Browse for Zeroconf services available on your network
+Exec=@bindir@/avahi-discover
+Terminal=false
+Type=Application
+Icon=network-wired
+Categories=GNOME;System;
+StartupNotify=false
+GenericName=
diff --git a/avahi-python/avahi-discover/avahi-discover.py b/avahi-python/avahi-discover/avahi-discover.py
new file mode 100755
index 0000000..362d3b6
--- /dev/null
+++ b/avahi-python/avahi-discover/avahi-discover.py
@@ -0,0 +1,288 @@
+#!@PYTHON@
+# -*-python-*-
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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, gettext, gtk, gobject, dbus, avahi.ServiceTypeDatabase
+ gettext.bindtextdomain(@GETTEXT_PACKAGE@, @LOCALEDIR@)
+ gettext.textdomain(@GETTEXT_PACKAGE@)
+ _ = gettext.gettext
+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)
+except Exception, e:
+ print "Failed to initialize: %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
+
+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()
+
+ui_dir = "@interfacesdir@"
+
+service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase()
+
+class Main_window:
+ def __init__(self, path="avahi-discover.ui", root="main_window", domain=None, **kwargs):
+ path = os.path.join(ui_dir, path)
+ gtk.window_set_default_icon_name("network-wired")
+ self.ui = gtk.Builder()
+ self.ui.add_from_file(path)
+ self.ui.connect_signals(self)
+ self.tree_view = self.ui.get_object("tree_view")
+ self.info_label = self.ui.get_object("info_label")
+ self.new()
+
+ def on_tree_view_cursor_changed(self, widget, *args):
+ (model, iter) = widget.get_selection().get_selected()
+ stype = None
+ if iter is not None:
+ (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"
+ infos += "<b>" + _("Service Name:") + "</b> %s\n"
+ infos += "<b>" + _("Domain Name:") + "</b> %s\n"
+ infos += "<b>" + _("Interface:") + "</b> %s %s\n"
+ infos += "<b>" + _("Address:") + "</b> %s/%s:%i\n%s"
+ infos = infos % (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,str(interface),3,str(protocol),4,stype,5,domain)
+ return myiter
+
+ def new(self):
+ 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 = {}
+
+ try:
+ self.bus = dbus.SystemBus()
+ self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
+ except Exception, e:
+ print "Failed to connect to Avahi Server (Is it running?): %s" % e
+ sys.exit(1)
+
+ 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 gtk_main_quit(self, *args):
+ gtk.main_quit()
+
+def main():
+ main_window = Main_window()
+ gtk.main()
+
+if __name__ == "__main__":
+ main()
diff --git a/avahi-python/avahi/.gitignore b/avahi-python/avahi/.gitignore
new file mode 100644
index 0000000..118a34d
--- /dev/null
+++ b/avahi-python/avahi/.gitignore
@@ -0,0 +1 @@
+ServiceTypeDatabase.py
diff --git a/avahi-python/avahi/Makefile.am b/avahi-python/avahi/Makefile.am
new file mode 100644
index 0000000..3eb67d0
--- /dev/null
+++ b/avahi-python/avahi/Makefile.am
@@ -0,0 +1,61 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 ServiceTypeDatabase.py.in
+
+pkglibdatadir=$(libdir)/avahi
+
+if HAVE_PYTHON
+
+avahidir = $(pythondir)/avahi
+
+if HAVE_GDBM
+nodist_avahi_SCRIPTS = ServiceTypeDatabase.py
+
+ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
+ $(AM_V_GEN)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,@pkglibdatadir\@,$(pkglibdatadir),g' $< > $@ && \
+ chmod +x $@
+endif
+
+if HAVE_DBM
+nodist_avahi_SCRIPTS = ServiceTypeDatabase.py
+
+ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
+ $(AM_V_GEN)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,@pkglibdatadir\@,$(pkglibdatadir),g' $< > $@ && \
+ chmod +x $@
+endif
+
+avahi_PYTHON = $(avahi_SCRIPTS)
+
+if HAVE_PYTHON_DBUS
+
+avahi_PYTHON += __init__.py
+
+endif
+endif
+
+CLEANFILES=*.pyc *.pyo ServiceTypeDatabase.py
diff --git a/avahi-python/avahi/ServiceTypeDatabase.py.in b/avahi-python/avahi/ServiceTypeDatabase.py.in
new file mode 100644
index 0000000..b2035fd
--- /dev/null
+++ b/avahi-python/avahi/ServiceTypeDatabase.py.in
@@ -0,0 +1,161 @@
+#!@PYTHON@
+# -*-python-*-
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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:
+ """ServiceTypeDatabase maps service types to descriptions"""
+
+ def __init__(self, filename = "@pkglibdatadir@/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):
+
+ return list(self.iteritems())
+
+ 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
+
+
+ def __iter__(self):
+
+ @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):
+ yield key
+
+ @NEXT_KEY@
+
+ def __len__(self):
+
+ count = 0
+ for _ in self:
+
+ count+=1
+
+ self.__len__ = lambda : count
+ return len(self)
+
+ def get(self, key, default=None):
+
+ if key in self:
+ return self[key]
+ else:
+ return default
+
+ def iteritems(self):
+
+ return ((key, self[key]) for key in self)
+
+ def iterkeys(self):
+
+ return self.__iter__()
+
+ def itervalues(self):
+
+ return (self[key] for key in self)
+
+ def keys(self):
+
+ return list(self)
+
+ def values(self):
+
+ return list(self.itervalues())
+
+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.get("gurki._tcp")
+ print len(b)
+
+ for key, _ in zip(b, xrange(3)):
+
+ print key
+
+ for key, _ in zip(b.iteritems(), xrange(3)):
+
+ print key
+
+ for key, _ in zip(b.itervalues(), xrange(3)):
+
+ print key
diff --git a/avahi-python/avahi/__init__.py b/avahi-python/avahi/__init__.py
new file mode 100644
index 0000000..7b45029
--- /dev/null
+++ b/avahi-python/avahi/__init__.py
@@ -0,0 +1,112 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/avahi-qt/.gitignore b/avahi-qt/.gitignore
new file mode 100644
index 0000000..e155956
--- /dev/null
+++ b/avahi-qt/.gitignore
@@ -0,0 +1,9 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+*.moc3
+*.moc4
diff --git a/avahi-qt/Makefile.am b/avahi-qt/Makefile.am
new file mode 100644
index 0000000..64356a5
--- /dev/null
+++ b/avahi-qt/Makefile.am
@@ -0,0 +1,68 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+ $(AM_V_GEN)$(MOC_QT3) $^ > $@
+
+libavahi_qt3_la_CPPFLAGS = $(AM_CFLAGS) $(QT3_CFLAGS) $(VISIBILITY_HIDDEN_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
+ $(AM_V_GEN)$(MOC_QT4) $^ > $@
+
+libavahi_qt4_la_CPPFLAGS = $(AM_CFLAGS) $(QT4_CFLAGS) -DQT4 $(VISIBILITY_HIDDEN_CFLAGS)
+libavahi_qt4_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT4_LIBS)
+libavahi_qt4_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_QT4_VERSION_INFO)
+endif
+
+CLEANFILES = $(BUILT_SOURCES)
diff --git a/avahi-qt/qt-watch.cpp b/avahi-qt/qt-watch.cpp
new file mode 100644
index 0000000..dac9dcc
--- /dev/null
+++ b/avahi-qt/qt-watch.cpp
@@ -0,0 +1,198 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-qt/qt-watch.h b/avahi-qt/qt-watch.h
new file mode 100644
index 0000000..cd7130d
--- /dev/null
+++ b/avahi-qt/qt-watch.h
@@ -0,0 +1,38 @@
+#ifndef QAVAHI_H
+#define QAVAHI_H
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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)
+#ifdef HAVE_VISIBILITY_HIDDEN
+__attribute__ ((visibility("default")))
+#endif
+;
+
+AVAHI_C_DECL_END
+
+#endif
diff --git a/avahi-qt3.pc.in b/avahi-qt3.pc.in
new file mode 100644
index 0000000..c18f080
--- /dev/null
+++ b/avahi-qt3.pc.in
@@ -0,0 +1,11 @@
+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/avahi-qt4.pc.in b/avahi-qt4.pc.in
new file mode 100644
index 0000000..f62f717
--- /dev/null
+++ b/avahi-qt4.pc.in
@@ -0,0 +1,11 @@
+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/avahi-sharp.pc.in b/avahi-sharp.pc.in
new file mode 100644
index 0000000..3cc78b6
--- /dev/null
+++ b/avahi-sharp.pc.in
@@ -0,0 +1,8 @@
+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/avahi-sharp/.gitignore b/avahi-sharp/.gitignore
new file mode 100644
index 0000000..9ad47f0
--- /dev/null
+++ b/avahi-sharp/.gitignore
@@ -0,0 +1,6 @@
+avahi-sharp-docs.tree
+avahi-sharp-docs.zip
+avahi-sharp.dll
+avahi-sharp.dll.config
+avahi-sharp.dll.mdb
+
diff --git a/avahi-sharp/AddressResolver.cs b/avahi-sharp/AddressResolver.cs
new file mode 100644
index 0000000..c11e97d
--- /dev/null
+++ b/avahi-sharp/AddressResolver.cs
@@ -0,0 +1,190 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/AssemblyInfo.cs b/avahi-sharp/AssemblyInfo.cs
new file mode 100644
index 0000000..aff09d9
--- /dev/null
+++ b/avahi-sharp/AssemblyInfo.cs
@@ -0,0 +1,48 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/AvahiTest.cs b/avahi-sharp/AvahiTest.cs
new file mode 100644
index 0000000..6ccfd57
--- /dev/null
+++ b/avahi-sharp/AvahiTest.cs
@@ -0,0 +1,131 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/BrowserBase.cs b/avahi-sharp/BrowserBase.cs
new file mode 100644
index 0000000..3af0086
--- /dev/null
+++ b/avahi-sharp/BrowserBase.cs
@@ -0,0 +1,50 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/Client.cs b/avahi-sharp/Client.cs
new file mode 100644
index 0000000..b3815b3
--- /dev/null
+++ b/avahi-sharp/Client.cs
@@ -0,0 +1,383 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/ClientException.cs b/avahi-sharp/ClientException.cs
new file mode 100644
index 0000000..0f511ac
--- /dev/null
+++ b/avahi-sharp/ClientException.cs
@@ -0,0 +1,123 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/DomainBrowser.cs b/avahi-sharp/DomainBrowser.cs
new file mode 100644
index 0000000..a1165dc
--- /dev/null
+++ b/avahi-sharp/DomainBrowser.cs
@@ -0,0 +1,198 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/EntryGroup.cs b/avahi-sharp/EntryGroup.cs
new file mode 100644
index 0000000..24abae4
--- /dev/null
+++ b/avahi-sharp/EntryGroup.cs
@@ -0,0 +1,376 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/HostNameResolver.cs b/avahi-sharp/HostNameResolver.cs
new file mode 100644
index 0000000..b9fe7f4
--- /dev/null
+++ b/avahi-sharp/HostNameResolver.cs
@@ -0,0 +1,167 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/Makefile.am b/avahi-sharp/Makefile.am
new file mode 100644
index 0000000..1fdb1ca
--- /dev/null
+++ b/avahi-sharp/Makefile.am
@@ -0,0 +1,82 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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)
+ $(AM_V_GEN)MONO_SHARED_DIR=. mcs -keyfile:$(srcdir)/avahi.snk -target:library -out:$@ -debug $(AVAHISOURCES) -r:Mono.Posix
+
+
+$(ASSEMBLY).config: $(ASSEMBLY).config.in
+ $(AM_V_GEN)$(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)
+ $(AM_V_GEN)$(MONODOCER) -assembly:$(ASSEMBLY) -path:en
+
+avahi-sharp-docs.zip: avahi-sharp-docs.tree
+
+avahi-sharp-docs.tree: $(srcdir)/en/*/*
+ $(AM_V_GEN)$(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)
+ $(AM_V_GEN)MONO_SHARED_DIR=. $(GACUTIL) /i $(ASSEMBLY) /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+
+uninstall-hook: $(ASSEMBLY)
+ $(AM_V_GEN)MONO_SHARED_DIR=. $(GACUTIL) /u avahi-sharp /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+
+endif
+endif
diff --git a/avahi-sharp/RecordBrowser.cs b/avahi-sharp/RecordBrowser.cs
new file mode 100644
index 0000000..ba5a983
--- /dev/null
+++ b/avahi-sharp/RecordBrowser.cs
@@ -0,0 +1,225 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/ResolverBase.cs b/avahi-sharp/ResolverBase.cs
new file mode 100644
index 0000000..d546aba
--- /dev/null
+++ b/avahi-sharp/ResolverBase.cs
@@ -0,0 +1,34 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/ServiceBrowser.cs b/avahi-sharp/ServiceBrowser.cs
new file mode 100644
index 0000000..5c39ad4
--- /dev/null
+++ b/avahi-sharp/ServiceBrowser.cs
@@ -0,0 +1,214 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/ServiceResolver.cs b/avahi-sharp/ServiceResolver.cs
new file mode 100644
index 0000000..7f8901a
--- /dev/null
+++ b/avahi-sharp/ServiceResolver.cs
@@ -0,0 +1,225 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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;
+
+ if (proto == Protocol.IPv6)
+ info.Address.ScopeId = iface;
+
+ 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/avahi-sharp/ServiceTypeBrowser.cs b/avahi-sharp/ServiceTypeBrowser.cs
new file mode 100644
index 0000000..e1356d0
--- /dev/null
+++ b/avahi-sharp/ServiceTypeBrowser.cs
@@ -0,0 +1,197 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/Utility.cs b/avahi-sharp/Utility.cs
new file mode 100644
index 0000000..a1d0a66
--- /dev/null
+++ b/avahi-sharp/Utility.cs
@@ -0,0 +1,112 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-sharp/avahi-sharp-docs.source b/avahi-sharp/avahi-sharp-docs.source
new file mode 100644
index 0000000..f3b3c75
--- /dev/null
+++ b/avahi-sharp/avahi-sharp-docs.source
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<monodoc>
+ <source provider="ecma" basefile="avahi-sharp-docs" path="various" title="Avahi" />
+</monodoc>
diff --git a/avahi-sharp/avahi-sharp.dll.config.in b/avahi-sharp/avahi-sharp.dll.config.in
new file mode 100644
index 0000000..5bae58f
--- /dev/null
+++ b/avahi-sharp/avahi-sharp.dll.config.in
@@ -0,0 +1,5 @@
+<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/avahi-sharp/avahi.snk b/avahi-sharp/avahi.snk
new file mode 100644
index 0000000..58c23bc
--- /dev/null
+++ b/avahi-sharp/avahi.snk
Binary files differ
diff --git a/avahi-sharp/en/Avahi.xml b/avahi-sharp/en/Avahi.xml
new file mode 100644
index 0000000..0739013
--- /dev/null
+++ b/avahi-sharp/en/Avahi.xml
@@ -0,0 +1,6 @@
+<Namespace Name="Avahi">
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+</Namespace>
diff --git a/avahi-sharp/en/Avahi/AddressResolver.xml b/avahi-sharp/en/Avahi/AddressResolver.xml
new file mode 100644
index 0000000..064e505
--- /dev/null
+++ b/avahi-sharp/en/Avahi/AddressResolver.xml
@@ -0,0 +1,113 @@
+<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/avahi-sharp/en/Avahi/BrowserBase.xml b/avahi-sharp/en/Avahi/BrowserBase.xml
new file mode 100644
index 0000000..fa6d2ad
--- /dev/null
+++ b/avahi-sharp/en/Avahi/BrowserBase.xml
@@ -0,0 +1,59 @@
+<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/avahi-sharp/en/Avahi/Client.xml b/avahi-sharp/en/Avahi/Client.xml
new file mode 100644
index 0000000..0abecf7
--- /dev/null
+++ b/avahi-sharp/en/Avahi/Client.xml
@@ -0,0 +1,178 @@
+<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/avahi-sharp/en/Avahi/ClientException.xml b/avahi-sharp/en/Avahi/ClientException.xml
new file mode 100644
index 0000000..3b8319b
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ClientException.xml
@@ -0,0 +1,29 @@
+<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/avahi-sharp/en/Avahi/ClientFlags.xml b/avahi-sharp/en/Avahi/ClientFlags.xml
new file mode 100644
index 0000000..d4ea291
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ClientFlags.xml
@@ -0,0 +1,51 @@
+<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/avahi-sharp/en/Avahi/ClientState.xml b/avahi-sharp/en/Avahi/ClientState.xml
new file mode 100644
index 0000000..c20a02b
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ClientState.xml
@@ -0,0 +1,66 @@
+<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/avahi-sharp/en/Avahi/ClientStateArgs.xml b/avahi-sharp/en/Avahi/ClientStateArgs.xml
new file mode 100644
index 0000000..e5da11d
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ClientStateArgs.xml
@@ -0,0 +1,41 @@
+<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/avahi-sharp/en/Avahi/ClientStateHandler.xml b/avahi-sharp/en/Avahi/ClientStateHandler.xml
new file mode 100644
index 0000000..0576975
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ClientStateHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/Avahi/DomainBrowser.xml b/avahi-sharp/en/Avahi/DomainBrowser.xml
new file mode 100644
index 0000000..20536e0
--- /dev/null
+++ b/avahi-sharp/en/Avahi/DomainBrowser.xml
@@ -0,0 +1,101 @@
+<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/avahi-sharp/en/Avahi/DomainBrowserType.xml b/avahi-sharp/en/Avahi/DomainBrowserType.xml
new file mode 100644
index 0000000..9743524
--- /dev/null
+++ b/avahi-sharp/en/Avahi/DomainBrowserType.xml
@@ -0,0 +1,66 @@
+<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/avahi-sharp/en/Avahi/DomainInfo.xml b/avahi-sharp/en/Avahi/DomainInfo.xml
new file mode 100644
index 0000000..dddfd60
--- /dev/null
+++ b/avahi-sharp/en/Avahi/DomainInfo.xml
@@ -0,0 +1,61 @@
+<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/avahi-sharp/en/Avahi/DomainInfoArgs.xml b/avahi-sharp/en/Avahi/DomainInfoArgs.xml
new file mode 100644
index 0000000..1967447
--- /dev/null
+++ b/avahi-sharp/en/Avahi/DomainInfoArgs.xml
@@ -0,0 +1,41 @@
+<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/avahi-sharp/en/Avahi/DomainInfoHandler.xml b/avahi-sharp/en/Avahi/DomainInfoHandler.xml
new file mode 100644
index 0000000..793e2b7
--- /dev/null
+++ b/avahi-sharp/en/Avahi/DomainInfoHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/Avahi/EntryGroup.xml b/avahi-sharp/en/Avahi/EntryGroup.xml
new file mode 100644
index 0000000..93fec22
--- /dev/null
+++ b/avahi-sharp/en/Avahi/EntryGroup.xml
@@ -0,0 +1,491 @@
+<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/avahi-sharp/en/Avahi/EntryGroupState.xml b/avahi-sharp/en/Avahi/EntryGroupState.xml
new file mode 100644
index 0000000..c01e1df
--- /dev/null
+++ b/avahi-sharp/en/Avahi/EntryGroupState.xml
@@ -0,0 +1,66 @@
+<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/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml b/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml
new file mode 100644
index 0000000..c7d6f8c
--- /dev/null
+++ b/avahi-sharp/en/Avahi/EntryGroupStateArgs.xml
@@ -0,0 +1,41 @@
+<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/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml b/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml
new file mode 100644
index 0000000..427c519
--- /dev/null
+++ b/avahi-sharp/en/Avahi/EntryGroupStateHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/Avahi/ErrorCode.xml b/avahi-sharp/en/Avahi/ErrorCode.xml
new file mode 100644
index 0000000..687f524
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ErrorCode.xml
@@ -0,0 +1,526 @@
+<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/avahi-sharp/en/Avahi/ErrorCodeArgs.xml b/avahi-sharp/en/Avahi/ErrorCodeArgs.xml
new file mode 100644
index 0000000..c8a7ccc
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ErrorCodeArgs.xml
@@ -0,0 +1,41 @@
+<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/avahi-sharp/en/Avahi/ErrorCodeHandler.xml b/avahi-sharp/en/Avahi/ErrorCodeHandler.xml
new file mode 100644
index 0000000..04e22d3
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ErrorCodeHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/Avahi/HostAddressArgs.xml b/avahi-sharp/en/Avahi/HostAddressArgs.xml
new file mode 100644
index 0000000..2b126e3
--- /dev/null
+++ b/avahi-sharp/en/Avahi/HostAddressArgs.xml
@@ -0,0 +1,55 @@
+<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/avahi-sharp/en/Avahi/HostAddressHandler.xml b/avahi-sharp/en/Avahi/HostAddressHandler.xml
new file mode 100644
index 0000000..f0c195e
--- /dev/null
+++ b/avahi-sharp/en/Avahi/HostAddressHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/Avahi/HostNameResolver.xml b/avahi-sharp/en/Avahi/HostNameResolver.xml
new file mode 100644
index 0000000..37124fd
--- /dev/null
+++ b/avahi-sharp/en/Avahi/HostNameResolver.xml
@@ -0,0 +1,115 @@
+<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/avahi-sharp/en/Avahi/LookupFlags.xml b/avahi-sharp/en/Avahi/LookupFlags.xml
new file mode 100644
index 0000000..d7882e0
--- /dev/null
+++ b/avahi-sharp/en/Avahi/LookupFlags.xml
@@ -0,0 +1,71 @@
+<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/avahi-sharp/en/Avahi/LookupResultFlags.xml b/avahi-sharp/en/Avahi/LookupResultFlags.xml
new file mode 100644
index 0000000..0066493
--- /dev/null
+++ b/avahi-sharp/en/Avahi/LookupResultFlags.xml
@@ -0,0 +1,81 @@
+<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/avahi-sharp/en/Avahi/Protocol.xml b/avahi-sharp/en/Avahi/Protocol.xml
new file mode 100644
index 0000000..361f034
--- /dev/null
+++ b/avahi-sharp/en/Avahi/Protocol.xml
@@ -0,0 +1,46 @@
+<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/avahi-sharp/en/Avahi/PublishFlags.xml b/avahi-sharp/en/Avahi/PublishFlags.xml
new file mode 100644
index 0000000..c21774c
--- /dev/null
+++ b/avahi-sharp/en/Avahi/PublishFlags.xml
@@ -0,0 +1,121 @@
+<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/avahi-sharp/en/Avahi/RecordBrowser.xml b/avahi-sharp/en/Avahi/RecordBrowser.xml
new file mode 100644
index 0000000..fdf32ca
--- /dev/null
+++ b/avahi-sharp/en/Avahi/RecordBrowser.xml
@@ -0,0 +1,107 @@
+<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/avahi-sharp/en/Avahi/RecordClass.xml b/avahi-sharp/en/Avahi/RecordClass.xml
new file mode 100644
index 0000000..69787ce
--- /dev/null
+++ b/avahi-sharp/en/Avahi/RecordClass.xml
@@ -0,0 +1,26 @@
+<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/avahi-sharp/en/Avahi/RecordInfo.xml b/avahi-sharp/en/Avahi/RecordInfo.xml
new file mode 100644
index 0000000..708678e
--- /dev/null
+++ b/avahi-sharp/en/Avahi/RecordInfo.xml
@@ -0,0 +1,94 @@
+<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/avahi-sharp/en/Avahi/RecordInfoArgs.xml b/avahi-sharp/en/Avahi/RecordInfoArgs.xml
new file mode 100644
index 0000000..81e6e57
--- /dev/null
+++ b/avahi-sharp/en/Avahi/RecordInfoArgs.xml
@@ -0,0 +1,41 @@
+<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/avahi-sharp/en/Avahi/RecordInfoHandler.xml b/avahi-sharp/en/Avahi/RecordInfoHandler.xml
new file mode 100644
index 0000000..f9cbc17
--- /dev/null
+++ b/avahi-sharp/en/Avahi/RecordInfoHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/Avahi/RecordType.xml b/avahi-sharp/en/Avahi/RecordType.xml
new file mode 100644
index 0000000..7913cad
--- /dev/null
+++ b/avahi-sharp/en/Avahi/RecordType.xml
@@ -0,0 +1,116 @@
+<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/avahi-sharp/en/Avahi/ResolverBase.xml b/avahi-sharp/en/Avahi/ResolverBase.xml
new file mode 100644
index 0000000..c7d8549
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ResolverBase.xml
@@ -0,0 +1,37 @@
+<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/avahi-sharp/en/Avahi/ServiceBrowser.xml b/avahi-sharp/en/Avahi/ServiceBrowser.xml
new file mode 100644
index 0000000..ff4eedb
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceBrowser.xml
@@ -0,0 +1,119 @@
+<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/avahi-sharp/en/Avahi/ServiceInfo.xml b/avahi-sharp/en/Avahi/ServiceInfo.xml
new file mode 100644
index 0000000..d780085
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceInfo.xml
@@ -0,0 +1,138 @@
+<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/avahi-sharp/en/Avahi/ServiceInfoArgs.xml b/avahi-sharp/en/Avahi/ServiceInfoArgs.xml
new file mode 100644
index 0000000..d2ee14d
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceInfoArgs.xml
@@ -0,0 +1,41 @@
+<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/avahi-sharp/en/Avahi/ServiceInfoHandler.xml b/avahi-sharp/en/Avahi/ServiceInfoHandler.xml
new file mode 100644
index 0000000..91cf630
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceInfoHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/Avahi/ServiceResolver.xml b/avahi-sharp/en/Avahi/ServiceResolver.xml
new file mode 100644
index 0000000..e8ac750
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceResolver.xml
@@ -0,0 +1,125 @@
+<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/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml b/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml
new file mode 100644
index 0000000..5ea64ac
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceTypeBrowser.xml
@@ -0,0 +1,113 @@
+<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/avahi-sharp/en/Avahi/ServiceTypeInfo.xml b/avahi-sharp/en/Avahi/ServiceTypeInfo.xml
new file mode 100644
index 0000000..5b09ae9
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceTypeInfo.xml
@@ -0,0 +1,72 @@
+<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/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml b/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml
new file mode 100644
index 0000000..fd584cd
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceTypeInfoArgs.xml
@@ -0,0 +1,41 @@
+<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/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml b/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml
new file mode 100644
index 0000000..0fd751f
--- /dev/null
+++ b/avahi-sharp/en/Avahi/ServiceTypeInfoHandler.xml
@@ -0,0 +1,23 @@
+<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/avahi-sharp/en/index.xml b/avahi-sharp/en/index.xml
new file mode 100644
index 0000000..e180cd0
--- /dev/null
+++ b/avahi-sharp/en/index.xml
@@ -0,0 +1,79 @@
+<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/avahi-sharp/gencfg.sh b/avahi-sharp/gencfg.sh
new file mode 100755
index 0000000..3486187
--- /dev/null
+++ b/avahi-sharp/gencfg.sh
@@ -0,0 +1,12 @@
+#!/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/avahi-ui-gtk3.pc.in b/avahi-ui-gtk3.pc.in
new file mode 100644
index 0000000..27c4322
--- /dev/null
+++ b/avahi-ui-gtk3.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 GTK3 UI support)
+Requires: gtk+-3.0 avahi-client avahi-glib
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lavahi-ui-gtk3
+Cflags: -D_REENTRANT -I${includedir}
diff --git a/avahi-ui-sharp.pc.in b/avahi-ui-sharp.pc.in
new file mode 100644
index 0000000..cdc35e0
--- /dev/null
+++ b/avahi-ui-sharp.pc.in
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=@prefix@
+libdir=@libdir@
+
+Name: avahi-ui-sharp
+Description: Mono bindings for the Avahi mDNS/DNS-SD stack
+Version: @PACKAGE_VERSION@
+Requires: gtk-sharp-2.0
+Libs: -r:${libdir}/mono/avahi-ui-sharp/avahi-ui-sharp.dll
diff --git a/avahi-ui-sharp/.gitignore b/avahi-ui-sharp/.gitignore
new file mode 100644
index 0000000..0a27ea5
--- /dev/null
+++ b/avahi-ui-sharp/.gitignore
@@ -0,0 +1,6 @@
+avahi-ui-sharp-docs.tree
+avahi-ui-sharp-docs.zip
+avahi-ui-sharp.dll
+avahi-ui-sharp.dll.config
+avahi-ui-sharp.dll.mdb
+bssh.exe
diff --git a/avahi-ui-sharp/Makefile.am b/avahi-ui-sharp/Makefile.am
new file mode 100644
index 0000000..28ea64f
--- /dev/null
+++ b/avahi-ui-sharp/Makefile.am
@@ -0,0 +1,70 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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-ui-sharp.dll
+
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(ASSEMBLY).config bssh.exe
+
+AVAHISOURCES = \
+ $(srcdir)/ServiceDialog.cs
+
+EXTRA_DIST = \
+ $(AVAHISOURCES) \
+ $(srcdir)/avahi-ui-sharp-docs.source \
+ $(srcdir)/en/*.xml \
+ $(srcdir)/en/*/*.xml \
+ $(srcdir)/gencfg.sh \
+ $(srcdir)/$(ASSEMBLY).config.in \
+ $(srcdir)/bssh.cs
+
+$(ASSEMBLY): $(AVAHISOURCES)
+ $(AM_V_GEN)mcs -keyfile:$(top_srcdir)/avahi-sharp/avahi.snk -target:library -out:$@ -debug $(AVAHISOURCES) -pkg:gtk-sharp-2.0 -r:$(top_builddir)/avahi-sharp/avahi-sharp.dll -r:Mono.Posix
+
+$(ASSEMBLY).config: $(ASSEMBLY).config.in
+ $(AM_V_GEN)$(srcdir)/gencfg.sh $(top_builddir)/avahi-common/libavahi-common.la < $< > $@
+
+bssh.exe: $(srcdir)/bssh.cs $(ASSEMBLY)
+ $(AM_V_GEN)mcs -out:$@ $(srcdir)/bssh.cs -r:./avahi-ui-sharp.dll -r:../avahi-sharp/avahi-sharp.dll -pkg:gtk-sharp-2.0 -r:Mono.Posix
+
+if HAVE_MONO
+if HAVE_DBUS
+if HAVE_GTK
+all: $(ASSEMBLY) $(ASSEMBLY).config bssh.exe
+
+if HAVE_MONODOC
+update-docs: $(ASSEMBLY)
+ $(AM_V_GEN)$(MONODOCER) -assembly:$(ASSEMBLY) -path:en
+
+avahi-ui-sharp-docs.zip: avahi-ui-sharp-docs.tree
+
+avahi-ui-sharp-docs.tree: $(srcdir)/en/*/*
+ $(AM_V_GEN)$(MDASSEMBLER) --out avahi-ui-sharp-docs --ecma $(srcdir)/en
+
+monodocdir = $(MONODOC_DIR)
+monodoc_DATA = avahi-ui-sharp-docs.zip avahi-ui-sharp-docs.tree avahi-ui-sharp-docs.source
+
+endif
+
+install-data-hook: $(ASSEMBLY)
+ $(GACUTIL) /i $(ASSEMBLY) /package avahi-ui-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+
+uninstall-hook: $(ASSEMBLY)
+ $(GACUTIL) /u avahi-ui-sharp /package avahi-ui-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+
+endif
+endif
+endif
diff --git a/avahi-ui-sharp/ServiceDialog.cs b/avahi-ui-sharp/ServiceDialog.cs
new file mode 100644
index 0000000..31f7479
--- /dev/null
+++ b/avahi-ui-sharp/ServiceDialog.cs
@@ -0,0 +1,238 @@
+using System;
+using System.Net;
+using System.Collections;
+using System.Runtime.InteropServices;
+using Gtk;
+using Mono.Unix;
+using Mono.Unix.Native;
+
+namespace Avahi.UI
+{
+ public class ServiceDialog : Dialog
+ {
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_new (string title, IntPtr parent, IntPtr dummy);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_browse_service_typesv (IntPtr dialog, IntPtr[] types);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_browse_service_types (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_domain (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_domain (IntPtr dialog, IntPtr domain);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_service_type (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_service_type (IntPtr dialog, IntPtr type);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_service_name (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_service_name (IntPtr dialog, IntPtr type);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_address (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern UInt16 aui_service_dialog_get_port (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_host_name (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern IntPtr aui_service_dialog_get_txt_data (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern bool aui_service_dialog_get_resolve_service (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_resolve_service (IntPtr dialog, bool val);
+
+ [DllImport ("avahi-ui")]
+ private static extern bool aui_service_dialog_get_resolve_host_name (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_resolve_host_name (IntPtr dialog, bool val);
+
+ [DllImport ("avahi-ui")]
+ private static extern Protocol aui_service_dialog_get_address_family (IntPtr dialog);
+
+ [DllImport ("avahi-ui")]
+ private static extern void aui_service_dialog_set_address_family (IntPtr dialog, Protocol proto);
+
+ [DllImport ("avahi-common")]
+ private static extern IntPtr avahi_address_snprint (IntPtr buf, int size, IntPtr address);
+
+ [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);
+
+ public string[] BrowseServiceTypes {
+ get {
+ IntPtr arr = aui_service_dialog_get_browse_service_types (Raw);
+
+ ArrayList values = new ArrayList ();
+
+ for (int i = 0;;i++) {
+ IntPtr ptr = Marshal.ReadIntPtr (arr, i * Marshal.SizeOf (typeof (IntPtr)));
+
+ if (ptr == IntPtr.Zero)
+ break;
+
+ values.Add (GLib.Marshaller.Utf8PtrToString (ptr));
+ }
+
+ return (string[]) values.ToArray (typeof (string));
+ } set {
+ IntPtr[] types;
+ if (value == null) {
+ types = new IntPtr[] { IntPtr.Zero };
+ } else {
+ types = new IntPtr[value.Length + 1];
+
+ for (int i = 0; i < value.Length; i++) {
+ types[i] = GLib.Marshaller.StringToPtrGStrdup (value[i]);
+ }
+
+ types[value.Length] = IntPtr.Zero;
+ }
+
+ aui_service_dialog_set_browse_service_typesv (Raw, types);
+
+ for (int i = 0;;i++) {
+ if (types[i] != IntPtr.Zero)
+ break;
+
+ GLib.Marshaller.Free (types[i]);
+ }
+ }
+ }
+
+ public string ServiceType {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_service_type (Raw));
+ } set {
+ IntPtr type = GLib.Marshaller.StringToPtrGStrdup (value);
+ aui_service_dialog_set_service_type (Raw, type);
+ GLib.Marshaller.Free (type);
+ }
+ }
+
+ public string ServiceName {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_service_name (Raw));
+ } set {
+ IntPtr name = GLib.Marshaller.StringToPtrGStrdup (value);
+ aui_service_dialog_set_service_name (Raw, name);
+ GLib.Marshaller.Free (name);
+ }
+ }
+
+ public IPAddress Address {
+ get {
+ return PtrToAddress (aui_service_dialog_get_address (Raw));
+ }
+ }
+
+ public UInt16 Port {
+ get {
+ return aui_service_dialog_get_port (Raw);
+ }
+ }
+
+ public string HostName {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_host_name (Raw));
+ }
+ }
+
+ public string Domain {
+ get {
+ return GLib.Marshaller.Utf8PtrToString (aui_service_dialog_get_domain (Raw));
+ } set {
+ IntPtr domain = GLib.Marshaller.StringToPtrGStrdup (value);
+ aui_service_dialog_set_domain (Raw, domain);
+ GLib.Marshaller.Free (domain);
+ }
+ }
+
+ public byte[][] TxtData {
+ get {
+ ArrayList txtlist = new ArrayList ();
+ IntPtr txt = aui_service_dialog_get_txt_data (Raw);
+
+ 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);
+ }
+
+ return (byte[][]) txtlist.ToArray (typeof (byte[]));
+ }
+ }
+
+ public bool ResolveServiceEnabled {
+ get {
+ return aui_service_dialog_get_resolve_service (Raw);
+ } set {
+ aui_service_dialog_set_resolve_service (Raw, value);
+ }
+ }
+
+ public bool ResolveHostNameEnabled {
+ get {
+ return aui_service_dialog_get_resolve_host_name (Raw);
+ } set {
+ aui_service_dialog_set_resolve_host_name (Raw, value);
+ }
+ }
+
+ public Protocol AddressFamily {
+ get {
+ return aui_service_dialog_get_address_family (Raw);
+ } set {
+ aui_service_dialog_set_address_family (Raw, value);
+ }
+ }
+
+ public ServiceDialog (string title, Window parent, params object[] buttonData)
+ {
+ Raw = aui_service_dialog_new (title, parent == null ? IntPtr.Zero : parent.Handle,
+ IntPtr.Zero);
+
+ for (int i = 0; i < buttonData.Length - 1; i += 2) {
+ AddButton ((string) buttonData[i], (int) buttonData[i + 1]);
+ }
+ }
+
+ private 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 (GLib.Marshaller.Utf8PtrToString (addrPtr));
+
+ Stdlib.free (addrPtr);
+ }
+
+ return address;
+ }
+ }
+}
diff --git a/avahi-ui-sharp/avahi-ui-sharp-docs.source b/avahi-ui-sharp/avahi-ui-sharp-docs.source
new file mode 100644
index 0000000..2e7b172
--- /dev/null
+++ b/avahi-ui-sharp/avahi-ui-sharp-docs.source
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<monodoc>
+ <source provider="ecma" basefile="avahi-ui-sharp-docs" path="various" title="Avahi" />
+</monodoc>
diff --git a/avahi-ui-sharp/avahi-ui-sharp.dll.config.in b/avahi-ui-sharp/avahi-ui-sharp.dll.config.in
new file mode 100644
index 0000000..819577f
--- /dev/null
+++ b/avahi-ui-sharp/avahi-ui-sharp.dll.config.in
@@ -0,0 +1,4 @@
+<configuration>
+ <dllmap dll="avahi-ui" target="libavahi-ui.so.0"/>
+ <dllmap dll="avahi-common" target="@COMMON_DLNAME@"/>
+</configuration>
diff --git a/avahi-ui-sharp/bssh.cs b/avahi-ui-sharp/bssh.cs
new file mode 100644
index 0000000..fa3d4d4
--- /dev/null
+++ b/avahi-ui-sharp/bssh.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Diagnostics;
+using Gtk;
+using Avahi.UI;
+
+public class EntryPoint {
+ public static void Main () {
+ Application.Init ();
+
+ ServiceDialog dialog = new ServiceDialog ("Choose SSH Server", null,
+ Stock.Cancel, ResponseType.Cancel,
+ Stock.Connect, ResponseType.Accept);
+ dialog.BrowseServiceTypes = new string[] { "_ssh._tcp" };
+ dialog.ResolveServiceEnabled = true;
+
+ if (dialog.Run () == (int) ResponseType.Accept) {
+ Console.WriteLine ("Connecting to {0}:{1}", dialog.Address, dialog.Port);
+
+ string user = Environment.UserName;
+
+ foreach (byte[] txtBytes in dialog.TxtData) {
+ string txt = System.Text.Encoding.UTF8.GetString (txtBytes);
+ string[] splitTxt = txt.Split(new char[] { '=' }, 2);
+
+ if (splitTxt.Length != 2)
+ continue;
+
+ if (splitTxt[0] == "u") {
+ user = splitTxt[1];
+ }
+
+ string args = String.Format ("gnome-terminal -t {0} -x ssh -p {1} -l {2} {3}",
+ dialog.HostName, dialog.Port, user, dialog.Address.ToString ());
+ Console.WriteLine ("Launching: " + args);
+ Process.Start (args);
+ }
+ }
+ }
+}
diff --git a/avahi-ui-sharp/en/Avahi.UI.xml b/avahi-ui-sharp/en/Avahi.UI.xml
new file mode 100644
index 0000000..949581c
--- /dev/null
+++ b/avahi-ui-sharp/en/Avahi.UI.xml
@@ -0,0 +1,6 @@
+<Namespace Name="Avahi.UI">
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+</Namespace>
diff --git a/avahi-ui-sharp/en/Avahi.UI/ServiceDialog.xml b/avahi-ui-sharp/en/Avahi.UI/ServiceDialog.xml
new file mode 100644
index 0000000..72fa8ed
--- /dev/null
+++ b/avahi-ui-sharp/en/Avahi.UI/ServiceDialog.xml
@@ -0,0 +1,171 @@
+<Type Name="ServiceDialog" FullName="Avahi.UI.ServiceDialog">
+ <TypeSignature Language="C#" Value="public class ServiceDialog : Gtk.Dialog" />
+ <AssemblyInfo>
+ <AssemblyName>avahi-ui-sharp</AssemblyName>
+ <AssemblyVersion>0.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Base>
+ <BaseTypeName>Gtk.Dialog</BaseTypeName>
+ </Base>
+ <Interfaces />
+ <Members>
+ <Member MemberName=".ctor">
+ <MemberSignature Language="C#" Value="public ServiceDialog (string title, Gtk.Window parent, object[] buttonData);" />
+ <MemberType>Constructor</MemberType>
+ <Parameters>
+ <Parameter Name="title" Type="System.String" />
+ <Parameter Name="parent" Type="Gtk.Window" />
+ <Parameter Name="buttonData" Type="System.Object[]">
+ <Attributes>
+ <Attribute>
+ <AttributeName>System.ParamArray</AttributeName>
+ </Attribute>
+ </Attributes>
+ </Parameter>
+ </Parameters>
+ <Docs>
+ <param name="title">To be added.</param>
+ <param name="parent">To be added.</param>
+ <param name="buttonData">To be added.</param>
+ <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="AddressFamily">
+ <MemberSignature Language="C#" Value="public Avahi.Protocol AddressFamily { set; get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>Avahi.Protocol</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="BrowseServiceTypes">
+ <MemberSignature Language="C#" Value="public string[] BrowseServiceTypes { set; 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="Domain">
+ <MemberSignature Language="C#" Value="public string Domain { set; 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="Port">
+ <MemberSignature Language="C#" Value="public ushort Port { get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.UInt16</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="ResolveHostNameEnabled">
+ <MemberSignature Language="C#" Value="public bool ResolveHostNameEnabled { set; 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="ResolveServiceEnabled">
+ <MemberSignature Language="C#" Value="public bool ResolveServiceEnabled { set; 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="ServiceName">
+ <MemberSignature Language="C#" Value="public string ServiceName { set; 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="ServiceType">
+ <MemberSignature Language="C#" Value="public string ServiceType { set; 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="TxtData">
+ <MemberSignature Language="C#" Value="public byte[][] TxtData { get; };" />
+ <MemberType>Property</MemberType>
+ <ReturnValue>
+ <ReturnType>System.Byte[][]</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/avahi-ui-sharp/en/index.xml b/avahi-ui-sharp/en/index.xml
new file mode 100644
index 0000000..d1e808c
--- /dev/null
+++ b/avahi-ui-sharp/en/index.xml
@@ -0,0 +1,13 @@
+<Overview>
+ <Assemblies>
+ <Assembly Name="avahi-ui-sharp" Version="0.0.0.0" />
+ </Assemblies>
+ <Remarks>To be added.</Remarks>
+ <Copyright>To be added.</Copyright>
+ <Types>
+ <Namespace Name="Avahi.UI">
+ <Type Name="ServiceDialog" />
+ </Namespace>
+ </Types>
+ <Title>avahi-ui-sharp</Title>
+</Overview>
diff --git a/avahi-ui-sharp/gencfg.sh b/avahi-ui-sharp/gencfg.sh
new file mode 100755
index 0000000..44a6c81
--- /dev/null
+++ b/avahi-ui-sharp/gencfg.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+. $1
+common_dlname=$dlname
+
+exec sed -e "s,@COMMON_DLNAME\@,${common_dlname},g"
diff --git a/avahi-ui.pc.in b/avahi-ui.pc.in
new file mode 100644
index 0000000..9edeea9
--- /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 GTK2 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/.gitignore b/avahi-ui/.gitignore
new file mode 100644
index 0000000..b942010
--- /dev/null
+++ b/avahi-ui/.gitignore
@@ -0,0 +1,13 @@
+bssh
+bvnc
+bssh.desktop
+bvnc.desktop
+bssh.desktop.in
+bvnc.desktop.in
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
diff --git a/avahi-ui/Makefile.am b/avahi-ui/Makefile.am
new file mode 100644
index 0000000..5523325
--- /dev/null
+++ b/avahi-ui/Makefile.am
@@ -0,0 +1,113 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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) -DG_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -DGTK_DISABLE_DEPRECATED=1
+
+# This cool debug trap works on i386/gcc only
+AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
+
+pkglibdatadir=$(libdir)/avahi
+
+desktopdir = $(datadir)/applications
+desktop_DATA =
+desktop_DATA_in = $(desktop_DATA_in_in:.in.in=.in)
+desktop_DATA_in_in = bssh.desktop.in.in bvnc.desktop.in.in
+
+EXTRA_DIST = $(desktop_DATA_in_in)
+
+if HAVE_GTK2OR3
+AM_CFLAGS += -DGNOMELOCALEDIR=\"$(datadir)/locale\"
+if HAVE_DBUS
+if HAVE_GLIB
+
+avahiincludedir=$(includedir)/avahi-ui
+
+avahiinclude_HEADERS = \
+ avahi-ui.h
+
+lib_LTLIBRARIES =
+
+if HAVE_GTK
+lib_LTLIBRARIES += \
+ libavahi-ui.la
+endif
+
+if HAVE_GTK3
+lib_LTLIBRARIES += \
+ libavahi-ui-gtk3.la
+endif
+
+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) -version-info $(LIBAVAHI_UI_VERSION_INFO)
+
+libavahi_ui_gtk3_la_SOURCES = $(libavahi_ui_la_SOURCES)
+libavahi_ui_gtk3_la_CFLAGS = $(AM_CFLAGS) $(GTK30_CFLAGS)
+libavahi_ui_gtk3_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-client/libavahi-client.la ../avahi-glib/libavahi-glib.la $(GTK30_LIBS)
+libavahi_ui_gtk3_la_LDFLAGS = $(AM_LDFLAGS) -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=\"$(pkglibdatadir)/service-types.db\"
+libavahi_ui_la_LIBADD += -lgdbm
+
+libavahi_ui_gtk3_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdatadir)/service-types.db\"
+libavahi_ui_gtk3_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=\"$(pkglibdatadir)/service-types.db\"
+
+libavahi_ui_gtk3_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdatadir)/service-types.db\"
+endif
+
+bin_PROGRAMS = bssh
+desktop_DATA += bssh.desktop bvnc.desktop
+@INTLTOOL_DESKTOP_RULE@
+
+bssh_SOURCES = bssh.c
+
+if HAVE_GTK3
+bssh_CFLAGS = $(AM_CFLAGS) $(GTK30_CFLAGS)
+bssh_LDADD = $(AM_LDADD) $(GTK30_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la libavahi-ui-gtk3.la
+else
+bssh_CFLAGS = $(AM_CFLAGS) $(GTK20_CFLAGS)
+bssh_LDADD = $(AM_LDADD) $(GTK20_LIBS) ../avahi-client/libavahi-client.la ../avahi-common/libavahi-common.la libavahi-ui.la
+endif
+
+install-exec-local:
+ cd $(DESTDIR)/$(bindir) && \
+ rm -f bvnc bshell && \
+ $(LN_S) bssh bvnc && \
+ $(LN_S) bssh bshell
+
+bssh.desktop.in: bssh.desktop.in.in
+ $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
+
+bvnc.desktop.in: bvnc.desktop.in.in
+ $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
+
+endif # HAVE_GLIB
+endif
+endif
+
+@INTLTOOL_DESKTOP_RULE@
+
+CLEANFILES = $(desktop_DATA) $(desktop_DATA_in)
diff --git a/avahi-ui/avahi-ui.c b/avahi-ui/avahi-ui.c
new file mode 100644
index 0000000..92d765a
--- /dev/null
+++ b/avahi-ui/avahi-ui.c
@@ -0,0 +1,1477 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <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-common/i18n.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;
+ GHashTable *service_type_names;
+
+ 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;
+
+ gint forward_response_id;
+};
+
+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);
+
+static int get_default_response(GtkDialog *dlg) {
+ gint ret = GTK_RESPONSE_NONE;
+
+ if (gtk_window_get_default_widget(GTK_WINDOW(dlg)))
+ /* Use the response of the default widget, if possible */
+ ret = gtk_dialog_get_response_for_widget(dlg, gtk_window_get_default_widget(GTK_WINDOW(dlg)));
+
+ if (ret == GTK_RESPONSE_NONE) {
+ /* Fall back to finding the first positive response */
+ GList *children, *t;
+ gint bad = GTK_RESPONSE_NONE;
+
+ t = children = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_action_area(dlg)));
+
+ while (t) {
+ GtkWidget *child = t->data;
+
+ ret = gtk_dialog_get_response_for_widget(dlg, child);
+
+ if (ret == GTK_RESPONSE_ACCEPT ||
+ ret == GTK_RESPONSE_OK ||
+ ret == GTK_RESPONSE_YES ||
+ ret == GTK_RESPONSE_APPLY)
+ break;
+
+ if (ret != GTK_RESPONSE_NONE && bad == GTK_RESPONSE_NONE)
+ bad = ret;
+
+ t = t->next;
+ }
+
+ g_list_free (children);
+
+ /* Fall back to finding the first negative response */
+ if (ret == GTK_RESPONSE_NONE)
+ ret = bad;
+ }
+
+ return ret;
+}
+
+G_DEFINE_TYPE(AuiServiceDialog, aui_service_dialog, GTK_TYPE_DIALOG)
+
+static void aui_service_dialog_class_init(AuiServiceDialogClass *klass) {
+ GObjectClass *object_class;
+
+ avahi_init_i18n();
+
+ 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 the selected service automatically before returning"),
+ 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 the host name of the selected service automatically before returning"),
+ 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(
+ const gchar *title,
+ GtkWindow *parent,
+ const gchar *first_button_text,
+ va_list varargs) {
+
+ const gchar *button_text;
+ gint dr;
+
+ GtkWidget *w = (GtkWidget*)g_object_new(
+ AUI_TYPE_SERVICE_DIALOG,
+#if !GTK_CHECK_VERSION (2,21,8)
+ "has-separator", FALSE,
+#endif
+ "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 *);
+ }
+
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(w), GTK_RESPONSE_ACCEPT, FALSE);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(w), GTK_RESPONSE_OK, FALSE);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(w), GTK_RESPONSE_YES, FALSE);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(w), GTK_RESPONSE_APPLY, FALSE);
+
+ if ((dr = get_default_response(GTK_DIALOG(w))) != GTK_RESPONSE_NONE)
+ gtk_dialog_set_default_response(GTK_DIALOG(w), dr);
+
+ 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(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 G_GNUC_UNUSED,
+ AvahiIfIndex interface G_GNUC_UNUSED,
+ AvahiProtocol protocol G_GNUC_UNUSED,
+ 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 G_GNUC_UNUSED,
+ 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), d->priv->forward_response_id);
+
+ 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 G_GNUC_UNUSED,
+ 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 = NULL;
+ 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 (d->priv->service_type_names)
+ pretty_type = g_hash_table_lookup (d->priv->service_type_names, type);
+
+ if (!pretty_type) {
+#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 ? domain : _("n/a"),
+ 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 G_GNUC_UNUSED,
+ AvahiIfIndex interface G_GNUC_UNUSED,
+ AvahiProtocol protocol G_GNUC_UNUSED,
+ 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);
+ g_return_val_if_fail(AUI_IS_SERVICE_DIALOG(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), FALSE);
+ 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);
+
+ 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);
+
+ if (d->priv->service_list_store)
+ g_object_unref(d->priv->service_list_store);
+ if (d->priv->domain_list_store)
+ g_object_unref(d->priv->domain_list_store);
+ if (d->priv->service_type_names)
+ g_hash_table_unref (d->priv->service_type_names);
+
+ 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 G_GNUC_UNUSED, GtkTreePath *path G_GNUC_UNUSED, GtkTreeViewColumn *column G_GNUC_UNUSED, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+
+ gtk_dialog_response(GTK_DIALOG(d), get_default_response(GTK_DIALOG(d)));
+}
+
+static void service_selection_changed_callback(GtkTreeSelection *selection, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+ gboolean b;
+
+ b = gtk_tree_selection_get_selected(selection, NULL, NULL);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT, b);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(d), GTK_RESPONSE_OK, b);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(d), GTK_RESPONSE_YES, b);
+ gtk_dialog_set_response_sensitive(GTK_DIALOG(d), GTK_RESPONSE_APPLY, b);
+}
+
+static void response_callback(GtkDialog *dialog, gint response, gpointer user_data) {
+ AuiServiceDialog *d = AUI_SERVICE_DIALOG(user_data);
+
+ if ((response == GTK_RESPONSE_ACCEPT ||
+ response == GTK_RESPONSE_OK ||
+ response == GTK_RESPONSE_YES ||
+ response == GTK_RESPONSE_APPLY) &&
+ ((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);
+ d->priv->forward_response_id = response;
+
+ 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_get_window(GTK_WIDGET(dialog)), cursor);
+ g_object_unref(G_OBJECT(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 G_GNUC_UNUSED, GtkTreePath *path G_GNUC_UNUSED, GtkTreeViewColumn *column G_GNUC_UNUSED, 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 G_GNUC_UNUSED, 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 G_GNUC_UNUSED, 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 G_GNUC_UNUSED, 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"));
+#if !GTK_CHECK_VERSION(2,21,8)
+ gtk_dialog_set_has_separator(GTK_DIALOG(p->domain_dialog), FALSE);
+#endif
+
+ vbox = gtk_vbox_new(FALSE, 8);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
+ gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(p->domain_dialog))), vbox, TRUE, TRUE, 0);
+
+ p->domain_entry = gtk_entry_new();
+ gtk_entry_set_max_length(GTK_ENTRY(p->domain_entry), 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->forward_response_id = GTK_RESPONSE_NONE;
+
+ p->service_list_store = p->domain_list_store = NULL;
+ p->service_type_names = 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_get_content_area(GTK_DIALOG(d))), 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_get_action_area(GTK_DIALOG(d))), p->domain_button, FALSE, TRUE, 0);
+ gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(gtk_dialog_get_action_area(GTK_DIALOG(d))), p->domain_button, TRUE);
+ gtk_widget_show(p->domain_button);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(d), GTK_RESPONSE_ACCEPT);
+
+ 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;
+ 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_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(ap, type);
+ for (u = 1; (t = va_arg(ap, const char*)); u++)
+ d->priv->browse_service_types[u] = g_strdup(t);
+ va_end(ap);
+
+ if (d->priv->browse_service_types[0] && d->priv->browse_service_types[1]) {
+ /* Multiple service types, show type-column */
+ 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, show type-column */
+ 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_service_type_name(AuiServiceDialog *d, const gchar *type, const gchar *name) {
+ GtkTreeModel *m = NULL;
+ GtkTreeIter iter;
+
+ g_return_if_fail(AUI_IS_SERVICE_DIALOG(d));
+ g_return_if_fail(NULL != type);
+ g_return_if_fail(NULL != name);
+
+ if (NULL == d->priv->service_type_names)
+ d->priv->service_type_names = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+
+ g_hash_table_insert(d->priv->service_type_names, g_strdup(type), g_strdup(name));
+
+ if (d->priv->service_list_store)
+ m = GTK_TREE_MODEL(d->priv->service_list_store);
+
+ if (m && gtk_tree_model_get_iter_first(m, &iter)) {
+ do {
+ char *stored_type = NULL;
+
+ gtk_tree_model_get(m, &iter, SERVICE_COLUMN_TYPE, &stored_type, -1);
+
+ if (stored_type && g_str_equal(stored_type, type))
+ gtk_list_store_set(d->priv->service_list_store, &iter, SERVICE_COLUMN_PRETTY_TYPE, name, -1);
+ } while (gtk_tree_model_iter_next(m, &iter));
+ }
+}
+
+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..aae61dc
--- /dev/null
+++ b/avahi-ui/avahi-ui.h
@@ -0,0 +1,181 @@
+#ifndef fooavahiuihfoo
+#define fooavahiuihfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/gtk.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;
+
+/** @{ \name Construction */
+
+/** 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;
+
+/** \cond fulldocs */
+GtkWidget *aui_service_dialog_new_valist(
+ const gchar *title,
+ GtkWindow *parent,
+ const gchar *first_button_text,
+ va_list varargs);
+/** \endcond */
+
+/** @} */
+
+/** @{ \name Service types to browse for */
+
+/** 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);
+/** Overwrite the pretty name shown in the service type column. \since 0.6.22 */
+void aui_service_dialog_set_service_type_name(AuiServiceDialog *d, const gchar *type, const gchar *name);
+
+/** @} */
+
+/** @{ \name Domain to browse in */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Selected service item */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Resolved service information */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Resolving settings */
+
+/** 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);
+
+/** @} */
+
+/** @{ \name Address family */
+
+/** 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/bssh.c b/avahi-ui/bssh.c
new file mode 100644
index 0000000..491380f
--- /dev/null
+++ b/avahi-ui/bssh.c
@@ -0,0 +1,256 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <locale.h>
+#include <getopt.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-common/i18n.h>
+
+#include "avahi-ui.h"
+
+typedef enum {
+ COMMAND_HELP,
+ COMMAND_SSH,
+ COMMAND_VNC,
+ COMMAND_SHELL
+} Command;
+
+typedef struct Config {
+ char *domain;
+ Command command;
+} Config;
+
+static void help(FILE *f, const char *argv0) {
+ fprintf(f,
+ _("%s [options]\n\n"
+ " -h --help Show this help\n"
+ " -s --ssh Browse SSH servers\n"
+ " -v --vnc Browse VNC servers\n"
+ " -S --shell Browse both SSH and VNC\n"
+ " -d --domain=DOMAIN The domain to browse in\n"),
+ argv0);
+}
+
+static int parse_command_line(Config *c, int argc, char *argv[]) {
+ int o;
+
+ static const struct option long_options[] = {
+ { "help", no_argument, NULL, 'h' },
+ { "ssh", no_argument, NULL, 's' },
+ { "vnc", no_argument, NULL, 'v' },
+ { "shell", no_argument, NULL, 'S' },
+ { "domain", required_argument, NULL, 'd' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ while ((o = getopt_long(argc, argv, "hVd:svS", long_options, NULL)) >= 0) {
+
+ switch(o) {
+ case 'h':
+ c->command = COMMAND_HELP;
+ break;
+ case 's':
+ c->command = COMMAND_SSH;
+ break;
+ case 'v':
+ c->command = COMMAND_VNC;
+ break;
+ case 'S':
+ c->command = COMMAND_SHELL;
+ break;
+ case 'd':
+ avahi_free(c->domain);
+ c->domain = avahi_strdup(optarg);
+ break;
+ default:
+ return -1;
+ }
+ }
+
+ if (optind < argc) {
+ fprintf(stderr, _("Too many arguments\n"));
+ return -1;
+ }
+
+ return 0;
+}
+
+int main(int argc, char*argv[]) {
+ GtkWidget *d;
+ Config config;
+ const char *argv0;
+
+ avahi_init_i18n();
+ setlocale(LC_ALL, "");
+
+ if ((argv0 = strrchr(argv[0], '/')))
+ argv0++;
+ else
+ argv0 = argv[0];
+
+ if (g_str_has_suffix(argv[0], "bshell"))
+ config.command = COMMAND_SHELL;
+ else if (g_str_has_suffix(argv[0], "bvnc"))
+ config.command = COMMAND_VNC;
+ else
+ config.command = COMMAND_SSH;
+
+ /* defaults to local */
+ config.domain = NULL;
+
+ if (parse_command_line(&config, argc, argv) < 0) {
+ help(stderr, argv0);
+ return 1;
+ }
+
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ gtk_init(&argc, &argv);
+
+ switch (config.command) {
+ case COMMAND_HELP:
+ help(stdout, argv0);
+ return 0;
+ break;
+
+ case COMMAND_SHELL:
+ d = aui_service_dialog_new(_("Choose Shell 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", "_ssh._tcp", NULL);
+ aui_service_dialog_set_service_type_name(AUI_SERVICE_DIALOG(d), "_rfb._tcp", _("Desktop"));
+ aui_service_dialog_set_service_type_name(AUI_SERVICE_DIALOG(d), "_ssh._tcp", _("Terminal"));
+ break;
+
+ case COMMAND_VNC:
+ 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);
+ break;
+
+ case COMMAND_SSH:
+ 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);
+ break;
+ }
+
+ aui_service_dialog_set_domain (AUI_SERVICE_DIALOG(d), config.domain);
+ 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("vncviewer %s\n", p);
+ execlp("xvncviewer", "xvncviewer", p, NULL);
+ execlp("vncviewer", "vncviewer", 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"));
+ }
+
+ g_free(config.domain);
+
+ return 1;
+}
diff --git a/avahi-ui/bssh.desktop.in.in b/avahi-ui/bssh.desktop.in.in
new file mode 100644
index 0000000..a4e54fe
--- /dev/null
+++ b/avahi-ui/bssh.desktop.in.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+_Name=Avahi SSH Server Browser
+_Comment=Browse for Zeroconf-enabled SSH Servers
+Exec=@bindir@/bssh
+Terminal=false
+Type=Application
+Icon=network-wired
+Categories=GNOME;Network;
+StartupNotify=false
+GenericName=
diff --git a/avahi-ui/bvnc.desktop.in.in b/avahi-ui/bvnc.desktop.in.in
new file mode 100644
index 0000000..92b8247
--- /dev/null
+++ b/avahi-ui/bvnc.desktop.in.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+_Name=Avahi VNC Server Browser
+_Comment=Browse for Zeroconf-enabled VNC Servers
+Exec=@bindir@/bvnc
+Terminal=false
+Type=Application
+Icon=network-wired
+Categories=GNOME;Network;
+StartupNotify=false
+GenericName=
diff --git a/avahi-utils/.gitignore b/avahi-utils/.gitignore
new file mode 100644
index 0000000..fecb9e1
--- /dev/null
+++ b/avahi-utils/.gitignore
@@ -0,0 +1,10 @@
+*.o
+*.lo
+Makefile
+Makefile.in
+.deps
+.libs
+avahi-browse
+avahi-publish
+avahi-resolve
+avahi-set-host-name
diff --git a/avahi-utils/Makefile.am b/avahi-utils/Makefile.am
new file mode 100644
index 0000000..66c4cc6
--- /dev/null
+++ b/avahi-utils/Makefile.am
@@ -0,0 +1,66 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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")'
+
+pkglibdatadir=$(libdir)/avahi
+
+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=\"$(pkglibdatadir)/service-types.db\"
+avahi_browse_LDADD += -lgdbm
+endif
+
+if HAVE_DBM
+avahi_browse_SOURCES += stdb.h stdb.c
+avahi_browse_CFLAGS += -DDATABASE_FILE=\"$(pkglibdatadir)/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:
+ $(MKDIR_P) $(DESTDIR)/$(bindir) && \
+ 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/avahi-utils/avahi-browse.c b/avahi-utils/avahi-browse.c
new file mode 100644
index 0000000..4101895
--- /dev/null
+++ b/avahi-utils/avahi-browse.c
@@ -0,0 +1,879 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <ctype.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-common/i18n.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
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ , COMMAND_DUMP_STDB
+#endif
+} 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;
+ int parsable;
+#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 && !c->parsable) {
+ 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 && !c->parsable) {
+ 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 char *make_printable(const char *from, char *to) {
+ const char *f;
+ char *t;
+
+ for (f = from, t = to; *f; f++, t++)
+ *t = isprint(*f) ? *f : '_';
+
+ *t = 0;
+
+ return to;
+}
+
+static void print_service_line(Config *config, char c, AvahiIfIndex interface, AvahiProtocol protocol, const char *name, const char *type, const char *domain, int nl) {
+ char ifname[IF_NAMESIZE];
+
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ if (!config->no_db_lookup)
+ type = stdb_lookup(type);
+#endif
+
+ if (config->parsable) {
+ char sn[AVAHI_DOMAIN_NAME_MAX], *e = sn;
+ size_t l = sizeof(sn);
+
+ printf("%c;%s;%s;%s;%s;%s%s",
+ c,
+ interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : _("n/a"),
+ protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : _("n/a"),
+ avahi_escape_label(name, strlen(name), &e, &l), type, domain, nl ? "\n" : "");
+
+ } else {
+ char label[AVAHI_LABEL_MAX];
+ make_printable(name, label);
+
+ printf("%c %6s %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, label, 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, 0);
+
+ if (i->config->parsable)
+ printf(";%s;%s;%u;%s\n",
+ host_name,
+ address,
+ port,
+ t);
+ else
+ printf(" hostname = [%s]\n"
+ " address = [%s]\n"
+ " port = [%u]\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, 1);
+ 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, 1);
+ 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];
+
+ if (c->parsable)
+ printf("%c;%s;%s;%s\n",
+ event == AVAHI_BROWSER_NEW ? '+' : '-',
+ interface != AVAHI_IF_UNSPEC ? if_indextoname(interface, ifname) : "",
+ protocol != AVAHI_PROTO_UNSPEC ? avahi_proto_to_string(protocol) : "",
+ domain);
+ else
+ 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 && !config->parsable) {
+ 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) {
+ /* Translators: This is a column heading with abbreviations for
+ * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain */
+ fprintf(stderr, _("E Ifce Prot Domain\n"));
+ } else {
+ /* Translators: This is a column heading with abbreviations for
+ * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain */
+ 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 && !config->parsable)
+ 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"
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ "%s [options] -b\n"
+#endif
+ "\n",
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ argv0,
+#endif
+ argv0, argv0, argv0);
+
+ fprintf(f, "%s%s",
+ _(" -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"
+ " -p --parsable Output in parsable format\n"),
+#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")
+#else
+ ""
+#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' },
+ { "parsable", no_argument, NULL, 'p' },
+#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 }
+ };
+
+ 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 =
+ c->parsable = 0;
+ c->domain = c->stype = NULL;
+
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ c->no_db_lookup = 0;
+#endif
+
+ while ((o = getopt_long(argc, argv, "hVd:avtclrDfp"
+#if defined(HAVE_GDBM) || defined(HAVE_DBM)
+ "kb"
+#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;
+ case 'p':
+ c->parsable = 1;
+ break;
+#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:
+ 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;
+
+ avahi_init_i18n();
+ 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;
+
+#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
+ }
+
+
+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/avahi-utils/avahi-publish.c b/avahi-utils/avahi-publish.c
new file mode 100644
index 0000000..485de3a
--- /dev/null
+++ b/avahi-utils/avahi-publish.c
@@ -0,0 +1,429 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <locale.h>
+
+#include <avahi-common/simple-watch.h>
+#include <avahi-common/error.h>
+#include <avahi-common/malloc.h>
+#include <avahi-common/alternative.h>
+#include <avahi-common/i18n.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, no_reverse;
+ 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, config->no_reverse ? AVAHI_PUBLISH_NO_REVERSE : 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"
+ " -R --no-reverse Do not publish reverse entry with address\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-reverse", no_argument, NULL, 'R' },
+ { "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 = c->no_reverse = 0;
+ c->host = c->name = c->domain = c->stype = NULL;
+ c->port = 0;
+ c->txt = c->subtypes = NULL;
+
+ while ((o = getopt_long(argc, argv, "hVsavRd: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 'R':
+ c->no_reverse = 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:
+ 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;
+
+ avahi_init_i18n();
+ setlocale(LC_ALL, "");
+
+ 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/avahi-utils/avahi-resolve.c b/avahi-utils/avahi-resolve.c
new file mode 100644
index 0000000..bf1730b
--- /dev/null
+++ b/avahi-utils/avahi-resolve.c
@@ -0,0 +1,339 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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-common/i18n.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, "host-name") ? "[-n]" : "-n",
+ argv0, strstr(argv0, "address") ? "[-a]" : "-a");
+}
+
+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;
+
+ 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:
+ 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;
+
+ avahi_init_i18n();
+ setlocale(LC_ALL, "");
+
+ 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/avahi-utils/avahi-set-host-name.c b/avahi-utils/avahi-set-host-name.c
new file mode 100644
index 0000000..34fbbeb
--- /dev/null
+++ b/avahi-utils/avahi-set-host-name.c
@@ -0,0 +1,211 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 <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/i18n.h>
+#include <avahi-client/client.h>
+
+#include "sigint.h"
+
+typedef enum {
+ COMMAND_UNSPEC,
+ COMMAND_HELP,
+ COMMAND_VERSION
+} Command;
+
+typedef struct Config {
+ int verbose;
+ Command command;
+} Config;
+
+static AvahiSimplePoll *simple_poll = NULL;
+static AvahiClient *client = NULL;
+
+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] <new host name>\n\n"
+ " -h --help Show this help\n"
+ " -V --version Show version\n"
+ " -v --verbose Enable verbose mode\n"),
+ argv0);
+}
+
+static int parse_command_line(Config *c, int argc, char *argv[]) {
+ int o;
+
+ static const struct option long_options[] = {
+ { "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, 'V' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ assert(c);
+
+ c->command = COMMAND_UNSPEC;
+ c->verbose = 0;
+
+ while ((o = getopt_long(argc, argv, "hVv", long_options, NULL)) >= 0) {
+
+ switch(o) {
+ case 'h':
+ c->command = COMMAND_HELP;
+ break;
+ case 'V':
+ c->command = COMMAND_VERSION;
+ break;
+ case 'v':
+ c->verbose = 1;
+ break;
+ default:
+ return -1;
+ }
+ }
+
+ if (c->command == COMMAND_UNSPEC) {
+ if (optind != argc-1) {
+ fprintf(stderr, _("Invalid number of arguments, expecting exactly one.\n"));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int main(int argc, char *argv[]) {
+ int ret = 1, error;
+ Config config;
+ const char *argv0;
+
+ avahi_init_i18n();
+ setlocale(LC_ALL, "");
+
+ if ((argv0 = strrchr(argv[0], '/')))
+ argv0++;
+ else
+ argv0 = argv[0];
+
+ if (parse_command_line(&config, 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_UNSPEC:
+
+ 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);
+ }
+
+ if (avahi_client_set_host_name(client, argv[optind]) < 0) {
+ fprintf(stderr, _("Failed to create host name resolver: %s\n"), avahi_strerror(avahi_client_errno(client)));
+ goto fail;
+ }
+
+ if (config.verbose) {
+ const char *hn;
+
+ 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, _("Host name successfully changed to %s\n"), hn);
+ }
+
+ 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/avahi-utils/sigint.c b/avahi-utils/sigint.c
new file mode 100644
index 0000000..b726654
--- /dev/null
+++ b/avahi-utils/sigint.c
@@ -0,0 +1,144 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-utils/sigint.h b/avahi-utils/sigint.h
new file mode 100644
index 0000000..ae66fd4
--- /dev/null
+++ b/avahi-utils/sigint.h
@@ -0,0 +1,28 @@
+#ifndef foosigchfoo
+#define foosigchfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/avahi-utils/stdb.c b/avahi-utils/stdb.c
new file mode 100644
index 0000000..6602c97
--- /dev/null
+++ b/avahi-utils/stdb.c
@@ -0,0 +1,212 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 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;
+}
+
+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);
+
+ 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);
+#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
new file mode 100644
index 0000000..d1e1a91
--- /dev/null
+++ b/avahi-utils/stdb.h
@@ -0,0 +1,30 @@
+#ifndef foostdbhfoo
+#define foostdbhfoo
+
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+char *stdb_getent(void);
+void stdb_setent(void);
+
+#endif
diff --git a/bootstrap.sh b/bootstrap.sh
new file mode 100755
index 0000000..105bdbf
--- /dev/null
+++ b/bootstrap.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 "$@" --enable-qt3=no
diff --git a/common/.gitignore b/common/.gitignore
new file mode 100644
index 0000000..1012b7f
--- /dev/null
+++ b/common/.gitignore
@@ -0,0 +1,15 @@
+intltool.m4
+ChangeLog
+gettext.m4
+iconv.m4
+lib-ld.m4
+lib-link.m4
+lib-prefix.m4
+libtool.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+lt~obsolete.m4
+nls.m4
+po.m4
+progtest.m4
diff --git a/common/Makefile.am b/common/Makefile.am
new file mode 100644
index 0000000..7379965
--- /dev/null
+++ b/common/Makefile.am
@@ -0,0 +1,21 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 = gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 gettext.m4 iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 \
+ doxygen.m4 \
+ doxygen.mk \
+ python.m4
diff --git a/common/acx_pthread.m4 b/common/acx_pthread.m4
new file mode 100644
index 0000000..dcf6332
--- /dev/null
+++ b/common/acx_pthread.m4
@@ -0,0 +1,348 @@
+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/common/doxygen.m4 b/common/doxygen.m4
new file mode 100644
index 0000000..e9c56c2
--- /dev/null
+++ b/common/doxygen.m4
@@ -0,0 +1,312 @@
+# 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/common/doxygen.mk b/common/doxygen.mk
new file mode 100644
index 0000000..eca9237
--- /dev/null
+++ b/common/doxygen.mk
@@ -0,0 +1,187 @@
+# 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/common/gcc_stack_protect.m4 b/common/gcc_stack_protect.m4
new file mode 100644
index 0000000..2246849
--- /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 -Werror"
+ 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 -Werror"
+ 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/common/gcc_visibility.m4 b/common/gcc_visibility.m4
new file mode 100644
index 0000000..6b5a89d
--- /dev/null
+++ b/common/gcc_visibility.m4
@@ -0,0 +1,36 @@
+dnl @synopsis CHECK_VISIBILITY([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl @summary check for the gcc -fvisibility flag
+dnl
+
+AC_DEFUN([CHECK_VISIBILITY_HIDDEN], [
+ save_CFLAGS="$CFLAGS"
+ VISIBILITY_HIDDEN_CFLAGS=""
+ OPTION=-fvisibility=hidden
+
+ AC_MSG_CHECKING(for gcc $OPTION support)
+
+ CFLAGS="$CFLAGS $OPTION"
+
+ AC_TRY_COMPILE([
+ int default_vis __attribute__ ((visibility("default")));
+ int hidden_vis __attribute__ ((visibility("hidden")));
+ ],
+ [],
+ ac_visibility_supported=yes,
+ ac_visibility_supported=no)
+ AC_MSG_RESULT($ac_visibility_supported)
+
+ if test x"$ac_visibility_supported" = xyes; then
+ ifelse([$1],,AC_DEFINE(HAVE_GCC_VISIBILITY,1,[Define if you have gcc -fvisibility=hidden support ]),[$1])
+ VISIBILITY_HIDDEN_CFLAGS="$OPTION -DHAVE_VISIBILITY_HIDDEN"
+ AC_DEFINE(HAVE_VISIBILITY_HIDDEN,[],[Support for visibility hidden])
+ else
+ $2
+ :
+ fi
+
+ AC_SUBST(VISIBILITY_HIDDEN_CFLAGS)
+
+ CFLAGS="$save_CFLAGS"
+])
diff --git a/common/introspection.m4 b/common/introspection.m4
new file mode 100644
index 0000000..bfc52be
--- /dev/null
+++ b/common/introspection.m4
@@ -0,0 +1,94 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+ dnl enable/disable introspection
+ m4_if([$2], [require],
+ [dnl
+ enable_introspection=yes
+ ],[dnl
+ AC_ARG_ENABLE(introspection,
+ AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+ [Enable introspection for this build]),,
+ [enable_introspection=auto])
+ ])dnl
+
+ AC_MSG_CHECKING([for gobject-introspection])
+
+ dnl presence/version checking
+ AS_CASE([$enable_introspection],
+ [no], [dnl
+ found_introspection="no (disabled, use --enable-introspection to enable)"
+ ],dnl
+ [yes],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+ AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+ found_introspection=yes,
+ AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+ ],dnl
+ [auto],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+ ],dnl
+ [dnl
+ AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+ ])dnl
+
+ AC_MSG_RESULT([$found_introspection])
+
+ INTROSPECTION_SCANNER=
+ INTROSPECTION_COMPILER=
+ INTROSPECTION_GENERATE=
+ INTROSPECTION_GIRDIR=
+ INTROSPECTION_TYPELIBDIR=
+ if test "x$found_introspection" = "xyes"; then
+ INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+ INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+ INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+ INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+ INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+ INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+ INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+ fi
+ AC_SUBST(INTROSPECTION_SCANNER)
+ AC_SUBST(INTROSPECTION_COMPILER)
+ AC_SUBST(INTROSPECTION_GENERATE)
+ AC_SUBST(INTROSPECTION_GIRDIR)
+ AC_SUBST(INTROSPECTION_TYPELIBDIR)
+ AC_SUBST(INTROSPECTION_CFLAGS)
+ AC_SUBST(INTROSPECTION_LIBS)
+ AC_SUBST(INTROSPECTION_MAKEFILE)
+
+ AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
diff --git a/common/python.m4 b/common/python.m4
new file mode 100644
index 0000000..e1c5266
--- /dev/null
+++ b/common/python.m4
@@ -0,0 +1,62 @@
+## 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/configure.ac b/configure.ac
new file mode 100644
index 0000000..9debce2
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,1237 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.63)
+AC_INIT([avahi],[0.6.31],[avahi (at) lists (dot) freedesktop (dot) org])
+AC_CONFIG_SRCDIR([avahi-core/server.c])
+AC_CONFIG_MACRO_DIR([common])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
+
+AC_SUBST(PACKAGE_URL, [http://avahi.org/])
+
+AC_SUBST(LIBAVAHI_COMMON_VERSION_INFO, [8:3:5])
+AC_SUBST(LIBAVAHI_CORE_VERSION_INFO, [7:2:0])
+AC_SUBST(LIBAVAHI_CLIENT_VERSION_INFO, [5:9:2])
+AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:2:0])
+AC_SUBST(LIBAVAHI_GOBJECT_VERSION_INFO, [0:4:0])
+AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:2:0])
+AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:2:0])
+AC_SUBST(LIBAVAHI_UI_VERSION_INFO, [1:4:1])
+
+# 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])
+
+AC_CANONICAL_HOST
+
+AM_SILENT_RULES([yes])
+
+AC_CHECK_PROG([STOW], [stow], [yes], [no])
+
+AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
+ 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}"
+])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_CC_C99
+AC_PROG_CXX
+AM_PROG_CC_C_O
+AC_USE_SYSTEM_EXTENSIONS
+AC_PROG_CPP
+AC_PROG_MKDIR_P
+AC_PROG_INSTALL
+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 -Werror -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]))
+
+#
+# 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>
+#include <net/if_dl.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 lfs, debian, gentoo, archlinux, fedora, mandriva, darwin, netbsd, freebsd, slackware or none]))
+if test "z$with_distro" = "z"; then
+ if test "$cross_compiling" = yes; then
+ AC_MSG_WARN([Target distribution cannot be reliably detected when cross-compiling. You should specify it with --with-distro (see $0 --help for recognized distros)])
+ else
+ AC_CHECK_FILE(/etc/lfs-release,with_distro="lfs")
+ 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")
+ fi
+ 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
+ lfs|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_LFS, test x"$with_distro" = xlfs)
+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 -fdiagnostics-show-option -Wno-cast-qual -fno-strict-aliasing"
+
+ 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
+
+ # Solaris stuff
+ AC_SEARCH_LIBS([inet_ntop],[nsl])
+ AC_SEARCH_LIBS([recv],[socket])
+ AC_CHECK_DECL([CMSG_SPACE],,CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__", [[#include <sys/socket.h>]])
+
+# Checks for library functions.
+AC_FUNC_MEMCMP
+AC_FUNC_SELECT_ARGTYPES
+# avahi_malloc actually returns NULL for avahi_malloc(0), so it does not matter
+# whether libc's malloc does too. (Same for realloc.)
+#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)
+
+# check if gcc's -fvisibility is supported
+CHECK_VISIBILITY_HIDDEN
+
+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")
+
+have_inotify=no
+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
+
+have_kqueue=yes
+AC_CHECK_FUNCS([kqueue],,have_kqueue=no)
+
+AM_CONDITIONAL(HAVE_KQUEUE, test "x$have_kqueue" = "xyes")
+
+if test "x$have_kqueue" = "xyes" ; then
+ AC_DEFINE([HAVE_KQUEUE], 1, [Enable BSD kqueue() usage])
+fi
+
+IT_PROG_INTLTOOL([0.35.0])
+GETTEXT_PACKAGE=avahi
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
+AM_GLIB_GNU_GETTEXT
+
+avahilocaledir='${prefix}/${DATADIRNAME}/locale'
+AC_SUBST(avahilocaledir)
+
+# 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 GLIB's gobject 2.0
+#
+AC_ARG_ENABLE(gobject,
+ AS_HELP_STRING([--disable-gobject],[Disable use of GLib GObject]),
+ [case "${enableval}" in
+ yes) HAVE_GOBJECT=yes ;;
+ no) HAVE_GOBJECT=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-gobject) ;;
+ esac],
+ [HAVE_GOBJECT=yes])
+
+if test "x$HAVE_GOBJECT" = "xyes" ; then
+ PKG_CHECK_MODULES(GOBJECT, [ glib-2.0 >= 2.4.0 gobject-2.0 ])
+ AC_SUBST(GOBJECT_CFLAGS)
+ AC_SUBST(GOBJECT_LIBS)
+fi
+AM_CONDITIONAL(HAVE_GOBJECT, test "x$HAVE_GOBJECT" = "xyes")
+
+#
+# Introspection support.
+#
+GOBJECT_INTROSPECTION_CHECK([0.9.5])
+
+#
+# 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"
+ AC_PATH_PROGS(MOC_QT3, [moc-qt3 moc], no, [$QT3_PREFIX])
+ if test "$MOC_QT3" = no; then
+ AC_MSG_ERROR([Could not find QT3 moc])
+ fi
+ 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"
+ AC_PATH_PROGS(MOC_QT4, [moc-qt4 moc], no, [$QT4_PREFIX])
+ if test "$MOC_QT4" = no; then
+ AC_MSG_ERROR([Could not find QT4 moc])
+ fi
+ AC_SUBST(MOC_QT4)
+fi
+AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
+
+#
+# Check for GTK+ 2.0
+#
+AC_ARG_ENABLE(gtk,
+ AS_HELP_STRING([--disable-gtk],[Disable use of GTK+ 2]),
+ [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.14.0 ])
+ AC_SUBST(GTK20_CFLAGS)
+ AC_SUBST(GTK20_LIBS)
+fi
+AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
+
+#
+# Check for GTK+ 3.0
+#
+AC_ARG_ENABLE(gtk3,
+ AS_HELP_STRING([--disable-gtk3],[Disable use of GTK+ 3]),
+ [case "${enableval}" in
+ yes) HAVE_GTK3=yes ;;
+ no) HAVE_GTK3=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk3) ;;
+ esac],
+ [HAVE_GTK3=yes])
+
+if test "x$HAVE_GTK3" = "xyes" ; then
+ # Check for GTK 3.0
+ PKG_CHECK_MODULES(GTK30, [ gtk+-3.0 ])
+ AC_SUBST(GTK30_CFLAGS)
+ AC_SUBST(GTK30_LIBS)
+fi
+AM_CONDITIONAL(HAVE_GTK3, test "x$HAVE_GTK3" = "xyes")
+
+AM_CONDITIONAL(HAVE_GTK2OR3, test "x$HAVE_GTK3" = "xyes" -o "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_WITH(xml, AS_HELP_STRING([--with-xml=[expat/bsdxml/none]],[XML library to use]))
+use_expat=false
+use_bsdxml=false
+
+# See what we have
+AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
+AC_CHECK_LIB(bsdxml, XML_ParserCreate, [ AC_CHECK_HEADERS(bsdxml.h, have_bsdxml=true, have_bsdxml=false) ], have_bsdxml=false)
+
+if test "x$with_xml" = "xnone"; then
+ :
+elif test "x$with_xml" = "xexpat"; then
+ use_expat=true
+ if ! $have_expat ; then
+ AC_MSG_ERROR([*** libexpat requested, but not found ***])
+ fi
+elif test "x$with_xml" = "xbsdxml"; then
+ use_bsdxml=true
+ if ! $have_bsdxml ; then
+ AC_MSG_ERROR([*** libbsdxml requested, but not found ***])
+ fi
+elif test "x$with_xml" != "x"; then
+ AC_MSG_ERROR([*** unknown with-xml option ***])
+else
+ if $have_expat ; then
+ use_expat=true
+ elif $have_bsdxml ; then
+ use_bsdxml=true
+ else
+ AC_MSG_ERROR([*** neither libexpat not libbsdxml could be found ***])
+ fi
+fi
+
+if $use_expat; then
+ with_xml=expat
+ XML_CFLAGS=-DUSE_EXPAT_H
+ XML_LIBS=-lexpat
+fi
+if $use_bsdxml; then
+ with_xml=bsdxml
+ XML_CFLAGS=-DUSE_BSDXML_H
+ XML_LIBS=-lbsdxml
+fi
+AC_SUBST(XML_LIBS)
+AC_SUBST(XML_CFLAGS)
+
+if $use_expat || $use_bsdxml; then
+ HAVE_XML=yes
+fi
+
+AM_CONDITIONAL(HAVE_XML, test "x$HAVE_XML" = "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.14 ])
+ 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-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
+#
+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(ON)
+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"])
+
+#
+# systemd
+#
+AC_ARG_WITH([systemdsystemunitdir],
+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+ [],
+ [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+if test "x$with_systemdsystemunitdir" != xno; then
+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+
+# ==========================================================================
+AC_CONFIG_FILES([
+Makefile
+avahi-common/Makefile
+avahi-core/Makefile
+avahi-glib/Makefile
+avahi-gobject/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/lfs/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
+avahi-python/avahi-discover/Makefile
+examples/Makefile
+common/Makefile
+man/Makefile
+tests/Makefile
+service-type-database/Makefile
+avahi-sharp/Makefile
+avahi-ui-sharp/Makefile
+avahi-compat-libdns_sd/Makefile
+avahi-compat-howl/Makefile
+avahi-compat-howl/samples/Makefile
+avahi-autoipd/Makefile
+avahi-ui/Makefile
+po/Makefile.in
+])
+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 GLIB GObject: ${HAVE_GOBJECT}
+ Enable GObject Introspection: ${found_introspection}
+ Enable GTK 2.0: ${HAVE_GTK}
+ Enable GTK 3.0: ${HAVE_GTK3}
+ Enable D-Bus: ${HAVE_DBUS}
+ With XML: ${with_xml}
+ 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}
+ systemd unit directory: ${with_systemdsystemunitdir}
+"
+
+BUILD_DAEMON="no (You need libdaemon and expat/bsdxml!)"
+
+if test "x$HAVE_XML" = "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
+if test "x$ENABLE_AUTOIPD" = "xyes" -a "x$HAVE_LIBDAEMON" != "xyes" ; then
+ ENABLE_AUTOIPD="no (You need libdaemon!)"
+fi
+
+HAVE_GTK2OR3=no
+if test "x$HAVE_GTK" = "xyes" -o "x$HAVE_GTK3" = "xyes" ; then
+ HAVE_GTK2OR3=yes
+fi
+
+BUILD_UI="no"
+if test "x$HAVE_GTK2OR3" = "xyes" -a "x$BUILD_CLIENT" = "xyes" ; then
+ BUILD_UI="yes"
+fi
+
+BUILD_GOBJECT="no"
+if test "x$BUILD_CLIENT" = "xyes" -a "x$HAVE_GOBJECT" = "xyes" ; then
+ BUILD_GOBJECT="yes"
+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 libavahi-gobject: ${BUILD_GOBJECT}
+ Building avahi-discover-standalone: ${HAVE_GTK2OR3}
+ 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}
+ Building libavahi-ui: ${BUILD_UI}
+"
diff --git a/docs/API-CHANGES-0.6 b/docs/API-CHANGES-0.6
new file mode 100644
index 0000000..7c08446
--- /dev/null
+++ b/docs/API-CHANGES-0.6
@@ -0,0 +1,74 @@
+-*-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().
diff --git a/docs/AUTHORS b/docs/AUTHORS
new file mode 100644
index 0000000..06c5102
--- /dev/null
+++ b/docs/AUTHORS
@@ -0,0 +1,15 @@
+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>
+Sjoerd Simons
+Ted Percival
+Pedraig O'Briain
+Mathieu Drouet
diff --git a/docs/COMPAT-LAYERS b/docs/COMPAT-LAYERS
new file mode 100644
index 0000000..01b01f2
--- /dev/null
+++ b/docs/COMPAT-LAYERS
@@ -0,0 +1,16 @@
+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
diff --git a/docs/DBUS-API b/docs/DBUS-API
new file mode 100644
index 0000000..7a57aaa
--- /dev/null
+++ b/docs/DBUS-API
@@ -0,0 +1,13 @@
+* 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/docs/HACKING b/docs/HACKING
new file mode 100644
index 0000000..94a8366
--- /dev/null
+++ b/docs/HACKING
@@ -0,0 +1,79 @@
+Please comply with the following rules when hacking on Avahi:
+
+ * Before commiting check with "git st" that all built files are ignored
+ by git. To change the list of ignored files use
+
+ $VISUAL .gitignore
+
+ 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>
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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>
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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>
diff --git a/docs/INSTALL b/docs/INSTALL
new file mode 100644
index 0000000..419ac3e
--- /dev/null
+++ b/docs/INSTALL
@@ -0,0 +1,53 @@
+*** 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".
diff --git a/docs/MALLOC b/docs/MALLOC
new file mode 100644
index 0000000..7c452af
--- /dev/null
+++ b/docs/MALLOC
@@ -0,0 +1,8 @@
+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.
diff --git a/docs/NEWS b/docs/NEWS
new file mode 100644
index 0000000..3b05915
--- /dev/null
+++ b/docs/NEWS
@@ -0,0 +1,822 @@
+Avahi 0.6.31
+============
+
+This is a bugfix release.
+
+ * Fix compatibility with newest autoconf
+
+This release is backwards compatible with Avahi 0.6.x with x < 31.
+
+Avahi 0.6.30
+============
+
+This is a bugfix release.
+
+ * Make IPv6 work again
+ * i18n updates
+ * Minor other updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 30.
+
+Avahi 0.6.29
+============
+
+This is a bugfix release.
+
+ * Updates regarding systemd integration
+ * Compatibility with newer gtk3 and gobject introspection
+ * i18n updates
+ * Minor other updates
+ * Fix CVE-2011-1002, fixing the fix for CVE-2010-2244
+
+This release is backwards compatible with Avahi 0.6.x with x < 29.
+
+Avahi 0.6.28
+============
+
+This is a bugfix release.
+
+ * Updates regarding systemd integration
+ * Properly avoid bus activation on non-systemd systems
+ * Compatibility with newer gtk3 and gobject introspection
+ * i18n updates
+ * Minor other updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 28.
+
+Avahi 0.6.27
+============
+
+This is a bugfix release.
+
+ * Various updates to the systemd integration
+ * Reset all signal handlers and the signal mask on initialization
+ * Don't trip over SIGPIPE
+ * i18n updates
+ * Minor other updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 27.
+
+Avahi 0.6.26
+============
+
+This is mostly a bugfix release but also fixes a low risk security issue and
+adds a couple of minor new features.
+
+ * Fix CVE-2010-2244 (Ludwig Nussel)
+ * Support for Gtk+ 3 and Gtk+ Introspection
+ * Native systemd socket activation support
+ * Add systemd service files
+ * Add various resource control options, for traffic rate limiting as well as
+ cache size and D-Bus client object limits.
+ * i18n updates
+ * Minor other updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 26.
+
+Avahi 0.6.25
+============
+
+This is mostly a bugfix release but also fixes a low risk security issue.
+
+ * Fix CVE-2009-0758 (Rob Leslie)
+ * i18n updates
+ * Minor other updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 25.
+
+Avahi 0.6.24
+============
+
+This is mostly a bugfix release.
+
+ * A huge number of bug fixes, including a security relavant one (low
+ risk)
+ * Add two new configuration directives "allow-interfaces" and
+ "deny-interfaces" which can be used to make Avahi ignore certain
+ network interfaces or only use certain network interfaces.
+ * A lot of translation updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 24.
+
+Avahi 0.6.23
+============
+
+This is an bugfix release.
+
+ * A lot of translation updates
+ * Beef up bnvc quite a bit, including passing a domain to browse in
+ (patch from lkundrak)
+ * Increase numer of open files resource limit to 300 so that we can
+ deal with more clients simultaneously.
+ * Rework 'poof' algorithm a bit to reduce traffic load on noisy links.
+ * Build fixes
+ * Minor other updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 23.
+
+Please note that Avahi's SVN has been converted to GIT and is now
+available on git://git.0pointer.de/avahi.
+
+Avahi 0.6.22
+============
+
+This is an important bugfix release, and adds a couple of new
+features.
+
+ * i18n support
+ * Documentation and example code updates
+ * Support for registering the Avahi documentation in devhelp (needs
+ manual setup)
+ * Added a new component libavahi-gobject, which is a GObjectified
+ version of the Avahi API, contributed by Sjoerd Simons
+ * Major BSD compatibility improvements, contributed by "zml"
+ * avahi-ui: Allow overwriting of pretty service name by the
+ application
+ * Service type database updates
+ * Add new option --parsable to avahi-browse
+ * Minor other updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 22.
+
+Avahi 0.6.21
+============
+
+This is an important bugfix release.
+
+ * Make avahi-autoipd actually produce correct ARP packets
+ (Identified and patched by Pauline Yeung)
+ * Add FreeBSD kqueue support for watching /etc/avahi/services
+ (Contributed by Marcus Clarke)
+ * Use search domain from /etc/resolv.conf as additional browse
+ domains.
+ * No longer return a conflict error when two local applications
+ register identical RRs.
+ * Properly find alternative service/host names for very long names
+ * DNS name compression fix (Sjoerd Simons)
+ * Fedora init script order fix
+ * Several fixes to make gcc produce less warnings
+ * Minor documentation and build fixes
+
+This release is backwards compatible with Avahi 0.6.x with x < 21.
+
+Avahi 0.6.20
+============
+
+This is a bugfix release and contains a fix for a low risk security
+vulnerability.
+
+ * Fix a local DoS vulnerability, where an assert() could be hit by
+ passing empty TXT data over D-Bus to the Avahi daemon. (Low Risk)
+ * Solaris/dbm portability fixes
+ * Close all open file descriptors when daemonizing. Is generally
+ safer and fixes a few issues with broken init systems of several
+ distributions.
+ * avahi-autoipd: allow passing the path of the action script on the
+ command line.
+ * Several minor build fixes and other cleanups
+
+This release is backwards compatible with Avahi 0.6.x with x < 20.
+
+Avahi 0.6.19
+============
+
+This is a bugfix release, but also adds a new component "avahi-ui-sharp".
+
+ * Rename zssh/zvnc to bssh/bvnc to avoid a name collision with another
+ free software tool, on request of the Debian developers. I hope
+ this name change early in the life of bssh/bvnc won't be too
+ difficult to handle by the distributors.
+ * Add man page for bssh/bvnc
+ * avahi-ui: fix segfault when browsing in empty domains
+ * avahi-ui: allow GTK_RESPONSE_OK, _YES and _APPLY besides _ACCEPT as
+ positive dialog response codes
+ * avahi-ui-sharp: Add Mono/C# API wrapper for avahi-ui
+ * Don't pick the first and the last 256 IP addresses from the IPV4LL
+ range in avahi-autoipd, as required by RC3927 section 2.1
+ * No longer publish the Avahi service identification cookie anymore
+ by default. It was a bad idea in the first place. A better
+ replacement will hopefully be made available in Avahi eventually.
+ * Properly set umask before writing to /var/lib/avahi-autoipd
+ * Update .deskop files to work around KDE menu issue
+ * Various build fixes and other minor fixes and updates
+
+This release is backwards compatible with Avahi 0.6.x with x < 19.
+
+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 privileged 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
+ privileges 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 received.
+ * 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 its 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
diff --git a/docs/README b/docs/README
new file mode 100644
index 0000000..65d8d16
--- /dev/null
+++ b/docs/README
@@ -0,0 +1,47 @@
+Avahi is a free, LGPL mDNS/DNS-SD implementation.
+
+Copyright 2004-2009 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/
diff --git a/docs/TODO b/docs/TODO
new file mode 100644
index 0000000..9907ec6
--- /dev/null
+++ b/docs/TODO
@@ -0,0 +1,106 @@
+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/docs/avahi-favicon.png b/docs/avahi-favicon.png
new file mode 100644
index 0000000..c39fb1b
--- /dev/null
+++ b/docs/avahi-favicon.png
Binary files differ
diff --git a/docs/avahi-logo.png b/docs/avahi-logo.png
new file mode 100644
index 0000000..fa17260
--- /dev/null
+++ b/docs/avahi-logo.png
Binary files differ
diff --git a/docs/avahi-poll.dia b/docs/avahi-poll.dia
new file mode 100644
index 0000000..eae82e2
--- /dev/null
+++ b/docs/avahi-poll.dia
@@ -0,0 +1,1042 @@
+<?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/docs/avahi-trac.png b/docs/avahi-trac.png
new file mode 100644
index 0000000..1ff44c7
--- /dev/null
+++ b/docs/avahi-trac.png
Binary files differ
diff --git a/docs/mdns-paket.dia b/docs/mdns-paket.dia
new file mode 100644
index 0000000..db3cf81
--- /dev/null
+++ b/docs/mdns-paket.dia
@@ -0,0 +1,1243 @@
+<?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="Standard - Box" version="0" id="O0">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,3"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,2.95;19.05,30.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="3,3"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="27"/>
+ </dia:attribute>
+ <dia:attribute name="show_background">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Box" version="0" id="O1">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,3"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,2.95;19.05,5.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="3,3"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O2">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,4.95;19.05,7.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="3,5"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O3">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,7"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,6.95;19.05,9.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="3,7"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O4">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,9"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,8.95;19.05,11.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="3,9"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O5">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,11"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,10.95;19.05,13.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="3,11"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O6">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,13"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,12.95;19.05,15.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="3,13"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Text" version="0" id="O7">
+ <dia:attribute name="obj_pos">
+ <dia:point val="10.7338,4.06625"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="10.7338,3.49875;11.3013,4.50125"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#ID#</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.7338,4.06625"/>
+ </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="O8">
+ <dia:attribute name="obj_pos">
+ <dia:point val="10.2413,6.075"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="10.2413,5.5075;11.7588,6.51"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Flags#</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.2413,6.075"/>
+ </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="O9">
+ <dia:attribute name="obj_pos">
+ <dia:point val="6.24125,8.06625"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="6.24125,7.49875;15.8087,8.50125"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#QDCOUNT - Anzahl der RR-Queries#</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.24125,8.06625"/>
+ </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="O10">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3.51625,10.0663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="3.51625,9.49875;18.4838,10.5013"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#ANCOUNT - Anzahl der bereits bekannten Antwort-RRs#</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="3.51625,10.0663"/>
+ </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="O11">
+ <dia:attribute name="obj_pos">
+ <dia:point val="4.64125,12.0663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="4.64125,11.4987;17.3588,12.5013"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#NSCOUNT - Anzahl der zu registrierenden RRs#</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="4.64125,12.0663"/>
+ </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="O12">
+ <dia:attribute name="obj_pos">
+ <dia:point val="9.09125,14.0663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="9.09125,13.4987;12.9087,14.5013"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#ARCOUNT = 0#</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.09125,14.0663"/>
+ </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 - Box" version="0" id="O13">
+ <dia:attribute name="obj_pos">
+ <dia:point val="5,15"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="4.95,14.95;19.05,18.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="5,15"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </dia:attribute>
+ <dia:attribute name="show_background">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Text" version="0" id="O14">
+ <dia:attribute name="obj_pos">
+ <dia:point val="6,19"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="6,17.6075;7.3925,20.085"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#...#</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="2"/>
+ </dia:attribute>
+ <dia:attribute name="pos">
+ <dia:point val="6,19"/>
+ </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="O15">
+ <dia:attribute name="obj_pos">
+ <dia:point val="10.1163,2"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="10.1163,1.4325;11.8838,2.435"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#16bits#</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.1163,2"/>
+ </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="O16">
+ <dia:attribute name="obj_pos">
+ <dia:point val="7,16"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="6.9825,15.4325;7.15,16.435"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string># #</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,16"/>
+ </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="10.4413,16.5663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="10.4413,15.9987;13.6088,17.0012"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#RR-Queries#</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.4413,16.5663"/>
+ </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 - Box" version="0" id="O18">
+ <dia:attribute name="obj_pos">
+ <dia:point val="5,20"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="4.95,19.95;19.05,23.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="5,20"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </dia:attribute>
+ <dia:attribute name="show_background">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Text" version="0" id="O19">
+ <dia:attribute name="obj_pos">
+ <dia:point val="8.09125,21.5663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="8.09125,20.9988;16.4587,22.0012"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Bereits bekannte Antwort-RRs#</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="8.09125,21.5663"/>
+ </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="6,24"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="6,22.6075;7.3925,25.085"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#...#</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="2"/>
+ </dia:attribute>
+ <dia:attribute name="pos">
+ <dia:point val="6,24"/>
+ </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 - Line" version="0" id="O21">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,20"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,19.95;19.05,20.05"/>
+ </dia:attribute>
+ <dia:attribute name="conn_endpoints">
+ <dia:point val="3,20"/>
+ <dia:point val="19,20"/>
+ </dia:attribute>
+ <dia:attribute name="numcp">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="1" to="O18" connection="2"/>
+ </dia:connections>
+ </dia:object>
+ <dia:object type="Standard - Box" version="0" id="O22">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,3"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.95,2.95;38.05,30.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,3"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="27"/>
+ </dia:attribute>
+ <dia:attribute name="show_background">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Box" version="0" id="O23">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,3"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.95,2.95;38.05,5.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,3"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O24">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.95,4.95;38.05,7.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,5"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O25">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,7"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.95,6.95;38.05,9.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,7"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O26">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,9"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.95,8.95;38.05,11.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,9"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O27">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,11"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.95,10.95;38.05,13.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,11"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O28">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,13"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.95,12.95;38.05,15.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,13"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="16"/>
+ </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:object>
+ <dia:object type="Standard - Text" version="0" id="O29">
+ <dia:attribute name="obj_pos">
+ <dia:point val="29.7338,4.06625"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="29.7338,3.51625;30.2838,4.46625"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#ID#</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.7338,4.06625"/>
+ </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="O30">
+ <dia:attribute name="obj_pos">
+ <dia:point val="29.2413,6.075"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="29.2413,5.525;30.7413,6.475"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Flags#</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.2413,6.075"/>
+ </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="O31">
+ <dia:attribute name="obj_pos">
+ <dia:point val="28.0162,8.06625"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="28.0162,7.49875;31.9838,8.50125"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#QDCOUNT = 0#</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.0162,8.06625"/>
+ </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="O32">
+ <dia:attribute name="obj_pos">
+ <dia:point val="25.1412,10.0663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="25.1412,9.49875;34.8588,10.5013"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#ANCOUNT - Anzahl der Antwort-RRs#</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="25.1412,10.0663"/>
+ </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="O33">
+ <dia:attribute name="obj_pos">
+ <dia:point val="28.0412,12.0663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="28.0412,11.5162;31.9412,12.4663"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#NSCOUNT = 0#</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.0412,12.0663"/>
+ </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="O34">
+ <dia:attribute name="obj_pos">
+ <dia:point val="28.0913,14.0663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="28.0913,13.5162;31.8913,14.4663"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#ARCOUNT = 0#</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.0913,14.0663"/>
+ </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 - Box" version="0" id="O35">
+ <dia:attribute name="obj_pos">
+ <dia:point val="24,15"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="23.95,14.95;38.05,18.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="24,15"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </dia:attribute>
+ <dia:attribute name="show_background">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Text" version="0" id="O36">
+ <dia:attribute name="obj_pos">
+ <dia:point val="25,19"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="24.9575,17.6075;26.35,20.085"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#...#</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="2"/>
+ </dia:attribute>
+ <dia:attribute name="pos">
+ <dia:point val="25,19"/>
+ </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="O37">
+ <dia:attribute name="obj_pos">
+ <dia:point val="29.1163,2"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="29.1163,1.45;30.8663,2.4"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#16bits#</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.1163,2"/>
+ </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="O38">
+ <dia:attribute name="obj_pos">
+ <dia:point val="26,16"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="26,15.45;26.15,16.4"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string># #</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,16"/>
+ </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="O39">
+ <dia:attribute name="obj_pos">
+ <dia:point val="29.4413,16.5663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="29.4413,15.9987;32.8588,17.0012"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Antwort-RRs#</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.4413,16.5663"/>
+ </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 - Box" version="0" id="O40">
+ <dia:attribute name="obj_pos">
+ <dia:point val="5,25"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="4.95,24.95;19.05,28.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="5,25"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </dia:attribute>
+ <dia:attribute name="show_background">
+ <dia:boolean val="true"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Text" version="0" id="O41">
+ <dia:attribute name="obj_pos">
+ <dia:point val="8.09125,26.5663"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="8.09125,25.9988;14.3087,27.0012"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Zu registrierende RRs#</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="8.09125,26.5663"/>
+ </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="O42">
+ <dia:attribute name="obj_pos">
+ <dia:point val="6,29"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="6,27.6075;7.3925,30.085"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#...#</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="2"/>
+ </dia:attribute>
+ <dia:attribute name="pos">
+ <dia:point val="6,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 - Line" version="0" id="O43">
+ <dia:attribute name="obj_pos">
+ <dia:point val="3,25"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="2.95,24.95;19.05,25.05"/>
+ </dia:attribute>
+ <dia:attribute name="conn_endpoints">
+ <dia:point val="3,25"/>
+ <dia:point val="19,25"/>
+ </dia:attribute>
+ <dia:attribute name="numcp">
+ <dia:int val="1"/>
+ </dia:attribute>
+ <dia:connections>
+ <dia:connection handle="1" to="O40" connection="2"/>
+ </dia:connections>
+ </dia:object>
+ <dia:object type="Standard - Text" version="0" id="O44">
+ <dia:attribute name="obj_pos">
+ <dia:point val="9.09125,31"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="9.09125,30.4325;12.9087,31.435"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Query-Pakete#</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.09125,31"/>
+ </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="O45">
+ <dia:attribute name="obj_pos">
+ <dia:point val="27.8663,31"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="27.8663,30.4325;32.1337,31.435"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Antwort-Pakete#</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="27.8663,31"/>
+ </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/docs/multicast.dia b/docs/multicast.dia
new file mode 100644
index 0000000..7a1c5be
--- /dev/null
+++ b/docs/multicast.dia
@@ -0,0 +1,651 @@
+<?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="Standard - Ellipse" version="0" id="O0">
+ <dia:attribute name="obj_pos">
+ <dia:point val="6,6"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="5.95,5.95;31.05,31.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="6,6"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="25"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="25"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Ellipse" version="0" id="O1">
+ <dia:attribute name="obj_pos">
+ <dia:point val="15,14"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="14.95,13.95;30.05,29.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="15,14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="15"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="15"/>
+ </dia:attribute>
+ </dia:object>
+ <dia:object type="Standard - Text" version="0" id="O2">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22.4913,25"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="17.9163,24.4325;27.0838,27.035"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Lokale
+mDNS/DNS-SD-Multicast-Gruppe
+224.0.0.251#</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="22.4913,25"/>
+ </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 - Text" version="0" id="O3">
+ <dia:attribute name="obj_pos">
+ <dia:point val="13,9"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="13,8.4325;18.6675,9.435"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#Gesamtes Netzwerk#</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,9"/>
+ </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="Network - General Computer (Tower)" version="0" id="O4">
+ <dia:attribute name="obj_pos">
+ <dia:point val="17,18"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="16.9919,17.96;18.2988,21.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="17,18"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105268"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.227272727272728"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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="17.6447,20.8359"/>
+ </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: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="Network - General Computer (Tower)" version="0" id="O5">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,16"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="21.9919,15.96;23.2988,19.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="22,16"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105268"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.227272727272728"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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="22.6447,18.8359"/>
+ </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: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="Network - General Computer (Tower)" version="0" id="O6">
+ <dia:attribute name="obj_pos">
+ <dia:point val="26,19"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="25.9919,18.96;27.2988,22.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="26,19"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105268"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.227272727272728"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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.6447,21.8359"/>
+ </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: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="Network - General Computer (Tower)" version="0" id="O7">
+ <dia:attribute name="obj_pos">
+ <dia:point val="10,13"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="9.99191,12.96;11.2988,16.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="10,13"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105259"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.2272727272727262"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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.6447,15.8359"/>
+ </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: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="Network - General Computer (Tower)" version="0" id="O8">
+ <dia:attribute name="obj_pos">
+ <dia:point val="10,20"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="9.99191,19.96;11.2988,23.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="10,20"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105259"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.2272727272727262"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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.6447,22.8359"/>
+ </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: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="Network - General Computer (Tower)" version="0" id="O9">
+ <dia:attribute name="obj_pos">
+ <dia:point val="16,11"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="15.9919,10.96;17.2988,14.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="16,11"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105259"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.2272727272727262"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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.6447,13.8359"/>
+ </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: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="Network - General Computer (Tower)" version="0" id="O10">
+ <dia:attribute name="obj_pos">
+ <dia:point val="25,10"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="24.9919,9.96;26.2988,13.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="25,10"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105259"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.2272727272727262"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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="25.6447,12.8359"/>
+ </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: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="Network - General Computer (Tower)" version="0" id="O11">
+ <dia:attribute name="obj_pos">
+ <dia:point val="20,20"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="19.9919,19.96;21.2988,23.2709"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="20,20"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="1.2894736842105268"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="2.227272727272728"/>
+ </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="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>##</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.6447,22.8359"/>
+ </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:attribute name="flip_horizontal">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ <dia:attribute name="flip_vertical">
+ <dia:boolean val="false"/>
+ </dia:attribute>
+ </dia:object>
+ </dia:layer>
+</dia:diagram>
diff --git a/docs/overview.dia b/docs/overview.dia
new file mode 100644
index 0000000..744f04c
--- /dev/null
+++ b/docs/overview.dia
@@ -0,0 +1,1495 @@
+<?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/docs/server-states.dia b/docs/server-states.dia
new file mode 100644
index 0000000..35fe437
--- /dev/null
+++ b/docs/server-states.dia
@@ -0,0 +1,975 @@
+<?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/docs/socket-auto-port.c b/docs/socket-auto-port.c
new file mode 100644
index 0000000..3c68c70
--- /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/docs/utilities-avahi1.svg b/docs/utilities-avahi1.svg
new file mode 100644
index 0000000..c39457a
--- /dev/null
+++ b/docs/utilities-avahi1.svg
@@ -0,0 +1,1745 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
+<svg:svg
+ xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
+ xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
+ xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
+ xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/"
+ xmlns:xap="http://ns.adobe.com/xap/1.0/"
+ xmlns:x="adobe:ns:meta/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Calque_1"
+ width="37.982"
+ height="43.529"
+ viewBox="0 0 37.982 43.529"
+ overflow="visible"
+ enable-background="new 0 0 37.982 43.529"
+ xml:space="preserve"
+ sodipodi:version="0.32"
+ inkscape:version="0.42.2"
+ sodipodi:docname="utilities-avahi1.svg"
+ sodipodi:docbase="/Users/izo/Desktop/spip_tango/Avahi ICONS"><svg:defs
+ id="defs266" /><sodipodi:namedview
+ inkscape:window-height="507"
+ inkscape:window-width="701"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="1.0000000"
+ inkscape:cx="23.353073"
+ inkscape:cy="40.129160"
+ inkscape:window-x="94"
+ inkscape:window-y="90"
+ inkscape:current-layer="g34" />
+<svg:metadata
+ id="metadata3"><xpacket />
+<x:xmpmeta
+ x:xmptk="3.1.1-111">
+
+<svg:metadata
+ id="metadata268"><rdf:RDF>
+ <rdf:Description
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+ <rdf:Description
+ rdf:about="">
+ <xap:CreatorTool>Adobe Illustrator CS2</xap:CreatorTool>
+ <xap:CreateDate>2005-11-18T17:59:54+01:00</xap:CreateDate>
+ <xap:ModifyDate>2005-11-18T17:59:54+01:00</xap:ModifyDate>
+ <xap:MetadataDate>2005-11-18T17:59:54+01:00</xap:MetadataDate>
+ <xap:Thumbnails>
+ <rdf:Alt>
+ <rdf:li
+ rdf:parseType="Resource">
+ <xapGImg:width>224</xapGImg:width>
+ <xapGImg:height>256</xapGImg:height>
+ <xapGImg:format>JPEG</xapGImg:format>
+ <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
+AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAADgAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FVK7u7Wztp
+Lq7mS3toVLzTysERFHUszUAGAkDcpAt4d56/5ybsrSSSy8o2q3si1U6lchlhr/xXEOLv82K/IjNf
+m14G0XMx6QneTx7W/wA2fzF1mRmvNeukRj/c2zm2jp2HGHgD9NcwJ6nJLmXKjhgOiQDX9dEnqDUr
+oSUpz9aStBvSvLK+OXe2cI7mT+Xfzm/MfQpVaDWJryFftW18TcxkDt+8JdR/qMMuhqskerVLBCXR
+6Nc/85WXx0+NbXy/Euo8f30ss7NCGHdY1VWofd9vfMo9omthu0DRi+bDdW/5yG/M+/ZvSv4dPjbr
+HaQRgD5NKJXH/BZRLW5D1ptjpYBi99+Ynny+JN15h1Bwf2Bcyqnf9hWC9/DKTnmeZLaMUR0CTz6p
+qc9fXu5peQ4tzkdqjwNTlZkSyoIXAlUiuJ4STDI8ZbrwYrX7sQVpMrTzZ5qsyDaazfW5FADFczJ0
+2H2WGTGSQ5EsTCJ6Mh0386vzQ0+no6/PKo6rciO4r9Myu345bHVZB1azp4HozTRP+cpPNVuyrrGl
+2l/EOrwl7aT7/wB6n/CjL4doSHMW1S0cehZNrP8AzlNoo0cPo2lTvq77GK74rBGf5i0bFpB7fD9G
+XS7QFbDdrjoze52eP+YPzd/MTXZGN3rdxDCx2trRvq0QH8tIuJYf6xOYM9TklzLlRwQj0Y6Nf10S
+eoNRuhIRQuJpK0HavLKuOXe2cI7mR6F+cH5kaLIrW2uXM8Y6wXjfWkI8KTcyo/1SMthqckerXLBA
+9HtHkP8A5yV0bU5I7HzTAulXb0UX0RLWjE/zBqvF9JYeJGZ+HXg7S2cTJpCN47vaYpYpYklidZIp
+FDRyKQysrCoII2IIzYOGuxV2KuxV2KuxV2KuxVD6lqNlpthcahfTLb2dqjSzzOaKqKKk4JSAFlIB
+JoPkX81/zd1XztftbW7PaeXYW/0ayrQyFTtLPTqx7L0X51J0mp1JyH+i7TDgEB5sKsNJuLv4x8EP
++/D3+Q75rsucQ97m48Jl7kyfT9Nsouco5U7vuSfYdMxhlnM0G844QG6U3V6stViiWOP2A5H6cy4Y
+65m3HnkvkFK3tri4f04I2kfwUVycpiIslrAtO7PybqEoBndYAe322/Db8cxJ62I5C2wYim9v5L01
+KGVpJT3qeI/Df8cx5ayZ5bMxjCPi8t6RGNrVD/rfF+uuUnPM9Sy4AiBpNgv2beMfJRkDOR6lNONh
+bf76T/gRgs96VCTTrU9YUP8AsRg45DqikJLo+nt1to/+BA/Vk46iY6lHCEDP5d01h8KFD4qx/jXL
+46uYYmAS6fyz19Gbf+Vx/Ef0zIjrO8MDjS260y9tqmSM8B+2u4/DMmGaMuRYGJCGRuLBqA07EVGW
+EWgGk4sbiyuKRvGiSdlIFD8sxMsJR3vZyscoy2pEy6LZyjZfTbxX+mVR1Eh5szgiUnvtMubQ1cco
+z0kHT6fDMvHmE/e42TEYvR/ye/ObUPKV5DpOrStceWZWoytVntSx/vIup4V3ZPpG/XZabVGBo/S4
+OfAJbjm+r7e4gubeO4t5FmgmUSRSoQysjCqspHUEZuQbdYQqYVdirsVdirsVdir5x/5yX/MCS4v4
+/JthKRbWoWfVSp+3MwDRRH2RaMfcjuuarX5rPAPi7DSYtuIvG9F0o3sxeQf6PGfi/wAo/wAv9c0u
+pz8Aoc3Z4MXEd+TIb24gsrb1GFFX4UQbVPYDNfjgZmnNnIRDEru7mupjJIf9VR0A8Bm2x4xEUHXT
+mZGynGk+WTKgub8+lABy9OtCR4sT9kZiZtXvww3KYw6lWufOeg6Yv1fT4frBX/fdEjr/AK5BJ+dM
+ycHYubL6sh4ftLj5NfCO0d0ub8ytS5fBaQBewPMn7wRmwHYGLrKX2ON/KU+4Iuy/M8g0vbEFe7wv
+Qj/Yt/zVlOXsDb0S+f6/2M4dp/zh8mV6Z5i0/VIy9k6uR9uM1Dr812zQarTZcBqYr7vm7PDlhkHp
+KMM8vgB9GYnG38Cm003t92HiXhUXnm9vuyQKOFQe5k7qPxyXCCiku1DW7GxTldNwr9lRux+S5laf
+R5MpqAtozZY4xcixu789AsRa2vw9nlbf/gV/rm8w9g7euXy/H6HWz7S/mhDL53vq/FbxFe4HIfxO
+XHsLH0lL7Gsdoz7gu/S2jX5pIhsLg9H+1ET70pT7spn2dmxfSeMfIt8NbCXP0lTmglgcK/fdWU1B
+HYqR1GY4kC5Kd6NqnqkW85/e/sOf2vY++YOowVuOTmYct7FOmhSVDHIoZGFGU98wxIg2HKMQRuxT
+V9MaxuKCphfeNj+IPyza4M3GPN12bFwHye+f84z/AJgS3EM/k7UJSz26m40lmNT6df3sP+xJ5L7c
+uwzd6DNfoPwdVq8X8Qe9ZsnCdirsVdirsVUL68hsrG4vZzSC2ieaU+CRqWb8BgJoWkCy+DdY1S71
+fVrzU7o8rq+mknl7/FIxYgewrQZzc5WSS7qMaFBl9hZraWUcPQqtXPix3Y5ocuTjkS7jHDhjTE9Y
+1A3l2Sp/cx/DEPbufpzbafFwR83XZsnFLyTXy3oy0F9cgU6wq3QAftn+GYur1B+iP48lhHqUq1PU
+dU8z6vHo2kKzxSPwijXb1COrueyild+2+b7Q6LHpMfiZPq6+XkHVajPLNLgjy+96/wCR/wAiNDs4
+Y59aUajemhZWr6KnwVP2vm33DNTqu2smQ1A8Eft+fT4ORj0kID1eqX2PTrXydodvEI4bCCNB0VY1
+A+6ma05SdySfi2eJXJKPMH5V+TtXhdbvS4RI1f38SiOUHx5pQ5kYdblxn0yP6PkxkIT5gPBPzA/L
+DWvI9yuraZO8+lhwFuRtLCWNAsoGxB6cuh6EePRaTXY9VE48gF93Q+5wsmGWI8cDsnHlXXYtb0/1
+CAl3DRbmMdKnow9mzlu09AdNkrnA8j+j4O70epGWN/xDmmzxZrhJyqQ8kWWAopIvMmrxaTZ+oQGn
+kJWCM9z3J9hmz7O0Z1E6/hHMuJq9QMUb69EB5B/LXWfO922o30zwaWHpJc0q8pB3SEHYAdK9B750
+uq1uPSR8OA9Xd3e902LDLMeKR2e/eXfyq8naPEi2umRNKtK3EyiWUnx5vUj6M5zNrsuT6pH7h8g5
+sYwhyATu48n6JPEY5bCB0PVWjUg/RTMbxSNwT82XiPNvO/5DaBfQST6Mg02+FSoSvosfBo+gH+rT
+6c2Ol7Zy4j6jxx+35/rap6aGTl6T9jwuWLUNE1CXRdZjaIRtRlO5jJ6SIe6n26jN9mxQ1EPFxfV9
+/kfxs4uLLLFLhlyVJEkgmKk0dDUMPvBBzUg2HZsv0e9F7aK5/vU+GUe47/Tmo1GPglXR2eGfFG1+
+sWQutPlSlXQc4/mu/wCPTBp8nDMJzQ4olI/JevyeXvNmlayjFRZXMcktO8RPGVf9lGWGb7FPhkC6
+jJHiiQ+6wQQCDUHcEZ0TpXYq7FXYq7FWM/mdI8f5d+ZGQ0b9HXK19miZT+BynUf3cvc2YfrHvfFG
+nqGv7ZW6NKgPyLDObymoH3F3eMeoe9lnmK6+raa4U0eY+mvyP2vwzVaSHFP3Ox1M+GPvYtplmby9
+jg/YJq5/yRuc2mbJwRJdbEWWQeb702OgtHF8LXBEC07KQS3/AAoplHY2DxM9n+Hf49GGuycOOh12
+Zn+QnlSKDSn12ZAbm+YxwMRusMbUNP8AWcb/ACGT9odYTMYxyj9/9jToMXDDi6n7mY/mL5+u9BMO
+i6JxGrzxiae5ZQ4toSSqkKQVaRyp4g7ACpHTMfsnQjKDkyfQPtLXqMpuhzePaw2p3PO6vr+6uZ6b
+yzTSO3yFTsPYbZujq4Y/TGIA9zCOlMuav5L/ADa82eVr6Nb65m1XRCQs9ncOZHROnKB3JZSo/Zrx
+P4inJhxagVQjPoR+lZQlj8w+h9Rh0vXNEDgLdabqMAZaj4ZIZlqDvvupzm/Elin3SiftDl4yJDyL
+5c0+1n8p/mJLpEjExesbUk7co5aGFj96nOs7QiNVouMcwOL4jn+kOHpScOfh86+fJ6XJFnCCT0lI
+WWPLIliXnF/azeZvPkGkRsQhmW1DDfiqmsr09viP0Z3PZ0Rp9JxnmRxfq/Q87qicufh+H631Fo1p
+pWiaKKBbTTdPgLMf2Y4olqzH5AVOclLLLLPvlI/aXPyVEUOQeAedvzf80+aNQli0q5m0nQlJW3t4
+HMcsi9Oc8iGpLfyA8R036npcelxaaPqAnk+z4OvAlkPcEHobanBwubS/ura4AoJoZ5Ef3FQ248Qd
+sl+dhP0yiD8GZ0pHJ7L+XH5gXuszSaFrzK+qRxmWzvFAT6zGtA4ZAAokSoPw7Eb0FDmo7U0UccfE
+x/R1Hd+xlhyEGixb8/fKUN1oo1yFKXensokYdWgdqEH/AFWIb23yXs9rTHL4Z+mf3tmtx8WPi6x+
+549aE3WipMd5bRvRc9yh3Q/RWmbTWw8PPXSYv49f1o0k+LH7kx8tXZh1ARE/BOOJ/wBYbr/TNdrI
+XC+52OmnUq72Yhc1DsnnUoCyOB0BIH350I5OlPN94+WZZZvLekyygiWSzt2kDGpDNEpNSffOkx/S
+Pc6SfMplk2LsVdirsVS/zFpY1fy/qelGgF/az21T29aNkr/w2RnHiiR3somiC+D3Se0umSRTHcW7
+lXRhQq6GhBHsRnNSj0LuweoTbzLfpdfVDGaoY/Up4FjSh+XHMPR4jHivvcnU5OKqRHlK3HKecjfZ
+FP4n+GV6+XINeIKH5iBvqtj/AC83r86CmbH2d+qfw/S4PafKL3P8qvRHkjRjF9n6utf9avxdf8qu
+c726SM8/e5OD+6j7mBecubfmDrpmpz9S340r/d/VIeHX6a+9c6Hs6V6GBHn/ALouBX702kWtj/Rh
+TpyHL5b5r7PG7TEAxa/CemczMJNteoAp9F/lO8v/ACq7RBNXnwmC8uvD6xJw69uFKe2aLtnJ/hUg
+PL/chx9KPS8U/NoL/wArST0f70/VOVOvPan4Uzreyf8AEd+VScXU/wB/t5PQpkABJ2A755+Hpix3
+y7qp1bSEvGpzZ5FIGwornj/wtM2vaOlGnzGA5UPu/W4ulzeJDi97GvywC/8AK1x6n2xJeca9eXF6
+/hXOs13+ICv5sf0Okwf4wffL9L278z2uv+VZa6tpy9X0F5cK19L1U9Xp29PlX2zkux5j83AS7/0G
+vtcvWA8BfOGmBOAzodUTxFOlAplmhj9y1enLb7hmsmfWHLnTJPKJZfPmgGP+8+sS9OvD6rLz/wCF
+zN1cq0eS+4feHWTH7wU9D/M8wt5L1wy/Z+pzU/1uB4f8NTOc7FkTqIEfzh97mZf7uXuL5x8nwmaz
+1GI/ZcIF/wBajf2Z2PbcqljPv/Q4fZw2l8P0oeGVoZklX7UbBh8wa5iyjYpzImjbPNQvY7Wwkua/
+s/u/dj9nNHixmUxF2+TIIxthmj6Xc6tq9nplsK3F9PHbxd/ilYKCfvzfxjZADppSoW+9bW3jtraK
+2iFIoUWNAf5UFB+AzpAKdISqYVdirsVdirsVfMX/ADkP+Wdxpesy+bNNhLaVqL8tQCAn0blju7U6
+LKd6/wA1fEZqNbgo8Q5F2Oly2OE83i+YDlsu8qoBp1f5pGP6h/DNTrT6/g34+S3zvZNdaNVBV7dv
+Wp34gUb8DXMnsXOMeajylt+po12Lix7dN2X/AJEebEm0aTQpHAubBmkgU9Whkapp/quTX5jIe1Gj
+kJeJHlL7/wCxq7PyCUeE8x9zJvPvk671mWLWdJCtqkMfoz2zEILiIEsoDEhVdCx4k7GtCemaDsPt
+waYnFmvwpHn/ADT+o/2MtTpyTxR5vLtWa8hDW15aXFtNTeKaJ0b5io3+Y2zrRixZfVjnGQ8iGmOo
+MdiKb8q/lp5l8yXkbXdvLpukAhprudTG7p4Qo4BYt/NTiPwOv1va2DSRNEZMvSIN7/0iOVd3P72X
+ry7cg94ubyw0XSAoZbbTdOgCrX7McUS0A8dlGcdozm1Gb+dKR+0ucIRhHuAfOmiy3PnD8ypNWkU+
+isxu2r+xFCQIUP3Kuena+Q0mi4OtcPxPP9JdVpYnNqOLpd/Lk9I8y3ItdFv560McEhXt8XEhfxzi
+tDj49RCPfIO/1M+HHI+TCfyznrpN3bHrFMH+iRQP+NDm/wDaXHWWMu+NfI/tdb2TL0EdxSTVbi48
+r+fYdXhUlPWW6AH7SsaSpX3+IfTm37NkNTo+A8wOH9X6HC1cTiz8Xx/W+j7HULDWtIBBW507UISr
+D9mSKVaMp+YNDnm3aAzYMtj0yiftDtjGM43zBeF+a/yw8x+XL6R9Pt5dS0ZiWguIVMkiL14zIgqC
+v8wHE+3Qddo+2cGsiOKUcebqDsD5xJ7+7n97ruGeI98VPRXvJeNvbWlxcT02hihkdvpCg069TmXL
+Bjx+vJOMR3kgJOpMtgHqvkHybe6VcPreshU1F0MVpaAh/QjahcswqpkelPh2A2qanOT7c7bjnAw4
+P7scz/OP6h58z02bcGA3xS5pD+evm1LXQBokbj63qRBdB1WCNuRY/wCsyhR475ufZTRznPxZfTD7
+/wAfoY6/IIw4RzLzvyjZtb6UJHFHuGMn+x6L+qubHtjOJ5qHKO3x6p0OPhx33pLcrxuZV/ldh9xy
+yBsBtKte6lc3ixJIaRwqFRB02FKn3OQx4YwsjqznlMqvo9x/5xx/LK5a7XzpqsJS3jVl0aJxu7sC
+rT0/lUVVPE79hm30On34z8HXarN/CH0Tm0cB2KuxV2KuxV2KqV1a213bS2t1Ek9tMpSaGRQ6OrCh
+VlNQQcBF7FINPjX85PLGl+WvP+oaZpUTQWAWKaCJiWC+rGGYKW34hq0zRarGITIHJ22CZlGyoeWG
+H6NUeDsM0Gt+tzcfJNrkA8K7gggg5iwbQwe/sNU8s6tHrOkO0ccb84pF39MnYo47qa036jbOt0Ws
+x6vH4WX6vv8AMebpNTp5YZ8cOX3PWPJ3506DqMMcGruumX4oGLk+g58Vc/Z+Tfec5ftT2WmCZY/V
+H7f2/BzMOvhMVL0n7HoNv5i02aMSQ3kEkbdHSRGB+kHOVydkZomjE/IuWDE9Uq1z8wvK2kxM17qc
+Kuv+6I2EkpPhwTk2Zuj9ntRlO0TXyHzLXPPjhzLxTzr+Yes+drtNH0i3kj053HC3G8sxG4aUjYKv
+WnQdSfDv+zOyMOgh4kyOIdeg9zq8+plnPBAbM18meWIPLmlGIkSX1xR7uYdKjoi/5K1zmu1u0jqc
+ljaA5D9Pxd1otKMMa/iPNLvzIvxFoDW4Px3cixgd+Knmx/4UD6cyPZ3Bx6ni6QF/PZp7UycOKv5z
+Efy/uxb6rLbsaLcx/D7unxD/AIXlm+9osHFhEv5p+w/tp13ZeSshHeGSeadDi1ix9IkJcREtbyHs
+e4Ps2c92Zrjpsl84nmPx3O11emGWNdeiQeSfzC1fyXdNpmowvNpvOr29fjiJO7xE7EHrTofbOj7R
+7Lw6+HHAji7+/wB7psGpngPDIbfjk9t0H8xPK2rRI1nqUPNqfuJWEUoJ7cHofuzgNb7O58R+k18w
+7WGfHPkU5m8w6dFGZJbyGONd2dpFAHzJOa6PZOYmhE/IthMR1YF5u/Ory9psLxaXINUv9wgjJ9BT
+4tJ0Yf6lfozpuzPZTLIiWX0R+35frcTNroQHp9ReMoNU8zaw+p6rI0vquDLIdgabBEA6AdNs7HUZ
+8ekxeHj5jl5eZcHBhlmlxS5M1VQqhVFFAoAOwGcoTe5dyAwy8Nbuc+Mjf8SObjH9I9zjnm+hPyr/
+AOcetHksNO8xeZJ/r/1uGK7t9LQFYVWVBIonJ+JyA26igr/MM2+n0QoSlu6/NqjZAe9IiRoqIoRE
+AVVUUAA2AAGbJwm8VdirsVdirsVdirsVfLX/ADk/p5g8/Wl2B8F5p8ZLeLxySIR/wPHNPr41O/J2
+WkPp+LBvKktbWWPuj8voYD+mc9ro+oF2GMp7PvGp8D+vMGPNvDk4spVgGUihB3BBxNg2GdWkmoeQ
+tKu2Mlq7Wch6hRzj/wCBJFPoObbT9vZcYqY4x8j83X5ezYS3j6UrP5ZamWPC7gK9i3MH7gDmxHtJ
+i6xl9n63F/kmfeEdYflWSwa+vwF7pAu5H+u3T/gcxs/tOK/dw+f6h+tsx9kfzpfJnOiaJpGjQmOw
+gEbMKSSn4pG/1mO/0dM5rWa7NqDcz8OjtcGnhiFRCYTXcccbSSMEjQFnY7AAbknMSGMyIA3JbpSA
+Fl5R5l1t9Z1EyiotoqpbIf5e7H3bPRuy9ANNi4f4jvL8eTy+s1JyzvoOSWwtLbzJPCxSWMhkYdiM
+z8kBOJjLcFxoyMTY5h6BpurRajZrOu0g2lj/AJW7/R4ZwWs0UtPkMTy6HvD02n1Ayxsc+qE1bTLD
+UI+F1EHI+y42Zfkwyel1WTCbga+5c2CGQVIMUu/JQViba5+Hssg3/wCCH9M3+Ht3+fH5fj9LrJ9m
+fzT80EfKV4D8U0dPbkf4Zkfy1DpEtf8AJs+8I208s2cRDTMZ2HY/Cv3D+uYeftbJLaPp+9ycXZ8I
+7y3Tu1jUSIqgBV6AbAAZqckjRJc6qCYswVSx6AVP0ZjAIYQeUkhoKs52A3JJObsBxn3vo1j9Q0ex
+sf8Alkt4oP8AkWgXxPhnSxFAB0kjZtGZJDsVdirsVdirsVdirsVeG/8AOVGhtNoeja0i1+pTyW0x
+H8twoZSfYNDT6c13aENgXM0ctyHgnlm49O9aI9JV2+a7/qrnPayFxvudpjO7LPtxle5G2arkXIBU
+YnycgzCMikykhkio5cqITaISbIGLJUE2Q4Vtg/nXzL68h0u1f90h/wBKcftMP2Pkvf3zr+wezOAe
+NMbn6fd3/H7ve6PtHV2fDjy6sZiIzpXUqkhWm2KV+marJp12JV3ib4Zk8V/qO2YWu0Yz46/iHIt+
+m1BxSvp1Zj9YjmjWWNgyOKqw7g5xksZiTE7EPRxkJCxyQ0r5OIUoVzU5aELcKEVZJuz+GwyrIeiC
+t1ef0dPlNd3HBfm236sOnjcwwmdlH8sdDOuef9C07jyje7SWdf8AiqD97J/wiHN5p4cUwHEzSqJL
+7ezoHTuxV2KuxV2KuxV2KuxV2Ksc/MTywPM/kvVdGABnuIS1rXtPERJFv2q6gH2yrPj44ENmKfDI
+F8RxvLa3KsVKSwv8SMKEFTuCDnOTjYILuQWcW1wksSSoaq4BH05o5xo0XJBWyjhJUfZbcYY7hmCq
+RyZEhkiElysxZK6zZAxW0n81eYDpun8YmpdXFUhP8o/af6M2fZOg8fL6vojuf1OHrtT4cNvqLz2N
+ZWQyUJXuxzuaebVklpilcZdsVU+LyV4CtO2Kpn5c1YxS/UZT8DkmKvZu4+nNJ2vouIeLHmObsuz9
+RR4DyPJP5HznwHcKOTQ4AkgDqemKplFGI4wv3/PMaRssUh8x3fOZLZTtH8T/AOsen3DM/SQocTVk
+L2D/AJxb8rNLqGqeZ5k/dWyfUbMkbGSSjykHxVAo/wBlm97Px7mTrtZPYRfRmbVwHYq7FXYq7FXY
+q7FXYq7FXYq+Tf8AnIPyMfL3nFtUtY+Ol62WuEIHwpcV/fp9JPMfP2zS63Dwzsci7PTZOKNdQwry
+5qFK2jnxaL+I/jmk1eL+IOdjl0ZCwEicT9B98wOTcChgzKxVtiMsq2YKskuQMU2qrNkDFNsA85Xb
+y67IjH4YERFHzUOf+JZ2XYuIR04P84k/o/Q892jMnKR3I6azUWqxpsvAAH6OubVwUhYvGxVxRh1G
+KteocVTXTLduNWG7GtPbFUu1Y/V9TcxGjIVcU7NQH9eCURIEHkUgkGwy9JPURX6cgDT5jOIIo09R
+E2LbwJRdpB/uxh/qj+OVZJdEFfe3aWtu0z9tlXxY9BkccDI0xJpitrbXup6jFa28bT3t5KscMa7s
+8kjUVR8yc3MIcgHHJ6l9ueQvKdv5T8p6focJDvbR1uZgKepO55SP8uR29qZ0OHHwRAdNknxStkGW
+sHYq7FXYq7FXYq7FXYq7FXYqxz8wfJVj5x8sXWjXVEkcepZ3B/3VcIDwf5b0b2JyrNiE40WzFkMJ
+W+K9V0vU9D1e406/ia21CykMcsZ6qy9we4PUHuN85+cKJiXbxkCLDINK1JbuGvSZP7xf4j2zUZ8P
+AfJyIytGSIJB1o46HKQabAUNzZG4tscsq2VrxNg4VtjfmrRpbiT69bLzcKBNGOpA6MPHN72TrowH
+hz2HQur1+lMjxx+KXWGuoluttdqf3Y4pINzQdmHtnSOnUL+/s5ARGC57EilPvxVC2t1FG9XWo8R1
+xVM/09bQxn0UZ5KbctlHz74qhdP0661K6M0tfSLcpZDtX2XMDW62OKND63K02lOQ/wBFlwAAoOmc
+o9Aibe1Jo7ig7L45XOfcglFO6IhdyFVRUk9ABlQFoYrquoteT/DtCm0a/wATm0wYeAebRKVvdP8A
+nG/8s3Df411WKgo0ejRONzX4XuKH6VT6T4ZutDg/jPwdfqsv8IfQebNwXYq7FXYq7FXYq7FXYq7F
+XYq7FUNqWp6fpdjNf6jcR2llbrzmuJWCoo9yclGJkaHNBNPkX87PzG8t+cvMMNxo1iY0tEML6m9V
+kuVr8NY6fCq78eXxb9umW6vsOU8fEP7wdP0e9On14jKj9LAbe4lglWWJuLL0PjnI5Md3GQd5GXUM
+o07VYbxKfYnH2o/4jNXmwGHub4ytGOiuKMK+B75SDTNDSQSruvxD8csEgU2gdRnljtXKEq4oK9xv
+l+KIMt2MzskE5juVIuI1d+0oFHH0jr9ObLFknj+k15dGiAxmV5IiY+X2hB/o62puzg+OzD8BmYO0
+MncHb4uyeys24nPGe4kfq/S4abag7u7bbACn4kYf5RydwZz7C7LgLOaR9xH6IlXt7a0gBIjEkh6N
+J8QA9l6ffmPk1WWfWh5Oo1GLTCX7qGw6yNk/oTnR2uZ5nSvJQtd9gN81uoAiLTjKexWqJu3xN+GY
+Mpktlqks0UMZklYIi9ScjGJJoIJYzqmrPdt6cdUtwdh3b3ObPBgENzzaZStLTMI2U0DEEHiehp45
+0PZPZR1EuKW2Mfb5D9LrdbrBjFD6vufWH5R/nh5e80W9tot7HFo+uRosUNovwW0wUUUW1fsmg/uz
+v4Vzd6nQHFvHeP3Osx5xLnzerZgtzsVdirsVdirsVdirsVdirsVY/wCd/PXl/wAm6O2p6zNxU1W2
+tkoZp3A+xGpIr7noO+XYcEskqiwnMRFl8h/mP+anmTz1f871zbaXExNnpcbH0ox0DOdvUen7RHyA
+GdDp9LHENufe4OTIZJJoflm91Rw1DFbd5D3+WZJ2aDJld95GtGslWyPp3MY2Zvsv7Hw+eaHtTsmO
+o9cPTk+/3/rc7Ra+WLaW8fuYbcW13ZXJinRoZ4zWh2I8CD/HOKzYZQkYzFF6PHkjMXE2E0sfMLKA
+l2OQ7Sr1+kZr8uk6xbxPvTqC5gnTnC4dfbt8xmFKBjzbAbdcW8U8TRyCoYUr3HyxhMxNhJDEryzm
+tJjHKP8AVbsw8Rm2x5BMWHHIpD5Yh2KrkRnYKoLMdgBuScBNJZRpFh9TtiZNpZN5PYDoPozV58vG
+duTdGNLb3XbSAFYj60ngv2R8z/TJY9NKXPYIMwx+8vrm7flM1QPsoNlHyGZ+PFGA2aibTnQvKs92
+VuLxTFa9VQ7O4/gPfOh7N7GllqeT0w+0/s8/k6rWdoiHphvL7ky1vyha3Kc7NRDOo2UfZNM7XHGM
+IiIFAPPGZJs7sIuLa6srj05VaKZDUHoajoQcspmDb6B/Jz/nIQloPL3nOetaR2etyH6FS6J/5Of8
+F/Nmn1nZ/wDFD5fqcvFn6F9EKysoZSCpFQRuCDmnct2KuxV2KuxV2KuxV2KsX/MP8w9D8j6G2o6i
+3qXElVsbFSBJPIB0Hgo/abt86A36fTyyyoMJzERZfGnnHzlrvm/W5dW1iYyTSGkMK1EUMdfhjiXs
+o+89TvnSYcMccai6+czI2Uw8s+T3uON3fqVh6pEep+eWE00mXczyKKKGIKoCRoPkAMr5sUFdamTV
+LfYd5P6ZZGHewMkqvLOG+j4XIMlPssT8S/I5Rq9Di1EamPj1Dbg1M8RuJY7feWLyGr237+PwGzj6
+O/0ZyGt9n82PfH64/b8uvw+Tv9N2tCe0/SfsSn9/bykfFFKuxG6sD+vNBOFbSDtYyBFhGwa9qEez
+MJR/ljf7xTMeWlgfJsEyiW8wQzR+nc2odT1+Kv6xlQ0pBuJTxoKVtIY1RJo/8kFWH475eBkHOix2
+Uq2APSVx4VVf4NkvX5LsrxaoLcH6rbpET1dqu/3nISwcX1G08VckPcX13cf30rMP5eg+4bZOGOMe
+QYkkorTdA1TUCDBCREf93P8ACn3nr9GbLSdm5s/0R27zsPx7nEz63Fi+o793VmWjeULCxKzT/wCk
+3I3BYfAp/wAlf4nOs0HYWLD6p+uf2D4fr+x0Gq7Unk2j6Y/asvLudL6Vo3ICsQBXbbbpm/oOtBRt
+pfxXA4n4Jf5ex+WVSjTMFD6xotpqUBSVaSD7Eg6g4g0kPPNT0u6064MM67fsP2YZJsBt7H+SH56T
+6NLbeWPM03PRmIisb9z8VqSaKkjHrD7/ALH+r01et0PF6o/V97lYc1bHk+oFZWUMpBUioI3BBzRu
+a7FXYq7FXYq7FUj85+cNH8o+X7jWtVekMI4xQr9uaUj4IkH8zfh1O2W4cMskuEMZzERZfFXnXznr
+XnDX59Z1WSssnwwQKT6cMQ+zHGD0A/E7nfOmw4Y448IddOZkbKaeU/KlSl9fLt1iiP6zlhNNEpWz
+Vnihj5MQqL/nQZCrQlN1eyXBoPhiHRfH3OWxjTWSpKuSQqquKqqpgVFzWFjfQqLqBJtqVYAkfI9R
+mNn0mLKKnESbcWeeP6SQk115F0mUkwPJbnsAeaj6G3/HNNm9nMEvpMo/aP1/a7HH2xlH1ASS6X8v
+7kf3N4j/AOuhX9RbNfP2ZmPpmD7xX63Lj23HrE/NCS+R9VQ09aA/7J6/8Qyr/Q1qP50Pmf8AiWz+
+WcXdL7P1tL5Mvv254l8ePI/rAyUfZnN1lH7f1BjLtrH0iUdY+SbRn43N05PYIoX8TyzMx+zER9cy
+fcK/W48+2pfwxA9/4Cf2XlrRbMho7ZXcftyfGf8Ahth9GbXT9kafFyjZ7zv+xwMuvzT5y28tk0zZ
+OG07BEZz0UEn6MKsVkJZix6k1P05NKkag1GxHQ4VTOx1LmRFOaP0V/H2PvlUodzIFfqem21/btDO
+ta/Zbup8RkAaZPOdV0u4065MMoqOqP2YZNsBt7n/AM4+/nK1vLb+TfMM1beQiPRr2Q7ox2W3difs
+npH4H4elKanX6O/XH4/rczBl6F9IZpXLdirsVdiqyeeGCGSed1ihiUvLI5CqqqKszE7AAYQLV8Zf
+nJ+Ztx538yM0DsuhWBaLTIDUchWjTsD+1JT6FoPHOk0emGKP9I83X5cnEfJJ/KHl363KL25X9wh/
+dqf2iO+ZZNONI9Ges8cMRZqKij/OmV82KT3N3JcyVOyD7K+GXRjTAlaowsVVRiqsoxVVUYFRlsfh
+K+HTAVVsVaJoMVQ7rU1PXFVJlwqpEUO2Ko22m9RN/tr1/rgVWxVB6pLwtio+1JsPl3whUiYZJKi2
+KqTYVTLT9R50gmPx9Ec9/Y5VOPVmCu1fS4NRtWhkFGG8b9wciCyec3lpPZ3LwSjjIh/zIyTYDb6v
+/IL81T5r0c6Jq03LzBpkY/eOatc24+ES+JdNlfx2Pc05/X6Xw5cQ+k/Y5+DJxCjzetZr292KuxV4
+X/zk1+YjafpcXk/T5eN3qKiXU2U7pbV+GOo7ysN/8keDZtezdPZ4z05ONqMlCnznomlyalfJCB+7
+G8reAzduDI09QtoYreBIowFjjFB26ZWTbWlV9em4k4qf3S/ZHifHLoxpgSpLkkKy4EKqYqrLgVVT
+FVeJuJrgVFYqtZh0xVSY4qothVSbFWoJfTmU9jsfkcVTPAqSahcetMaH4F2X+uSCoFsKVJsVUWwq
+pN1xSnGnX/rp6ch/ep3/AJh45VKNMgUu8z6OL22M8S/6RCKj/KXuMESyBpjHlnzFqflvXrPWtNf0
+7yykDqD9lh0ZHH8rrVTkcuMTiYnq3RlRsPuXyl5n07zP5dstc09q215Hy4E1aNxs8be6MCDnLZcR
+hIxPR2UZcQtN8rZIXVtUs9K0u71O9f07Syhe4nfqQkalmoO5oNslCJkQBzKCaFvg/wA1+Yr3zJ5j
+1DXL01uL6ZpOPUIvRIx7IgCj5Z1WLGIRER0dZKVm2X+U9LFlp6yOKTzfE3iB2GTkejSTZRuq3nBB
+Ah+J93Pt4fThhHqwJSxTljFVU4qrKcUKqnAqsrYqqq2BVRXxVEQzD7J+g4FWGTc4qtZ8KqbNiqkz
+YqpM2FUVe3tIhEh+JgOZ8PbAAqVOcklSY4qpMcVUmOFVFsUrEleKRZENGU1GJFqyCC4SeBZV6N1H
+ge4ygiizYV5o0wWl560YpDPU7dA3cZJnEvWP+cYfPj2GuT+UryT/AEPVKzWHI7JcxrVlFf8AfqL9
+6jxzV9p4LjxjmHM086NPp3NG5jxr/nJ/zW2meTLfQ4H43GtzUlod/q9vR3+9yg+Vc2XZmLinxfzX
+H1EqFd75m0Cx+uapDGR8Cnm/yGb9wJHZ6SXSKMsdkQV+gZW1sfkmaaVpG6sa/wBBl4FMFynChVU4
+FVVbFVVWwIVFbFVRXxVUD4FXB8VdzxVoviq0viqmz4VU2bFVJmwqpM2KVJjiqkxwqh7ib0l5kVUH
+4vYHvkZGkgWsLAioNQehyQVTY4VRek3fpz+ix+CXp7N2+/ITDIIvWbFb2wkip8YHKM/5QysFkGD6
+ff3mmajb39o5iu7OVJoHHVZI2DKfoIxlEEEFtB6vvHyp5gtfMXlvTtbtqCK/gSbiDXgxFHSvijgq
+flnKZcZhIxPR2cZWLfLn/OS+unUfzJksVasWkW0NsF7c5B67n5/vQD8s3vZsKxX3uHqJXJi3ke1p
+HPckbsQin2GZ0uTiS5p5rE/C3WMHeQ7/ACG+GA3YFKFbLWKqrYoXtKsaF3NFHU4CaSAutZmkjEjC
+nI1UeA7ZGJsWpCIV8khUD4oXh8Crw+Kt+pirfqYq0ZMVWl8VWl8VU2fCqmzYpU2bFVJmwqps2KqE
+oDqynoRQ/TgIsJCV21yYZDDIfhrQHwOUY58Jotso3ujGOZLUplypBBoRuDilklvOJ4ElH7Q3+ff8
+coIosmFeYrP6tqclBRJfjX6ev44WyL6N/wCcV/MrXnlbUdAlasmlTiaAH/fN1U8R8pEcn/WzR9qY
+6mJd7naaW1Pn78wdROpeevMF6TVZtQuTGT/IJWCDfwUDNvp48OOI8nFmbkWQeWYvS0iDxern6csk
+0Hmp6zLyugnZFH3nfLMY2YFBq2TQqq2BUvurk3Eywxn4K0HufHMacuI0G2IoWm8ZCqFHQCg+jMim
+lUD4qvD4qvD4quEmKt+pihvnirXqYq0XxSsL4qsL4qsZ8VWM2FVNmxVSZsUqbNhVKNSTjPyHRxX6
+RtmLmjRboHZfZ3XNfTY/Ev2T4jLMU72YzirMcuYJxoU1YZIj+waj5H/ayvIGQQHnG3BhguAN1JQn
+2O4yIZR5su/5xn1k2P5lx2Rakeq2s9vx7cowJ1P3QkfTmB2lC8V9xcvTmpPK7iZp55Jm2aVmdgPF
+jXM8Cmh6FpI46dbr4IMEubSlWoyVvpT7gfcAMtjyYlRVskhQvrrgnpqfifr7DKcs6FM4RtS0xeU/
+Lsgr9J2yrCLLKZ2ThXzKaV4fFV4fFVwfArYfFW+eKu54q7nirRfFVpfFVpfCqwviqxnxVTZsUqbN
+hVTZsVQWoryh5d0NfoyrMLDOB3SxXZGDA7jpmKDRbimcUgkQOO/Ue+Z0ZWLaCKTPRH43ZXsykfdQ
+4J8lCJ8yxh9Il/yCrfccqDIc0B+Vd81j+ZHlqdTxrqFvEzVpRZnETVPhxc5Tqo3il7nIxmpBjVxC
+0FxLCxq0TshPuppl4NsGfaW/LT7dh/IPwwS5tKUaieN9KPcH7wDlseTEqBlVFLE7AVOEmlASqSZp
+JC7dTmFI2bbwKTLTBxhL93P4DMjCNmqZ3RwfLmC8PgVcJMVXCTFC7nirueKt88Va54q0XxVoyYqs
+L4pWl8VWF8KrC+KrC+KqbNilSko6sp6EUxIsKEmYEEg9RscwKchE2MvF/TPRunzy7DKjTCYTvSa/
+X4/9lX/gTl8+TWE01wA6TdA/yfxyoMgxfyg7R+bNEkVS7Jf2rBB1YiZTQfPIZvoPuLdHmEZ+YumN
+pfnzzBYkUEV/cemP+K3kLx/8IwyOnlxY4nyTkFSKbeW5hLpMQ7x1Q/Rl0mg80PrcZW6V+zr+I2yc
+DsxKR381AIh33b+GV55dGcB1QYOY7YncHwRKvgBXM6IoOOeaqHwoXh8VXB8VbD4q3zxVvn74Fdz9
+8Vdz98Va54VaL4qtL4qtL4qtL4qsL4pWF8VWE4VdiqWXicZ28G3+/MPKKk3ROyiCQQR1HTK2TJdA
+Pq3KyDshJ+fTMsyuNtNUUf5hkCaRPX9oBR9JyMUhJPy+tnuvPnl23TYyanaCvWg9dCT26DKtQaxy
+9xb4D1B6B/zk75dOnef49VRKQazbJIW7GaD91IP+AEZ+nMPszJeOu5t1EalbA/KF4FeW1Y/a+JPm
+M2J5OJJPNWt/VtCw+1F8Q+XfGBosSwiaT1JGfxO3yyiUrNtoFBu3XlMi++/0b4wFkLI7JuGzOaFw
+fAq4Piq4PirYfFW+eKHc8Vb54q1zxV3PFWi+KVpfFVpfFVpfFVpJwq7FXYq7FUFqC/Yf5g5j5xyL
+ZBB5jtjJvKYpDMT1Ygr8h1/HLIS6MJBrzfchbaO3B3c8iPYdMtHJEeae/wDOPejNqf5paY5XlFp6
+TXs3sI0KIf8AkbImYXaE+HEfPZycAuT3v/nILyY3mTyDPcWyF9R0Zje24HVo1FJ0/wCRfxe5UZqt
+Bm4MlHlLZys8Li+QrO5e2uY506oQfozow68i2cTXscmm+vGdpQAPmeuVZdgwiN2H31sYZagfu23X
+29soibbS6wWsxP8AKMvwjdrnyTHMtqdirsVdU4q3yOBW+eKu54q7nirueKtc8VdyOFWqnFXYq7FX
+Yq7FXYq7FUPerW3J/lIP8MqzD0s4c0FbwNNKEX/ZHwGYZNNrJ9IT05Sw+GKNDzPgP8xjislE+THd
+bvjeX7uPsL8Kj2GZZREPon/nFbym1roupeZ50o+oOLSzJG/owGsjD2aQ8f8AYZo+1MtyEO5ztNHa
+3u5AIIIqDsQc1TkvjP8AO78uX8m+bZDaxFdD1MtcaawHwpU1kg/55k7f5JGdJotR4kN/qHN1+bHw
+nyYZYam8SC3kP7ktUex6ZfmFhqA3TOSOOWMq26t/nUZiskNb2MsAkenKOoAcfxzN05u2nIq5ktbs
+VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVXfU5rmGQIvwgEs56Cm+V5T6SyjzXWdmEpFE
+OTt1PcnNfuS38m9Z1GO0tvqVu1ZG3lceOZmOHCGvmUJ5P8ral5p8x2Wh6etZ7uQK0lKrHGN5JW/y
+UXf8OuQzZRjiZFthHiNPufQdFsdD0Wy0iwThaWMKQQjuQgpybxZjuT45y2SZlIyPMuyiKFI/IJY7
+598kaV5z8uXGi6gOHP47W5ABeCZR8Ei/qI7ioy7BnOOXEGE4CQp8VebvKWs+VtbuNG1iAxXEJqjf
+sSxk/DJG3dW/sO4zpcWWOSNjk6+UTE0UDY6o1uRFPvF+y/hlU4UoZjorRS2bMpDqzkeI6DJ4uTVP
+m3caNbSEmMmJvbcfdmQJlhSBk0W7X7BVx7Gh/HJiYRSg2nXy9YW+jf8AVh4gtLDZ3Y/3RJ/wJ/pj
+xBDvqd3/AL4k/wCBb+mGwrvqd3/viT/gW/pjYV31O7/3xJ/wLf0xsK76nd/74k/4Fv6Y2Fd9Tu/9
+8Sf8C39MbCu+p3f++JP+Bb+mNhXfU7v/AHxJ/wAC39MbCu+p3f8AviT/AIFv6Y2Fd9Tu/wDfEn/A
+t/TGwrvqd3/viT/gW/pjYV31O7/3xJ/wLf0xsKuXT71ukLfSKfrwcQTSIj0W8b7XFB7mv6q4OMLS
+Ng0W3Qgykynw6D7sgZlNIudY1tnSqxJxK16AA7ZAi0jZjV/rVvbI0Fj8TnZ5z1+jwxhjEWW5Sazs
+7/U7+G0tIXur26cRwwxgs7uxoAAMMpACyzA6B9gfkv8AlPB5G0dri9Cy+Yr9R9dmWjCJK1EEbeA6
+se59gM53WarxZUPpDn4sXCPN6PmE3OxV2KsX/MD8uvLvnfSfqOqxlLiIE2V/GB60DGm6k9VNPiU7
+H50Iv0+oliNhhPGJDd8lfmF+U/mvyVcuNRtzcaWzUg1SEFoHBPwh/wDfb/5LfRXrnQYNVDKNufc4
+M8ZixTT766sCTbyFQTUqdxmRGNNUhaf2vnAUAuYd/wCZD/A4aDDhTOHzJpEg/vuB8HBGCkUUSmp6
+c/2bmL/ggP140qp9btD/ALuj/wCCH9caVv63a/7+j/4If1xpXfW7X/f0f/BD+uNK763a/wC/o/8A
+gh/XGld9btf9/R/8EP640rvrdr/v6P8A4If1xpXfW7X/AH9H/wAEP640rvrdr/v6P/gh/XGld9bt
+f9/R/wDBD+uNK763a/7+j/4If1xpXfW7X/f0f/BD+uNK763a/wC/o/8Agh/XGlWPqFgn2riMf7Mf
+1xpULN5h0iL/AHeHI7ICcaWktuvOCAEW0JJ7M/8AQYaCeEpHe6tfXh/fSHj2UbDDbIRTfyb+X3mv
+zhei20SyaVFNJrx6pbxf68pFP9iKsewyjNqIYxci2QgZcn1V+V35NeX/ACNbi5NL/X5FpPqLqBwq
+N0gU/YXxPVu+2w0Oq1ksu3KPc52PEI+96FmG2uxV2KuxV2KrJoIZ4XhnjWWGQFZI3AZWU7EEHYjC
+DSvKfN//ADjZ5E1t3uNL9TQbxySfqwD25J7+gxHH5IyjM/D2jkjsfUGiWnieWzybXf8AnGL8w7Bm
+bTWtdXi34iKUQy091m4KPoc5sIdp4zzsNEtPIcmFaj+V35i6eSLry5qACmheOB5kG9PtxB1/HMmO
+qxnlINZxyHRIp9G1eBuM9jcRNStHidTT6RlomD1Y0UJkkOxV2KuxV2KuxV2KuxV2KuxV2KuxVWt7
+K8uCBbwSTEniPTRm3PbYHfASBzWk7078uvPuo0+peXtQlU9JPq0qp/wbKF/HKpajHHnIMhjkejNt
+C/5xo/MnUSrX0dtpER+0bmYSPT2SD1d/YkZjT7SxDlu2x08i9V8pf84x+S9KZJ9cnl1y5U19Nv3F
+tX/jGhLt9L0PhmBl7SnL6fS3R04HPd65Y2Fjp9rHaWFvFaWsQpHBAixxqPZVAAzXSkSbLeBSvgS7
+FXYq/wD/2Q==</xapGImg:image>
+ </rdf:li>
+ </rdf:Alt>
+ </xap:Thumbnails>
+ </rdf:Description>
+ <rdf:Description
+ rdf:about="">
+ <xapMM:DocumentID>uuid:0A41642B59EE11DA9346CE657E5F1B06</xapMM:DocumentID>
+ <xapMM:InstanceID>uuid:0A41642C59EE11DA9346CE657E5F1B06</xapMM:InstanceID>
+ <xapMM:DerivedFrom
+ rdf:parseType="Resource">
+ <stRef:instanceID>uuid:c939d50e-5853-11da-9437-000a95dac8e4</stRef:instanceID>
+ <stRef:documentID>uuid:FDEFD071588811DA91E5E11227A4C4DF</stRef:documentID>
+ </xapMM:DerivedFrom>
+ </rdf:Description>
+ <cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>AVAHI</dc:title><dc:creator><cc:Agent><dc:title>Inkscape</dc:title></cc:Agent></dc:creator><dc:publisher><cc:Agent><dc:title>izo@aucuneid.net</dc:title></cc:Agent></dc:publisher><dc:subject><rdf:Bag><rdf:li>avahi tango freedesktop</rdf:li></rdf:Bag></dc:subject><cc:license
+ rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/" /></cc:Work><cc:License
+ rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/"><cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" /><cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" /><cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" /><cc:requires
+ rdf:resource="http://web.resource.org/cc/Attribution" /><cc:prohibits
+ rdf:resource="http://web.resource.org/cc/CommercialUse" /><cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" /><cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" /></cc:License></rdf:RDF></svg:metadata></x:xmpmeta>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<xpacket />
+ </svg:metadata>
+<svg:switch
+ id="switch5">
+ <svg:foreignObject
+ requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/"
+ x="0"
+ y="0"
+ width="1"
+ height="1"
+ id="foreignObject7">
+ <i:pgfRef
+ xlink:href="#adobe_illustrator_pgf">
+ </i:pgfRef>
+ </svg:foreignObject>
+ <svg:g
+ i:extraneous="self"
+ id="g9">
+ <svg:g
+ id="g11">
+
+ <svg:radialGradient
+ id="path2329_1_"
+ cx="38.7061"
+ cy="-110.314"
+ r="18.9916"
+ gradientTransform="matrix(1 0 0 -0.6819 -21.9902 -50.4182)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#729FCF"
+ id="stop14" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#3465A4"
+ id="stop16" />
+ </svg:radialGradient>
+
+ <svg:path
+ id="path2329"
+ nodetypes="cczcczc"
+ fill="url(#path2329_1_)"
+ stroke="#204A87"
+ stroke-width="1.4"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d=" M12.021,42.829h14.85c4.208,0,8.373-1.542,9.898-5.939c1.452-4.175,0.249-12.127-9.157-18.562h-17.57 c-9.404,5.94-10.579,14.063-8.414,18.809C3.833,41.972,7.566,42.829,12.021,42.829z" />
+ <svg:path
+ id="path3812"
+ nodetypes="cccc"
+ fill="#729FCF"
+ d="M19.12,22.039c0,0-3.012,2.324-2.752,5.125 c-2.857-2.521-2.939-7.352-2.939-7.352L19.12,22.039z" />
+
+ <svg:path
+ id="path3838"
+ nodetypes="cczcczc"
+ opacity="0.2152"
+ fill="none"
+ stroke="#FFFFFF"
+ stroke-width="1.4"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ enable-background="new "
+ d=" M12.168,41.339H26.61c3.697,0,7.355-1.355,8.698-5.218c1.271-3.666-0.134-10.652-8.395-16.305H10.779 C2.519,25.033,1.137,32.17,3.038,36.339C4.977,40.587,8.256,41.339,12.168,41.339z" />
+ <svg:path
+ id="path3810"
+ nodetypes="cccc"
+ fill="#729FCF"
+ d="M20.491,22.039c0,0,3.009,2.324,2.749,5.125 c2.857-2.521,2.939-7.352,2.939-7.352L20.491,22.039z" />
+
+ <svg:linearGradient
+ id="path4368_1_"
+ gradientUnits="userSpaceOnUse"
+ x1="84.2158"
+ y1="80.1289"
+ x2="86.9671"
+ y2="79.5692"
+ gradientTransform="matrix(0.9834 0.1816 0.1816 -0.9834 -93.3736 97.3126)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#000000"
+ id="stop23" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#000000"
+ id="stop25" />
+ </svg:linearGradient>
+ <svg:path
+ id="path4368"
+ nodetypes="cccc"
+ opacity="0.2278"
+ fill="url(#path4368_1_)"
+ enable-background="new "
+ d=" M5.982,41.38c-1.746-0.763-2.528-2.601-2.528-2.601c1.178-5.697,5.208-9.865,5.208-9.865S5.471,37.891,5.982,41.38z" />
+
+ <svg:linearGradient
+ id="path4370_1_"
+ gradientUnits="userSpaceOnUse"
+ x1="-698.3379"
+ y1="-77.105"
+ x2="-700.1275"
+ y2="-76.1939"
+ gradientTransform="matrix(-0.9777 0.2101 -0.2101 -0.9777 -667.8553 105.2513)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#000000"
+ id="stop29" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#000000"
+ id="stop31" />
+ </svg:linearGradient>
+ <svg:path
+ id="path4370"
+ nodetypes="cccc"
+ opacity="0.2278"
+ fill="url(#path4370_1_)"
+ enable-background="new "
+ d=" M32.451,40.18c1.723-0.813,2.523-2.803,2.523-2.803c-1.342-5.66-5.564-9.582-5.564-9.582S32.861,36.675,32.451,40.18z" />
+ </svg:g>
+
+ <namedview
+ showgrid="false"
+ pagecolor="#ffffff"
+ window-x="472"
+ id="base"
+ bordercolor="#666666"
+ cy="24.622653"
+ zoom="9.8994949"
+ pageshadow="2"
+ cx="25.799661"
+ grid-bbox="true"
+ window-height="695"
+ document-units="px"
+ window-width="770"
+ showpageshadow="false"
+ borderopacity="0.17254902"
+ pageopacity="0.0"
+ window-y="167"
+ current-layer="layer1">
+ </namedview>
+ <svg:g
+ id="g34">
+
+ <svg:linearGradient
+ id="XMLID_1_"
+ gradientUnits="userSpaceOnUse"
+ x1="-147.7383"
+ y1="-97.4844"
+ x2="-137.5947"
+ y2="-97.4844"
+ gradientTransform="matrix(-0.7135 -0.7006 -0.7006 0.7135 -141.2909 -25.0322)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#C17D11"
+ id="stop37" />
+ <svg:stop
+ offset="0.2735"
+ style="stop-color:#BD7A10"
+ id="stop39" />
+ <svg:stop
+ offset="0.5694"
+ style="stop-color:#B0700C"
+ id="stop41" />
+ <svg:stop
+ offset="0.8747"
+ style="stop-color:#9A6105"
+ id="stop43" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#8F5902"
+ id="stop45" />
+ </svg:linearGradient>
+ <svg:path
+ fill="url(#XMLID_1_)"
+ stroke="#6F4709"
+ stroke-width="1.4"
+ d="M25.182,1.811c-1.583,1.613-1.248,4.513,0.748,6.475 c1.999,1.964,4.902,2.245,6.488,0.632c1.585-1.613,1.25-4.512-0.749-6.475C29.672,0.48,26.768,0.197,25.182,1.811z"
+ id="path47" />
+
+ <svg:linearGradient
+ id="XMLID_2_"
+ gradientUnits="userSpaceOnUse"
+ x1="-49.5405"
+ y1="-1.0635"
+ x2="-39.3975"
+ y2="-1.0635"
+ gradientTransform="matrix(0.7135 -0.7006 0.7006 0.7135 41.6581 -25.0322)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#C17D11"
+ id="stop50" />
+ <svg:stop
+ offset="0.2735"
+ style="stop-color:#BD7A10"
+ id="stop52" />
+ <svg:stop
+ offset="0.5694"
+ style="stop-color:#B0700C"
+ id="stop54" />
+ <svg:stop
+ offset="0.8747"
+ style="stop-color:#9A6105"
+ id="stop56" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#8F5902"
+ id="stop58" />
+ </svg:linearGradient>
+ <svg:path
+ fill="url(#XMLID_2_)"
+ stroke="#6F4709"
+ stroke-width="1.4"
+ d="M12.801,1.811c1.583,1.613,1.248,4.513-0.748,6.475 c-1.999,1.964-4.902,2.245-6.488,0.632c-1.585-1.613-1.25-4.512,0.749-6.475C8.311,0.48,11.215,0.197,12.801,1.811z"
+ id="path60" />
+
+ <svg:radialGradient
+ id="path2327_1_"
+ cx="159.8369"
+ cy="-47.0518"
+ r="12.3745"
+ gradientTransform="matrix(0.788 0 0 -0.788 -109.7853 -28.1509)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#E9B15E"
+ id="stop63" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#966416"
+ id="stop65" />
+ </svg:radialGradient>
+
+ <svg:path
+ id="path2327"
+ type="arc"
+ ry="8.6620579"
+ cx="31.112698"
+ rx="8.6620579"
+ cy="19.008621"
+ fill="url(#path2327_1_)"
+ stroke="#6F4709"
+ stroke-width="1.4"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d=" M30.77,9.777c0.003,6.696-5.422,12.13-12.121,12.132C11.951,21.912,6.52,16.486,6.516,9.788c0-0.003,0-0.008,0-0.011 C6.513,3.078,11.938,0.704,18.637,0.7c6.697-0.004,12.13,2.367,12.133,9.063C30.77,9.769,30.77,9.771,30.77,9.777z" />
+
+ <svg:path
+ id="path3834"
+ type="arc"
+ ry="8.6620579"
+ cx="31.112698"
+ rx="8.6620579"
+ cy="19.008621"
+ opacity="0.1266"
+ fill="none"
+ stroke="#FFFFFF"
+ stroke-width="1.5962"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ enable-background="new "
+ d=" M29.279,9.777c0.003,5.873-4.758,10.638-10.631,10.641C12.774,20.422,8.01,15.661,8.006,9.788c0-0.006,0-0.008,0-0.011 c-0.003-5.876,4.758-7.421,10.631-7.424c5.874-0.003,10.64,1.536,10.643,7.413C29.279,9.769,29.279,9.771,29.279,9.777z" />
+ <svg:radialGradient
+ id="XMLID_3_"
+ cx="19.2021"
+ cy="17.4814"
+ r="1.9231"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EF2929"
+ id="stop70" />
+ <svg:stop
+ offset="0.4553"
+ style="stop-color:#DD1414"
+ id="stop72" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#CC0000"
+ id="stop74" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_3_)"
+ stroke="#CC0000"
+ stroke-width="0.1624"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d=" M21.547,16.603c0,1.245-1.051,2.257-2.345,2.257s-2.345-1.012-2.345-2.257c0-1.249,1.051,0.237,2.345,0.237 S21.547,15.354,21.547,16.603z"
+ id="path76" />
+ <svg:g
+ id="g78">
+ <svg:g
+ id="g80">
+ <svg:radialGradient
+ id="XMLID_4_"
+ cx="19.251"
+ cy="12.7207"
+ r="4.7763"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#555753"
+ id="stop83" />
+ <svg:stop
+ offset="0.4309"
+ style="stop-color:#424645"
+ id="stop85" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop87" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_4_)"
+ d="M16.056,14.185c0.754-1.104,1.676-2.194,2.225-3.046c0.587-0.842,0.798-3.921,0.972-3.914 c0.172-0.007,0.384,3.072,0.971,3.914c0.547,0.852,1.469,1.941,2.225,3.046c0.751,1.107,0.991,2.083,0.394,2.819 c-0.562,0.729-1.962,1.217-3.589,1.213c-1.629,0.004-3.029-0.484-3.59-1.213C15.062,16.268,15.305,15.292,16.056,14.185z"
+ id="path89" />
+ </svg:g>
+ <svg:g
+ id="g91">
+
+ <svg:linearGradient
+ id="XMLID_5_"
+ gradientUnits="userSpaceOnUse"
+ x1="35.1543"
+ y1="-75.9287"
+ x2="36.9648"
+ y2="-75.9287"
+ gradientTransform="matrix(-0.8133 -0.5818 -0.5818 0.8133 6.2482 98.8567)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop94" />
+ <svg:stop
+ offset="0.173"
+ style="stop-color:#D2D3D2"
+ id="stop96" />
+ <svg:stop
+ offset="0.5467"
+ style="stop-color:#8B8E8F"
+ id="stop98" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop100" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_5_)"
+ d="M20.774,15.892c-0.479,0.64-1.662,0.609-0.996,1.067s1.592,0.311,2.069-0.329 c0.474-0.642,0.319-1.534-0.345-1.992C20.835,14.18,21.25,15.249,20.774,15.892z"
+ id="path102" />
+
+ <svg:linearGradient
+ id="XMLID_6_"
+ gradientUnits="userSpaceOnUse"
+ x1="29.1709"
+ y1="-80.1465"
+ x2="30.9785"
+ y2="-80.1465"
+ gradientTransform="matrix(0.8133 -0.5818 0.5818 0.8133 39.576 98.8567)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop105" />
+ <svg:stop
+ offset="0.173"
+ style="stop-color:#D2D3D2"
+ id="stop107" />
+ <svg:stop
+ offset="0.5467"
+ style="stop-color:#8B8E8F"
+ id="stop109" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop111" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_6_)"
+ d="M17.728,15.944c0.477,0.642,1.662,0.608,0.996,1.068 c-0.665,0.456-1.591,0.309-2.066-0.331S16.336,15.148,17,14.689C17.665,14.232,17.252,15.304,17.728,15.944z"
+ id="path113" />
+ </svg:g>
+ </svg:g>
+ <svg:ellipse
+ fill="#FFFFFF"
+ stroke="#2E3436"
+ stroke-width="1.4"
+ cx="13.243"
+ cy="7.483"
+ rx="3.657"
+ ry="3.521"
+ id="ellipse115" />
+
+ <svg:radialGradient
+ id="XMLID_7_"
+ cx="9.3857"
+ cy="22.0771"
+ r="3.7695"
+ gradientTransform="matrix(0.9241 0 0 0.8901 4.5696 -12.1687)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#FCE94F"
+ id="stop118" />
+ <svg:stop
+ offset="0.3535"
+ style="stop-color:#FBE651"
+ id="stop120" />
+ <svg:stop
+ offset="0.6"
+ style="stop-color:#F7DD57"
+ id="stop122" />
+ <svg:stop
+ offset="0.8134"
+ style="stop-color:#F1CE61"
+ id="stop124" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#E9B96E"
+ id="stop126" />
+ </svg:radialGradient>
+ <svg:ellipse
+ fill="url(#XMLID_7_)"
+ cx="13.243"
+ cy="7.483"
+ rx="3.483"
+ ry="3.355"
+ id="ellipse128" />
+
+ <svg:radialGradient
+ id="XMLID_8_"
+ cx="9.5366"
+ cy="20.9419"
+ r="3.1631"
+ gradientTransform="matrix(0.9241 0 0 0.8901 4.5696 -12.1687)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop131" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop133" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop135" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop137" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop139" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop141" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop143" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop145" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop147" />
+ </svg:radialGradient>
+ <svg:path
+ opacity="0.5"
+ fill="url(#XMLID_8_)"
+ d="M9.898,7.684c0-1.854,1.561-3.354,3.484-3.354c1.923,0,3.483,1.501,3.483,3.354 c0,1.853-1.561,0.371-3.483,0.371C11.459,8.055,9.898,9.536,9.898,7.684z"
+ id="path149"
+ style="opacity:0.15662651" />
+
+ <svg:radialGradient
+ id="XMLID_9_"
+ cx="9.3857"
+ cy="22.0771"
+ r="2.1484"
+ gradientTransform="matrix(0.9241 0 0 0.8901 4.5696 -12.1687)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#8F5902"
+ id="stop152" />
+ <svg:stop
+ offset="0.273"
+ style="stop-color:#8C5804"
+ id="stop154" />
+ <svg:stop
+ offset="0.4635"
+ style="stop-color:#835408"
+ id="stop156" />
+ <svg:stop
+ offset="0.6288"
+ style="stop-color:#744F11"
+ id="stop158" />
+ <svg:stop
+ offset="0.7799"
+ style="stop-color:#5E461C"
+ id="stop160" />
+ <svg:stop
+ offset="0.9198"
+ style="stop-color:#423C2B"
+ id="stop162" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop164" />
+ </svg:radialGradient>
+ <svg:ellipse
+ fill="url(#XMLID_9_)"
+ stroke="#2E3436"
+ stroke-width="0.1367"
+ cx="13.243"
+ cy="7.483"
+ rx="1.985"
+ ry="1.911"
+ id="ellipse166" />
+ <svg:linearGradient
+ id="XMLID_10_"
+ gradientUnits="userSpaceOnUse"
+ x1="11.3965"
+ y1="7.4829"
+ x2="13.6787"
+ y2="7.4829">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop169" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop171" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop173" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop175" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop177" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop179" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop181" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop183" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop185" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_10_)"
+ d="M13.06,7.483c0,0.995,1.241,1.802,0.208,1.802s-1.871-0.807-1.871-1.802 c0-0.996,0.838-1.803,1.871-1.803S13.06,6.487,13.06,7.483z"
+ id="path187"
+ style="opacity:0.15000000" />
+ <svg:ellipse
+ fill="#FFFFFF"
+ stroke="#2E3436"
+ stroke-width="1.4"
+ cx="24.877"
+ cy="7.483"
+ rx="3.658"
+ ry="3.521"
+ id="ellipse189" />
+
+ <svg:radialGradient
+ id="XMLID_11_"
+ cx="-179.376"
+ cy="22.0771"
+ r="3.77"
+ gradientTransform="matrix(-0.9241 0 0 0.8901 -140.8831 -12.1687)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#FCE94F"
+ id="stop192" />
+ <svg:stop
+ offset="0.3535"
+ style="stop-color:#FBE651"
+ id="stop194" />
+ <svg:stop
+ offset="0.6"
+ style="stop-color:#F7DD57"
+ id="stop196" />
+ <svg:stop
+ offset="0.8134"
+ style="stop-color:#F1CE61"
+ id="stop198" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#E9B96E"
+ id="stop200" />
+ </svg:radialGradient>
+ <svg:ellipse
+ fill="url(#XMLID_11_)"
+ cx="24.878"
+ cy="7.483"
+ rx="3.484"
+ ry="3.355"
+ id="ellipse202" />
+
+ <svg:radialGradient
+ id="XMLID_12_"
+ cx="-179.2246"
+ cy="20.9419"
+ r="3.1616"
+ gradientTransform="matrix(-0.9241 0 0 0.8901 -140.8831 -12.1687)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop205" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop207" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop209" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop211" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop213" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop215" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop217" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop219" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop221" />
+ </svg:radialGradient>
+ <svg:path
+ opacity="0.5"
+ fill="url(#XMLID_12_)"
+ d="M28.22,7.684c0-1.854-1.558-3.354-3.479-3.354c-1.925,0-3.483,1.501-3.483,3.354 c0,1.853,1.559,0.371,3.483,0.371C26.662,8.055,28.22,9.536,28.22,7.684z"
+ id="path223"
+ style="opacity:0.15000000" />
+
+ <svg:radialGradient
+ id="XMLID_13_"
+ cx="-179.375"
+ cy="22.0771"
+ r="2.1484"
+ gradientTransform="matrix(-0.9241 0 0 0.8901 -140.8831 -12.1687)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#8F5902"
+ id="stop226" />
+ <svg:stop
+ offset="0.273"
+ style="stop-color:#8C5804"
+ id="stop228" />
+ <svg:stop
+ offset="0.4635"
+ style="stop-color:#835408"
+ id="stop230" />
+ <svg:stop
+ offset="0.6288"
+ style="stop-color:#744F11"
+ id="stop232" />
+ <svg:stop
+ offset="0.7799"
+ style="stop-color:#5E461C"
+ id="stop234" />
+ <svg:stop
+ offset="0.9198"
+ style="stop-color:#423C2B"
+ id="stop236" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop238" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_13_)"
+ stroke="#2E3436"
+ stroke-width="0.1367"
+ d="M22.892,7.483c0,1.055,0.889,1.911,1.988,1.911 c1.095,0,1.982-0.856,1.982-1.911c0-1.056-0.888-1.914-1.982-1.914C23.78,5.569,22.892,6.428,22.892,7.483z"
+ id="path240" />
+
+ <svg:linearGradient
+ id="XMLID_14_"
+ gradientUnits="userSpaceOnUse"
+ x1="-183.6211"
+ y1="7.4829"
+ x2="-181.3379"
+ y2="7.4829"
+ gradientTransform="matrix(-1 0 0 1 -156.8955 0)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop243" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop245" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop247" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop249" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop251" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop253" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop255" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop257" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop259" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_14_)"
+ d="M25.062,7.483c0,0.995-1.241,1.802-0.209,1.802c1.033,0,1.873-0.807,1.873-1.802 c0-0.996-0.84-1.803-1.873-1.803C23.82,5.681,25.062,6.487,25.062,7.483z"
+ id="path261"
+ style="opacity:0.15000000" />
+ <svg:path
+ fill="#6F4709"
+ d="M22.559,18.449c0,1.407-1.481,2.547-3.308,2.547s-3.307-1.14-3.307-2.547c0-1.405,1.48,0.425,3.307,0.425 S22.559,17.044,22.559,18.449z"
+ id="path263" />
+ </svg:g>
+ </svg:g>
+</svg:switch>
+<i:pgf
+ id="adobe_illustrator_pgf">
+
+ eJzs/eda68ySAAp/N6B7sAGDwUnBkWxZssnR5OggwOCEw7v3Oz/O9Zy5jrmxUx0ktWQlhz17Zr5F
+P4tlrFbHyl3VFQlfXCeKzV5dS0hJPsRFIqWBVhv1Bpsh/G3osN0eD0cD9FX0aj0kiEkeKhUP82+0
+4q02GLZ63U38KCnAwzJ6OyoIkpAQBD6fyPC5bEJM82IiI/FSosALwrrfc2im2hq1NWio9lftq5UQ
+krXWuj486E+pjeChkE8JQorPwIdNHg1M7o27zVb3U+79czMk5fmQmMuH0kIhJIkiPD5oXWlDe51k
+VsrmUMWklMmmoXY+mRUKArwiJPP5TA7eU3qNcUfrji4GvYY2HJZ67d5guBkq/V3rhk5rn/CkFnrQ
+2u3eP0Jyu9b44WCFMm/lVluDxejURqE8WrbioSC+yeNWu3k27tQ1WCWRz6CvpTfc4s0QmoJW0Wf0
+de7tsAPfXGujEQwX+kMzvKrIJdiRXgdXg+9wiT5daf3/+s8BVH8JoeVDjVa1Tr8N60QmWigkMyGJ
+59Fv8zOtCSPFtRKFZKHAi1JIyCQzfLoQyvM5/E0ok88m04WMQF4wF0T7q6X9YzN01utqZNbFwei6
+9R8wjzSsfJ58dzVua4ObbmsEk8iirwpkxqe9ptaGbTTeLLdreKK4COZvUqFaG3xqI9jCXns8wkCX
+5+kjWNGT2t8a2hWBdHDe17rV3i0eXUIAGMmKWWhM4AUxlM2KIfgLNZ8N5STch4ALrw8GvY5e1ltF
+YHABy3s+aH22upsSQEpCzOfJPlUGraa5TTkxlCe/8NiTeeZfQf9HBgnzHY20Lh00gEfplNluPnl6
+Dd2q3Wap10HLPUQgrkH/AIjt3id5ZnzGT+D1cZ9MAf/9BjtzMWh1UZvcGX6Sf7toj+FRZdAb9w+7
+Hz0uSpC9Oqg1oFrovP6tNUaApLfwX2/QGmKUs/8NGNlf92zvuoFmNwjJg/HwK1Tt9drQBuw5QENI
++yc86WqUzCA00ULN1sfHeKhBJcvf/4M6uqiNvgDFtW5zONmD8iwK2c9BrYn+DzW10AdqfEh6huqW
+58NAnaGGz7uk16Bz00Kd3qj1YUyuNhi1hqPW7zjY/P67uwSsD9CdvV1jUf8XdFiqtdst2Pf+V6sR
+oM+GWX2yX+tD/76BwAxgW/FD1Aj6E/4/qLV7AdDq7069124NO/CG8dkckfmVf1OKhpDBHIgjNKnd
+v7R2r99HjRufQ9oohDHmA7NSH8KD9vWj1W0CMbget0bMwvU6/d4QtWNOQIXeu0h6CZmvBcCRdq1b
+G4Tw95MzudCA1o5hzZt/d2sdvIPNNb3Dk9ZfCMeghtFN5g1IOEukEwlOEEJyl6HhFaAZLSD/IA3d
+dKFVrRn6pF8hZu/0JbAeMSQ3uSdum+NLcxTFVuA7tkEVirWCavmuTP9W4VNZ/0vgyV/Ai/EnDn3A
+RaC/yY+Ii4RLGkpWyEDJQsnR3zkhD6Ug5LldNNFM4JKbKFkoeaYU+SKHfkGRaWEnrdIJkB8Jxpk2
+xojGVYAiC0WhJKhQykIZpiJxoiimxYwIooiYh1IQZVGBooLgK0qSlJFyUlbKSwWpKJUkRSqn+bSY
+Tqcz6Wy6kC6m5bSCJ1rKTF3SlmL7nmMeSY5FpEWgBa+DXIaiQlHgXwkX9FOUixz8Ksh5OQclCyUD
+BUYvS1Bgzmgxi+WiCkWBIhfRT6GYg5IpSkWxKBTKMFEeplouzVHkycIxfxQnSsFS8kbJMSVLS4YU
+rpymRcJFpEXAhQB9GQr5UaCUcEELh1agoBbwnqIPAUveseSYklWzHPoFJUNLmhYJFxEXDJsYXcu4
+oOGhnxIU2FTYmwKUPJSckuWUrJJR0lAkBLOKAMQArbIKtUuw98VSAUq+lCtlMVxJGFx4DCIlDBZk
+ounytMUVjTE94Mh/uIhMkYySpkX/yeKSwyWPSwEXAD4EqBz8QrgBs8VLB7uMiAOiOAhxQV0E6R+3
+gX5y2TyUQrYIRc6WsrBKWRUmmg5F3uQBEGA+yadzfAZJ/bxQACIDH3I5MQPaFdIOCvm8KGXQB0GC
+b+GDxBfyfBrody6XzIh5pERAU6AJvC2iKXmIRlRIC0IeV4B24OtkFt4UaTP627TlZBoIMGhJoASC
+esSzo5mrGRiJrBg8UGdyQfke78j4eCvn8/oReQlDURaIfwHT+RJmWISqE3quc5s8pudFDki6jAmg
+ghCH4G0eMLIIyFwC7FHVMuFsmARIBHoR/GDKQWgJoS2E3pi0SCdZCldWmEL6AJgqAEqWAVUlQOkC
+9KZCLyK0noUWi+i98hQ/nO3PXe+1EpgiMkWiJY1LBrPQLGWneQ5z0QJd2iJZqzImgYT8FTEly1Ei
+lcZECZMjTIgIGUIkqIhJUA7hFUN/BER/OEqACAkq4T6AqebFHOBpBlitBAxXEHmgxCq8UMIcGaQF
+LD9k8A4jzi1gMUTF0g1mTTDoPBUJMhxMDU1SxNPn/5v6MKkHwiSCxXwSJAOkWuLvEHIh7BJgxfNp
+84MYSiPbTSbLkI152sD0QhBy2XQOvVJANZBhI8nThpBdA8okdZjmpflogbMQDFIwb9KCCZlGsRTC
+F/X/VcLLYVfwb1zQVoq4SOgfB/+lsWyGpDP0DyabzuN/eSytIXkNlRLALPqnAjVQDW5G2JVEWRU0
+wDHcifAmnSshnoTALu/0U7CV4kSRaSnhov8POMXlFVpU+FfGYgT8BsAsA7mjvxHhK4jwD3YO/0vD
+7zQudICFbCGH/+U59AuK/lPERQa5AP7hKZRVhzLHD+dfZYENEkJZniwCP1GclBhdkUlTeQUzF45q
+MZTH4KIzGYXqDjxuRcLgh9SHHBSiPsgglYMCgdkND+2LUpoDmQcJKTmsScgY1FUMwAhssf4g2IpF
+5TOYkkoLlgUZAR+L+CDfF7CMD1I+5yjmI2bJCvogIRqifh4L+1mQuBCiYJEfsQngjCqInCUOmkag
+UwBgQrCVwVAnEqjEU8gpDqVkK7JRirQUaMnTQn5AiOPgF0E7wOCchAtaZqTMEf0QCf2IWSFGBCIu
+mi8W+gpYAERtoJ8MogOw+iIHkiLaYB5rCSqWJkuwQEjIJIKw4PczCVS8rjJbClWxOZvuTdV1c1+N
+UjRKgRZd62W14SyHeBMthAjqHB8A0iriShlYAwkJgIjqZzCtR3CaRuwlo7MXKY2OEoALoL+dBMr5
+msGsCgugqFZGQj8m+4H6GRCQ0aOc3g00BIIreoRFeWgqW0gi5GVl7oW1OB+TEx2ZnGgReKmoKlMJ
+FREOEcgGIRl5sYjJhWqQCklKY1qRozYHWacWlO0JHOZ2hMXlbKytRJmaztJ0/UvXuFhNS9exihzD
+zvD3hL+VsKqF0KSMFS2RqlhEvTKVK6JgqQgXAUoFjKESDAzhLaAwxmT4ncc4XgS8R1RAAY24jMFb
+yIv4H0wXZpJBeAtEIE/5poy5YokyRJCrOcz9RDxYQBsBaJqE6VsGcD8PxK8IpBARRRXkdx7IqIhN
+K2mgDjlgsQUgeDKSS0E6VUFC50FslbAAm0HadA76KQJhLWFZV8XSvQAycBqr61mQjPOGXqFrFkSn
+wNPHmgSR/FWGcfnJ8qw8b5Xj04Ycn6FyvCHAc9T8pTBmLxHzsoyhHulsi4W7NIa7AoY7ZDOwsaic
+bvggaoCpBOgqQInaIIj4nzFEf95mdrAYHThsdVAxx5INO1QWsybClghLUig7IsyIsCLKiHQ2hLlQ
+gSNMiIDB5Nt+77twMSxzlTgsmRUB/vIAiVmAyTTAJoJSHjRGFfM0wr8KmFtlMYOSMGPiMUPSmRFh
+RDmO8CCCYCrLcwDZgEoBUqYxioqArjyWSBWMyjIgdQHLr1mM8Gks5gpYBCaicYkD8lAEQpHHZsos
+tJIGEiLClvLY5qXCFpdgq4tYP7JrSHYdCbQkjqhJNmuJTkGlNGICiBnQb1ijQtYwPcCsxRxhAhbT
+xBytYEZi8KIMMWBgXiSgL9F3uqkF6TMZpOTwqIGMF0+brZ25mIYjzxAtepGQWWxxazA3dSFCcZ7T
+P0yUgkspOhTZLBz9oNikYJVYdWgpm4W1eYgCU+gPh4mdXtJGyWL4z2BpXTf556nhn5QiLTKV5ElR
+OHIqQAqWt8pUfSB9kJ80Llkq6+cwF0eliAvh5VTR5Yhma9NkSQumEosK4fCm+lqifJ5yep3Xcwyz
+N1VWg81jps7aT1nLKbGaEsZewIwd2DpHObuKObvO2ylnx0J6HrN0lqmrlLELlKnjwetsnbNxdqLz
+qtQGhxk7VmRNFZZorkX8T8ZaKzJ/q9haxxcFDgOSiFcXLU8GaD4aUB7zAPQjYxUHmaxUbNzjsdCA
+xAZdaMhSfQRR/QJnyA8KLWUsqAuEh6uLLe4NOuiznkUl0gPnrp+46jPiRBFM1ZijH/SjNL1IFjqi
+HwOadCVrFJ1yZE3KoZ/FFfBXhBaQsznCg0qYG+lmXV3rLtFzO/S5TAgC4l4cPsYjdEA0KICAkVI0
+iECaqukZetJH1PUcRvi8ge74N0exXmEQnmjyPF4L3kD3NOa1GYzw+jEh4sMFjPAFHeU5w7SlG7N0
+AxZBehbZiUBvInvRQHQFoTn8AwmBo0aqNGObyuN/RYzoJSq9K1R2Nw9KJExQMlgeyZnHJByWVXRB
+XjEQnqB8mhaE9HmM9HkqycusNE/RHkv0nCHOZ7A4T9A+T01hMhXrKepjbVfAxNe0YiE6pJurAPE5
+dI5l4L5K0R4QP5jWPuWPe4OTyOJXBBaNnIodtZxRTEc0G0fPUouViW1Wrp61MOccw5DzBhumxyhF
+in863pnYJ2OcMzFQxRhYxliIGbFhDdNZMU8YsGDgYRqLnBIWPXUmnLVgIsuE7QwYoyKHZVmFsF+M
+kYKBk6hIFrxMYzU6Y5jddFZcwAVjJmfwY8URL3mDIdvxkyjcBYqfiCFj/OQYUzIS5SWMpxmMpzlG
+5y7qFmR64E/0bPNIU6SMOc0RXR3zZl3tzhv8Gf0mirdqqN6ChUkTnCWsGukqBc6BXysG6gp4DyTK
+sU1V3GTZBG9l3VidVzkDhREYpfHqYgQOovNO/fOnwT8NLqxBq4Dkdn6asZyhUuuL6YRUov5VrAVG
+ojJQntpgWAuMQGlhhrH9lUSVw9RMxDQrh6UHmTobEQEhi0mOjIUAgYr3eczpVRiaiAX4PBCEUlaF
+YQL6c5hXFwHJyzAM0GgBfUvo8IiYdxb849agMnUhfjglTv8wUWSXUnQojH8O5+Kmk7O76Bglw5Q0
+U+hZJGc47JhOO9Rxh3HeKTNz039KtMjUnYeUAmf49RDfnhw9Xkc2tgw9ZE/Tk1GROvvgA3d8pFBm
+Tt0VevKOTXHIGFc0/IDy9BQmi01zGca9THckM8+a9FMmw4WMowdMeWq8m3Qh08+WrKdLpkmOGOWM
+EyaO2uaIdY7Y54iFDtv4DBsdsdLpdjrdUodtdYypLo/0S2KtM+x1jMWuZLHY2W12ug==
+
+
+ 1c6w2VGTHTk3okdGpunOarizmu10o112wmCHzXWmsY6Y6oihTv1vxcuZMdMdL2fETM7Vgc4dM91w
+08BLKSBuln1wE2MnRz3uTOxkcTM4dqo6dnIEPcnR7fTYaXHxxNjJWY5/8xMuniZ2CjYnT/b01zz/
+zXLMEfCs+Elt6RhDixwWIHVrum5PZy3qioGfVpu63apO5N4CZ6Iog59zYChnoig2qBsYSvDSHepn
+KtOzN68Cm8k5YpkDH/T1WaUIx7ninhX7rLzR4I42FAQk5OxY6IiHnphI/c4oKnIBsdGbW6o6t0T8
+0sTIgoGReQtGZhh3bF+OyXngpA0rGZ45iZUG1+ToeZbBNempFjnXYk+2ZsBL/ZzLPOlyOuuynnZN
+YCbHMk+KmbPwzpyOm5yFfTJHXdbzKeOoP6v7ssFkJAE7CJBTJD4Jk4KH6KAH/Y8/EIeGyeOhxTRH
+vHrRWZKE3RJ0DwnihECc/XTnBeMDPo5ydjOet6W5Tq0kp1MryeLogC0a8xVLeARni5dwqGIYUKyF
+JVBls3DUFsoW3XJGbC76/+RYRMIwLFEjDHEtzxpHJblsnjOMqMQZoqifnNCi6tYZw57KUwuNgHlb
+mtpoiJUGNDaOGlcL1DWqhBFQyakIIamNRmAsq1nDrirToxTVepBCvP8KxC+MWE+BbKADkyymLOh4
+RMVHIhIsbg4qyfjMg+iJhdLcRWYLZ/2T0vKgzSiT9dkGnXu2/120jIpal+knKJzlUYF9ZJSC8bRg
+/J+n/xcMT0vyf56zfwEbolNo8hf5rP9PKLdOv0khfgr0E0c/ZoyH5qt5Yyz6xMl+C4al/L/VNfP/
+XxpE/rJEpkBiMolIQvSGOGCgxyXg7UiUIgISknyQZIMEFxBNOCyLIK8kJGqkQazgsURfAHxM08As
+GXA1i4VyHjBAhl3OURtrWpq7WH446580TicboOi2cf24mhYOH2UVGedr2YhsU4xTbFU/y8YWdHvc
+EBsrlOVsZ9tFWmR6vm09+OIt8UE6+c5T3MIiGUcN6Sq2nhESrZNn3XheMI68SkQqpt6ZAnUfIPMm
+FDnPYXtbEdvcDFM5KvSoi3XfFukn/A1xKS/PXSwiPecYm6Y4lJKtyExhvNc5xrVd/9G9d7O00CAu
+ui4SFSxFqvYJ1LOVIIvK0YMIhfEQLhraoC53Zi2uwIwjsMUJmMqhpg+wxQOYkUd1idSUSVmp1CaX
+coxgajXsmDqju10nU1hssTeYn6rkJgvH/JF1LJM/aVuR2MJZ0Fe0nGKa/stmPKFJAhSj6EQCkwwO
+6wak6KRFJzbkfFonQxnqKpfGm0QKOf8nB6s8iSDhqA+dStXEEt5FGe9kkR4TkuP8nOFah3aWWAQs
+MVcLKJzl8MGvpF2Lsbhs4LVd6LUGWbMB1gWmmA7p2GmGs4Rbl2yx5YbHii3WwhppYYmz4Bj3ENNz
+zPQMMz0/DOcvw9lLNFw7dLcOQG3OOEfWz5DN02OVCccQ6EGxfkScXYjbvIPGNndLWIP8n6rbzq5L
+pp10ybTVaf6PB+QfD8g/HpB/PCD/eED+8YD84wH5xwPyjwfkHw/IPx6Q/2ud7f40+D+wwT8ekP9y
+T6s/HpB/PCD/eED+8YD84wH5xwPyjwfkHw/IPx6Qfzwg/yUekP+z/Az/L55aZZxOrTL2ezuyjNpD
+FB/VUHwEegEPuS9OP6aU9SNK4wIoCdtTQQviqAHVvC0O3xdHb5/WraSyfpMhvfJJpOpRzjj3kKkh
+VOCoBdR0gjGNnmXDOVH3e8kbFzYRO4luJTEtJFnOMG0WDaMI6+linmbonmqGQdN+kkFMXpzlJCMb
+4CRDxITE8SwDXQeln2co+EZsFd/ryp5n4JMBnqqu5AIlyTDhk2uU8nQndTWWqLICY97L6HcAkmtI
+zUsAFeZmL4HeJ07u9jLv99KvvVTJ/V7G4Re+u5KjW1xkNlm/pJLd5iKmLMatXYYdLc3c2oV3nDO2
+nN6LbFjOJMPGrW9/nnF6UkwbtwEGGBA4m41bBwV3G7dp3zadFovG/9hLtMRABm+3dPPUyGBe2UgO
+ZnPGKSs5MSnpB6YU9wR61bt+XyM2t3JWPwF8qql7CaQNL4EsNZ/qRxpF/U42vGM8tpRSvOTopaM6
+asq2nRPo5aLEgpFnkFS3hOrXW9PjSQ5vYBqjLXtCWWTut2YvXzOvYDOtn0SqpI7FnMX6SbcUm0nc
+rJ/s3upW0JK5qxzeWP1aUvH/pg3UbikzrWQZ5n42ZCErcNR9hrmhjSEw7P1sLIMgzEG3ixWJXYyY
+xTiLXYxYxQihcLOLIZKPDrglfM5FLWMAJMizMZPLITN4idrGJCfrmK7w6hfi56kgnKFCrvO90AXL
+xXDG1XCc76X05rX0ipGxwHpJnOWaOM73pjfmrrjJm97Mu9502wnneNObymhl7je92SwmWOgTufmk
+PqvNBBEczmY1Ee12k8kd06/w0y/x06/x0y/yM6/ym9gzjmoJ+p6xd/pZUglYdq3ovmuc5bpZdtcm
+b+hz3jfLHX15mTNu6FvIHX3ZLGfTpSf9Q4PtnbF7nEWfLjhp1Pa9csYv/dpF+26Zly9SHNN1uUkc
+Y1M/uO+X5TJGfcf0/bLjmf+dio475nCromXP3C2UFvsHc6+iZc888c0P44gNxGHX/o9Hm2WkpJRD
+mSvm1gLNlubStbJOulbW4iFoKBOGsIgFReILpftB5bHmIGOtQcUag35hbBbrCAVDOVA5475YCd8Y
+i+6LLRj3xeq3xQrkvlgSecFKdbo8V6Dct4T5r35vrn5rLhHXTG8yJKQR8ayYK3H0VlyiYBGRWhe4
+sBBN9SkkOtPkSgJNTyCS+5/xb5RBQ6K5H9jfuYnfSEjJ498FLKzg5EpIYikaN1KTv/Rbq/XfKvpN
+kwEFYIZenHCClnJ+jHCCklpvhjVokMPNro7XutqZRpFz4RmOUyR3t5sJL2QL8bWSXysBtgo65oES
+LAJn3tVO7WL2m9p1Ygzk2EqbMvqdpUb6F55SDHQRtp6pRk8Jk8wzVITB/rlawZQojxLLILKRMe/l
+5gs4w4RJwyT9WRbnoXGgjfM1MxcNyjnRoBxj74HR4ati8QcYFOIM+OpYTgDMQIXZF1I1RKuG9Ko0
+oapTqo7Ab5D1DlJ72tbnXMG80wrmLVTc4qsqGxYe1aDWgmHdYS08unWngDGohHEJm3c4m32HMUmV
+DX1VV1GJkqoHURJbRBFbIoo04FQ3QyDuIiAOw2HRR8Rnt7h9PVOH0QexMVvCvATqWC1RqUh3EhIZ
+d6E0IewcHhC2mJHIIR5rdWnKW7C/g6HXZWngcYlGrun8BCn6snHFuoi1eaK/l9CCEE5C1iewNuJE
+hlmFhKoknHnxtH6fvGtMlaUfltybPel9FfVgHM645Jpepy3R4CKehhGxF2cXaGwQe3m2aEQAqUwP
+Rh8cjfjJ2mW+rC4GGf+jBASIMkpGYi9dGDKut5aoVDSZ/WdR7f0vtrU7ZEF2Srzp+UKBPEH5rUd/
+t7Uhlzru9v7RxX+ENrno00VtEGr+139+1Majl/VQ6gxoUSjOpa5bnX5b06vxoXOONxJco3Jfgy+u
+ApDVe5CZzD/+hj+O4MM3fPWPUDp0Gnp64UNN+Pb+isPtNrkUzjUa2uJCKUX7gP/xNGDe5iR8V+Ki
+1tZGIw0P+qIeYJi2XOR4nvf/wdlTlF80oC2cOoNkoULgmNHBEX2PBABYm+hZb/yX1obF645r3YZm
+vkvSySHQwfk5UANpXUpI6zk7RBToRDJP4W+cWhRxixeysRj6nKeBh5PWcGQHgon1xpVmAT6BJ49I
+zl3UzP+Pfg0N2b50aZyOV0/drtRGNUDBlP43wCb6q9VAKXZrg7/x30IoJfd67VAUuhJCFwNtqA3+
+0kJV7Z+jkNpsjWr1Vrs1+nsd4BylGUsdQjukrtEsTkgeOql1P8ew9aGLXh+lzY07dCZlQ6krrQa9
+9WvNptEmGUCnNvwhXxljGvZ7I1utWrs1JF+BIEdG0+y3kuSrNP2m0WsPyDdbaLCh4njUC13VhiNt
+0PoPzdYinkxTn8xPt9f46Y1HIGL09GkAP9DHDYscOtWGX0ZrOF9xyMxYT94QjYUqhEaDWnfYrw20
+buNvaLXVDA2NQQhMvdpgVO/VBs0QjL5Hh49OF/KudYA81ttjLWDVz4GmdQPWHWh0d4DdAuK71hSY
+AfhWNRoFQoETpNMlC3V6f2vdroZI6vVogPLTO0JYuY1yl3e1AQHTUQjRX8/NbEEXtZEGg9S6TWiX
+VJZ4y3aej0d92G/vDWU6KIT6tT4MYtjqjNs1s4rv/JkNYLGOD30YE+vr+Nf7Sxv0EXIPJyfIvgCQ
+2m51tdBwNOj9aLQyYpgGorK1B3iOib+0xghGVK+1EXH0HlGj3erj1Npt7Z+wg58w3YBDGgEJcSYD
+qeJgUCMfAT+vtfZBbQR7fdJr1NpoT4f4OX3XuS7MThscKmxN9nG1BluOerVN7qd4COQbuoC3hyWY
+Faz30NhBHRstte6+Wo2vi0Hvo9XWjjUbIbTUVDt1rWmv6dz1hVJGvQP0sORVMAHTUvt6XAdwL/cA
+Gq4QwBmNp+5PT856Tc2RssN6/LPT7sLjBGzNoFUfj3QAYRb1X93EAtpnajW+Wu3mQLNRWf0p+jX6
+u08hOrraHb79VRsMtxi6wlb9q2bQLvz90KVe1yAzdCRDy1//S1en2+tqARamDewQ0W3/ldFrLggw
+Z51XvYVJvRBgbgAcwFkIF/GfH1t7Qds/50oInisRaP4tRCiDAL7vrv5vQvTNvwKjOqr6b4ZoNL3G
+eDjqdf69lOxfB4ebwxoSMJDCAigWFBz/5XgBY/kfNJT/C1g6/PjH/2Bu/G9Gg2G71fjfTovFXB5d
+VGPo+W5z/TvI7i5Oyp1xNlIe2Z6yeb/Z/DMQrP67Z2OoIm7TqPdGwGROtI/R+aD12eoGmdXkO//e
+SaYl5Dhe8NuxL631+RWEuhs1/82QmEsWkE3WZ1r/aDVHX0FmRSv+D2D+mOpd98aDhib3xt3mv537
+A4/6dw8B1P5aE4ShecdRmHMcy7olLQhIMZXJNwCrjd6gqTUJLLHoEkqd9UaWxxYbqyCGioch/ZQn
+VOs2qdHVZpWzWPLISyfI9FQckJewFdv+kmlzJW+c20xtQa2T6sW1l0nSalhHlUvIlFaiprQr1pQ2
+WfecGtGuWbse71qtatjacqYJktYhhs3ULTH6yRajn2XRSfVpV5285b/sc50dTMKL3lzKpFmpQXMw
+TAJQgrzcXPeu9THuNtyr9IfJttDABjr3Sv/sJ3v9Rs+nwlDzqdAcu1dodJK6Rbg3+tIGE+tvG/Tw
+q9bUBgy4OM0MwBQZa7va0IQ+x9astQzAss3AYkWWeJd5DgZ2LMy41Py013Sp1+h1AXFHppVZ8KxH
+DOTeNQE/A+1Fo/P3j52ETkAY0ditvN3WHtAcrdUdeewCgVVKZPSdiAIluum2GkCAXQ==
+
+
+ e691uz2PdYHOO/A6be8meZ0M3Wl1IE61EeDXc/T67vzieT30l+jdFV4TbO/WSafthNzr3V67rWEM
+t9DMiaEOR+1kU4MG2yNMpXUs8FkF9Bqtb3KpIO/0m2hl2t3Ag+o3AzdOYMJ4wxFB+wML6Dj1jurQ
+3kmlTCGdLBQc0RiqMrJePi2AHOlWkRV1gTe61Gp1gFIn2yDxB6s56lGsyuRFj1GSygNzBHmx4DFW
+Up1oH4HWH71kbqojBW3YVsu9ErtSHk31Pj6Gmm+1L1u1SWxFtfAxsnud714dYGLY+uzWvEknqogR
+o06lbd+KDIJ71qsN661Rp+ZBQ1FVUsdO5H02D71o2bzJNWoPGJLmVkNnBv3eyGPmqKZxAFtv1xo/
+unHDsfagmewNkMjks/Ko4gfwmK/e4D8oRrjU6veGLUtbDpCDe/1MeoIqrUNN2IKz3IBqDRu1tqa3
+5VvvL+85Dhv9duNvd/JF6jS6Qy+QhzqjVts4s3efH+xTu9b3Xwdaz2Ps/c/Oj7/4iGsNkatPMLKD
+qhOCzvDJAO8AyI9aIwPxkmLGkRSiqsALkBZgpVzOA4e5+U6uMeh54DCu0gfi2+p+eAi/uBryFwDB
+ywcvSKfISaJeGww99tGcAVBMhgMFqDxipuRXd+BD2621WRaUda3eqQ1+htZRB6hsjDpAXWbUAWqz
+o3bC0Y/uKNlsexNUUqc/+Oh1vagpqjYc13Vsd5KFkb6l/aW1PfWWegvpgp5VutonwNpfHmOGSg27
+24drPWB9XUOyvfqv/3QyCXigMagUFgMJ9bBD/ppFvVbIdFIJZnfAJouAZgdcN5jVgVhC/IwOllrO
+NgdcxcvkwDpSdXumo1Oo1cV+Roj1aYFMAM7KFxZHgDyBuPTpIcGjasOfVh/Ye/fHW2IZAGgOhhrq
+eOBdE+k0tZHjjh/16odAMEMWpySrocZuiPK3gExieav70x6OQLP8EZK19ggkGYFCV+nvWjf0O641
+B61155Uz3+V9hC2zpkhEP1I17cii2GZhT9peEjjbMBm+NFVtMVBtybo03jPk2Rn6LZyQRKKlaVxK
+uzfdAPFbp9e+s/sYaL9j5EAabMTAcvumnde7tqQLxYGWjrduS/Ss1xoEhSqJhapkzpFLsUvZ1LrD
+Cddjt6anmTJvm3JS8BmLaB2L337xDvsVBFXTU21BOshUBdvC+KGoYENRbzBj1zvIkIVg6ydNuX6S
+dUX84FAMjqQGaLHEP5l1tNWx050CdMUpsXUKasTbJho9qo2BcQdEVzHpbQOzAJl5UOm3mAEnKiRb
+Q9POKiRzfiBgX/Ig8CgGG4mFWngvBW+HFn+iaN0j7/UTJ4AxGGUJNFHRsuR+lEJiKYVfZZGt7KQB
+WKZoepMEoG3TL4YUjAoJU1IhcRq6LFnWOnoKAmt3VAuKmkJg+Yy39BNwBsJUVDeYhCZNB4l2mcQT
+DBiSqAvdh92fEAqXcpS3C/bzx36tqyufeRT7zWgzILeHzvtIDB+Gro24nSh2zgd1LTcaaKH+AClu
+TfTro9VthYrNXl0LXShlZMTpkZftWhzbrqm9peSWLu4Xr0uHh/mMoiH1Ej1M752vPsW273bWtmr3
+8SNp9Twh7w8qna/Nz274qByOR9dKrVpyuJK9OVCzy5v7N5Xd0/Te5snz2un+YNzIlVXxNB8R0ull
+nh8q38pnnF/Z33pNbuxvx/vD/eGxmOIi+1sn4YFe6Wgkfx5cnuxvp7XrUmtnt6Ekk2ufE12dNB+g
+v5xSjmzmHisj5ftFTj8m4sVO72RYPLwefcV2s8vjspJeuZO/22t3XET54I/qjo2t5AofudvLp+di
+tZS8de+Urbf5sr/9U37Z3xwmOzElHhmXo5XmBxfBi1V+fzsfKx8vdzm5vd++3/yQv0alr9yjYFmO
+91WlIZz87m/vrd2RdmDIw9Lr52sPPq3+KofNw7CcyH+vFK8Ty10yhvtac8xFCt/RWENtZC6jpa/0
+29Z2MSKtxuSz+Htsv7R2Uy5p443d26Plr61Go/aDPrVi6sfJF+lZ4FO13KC18r7Zej1qyu3I3lpi
+EHseF0+uV3/R+Nf3t46+JC6S3bp92S92G2ud2M7pVirXed5p5XKp4YdUHDQOhdjPpmC02FCOhrew
+bLk1LXcn8c3NVilVg/0VTneiibgmt3MXHTKDh5PIfulwe/lOjRcyQ9iXw6fs8m6u1HuNbd82nzbF
++vILbna3G4EJ7WY3ltGWPGXvspddtE678s96NkFB87Z5wgsvy6dKqra9Wg7HHgeolyx68IpbwVW4
+CF9fOkzjz7Hd8jb9tH2nHpPqpbj6ThoTH8RDAN17Pra7q8ZFZe9zh7Zzt7O91fw+e8U7aQwY2juX
+M7QXqCQfGQN4MQcgRHeuUCUtjb/LhGXlDS+1og330tnH7HejWFW+Y8pH6vhXrdXWVuRs/eaycBG5
+vymel+QL5eO69bv/+7L5yUXk9EP1jSzmY7b5qL4JsVs5fV88Lyvfd2+l1nc2tfXRiXyWSx8bAizg
+7nsud9Xsmf3lr387x8Xzk43jsrLePCZroy80gX3Y/VE/eRnbu639kgntZvO1/a3qaKlYPRqNJ6dm
+W1lmHfSNuB+E9aauAXPOSyMuoj42I5/i+/aewpef9yUMAtvv22UFoGMjHpN7hVf7XllXlt1YfSMI
+5Ox9Dcd4lWAu7DodnVSKb0cChpjtWH/rvRz9OE4W+e3qo7i+8rpNBmJdjuz4qqCVo6v99dJX9upH
+jZ0kyyakAgI89BCFuVabCEL3Aak6qzC15fXS55c6zG01bq6KuUfxzr4HFwftW0vbSxU1Ea8XnLak
+8KMdl7hIsXrajAGF2S0o8snDj9NocU2mXuUh9wFIo4q8WEmfTkLO6KK8ftHeKiuZRzG2W3lPcBFz
+XjCrxkdZVTI5OZs4v8UEJykc3MZxp0rqvb8hf4+aHbndve0Vq1/3K9DE8YbRQF+N987E8moi91S8
++vhag9fOVoFdRVuAL6SJ2lm8vD5KNTEJZ2gkvP1biVReCmSxqiefX/nq6tpp5TmqJC316j+IjF5m
+f/n7Jxjh+4rJUwD3jedKs/30tD9Yvh+ZNBtvCdDSbo3Zl+rRuKA2fn5X6WJdbRCS6foUaHK73Ptw
+fD64PDgrVsWrJCzw3UbhYlV+KL3/KPvk6eh4tFN+aydHxevxSkutV9UoTPLuRTk+DF8bT1M6JI9O
+yidQ6RizFomlgketjdjeXew1d/Wx1sCQLCoHnV3xrbO2Tz6VjzOXucx4VBXfNySZPujwsvgeThSF
+eLRUEN8e+7tcxHyRfKs0N4q57EbkRlTD2RJ5+i4VSrgds4oQ/+zQFsvVrSumA3VjWxHV7YMy7gq/
+Br2Yz9HImBedmsX9oafkAR4IblF5WtkXVUlW6Z+oFWPoXERoPGUVsSynLsgvMm59FMzq4D/LL8Vr
+duL6kMzRkCq4UzIkGDpascnBC/XPp232ncvhHq5HGkM7JDQSnT2hsb9SFJLb7TP64GqNDg5PCI8a
+fYJe8LhxV7Xj+DkdFBqKwzbOsPuoK+jFWATS31szvEfmag4eUWxSz1hPpmf0LoEXpt7dZcUcOuyL
+uaJmsxgOyGKhB3j+zE5btnbiXbT4zJCgZ31fDIA1p8m8GBCUaH94KfE+63OeE8aMITODc9gBtPsB
+98BYGFLFBi8EqNBC471iuiJYaZv1ghcLjxXBGPrWbJbAKoYdPCgd5il0G2tHBo+GbMNKGwzZ8cUR
+nU0swfQJ10tuvJ/QgaL+yBvGxppNGUiBIBnoEwUB1DbCaROzKBCjDvBTswPbxmPyYC6lOcwFYKV9
+tdGiGqtIn8I6QC8MkXagNeaKWYkG/m4C+AwEILvG9OK6lyZ4GdXtK487MJfNDSAtkJzcKRYQB62m
+f5OtIogd8R5oScNodvcmfVYspNp5hl+PTg7P9wej6LPaGC/nkR6wyh9VhBwVNgpv9/LlM7+iHB5m
+f7kIaIlX5fLbevgLSRIbymdifY/IyVRuJzJhxypxWOp9Nk5cVNjECpZVQbZE0qpVxIgxerMgv2nF
+q+56qdQc7D6X1fzVgTmh3NbjSbmYhl42zwSlBYrw7Y6lF355/3YtWgFpPHbWax4sX+1s2Z7L7Xat
+mL17etlUjnbCKzbNmMq3z/EDi/LMLEsMtLzqL54pFzHnyspwcv1T0TbUK4uebm2icXUhp+/ELV06
+zm6AEp6MbdU3v3JIsC/vDwZfN+nN07s9pIuBKpHPtAbZ+VUJ1NRWbGccLSttQeaPMpvwq8KDBKsr
+NPXeQnQjAz7x1Ih9YQtg7P3t/IcoFe+56DKSZbuV/lI9vdns/LyTPTDF0wnFjmnMXXlGkOyiPi9Q
+eeYirurz1MpzAhTlTN1BP3sESK7z2xuKNhjEee1iZwvv1uQ6HTwrx3J2DQBkvY7Bnhf3Kms62DPL
+5qjRgS6m63TMUJDylWGxm+7GBYXzm8gPRYB77Vyp/EQ00Dsut7E4z39s3vVsw4RekJa4dTjsfZRa
+w1ZW+UjJrdLXU2kdxnj6PtnshDpHq3wufaFOj5XU/cEePLiMS6tnd5eGltRb5XM/4/oFf3Jc7wPh
+SohOmEWQgd/bekcaX4n/KJQO6e6PHyLF8758IKfHMi/Eb4aGvv+ShH15gt0vFraOE8YjA9yRiaK6
+ocE2/aQZrXvCBFHN7W8dPywB7H+FDcjaRDas8+J1pfld3lZ3BkD592/CBWJLiK+knnaiY1GTD6qr
+H+SBYRnIt5ODA8xG8Hpnht0rOWjPxNZn73vGnnWAzMrQynPSmFoOsPL1ZWO5rHbH72Kk0Mmbbedz
+jZMj+fJi/0Jcf+icMXtweXZ9i0GOPrj7lggIiInNXulQad8DbFwmitXSzY1ae/+MwVzU2/sDHfAr
+o8pj6r1Xjh5XWmjjj/gj9beExiOZ1BnY5M6jfHDdpjYQMVtcVepp7doJXgqJ3Y99alUw8JdtzIq/
+rtjLcEA37EW3kpFpHCSUo8HGu79FhhmI3XQin7x96SYWpj3glXI7+/lkIppp8Nw8EhNRW7Ms9iae
+roz1TAONuBqqsY3sh8mgEv03+XX/dmU00vnLznH1V0mVpRQxvEClKixMMmWxk55qhcY4tYTXiTD6
+1NJ2wip2ZMpKPBvbFPLhs/L6w8UI8yu6L/C8mWKIPj98uCteVWPP6nu2P0KfvtnGCMUmppNPwq9X
+n9YOAZ4+BiznpvUAxtTG5foOsnXW4J36Ji9tXa8q5dXUGf5ObufX1pnuheN6s6wq6xKA6X5VORpe
+xrc+Duqf+5t3qbtiVfncKOZePtcZQYXaYHez29H9QaIwBnGjfYcqXaj16tqGw+BTIJacQDvPp9dK
+5WH/Qzk+rgpyYlPrG8JNlsgR1dWV6/Lb8uorbGIxAzBm7RY6PRoryatmYn/z7PuHYW9or7JL5W6J
+mtfpdyeJ3+stFQDtcqyUDpYjzIPe9oWA95mj3xr8Fe8g7Or6Z+nz87NelEbhC1h5YA==
+
+
+ BJNTY+ulC9td1yrAkXGlTOXx3aFSQW6nwikkcdwiU1wGGagyMF11SU5nNn91yKEUZhKG0KFPrAGS
+EkKbbbWeeuw7QAcIkwC42zE+e1E831SP97fkPiMdUogoxdf3t15uLqCpRG9yBwpRkJOPhhev+9vZ
+8NNWJS9VDSGYbmO+JdfU98RnG5jMcVJ9rV1fFK8+JqAIwVAYg1w+M9i6w6dd2b3sfaV0VroV2BMr
+OrLPyA8ARmEJaHJ6DwA296B8fFyKDusp7W8nwn2lcv5zi+hrwQoqz+yZBVTfOzQGD4PayUomnBj2
+chuAAL7c7v3sb+/2FSBhW3n1sVF/ZMYqZpeXAIe0z/3ciL8Dabz4dZouh9d/nhwr5b+27kvCTWcY
+2zl6NMWzp8JPUa0Wc4WrT2BGle/i8Z18amsAQGX5CW37KVDLzvluxnWulplSMc/azjvoHWKez2S2
+gUVebP7o23SQ2L89vm8BBfl8hn3Z3pM6yEJdYpvY/e0Aon2G93/3Gpql07VxMV/vfxpUlaBrbnAa
+zVci6obELP7OsRThD58q2zpWmscZ+NjqjG+/7a5e7wy24w/b8cLX83JfOT76+DnYeU6LdngRL6Ot
+4sXT7nPxelwdU0Ete8mrjcauILe/mz9GL3c7+eJ1ez9VPC985kunySdgTNG39CTAPsYRasYxLUXN
+pu3oI45Ha/vbOz9VgP29fHZlKRVBJ4m/tSvEVd+RaqNhE7g6Wj0M682+F4rnNwfl4lVv562YOdyq
+4wNBqwJIlmD7QHmTt9dXIg0QDPnV7MpyXSqXii9AYcqlva0sg4u6GJRlRCzUBBDKE9i/HP9Z+B6s
+3Tv1gqp0yanZTrl7Yz171alJMXe9eqR8FFWQJD7ediYXa/mnmDl4OSxerDTOlZfWw/JkL6fR4nX6
+rWJrQO9lN7s6Kl4vl46K3YON3/J2uTEMgqkBwR6fWdCzD3JS07jbu90U30+2leOXqlSO9i4Flv4U
+ih10uLBCRRF6rnsD0sXlONGNVw2dbWcDUGGYUA4P71fQiVVKbiva9utS8XIjdYvOZ5aRkCRk+okb
+xXyHUWdOD9Z5ud3uvxOjhik20mWRkHZ6s6ocdlp1JMaBPMaKtLTFLH5ULrZrmtEpDzB2MlLi579N
+XSP6GRuL+k1UBb2XVbWxlH0BzAgPsLUDSRcWUp/7Pbg6wSepWx+d1VXQSr+zxeOH664bZz9VPgpq
+Eqhz0omdEkkBaXzPW3dq7HwtJrdzrwkvmWL3tFz6OF6BnstJz57v9rfb5XUT2HWpz1LpiR73g/I8
+Cc6VEQLTNoVF9fCModMYkVbHfQ1rZfwRaNIW2wWu1Inme3I7qbbl7++LfeWweTlSjqLRMsLpw/3b
+6mEN7RWGsQ0LefCTemDFbHJPf7DcBBBJxwHk3hrlUqMjsGT2aDzCZNaRyDabjerm2Wt9XH5/FTuw
+vHsSBnYkjUf2HovX9f4HMdGIO9rNBME9qF6VzpThI+IQ8tbxivKslIurR/vbB6WkpfLzMvBmOQ+U
+L6HgOWM41zULnTKmgbp99ItX3dTqzrOy2TOXjZzbX27ftgBL0rViMv/zOfnacyq7WT9fLeYrwxHx
+87iq1rpcZLvS7sJu/TSbzKCkjeh6dnx5dQ/rfRNHdku1yO8edRig0qnqkCpkF6uxnf3EVx66ilcq
+j/nqM3CI4p3ymVmF3S/2vs43TKXDIFI6fTJIEyFmdCNUvAeY3Za+nrZ/y8WL/f7m6XDcsyoa2eyv
+ULgCCtMo1X6UjVaqkduWVE19/DhUDZMernQNUsp1ubzPj2rFfCK5hBSkin7AfPGYq74fpMrKuIiO
+rL8vgbWswZ50i6dIVl+Xf7a2E1yEkjhbi5/7bcQIm6ajjKXZyyU5s15Oqc1NBfSX869ty9Pqcnl/
+Tasaa3cDKwb06T27+7v+w9gt8SrLa9snavxFDsPborklZLG24+PnFry2caTU77UrwLDdg8rDW//d
+Kv89m1YF68obm0PEPJgkEKnyMjpW3lM+1vZWYSV+ZXZIl9FROXpY287eXDRTGF7KESH6icAnrhyF
+P3igyRPV+0L29vejSNh75CS36db2uLz6+NlVPnovMWzFcDRIIxyCXggWleRqZZzsvxaPH9fz5u5j
+HqA2xkuv+fMDqVqQ4kdb5bf47aalPwMXq2oPqGHiwQZoxNaH23kH3b68Bgyul3duop+tFHu/w5QD
+31eBkMQ/Qa8cbmwe1W5PzdljcmtaFS5BwD4tr1Ui5QMQK5UayGt5ECeqdytJ5Si2nGF7bo9W1EY9
+3kRW6z36XWdpFW38m/LBP25bzC4vOaRZvCbGSIF4AzbSXAUGnagVe0WtbA6PtCNFi1tIGZJz3cOq
+oLx8vohETqSNgdx20QTsa23DdC3cR4V9Wa2c9E33r2R4tXCbzR61PrPVxMOjqIYTcuqr26ytFD7v
+BjDag6jc1mSh1Ao/ramxjcavwq8kutiKnAmXNgRQOTqgDz7c1CvIDBkRpP9n1/CMtDoeKviOoQCx
+RtGnw3Z7jEM5e4NQf65LHnyCX9EgL5Ty2xWJHf3b+3YIvTYIKaMWCX2/6LVbXoEyyD8UvVIdtDqn
+KB5Sd2H2qnza6/aU3j+65KLKQ3T5QLHe84o09L0V2zHmRO/vHF8JUB70OsXB6B+9wc+VGd7p5BWt
+v+dwq7SjY65eX0ZhrLJPMGjgK8GdL3XR+6oMan+ba2i/H2i65Tgxr59wvHJGf9G8OhvfnE0XMJP1
+XMJ2b1BttTXT3df7BTQva32/2szN48etbtNz5Z1euhzXzP0VRadrBCyzcYdc7x2zvWzfslmCYvWm
+aQgrPCchrFPTB3Jtf6nXbeKrEg6bWnfU+mjpsQBeq4mQufEFwKSZczP3weV6pcCpAqYaP4wRxk0v
+jfcldQ5oZI57OgRicd4LBMow1zutftvS/uFfGWg2Q1Hd7iywE+A762Uqrq1fkOt80CtVzygi4wWA
+9UP2lgIfOsgQFQ9WQzfrsNsAjmjjNwH3nuFWZ56BHPoL1UGt39cCEAoyj1b3JzA1d84g4cNiEB0q
+eoVn6AO/GWp426rMXR6ON4kFz1ThFK43idmOJNaX1sneF1BYVpnhyMw9enaSESBZjBewuVAJFua8
+XseTKuFYGjuoOl/V5kUi3W70c8ZVclVasTHo1Wujk9rf2iAAbOmvMdImSkIEoFOq9UkqopYW7Bo0
+Fz4RgOIRIKwyaXtmIbBV5u4Ob6CbWhqwsWXzJW9RwMo4JiSBKYZpkT9ILNR//b8jeMiqBqHmmtal
+N8BoONiquTbuhj5ajS/g0iFWodC6Zs4eM3gqdINuABpq/xFqkJaNXmA0w9+xFvqrN4YHg//6z79A
+9viPUFMDIaSJhQD0uYuSgNXGobZmdNqEPbX03BtbG2tqf0FDrU6/NwCMnXgVhc8CJQYsIqiMeoQR
+ogmgOyfiIN6jrGO/47VDZBdvfXbjqIt6CypY+oF2Gr1ut9Yaovn1azCnGrRmsAXotluDlppjfQDJ
+wKylMWj1fakLgQhEa2sjrfo17tRhMG1vFMUdXI9qoIwOAoCpcZ9FUIpqoAzoqvAlEQxLhgpp7fH6
+toLEepQ0iLma1HwIbzdak7l96GvVyVux0TufH1b6AN8pVcX4zqiIgRSnKurXGtpEDzgTECH6k52g
+ZGTH2sCeCQqe3Ot3p4nWwRIlZsRehmW8U9UAmY07R6xP/jk6717U9Duh0majOFNddSLMFo28CwBm
+dLQ1aQkwMwxa08yhjSTp51C/+jMObzD7jWNoY2w3o/yk987fd/nm6vU+/nO3cLDybT6Q5LyUzz5m
+O4/bifdyD8e1Ma8dvGmlwWC31q20b7/r8vvpZbEY7wovW3vCbV5Zbo5VLqKUDp5fhI1irpsJl9Yv
+00NpBbkV1VN8KnYqprcvN7ekvepIVj4KlR/kw1JTPviHXeOpGNu5yn6F1/rV33D86/sgHGskI+H4
+W/MpHBfL1+HowRDmgr54SEonhXBsd6cfob18jaTd/vp2H4Z81KFDrl3J9NP70R6eSzI1zPzCp+v+
+RBWY3zBf7lbFaOFhhYvAOgl4GufmyAbPw8889Jwfx3Yr4dX0UBye6s3mK9Ld1vIH/Flpw7sPij7x
+k+FgsDV8HLxsXZzzqfR1FI8Vdwq9kG4rwnP6/usk7tjpy6d84NppVvxOhd06rQ9eU7E76MXaLe30
+TF5fvum3T5w6HS6/ZmW3Tg92L3PdW1unqBfcbXr9PrbVOD916nQwft+MbkS2w+9OnfJlfm/bpdPs
+8kp+66OAIdlhrumHZ75clS8dZ7pU7m9GzlunV46dVpZ7J7ZOKb7gbteOTtKnbgt8M3huiEeo0/WJ
+5a0s3UmRzGgNXkv3JvZ0cwV2n3Z7sbZm29V0NVdp404Bm+qqtdOXwctt/cql0823zE3zM2V2ykWY
+bl8T1TPXTnOpj+s15063w+uD4WZs6NzpRe4VeqHwOzHX4drug+DSaeZrfU3WKs6dptdfYttbHWam
+OETb3NVaZvk3Oz516pQvH1/KLp1mlyOZfGbPpdOHN4Dkcq9adZzrUmVlZ/VE+7px7LRymb91W96D
+1UQ4+UU6VZ9/ygBj7AIvrQ/X9uN4gTcmOj1462R+N/o8dJrr2zs9OTx7oZ0+JKK2mXKRXCaZfDS7
+tcz1UeZPOpc5504Pl8b5k4dG3rHT87Z2YHYK+2Lt9jj524+7dPoU469PfsfOnR5Lryfl8l7YqVPY
+l+ph69B1rten2eq7W6cKf8u/Fpw7PUksV5tvG1u4Uy5in+vt687QtdPbqPbWd+v0lL9L7MlOnXIR
+6FaN3e3nByXHBX6MV19dO/1eqp7ILp0+Z/mX2nsMd4pgzDbXs5vWz2bkLO7Y6evr/Ztrpz1tL/rp
+1CkXQd2e8u/qieK8wOUbYel+dHno1OlgcJZYpp3WpXUb0sQKG6qEO+UiQm1pVLFSpc3BWCrxqNP4
+RKfnO9HfV/V+HzrdGdg6jW32HuK005/Chtkp0GTUbeTjaYmwclF+EA6tBOKKV8+eKqjTxCRPPUus
+dKWtC+i0NLIvr6p+J3GnaF+iatxGCteaMUqVpJXN0rGVFGqxnfzZE+o0NdlpNrK083BwAJ0ehc1O
+oRcsTony+ReZ697mZdK2wN+9HfWHdLp3c3JiXV7Y2O+vHuapIEJdlNin4qgTFje7dSpdTD4fr4al
+Zqfv/DS9Dkizm9Hcng4AGE5b5lMrtUw/XPDq9rlKnk/IAo87/Mm+JOKnkwT+cY8/udpLOz3FkPxY
+5E+ax1m3t0v8afgu7/ZU5c8bh1duT9/469LPiK7Y5POnOH99uxx2e5rkq/unUbenGf4m/Js0n9r4
+S5gfjMM5+nySUh3wtzfhHfLUjmbppyP+9jOx5/QUr9jTCX+3Uii6vX3G32XVktvTC/5xOffi9vSb
+f7l/3NBXbOL5c45/+f6Iuz0t8K83W5Lb033+LftWMJ/aYOxtICQ3jjMub9eiQuFdPA==
+
+
+ dXlaXxbk1dey64rVr4Xjy6Ujl7cbPeHsR2y5PG2uCw/fx6vOTzOv3erW9ujRbcXE4UV4bf3oDD8V
+13ajB9anxXDyYH+XPLVTPnHUDm+nj77Np7BipcTGFauBRZvVmNwbnhGyR/SzdPwKUSUZ4E6TnVRP
+qlzuCZH91GitVK7u5R6Ux/JDVXlUt5Mc+pYvl+Rko1SSU8cxVn97j7TReCTSH9PzsrSGVUFM5ZCe
+82RSvtRpvrvGp3buxwgznoA4fmybu3+6nGrt1NcBi5bUYf5y88JCcAdL4trORYKwEaTnMFSe7TTz
+hfScnq1TtC+42/TDPe7WsdOlcjPl2inWc1w6BdEW9JwaK4+xc00/vHt0WkkUmE6bq6vLZqdY+jc6
+lXCnWEuiC4yk/y2900rbssBLUbbT9PWK2Snog0LStVMs/TPymGSbK5L+n507TT88uXYKy9sRbZ1y
+EXaBQfp37RRJ/023TjX3TvNnl/cWecw6VyxTuHSaP0AyxZtbp5e2PeUiqdbyZpwOAH+ikL45sfvO
+9bYC1CNS30mgFtPrF6QeoRbiSdZqFbIgbnkMmvbaU8mwkNSuZCzDEeKir62J8ftC/EaIG7+eWGUd
+Vhstap/FpvdYFzVwZYzhEkHyxWoPDa9k2sdMCxF/lIlE8C+0oXesEEw7ODdGoyDdr4yr2GxPXGS3
+ULm5gC9WI/RX7Z6RmKnNTEdcqPykCOrLsMJM1xgyCjmN0F/x0x5ZG10X08mxOQOAwZJlAdmVl1Nf
+mhJBvwAg9/hD7yHhKoS/uAwqrsbJL7qegpM58BIt+dh7ybmIufJ0hlivdpzfRdh/fvjXlW3/LBof
+3kGQk0+ddpDdv7fxhj54otM4za9nbLGk22H8d9BlfluxAPDJWRbLo7H4PMCuz4WAe+WhvxjI4j+E
+pQdz3RHuz77yRn8+mMMFWCx+jsXqWy1X78mejfhAz/G+pQMD7qYkPUjmh2lUmCYYYz9DetZXMVw6
+r91DfOQ9Gspf8C+6dthw6rB26vNt2I1sO2MlUWwcsBK+FY5P5pxaYtk2NWNfLEuNok1XyWmCwyrD
+dC86/rNaJbMy52IF91eV14Y/d/PuVd/kEAQrJWdIrxyv2mR1yzYpqQAQiJcF4Yv7wry5c2leG92k
+KOQYkEz0E2dIrtSHczRmZflCfwLr6uIv0V/mxrsyMiIduu4kPuUZr4Gsdxo3qFLUhQrWyuLLWD42
+puuynegXHToxQ18afN8yQysVtDQWl6N0SOy4Yq7j4j9KySd6/jI5zfNLJynMa0vSvxNb8pMf4Fnh
+0zdnWhuU9MCs7odubIlIjOgqIw+Z0dzfip2q2tmS1+6yuhhUb1aE2srawQKkp59C2IReywkvs1g7
+9agvyDUrovxYOHIekjEa9MvEF/dBLbvySnPrvPePyvywoj8rnoLFcuD9cxDo6IoF2EHbYvFa7e0m
+KDCwZ6/OjX1rtzNCFmu1po1ZGcpsjZGmPtZ+7xe2Yla5bs4V+9iMPi5sxRBNm7kxatfS7TCj3V9T
+ccUgzEVE+f7VlQxNIx1/HriqglxkQpVwZtAH6ITlIKBiY5cUdKyU73+WFoKVB+gM5NgTxiYU5XXX
+1ZFWto5PAinKsDbUDjMxnuBqn6McBWvzlvSjyYxM4TYXP6JgGYizvo+GElxrcR2IQQVM/WWGNRGD
+DoTZl8mheKO9XTPc/HVmUKPdIcJKV37npJPjY0mrk5H+RgIPyTRnw2i+D4EK1FRPC4mtAxejhvgy
+7PoYNTgb+XBDkO9DP7HDa0islgSDGi0vhAAc2giAm74fhAB8HwYlAJyPJUl8GcXWpqHYjkPC/AUg
+wUdWsEMtleXtULsXVUbChvxdts0P+1xND1RfgRGS4r6pldt3cLfy/Dv3YuGlgrlMieIei+WK4A68
+cnKxrCienETxzhFGcVcljZvswMW6JK1sLi1NZUsw187klZ0jDz1vGqViTyBmAn8Lib9JFqYmrAWd
+mivl7xxJe7fVUz992Mu8Ia0UfnmbXulh4HCTno6gl9tegAlxEafdYmDHJltPb/fZE47GyB+Gpegz
+LkzGz9Znt4G4WGyOPO01TqSAsTRwEbswvbd5MbIJ09LeTSSAMdFdlDbxpX9sFaZnWbu9GyHiNBro
+ZVpGeGyXhJ0hgmWDrvjSP7YywtmmtrOOp2aciU9BlcyB2JmfG5xzEQ9I37wMWznfbBOKpAPZ+jwJ
+wPEEt5tcFi7QwtgYnePCeMmyOt9Hq2NldS6rE0iWXYOel9fMo1gCySX4NhrA3O2vwt5fO51OOGl8
+njbvykVnem5nWOAdGpvN3urUFBeZG/kQ0giBaLInrKJdW4/OA/Hm7q9vzIs5uJWYUyv6+f4U7cSn
+H439LAm3k5jO9u/C93BTyUDSRbCTivX1SXnzvmqeMOjymJ1oBLbHQWP+7IYLqHehkXkc+jif8Rmz
+n9yX5qoY6CSKET+9KBooLpl1AslnZi/w7WYAQS4ARbsxKZrbvgShaLe9oBTN3wKPGpuXohl6JTS2
+AIo2/JEWgPvoIH4GSjQBY5PeD7NQNNQKQ0Es52LTtpMMOhr3s1fcTspVrU999WI7OhQ5ywKs1Rpt
+WczrUIg5Okw5SinU0YuiCtJ4NiZs4+jbIBvhfwBbggeHjkSIkcb9JbP7W++DXFci63S+D41NLdW7
+jwv5PrievQYlMw/9ALo054fOaNdMt6YZiQLd/blFe9KKmzJntfb4tzObQm2xkKB2groeeaMhacpA
+woD+Y57csLZUidl5YW3phNFpLFbrabnhXVDvIy+ND+lYi7FmYUiGxhYl3z//OvFCBxusN6AJSz42
+l2BcrLZ0ugAuBq3YT6xmbWcBHkS4HX4hsxJs+v7M3BBtWMLTnjw9N9yMxm3cEH3nLgawfrABuCEM
+5GkUyHXKdMOA2TufJKKRuSuklqU0EdLt9A1UBeRpvxBbNWrMFbetlD8Idr8NAkm6FnhxX7HsYpRL
+2MnbxBReai6E+d7TdE0gwvDqDDSogBAxgVzUbmljTKJ8/5CwMaYJz4kp2JLN5+r+wYsxBfFcO7eM
+6yvsbh11Ry9nUCklHXWjWbxtUWOBWIvD2Y01Upg2tigglh+WVoPYkx3PBiZ20tf5lj0Td0H2+tDL
++ZaFCNchmXZLPCh3w3BgX1WTn/Gp8tuGs2ZB94BcxnL+VWnf1t7w7Svlwsr+a7m6e6E6xdB5R9DZ
+pb5ZY+jYOKDJCDrz9ob5Yui8I+jwafUCYui8I+hcogWnjqGLeUbQGdGCc8bQuXRKI+hMajlfDJ13
+BJ0ZLThfDJ17pyiCzjVacMoYOu8IOuvuzx5D5x1BZ8TxzRlD5x1BRywk88fQeUfQMefIUV9F8klx
+cnbx0tloHJCDD/zF6q+3s0vgIRnGATdNHKSdQOGBVhOTm8spIye7WfKfFKv8679O7pbei7XwYtbJ
+amJy8lMKuk42Rj/pZ2ZRuPSbW5zD8CzuOoHhyakpxF+8gTPw/Dzi5gwZxjJD10H5xhQ4D2ky8tF+
+mOO76K5D8rdceayTldYECpmb8FMKBrCv6lSuIC7RterzuavCPZUriIqNxgEsvQHMxq+qt0bLBbFX
+wdSel/3VMHe7OvaERMFuwZxBfILd3OzFwS29KNgt8IGLzcTExL2qAZxBfA8cYFkcXEFMzSKQIsI2
+Zo1m8NRpiMxvacwWz1AXezYhwmYsdoLzgDS5Lo699yBwiGlt6W2Jc/TEChBkakW+sncAIzoXm0K3
+R1ZIcXrDmWXFrIZDJOvGrWaSCloYNYA4EeDEqlnx4GyWODDfKLD8aIFxfK9jb440TRyfn+y1wRqt
+LEOy+MCv7WiuQTABRGlLaJqXD/z5lUOIpntslJ8P/DRxfO7m86D7Z8bx3SbmbsxoKmlryoHvB2/M
+/cTc1pQRNeDRmE+8zXQrJixuxeze/nOtmDTfilkNv+SKSIur0+eBn6xuERsB910E7AP/oF0d2X2j
+5dyinwI04UdwMG4LASIfPw/mVvYMSWm054vduuzsEkW1t+rdAOffxO7Q6kXgsdNuK4I4sl/8rO8O
+2U5GnPiLIdS4hrj5oqvvYtj9+WdYDv/Q2A0uiOcBmlB6GmuAXYq06JV7UWVgkyPFl+HnaAo10xWS
+gXlOZbaYITyOjeVh1FX3iKhg5p0A8tj34WIwHq3Sqr88FmydnMw7NiDlIoHWaTrzjqvlyi02zt3S
+4DGkCYsMo/EFhksypGksMt4RdlNZZDyG5B/36rFOVovMzshukUEhSX5e0MEsMp2jABYZPy81aWUz
+ujK3RYbYxo8W5sjXOVqABxFMLR2d3vBgOxPvHM1vkUF7brPIMCcjU4Wh+RyC2ywyjvH7R4uwyKDo
+PJ2Jenp0+4eao9UJEJzjwZGtwnJqUljuH3vHoZoYTS2KbsLy8fz3hu1tXkb8PFWCKhrS3k3OPXSU
+i0xj1Dme8d4wCyTD5NYXET424bpg5y/B4uqmvTds8lwMx9UtIAYywjiczOo9eBwwhGTZzW5pC65z
+N4L6Yq9hb6M2WEQj1+wnqfCdDzAEY3T31wu5r883Ho6bxqdu5ng4h7NXaGzR8XAze6hOFQ/n4aG6
+wHi4+SNSg8TDBY4WnCsejqFjTETcouPhGJ+r6oyhGg5oaI+HY7WkqUM1AsfDcY4RcfZ9mTcezoBk
+IwYARcRNHQ/nc+rLxovNzVUQe3OcMxsvFtgnEhrzCae1LSC+C9r5RgvUmPuJzhQRX9eBTqy8Y5Vu
+AntC+rcT6FoL7xNe3I5VfZ51Vs5C/HSRXDcz3kXqqFmUvO8ADhBOYENCbLXe3bCjofpc8l7AYM4X
+sA0YCRmvzhkjq3xCMaidP5Br8tpvIMxxu1bGHmM1nb7ouKcOjg3TS+MoZHARtwHjduZDQ70VioTz
+3N2B2wmkS3vfdYPbCS7auwr2hMLcTlwx43fblJd3A8zPZsOi8WJBVWpPhRrFIF05hi9MR8fuFhmR
+ere4iNS7xUSkPv8uJCJVWEosJCIV2llARCpqZRERqaidRUSkovi1YNdAO0evWTfM1K+dTkX9PZbs
+aPg2mHDuQ98ZSOh2q3kwNAwaCmflYq7ROnOGwlmtoyh+7V8RCud5D/zCQuECnSTOHQrH6pWTjiSL
+CoVjepnqmvrpQuG4IDeWzBYKxwiGWHt1FQ3rQw/9bIob4QlHfrBfKDxfXN2P/SbEidO3gF5VqLFf
+7+Mfxnys28ZdDMiosVEAdS2QDPNgv2R4xsMFEsI2eYDjcJuW1+28iJinPFieC3NwvU0LBmW763u6
+uDrKHNiYdxnf7eHQH5sxPHq1kkMZw6/DIC+dhBP5xFt443hLCMeVq7tw/Pb1GiUNr4Y3qsUs+nSB
+6pXCieO3DNKS7n9ylB3t9H7YIetnLdZgt6hHsNtFimfXWI86o7k4h2srPTYBqjXYLVpfufpxiTtb
+f/ZKF/easPJ9W7CbnD136TS7bAmLsge7vXpG2FXCGae50lzIlcGD0ak9Fssjc9t2+A==
+
+
+ xRpjZQsBu9y/Yjq1BbtttW/OXDrNfG3s32303SLs0g8PXsFun7xrp3z55cA9wi7yk7qtu0fY1Tw6
+rfCbrp0Ohp9Hy7ZO2Qi78PNy9sZtgeNeMz1cte0pQtcE7h5/0nc/fzZuetek9c6XtSD1ls53wlZP
+SJeag/HbDxtFjuY8IYjqiAvvxqM2dup9l5q/y61Ngr1Y7djd5K32VGIdnTGOpu9qdrJZTQLksdr3
+vqo5yJBIprzBYkLFXO/JMX2uFpVJzsm65JopzyeTXMCtW1uazufKIy+ab8YRm1/fnEnk2HWyNMXq
+lQGSyAWen/VCZId74G2O+R7zs7uHuw6JWEe9BuXrTBlgSJha+uWPC75OJ+lnpyEZmSWd3V1niKZz
+GiETkbqgaDqXFVtwNJ2TNOqei3PWaDqnqU3cqjF3NJ1TLJ3reeXM0XRTRT7OHE3HbJNhbZ7Hau0c
+TeekfDCQvKBoOl8v6IVE07lx5MVG0wWxWs8fTecUS4fnstBoOg/fngVG002CT7PiGSc+UzSdE/8w
+7lVYWDSdE2l1PBWdK5rOMiQaS8dYRxcUTecUS0eiORYZTee0f1ZL7yKi6Zxi6dyy/s0eTTfzCe9U
+0XQB4isXEE3nFEs3/4r55M6ZbsUCR9M5r9iio+mcjlEI5V9kNJ1TA1xk0dF0TrhtWkcXFU3nFEvn
+cROFWxM+0XRODVgpzCKi6Zxi6ew5H+ePpnOKpbPg/kKi6ZzCb1xuoXFdjukUQNsNh9YJzR5NZxuS
+rgBOF5FqVQA3hxPBO1HFUcSwetwFDKRzS1PpGmPkKF0c+uWqtC2/e7Yzmq3OUbqYK1+dU4KyoHkT
+/PPVecWsMedih35ZKwOv05edffvcqOM+Nf88tMyQPPwtA6SqCzok4t3hnYQ26Dq5I7PjLWce6+Sb
+fdZxSJMUBgaVnYFkWm8XkVYKPylTH9Jj32wa0aT/URAzmGuau6m8oWZOc+cQ/zKZ6G4qf0TL1Gia
+u3lsF8HT3JGoAZ9Ed3MYY0iau7n9kwOlueMCRRjOm+YOZWXyTXQX8DJb9zR3dkgO5IU4dZq7Ke6F
+A76wPCMwMPzleGFxFv1jW2SRW6xogID2zcsFxPIcB/LF8At6DOOn8/laoz0P4tHM+QfSze2C3z+e
+5JWzLYx/VFqwRBhodXIzYi+xwdoiiqKTijLKTTc7o7NISlrtzTHV2bSBXWm7bXhmbygs8y/KGwpH
+/8/rp44iH+dGPuR47x3EbkjjAdqZNqbWKfoJ2pk7tytpZRL/ZsmTOH2iSY88iYsJrKWaBbI1RCcC
+a781n7Ok4GFf3xofLL7SX8JDjW24EjPXTBOunnvX3UBLyaqRMWu+V7sP9e3kkS76bupABtfop/15
+71VAAVmLy2B4s8gMhjczXhBgw/3b3tyJqnHaNadAhmlzDKF2pg9kmMwBgdtZRDxnzH579qzteKTW
+sviqcv5oCAjioX/PcMILstckGsJ388YT0UysrjnupgzschHnGR+SoGg4Q4Y717zVNMfdnKyTZrib
+P/IxSIa7QJny5o4n0jPlzY2GnhnupsyUN2OGO4csM5Ycd1M1xriAGtETOMPdZL7XhThaYCcVcxtm
+p2Mg3PmEpJtijt+9o6ixQLGwnmKObueHxtJzqy6w2ppj7MXUkY/TBtYatj57O/MH1t7ZVGv3PIn+
+7QS/pMqdWt553gs3XRATunnS7lwzX3y7g2tNCftd3HgzsIBo+DbwjK+cIoyJRoRNG8SEV8w1Iqzu
+br6bSm3HK/YVwF0wgDMWGtdPIKwMkITrfvogJle98m0Q6B467yCmzWgS81k3vj9djCsMyTOIiblv
+PGCMa33ixBV/5ykYcsFjXOX75tgNSnzy0TnmfZvPz846ScbXet4YV2jM82oqiwzjF+NaH06f7tF9
+xWY1T07u5FvSFjUwQ4zrgyfLs0U9BxpUQIhwZg66Bd7E393MadexP7oHJ8PBQByt0CC9o8IDiu2r
+ol/74VgjeYTC+ko4ti8pnRRWGB151TY8+skSmjYYCpEBi5/WPGxL4mbBJc3d0ioXcQ3DG4zfkwkW
+Nqxp7rbFT/eMc7bcerAvliixR6/Yv2/BtVO+/HF27dopF1kVjt4abrF/Ta88bPI106k1NG24/KUx
+8XAIKy0LvPu70jHmaouHW3cPwoPl3XHPOAe7Xy7wbrF/2eWVq4746haE9+IVDzdMW+RkW+xfJf5+
+69rpmhbNfbkF4SVdO+Ui0O3JmutcB8Ob3bBrp+H9l0TVsqdaQe8ef6LbwEXWS4/NToCa66/jTte3
+Xnb591W9P7fVo6cJlpqZLwp3lE2iuJ3nok3o1C0y0c4E6yyPBzZyxJ6/mKzO1U5slVYdToOeFCe3
+ydmymF2slV1MTI4Wkg1Xmf9Jmc61yn1IIO5a71GcNdqq7H0bT/DMLEoA1ypXc65N43tSpnOtcl0n
+q5A7V1TahqtyNW1Umk++g0l4cmoK2/pQY1P4aXnOzzG/i7v3oFeI21ReWjAk1yjOLV939KBDKiWf
+FoMvW+6OrUaE3aR3rJVcrU+Sq1d1Khuze84UdQHX0T7E7bmfZo9GUp9vvXXpCBdUAVYXcsrzkJjV
+pcYS7OZs15rKPoaiAGc6srZ63aAowHktyygG0H5h54TvaLCFmfLKRnc7jOrqpxXQPta3SH0H78Lk
+2U5d/PUz4wahMLXy4nTkurTkPSQu8Kk3sgnOetmVw13QsFgel+EHMNnZbCo/+T6iMNa0MnYD48yu
+3hVTbnO85Wy6tGy+chvOyBYsFNDnnoOpYqzq09xz4J4pbsk2pCmlccuQrOZOr0BAypE9QgGt9H62
+UE4sKTUrvllvAodyDpzCdGyaxRSN+UV3sU1hjuzRmG8WnUDjQvuCGvOH+aCTDBDLE7wxv5PLqVbM
+N5/ONCvmEZA2ES7sKh26xwBaTqxm0oiCxAAa95DMFAUYNAbQRxr3iQI0F8Y7BnAae/LsGfUMSJ4p
+CtAyBo8YwMksZm5rMk9GPSNWdKYoQIYReMYATkTZuC7HPBn1MOWfOQrQYUKOYUPuOnKQKEAHyeTG
+aVZIHrMFHvwLkvKZGdn+lUn5vKxwi0vK52qFW2hSPi4w0fCJJfQUTyZPEv8VSfms+ZL+VUn5Atyl
+toCkfD4+8AtKyofzVyqjOZLyWYekOWIvocn7ZDx+ocEeef28tdwAd0MFyuvnH8m1iLx+JJJrcXdD
+Oef1m9Lbdsa8ft5Z/Wa6G8ohr5/3hJxtsNPn9XPcpoXcDcXm9fN2M/H1HA6Y18/bV4qhlnPl9fMU
+2I8XkV8M5fXzsykFVfC98/p5+zNZfK3l2fP6WadmT+Q2g93SMa+fN3w6ZWeYJa+fU9TdAjxUbXn9
+vBHXK75yIck/jJjEhYUfuWb1889fGSyvnzfWBY9Kmyc9gC3XwMx5/ZzGZXK7OaI5am+BEnMFyMcX
+OBbYO6vfgvLx+QR/Bs7H55PXz7sVGjMyd14/65Ds0XnO1HL6vH4G5jhm9bPfQTRrXj/v8BRiH5s/
+rx/DuxyWUt+XefP6eWf10yOG5s3rZ4ZKOYnuM0Sl+czZSY5wli2nz+vnndVvAbiP8/oFOa2eP6+f
+dytmPr754x7cs/pNn49vluTc9miOybx+s8c9mDczO9/RPX3cg3dWP3f9Zbq8fvNHpQXJ6+ctzhsR
+Q3Pm9bOOy64tziCNO+b1m14anyWvn0srt725tVc2r593KwHy8c2ChrZWMIz5WMCCBpO4Z/Wb6UYd
+h7x+Mc+sfpMnI57BFq55/aaOSltU+mImq59bZP20ef28ZSbfW5sC5vULlI8vQBxukDx6btasafPx
+zWbBnMjHN/edVg5Z/USrxjd7Xj+HU6UAd6dPm9fP266lW+DnzevnFPPkwMXmzOtnm6RNbXe452qm
+vH7eaju3oLx+3qeZzIrNldfPspMTWf289EoXwuWY129W78Hp8vp5C4ZES5o/r5+XYFgfIp/eReT1
+2/XM6oc1iwXk9fM+scHS+ALy+nkemKHo2oXk9dv1zOpnPUuaPa+fm6XT7eaW2fL6uQ8JueW7Zvud
+PumrNnHOiL+z+SlZh0w4g88lpvzHzWbKbtqF7+zIbPVRxM26Od7bwhYt8NS32bBgcy5Kpj5o3Zf3
+WJddBBwmYIRA1Za6JbqeemP0tTetNBjsXrX2U6Pto6KQv7sW13aXFFwFRVOhWJ7qRW0QjjzHVsPI
+FBReez34Cid3vouxrd3fQmx76+ohVm399HhV/U7x6ndiky8fXyp8udc64SuXhQR/cnj2xp90Pj75
+87b2xV+fSgW+eti65W+GXx/8LT9CWHn7ujPm7xK3Uf4xfrPOv9SXzvnX1/sP/u1KGvHv0v0a/34a
+vRwMBmpqMHzubQ3GQvd2MH7LR4druVUkEFyNUGTnWqLVPDg/OCt87N++PH6GN1Yj9xcr+a02SH2R
+i+vK0erXT2RpqZA6iy63G5HDdGH1vP59r2xv6KGA4XG8nz57x1tCwt6K5Wo1wq9oTfjuoudIQei+
+nAC1hFEMhyig9CSckB/STApImkdwU3ZZrM00LMf4l3/ffl0fDM4SMdeZol7S6/exbWltny/LxzJf
+/mgc8ZXzs85w+TVbR7GrYdrf7q8a28mfPfGp8lsYxSRe8upt7g2n+eNT51rchk0m+uhxryygRTum
+vZWZmsl9jJVAu7EaXm+1d8OJ7uVzONZIXIZjj9H98IqSP0cBuEfo1xYXCSeKmfVwIrV2Fk7k428k
+nyb8eYueK+GN32WYde03T6GbJNIUY4iCrggbJWGr1KqlBDS/t/2tk/AAb1NZFU/z8Om6L8Q/P3cx
+hbn9xQo+n/pZSuK3pZVCZ8Tz0WQK/4nIY5R++tY24I2DddLfx9pvDP0Zo39uRhPozwT98yRNGkCa
+xc3mSG38/Bb4VOaQL3Z6J8Pi8d3dC9CDUYEOdDe3bj5gZ7C7E2Me1FZKO/qDUsJ8gPjL482e/ugw
+ZT4CKeyzqD84F4wHr7B1kTafquxsmN+xPVdKceYB6pmL6I8Ok7De8Q1gas8xaGd5XXwZfo/hwZWA
+/5T2bsLw58W+2fYbFhbhu3IcVdkAaVuTMV1BJDEPVPUkD4TpfIBg7OI8hazMccyC4c8b3OwG2ZzU
+xZOUOr3+keDtKiz/8vYyehqDDpIdPvVwYi7Mu97LO2x89jGhpGrbq5uf3bUbLlLeVtPfJvmkxLVy
+f8mqsLoeq/Phk4JOPCdadGqPWEd9WtQpLG5x/Sh/WchXyvtrWlU5bNI0lTCre0GH36oYU+KRcTl6
+cHgorrfflrkIBa+HWtqYeo0Fr/p5Ai1RHBY114U/b1IU7Ov3vFA/OVyHT08CkX5T9Vdxt3Aowl7V
+axL+ZFgVKA8ssUwPoIglAAZWTksAnjEBANyH//YQsh+F47/9c1LJkQDYM+mmVtEko1SzAGJNJ3Su
+bWBcBLZ7vYHXAeF+edxGd5mjPJ8ZHjch7d2ptfLb+tMxQvskQucoSbmpDX+Qs/PBBg==
+
+
+ xW5hKSUqiacYYPROXN8XhPsgOMB3pSQSVO516yj8WqcSc6accjaTAGXQQQVZO3STB+BsOopnxTej
+0U0djzfxNKKC+rq5bWDl7j7GLCRdXP3Cn+WkSQVgpvUfub3ULQvxfolXjrZ7/CQ9ACWcbCIQBQEk
+g12Y1VmMUn5WXsPyCpJlzU3e3embjp8YsDN2a50d13TZAwsWsZ1rtYmk8UhXGQx2GtbMsEgs2T4m
+qhSuLpaq9bQpiuHvUKLfU72B94i9gXH94hfYYH5M8yOHVx/FI4Zj4+/COw8dXXQY3liuQkDwm364
+wE3QBjK9Mgv76WsSG49pIPaEPBORmR4BxkEMfUoa36WM7wD44tewYaPogOAxcJ9HY7FWjTl/bUS2
+w+/M/QQIxLmIkc35GUhTugKPhKSNQdMJpddfGTFgWxle6xIAvgqhsOyQ15jknKX7MlwqN1Mx53sO
+lB9yIGEkgTZuPHiyXiixwUzoaSDV9QltCjYJNv3rPG7b3Raj3V+y5+P3fSlmJmCGxeqZg0MIkKS3
+N+AmjFsg0IUMhSU69cb5KaIXSxPXQ8ROky7jxp1iwTDztR7de3rB2wDy2MRG7P9/7V17QxNJEv8E
++Q7jKisIGaa7p1+6qxJAYEUEBAUfYAgROHltCOd6f9xnv6rqnp6e8Eqie+zeua6S1PRUv+rxq+oH
+5982Ee7qVcfgPTHwkgyg+2g1sNi4jgVdGzlgG3punnz/e08rBm3DducyBjgvfbOgS46GGcriXuvH
+c/tXzAa0oSL9768YsR4xXN6OxJVubrmSYzs0ni5b8eUA+P+yXCl3cufKFlInHea/VnU7P4WqjqKq
+5l9stirh4fsgWZvv4yZ9mO+9d3T5qPL11XFPrF35enin0prXlcLLmyeVvQqPl3cqN+Us71eYLX8+
+L6JgdMvdJ+PoZFSPocza3aeGrEDp2Uq4hFm4e0fvyceDm9yUDhc0NrbJdda9v5bvz/DrZIEk5u+H
+T6MEHBAQPKgCAsIHE/TV7R8j/JCGFyfHZ19vzGN73osnr08bhdPOR6OIoOrjI+CPjr508/SgNuI8
++/0ni4+LR1WXf771tHiwGMUdcfVzD8fIWcU1zz0tQ44tzPWVdc89K7H1Fp2ABdripMdZcy8zBFPj
+HqbPrXNC7TEQXZ4eJ2DvgejyQj1kejHJ5Nzo8mLq0P/9XzdAVZZXM7TeDP7Zxa8bjq14snbsYjY+
+di8d84B2c4FmcjyOZDZfpr4W0TDCPGpvjX2a3lfPXjYOzV0TARSaWoS2jlnvinKxCAwcVyeJ42X8
+KqcG+ue4npUc1fqvD6en1n9+9HF6Xz8/nVqbOn7jQoXGuwdbJL0Q8Y21Ng6K6HZNBPH6GM/vzuJE
+FBG4AGlnNXXBwOz7mTH3qfnTaxcglBAZAkq8uQVh3iaI0i8LrrXo6krgT5DHR91T5j6JUiHxyyde
+LDY+jxdqtnXmIu2Dn5Z/DpH2WYhfZOpS1z5UlPkY7TWChj7Frw/HC1AKiha0Cd54nTldw+Q7bgRP
+CUCzua30rVO9RvhtJtWU7XxG6dmwiPpz8eD5KGkym8iOPxZj/PyBp02P7ATahKetM9T35ynYsWBt
+2MTer5MF1F7MMrnzHFe5nrOoyFzjdwWisvcSoTZUsHlCkzPmrikq8zAn/35c09ryxOTwz+Tq+WG7
+87JzsHdwnEzUHtUmpxYYWz/ePXnWabfX2n90Z05a50ft427yMJmcejW9sGDkTLt1sttOJiq/ljJK
+rVZSgU4O36qjt7/UPz470W9EtnsxUdg8njt8/Y+dxscXK1NTE8fsw6Mn7LWZubt7PlsbmZmef/+B
+FP2SVC/pxyPQ4W5j5pOd+zx/d/XX5synbPNxpD0Esu+frv2OybN5vI1tBCPBd3cm+LNXd0bnz6Av
+SNh0LsuFINWEKqZ7yuxrz2ojRQ2P1cirkWf23uru9Iff7s6PW3m6PDUv9leeflo7fTT7pvECgtKn
+n9bXlj6v3H1zf2petV6OW2Xfzrx91t6gvk5/WPh4QNmkqmqMsvHPGm/h2twqBObFcZkRKVUWvNth
+SkvddycKH7TZ8SatO4qitd316gRKUnxio5iGGfXGVGrSXLyXeOGUIlP6CvrxrkNBabElFKPQELRm
+sbze3w/5sudj8QPbbYYH4/GDxfFWeFCvONqJLd0Ojybjd06n98KDHl144NQgoq2PBmVbmogf7OUQ
+LoZHKZlasA9PM2eP5uvPEJgvMaeg809W8etKzHtnbxxHdsXrcOuefuitNoTxLlPeqv/KSF9WJikQ
+Yq0nCzhsK55ta2Wd2IooDTW/3RnxfqmeY1JwrR4nbJ48fRRkf7VxmO49mFpufVoEfXm+cOdVKZw0
+tcE8XTBehWlo8LH5Z79cxvEyfn6z5k0cVxZ/LfVTdpfvtec+vDV7U6/O7x3Mvt1dRnu7xkr5jbHG
+5paojYRcVR51feaJDsLyxiVK+czKNEaUbyYLsX8DvHc+4H7dN6xwJW8om3SCn4T7VNlKVUlRlwnq
+wgAErRzUAMycNx+BCyQT0Bg77Cw/neyq+cYsX5u5wgAEWzOob6QFwsu943f0je6Xk13qHb+jbyy1
+8oJ3/I6+sXpo9sbEJAn2hY2XF3RtKXI892a3JC0QumTQyoVkED+rx8mglnl+IZvUHT0LDJYvZpMe
+zKX5/NRRmfY6eXAx7VV/EaW9Ru2mqKS91N07I417Mz15s0L2ISByKVEKS0BYHtXFz4/eMfARMxMo
+Am5VlmgoLKmjfTjbFhQGFXq83a2sO969XwbBPYmUIiVxXSrl/kCplIuJlPHjMC/Xh9CbE8f9JK7w
+Iv84geA79L73AtbxK1NXlebpTj8ZA3cqHhpHqSJgUaaunr550IS5Gn/mrnlFexHG5LD3l2hebPdW
+nNE6XF+iaSiTBVGHJr9xIsbiZB5mJ0HGqvnJG7OTY1cN6jVt6EkUjk1cnyO9uQ31yxjQvPTNYrD0
+YMmgvPJpLLuCReUq2vmPE32K4UQ0LLWRazmGxoNu6NWxpeI+2r2sWo5d3cIoGX2dxEzwsion566q
+uefTlXKTD6ImHYtHy0WTjriffVqAAMP99MxBtXCvq7NPj+feuIWTyKFEmYyX7WPvWDc+1/n2/O4E
+Ll3VHW7DZSGHxlO/MLT+E7me+8W6DXzCjXTkhx3oDn7YgW63BiOf1t3XD2dth8bFvV9++ejWmD5t
+Pd2LfGXc0B7XGj2oxp7Rg3W2Gx70+NlPUS0x3K/fW9gPANota7O5xZ8C0l+KkT74hQDelurxg9OH
+KLhLk2F7q1zKHFieV4s43UtuhY7tbI0E3ivjrsjOKUPlW6kHm3SP3388ijvCVlIPudU0clnJyGSC
+hWnNvySCZ9t6+44V2Z9n42Fl2GEPPqYehoFZS10t2dg9k/HDVyOzE3YMQrPs9b0KKhg9chuDVj0o
+vXBkMezRWZvsl+Nl/GqXccwijmzy7tkv4+uPOurxer40pT/sjnqE/vbVnWLR9x0v17tL8eJj57uf
+qeMUv7yZiIH4/K+o8W9Sj8HfLjAn+DOtlz4lOnO4zv2n83dbhK347Fhzu9gCtah7Eq/FUUMIdt2G
+CdCIKdLAB4VYvDr1RUDRigA3Hy0D3BCT3nerOu1/tGmLxZhbhMUdF9QX3HPhsSAo2tM7H7w+TROa
+WZ6gdNXkwUY3dbj1YOLhOFkLce/R7G+XHRQRT14vPXcy5I6A+mMfo7vrHsv3bNCggLtnbwZF3Y+n
+624RtrofI+Bb0Az9en764+cpiF57MrEoLC9obMG4GDclGAAbB4IdjJ369+Pao9oI5nu2Z49341xP
+bWQEKK/a3fNTLCC3G+29g+PF5td2p8YS9yeDP/ivtgnjJuFSwheJ1MWd2uh08/D383bCxpJFMObb
+k1Od7sxBq3twctzsfE0eImnjxeL6wkzyMPGFt6Hwo2QU2pNtQ3F4NoYppm1o43YtS6bg78aX2jk0
+YAY+voS/q7UstZxJZZMs1VIZJeADyxnTCj5kgglNFC5zLMJtxiw+kdzmjCcbyBP7wOHvxlfg/Bt8
+/UfC0jz5kuTJi+TdhyzZxYpXa8LyVEnNE65tmkmlkqNanulUZsqUtMUa1J5qlke0nMnUaGsTbqBq
+a5Ci0zyTAih5aq1iyTS8Z1IjdQ40mzKdWSqlZA6lrIY+iCTPTMqBs8hEKiXwmYZWZanSWpe0xZow
+LOVa5PSeYoYnAirOsGLknVvJgMJTroSmFmiJnOBDrqymdlsYRCgD1cEglj25OAbTtcZOLUvcn8Y+
+DOHo+vFx86i9m+x1mrsHmDhUY0kd6lecGY2zICT0CqUnZUZK62UJiijDbFLnDIYk4wkTCjpnrJJJ
+Y68Go2MtU07seGpllkNzdCokl9TRzDCWNI5qOzWeNBo3ytxps7vPBbeXyxwWXMIcJ711CZcrHwK3
+P44Oj+Fxvdntdg52zrvtM890qtNpXijV2j843O20j10ZnkwuwJCFp/hP9+tp2z0dbbX+hf+PJZOv
+gPfxXrXgP5uH50XJs5Pdg1P4+7DgcHbFSzhZXtGSS9+a+PZesWt7dXNnXr2e217bPzibPWyjeeqn
+JxdeQbr27cCHr/abp+210IjKPCaTSyfd1XbrpLMLgux6cJOMTq62m4cvmtCuP7BPo9NTC3NeA9Y+
+nXSO3KPQvqndk5329tSCRbl71f162N4uWxAZPjS1G7s9WsaH1jL3L+hThkqiktGxZOMNfAGTCqYJ
+bCm+K9BMMrSgGWg8GscszXOdSTSiCjhz/GDQzMpkowmv/wZlwG4mX8AgWTLFoJM2NbnSYCaFVanO
+weqgnkoOCouam2VglMEQp5oznbyGUjnYbu20mecCzBZQMuyFyHiaaaBsXsJ/sfapL20Hs8j/btre
++qHq31/VvV7NOAThtcqBGkIEoDxMskJjenEBAQGT5dq5c3CZHgjwXLOShkAA0EmO7rug5SxPVYb+
+Cjw0mA9B0MDmBARkqlWuCAgAL4YSjs5aZNoBCMZQM1QKjxPCHTIzTjGUFYQEoHngIAMJgYBImUTu
+8J5BR4nQQBM0AN6aSeAAZZRGuAItoFYiFJCAG4SgdnJrDEEBY7kq+3JxFKZrZ33qoTB/Nz384XX/
+RFUkMP8t3ieC8LEryjPwfYBUY1eUZ+BkBHwMrigH4Gy0jj1RnoG/EnleeiKkGKYqnugi+wE8UfZ3
+04AfnujPE/8Z53S4NmCHg9cRRoEVtt6noPgfUZBmtDfMEO8mSMhshuYbbH0GErpJ5psecrTaGQR5
+Aqw92XEOVttqEPJNYs8yijcFgFmKCXsrfI2487KQThPYBMHnqJUJhLy5JdipoT4Ksa0BLwOht8GY
+zf2oe2qd5Tm8APgvgTgZvB0oskJMCsElvI0FILjMAF5DC8GDAsyWqVDMuS8JBoBaCEgwTzaOalop
+/ALGoC4yg2Ei+M7eN+saRjc14NUSAZjdlW+0hqmy0WeVODUMLBgFyyKHUYH6Pjng3Q==
+
+
+ j5XIhfrb+ckfVuK/H5oOoWt/UqyahVj1sgD1JptxXYCKaD1nIs0M+lsEsRlABHDngKjBmSKi5ilg
+dklYWTHmUmsAkQ16aijFlUX8DMOjDCJxgBcIWtHrk/3cJP7QIgLCnFH+rbfC6+whZhUZdQgGXcKb
+PEMQI8C+AJLA+cA0HcYWQK+XP4nMAHlgHRB05ACm4SF4Asx6YU5PQGQC7VcaxgiabQAT1RmHSeXa
+AxMhXUcgBkCLKAGYp7mEiYaQxKQ5mKuLb9YlBuEq59AKMFvwgtBkEoeos9FnnZjAFNBVeBOMZAZw
+b1CTqH8Apx8m8UaTOIy23ZZNvN5uXGcU12vWfzqHzzfpz/YfYnp7p3nWhg+z25drEcx84+Tk0A35
+dKfd7LZ3G18Xjk5POt12pw9N60/y/qrK+ql5eAafJ9ePD3CD841Ku3/yZa9zsHv9G1WNDa98p6Ec
+tqt3P9F//Xf2tLkHGnZ40hmgt9E7t9zdXPP+u3pw/PmsBebm4ZeD492TL/U/BujyJe/ectdR5Qfo
++yDS/FeQY0X/9d/BHfQSnUElufLWLXcZoJriXEkxhES3vg4jy62vt95pmxqIveHPEJ3+18nJ0TDd
+du/d9mwP0WG0u2f7TbA/w3Q7fvu2Oy9Tba1SbBhRH8pst27fYHc754MY7KLlCCvqOzsnQ3U7evmW
+ew9h+vCeer99sLff/QZ3XTC45UE4vWESLx2DXb95q35+fNA9G2YQejnc8ihoDPaHFYUvB7vd/W+Q
+BP/+LQ/BgBFJ6ATGGd/mBXo53PJAZCkE7TK32QD+0IG2k9Nm66A7CO7pee/Wez6MFuDUDd7zy1+/
+5QFgSg9vBobqffnuLXf9EHfcDgV+zjsdNOTEYCgcVGXwF8gqlslOTKH986D9pY/E4sSf2aLvleek
+PGGZymPJ1KlfFMYNznmxi1nhzgfKCKZ5sQsid7QsxbVjQZsmHCVsbS62MNHWpTzDjUQmTwSHklpy
+vyMC2AEN0/aK2QQpUmcCKDKVivZIKPiA2x+YSFWWqaRVw1w+bTEUjEHbFG5TgloU7haCD0JK6VZQ
+ZK6BwlOLj1q0GKNwvUfAB2k47YoSGRXSaW4yfI271QHBbJrnIqfXcGcIrnhz5vZO4yYoaKogCvDG
+ZvZ2r3XVgg0DrSo2ftWzVONyBv7EvhU/PZlZaaD7mbCJyXAxTUqGudi6hnHTUL/GhXdobR0GJMet
+5/BBWZvltINbcMWpa/CX1qvrUnOdWmw5DC70Pc8ve1exXEIFMBx1KaCrGQcpaLSGq7bRd7W0MmaM
+hTHMUc4M1nntnuobU/EDD+73T8WDF9VagfRGStpoTLUA766edJtYNtJFdm3OPhad69Lzwgq3phYp
+m7ASE/yyVDbc46qMlKWy0SZ7Y2WsbLTNH6cnKJswOtVGs1LZcPsGzxiPlQ33IChGkuCUDQlWMl4q
+G75mZcZjZcPtfjbXolQ23F1oJFOlsl3sXl/K1iMOVWmoC5FnqVEgdRVVI5HPjBN5LhKSWmu81HJF
+uzSsyAqJN6RoUlsQeA1UqaCxLBfq4pt1+K5SGFnQMg3mg0NHQOKHqLHRZ424GQcwjfQaln+rhg0+
+ov8b+pU5P3nx/A4dwQGXJUgTWAZzc+RpFuYLnAQ4GEbewhra5Wdh0kikbcoN7vUhinIHbDgojt/l
+Z7VQpHlMIndgQDuCHIW7+jKrNalQRGM4Iz0U0tgKBdo57d7LrXPHJtPu0I3UOSfVo80d1E7cxeso
+wKlFrh0kT3sa7YTAHgvhOKGEVseFwxi0esYKgqyeUiDDycXxbPVx7Ad324NQMrB3GrEKg0HPNW3n
+NJwbJ6NgpfzBCvwIloq7rQXg/PDMEkAfnHfc8o97OrBo8RkPFZhMFOZu8KM/+u+1k6DZGWgjgXtz
+gD0EZVW32EmwkQrco7aDdBWN0AAd7dx+XCcYaoOyZpBuUkK7/27+BTLZw83mYN3s3H43ATdlEJlw
+NtBsDia0xRLc//3Wnv58xm0fxrvZ912PbC45kwT2AgF8eSgplVYxQ1E9HthVFbRDJIziIHKn6B7x
+AaMIIANnTkChQDtEUdoQ2gFQzxjzNIjKMBRQuZKOE8+Vp3BVRTsRjWVCJj0UeYHi0Y4pkgHagTFq
+QUaRjsVz2iJCO0gRnOMZKewNnhV0NIknNLDHgjlOeICkMiy4rb1VHSnCOhUCQp3esWz1f6op/wEo
+fgCKH4DiLzebPwDF/zWg8J6bkgV40BAPDqIvRi+RaTpwhbvYOR2ecNCiN3uOpwY4eCZytuAYDKYB
+wAVxI1wKPdBwQ7xB3wMKKbi7qiPjmDnHQ4KCPLKnYFYPk0O5jUvpFIJ/VnKKKL4+fC/QlPOIESeZ
+Zrm0cX2e0qpFrfK0qOWe08X+9RXrZ1fmbFhqOR5iJshWfIlal7skfhm+n8Of6o0CKlWW49lLnWpM
+cB65EcgpB4NZElwqgBEQivAN7hVDvAEUy3ARAYAins1u0eUBlGvGpKmkLDdeJ4DbvzFBqpRxLTNG
+ewJzsAEvVqCsrSuEBK4xV1vwQYqRlLYJteFwu7RJ0SQcXBh/VjYbT58izAh9w9cEjI0DXNIKQ+sx
+lGDFKaH7XLBIrhH+wCNjGK2rAG9CLnjCVQpBMiiZVCRdSsmoa0Qw1osgl9ZEhZTvSMEHKe4QeFkZ
+5rExm1k2CSkgknnZ7Ivz1s9lMeZKQcopxcidIBVfXJ/o/hvMqkqUI3+gZJ2qAriuwtIaGgCOm+s9
+Z1BtmiSHeKEDqFRHNN9WcKcDAJ7d0GmvXgJPaWKRnLkJsFwZP910CQ3JNObfcUoyvB4IKZSGR0pO
+MBe1S3qtxOtsnFIaq52UuGObeA7ZKymBZLploKgrx3OcbmyVszjGKPeSW4670LMrE/Syshhm8Og/
+/JQ418VPT2ZW4tU/uE6hBF0CpOnoZh3bg7lzPEcpYPZhhjKOclQHAeHaaBLj3JCEGLA+RtBimFJa
+4+lpGBsNn8Aq5Ze8qzPjNacOao8HLkHDcDFsmGobfVdL2pmR6IN0ZezmI5w3LoYNPLh/QrJeIozi
+WvWVrL/+AIvsdy0MrXPucuZkJo6IZvLMCT631imVc4OoZsKFfkJlzhjhuWdnsJTFFSmcV9QAi4ca
+rVNFqXJ3uQwEjk5beZY7y6/80jBqWe7Nk9XcaxkusdN5OFpbA6ViVhXVQSxsiKacOdSFFVVuSe1C
+3/rRsx5JqApCXTADUawCXa9oGUXuTJC0M1RxFNi8EFhspcWhRPef+SgYdAxkHSwMqgDIunCL9hfe
+rMMP7VYiUcVwLdIKdxxw4DobfdZJ9wKBjyX1ynIwdd+mXoOP6f+EcpXnwMpPPSmkpt9MEi7JUwXg
+lbhvBHeQ4BOu6fwwomHcU+Lv30i5v2vj0j0lqA9S0EI0QjkuPDzzNPB3hM4kbeAneGRMZinPYzQi
+sILSoitsDKl7WQrvReA6YhQIvja3OO5pyh20jxjBlHN0rmV1nuJAjG9UKBXaHTj19g7Xah0s9VcA
+VPodaICZJMFJgLzS7W3RUvc0hCi+IeTwy1IabAqt3QVGgRJ1PNA4wH/rdNFzYk6jovo8xY2za1Qo
+FNodGPX2rq8wILZvAP28sMAoZyzBTSdoww1edcQ1LewDjDUi95hO4D4GRF3UZGt93UJEoG44s3Bj
+U/70w5835Yv703RURlliV5wkSn7iQPGMMy+CnqbAxpHKYJrWy6B01ziCKWa0w8RTnAzanOdxKbzc
+ktuYU6D4+pwMehovVCZwwkAGAWhZn6e0alGrQqnQ8sCpt3/9CGE+qBByDEqdCOJKgszDCNGmnBzv
+wvyfl8C8300X392NZHQhU+5sKpgv5Sc82NRAAwORY6gHk0O7M8gpWNzMVBo5T3ECpk3O41LgFWwu
+Y06BEhnVQIO5J6cQGIFToEugyuo8pVWLGhVKhYYXjHp71484i0HFGWy7AZcVEi6MC365Tf2mTUe3
+JdF9r8GJ/m1qlA9wYiggxlCiKoaBhgtU2t1OaWkDHONunx6WoQ2WgeLE0GjG4lJg+YTgMadAicQw
+0HCXEUYuJSfc6IcXNpX1eYqXQ9eqqJRveeDU278rIxZ+5SDylBte2E2IHDJKP5atNq52iD8MAm+i
+VsrWtbayLEiXMfXFsnElS+w89DKvcPV2+7+HiCkVI2m3dBCfiOaALKXwMFgKWBfXNCHCUjEipose
+BdmeUApvh2Y2YhQIYTIjmsexESOPdaPqAiKOGhVKhXYHTr29KxAx7gi31la7XZA8jKVN28LIEupW
+2uEBMbZDWowQy1IoBZmIOQVK1O9A8zg24uSxblRfAMRRq0KpouGBUU/nBsTD9YsWk0mJt7cZZSv2
+u06g2OgIFKui2bn6XqC4z/bcNiwZDhjjZAUZ9cA4onk4S5e2UmK7gLw4yEJHSNmrhOQsLoQAQaiY
+UaAEnBrReKE4gZNHvGV1ARZHbQqFTGk5PKPe3g0IiweQRcTGqCwBHeMVs67d8nuh47+JKP4lEDLZ
+M25E1cgGmse1eZEbLaBvZPQCQMZDPXRTWlQK1xVtzKcgRCa2IDlQG3HxuDeqK6DjskGhUGhzwae3
+YwOC4wGE+lKE7JotdPKdEPLtSvV/ASXjgClreFUUA81jW5p5qUv4i0VyYysgmc6X0b3wZSlMbXER
+MwqUijB6moe2EScPf6P6AkguGxUV8u0OjHp71w9GrhdjyBQzeNcd7v7zhpQW0ytwNWp+iZbrEKUB
+isGF20phQ4shyDAGt33ybVzNFzuaacsuw8xDyf2lQ3Art6tdHbxULfawZyx77p5GE8bc0hQejQJD
+fhTTYPBxOyMCA81odQohvVXxGranuHWnjG6RLUvhchMt53pOEcXX59a5ZLEIbXJaZAmcBEw/03F9
+nuLgim+Vp0Ut95wu9g8FpVxzWGy4XxY0e7xLvyqoXq+NjCw399prnebBYbtT2ztr/rOdNI+PcSGk
+jWfMYa7aZ92TTjsp7huAV4riIyOzL5/V/gOEepm2
+
+</i:pgf>
+</svg:svg> \ No newline at end of file
diff --git a/docs/utilities-avahi2.svg b/docs/utilities-avahi2.svg
new file mode 100644
index 0000000..4397ea5
--- /dev/null
+++ b/docs/utilities-avahi2.svg
@@ -0,0 +1,1627 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
+<svg:svg
+ xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/"
+ xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#"
+ xmlns:xapMM="http://ns.adobe.com/xap/1.0/mm/"
+ xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/"
+ xmlns:xap="http://ns.adobe.com/xap/1.0/"
+ xmlns:x="adobe:ns:meta/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Calque_1"
+ width="42.354"
+ height="31.653"
+ viewBox="0 0 42.354 31.653"
+ overflow="visible"
+ enable-background="new 0 0 42.354 31.653"
+ xml:space="preserve"
+ sodipodi:version="0.32"
+ inkscape:version="0.42.2"
+ sodipodi:docname="utilities-avahi2.svg"
+ sodipodi:docbase="/Users/izo/Desktop/spip_tango/Avahi ICONS"><svg:defs
+ id="defs2914" /><sodipodi:namedview
+ inkscape:window-height="507"
+ inkscape:window-width="701"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="10.867848"
+ inkscape:cx="21.177000"
+ inkscape:cy="15.826500"
+ inkscape:window-x="45"
+ inkscape:window-y="73"
+ inkscape:current-layer="g2682" />
+<svg:metadata
+ id="metadata2674"><xpacket />
+<x:xmpmeta
+ x:xmptk="3.1.1-111">
+
+<svg:metadata
+ id="metadata2916"><rdf:RDF>
+ <rdf:Description
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ </rdf:Description>
+ <rdf:Description
+ rdf:about="">
+ <xap:CreatorTool>Adobe Illustrator CS2</xap:CreatorTool>
+ <xap:CreateDate>2005-11-18T17:57:36+01:00</xap:CreateDate>
+ <xap:ModifyDate>2005-11-18T17:59:06+01:00</xap:ModifyDate>
+ <xap:MetadataDate>2005-11-18T17:59:06+01:00</xap:MetadataDate>
+ <xap:Thumbnails>
+ <rdf:Alt>
+ <rdf:li
+ rdf:parseType="Resource">
+ <xapGImg:width>256</xapGImg:width>
+ <xapGImg:height>192</xapGImg:height>
+ <xapGImg:format>JPEG</xapGImg:format>
+ <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
+AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK
+DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f
+Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgAwAEAAwER
+AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA
+AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB
+UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE
+1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ
+qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy
+obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp
+0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo
++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYqlHmbzd5c8sW
+Bvdcvo7OHf01Y1kkI/ZjjWrufkMhkyRgLJZwgZGg8R81/wDOUkxd4PK2lqqCoW+v6kn3WGMintVz
+8s12TtD+aHMho/5xeZ6v+cv5mao5M2v3MCnoloRagewMIRvvOYktVkPVyI4IDokEnmrzRI6vJrF8
+7r9lmuZiRTfYlsr8SXeWfBHuTLTfzO/MLTXD2nmG+FDUJLM86f8AASl0/DJx1ExyJYnDA9HpHlP/
+AJyf161kSHzNZR6jb7Brq2AhuB4sU/un+QC/PMrH2hIfULceejB+l6jdf85AflfBp8d2NTeZ5V5L
+aRQyGYeKsCAqn5t8szDrMYF2440075MI1n/nKu0Usmi6DJIP2ZryZY/viiEn/E8x5dojoG6Oj7yw
+zU/+clPzJu+X1ZrPTwahfQg5keG87TCv0Zjy12Q9wbRpIBjN9+b/AOZt7X1vMV2la19Bhb9fD0RH
+TrlR1OQ9S2DBAdEmufOHm26NbnW7+c1rWS6mffpX4mOVnLI9SzEI9yAk1C/k5CS5lcPXnydjWvWt
+TkeIsqCHwKqxXVzCCsUzxqTUhGKiv0YbWkbb+ZPMVvT6vql5DxFF9OeVaDwFGGEZJDqWJgO5NrP8
+0fzFtCDD5k1A06CW4kmH3Slxlg1GQfxFicMD0DItO/5yH/NGzI9XUIb5R0W5t4v1xCJvxy2OtyDr
+bWdLAsv0j/nKvVEKrrGhQTA/aks5Xhp7hJBNX/gsuj2ieoapaMdCz7QP+cify31RljubibSZm2C3
+kR4V/wCMkRkUD3amZUNbjPk0S0sx5sr1j8xfJWk6INaudXtnsHqIHgkWYysP2I1jLFm8fDvl0s8I
+iydmuOKRNU8M82f85P69dSPD5Zso9Ot9wt1cgTXB8GCf3SfIhvnmuydoSP0inMhowPqeb6l+Z35h
+ak5e78w3xqalIpngT/gIiifhmLLUTPMlyBhgOiWx+avNEbs8esXyO32mW5mBNd9yGyHiS7yy4I9y
+f6R+cv5maW4MOv3M6jql2RdA+xMwdvuOWR1WQdWEsED0emeVP+cpJg6QeadLVkNA19YVBHu0MhNf
+ejj5Zl4+0P5wceej/ml7d5Z83eXPM9gL3Q76O8h29RVNJIyf2ZI2o6H5jNjjyRmLBcOcDE0U3ybB
+2KuxV2KuxV5T+bX546f5SMmkaOEvvMNKSct4bao2MlKcn8EB+fgcLU6sQ2H1OTg05lueT5g1zX9Y
+13UZdS1e7kvL2U/FLIa0HZVHRVHZRsM1E5mRsuyjERFBAKrMQqgknoBucgSyRkWkXripURj/ACzT
+8BU5VLPENowyK+TSGjQvJMqgd6GmRGezsEnDXMoFgoYhTyHj0y8NJW4UOxVtVZjRQST2GC0ouHR9
+Tm/u7Zz8xx/XTKpZ4DmWQgUbH5U1h+qKn+s39AcqOsgO9PhFEJ5Mvz9qVF+W/wDTIHXR7mXheaoP
+JU/e4HuOP/N2R/P+S+F5tnyY4/3f/wAL/bg/P+SfCHesbydL2uB/wP8Abj/KA7keF5qL+U7sfZlU
+/RT+OTGuj3L4SHk8t6kvQK3yOWDWQLHwyhpdJ1GP7UDU8Rv+rLI54HqgwKFZHQ0dSp8CKZaCCxpb
+hQ7FXYqibaye4+y6inUE7/dlc8nC2Qx8SJ/QspG0i1+Ryr8yO5s8A96lLpF6gqFEg/yDX8DTJxzx
+LE4ZBBsrKSrAgjqDsctBakfoev6xoWoxalpF3JZ3sR+GWM0qO6sOjKe6nY5OEzE2GMoiQovp/wDK
+X88dP82mPSNYCWPmGlI+O0NzQbmOteL+KE/LwG302rE9j9Trc+nMdxyerZmuM7FXYq8n/PH83T5T
+sxomjSKfMN4nJ5BQ/VYW25n/AIsb9gdup7VwtXqeAUPqcrT4OLc8nyrLLLNK80ztJLIxeSRyWZmY
+1JJO5JOaYl2SL07SZ7w8vsQjrIe/sMozZxD3t2PCZe5kNvYW9snGJKHux3Y/M5r55TLm5scYjyQm
+o6nDbVRfjm/l7D55diwmW/RqyZRH3pBPczTvylap7DsPkMz4wEeThykTzUwCTQbk9BkmKbWHljUr
+qjOvoRn9qTr9C9fvzFyauEeW7YMZKf2fk/TogDMWnfvU8V+4Zhz1kzy2bBjATm30+0gFIYUjH+So
+GY8pE8zbMBEiPIppv08Vd6eKtGPFaWmPFVNo8FKotHkaVSdMIKFFlyQKFCWCNxR1DDwIrlkZEKgJ
+9E0+XcJ6beKGn4dMvjqZhgYhK7ry7cpVoGEo/lPwt/TMqGrieezA40rkikjcpIpRh1VhQ5lCQPJg
+QtVmVgykhh0IxItQaTaw1ZSRHc7HtJ2+nMXLg6xcnHm6FOlFRUdMwi5S24sLe5TjKlT2YbMPkcMM
+pjyYyxiXNj2o6VPZnl9uE9HHb2ObDFnE/e4eTCY+5CRSywypNC7RyxsHjkQlWVlNQQRuCDl4LS+q
+vyO/N3/FlkdF1mQDzDZpyWQ0X61Cu3Mf8WL+2O/Ud6bnSanjFH6nW6jBw7jk9YzNcVIvO/myy8qe
+WL7XLv4hbJ+5hrQyzN8McY/1mO/gKnK8uQQiSWeOHFKnxJrOr6hrOq3WqahKZr28kaWeQ92Y9AOw
+HQDsM5+UjI2XcRiAKCpo+ltezcnqLeP7Z8T/ACjMXUZ+AebkYcXGfJlSxJGgRFCoooFHQDNUZE7l
+2AFJRrOrC3rBCazn7Tfyg/xzL0+Di3PJxs2bh2HNjhJJJJqT1JzZOEjdM0e71B6RjjED8crdB8vE
+5Rm1EcY35pjEll1ho+m6bEZTxDKKvcSkCn0nZc1k8uTKa+wN9CItBXvnzQrUlIS924/32KLX/Wan
+4VzY4OxM095VH3uJk7Qxx5bpY/5mvy/d6cAv+VKSfwXM8ez46z+z9rjHtM9I/avh/NCjUm074fFJ
+dx9BXBL2f7p/Z+1I7T74/an2neffLt4QhdreU9EmAUV/1gSv45rdR2Tnxi64h5fq5uXi1uOfWven
+YuwQCqVB3BrmpM3O4WjdSdlH44OMrwLGuJfAfdjxJ4VjXE3t92NrwqTXM3t92EI4VNrqXuq/jk0c
+Km10e6fjjwI4VNrqPuCMIgUUld/5m0a0qrzepIOscY5H+g+k5sNP2Zny7gUO8uJl1eOGxO/kkk3n
+lOR9G0JHYu9PwAP682kOwT/FP5BxJdpd0VMeepK72YI9pCP+NcmewR/P+z9rH+Uj/N+1EDzTot6v
+p3sLRV6MRyA+RX4vwzHn2Pmx7wIl9n7Ptbo6+EvqFKV1pa+l9ZspBc23ipBK/OmUDKQeGY4ZOQKI
+uJsJfl7FNNJ1UwMIZzWE7Kx/Z/szFz4OLcc3Iw5q2PJkqgEAjcHoc1xc4LmiSRCjqGRhRlPQ4BIj
+cJItiusaW1lMClTbyfYPgf5Tm00+fjHm6/Ni4T5KejaxqGjara6rp0phvbORZYJB2K9j4qRsR3G2
+ZUZGJsOPKIIovtvyR5ssvNflix1y0+EXKfvoa1MUy/DJGf8AVYbeIoc6DFkE4gh0+SHDKnhf/OUP
+mxrjWNP8sQP+5sU+t3ig7GaUUjB90jqf9lmu7QyWRFzdHDYyeHRRvLIsaCruQqj3O2a0mhZc0CzT
+ObKzjtLVIE/ZHxHxJ6nNHkyGcrLtoQERSE1jUFsrao3mk2iH6z9GW6fFxy8mvNk4R5sPZmZizGrM
+aknqSc24FOtJTTRNFe+k9SSq2qH4j3Y+AzG1OoEBQ+pnCFsj1TVtP0OxVmUVpxgt02LEfqHicxNH
+o56me3LqVz544o2Xn2paxq2t3So5aQs1ILWIEip6BVFST+OdjptJi08fT8SXR5c88p3+TNPLP5G+
+aNVRZr9102FtwjD1Jqe6Aqq/S1fbNfqO3cUTUBxn5D5uRj7Pkd5Hh+9ndl/zjloAQfWby6lem9Gj
+RfuCE/8ADZr5duZzyEB8y5A0WIcySsv/APnG7R2Q/UtRuYZO3q8JVH0BYz/w2Th25mH1RifmP1sT
+osZ5Eh555q/JnzfoKvPFENSs13MtuDzAHdotz/wNc2mm7XxZNpeg+fL5/rpxsuinHceofjox3QPN
+WoaRIqVM1nX47dj0H+Qf2Tktf2Xj1AvlPv8A196NNrJ4j3x7np+mX9nqdml3aPzjbqP2lburDsRn
+D6nTzwzMJjd6LDljkjxRRJjyi21Y0eSBQpMmSBQoumTBVCXUkUETzTMEiQVZz0Ay7HCU5CMRZLCc
+hEWeTAtb8z3N67RWxMNr022Zx7nt8s6/Q9lQxDin6p/YHQ6nXSntHaKY+U/yu82eZVWe1t/q9i3S
+7uKohH+QKcm+YFPfLtV2niwmvql3BpxaWc9+Q83pemf843WAQHUdTnlfwgVIh/wwlzUZO3Mp+mMR
+77P6nMjocY5klHXH/OOXlxk/c3d3G9NjzjIr7gx/xykdt6gdIH5/rZfk8R6yYb5i/IDzBYo8ul3K
+Xqrv6Mg9J/krVZCfmVzNwdvwO2SJj58w0z7PP8Bv7HnTDWNCv3ikSSzu4zSSGQFaj3U9Rm3nDFqI
+dJRLhxlPFLuKbRz22qRNNAoivEHKe2HRh3eP+IzR59NLAaO8DyP6C7XDnGQd0kNkG1kHl7UuVLOU
+7j+5Y+H8v9MwNXh/iDm6bL/CWQAZr3MUryzju7V4H/aHwnwPY5LHkMJWGM4cQpg0sbxSNG4o6Eqw
+9xtm8BsWHUkUae5f84vebGt9Y1DyxO/7m+T63ZqTsJohSQD3eOh/2ObLs/JRMXC1kNhJ5h+ZWsNr
+Hn7XtQJJWS8lSInr6ULelH/wiDMPPLimT5uRijUQEF5XthLqJkI2hUsPmdh+vNdrZ1Cu9zdLG5X3
+MsagBJ2A3JzVB2LB9Vvje3jy/wC6x8MY8FH9eubvBi4I06rLk4pW1ptg97drCuy9ZG8FHXDmyiEb
+YRjZZsz2mnWDStSO3t0rT2Hb5nNPCEs2QRG8pFunIQjZ5B5nd3Oo69q68UaW5uXEVvAu9Kmiov35
+3eDDDTYq5RjzP6Xnsk5ZZ31L6G/LL8rrHy/bLc3KrcatKP31xSoSv7Edei+J6t+Gcf2j2nLUSobY
+x07/ADLuMGnGEf0nqNrZqqgAUHhmvEkSmlOpefPIekzNBf65ZQzoeMkPqq8ikdmVOTL9OZuPR5pi
+4xNOPLNEdUTo/m3yhrjiLSdXtLycgkQRyoZaDqfTJD0+jI5dNlx7yiQFjlB5FH3FopBFMo4m6M3i
+/wCbn5QwahDNrehwiLU4wZLm2QUW4A3JAH+7P+JfPN32Z2oYEQmfR08v2fc1anTCY4o/V97xnyn5
+hk0bU1MhP1OYhLqPwHZwPFc3HamgGpxUPrH0/q+LiaPUnFP+ieb1/irKGUgqRUEbgjPPNxsXqFNo
+8kCqi6ZMFCi6ZMFDzjznrhu7w2MDf6NbmjkdHkHX6F6Z2fY2h8OHiS+qX2D9rz/aGp45cI+kfez3
+8oPynh1COLX9dh527ENYWTj4XH+/ZB3X+Ud+vTKe1e0zE+HA+8/oTpdKK45fB9B2diiIqqoVQKAD
+YAZzXG5k5qera/5b0RVOr6na2HIVRbiVI2Yf5Kk8m+gZbiw5Mn0xJ9zjyyAcylln+ZP5dXsvpW/m
+Cy9TsJJRFUnsDJwrl09DniLMJMRnieqfy28ciBloyMKqw3BB8MwSW+M2B+f/AMutI8yWDRTxiO5Q
+H6tdKPjjb28V8V/jvl+j109PPih9PWPe2TxxyxqXPvfMeraXqvlvXJLO4HpXlo9VdfssvVXXxVh/
+bncYsmPU4rG8ZB00oyxTrqEyn9K5to9QgXikp4zRjoko6j5HqM0EsZxTOM9OXmHb48gnESCHjd43
+V0PF1IKkdiMSLFFmDTONOulu7SOcbFh8Q8GGxGaTLDgkQ7bHPijaLAypmxLzPbCLURIBtMoY/MbH
+9WbXRTuFdzrtVGpX3o38tdYbR/P2g6gCQsd5EkpHX0pm9KT/AIRzmxwS4Zg+bhZY3Ehj08zTTSTP
+TnIxdqdKsanKiWxkPk9Rxum71Qf8SzW9oHk52j6o7zHd/V9OZVNHnPpj5H7X4ZRpMfFP3N2pnUfe
+wzNy6tmHlqx9CyEzD95P8R/1f2R/HNRrMvFKugcjGKCW/mDftHaW9ihp6zGSX/VT7I+kn8M2vs/g
+uUsh6bB1/aWSgI97IPyG8rx3N5da9OnIWx+r2lezstZG+YVgv0nLfaHV8MRiHXc+7p+PJh2di5zP
+TYPoawiVUBOwG5PQZx4nbmZC8S88/mFqfmy8nsNKuHtfK8LGINCSkl6VNGdnFCIj+yo69T4Ds9D2
+fDTwE5i8h/2P7XVzmZmhyYidItoYuMUSoKfsgDLcuvIbYaZjGoWg+smSOqshHF12NQeoIwY9dL4J
+npXsX5Nfm/qM2oQ+VvM1wbn6x+70zUZTWT1O0MzH7fL9hjvXbeu2D2joYSgcuIVXMfpDCEzE0Xst
+9CCpzneNz8ZfLP50eV49F81tdW6cLTVAZ1UdFlBpKB9NG+nO37F1Xi4aPOO36nW63FwzsciyD8vt
+Ra/8txK55S2jG3YnrRQCn/CkD6M5bt7T+FqSRyn6v1u67Oy8eIf0dmQumacFzlB0yYKEn8w3v1DS
+Lq6GzohEZ/y2+FfxOZ/Z+Dxc0YdCfs5lx9Tk4MZkwDyD5cHmLzXZ6fKC1sWM12d/7qP4mFR/N9n6
+c7rX6jwcJkOfR5vT4uOYD630q2jjjREUIigBVUUAA2AAGefSyWbd3kLAvzl/Ni48sqmgaCyjXLhB
+JcXVA31aJvs0Ugj1H7V6DfuM3XZegGQeJk+gch3/ALHXZspuhzfPoS5u7xry9le5uZW5zTysXdie
+pZmqSc3OTW8O0RQY49NfNk1rpsEkQDorqR0IBGUw7QJLZLTMj8qeb9c8kzq9q8l3oNR9c0liWCpW
+rSW3I/A43PGvFu/bJajTY9VHuydD+to3xnye/R3dlqWnwX9lIJrS6jWaCVejI4qp336HOMyiUJGM
+tiHYYpXu8Y/PryrHc6OmuQp/pNgwSZh1MEjU/wCFcgj5nN77O6zhyHGfpn94/Yw1+LihxdY/c8j8
+qSrLJcadIf3dynJfZ06EfR+rN32zjqMcg5xP2FxtBP1GPe6SNo5GjcUZCVYe4zXg2Ldgn3lS7pLL
+asdnHNPmNj+GYOuhsJOXpJ7kMnAzWOex3zgo42rd6uP+I5sOzzzcLWdGPQTNDNHMlOcbB1r0qpqM
+2QLgph5o06TTfMuq6fICHtLyeEg/5EjL/DJ5I1IjzYwNgFF+UJwt1NATT1UDD3KH/m7Nbr43EHuc
+7Ry3Ia823HK9igB2iSpHux/oBh0EaiT3o1cvUAk1pAZ7mKEf7sYLX2J3OZc5cMSXFAsvQYUVVCqK
+KBQD2GaCRcpgPn6Uvrip2jhRR9JZv452PYUK0998i6PtE3k+D3L8lbNIPIlgyj4p2lkc+JMrAf8A
+CgZzXb0ydRLyofY7DRisQZD+Zuo3Gn/lvrc9seMzwpbhh1AuZUgYj/YyHNf2JEZNVCJ77+QJ/Q16
+s1AvHdOto4bdI0FERQqj2G2djrchtxtPBvUj6dq7DrSg+k0zQylcwHZ44sZkjBGZILOUUovOcEiz
+QsY5YmDxuuxVlNQR8jmz0U/VR5F1eqhs+xNP1H9JaFYaiV4m9tobgr4erGHp38c4vUjgySj/ADSR
+8nIwmwC8d/5yFs0fy9YXhpzgu/TB70lRif8Ak3nR+zOT1yj3xv5H9rX2jH0A+bCvyhkJGqQk7D0X
+Udv2wf4ZL2qj/dy/rD7mzsc/UPd+l6C6ZyILukttr+1vHuUgJJtJjBLX+dQCae3xZl5dPLGImX8c
+eIe5phlErroaYv8AmS7JoKKOklwit8uLN/xrm79nReoPlE/eHB7UNYvijP8AnHy0RtW1S7P244Ui
+X5O/I/8AEBm19opkYojvP4+91/Zo9RPk+iNPpQe2cPxufkfIvmXUJ9W84axqFwxaSe8mI5GvFFcq
+ifJUAUZ3sx4eGEB0iHW4RxSJVYIgFGauUnbY4sh0Y8oaH9k0+jrmHkNTZTimE0YKHNppchtwc0Ho
+35H30j+Ur7TnYlNM1CaG2HZYZFWYL9DSNmm9o4iOYSH8UR8+TXpeRHcU1892a3flbV4GFfUtJgPn
+wND9BzX9mZKywP8ASH3ufMXAjyL5Y8vSGPWrRgaVfj/wQK/xz0TtGN4J+50mlNZIp95gt/TvvUHS
+VQ30jY5zellca7ndTG6G0u4+r6hby1oFcBj/AJJ2P4HLM0eKBCcUqkCz8DNC7hivm6cNdQQg19JC
+x9i5/wCbc2mgjUSe91+sluAhPK+nSal5l0rT4wS93eQQgD/LkVf45sscbkB5uDM0CXo3/OSPlSTS
+vPA1iNKWWtxiXkBsLiIBJV+kcX+nMrXY+Gd97RpZ3Gu55XaXMlrcx3Ef2ozWniO4+kZr8kBKJBcu
+EjE2FXVbtby/luFqFenEHqAFAyODHwQAZZZ8UiUV5bi56orf77Vm/wCNf+Nsq1kqh70Y+bNIxmmL
+kMA/MGHhrUcg6SQKa+4Zh/TOx7CneAjuk6TtGNZL7w9r/JDUEufI1rEDV7SWWGT58zIP+FkGc77Q
+Yqzy86P2V+hztFK8Q8mVeftGn1vyPq+mW4LXEsPqQINy0kDrMiD/AFmjAzQdm6oafVwnL6b39x2v
+4Wuox8UCA8W0m9jubSKZDs4BI8D3H0HO/wBbiNuHp5quoAS27p4jb5jcZoMkTGVuyhJjEsgAIPXM
+mIbJSS36rc6lfW+n2i+pdXciwQJ0q8hCjfsN82OmMYA5JbRiLPwdXqZXsOZfXdvbQ2GmWmnwHlDa
+QxwRn/JiQIPwGefZNR4szL+cb+bmYoUKeO/85C6giaNp1hy+OedpuPtEvH/mZnZ+zGLeUu4V8/7H
+G7Rl6QGK/k7an0NUuSNmaGNT7qHZv+JDB7Uz3xx95+5u7HjtI+5n8oABJ2A6k5yQ5u6Lzr8udQNz
+e6yGNTPILlf9kzcv1jOt9odPwQxV/COH7qdL2Zl4pT890X+ZEDSeXuYFRDOjt7Agp/xvmN7OzA1F
+d8SPuP6G7tSN4vcVT/nH6/jj1vULJiA08AkX3MbAU+583XtDjvED3H73W9nS9ZHk+hbOXjTwzzzK
+eEuzmLfKfnPSJdD866vYSiii5eW3b+aGZvUjNf8AVbf3z0DFmGo00MkTe2/vGxdXD0TIKy3lUqMw
+ZRdrjmyPSQEhFerHkcwpjimylJG3M6JEzsQFUEsT0AHXNrpMRtwM03pX5N6dNaeTXvZl4SaxdS3y
+KRRhCwWOKvzWPkPnnMe0eqGTU8ET9AEfjzP318E6SHpvvRv5h6hHY+T9YuHbjS1lRD0+ORSif8Mw
+x7IxGWaA/pD7N3Kyy4ccj5Pl7y3EZNbtQP2WLH5KpOeg9pz4dPL3fe6XSC8gZX5ljrbwyd1cr/wQ
+r/xrnK6M7kO8yMezYNTPm1CCDTkvJmorRqwHdiy1AHzzQjEZT4R3u4OQCPEWD3dzJdXMlxJ9qQ1p
+4DsPoGbvHARiAHUzkZGy9U/5xu8qSar54OsSJWy0SMy8iNjcSgpEv0Dk/wBGbDQ4+Kd9ziaqdRrv
+fQn5j+RrLzp5XuNInIiuR+9sLkivpTqDxb/VNeLex8c2efCMkacDFkMJW+MNb0TVND1W40vVLdra
++tW4SxN+BB7qw3BHUZoZwMTR5u3jIEWEBkUp75UX/Spm8EA+8/2Zg64+kNuLmy2PNUW9i3n2wae1
+W6QVa1Pxf6jgV+40zfdhagQyGB/i+8OB2ji4oCQ6Iv8AJTzXHpetSaTcvwt9S4+gx2CzrsB/sxt8
+6Zm+0OiOXFxx+qH3fscTs7MIy4Tyl976EgnO1TXPK9XiIO7uSHnHnT8ttQivp9a8sRiZLljLfaTy
+Cn1Du0tuT8NW6sh+jwzq+xPaSAgMOp2A2jPy7pfr+fe6zPpSDxQ+Tzy+1YWrmC+jlsrgfaguY3ic
+fQ4GdUNNDMOLGROPeDbQNQY7HZJ4bLVtbvTDotnNfOxHL0EZlUnuz/ZUe5OVZceLTi8s4wHmfuHM
+/Bn+YMtoi3s35ZflYPLjjWdaKTa2ykQRIeUdsrCjUP7UhBoT0HQeOcT2528NQPBw7Yep6y/Z3D4l
+yMGnIPFL6vuZ1c3HEFi3EDcmtM02jxEy2c8B8wfmZ5qHmPzRPcQvzsbUfV7M9mRCav8A7NiT8qZ7
+B2Rozp8AifqO5/Hk8/q83iTscg9N8iaK2k+V7WGVeNxPW4nU9Q0lKA+4UAHOL7Z1QzaiRHKPpHw/
+a9BoMPh4gDzO6v5kufquiX89aMkEhU/5RUhfxzE7PxceohH+kG3Uz4ccj5PL/wAuZ/R8w+melxC8
+YHuKP/xpna+0OPi01/zZA/o/S6HsudZa7x+16BrVguoaZc2bbeshVSezdVP0NnH6POcOWM+4/wBr
+vc+PjgY97yfy3rN15c8x2uoBWElnLxni6EoapIn/AAJOeh6nDHUYTG9pDY/cXl8UzjmD3PqjStTt
+7+zgvLaUS286CSKQHYqwqM8k7S0s4yIlzD0gIkLHIpD+Yv5d2nnCzjmgkW11m0Ui1uWHwuvX0pab
+8a7g9sl2J23LRSMZDixS5ju8x5/e4ep03HuPqDwrVPL/AJj8vXPpazYTWyKaevxLQsP8mVaofvzv
+sGTT6oXhmJeXX5c3C8WUNpBH2Gs28jLDCWnnbZIYVaR2PgFUE5b+RGMXKogdTsp1N8mdeWvy31nX
+Zo7jX4X03REIZrKQ8bm5puFdRvEnjX4j7dc0PantJiwRMNOePL/O/hj7v5x+z7mePTymbltF607p
+EixxARxoAqIooFUCgAA6DOCxRlKV3v3u0jF4v+e3m1DDD5ct5OUrss99Q/ZUbxof9Y/F9A8c9J9l
+9AReaXuj+k/o+bru0cwA4B8WA+SbEmSa+YfCB6UZ9zux/Vmy7dz7DGPef0NfZ2Pcy+Cd6+tdOY/y
+sp/Gn8c0mlPrdlPkxfNm0q093cTrGkrlkiUJGvYACmQjjEbrqylMnn0ROiaJqmuarb6Xpdu1zfXT
+cIol/Ek9lUbknoMthAyNDmwlIAWX2f8Alx5GsvJfle30iAiW5P72/uQKerOwHJv9UU4r7DxzfYMI
+xxp1GXIZytk+XNbDPzI/Kvy955slF3W11SBStpqUQBdAd+Drt6iV34n6CKnMfPp45BvzbsWYw9z4
+11GylsdQubGX+9tZXgkp/NGxU9fcZopCjTtQbFpv5TI9W4Hfiv6zmv13IN2NlUZzVluQ9zGkjSxy
+KGRxxZT0IIoRlsJGNEcwyoEUXm2u6NPpN9xFfRY8reUdaDtXxXO30GtjqMd/xDmHnNVpzilXTo9d
+/Lf827a8hi0rXphDfqAkN45pHN2HMn7L/gfnnL9tez53niFx7u79jstJrhIcM+fe9YiudhQ7Zwmb
+RkHZ2BCIW6zDOE9zHhc11iMJPReFCXd9FDE800ixxRgs8jkKqgdSSdgMztPoZTIFJoB4h+Z35sJq
+EUui6DITaPVLy+FR6g7xx/5J7t3+XX0XsTsHwayZR6ug7vM+bqdZrbHDDl1LHPy48nPqt+mpXiU0
+y1bkAw2lkXcKK9VH7X3Zm9t9pjBDgif3kvsHf+pj2fpPElxH6R9r2OV84El6Rhv5kXno+XWhB+K6
+kSOneinmf+I5vPZzDx6ni/mgn9H6XXdqZKxV3l5voNx9T1mzuSaKkq8z/kseLfgc7TX4fEwTj3xP
+z6Oh00+DJE+b1yU55sHrHnnn3y6wkbVrVaq3+9aDsegf+udd2F2iK8Gf+b+r9TpO0tLv4kfj+tEf
+lp+ZkvlyQadqJaXRpGqCoq8DN1ZR3U/tL9I8DldsdjjUjijtk+9xtHrPD9Mvp+59AaXrFjqFrHd2
+U6XFvIKpLGQyn7u/tnmus7NnjkQRRd3EiQsbhMkus1UsEh0QYrjdZDwj3I4VGS598yMelkWQi89/
+MD81NM8vxSWdky3msEFRCDVIj/NKR4fy9flnYdjez0stSl6cf3+79bianWRx7DeTwL/chrGpPLK7
+TXVw5knmffcndjnfZMkNPj7ojkHTQhLLPzL0KxtIrS0it4hRIxQeJPUk/M5xOfNLJMylzLv8eMQi
+IhDa9/xzJPmv/Ehk9L9YTPkxXNo0Mx8k/lR5z83yxtp9k0Onsfi1O5BjtwOh4sRWQ+yA+9Mvxaec
++Q2asmaMeb6g/Lf8q/L/AJGsmFoDdarOoW81KQAOw68EXfgld6Dr3J2zb4NPHGNubrsuYz9zNMyG
+l2KuxV8NfmDbG289+YoDX4NSuwtaVKmdip28RnO5hUz7y7nEbiPcpeVXpeyp/NHX7iP65rtaPSPe
+34+bLIzmpLepT7TH3AyceTMKV3Y2l/bNb3SB42+8HsQexyzDnnilxQNFjkxRnGpMF1ryfqNgWlgU
+3Vp1DqKuo/ylH6xnW6LtjHm2l6Z/Z8C6LUaCePcbxVvL/wCYvm7QlSKzvWktU2FrcD1YwB2FfiUf
+6pGXarsrT595R37xsfx72rFq8kNgdmX2/wCf+sqlLjS4JH7tHI8Y+4+p+vNPP2Vwk7SP2fscsdpy
+6xCy8/P3X5EItNOtoGIpykZ5ae4AMeSx+y2AH1SkfkP1ol2nLoAwnXfN/mjzHIseo3klwpP7u1Qc
+Y69qRoACfc75utNocGnFwiI+f7XDyZ8mTmbT7yt+Wd7dulzrINraChFt0lf2P8g/HNP2j7Q48YMc
+Xql39B+v7nO0vZkpbz2H2vVbaK3tbdLe2jWKCIcY40FFA9hnFZM0pyMpGyXfxiIihsHPJlbJ5f8A
+mBqyX2qJaxNyhswVYjoZG+191AM732e0RxYeOX1T+7o852nnE58I5R+9i3p5v3WvTdB1VdQ0uKQm
+s0YEc478lFK/7Lrnn3aWjODMR/Cdx7v2cnp9Jn8TGD1HNFS0YEEVB2IPSmYkdnILBfMHkr42udLA
+od2tTtT/AFCf1HOo7P7b24c3+m/X+t0+q7O/ih8v1JFpWveYvL10zWF1NZSg/vIv2WI/njaqt9Iz
+eZdPh1EfUBMfjq62GSeI7WCzfT/z58ywKFvLO2uqftrzic/OhZfuXNLm9mMEvpMo/a5ke05jmAUX
+L/zkDqpQiLSYVfszSsw+4Kv68pj7KYr3kfkyPah/msX1381vOesI0TXYs7d9mhtAY6jwLktJ/wAN
+m00vYmmw7iPEfPf9jjZdbkn1r3MesdIvb1gwUpEesr9Po8cydTrseLbnLu/HJjh0s8nkO9lWn6dB
+ZxiKIVLEc3PVjnNanVSyyuTu8OCOMUE+zWtiWeYWpp9P5nUfrP8ADMnSD1sJ8mMZs2l9wflnam2/
+Lzy3ERxb9HWzstKULxK5qPGrb50OAVCPudPlPrPvZLlrW7FXYq7FXxz+e+mmx/NLWgBRLlorlD4+
+rChb/h+WaLWRrIXbaY3AMR8vy+nqkVejhlP0io/EZrtVG4FyYHdmiHNMXIC25+0reIphgyDUbYkM
+0TG2VkJQ155f0S/Ja6tEZz1kWqP9LLQnMjD2hnxbQka+Y+1pyaXHP6glzflz5ekaoe4jHgjrT/hl
+bM4e0OoHSJ+B/W4x7LxHvV7b8t/LcbAv68w8HkAH/CKmVz9otSeXCPh+slMey8Q7yyHTNF0fTf8A
+eG0jhbp6gFXp/rmrfjmp1OtzZvrkT93y5OZi0+PH9IATIS5h03tmXGlY75u8xjTLP0YG/wBOnBEd
+OqL3c/wzd9jdmePk4pf3cefn5frcDX6vw40PqLzVVJNTuT1Od880uMe2Ko3RdVk0y8EoqYH+GdB3
+XxHuMwO0dENRjr+Icj+O9ydLqDinfTqzsTxyxrJGwaNwGVh0IOcNKBiSDsQ9KJAiwoyNkgFS+9tL
+S6XjcQpKB05AEj5HtmThzTxm4khqyY4z+oWklx5V0diSivF7I3/NXLNpj7XzjmQfh+qnDl2fiPeE
+MfKumqa85W9iy/wUZd/LGY9I/b+th/J2PvP4+CIt9G02AgpCCw/af4j+OY2XXZp85fob4aTHHkEb
+mI5CpbrymUe9fu3yMzspTHMdiknmaT4IIvElj9G38czdGNyWvIkcMUk0qQxKXkkYIijqWY0AzPAa
+n31ptmljp1rZR04WsMcKU2FI1Cj9WdLEUKdITZtEYUOxV2KuxV82/wDOVGimLXdG1pR8F3bPaSEd
+OVu/Na+5E34Zqu0IeoF2GjlsQ8Qt5TDPHKOsbBh9BrmslGwQ5oLPYnDKGU1BFQfY5opByQvnHKEn
+uu+RjzZBRRsmQzRCPlZCUQj5WQlWR8gQyVlkyBCqqyZEhK8SYKVB6tq9vptlJdTHZdkTuzHoozJ0
+ejlnyCEf7A1Z84xxMi8tvL+4v7yS7uG5SSGp8AOwHsM9F0+njhgIR5B5bLlM5GR5l0dMua1RqUwJ
+UJMKE58t636Dixnb9y5/csf2WPb5H9eaLtjs/jHix+oc/Mfsdn2fquE8EuR5Mlds5gB3SHkbLAEI
+aRstAYqDGpyYVbhQ7FUVZJuz+GwyrIUFF5Uhi+vz+pqBUdIlC/T1P682eljUPe0zO6eflNop1n8x
+tBs6ckW6W5lHbhbVnYH2IjpmfpocWQBx80qgX2vnQOodirsVdirsVea/85BeWzrP5cXc8acrnSHS
++jp14JVJfoEblvozE1sOLH7nI006n73yJmkdoy7QLv1rBFJ+OH4D8h0/DNTqoVP3t8DYTdSKUPQ5
+iFsCFIKOVPbp8st5hmFVHyBCVdHyBCVZXyBCVVZMgQlUEmCkuadUQu7BVUEsx2AA6nEQJNBBNbl5
+p5k8wPq18ShItIarAvj4sfc53vZfZ40+Pf6zz/U81rNT4sv6I5JajZsnEV1fAq8yYqpO2KqDthVl
+Wgaz9bt/Qmb/AEiEdT+0vSvz8c5PtTQ+FPij9EvsLvdDqeOPCfqCYu2a0BzkO7ZYAhSySHYq7FUx
+gj4Rhe/U/PMeRsobmlWKJ5W+ygLH6MEY2aQSwuWRpZXkb7TksfmTXN1EUKcd7p/ziz5bMuqat5jl
+X93axrZWxI2MkpDyEe6qij/ZZsuz8e5k4OsnsA+js2rgOxV2KuxV2Kqd1bQXVtLa3CCS3nRopo26
+Mjjiyn5g4CL2UGnwx5z8tXHlnzRqWhz1JspmSNyKF4j8UT/7JCDnPZcfBIh3WOfFEFQ0G8+r3oRj
+SOb4T/rfs5harHxRvubYGiy1GzUkN624XkvMdV6/LDA9GQKkj5IhkrI+QISrLJkSEqiyZEhKoJMj
+S2xXzzrbRQJp0LUeccpyOoSuw/2RzoOwdEJSOWXKPL3/ALHV9p6ihwDrzYhaW8k7Hjsq/abOsdGq
+Sp6UnGtdqjArg+KV3qYqsZ8VVVtGli5KfiO4HY4UIaC6mtLpJk2kjbcHv4g5VnwjJAxPItmPIYSE
+h0ZrFdJcQJMh+CRQw+ntnF5MRhIxPMPSwmJRBHVaxqcQlrFXYqr2kXJ+R+yv68hOVBSjsoYpN5iv
+OES2yn4pPif/AFR0+85maTHZ4mvIejH+uwzYNT7V/KbykfK3kTTdNlTheyJ9avx39eajMpp3QUT/
+AGOb/TY+CADqM0+KRLL8vanYq7FXYq7FXYq8H/5yc8jNcWVr5ws0q9mFtNSAG/pM37mT/YuxU/6w
+8M1uvw2OMObpMm/C+cs1bnsu0fUPrVqCx/ep8Mg9+x+nNTqMXDLyb4SsJmrZjEM0LMhjbb7J6ZZE
+2zBcr4kJVVkyJCVQSZGlXiTBSbeZeYLtrnWruRjUCQov+qnwj9Wd32diEMEAO6/nu8xq58WWR802
+0qBRpkbDrJVmPvWn8MzXHQeqQspWQDYbN/DAqAD4q36mKXLydgq7k9MUJ7aw0VR4ADFUm1xFjv3A
+25BWPzphVOPLFwz2LxH/AHU54/JhX9dc5rtfGBlB7w7vs6dwI7im+apz3YquRGdgq9TgJpUxjRUQ
+KOgzHJti1NNHDE0shoiCpOGMSTQUmmHXdy9zcPM/VzsPAdhm3hARFOOTb0P8hvI/+JvOsVzcR8tL
+0bjd3VRVWkB/cxn/AFmHL5KczdHi45+QcbU5OGPmX15m8dW7FXYq7FXYq7FXYqh9S06z1LT7nT72
+MTWl3G8NxEejI44sPuOCUQRRSDRsPib8wvJV95O80XWjXNXhU+pZXBH97bsTwf57Ub/KBzn82Iwl
+Tt8WQTjaSafevZ3AlXdTs6+K5i5cYmKbommXwTpJGskZ5IwqpzUyiQaLeCrHi6lW3ByHJKEkVomo
+dx2OWg2yBbWTEhK8SZGkrhJgpXnnmKze21a4qPglYyxnsQ5r+B2ztezcwyYY1zAr5POazGY5D57p
+h5dv42gNlIaSKSYq9wdyB71zPcVHXUIIIIqD2xVI7u0VKsh4gb0PTFUJEObha0riqb2dsidBue/f
+FU0Dw28RlmYIi9ScVYnf3bXd3JORQMfhHgo2H4YqyPy3avDYGRxQzNyA/wAkCgzmO1cwnlofw7O8
+7PxmMLPVNs1jnNqrMwVRUnEmlR8EIiXxY9TmPKVoVcihjeual68n1eI/uoz8RH7Tf0GbHTYeEWeb
+VOVpfaWlzeXUNpaxtNc3DrFBCgqzu54qoHiSczALNBrJp9o/lb5Eg8l+U7fTPhe/l/f6lMu/KdwK
+gH+VAOK/KvfN9p8Phxrq6jNk45Wy7L2p2KuxV2KuxV2KuxV2KsE/N78tbfzv5dMcIVNbsQ0mmTna
+pI+KFz/LJT6DQ+OY2pweJHzDdgy8B8nx1dWtzaXMtrdRNBcwO0c0MgKujqaMrA9CDmjIrYu2BtG6
+RqhtH9OU1t3O/wDknxGYufBxixzZxlTJ0cMoZSCpFQR0IzWENy48XXiwqMHJNoWWJ49xunjlsZWy
+tYJMlSrhJgpNoTU9PtdQt/SnFCN45B9pTmTpdTPDK4/Ed7RnwRyCixC80LULUl0X14h0li3+8DcZ
+02n7SxZOZ4ZdxdJl0c4eY8lJdY1FV4GUsB/MAT95Fc2Dioea6nmNZHr7dB9wxVT5HFVePULyMUSU
+ge9D+vFXVvr6QD453HQCpp/TK8mWMBcjTKEJSNAWnGm+XKOJLwgld/QBr/wRzTavtWxWP5/qdnp9
+Bvc/kyEAAUGwHQZonar44nkNFHzPbAZAKjoYViG27dzlEpWhUyKEl1rVwga1t2+M7SuO3sPfMzT4
+L9Ra5y6MfzYNT6K/5x2/KxrdI/OesxUmkU/oa3cfZRhRrgjxYGie1T3GbTRaevWfg4Gqzfwh73my
+cJ2KuxV2KuxV2KuxV2KuxV2KvHPzy/Jo+Y4n8xaBCP07Cv8Apdsu31uNRsV/4tUDb+YbeGYOr0vF
+6o83L0+fh2PJ8vujxuyOpV1JVlYUII2IIOad2KYaXq8loRFJV7cnp3X3H9Mxs+AT3HNnGVMliljl
+jEkbBkboRmtlEg0W4FfgVQltlbdPhPh2yYn3ptDOskZ+IU9+2WggptC6jI31KXj1oPuqK5biHqDG
+fJIoppYm5RsVPtmbKIPNxwaW3CwXDmSSJebfbIFOR8duhyeOcoCoku30evw1wajHHJHoaFj8e9R+
+p6eRuhSnUkkfidsyBrMw6/c7nH2Z2Pn3AiD/AFpR+y2hZaaTs3I+HKv6sfzubv8Asbpez3ZURZAr
++uf1rltLHkCI9h41/UchLVZT/F+Pg67UHsvTisWOM5fGQ+cr+xFm6dYhDCBDEOipt95zG4LNncvP
+5Mxmb5e5fpodr2MLUkk7D5HI5vpLCHNksVmeshp/kjNbLJ3N9opVVRRRQeGVEobxVI9V1wAGC0ap
+6PKO3sv9czcGm6ya5T7khzPanr/5H/k5J5luo9f12Er5ft2rBC4p9bkU9N/91KR8R7/Z8aZ2k0vG
+eKX0/e4uoz8Ow5vqVVVVCqAqqKKo2AA7DNw61vFXYq7FXYq7FXYq7FXYq7FXYq7FXjv5yfkbD5j9
+bX/LqLBrtOVza7LHd07g9Fl9+jd/HMHVaTj9Uebl4NRw7Hk+Yru0urO5ltbuF4LmBik0MilXRlNC
+rKdwRmoII2LsQbX2WoXFm/KJvhP2kP2TlOTEJjdkJUyOx1e1uwFB9OX/AH238D3zX5cEoe5tEgUd
+lDJ1K9cVQ89lBNGyEceQIJHvlkchBUsRuIJIJnhkFGQ0+fvm2hISFhxyKU8kh2KuxV2KuxVO/Ltm
+xdrthRQCsfue5zC1eTbhbMY6p/mA2qF1e21qnKZwvgvUn5DJwxmR2QTTHdR1qe6rGn7uD+Xufmf4
+ZsMWnEdzuWqU7S7Mlg9m/J/8iLrXmh13zNE9vomz21kapLdDsxpRki9+rdtt8z9NozL1S5OJn1PD
+tHm+m7e3gtoI7e3jWGCFQkUSAKqqooqqo2AAzbAU64lUwq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq
+wX8yfyi8ued4DNKPqWtIvGDU4lBag6LKu3qL9NR2OY2fTRye9uxZzD3Plrzt+XfmjybfG31i1IgZ
+iLe/iq1vL/qvQUP+S1D7Zp8uCWM7uyx5YzGzGcqbExtNcvIKK59aMdm6/Q2Y+TTRl5MxMhOLbXbC
+agZvSbwfp9/TMOemmPNsEwmCurqGUhlPQg1GUEUyQmo6ZDeoK/BKv2JB+o+2W4cxgfJjKNsau9Ou
+7Un1UPHs43U/TmxhljLk1GJCGy1i7FW1VmYKoLMegG5wE0qbWGgzSESXX7uLrw/aP9MxcuqA2juW
+yMO9NpdS060QJ6i/CKCNNyPbbMSOGczdMzIBKrvzFO9Vtk9Jf523b+gzKx6QD6t2ByJTJJJI5eRi
+zHqxNTmWAByYIzRtE1bWtQj0/SbSS8vZT8EMS8jTxPZVHcnYZOMDI0GMpACy+kPyw/5x507RWi1b
+zT6eoaotHisR8VtC3UFq/wB64/4Ee/XNrp9EI7y3Lr82qJ2jyezgACg6ZnuI7FXYq7FXYq7FXYq7
+FXYq7FXYq7FXYq7FXYq7FUPf6fY6jZy2V/bx3VpOvGaCZQ6MPAqdsEogiikEjcPEvPP/ADjJp900
+l55RuhZTGrHTbos0B9o5fidPkwb5jNfm0AO8XMx6sj6nhnmbyR5r8sT+jremzWgJok5XlC5/yJVq
+jfQc12TFKHMOZDJGXIpFlbNfHNLEaxuyHxUkfqyJiDzTaMj1vUk29XkPBgD+PXKjpoHoy4yrr5kv
+KUaONvoI/jlZ0ce8p8QqUmqW8hq9lFU9SKg/hTJjCR/EUcXkpG9t61WziHzLn/jbJeGf5xRfk2NX
+ukFIRHAD19NFH664PAiedleIqE13dTf3srOPAk0+7LI44jkEElRyaEZpekarq12tpplnNe3T/Zhg
+RpG+dFB298MYmRoIMgOb2PyR/wA4y61elLrzXc/oy26/UbcrJcsPBn+KOP8A4Y+wzPxaAneWziZN
+WB9O733yv5N8teVrH6nodjHaRkD1ZAOUshHeSQ1Zj8zt2zZY8UYCgHCnkMjunOWMHYq7FXYq7FXY
+q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FVk8EFxC8M8azQyDjJFIoZWHgVOxwEWoLzzzH+QP5ba0
+XkSxfS7h9zLYP6Qr/wAYmDxD6FGY09Hjl0r3ORDUzHm831v/AJxW1aMs+ia3BcL1WK8jaEj25x+s
+G/4EZiT7OPQt8dYOoYZqX5A/mlZFiukrdxr/ALstp4Xr8lZlk/4XKJaPIOjcNTA9Ugufy0/MK2JE
+vlvUtq1ZLWWRRTr8SKwyo4Jj+Esxlh3hB/4M84f9WLUP+kWf/mjI+FPuLLxI94V7f8vvPlxT0fLm
+puCachZz8a+7cKYRhmeh+SDlj3hObD8kfzSvSPT0GWJTuWuHigoDTtI6nv4ZYNJkPRgdRAdWXaP/
+AM4uecbghtU1GzsIz1EfO4kH+xAjT/h8vj2fM8yA1S1kegeh+Xv+cafIenFJNUkudYmXcrK3owkj
+/iuKj/e5zKhoIDnu0S1cjy2em6RoWjaNai10mxgsLfvFbxrGCfE8QKn3OZcYCIoCnHlInmjskxdi
+rsVdirsVdirsVdirsVdirsVf/9k=</xapGImg:image>
+ </rdf:li>
+ </rdf:Alt>
+ </xap:Thumbnails>
+ </rdf:Description>
+ <rdf:Description
+ rdf:about="">
+ <xapMM:DocumentID>uuid:0A41642859EE11DA9346CE657E5F1B06</xapMM:DocumentID>
+ <xapMM:InstanceID>uuid:0A41642A59EE11DA9346CE657E5F1B06</xapMM:InstanceID>
+ <xapMM:DerivedFrom
+ rdf:parseType="Resource">
+ <stRef:instanceID>uuid:0A41642759EE11DA9346CE657E5F1B06</stRef:instanceID>
+ <stRef:documentID>uuid:0A41642659EE11DA9346CE657E5F1B06</stRef:documentID>
+ </xapMM:DerivedFrom>
+ </rdf:Description>
+ <cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>AVAHI</dc:title><dc:publisher><cc:Agent><dc:title>izo@aucuneid.net</dc:title></cc:Agent></dc:publisher><cc:license
+ rdf:resource="http://creativecommons.org/licenses/by-nc/2.0/" /><dc:subject><rdf:Bag><rdf:li>tango avahi freedesktop</rdf:li></rdf:Bag></dc:subject></cc:Work><cc:License
+ rdf:about="http://creativecommons.org/licenses/by-nc/2.0/"><cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" /><cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" /><cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" /><cc:requires
+ rdf:resource="http://web.resource.org/cc/Attribution" /><cc:prohibits
+ rdf:resource="http://web.resource.org/cc/CommercialUse" /><cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" /></cc:License></rdf:RDF></svg:metadata></x:xmpmeta>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<xpacket />
+ </svg:metadata>
+<svg:switch
+ id="switch2676">
+ <svg:foreignObject
+ requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/"
+ x="0"
+ y="0"
+ width="1"
+ height="1"
+ id="foreignObject2678">
+ <i:pgfRef
+ xlink:href="#adobe_illustrator_pgf">
+ </i:pgfRef>
+ </svg:foreignObject>
+ <svg:g
+ i:extraneous="self"
+ id="g2680">
+
+ <namedview
+ showgrid="false"
+ pagecolor="#ffffff"
+ window-x="472"
+ id="base"
+ bordercolor="#666666"
+ cy="24.622653"
+ zoom="9.8994949"
+ pageshadow="2"
+ cx="25.799661"
+ grid-bbox="true"
+ window-height="695"
+ document-units="px"
+ window-width="770"
+ showpageshadow="false"
+ borderopacity="0.17254902"
+ pageopacity="0.0"
+ window-y="167"
+ current-layer="layer1">
+ </namedview>
+ <svg:g
+ id="g2682">
+
+ <svg:linearGradient
+ id="XMLID_15_"
+ gradientUnits="userSpaceOnUse"
+ x1="-156.5977"
+ y1="-100.4229"
+ x2="-142.3975"
+ y2="-100.4229"
+ gradientTransform="matrix(-0.7135 -0.7006 -0.7006 0.7135 -142.1155 -25.5815)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#C17D11"
+ id="stop2685" />
+ <svg:stop
+ offset="0.2735"
+ style="stop-color:#BD7A10"
+ id="stop2687" />
+ <svg:stop
+ offset="0.5694"
+ style="stop-color:#B0700C"
+ id="stop2689" />
+ <svg:stop
+ offset="0.8747"
+ style="stop-color:#9A6105"
+ id="stop2691" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#8F5902"
+ id="stop2693" />
+ </svg:linearGradient>
+ <svg:path
+ fill="url(#XMLID_15_)"
+ stroke="#6F4709"
+ stroke-width="1.96"
+ d="M29.844,2.535c-2.216,2.259-1.747,6.318,1.048,9.064 c2.798,2.75,6.863,3.144,9.083,0.885c2.219-2.259,1.75-6.316-1.049-9.064C36.13,0.672,32.064,0.276,29.844,2.535z"
+ id="path2695" />
+
+ <svg:linearGradient
+ id="XMLID_16_"
+ gradientUnits="userSpaceOnUse"
+ x1="-57.9634"
+ y1="-3.5654"
+ x2="-43.7632"
+ y2="-3.5654"
+ gradientTransform="matrix(0.7135 -0.7006 0.7006 0.7135 46.2366 -25.5815)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#C17D11"
+ id="stop2698" />
+ <svg:stop
+ offset="0.2735"
+ style="stop-color:#BD7A10"
+ id="stop2700" />
+ <svg:stop
+ offset="0.5694"
+ style="stop-color:#B0700C"
+ id="stop2702" />
+ <svg:stop
+ offset="0.8747"
+ style="stop-color:#9A6105"
+ id="stop2704" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#8F5902"
+ id="stop2706" />
+ </svg:linearGradient>
+ <svg:path
+ fill="url(#XMLID_16_)"
+ stroke="#6F4709"
+ stroke-width="1.96"
+ d="M12.511,2.535c2.216,2.259,1.747,6.318-1.047,9.064 c-2.799,2.75-6.863,3.144-9.084,0.885c-2.219-2.259-1.75-6.316,1.049-9.064C6.225,0.672,10.29,0.276,12.511,2.535z"
+ id="path2708" />
+
+ <svg:radialGradient
+ id="path2327_1_"
+ cx="160.6719"
+ cy="-64.959"
+ r="17.3244"
+ gradientTransform="matrix(0.788 0 0 -0.788 -109.3872 -38.6921)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#E9B15E"
+ id="stop2711" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#966416"
+ id="stop2713" />
+ </svg:radialGradient>
+
+ <svg:path
+ id="path2327"
+ type="arc"
+ ry="8.6620579"
+ cx="31.112698"
+ rx="8.6620579"
+ cy="19.008621"
+ fill="url(#path2327_1_)"
+ stroke="#6F4709"
+ stroke-width="1.96"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d=" M37.667,13.688c0.004,9.375-7.591,16.983-16.97,16.985c-9.376,0.004-16.98-7.592-16.985-16.969c0-0.004,0-0.011,0-0.016 C3.707,4.309,11.302,0.986,20.681,0.98c9.377-0.005,16.982,3.314,16.986,12.689C37.667,13.676,37.667,13.68,37.667,13.688z" />
+
+ <svg:path
+ id="path3834"
+ type="arc"
+ ry="8.6620579"
+ cx="31.112698"
+ rx="8.6620579"
+ cy="19.008621"
+ opacity="0.1266"
+ fill="none"
+ stroke="#FFFFFF"
+ stroke-width="2.2347"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ enable-background="new "
+ d=" M35.581,13.688c0.004,8.223-6.661,14.893-14.884,14.897c-8.224,0.006-14.894-6.66-14.899-14.881c0-0.009,0-0.011,0-0.016 C5.794,5.462,12.459,3.299,20.681,3.295c8.224-0.005,14.896,2.15,14.9,10.378C35.581,13.676,35.581,13.68,35.581,13.688z" />
+ <svg:radialGradient
+ id="XMLID_1_"
+ cx="21.4727"
+ cy="24.4736"
+ r="2.6923"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EF2929"
+ id="stop2718" />
+ <svg:stop
+ offset="0.4553"
+ style="stop-color:#DD1414"
+ id="stop2720" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#CC0000"
+ id="stop2722" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_1_)"
+ stroke="#CC0000"
+ stroke-width="0.2274"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ d=" M24.755,23.243c0,1.744-1.471,3.16-3.282,3.16s-3.282-1.416-3.282-3.16c0-1.748,1.471,0.332,3.282,0.332 S24.755,21.495,24.755,23.243z"
+ id="path2724" />
+ <svg:g
+ id="g2726">
+ <svg:g
+ id="g2728">
+ <svg:radialGradient
+ id="XMLID_2_"
+ cx="21.541"
+ cy="17.8096"
+ r="6.6862"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#555753"
+ id="stop2731" />
+ <svg:stop
+ offset="0.4309"
+ style="stop-color:#424645"
+ id="stop2733" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2735" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_2_)"
+ d="M17.067,19.858c1.056-1.547,2.347-3.071,3.114-4.264c0.822-1.179,1.117-5.489,1.36-5.479 c0.241-0.01,0.538,4.301,1.359,5.479c0.766,1.193,2.057,2.717,3.114,4.264c1.052,1.551,1.388,2.916,0.551,3.947 c-0.786,1.02-2.746,1.703-5.024,1.697c-2.28,0.006-4.24-0.678-5.025-1.697C15.677,22.774,16.017,21.409,17.067,19.858z"
+ id="path2737" />
+ </svg:g>
+ <svg:g
+ id="g2739">
+
+ <svg:linearGradient
+ id="XMLID_3_"
+ gradientUnits="userSpaceOnUse"
+ x1="28.5498"
+ y1="-72.4541"
+ x2="31.085"
+ y2="-72.4541"
+ gradientTransform="matrix(-0.8133 -0.5818 -0.5818 0.8133 6.2234 98.8486)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop2742" />
+ <svg:stop
+ offset="0.173"
+ style="stop-color:#D2D3D2"
+ id="stop2744" />
+ <svg:stop
+ offset="0.5467"
+ style="stop-color:#8B8E8F"
+ id="stop2746" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2748" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_3_)"
+ d="M23.674,22.249c-0.67,0.895-2.327,0.852-1.395,1.494 c0.933,0.641,2.229,0.434,2.897-0.461c0.663-0.898,0.446-2.148-0.483-2.789C23.759,19.853,24.34,21.349,23.674,22.249z"
+ id="path2750" />
+
+ <svg:linearGradient
+ id="XMLID_4_"
+ gradientUnits="userSpaceOnUse"
+ x1="23.2285"
+ y1="-76.1748"
+ x2="25.7578"
+ y2="-76.1748"
+ gradientTransform="matrix(0.8133 -0.5818 0.5818 0.8133 43.3567 98.8486)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop2753" />
+ <svg:stop
+ offset="0.173"
+ style="stop-color:#D2D3D2"
+ id="stop2755" />
+ <svg:stop
+ offset="0.5467"
+ style="stop-color:#8B8E8F"
+ id="stop2757" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2759" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_4_)"
+ d="M19.408,22.321c0.667,0.898,2.327,0.854,1.395,1.496 c-0.931,0.639-2.228,0.432-2.893-0.463c-0.666-0.896-0.45-2.146,0.479-2.789C19.32,19.925,18.742,21.425,19.408,22.321z"
+ id="path2761" />
+ </svg:g>
+ </svg:g>
+ <svg:path
+ fill="#FFFFFF"
+ stroke="#2E3436"
+ stroke-width="1.96"
+ d="M18.25,10.477c0,2.724-2.293,4.93-5.121,4.93 c-2.826,0-5.119-2.206-5.119-4.93c0-2.727,2.293-4.933,5.119-4.933C15.957,5.544,18.25,7.75,18.25,10.477z"
+ id="path2763" />
+
+ <svg:radialGradient
+ id="XMLID_5_"
+ cx="9.1104"
+ cy="26.168"
+ r="5.2773"
+ gradientTransform="matrix(0.9241 0 0 0.8901 4.7122 -12.8166)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#FCE94F"
+ id="stop2766" />
+ <svg:stop
+ offset="0.3535"
+ style="stop-color:#FBE651"
+ id="stop2768" />
+ <svg:stop
+ offset="0.6"
+ style="stop-color:#F7DD57"
+ id="stop2770" />
+ <svg:stop
+ offset="0.8134"
+ style="stop-color:#F1CE61"
+ id="stop2772" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#E9B96E"
+ id="stop2774" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_5_)"
+ d="M8.253,10.477c0-2.597,2.186-4.698,4.876-4.698c2.694,0,4.878,2.102,4.878,4.698 c0,2.594-2.184,4.696-4.878,4.696C10.438,15.173,8.253,13.071,8.253,10.477z"
+ id="path2776" />
+
+ <svg:radialGradient
+ id="XMLID_6_"
+ cx="9.3203"
+ cy="24.5781"
+ r="4.4281"
+ gradientTransform="matrix(0.9241 0 0 0.8901 4.7122 -12.8166)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop2779" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop2781" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop2783" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop2785" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop2787" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop2789" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop2791" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop2793" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2795" />
+ </svg:radialGradient>
+ <svg:path
+ opacity="0.5"
+ fill="url(#XMLID_6_)"
+ d="M8.447,10.757c0-2.595,2.185-4.696,4.878-4.696c2.692,0,4.877,2.102,4.877,4.696 c0,2.594-2.185,0.52-4.877,0.52C10.632,11.277,8.447,13.351,8.447,10.757z"
+ id="path2797"
+ style="opacity:0.15000000" />
+
+ <svg:radialGradient
+ id="XMLID_7_"
+ cx="9.1104"
+ cy="26.168"
+ r="3.0081"
+ gradientTransform="matrix(0.9241 0 0 0.8901 4.7122 -12.8166)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#8F5902"
+ id="stop2800" />
+ <svg:stop
+ offset="0.273"
+ style="stop-color:#8C5804"
+ id="stop2802" />
+ <svg:stop
+ offset="0.4635"
+ style="stop-color:#835408"
+ id="stop2804" />
+ <svg:stop
+ offset="0.6288"
+ style="stop-color:#744F11"
+ id="stop2806" />
+ <svg:stop
+ offset="0.7799"
+ style="stop-color:#5E461C"
+ id="stop2808" />
+ <svg:stop
+ offset="0.9198"
+ style="stop-color:#423C2B"
+ id="stop2810" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2812" />
+ </svg:radialGradient>
+ <svg:ellipse
+ fill="url(#XMLID_7_)"
+ stroke="#2E3436"
+ stroke-width="0.1914"
+ cx="13.13"
+ cy="10.477"
+ rx="2.779"
+ ry="2.676"
+ id="ellipse2814" />
+ <svg:linearGradient
+ id="XMLID_8_"
+ gradientUnits="userSpaceOnUse"
+ x1="10.5449"
+ y1="10.4761"
+ x2="13.7393"
+ y2="10.4761">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop2817" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop2819" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop2821" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop2823" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop2825" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop2827" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop2829" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop2831" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2833" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_8_)"
+ d="M12.873,10.477c0,1.393,1.737,2.522,0.291,2.522s-2.619-1.13-2.619-2.522 c0-1.395,1.173-2.524,2.619-2.524S12.873,9.083,12.873,10.477z"
+ id="path2835" />
+ <svg:path
+ fill="#FFFFFF"
+ stroke="#2E3436"
+ stroke-width="1.96"
+ d="M24.297,10.477c0,2.724,2.296,4.93,5.125,4.93 c2.824,0,5.117-2.206,5.117-4.93c0-2.727-2.293-4.933-5.117-4.933C26.593,5.544,24.297,7.75,24.297,10.477z"
+ id="path2837" />
+
+ <svg:radialGradient
+ id="XMLID_9_"
+ cx="-180.3799"
+ cy="26.168"
+ r="5.2778"
+ gradientTransform="matrix(-0.9241 0 0 0.8901 -137.2698 -12.8166)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#FCE94F"
+ id="stop2840" />
+ <svg:stop
+ offset="0.3535"
+ style="stop-color:#FBE651"
+ id="stop2842" />
+ <svg:stop
+ offset="0.6"
+ style="stop-color:#F7DD57"
+ id="stop2844" />
+ <svg:stop
+ offset="0.8134"
+ style="stop-color:#F1CE61"
+ id="stop2846" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#E9B96E"
+ id="stop2848" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_9_)"
+ d="M34.297,10.477c0-2.597-2.185-4.698-4.875-4.698c-2.695,0-4.881,2.102-4.881,4.698 c0,2.594,2.186,4.696,4.881,4.696C32.112,15.173,34.297,13.071,34.297,10.477z"
+ id="path2850" />
+
+ <svg:radialGradient
+ id="XMLID_10_"
+ cx="-180.1689"
+ cy="24.5781"
+ r="4.4261"
+ gradientTransform="matrix(-0.9241 0 0 0.8901 -137.2698 -12.8166)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop2853" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop2855" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop2857" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop2859" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop2861" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop2863" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop2865" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop2867" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2869" />
+ </svg:radialGradient>
+ <svg:path
+ opacity="0.5"
+ fill="url(#XMLID_10_)"
+ d="M34.098,10.757c0-2.595-2.181-4.696-4.872-4.696c-2.694,0-4.876,2.102-4.876,4.696 c0,2.594,2.182,0.52,4.876,0.52C31.917,11.277,34.098,13.351,34.098,10.757z"
+ id="path2871"
+ style="opacity:0.15000000" />
+
+ <svg:radialGradient
+ id="XMLID_11_"
+ cx="-180.3789"
+ cy="26.168"
+ r="3.0083"
+ gradientTransform="matrix(-0.9241 0 0 0.8901 -137.2698 -12.8166)"
+ gradientUnits="userSpaceOnUse">
+ <svg:stop
+ offset="0"
+ style="stop-color:#8F5902"
+ id="stop2874" />
+ <svg:stop
+ offset="0.273"
+ style="stop-color:#8C5804"
+ id="stop2876" />
+ <svg:stop
+ offset="0.4635"
+ style="stop-color:#835408"
+ id="stop2878" />
+ <svg:stop
+ offset="0.6288"
+ style="stop-color:#744F11"
+ id="stop2880" />
+ <svg:stop
+ offset="0.7799"
+ style="stop-color:#5E461C"
+ id="stop2882" />
+ <svg:stop
+ offset="0.9198"
+ style="stop-color:#423C2B"
+ id="stop2884" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2886" />
+ </svg:radialGradient>
+ <svg:path
+ fill="url(#XMLID_11_)"
+ stroke="#2E3436"
+ stroke-width="0.1914"
+ d="M26.638,10.477c0,1.477,1.244,2.676,2.784,2.676 c1.532,0,2.775-1.199,2.775-2.676c0-1.479-1.243-2.68-2.775-2.68C27.882,7.797,26.638,8.999,26.638,10.477z"
+ id="path2888" />
+
+ <svg:linearGradient
+ id="XMLID_12_"
+ gradientUnits="userSpaceOnUse"
+ x1="-185.1465"
+ y1="10.4761"
+ x2="-181.9497"
+ y2="10.4761"
+ gradientTransform="matrix(-1 0 0 1 -153.1406 0)">
+ <svg:stop
+ offset="0"
+ style="stop-color:#EEEEEC"
+ id="stop2891" />
+ <svg:stop
+ offset="0.2125"
+ style="stop-color:#EBEBE9"
+ id="stop2893" />
+ <svg:stop
+ offset="0.3608"
+ style="stop-color:#E2E2E1"
+ id="stop2895" />
+ <svg:stop
+ offset="0.4895"
+ style="stop-color:#D3D3D2"
+ id="stop2897" />
+ <svg:stop
+ offset="0.6072"
+ style="stop-color:#BDBEBD"
+ id="stop2899" />
+ <svg:stop
+ offset="0.7172"
+ style="stop-color:#A0A3A2"
+ id="stop2901" />
+ <svg:stop
+ offset="0.8216"
+ style="stop-color:#7E8181"
+ id="stop2903" />
+ <svg:stop
+ offset="0.9197"
+ style="stop-color:#555A5B"
+ id="stop2905" />
+ <svg:stop
+ offset="1"
+ style="stop-color:#2E3436"
+ id="stop2907" />
+ </svg:linearGradient>
+ <svg:path
+ opacity="0.3"
+ fill="url(#XMLID_12_)"
+ d="M29.676,10.477c0,1.393-1.737,2.522-0.293,2.522c1.447,0,2.623-1.13,2.623-2.522 c0-1.395-1.176-2.524-2.623-2.524C27.938,7.953,29.676,9.083,29.676,10.477z"
+ id="path2909" />
+ <svg:path
+ fill="#6F4709"
+ d="M26.172,25.829c0,1.971-2.074,3.566-4.631,3.566s-4.629-1.596-4.629-3.566 c0-1.967,2.072,0.594,4.629,0.594S26.172,23.862,26.172,25.829z"
+ id="path2911" />
+ </svg:g>
+ </svg:g>
+</svg:switch>
+<i:pgf
+ id="adobe_illustrator_pgf">
+
+ eJzs/XdC+8iyAAp/G9AebMBgwEHBkSxZssnR5OgIBicc5py5f7z1vLuOu7FXHSS1ZCWHc+ec+w09
+P8ZYrY6Vu6orEr68icv1XrURlxJ8iItECoNGZdQbbIXwt6Gjdns8HA3QV9Hr9ZAgJnioJB/l3mnF
+u8Zg2Op1t/CjhAAPi+jtqCBIQlwQ+Fw8zWczcTHFi/G0xEvxPC8I637PoZlya9RuQEOVPypfrbiY
+GP7xua6PDzpUKyN4KuSSgpDk0yEhu5XOw2OlN+7WW91PpffPrZCUzYXEXCqUEsWQJGTg8WHrujG0
+10lk0zlcMSFJmTzUFhIwOgleSSfyeV6E99RebdxpdEeXg16tMRwWeu3eYLgVKvxZ6YbOKp/wpBJ6
+bLTbvX+ElHal9sPBEqXfi612A1ajUxmFcmjd5CNBfFfGrXb9fNypNmCZRD6NvpbecYu3Q2gKWkWf
+0dfZ96MOfHPTGI1guNAfWvvrklKALel1cDX4Dpfo83Wj/z//PYDqr+ukyXKj02/DKpFp5vOJdEji
+efTb/ExrwjhxrXgeT1gKwczTfCofyvFZ/E0oncskUvm0QF4wl6PxR6vxj63Qea/bIHOWB6Ob1n/B
+LFI5+I98dz1uNwa33dYIppBBX+XJfM969UYbNtF4s9iu4GniIpi/SYVyZfDZGMEG9trjEYa5HE8f
+wXqeVv5soD0RSAcX/Ua33LvDo5MkWP58KgsfhEQunwllE1I+mw0JvCCGMhkxJGZwX/BAwh0KuPD6
+yFBbqCW9iyxswyWs9MWg9dnqbkmZVCgu5nJky0qDVt3csawYypFfeCKJHPMvr/8jI4bJj0aNLp0B
+QErhjNl5PnF2A91q3Xqh10FrP0TQ3oD+ASbbvU/yzPiMn8Dr4z6ZAv77HbbpctDqoja5c/wk937Z
+HsOj0qA37h91mz0uShC/PKjUoFroovrdqI0AYe/gf71Ba4ixz/53otLqr3u2d1NDsxuElMF4+BUq
+93ptaAMAAEAj1PgnPOk2KMlBGNMI1VvN5njYgEqWv/+NOrqsjL4A2xvd+nCyB/VFFDKfg0od/T9U
+b4SaqPEh6RmqW54PA3WGGr7okl6Dzq0R6vRGraYxucpg1BqOWr/jYPP73+4SSECA7uztGov6H9Bh
+odJut2Df+1+tWoA+a2b1yX6tD/37BgIzgG3FD1Ej6E/4/2Gl3QuAVn92qr12a9iBN4zP5ojMr/yb
+UhsIGcyBOEKT1v2j0e71+6hx43OoMQphjGlirupDeNC+NlvdOhCDm3FrxCxcr9PvDVE75gQ06L2L
+JJmQ+VoAHGlXupVBCH8/OZPLBtDaMax5/c9upYN3sL6md3ja+gPhGNQwukm/AwlniXQ8zuVDSpch
+4SUgGS2g/iAY3Xah0UY99Em/CoHY5PQlcB4xpNS5Z26H4wtzFNVW4Du2QQ2KtYJm+a5I/9bgU1H/
+S+DJX8CK8ScOfcBFoL/Jj4iLhEsKSkZIQ8lAydLfWSEHJS/kuD000XTgkp0oGSg5psi8zKFfUBRa
+2ElrdALkR4JxpowxonHloSiCLBQEDUpRKMJUJE4UxZSYFjNQclDyoiKqUDSQgUVJktJSVspIOSkv
+yVJBUqViik+JqVQqncqk8ik5paRUPNFCeuqSshTb9xzzSHIsIi0CLXgdlCIUDYoK/wq4oB9ZkTn4
+lVdyShZKBkoaCoxekaDAnNFiykVZg6JCUWT0k5ezUNKyJIuykC/CRHmYarEwR1EmC8f8IU+UvKXk
+jJJlSoaWNClcMUWLhItIi4ALAfoiFPKjQingghYOrUBey+M9RR8ClpxjyTIlo2U49AtKmpYULRIu
+Ii4YNjG6FnFBw0M/BSiwqbA3eSg5KFk1w6kZNa2moEgIZlUBiAFaZQ1qF2Dv5UIeSq6QLWQwXEkY
+XHgMIgUMFmSiqeK0xRWNMT3gyP9wEZkiGSVFi/6TwSWLSw6XPC4AfAhQOfiFcANmi5cOdhkRB0Rx
+EOJmAEUzKdwG+slmclDyGRmKkilkYJUyGkw0FYq8KwMgwHyCT2X5NBL6eSEPRAY+ZLNiGjQtpBzk
+czlRSqMPggTfwgeJz+f4FNDvbDaRFnNIh4CmQBF4X0RTyhCNKJ8ShByuAO3A14kMvCnSZvS3acuJ
+FBBgUJJAIQTtiGdHM1czMBJFNVigzuSC8j3ekfHxVs7n9SPyEoaiDBD/PKbzBcywCFUn9FznNjlM
+z2UOSLqCCaCKEIfgbQ4wUgZkLgD2aFqRcDZMAiQCvQh+MOUgtITQFkJvTFqkkyyVK6pMIX0ATOUB
+JYuAqhKgdB5606AXEVrPQIsyeq84xQ9n+3PPe60EpohMkWhJ4ZLGLDRD2WmOw1w0T5dWJmtVxCSQ
+kD8ZU7IsJVIpTJQwOcKEiJAhRIJkTIKyCK8Y+iMg+sNRAkRIUAH3AUw1J2YBT9PAaiVguILIAyXW
+4IUC5sggLWD5IY13GHFuAYshGpZuMGuCQeeoSJDmYGpokiKePv+/1IdJPRAmESzmEyAZIM0Sf4eQ
+C2GXACueS5kfxFAK2XHSGYZszNMGpheCkM2ksuiVPKqB7BoJnjaEzBpQJqnDNC/NRwuchWCQgnmT
+FkzINKqlEL6o/18jvBx2Bf/GBW2liIuE/nHwvxSWzZB0hv7BZFM5/C+HpTUkr6FSAJhF/zSgBprB
+zQi7kiirggY4hjsR3qRzJcSTENjlnH7ytiJPFIWWAi76/wGnuJxKiwb/iliMgN8AmEUgd/Q3Inx5
+Ef7BzuF/KfidwoUOMJ/JZ/G/HId+QdF/ZFwUkAvgH55CUXMoc/xw/lUW2CAhlMXJIvATxUmJ0RWZ
+FJVXMHPhqBZDeQwuOpNRqe7A41YkDH5IfchCIeqDAlI5KBCY3fDQviilOJB5kJCSxZqEgkFdwwCM
+wBbrD4KtWFQ+gylptGBZkBHwsYgP8n0ey/gg5XOOYj5ilqygDxKiIernsLCfAYkLIQoW+RGbAM6o
+gchZ4KBpBDp5ACYEW2kMdSKBSjyFrOpQCraiGEWmJU9LjhbyA0IcB78I2gEGZyVc0DIjZY7oh0jo
+R8wKMSIQcdF8sdCXxwIgagP9pBEdgNUXOZAU0QbzWEvQsDRZgAVCQiYRhAW/n0mg4nWV2VKois3Z
+dG+qrpv7ahTZKHladK2X1YYzHOJNtBAiqHN8AEiriCulYQ0kJAAiqp/GtB7BaQqxl7TOXqQUOlYA
+LoD+dhIo52sGsyosgKJaaQn9mOwH6qdBQEaPsno30BAIrugRFuWhqUw+gZCXlbkX1uJ8TE50ZHKi
+ReCloqpCJVREOEQgG4Rk5EQZkwvNIBWSlMK0IkttDopOLSjbEzjM7QiLy9pYW4EyNZ2l6fqXrnGx
+mpauY8kcw87w94S/FbCqhdCkiBUtkapYRL0ylSuiYGkIFwFKBYyhEgwM4S2gMMZk+J3DOC4D3iMq
+oIJGXMTgLeRE/A+mCzNJI7wFIpCjfFPBXLFAGSLI1RzmfiIeLKCNADRNwvQtDbifA+InAylERFED
++Z0HMipi00oKqEMWWGweCJ6C5FKQTjWQ0HkQWyUswKaRNp2FfmQgrAUs62pYuhdABk5hdT0DknHO
+0Ct0zYLoFHj6WJMgkr/GMC4/WZ6V561yfMqQ49NUjjcEeI6av1TG7CViXpY21COdbbFwl8Jwl8dw
+h2wGNhaV1Q0fRA0wlQBdBShQGwQR/9OG6M/bzA4WowOHrQ4a5liKYYfKYNZE2BJhSSplR4QZEVZE
+GZHOhjAXynOECREwmHzb730XLoZlrgKHJTMZ4C8HkJgBmEwBbCIo5UFj1DBPI/wrj7lVBjMoCTMm
+HjMknRkRRpTlCA8iCKaxPAeQDagUIGUKo6gI6MpjiVTFqKwAUuex/JrBCJ/CYq6ARWAiGhc4IA8y
+EIocNlNmoJUUkBARtpTHNi8NtrgAWy1j/ciuIdl1JNCSOKIm2awlOgWVUogJIGZAv2GNChnD9ACz
+FrOECVhME3O0ghmJwYvSxICBeZGAvkTf6aYWpM+kkZLDowbSXjxttnbmYhqOPEO06EVCerHFrcHs
+1IUIxTlO/zBR8i5FdiiKWTj6QbVJwRqx6tBSNAtr8xAFptAfDhM7vaSMksHwn8bSum7yz1HDPyky
+LQqV5ElROXIqQAqWt4pUfSB9kJ8ULhkq62cxF0dFxoXwcqrockSztWmypAVTiUWFcHhTfS1QPk85
+vc7rOYbZmyqrweYxU2ftp6zllFhNCWPPY8YObJ2jnF3DnF3n7ZSzYyE9h1k6y9Q1ytgFytTx4HW2
+ztk4O9F5NWqDw4wdK7KmCks0Vxn/U7DWiszfGrbW8bLAYUAS8eqi5UkDzUcDymEegH4UrOIgk5WG
+jXs8FhqQ2KALDRmqjyCqn+cM+UGlpYgFdYHwcG2xxb1BB33Ws2hEeuDc9RNXfUacKIKpGnP0g36U
+phfJQkf0Y0CTrmSMolOOjEk59LO4PP6K0AJyNkd4UAFzI92sq2vdBXpuhz4XCUFA3IvDx3iEDogG
+BRAwUooGEUhRNT1NT/qIup7FCJ8z0B3/5ijWqwzCE02ex2vBG+iewrw2jRFePyZEfDiPET6vozxn
+mLZ0Y5ZuwCJIzyI7EehNZJcNRFcRmsM/kBA4aqRKMbapHP4nY0QvUOldpbK7eVAiYYKSxvJI1jwm
+4bCsogvyqoHwBOVTtCCkz2Gkz1FJXmGleYr2WKLnDHE+jcV5gvY5agpTqFhPUR9ruwImvqYVC9Eh
+3VwFiM+hcywD9zWK9oD4wbT2KX/cG5xEFr8isGjkVOyo5YxiOqLZOHqGWqxMbLNy9YyFOWcZhpwz
+2DA9RpEp/ul4Z2KfgnHOxEANY2ARYyFmxIY1TGfFPGHAgoGHKSxySlj01JlwxoKJLBO2M2CMihyW
+ZVXCfjFGCgZOoiJZ8DKF1ei0YXbTWXEeF4yZnMGPVUe85A2GbMdPonDnKX4ihozxk2NMyUiUlzCe
+pjGeZhmdW9YtyPTAn+jZ5pGmSBlziiO6OubNutqdM/gz+k0Ub81QvQULkyY4S1g10lXynAO/Vg3U
+FfAeSJRjm6q4ybIJ3iq6sTqncQYKIzBK4dXFCBxE55365+8G/25wYQ1aBSS389O05QyVWl9MJ6QC
+9a9iLTASlYFy1AbDWmAESgvTjO2vIGocpmYipllZLD0o1NmICAgZTHIULAQIVLzPYU6vwdBELMDn
+gCAUMhoME9Cfw7xaBiQvwjBAowX0LaDDI2LeWfCPW4Pq1IX44RQ4/cNEUVyK7FAY/xzOxU0na3fR
+MUqaKSmm0LNIznDYMZ12qOMO47xTZOam/xRoUag7Dyl5zvDrIb49WXq8jmxsaXrInqInoyJ19sEH
+7vhIocicuqv05B2b4pAxTjb8gHL0FCaDTXNpxr1MdyQzz5r0UybDhYyjB0w5arybdCHTz5asp0um
+SY4Y5YwTJo7a5oh1jtjniIUO2/gMGx2x0ul2Ot1Sh211jKkuh/RLYq0z7HWMxa5gsQ==
+
+
+ 2NltdrrVzrDZUZMdOTeiR0am6c5quLOa7XSjXWbCYIfNdaaxjpjqiKFO+1/Fy5kx0x0vZ8RMztWB
+zh0z3XDTwEspIG4WfXATYydHPe5M7GRxMzh2ajp2cgQ9ydHt9NhpcfHE2MlZjn9zEy6eJnYKNidP
+9vTXPP/NcMwR8Kz4SW3pGENlDguQujVdt6ezFnXVwE+rTd1uVSdyb54zUZTBzzkwlDNRFBvUDQwl
+eOkO9TOV6dmbV4HN5ByxzIEP+vqsUoTjXHHPin1W3mhwRxsKAhJydix0xENPTKR+ZxQVuYDY6M0t
+NZ1bIn5pYmTewMicBSPTjDu2L8fkPHDShpUMz5zESoNrcvQ8y+Ca9FSLnGuxJ1sz4KV+zmWedDmd
+dVlPuyYwk2OZJ8XMWXhnVsdNzsI+maMu6/mUcdSf0X3ZYDKSgB0EyCkSn4BJwUN00IP+jz8Qh4bJ
+46HFNEe8etFZkoTdEnQPCeKEQJz9dOcF4wM+jnJ2M563pblOrSSnUyvJ4uiALRrzFUt4BGeLl3Co
+YhhQrIUlUEWzcNQWyhbdckZsLvr/ybGIhGFYokYY4lqeMY5KspkcZxhRiTOErJ+c0KLp1hnDnspT
+C42AeVuK2miIlQY0No4aV/PUNaqAEVDNagghqY1GYCyrGcOuqtCjFM16kEK8//LEL4xYT4FsoAOT
+DKYs6HhEw0ciEixuFiop+MyD6In5wtxFYQtn/ZPS8qDNqJP12Qade7b/LVtGRa3L9BMUzvIozz4y
+St54mjf+n6P/zxueluT/Oc7+BWyITqHJX+Sz/n9CuXX6TQrxU6CfOPoxbTw0X80ZY9EnTvZbMCzl
+/6uumf//0iDylyUyBRKTSUQSojfEAQM9LgBvR6IUEZCQ5IMkGyS4gGjCYVkEeSUhUSMFYgWPJfo8
+4GOKBmYpgKsZLJTzgAEK7HKW2lhT0tzF8sNZ/6RxOpkARbeN68fVtHD4KEtmnK8VI7JNNU6xNf0s
+G1vQ7XFDbKxQhrOdbcu0KPR823rwxVvig3TynaO4hUUyjhrSNWw9IyRaJ8+68TxvHHkViFRMvTMF
+6j5A5k0oco7D9jYZ29wMUzkq9KiLdd8W6Sf8DXEpL85dLCI95xibpjqUgq0oTGG81znGtV3/0b13
+M7TQIC66LhIVLEWq9gnUs5Ugi8bRgwiV8RCWDW1QlzszFldgxhHY4gRM5VDTB9jiAczIo7pEasqk
+rFRqk0s5RjC1GnZMndHdrpPOL7bYG8xNVbKThWP+yDiWyZ+UrUhs4SzoK1pOMU3/ZTOe0CQBqlF0
+IoFJBod1A1J00qITG3I+rZOhNHWVS+FNIoWc/5ODVZ5EkHDUh06jamIB76KCd1Kmx4TkOD9ruNah
+nSUWAUvM1QIKZzl88Csp12IsLht4bRd6rUHWbIB1nimmQzp2muEs4dYFW2y54bFii7WwRlpY4iw4
+xj3E9BwzPcNMzw/D+ctw9hIN1w7drQNQmzPOkfUzZPP0WGPCMQR6UKwfEWcW4jbvoLHN3RLWIP9d
+ddvZdcmUky6ZsjrN/+0B+bcH5N8ekH97QP7tAfm3B+TfHpB/e0D+7QH5twfk3x6Q/7HOdn83+G/Y
+4N8ekP9yT6u/PSD/9oD82wPybw/Ivz0g//aA/NsD8m8PyL89IP/2gPyXeED+e/kZ/l88tUo7nVql
+7fd2ZBi1hyg+mqH4CPQCHnJfnH5MqehHlMYFUBK2p4IWxFEDqnlbHL4vjt4+rVtJFf0mQ3rlk0jV
+o6xx7qFQQ6jAUQuo6QRjGj2LhnOi7veSMy5sInYS3UpiWkgynGHalA2jCOvpYp5m6J5qhkHTfpJB
+TF6c5SQjE+AkQ8SExPEsA10HpZ9nqPhGbA3f68qeZ+CTAZ6qruQCJckw4ZNrlHJ0J3U1lqiyAmPe
+S+t3AJJrSM1LAFXmZi+B3idO7vYy7/fSr73UyP1exuEXvruSo1ssM5usX1LJbrOMKYtxa5dhR0sx
+t3bhHeeMLaf3IhuWM8mwcevbn2OcnlTTxm2AAQYEzmbj1kHB3cZt2rdNp0XZ+D/2Ei0wkMHbLd08
+NTKYVzaSg9msccpKTkwK+oEpxT2BXvWu39eIza2c1U8An2rqXgIpw0sgQ82n+pGGrN/JhneMx5ZS
+ipccvXRUR03FtnMCvVyUWDByDJLqllD9emt6PMnhDUxhtGVPKGXmfmv28jXzCjbT+kmkSupYzFms
+n3RLsZnEzfrJ7q1uBS2Yu8rhjdWvJRX/b9pA7ZYy00qWZu5nQxayPEfdZ5gb2hgCw97PxjIIwhx0
+u5hM7GLELMZZ7GLEKkYIhZtdDJF8dMAt4XMuahkDIEGejelsFpnBC9Q2JjlZx3SFV78QP0cF4TQV
+cp3vhc5bLoYzrobjfC+lN6+lV42MBdZL4izXxHG+N70xd8VN3vRm3vWm2044x5veNEYrc7/pzWYx
+wUKfyM0n9VltJojgcDariWi3m0zumH6Fn36Jn36Nn36Rn3mV38SecVRL0PeMvdPPkkrAsmuy+65x
+lutm2V2bvKHPed8sd/TlFM64oW8hd/RlMpxNl570Dw22d8bucRZ9Ou+kUdv3yhm/9GsX7btlXr5I
+cUzX5SZxjE394L5flssY9R3T98uOZ/53KjrumMOtipY9c7dQWuwfzL2Klj3zxDc/jCM2EIdd+z8e
+bZaWElIWZa6YWws0W5pL18o56Vo5i4egxctJMXQDhFBF6uGk6wWsbqDrBXnMZAoYEbBiwNk0A0aZ
+KRqSji7cEPFGD78hUqyMZViZhirpAiwKwBGQGMthpBGx1R+3r9/xbvRBrBOWAAGBuuRJFJ/042WR
+OWhGn9IoLggNCOtaxOecx/JACssDxCdGMySCDA1ZK9CYBwGLixksIirG5bwilgOJ5FdAC6Lh6+fJ
++gTmYxOcjLpW66yMMjPOvLJUv4nY1Rvf0g/LMc2e9L5k3Y2bM65HpRexStQtnacO6OyVq3nqVc5e
+uyoavuMa04PRB0d9xTN2apHREcj4P7q6GvkCS0ZKGB2NjItRJYpPk3kjFtXef7CVxp4+Uwiemi3j
+RFgyFsJiWCkMLRRroMTJUnewzFGyQ0hOkbmJmhCZvGF1QISFXkQt4auo0UXUeeMiav0aaoFcRE1C
+ulh1UVcU81SsL2DBXr+QW7+Om+iBppsqQecs1vcKHMVoYrkhurquyakUqUVCRfI0a5tA856I5GJ5
+/Bul5pFoUhn2d3biN9J+cvh3HmtBOGsbUoVk46p78pd+Hb7+W0O/aZaxAFK2l4g9QZg4Pwl7QkSz
+XjltCDcOV0Y73hdtl0ZlzkUYdZwiSQphZtJRLFKdVa6zSnZWDco8qYZF4MwkENTgbk8BoUt5IOdZ
+yVhavwzZyCvFUwSGjyk9BZaeayqRY5CaoRBztYJJVg5TOURRzAv/+TxOXWOSFEl/lsEJrhxI1XzN
+eJGoydSRnol/p34hT56g/M6jP9uNIZc86fb+0cV/hLa46PNlZRCq/89/Nyvj0et6KHkOxC4U45I3
+rU6/3dCr8aELjjcSPKPyUIEvrtEK4wuw0eqTFUlkyYXYAq3+AOhs/vEn/HEMH77hq3+EUqGz0PMr
+H6rDtw/XHG63ziVxes3QNhdKqo0m/B9PA+ZtTsJ3JS4r7cZo1MCDvqwGGKYlEzee5cN/cdb03Jc1
+aAeniiBZlxA8pnUmir5HcAnrEj3vjf9otGHhuuNKt9ZAGT7JuyR9GmJ4OB8FaiClA29Kz1EhosAe
+kmkJf+PUoohbvFSMhdDnOw0snLaGIzsATKw1rjQL4Ak8eURSzKJm/n/0a2jI9qVL43S8etpytTKq
+ADYm9b8BLtFfrRrKKFsZ/In/FkJJpddrh6LQlRC6HDSGjcEfjVC58c9RSKu3RpVqq90a/bkOMI7S
+aiWPoB1S12gW598OnVa6n2PY+NBlr4+yxMYcOpMyoeR1owK99Sv1utEmGUCnMvwhXxljGvZ7I1ut
+Srs1JF8BfSGjqfdbCfJVin5T67UH5JttNNiQPB71QteV4agxaP1Xw9Yinkxdn8xPt1f76Y1HIL/0
+9GkAq9PHDYscOmsMv4zWcHrekJmtnbwhGguVD40Gle6wXxk0urU/odVWPTQ0BiEw9SqDUbVXGdRD
+NZQ0njxH1vScax2gmNX2uBGw6ueg0egGrDto0N0Bbg9I71pTYAbgW9VoFMgEzgdOlyzU6f3Z6HYR
+HUnejAYoHbsjhNHM8Y0BAdNRCNFez81sQReVUQMG2ejWoV1SWeIt23kxHvVhv703lOkgH+pX+jCI
+YaszblfMKr7zZzaAxTo+1DQm1tfxr/dHY9BHyD2cnCD7AkBqu9VthIajQe+nQSsjHmogKlt7gOcY
+/wPntA9VK21EHL1HVGu3+jiTdLvxT9jBT5huwCGNgIQ4k4GkPBhUyEfAz5tG+7Aygr0+7dUqbbSn
+Q/ycvutcF2bXGBypbE32cbkCW456tU3uRz4C8g1dwNvDAswK1nto7KCOjZZa91+t2tfloNdstRsn
+DRshtNTUOtVG3V7TuetLtYh6B+hhyatgAqal9s24CuBe7AE0XCOAY4ehb8FN8T6k/bPfG4xC5V6o
+cHPjsvS2v1mMQ00cls9OQ0ql9oPIX7ceOupgkl4ZfdEhIrUHhEwDvpxeKpgETPCvGLoZVUaTeGzU
+vx026DDkIfMyQ9+dmgaSgRjj0HkZxMlh6S+Qvs4qfQSOFgLg+0b5z/4EXZ+sXVbvW/XR12Gj9fk1
+8m/8pl+pYeDqj/4sgEwziX2T75R6KO26DmHtSRR3mEO31h7X0TuIcg4DjAtLlkWcoT7AkGAXDaBM
++U/3sAekGAC+0g78yl1jMGrV9Bf8AF+0gsBN5Q+EBUVAXcxWQmjxel3ERNCuIuso5uupqd7KzvRW
+Zqa30pQLTfVSikJGfqq3JLuQE+Qlkb7ET/WW4IRPfi/x5KWgkwIIMgSy7QDVnQHMhl3GO5VR6Lbb
++qcjCrKV7lvdeu8fQ996Z5WabajMUys7scxfHffbgB4gDZlzUhpfME2dVkdbiI4N1+08gRBfYELN
+XrsODN4Uu2zDNCm1UdmRMlBaE3o4u3Rsp9Dr/zlB6ScQ2IYeMLmGO0i88HzaGa1830vN+J6OJbkp
+3xOdcdL3PcGJZvu85kgz3F5xxhPX2raKuArFKitz3nYk67ZnrC7APLdDDpJWQf6RqexNQefh7PS8
+V284MgLo4Z+ddhcex0GCHbSq45EuRzOy57+6iQW0z9SqfbXa9UHDpozqT9GvkSGqRFe7w/c/KoPh
+NoP4bNU/KoaKh78futTrGmSBjmRo+es/dHW6AMwBFqbdq/0g9dZ/ZfSaCwLMWedVbWGNWAgwNwAO
+QDpC9f3nx9Ze0PbPuRKC50oEmn8L6ZNBAN93V/+TEH3rj8Cojqr+xRCNplcbD0e9zl9Lyf51cLg1
+rCA7DLLrAooFBcd/OV7AWP6NhvJ/AUuHzX/8G3PjvxgNhkji/A/fZTGXSkhSJq+b+w==
+
+
+ 3Ob6Z5Dd1S2lf9lspGwukU3nMn6z+WcgWP2rZ2OoFG7TqPZGwGROG83RxaD12eoGmdXkO3/xlgmJ
+TFpK+e3YFzVS+k/wizFn/nXTSokJKZ3yBcR/IANskFnRiv8GzB9TvZveeFBrKMgoshAC+B+tmvEO
+T9kVG1UGn42Rbi44UoPs9+Q7f7FQe3leElO6kd0XSNDJk2dly2TZ2v/xirov1WaP4QOBgqX+vzlL
+aqHj0HalFswEwdb+ayfG+00MYBTGGmxaZt1/80l1e2fosJwek/pPzFr/L6ZIyyQrQwBq1Jlqkh3b
+FP9ifutPeP/XlFsrU/qrR9Prj1od6ibz7zIm0Jf/6iF0GqNKvTKqzDuO/JzjWNadn4LgHFOZfANy
+c603qDfqBM9YwhJKnvdGlscWtzhBDMlHId1XN1Tp1qmfnM2RyuJ8RV46Rd5C8oC8hB0P7S+ZJ5nk
+jQubd1RQhzLt8sbLi8zqC4kq4/OkAvV+uma9nybrXlC/pxvWFYt3rVY23KOypjcNrUN80ZJ3xE9L
+sfhpWRadVJ921clb/ss+l7vnJLzozSVNep4c1AfDBABltd2or3vXao67Nfcq/WGiLdTwIbh7pX/2
+E71+redTYdjwqVAfu1eodRK6E19v9KUfgDPrbxv08KtSB6Fl6DkzAFPkX9dtDE3oc2zNWssALNsM
+LI5/Eu8yz8HAjoVpl5qf9pou9Wq9LiDuyHQMFDzrEZ9G75qAn4H2otb588dOQicgjJweWKUgW3tI
+dG51Rx67QGCVEhl9J6JAiW67rRoQYNfeK91uz2NdoPMOvE7bu03cJEL3jSoQp8oI8OslenN/cfmy
+HvpD9O4Krwl2UdRJpy2gwevdXrvdwBhuoZkTQx2O2ol6AxpsjzCV1rHAZxXQa7S+yaWCvNOvo5Vp
+dwMPql8P3DiBCeMNRwTtDyyg49Q7qkN7J5XS+VQin3dEY6jK2J1yKSGRz7lVZM1uwBtdamHHnkS7
+0QxYc9SjWJXOiR6jJJUH5ghyYt5jrKQ6sYQGWn/0krmpjhS0Zlst90pfVn9Lt6Z6zeaw4Vvty1Zt
+EltRLWxCcK/z3asCTAxbn10HP1N7RYwYVWr5863IILhnvcqw2hp1Kh40FFUldexE3mfz0IuWzZtc
+o/aAIWluNXRm0O/ZvVLtNQ2f+Wq7UqPUXsw61h7UE70BEpl8Vh5VbAKP+eoN/otihEutfm/YsrTl
+ADm418+EJ6jSOvQ4XXCWG1CtYa3Sbuht+db7w3uOw1q/XfvTnXyROrXu0Avkoc6o1TbCLNzn9wey
+PvX914HW8xh7/7Pz4y8+4lpD5K8cjOyg6oSgM3wywDsA8qPWyEC8hJh2JIWoKvACpAVYKZfzwGFu
+vpOrDXoeOIyr9IH4trpND+EXV0MhHiB4+eAF6RQZa6qVwdBjH80ZAMVkOFCAyiNmSn51Bz603Vqb
+ZUEZ1+qdyuBnaB11gMrGqAPUZUYdoDY7aiccbXZHiXrbm6CSOv1Bszfh42+vNhxXdWx3koWRvtX4
+o9H21FuqLaQLelbpNj4B1v7wGDNUqtkjdVzrAevrGpLt9f/8t5NJwAONQaWwGEhoUCTwlJCs1wqZ
+cUXB7A7YZBHQ7IDrBrM6EEuIn9HBUsvZ5oCreJkc2Ni3bs+MTQu1ujg0DLG+RiATgLPyhcURIE8g
+Ln16SPCo2vCn1Qf23v3xllgGAJqDYQN1PPCuiXQaI/zIuuPHveoREExmvxk7FDXm2AxR/haQSSxv
+dX/awxFolj9CotIegSRDPbmjhT8r3dDvuFIftNadV858l/cRtsyaIhH9SNWUI4tim4U9aXtJ4GzD
+ZPjSVLXFQLUl69J4z5BnZ+i3cEICiZamcSnl3nQNxG+dXvvOrjlo/I7Nw0O/EQPL7U+ebbstBhWK
+Ay0db92W6HmvNQgKVRILVYmsI5dil7Le6A4nosXdmp5myrxtygnBZyyidSx++8U77FcQVE1NtQWp
+IFMVbAvjh6KCDUW9wYxd7yBDFoKtnzTl+knWFfGDQzE4khqgxRL/RMbRVsdOdwrQFafE1imoEW+b
+aPS4MgbGHRBdxYS3DcwCZKYvmN9iBpyokGgNTTurkMj6gYB9yYPAoxhsJBZq4b0UvB1a/ImidY+8
+10+cAMZglCXQREXLkvtRComlFH6VRbaykwZgmaLp2RqAtk2/GFIwKiRMSYXEaeiyZFnr6BkIrN1R
+JShqCoHlM97ST8AZCFNR3WASmjQdJNplEk8wYEiiLnQfdX9C6IYbR3k7bz9/7Fe6uvKZQ7dIMdoM
+yO2hiz4Sw9mIxSi+TwHUtexo0Aj1B0hxq6NfzVa3FZLrvWojdKkWkRGnR162a3Fsu6b2llRaurgv
+3xSOjnJptYHUS/QwtX+x+ry5c7+7tl15iB1Lqxdx5WBQ6nxtfXbDx8VwLLpWaFUSw5XM7aGWWd46
+uC3tnaX2t05f1s4OBuNatqiJZ7mIkEot8/xQ/VY/Y/zKwfZbYuNgJ9YfHgxPxCQXOdg+DQ/0Sscj
+5fPw6vRgJ9W4KbR292pqIrH2OdHVaf0R+suqxchW9qk0Ur9fldRTPCZ3eqdD+ehm9LW5l1keF9XU
+yr3y3V675yJqkz+uOja2ks03s3dXzy9yuZC4c++Urbf1erDzU3w92BomOptqLDIuRkv1JhfBi1X8
+eL8Yq83X+6zSPmg/bDWVr1HhK/skWJbjY1WtCae/Bzv7a/ekHRjysPD2+daDT6u/6lH9KKzEc98r
+8k18uUvG8FCpj7lI/ju6WdNq6ato4Sv1vr0jR6TVTeU89rF5UFi7LRYa4429u+Plr+1arfKDPrU2
+tebpF+lZ4JOV7KC18rHVejuuK+3I/lp8sPkylk9vVn/R+NcPto+/JC6S2b57PZC7tbXO5u7ZdjLb
+edltZbPJYVOSB7UjYfNnSzBarKnHwztYtuxaI3sv8fWtViFZgf0Vznaj8VhDaWcvO2QGj6eRg8LR
+zvK9Fsunh7AvR8+Z5b1sofe2uXNXf94Sq8uvuNm9bgQmtJfZWEZb8py5z1x10TrtKT/rmTgFzbv6
+KS+8Lp+pycrOajG8+TRAvWTQgzfcCq7CRfjq0lEKf97cK+7QTzv32gmpXohpH6Qx8VE8AtB94Df3
+9rSYqO5/7tJ27nd3tuvf5294J40BQ3sXSpr2ApWUY2MAr+YAhOjuNarUSOHv0mFFfcdLrTaG+6nM
+U+a7JpfV7021mTz51SqVtRUlU729yl9GHm7li4JyqTZvWr8Hv69bn1xEST2W38liPmXqT9q7sHmn
+pB7ki6L6ff9eaH1nktvNTuSzWGhuCLCAex/Z7HW9Z/aXu/ntnMgXpxsnRXW9fkLWRl9oAvuw+6N+
+4mpz/67ySya0l8lVDrbLoyW5fDwaT07NtrLMOugb8TAI603dAOZcFEZcRHuqRz7Fj519lS++HEgY
+BHY+dooqQMdGbFPp5d/se2VdWXZj9Y0gkLP/NRzjVYK5sOt0fFqS348FDDE7m/3tj2K0eZKQ+Z3y
+k7i+8rZDBmJdjsz4Ot8oRlf764WvzPWPtnmaKJqQCgjw2EMU5karIwg9AKTqrMLUltcLn1/aMLtd
+u72Ws0/ivX0PLg/bd5a2l0paPFbNO21J/qdxUuAicvmsvgkUZi+vKqePP06jxTWZeqXHbBOQRhN5
+sZQ6m4Sc0WVx/bK9XVTTT+LmXukjzkXMecGsas2ipqazSiZ+cYcJTkI4vIvhTtXkR39D+R7VO0q7
+e9eTy18PK9DEyYbRQF+L9c7F4mo8+yxfN7/W4LXzVWBX0RbgC2mich4rro+SdUzCGRoJb/+WIqXX
+PFms8unnV668unZWeomqCUu96g8io1eZX/7hGUb4sWLyFMB947labz8/HwyWH0YmzcZbArS0W2H2
+pXw8zmu1n99VuljXG4Rkuj4Fmtwu9pqOzwdXh+dyWbxOwALfb+QvV5XHwsePekCejk5Gu8X3dmIk
+34xXWlq1rEVhkvev6slR+MZ4mtQheXRaPIVKJ5i1SCwVPG5tbO7fb75lr5trNQzJonrY2RPfO2sH
+5FPxJH2VTY9HZfFjQ1Logw6viB/huCzEooW8+P7U3+Mi5ovkW7W+IWczG5FbUQtnCuTph5Qv4HbM
+KkLss0NbLJa3r5kOtI0dVdR2Dou4K/wa9GI+RyNjXnRqFveHnpIHeCC4RfV55UDUJEWjf6JWjKFz
+EaH2nFHFopK8JL/IuPVRMKuD/yy+yjfsxPUhmaMhVXCnZEgwdLRik4MXqp/PO+w7V8N9XI80hnZI
+qMU7+0LtYEUWEjvtc/rgeo0ODk8Ijxp9gl7wuHFXlZPYBR0UGorDNs6w+6gr6MVYBNLfez28T+Zq
+Dh5RbFLPWE+mZ/QugRem3v1VyRw67Iu5omazGA7IYqEHeP7MTlu2duJdtPjMkKBnfV8MgDWnybwY
+EJRof3gp8T7rc54TxowhM4Nz2AG0+wH3wFgYUsUGLwSo0ELjvWK6Ilhpm/WCFwuPFcEY+tZslsAq
+hh08KB3mKXQba0cGj4Zsw0obDNnxxRGdTSzB9AnXS2x8nNKBov7IG8bGmk0ZSIEgGegTBQHUNsJp
+E7MoEKMO8FOzA9vGY/JgLqU5zAVgpX210aIaq0ifwjpALwyRdqA15opZiQb+bgL4DAQgu8b04rqX
+JngZ1e0rjzswl80NIC2QnNiV84iDllO/iZYMYkesB1rSMJrZu02dy/lkO8fw69Hp0cXBYBR90Wrj
+5RzSA1b545KQpcJG/v1BuXrhV9Sjo8wvFwEt8bpYfF8PfyFJYkP9jK/vEzmZyu1EJuxYJQ5Lvc/a
+qYsKG1/BsirIlkhatYoYm4zeLCjvDfm6u14o1Ad7L0Utd31oTii7/XRalFPQy9a5oLZAEb7btfTC
+Lx/crUVLII1vnvfqh8vXu9u250q7XZEz98+vW+rxbnjFphlT+fYldmhRnpll2QQtr/yLZ8pFzLmy
+MpxS/VQbG9q1RU+3NlG7vlRS9+K2Lh1nNkAJT2xuV7e+skiwLx4MBl+3qa2z+32ki4EqkUu3Bpn5
+VQnU1Pbm7jhaVNuCwh+nt+BXiQcJVldoqr2F6EYGfOKpEfvCNsDYx/vFD1EqPrLRZSTLdkv9pWpq
+q975+SB7YIqnE4od05i78owg2UV9XqDyzEVc1eeplec4KMrpqoN+9gSQXOV3NtTGYBDjG5e723i3
+Jtfp8EU9UTJrACDrVQz2vLhfWtPBnlk2R40OdDFdp2OGgpSvNIvddDcuKZzfRn4oAjw0LtTST6QB
+esfVDhbn+ebWfc82TOgFaYnbR8Nes9AatjJqM6m0Cl/PhXUY49nHZLMT6hyt8rn0hTo9UZMPh/vw
+4ComrZ7fXxlaUm+Vz/6Mq5f86Um1D4QrLjphFkEGfn/7A2l8Bb6ZLxzR3R8/RuSLvnKopMYKL8Ru
+h4a+/5qAfXmG3Zfz2ydx45EB7shEUd5owDb9pBite8IEUc4ebJ88LgHsf4UNyNpCNg==
+
+
+ rAv5plT/Lu5ouwOg/Ae34TyxJcRWks+70bHYUA7Lq03ywLAM5NqJwSFmI3i908PutRK0Z2Lrs/c9
+Y886QGYUaOUlYUwtC1j59rqxXNS64w8xku/kzLZz2drpsXJ1eXAprj92zpk9uDq/ucMgRx/cf0sE
+BMT4Vq9wpLYfADau4nK5cHurVT4+N2Eu2t3DoQ74pVHpKfnRK0ZPSi208cf8sfZbQOORTOoMbHL3
+STm8aVMbiJiRV9VqqnHjBC/5+F7zgFoVDPxlG7Piryv2MhzQDXvRRfJkGodx9Xiw8eFvkWEGYjed
+KKfvX7qJhWkPeKXSznw+m4hmGjy3jsV41NYsi73x52tjPVNAI66H2uZGpmkyqHj/XXk7uFsZjXT+
+sntS/lWTRSlJDC9QqQwLk0ha7KRnjXxtnFzC60QYfXJpJ24VO9JFNZbZ3BJy4fPi+uPlCPMrui/w
+vJ5kiD4/fLyXr8ubL9pHpj9Cn77ZxgjFJqaTT8KvV5/XjgCemgOWc9N6AGNa7Wp9F9k6K/BOdYuX
+tm9W1eJq8hx/p7Rza+tM98JJtV7U1HUJwPSgrB4Pr2LbzcPq58HWffJeLqufG3L29XOdEVSoDXYv
+sxM9GMTzYxA32veo0qVWLa9tOAw+CWLJKbTzcnajlh4PmurJSVlQ4luNviHcZIgcUV5duSm+L6++
+wSbKaYAxa7fQ6fFYTVzX4wdb598/DHtDe5VZKnYL1LxOvzuN/95sawBoV2O1cLgcYR70di4FvM8c
+/dbgr3gHYVfXPwufn59VWRqFL2HlgRFMTo2tl8rvdF2rAEfGldKlpw+HSnmlnQwnkcRxh0xxaWSg
+SsN0tSUlld761SGHUphJGEKHPps1kJQQ2uxo1eRT3wE6QJgEwN3Z5DOX8sWWdnKwrfQZ6ZBCRCG2
+frD9ensJTcV7kzuQj4KcfDy8fDvYyYSft0s5qWwIwXQbcy2lon3EP9vAZE4S2lvl5lK+bk5AEYKh
+MAa5XHqwfY9PuzL7mYdS4bxwJ7AnVnRkn5EfAIz8EtDk1D4AbPZRbTavRIf1lA524uG+Wrr4uUP0
+NW8FlRf2zAKq7x8Zg4dB7WYkE04Me7kNQABf7vZ/Dnb2+iqQsO2c9lSrPjFjFTPLS4BDjc+D7Ii/
+B2lc/jpLFcPrP8+OlXJf2w8F4bYz3Nw9fjLFs+f8j6yV5Wz++hOYUelbPrlXzmwNAKgsP6NtPwNq
+2bnYS7vO1TJTKuZZ2/kAvUPM8en0DrDIy60ffZsO4wd3Jw8toCCfL7AvO/tSB1moC2wTe78dQLTP
+8MHvfq1h6XRtLOeq/U+DqhJ0zQ7OorlSRNuQmMXfPZEi/NFzaUfHSvM4Ax9bnfPt973Vm93BTuxx
+J5b/elnuqyfHzZ/D3ZeUaIcX8Sraki+f917km3F5TAW1zBWv1Wp7gtL+rv8Yvdzv5uSb9kFSvsh/
+5gpniWdgTNH31CTAPsUQasYwLUXNpuzoI45Hawc7uz9lgP39XGZlKRlBJ4m/lWvEVT+QatPAJnBt
+tHoU1pv9yMsXt4dF+bq3+y6nj7ar+EDQqgCSJdg5VN+VnfWVSA0EQ341s7JclYoF+RUoTLGwv51h
+cFEXgzKMiIWaAEJ5CvuX5T/z34O1B6deUJUuOTXbLXZvrWevOjWRszerx2pT1kCSaL7vTi7W8o+c
+Pnw9ki9Xahfqa+txebKXs6h8k3ov2RrQe9nLrI7km+XCsdw93Pgt7hRrwyCYGhDs8ZkFPfsgJzW1
++/27LfHjdEc9eS1LxWjvSmDpT17uoMOFFSqK0HPdW5Aursbxbqxs6Gy7G4AKw7h6dPSwgk6skkpb
+bey8LclXG8k7dD6zjIQkId2P36rmO4w6c3a4zivtdv+DGDVMsZEui4S009tV9ajTqiIxDuQxVqSl
+LWbwo6LcrjSMTnmAsdORGrv4resa0c/YWNRvoirovaxqtaXMK2BGeICtHUi6sJD67O/h9Sk+Sd1u
+dlZXQSv9zsgnjzddN85+pjbzWgKoc8KJnRJJAWl8L9v32ubF2qbSzr7FvWSKvbNioXmyAj0XE549
+3x/stIvrJrDrUp+l0jM97gfleRKcSyMEpm0Ki9rROUOnMSKtjvsNrJXxx6BJW2wXuFInmusp7YTW
+Vr6/Lw/Uo/rVSD2ORosIp48O7spHFbRXGMY2LOTBT+qBFbPJPf3Bch1AJBUDkHuvFQu1jsCS2ePx
+CJNZRyJbr9fKW+dv1XHx403swPLuSxjYkTQe2X+Sb6r9JjHRiLuN2wmCe1i+LpyrwyfEIZTtkxX1
+RS3Kq8cHO4eFhKXyyzLwZiUHlC+u4jljONc1C50ypoC6NfvydTe5uvuibvXMZSPn9lc7dy3AklRF
+TuR+Pidfe0lmtqoXq3KuNBwRP4/rcqXLRXZK7S7s1k+9zgxK2oiuZ8ZX1w+w3rcxZLfUZH7vuMMA
+lU5Vh1Qhu1zd3D2If+Wgq1ip9JQrvwCHkO/Vz/Qq7L7c+7rYMJUOg0jp9MkgTYSY0Y3Q8B5gdlv4
+et75LcqXB/2ts+G4Z1U0MplfIX8NFKZWqPyoG61kLbsjaQ3tqXmkGSY9XOkGpJSbYvGAH1XkXDyx
+hBSkkn7AfPmULX8cJovqWEZH1t9XwFrWYE+68hmS1deVn+2dOBehJM7W4udBGzHCuukoY2n2aklJ
+rxeTWn1LBf3l4mvH8rS8XDxYa5SNtbuFFQP69JHZ+13/YeyWeJWVtZ1TLfaqhOFt0dwSslg7sfFL
+C17bOFarD41rwLC9w9Lje//DKv+9mFYF68obm0PEPJgkEKniMjpW3leba/ursBK/Cjukq+ioGD2q
+7GRuL+tJDC/FiBD9ROATU4/DTR5o8kT1vpC5+23KhL1HTrNbbm2Pi6tPn1212XvdxFYMR4M0wiHo
+hWBRQSmXxon+m3zytJ4zdx/zAK02XnrLXRxK5bwUO94uvsfutiz9GbhY1npADeOPNkAjtj7czgfo
+9sU1YHC9nHMT/UxJ7v0Okw58XwNCEvsEvXK4sXVcuTszZ4/JrWlVuAIB+6y4VooUD0GsVCsgr+VA
+nCjfryTU483lNNtze7Si1aqxOrJa79PvOkuraOPf1Sb/tGMxu7xmkWbxFh8jBeId2Eh9FRh0vCL3
+5EbRHB5pR4rK20gZUrLdo7Kgvn6+ikROpI2B3HZZB+xr7cB0LdxHg31ZLZ32TfevRHg1f5fJHLc+
+M+X445OoheNK8qtbr6zkP+8HMNrDqNJuKEKhFX5e0zY3ar8qvxLvYityOlzYEEDl6IA++HhbLSEz
+ZESQ/p89wzPS6nio4juGAsQaRZ+P2u0xDuXsDUL9uS558Al+RYO8VIvv1yR29E/v2yH02iCkjFok
+9P2y1255Bcog/1D0SnnQ6pyheEjdhdmr8lmv21N7/+iSS7NxXhK52vOKNPRNZOYYc6L3d4GvBCgO
+eh15MPpHb/BzbYZ3OnlF6+85ZG5xdMzV6ysojFXxCQYNnMXN+VIXva/SoPKnuYb2+4GmW45T8/oJ
+xytn9BfNbGc42RldwHTGcwnbvUG51W6Y7r7eL6B5Wev71WaSxZ209Jw0Livv9NLVuGLuryg6XSNg
+mY075HrvmO1l+5bNEhSrN01DWOE5CWGdmj6QTIuFXreOr0o4qje6o1az1Rj4ryZC5toXAFPDnJu5
+Dy7XKwXO7jjV+GGMMG6a58+X1DmgkTnu6RCIxXkvECjCXO8b1btW4x/+lYFmMxTV7c4COwG+d0he
+51T/klzng14pe0YRGS8ArB+xtxT40EGGqHiwGrpZOO/U0MZvAu49w63OPQM59BfKg0q/3whAKMg8
+Wt2fwNTcOemnD4tBdEj2Cs/QB347bOBtKzN3eTjeJBY8uahTuN4kZjuSWF9ap3hfQGFZZYYjM/fo
+2UlGgPy+XsDmQiVYmPN6HU+qgGNp7KDqfFWbF4l0u9HPGVfJVWlybdCrVkanlT8bgwCwpb/GSJso
+bzSATqHSJ9mjW41g16C58IkAFI8AYXniyubpCGyZubvDG+imlgZsbNl8yVsUsDKOCUlgimFa5A8S
+C/U//+8IHrKqQai+1ujSG2AaONiqvjbuhpqt2hdw6RCrUDS6ZpplM3gqdItuABo2/itUIy0bvcBo
+hr/jRuiP3hgeDP7nv/8A2eO/QvUGCCF1LASgz12Ut70yDrUbRqd12FNLz72xtbF64w9oqNVBuW+h
+vv1VFD4LlBjnPkSojHqEEaIJoDsnYiDeo0Txv+O1I2QXb312Y6iLagsqWPqBdmq9brfSGqL59Ssw
+pwq0ZrAF6LZbgZbqY30AicCspTZo9X2pC4EIRGsro0b5a9ypwmDa3iiKO7gZVUAZHQQAU+M+i6AU
+1UAZ0FXhSyIYFgwV0trjzV0JifXWxLqS+RDerrUm0zHT18qT16Gjdz6bVvoA36ll1fjOqIiBFGeX
+RuliJ3rAyZsJ0Z/sBOWPP2kM7Mm74cmDfneaaB0sUWJG7GVYxjvlBiDzZMpj/OSfo4uumW05ZTaK
+0+2WJ8Js0ci7AGBGR9uTloBtZHzJv2vduh5DiYwI6EtBeFcA27uoX/0ZhzeY/cYxtHFzL63+pPYv
+Pvb4+urNAf5zL3+48m0+kJSclMs8ZTpPO/GPYg/HtTGvHb43CoPBXqVbat99V5WPsytZjnWF1+19
+4S6nLtfHGhdRC4cvr8KGnO2mw4X1q9RQWkFuRdUkn9w8E1M7V1vb0n55pKjNfOkH+bBU1Cb/uGc8
+FTd3rzNf4bV++Tcc+/o+DG/WEpFw7L3+HI6JxZtw9HAIc0FfPCak03x4c2+3H6G9fI2kvf76Th+G
+fNyhQ65cK/TTx/E+nksiOUz/wqeb/kQVmN8wV+yWxWj+cYWLwDoJeBoX5sgGL8PPHPScG2/ulcKr
+qaE4PNObzZWk++3lJvxZasO7j6o+8dPhYLA9fBq8bl9e8MnUTRSPFXcKvZBuS8JL6uHrNObY6eun
+cujaaUb8TobdOq0O3pKb99CLtVva6bmyvnzbb586dTpcfssobp0e7l1lu3e2TlEvuNvU+sPmdu3i
+zKnTwfhjK7oR2Ql/OHXKF/n9HZdOM8srue1mHkOyw1xTjy98saxcOc50qdjfily0zq4dOy0t905t
+nVJ8wd2uHZ+mztwW+HbwUhOPUafrE8tbWrqXIunRGryW6k3s6dYK7D7t9nJtzbarqXK21MadAjZV
+NWunr4PXu+q1S6db7+nb+mfS7JSLMN2+xcvnrp1mk82bNedOd8Lrg+HW5tC508vsG/RC4XdirsO1
+vUfBpdP01/qa0ig5d5paf93c2e4wM8Uh2uauVtLLv5nxmVOnfPHkSnHpNLMcSefS+y6dPr4DJBd7
+5bLjXJdKK7urp42vW8dOS1e5O7flPVyNhxNfpFPt5acIMMYu8NL6cO0ghhd4Y6LTw/dO+nejz0On
+2b6909Oj81fa6WM8apspF8mmE4kns1vLXJ8U/rRzlXXu9GhpnDt9rOUcO71oNw7NTg==
+
+
+ YV+s3Z4kfvsxl06fN/mb09+xc6cn0ttpsbgfduoU9qV81DpynevNWab84dapyt/xb3nnTk/jy+X6
++8Y27pSL2Od697Y7dO30Ltp477t1esbfx/cVp065CHSrbd4f5AYFxwV+ipXfXDv9XiqfKi6dvmT4
+18rHJu4UwZhtrue3rZ+tyHnMsdO3t4d31057jf3op1OnXAR1e8Z/aKeq8wIXb4Wlh9HVkVOng8F5
+fJl2WpXWbUizmd/QJNwpFxEqS6OSlSptDcZSgUedxiY6vdiN/r5pDwfQ6e7A1unmVu8xRjv9yW+Y
+nQJNRt1Gms9LhJWLyqNwZCUQ17x2/lxCncYneep5fKUrbV9Cp4WRfXk17TuBO0X7EtViNlK4Vt+k
+VEla2SqcWElhY3M3d/6MOk1OdpqJLO0+Hh5Cp8dhs1PoBYtTonLxRea6v3WVsC3wd29X+yGd7t+e
+nlqXFzb2+6uHeSqIUJcF9qk46oTFrW6VSheTz8erYane6Ts/Ta0D0uylG25PBwAMZy3zqZVaph4v
+eW3nQiPPJ2SBp13+9EAS8dNJAv+0z59e76ecnmJIfpL50/pJxu3tAn8Wvs+5PdX4i9rRtdvTd/6m
+8DOiKzb5/DnG39wth92eJvjywVnU7Wmavw3/JsynNv4S5gfjcJY+n6RUh/zdbXiXPLWjWer5mL/7
+jO87PcUr9nzK36/kZbe3z/n7jFZwe3rJPy1nX92efvOvD08b+opNPH/J8q/fzZjb0zz/drstuT09
+4N8z73nzqQ3G3gdCYuMk7fJ2JSrkP8Qzl6fVZUFZfSu6rlj1Rji5Wjp2ebvWE85/xJbL0/q68Ph9
+sur8NP3WLW/vjJ7cVkwcXobX1o/P8VNxbS96aH0qhxOHB3vkqZ3yiaN2eCd1/G0+hRUrxDeuWQ0s
+Wi9vKr3hOSF7RD9Lxa4RVVIA7hqKk+pJlct9IXKQHK0ViuX97KP6VHwsq0/aToJD3/LFgpKoFQpK
+8mST1d8+Im00Hon0x/S8LK1hVRBTOaTnPJuUL3mW667xyd2HMcKMZyCOzR1z98+Wk63d6jpg0ZI2
+zF1tXVoI7mBJXNu9jBM2gvQchsqznaa/kJ7Ts3WK9gV3m3p8wN06drpUrCddO8V6jkunINqCnlNh
+5TF2rqnHD49OS/E802l9dXXZ7BRL/0anEu4Ua0l0gZH0v613WmpbFngpynaaulkxOwV9UEi4doql
+f0Yek2xzRdL/i3Onqcdn105heTuirVMuwi4wSP+unSLpv+7WacO909z51YNFHrPOFcsULp3mDpFM
+8e7W6ZVtT7lIsrW8FaMDwJ8opG9N7L5zve0A9YjUdxqoxdT6JalHqIV4mrFahSyIWxyDpr32XDAs
+JJVrBctwhLjoa2ti/IEQuxVixq9nVlmH1UaL2mex6WOzixq4NsZwhSD5crWHhlcw7WOmhYg/Tkci
++Bfa0HtWCKYdXBijUZHuV8RVbLYnLrKXL91ewherEfqr8sBIzNRmpiMuVH5WBe11WGKmawwZhZxG
+6K/YWY+sja6L6eTYnAHAYMGygOzKK8mvhhpBvwAg9/kj7yHhKoS/uAwqpsXIL7qegpM58Aot+dh7
+ybmIufJ0hlivdpzfZdh/fvjXtW3/LBof3kGQk8+cdpDdv/fxhj54otM4za9nbLGk22H8d9Blftub
+AeCTsyyWR2OxeYBdnwsB99JjfzGQxTeFpUdz3RHuz77yRn8+mMMFWCx+jsXqWy1XH4mejfhAz7G+
+pQMD7qYkPUjmh2mUmCYYYz9DetZXMVw6r91jbOQ9Gspf8C+6dthw6rB22std2I1sO2MlUWwcsBK+
+FU5O55xafNk2NWNfLEuNok1XyWmCwyrDdC87/rNaJbMy52IF9zeNbwx/7ufdq77JIQhWSs6QXjpZ
+tcnqlm1SkwEgEC8Lwhf3hXl359J8Y3SbpJBjQDLRT5whuVQdztGYleUL/Qmsq4q/RH+ZG++KyIh0
+5LqT+JRnvAay3lnMoEpRFypYKYqvY+XEmK7LdqJfdOjEDH1l8H3LDK1U0NJYTInSIbHj2nQdF98s
+JJ7p+cvkNC+unKQwry1J/U5syU9ugGeFT9+caW1Q0gOzehi6sSUiMaKrjDxkRnN/S3aqamdLXrvL
+6mJQvV4SKitrhwuQnn7yYRN6LSe8zGLtVqO+IFcvicpT/th5SMZo0C8TX9wHtezKK82t894/KvPD
+iv6seAoWy4H3z0GgoysWYAdti8U3Ku+3QYGBPXt1buy7cTcjZLFWa9qYlaHM1hhpqrn2+7CwFbPK
+dXOuWHMr+rSwFUM0bebGqF1Lt8OM9n5NxRWDMBcRlYc3VzI0jXT8eeiqCnKRCVXCmUEfohOWw4CK
+jV1S0LFSefhZWghWHqIzkBNPGJtQlNddV0da2T45DaQow9pQO8zEeIKrfY5yFKzNe8KPJjMyhdtc
+/IiCZSDO+j4aSnCtxXUgBhUw9ZcZ1kQMOhBmXyaH4o32ds1w69eZQY32hggrXfmdk06OjyWtTkb6
+G3E8JNOcDaP5PgIqUNE8LSS2DlyMGuLrsOtj1OBs5MMNQb6P/MQOryGxWhIMarS8EAJwZCMAbvp+
+EALwfRSUAHA+liTxdbS5Ng3FdhwS5i8ACT6ygh1qqSxvh9r9qDoSNpTvom1+2OdqeqD6CoyQFPdN
+rdy+g3ull9+5FwsvFcxlShT3WCxXBHfglZOLZUXxxCSKd44xirsqadxkBy7WJWlla2lpKluCuXYm
+r+wce+h50ygV+wIxE/hbSPxNsjA1YS3o1Fwpf+dY2r8rn/npw17mDWkl/8vb9EoPA4eb9HQMvdz1
+AkyIizjtFgM7Ntl6ervPvnA8Rv4wLEWfcWHSfrY+uw3ExWJz7GmvcSIFjKWBi9iF6f2ty5FNmJb2
+byMBjInuorSJL/0TqzA9y9rt3woRp9FAL9MywhO7JOwMESwbdMWX/omVEc42td11PDXjTHwKqmQO
+xM783OCci3hA+tZV2Mr5ZptQJBXI1udJAE4muN3ksnCBFsbG6BwXxkuW1fk+Wh0rq3NZnUCy7Br0
+vLxmHsUSSC7At9EA5m5/Ffbhxul0wknj87R5ly4703M7wwLv0Nhs9lanprjI3MiHkEYIRJM9YRXt
+2np0Hog3d399Y17Mwa1sOrWin+9P0U5s+tHYz5JwO/HpbP8ufA83lQgkXQQ7qVhfn5Q3H8rmCYMu
+j9mJRmB7HDTmz264gHoXGpnHoY/zGZ8x+8l9qa+KgU6iGPHTi6KB4pJeJ5B8bvYC324FEOQCULRb
+k6K57UsQinbXC0rR/C3wqLF5KZqhV0JjC6Bowx9pAbiPDuJnoEQTMDbp/TALRUOtMBTEci42bTuJ
+oKNxP3vF7SRd1frkV29zV4ciZ1mAtVqjLdv0OhRijg6TjlIKdfSiqII0no0J2zj6NshG+B/AFuDB
+kSMRYqRxf8ns4c77INeVyDqd70NjU0v17uNCvg+uZ69BycxjP4AuzfmhM9o1061pRqJAd39u0Z60
+4qbMWa09/u3MplBbLCSonaCuR95oSJoykDCg/5gnN6wslTbtvLCydMroNBar9bTc8D6o95GXxod0
+rMVYszAkQ2OLku9ffp14oYMN1hvQhCUfm0swLlZZOlsAF4NW7CdWs7azAA8i3A6/kFkJNn1/Zm6I
+NizuaU+enhtuRWM2boi+cxcDWD/YANwQBvI8CuQ6ZbphwOydTxLRyNwVUstSmgjpdvoGqgLytF+I
+rRo15orbVsofBLvfB4EkXQu8uK9YZjHKJezkXXwKLzUXwvzgabomEGF4dQYaVECImEAuare0MSZR
+eXiM2xjThOfEFGzJ5nP18OjFmIJ4rl1YxvUVdreOuqOXM6gUEo660SzetqixQKzF4ezGGilMG1sU
+ECuPS6tB7MmOZwMTO+nrfMueibsge3Xo5XzLQoTrkEy7JR6Uu2E4sK+qyc/4ZPF9w1mzoHtALmO5
++Cq17yrv+PaVYn7l4K1Y3rvUnGLovCPo7FLfrDF0bBzQZASdeXvDfDF03hF0+LR6ATF03hF0LtGC
+U8fQbXpG0BnRgnPG0Ll0SiPoTGo5XwyddwSdGS04Xwyde6cogs41WnDKGDrvCDrr7s8eQ+cdQWfE
+8c0ZQ+cdQUcsJPPH0HlH0DHnyFFfRfJZdXJ28dLZaByQgw/85eqvt7NL4CEZxgE3TRyknUDhgVYT
+k5vLKSMnu1nyn1Wr/Ou/Tu6W3su18GLWyWpicvJTCrpONkY/6WdmUbj0m1ucw/As7jqB4cmpKcRf
+vIEz8Pw84uYMGcYyQ9dB+cYUOA9pMvLRfpjju+iuQ/K3XHmsk5XWBAqZm/BTCgawb9pUriAu0bXa
+y4Wrwj2VK4iGjcYBLL0BzMZvmrdGywWxV8HUXpb91TB3uzr2hETBbsGcQXyC3dzsxcEtvSjYLfCB
+i83ExMS9agGcQXwPHGBZHFxBTM0ikCLCNmaNZvDUaYjMb2nMFs9QFXs2IcJmLHaC84A0uSqOvfcg
+cIhpZel9iXP0xAoQZGpFvqJ3ACM6F5tCt0dWSHF6w5llxayGQyTrxqxmkhJaGC2AOBHgxKpe8uBs
+ljgw3yiw3GiBcXxvY2+ONE0cn5/stcEarSxDsvjAr+02XINgAojSltA0Lx/4i2uHEE332Cg/H/hp
+4vjczedB98+M47uLz92Y0VTC1pQD3w/emPuJua0pI2rAozGfeJvpVkxY3IrZvf3nWjFpvhWzGn7J
+FZEWV6fPQz9Z3SI2Au67CNiH/kG7OrL7Rsu5RT8FaMKP4GDcFgJEPn4ezq3sGZLSaN8Xu3XZ2SWK
+an/VuwHOv4m9odWLwGOn3VYEcWS/+FnfHbKdjDjxF0OocQ1x80VX38Ww+/PPsBz+obEbXBDPAzSh
+1DTWALsUadEr96PqwCZHiq/Dz9EUaqYrJAPznMpsMUN4HBvLw6ir7hFRwcw7AeSx76PFYDxapVV/
+eSzYOjmZd2xAykUCrdN05h1Xy5VbbJy7pcFjSBMWGUbjCwyXZEjTWGS8I+ymssh4DMk/7tVjnawW
+md2R3SKDQpL8vKCDWWQ6xwEsMn5eatLKVnRlbosMsY0fL8yRr3O8AA8imFoqOr3hwXYm3jme3yKD
+9txmkWFORqYKQ/M5BLdZZBzj948XYZFB0Xk6E/X06PYPNUerEyA4x4MjW4Xl5KSw3D/xjkM1MZpa
+FN2E5ZP57w3b37qK+HmqBFU0pP3brHvoKBeZxqhzMuO9YRZIhsmtLyJ8bMJ1wc5fgsXVTXtv2OS5
+GI6rW0AMZIRxOJnVe/AkYAjJspvd0hZc524E9cVew95GbbCIRq7ZT1LhOx9gCMboHm4Wcl+fbzwc
+N41P3czxcA5nr9DYouPhZvZQnSoezsNDdYHxcPNHpAaJhwscLThXPBxDx5iIuEXHwzE+V+UZQzUc
+0NAeD8dqSVOHagSOh+McI+Ls+zJvPJwByUYMAIqImzoezufUl40Xm5urIPbmOGc2Xg==
+
+
+ LLBPJDTmE05rW0B8F7TzjRaoMfcTnSkivm4CnVh5xyrdBvaE9G8n0LUW3ie8uB2r+jzrrJyF+Oki
+uW5nvIvUUbMoeN8BHCCcwIaE2Gq9t2FHQ+2l4L2AwZwvYBswEjJenTNGVvmEYlA7fyDX5LXfQJjj
+dq2MPcZqOn3RcU8dHBuml8ZRyOAibgPG7cyHhnorFAnnubsDtxNIl/a+6wa3E1y0dxXsCYW5m7hi
+xu+2KS/vBpifzYZF48WCqtSeCjWKQbp2DF+Yjo7dLzIi9X5xEan3i4lIffldSESqsBRfSEQqtLOA
+iFTUyiIiUlE7i4hIRfFrwa6Bdo5es26YqV87nYr6eyzZ0fB9MOHch74zkNDtVvNgaBg0FM7KxVyj
+deYMhbNaR1H82r8iFM7zHviFhcIFOkmcOxSO1SsnHUkWFQrH9DLVNfXThcJxQW4smS0UjhEMsfbq
+KhpWhx762RQ3whOO/Gi/UHi+uLof+02IE6dvAb2qUGO/3sc/jPlYt427GJBRY6MA6logGebRfsnw
+jIcLJIRt8gDH4TYtr9t5ETFPerA8F+bgepsWDMp21/d0cXWUObAx7wq+28OhPzZjePR6JYsyht+E
+QV46Dcdz8ffwxsm2EI6p1/fh2N3bDUoaXg5vlOUM+nSJ6hXC8ZP3NNKSHn6ylB3t9n7YIetnLdZg
+t6hHsNtlkmfXWI86o7k4h2srPTYBqjXYLVpduf5xiTtbf/FKF/cWt/J9W7Cbkrlw6TSzbAmLsge7
+vXlG2JXCaae50lzIpcGj0ak9Fssjc9tO+NUaY2ULAbs6uGY6tQW7bbdvz106TX9tHNxv9N0i7FKP
+j17Bbp+8a6d88fXQPcIu8pO8q7pH2FU8Oi3xW66dDoafx8u2TtkIu/DLcubWbYFjXjM9WrXtKULX
+OO4ef9J3P3c+rnvXpPUulhtB6i1d7IatnpAuNQfj9x82ihzNeUIQ1REX3o1FbezU+y41f5dbmwR7
+udqxu8lb7anEOjpjHE3f1exks5oEyGN14H1Vc5AhkUx5g8WEirnek2P6XC0qk5yTdck1U55PJrmA
+W7e2NJ3PlUdeNN+MIza/vjmTyLHrZGmK1SsDJJELPD/rhcgO98DbHPM95md3D3cdErGOeg3K15ky
+wJAwtfTLHxd8nU5TL05DMjJLOru7zhBN5zRCJiJ1QdF0Liu24Gg6J2nUPRfnrNF0TlObuFVj7mg6
+p1g61/PKmaPppop8nDmajtkmw9o8j9XaOZrOSflgIHlB0XS+XtALiaZz48iLjaYLYrWeP5rOKZYO
+z2Wh0XQevj0LjKabBJ96yTNOfKZoOif+YdyrsLBoOifS6ngqOlc0nWVINJaOsY4uKJrOKZaORHMs
+MprOaf+slt5FRNM5xdK5Zf2bPZpu5hPeqaLpAsRXLiCazimWbv4V88mdM92KBY6mc16xRUfTOR2j
+EMq/yGg6pwa4yKKj6Zxw27SOLiqazimWzuMmCrcmfKLpnBqwUphFRNM5xdLZcz7OH03nFEtnwf2F
+RNM5hd+43ELjuhzTKYC2Gw6tE5o9ms42JF0BnC4i1aoAbg0ngneiqqOIYfW4CxhI55am0jXGyFG6
+OPLLVWlbfvdsZzRbnaN0MVe+OqcEZUHzJvjnq/OKWWPOxY78slYGXqcvO/v2uVHHfWr+eWiZIXn4
+WwZIVRd0SMS7wzsJbdB1ckdmx1vOPNbJN/us45AmKQwMKjMDybTeLiKt5H+Spj6kx77ZNKJJ/6Mg
+ZjDXNHdTeUPNnObOIf5lMtHdVP6IlqnRNHfz2C6Cp7kjUQM+ie7mMMaQNHdz+ycHSnPHBYownDfN
+HcrK5JvoLuBltu5p7uyQHMgLceo0d1PcCwd8YXlGYGD4y8nC4iz6J7bIIrdY0QAB7VtXC4jlOQnk
+i+EX9BjGT+fztUZ7HsSjmfMPpJvbBb9/MskrZ1sY/6i0YIkw0OpkZ8ReYoO1RRRFJxVllJtudkZn
+kZQalXfHVGfTBnal7Lbhmb2hsMy/KG8oHP0/r586inycG/mQ4713ELshjQdoZ9qYWqfoJ2hn7tyu
+pJVJ/JslT+L0iSY98iQuJrCWahbI1hCdCKz9bvicJQUP+/pu8MHiK/0lPNTYhisxc8004eq5d9MN
+tJSsGrlpzfdq96G+mzzSRd9NHcjgGv10MO+9Cigga3EZDG8XmcHwdsYLAmy4f9ebO1E1TrvmFMgw
+bY4h1M70gQyTOSBwO4uI59y03549azseqbUsvqqcPxoCgnjo3zOc8ILsNYmG8N288UQ0E6trjrsp
+A7tcxHnGhyQoGs6Q4c41bzXNcTcn66QZ7uaPfAyS4S5Qpry544n0THlzo6FnhrspM+XNmOHOIcuM
+JcfdVI0xLqBG9ATOcDeZ73UhjhbYScXchtnpGAh3PiHpppjjd+8oaixQLKynmKPb+aGx1NyqC6x2
+wzH2YurIx2kDaw1bn72d+QNr722qtXueRP92gl9S5U4t7z3vhZsuiAndPGl3rpkvvt3BtaaA/S5u
+vRlYQDR8H3jGV04RxkQjwqYNYsIr5hoRVnU3302ltuMV+wrgLhjAGQuN6ycQVgZIwvUwfRCTq175
+Pgh0D513ENNWNIH5rBvfny7GFYbkGcTE3DceMMa1OnHiir/zFAy54DGuykN97AYlPvnoHPO+zedn
+Z50k42s9b4wrNOZ5NZVFhvGLca0Op0/36L5is5onJ3fyPWGLGpghxvXRk+XZop4DDSogRDgzB90C
+b+LvXvqs69gf3YPT4WAgjlZokN5x/hHF9pXRr4PwZi1xjML6Cji2LyGd5lcYHXnVNjz6yRKaNhgK
+kQGLn9Y8bEviVt4lzd3SKhdxDcMbjD8ScRY2rGnudsRP94xzttx6sC+WKLEnr9i/b8G1U77YPL9x
+7ZSLrArH7zW32L+6Vx425Ybp1BqaNlz+ajDxcAgrLQu897vSMeZqi4dbdw/Cg+Xddc84B7tfzPNu
+sX+Z5ZXrjvjmFoT36hUPN0xZ5GRb7F8p9nHn2ulaI5r9cgvCS7h2ykWg29M117kOhrd7YddOwwev
+8bJlTxt5vXv8iW4DF1kvPNU7AWquv407Xd96meXfN+3hwlaPniZYaqa/KNxRNonidl5km9CpW2Si
+nQnWWRwPbOSIPX8xWZ2rndgqrTqcBj2rTm6Ts2Uxu1wrupiYHC0kG64y/7M6nWuV+5BA3LXeozhr
+tFXR+zae4JlZ1ACuVa7mXJvG96xO51rluk5WIXeuqLQNV+Vq2qg0n3wHk/Dk1BS29aHGpvDT8pyf
+Y34Xd+9BrxC3qby0YEiuUZzbvu7oQYdUSDwvBl+23R1bjQi7Se9YK7lanyRXb9pUNmb3nCnaAq6j
+fYzZcz/NHo2kvdx569IRLqgCrC3klOcxPqtLjSXYzdmuNZV9DEUBznRkbfW6QVGA81qWUQyg/cLO
+Cd/RYAsz5ZWN7nYYzdVPK6B9rG+R+g4/hMmznar462fGDUJhKsXF6chVacl7SFzgU29kE5z1siuH
+u6BhsTwuww9gsrPZVH5yfURhrGll7AbGmV29S6bc5njL2XRp2XzlNpyRLVgooM89B1PFWFWnuefA
+PVPckm1IU0rjliFZzZ1egYCUI3uEAlrp/WyhnFhSqpd8s94EDuUcOIXp2DSLKRrzi+5im8Ic2aMx
+3yw6gcaF9gU15g/zQScZIJYneGN+J5dTrZhvPp1pVswjIG0iXNhVOnSPAbScWM2kEQWJATTuIZkp
+CjBoDKCPNO4TBWgujHcM4DT25Nkz6hmQPFMUoGUMHjGAk1nM3NZknox6RqzoTFGADCPwjAGciLJx
+XY55Muphyj9zFKDDhBzDhtx15CBRgA6Sya3TrJA8Zgs8+Bck5TMzsv0rk/J5WeEWl5TP1Qq30KR8
+XGCi4RNL6CmeTJ4k/iuS8lnzJf2rkvIFuEttAUn5fHzgF5SUD+evVEdzJOWzDqnhiL2EJh+Q8fiF
+Bnvk9fPWcgPcDRUor59/JNci8vqRSK7F3Q3lnNdvSm/bGfP6eWf1m+luKIe8ft4TcrbBTp/Xz3Gb
+FnI3FJvXz9vNxNdzOGBeP29fKYZazpXXz1NgP1lEfjGU18/PphRUwffO6+ftz2TxtVZmz+tnnZo9
+kdsMdkvHvH7e8OmUnWGWvH5OUXcL8FC15fXzRlyv+MqFJP8wYhIXFn7kmtXPP39lsLx+3lgXPCpt
+nvQAtlwDM+f1cxqXye3miOaovAdKzBUgH1/gWGDvrH4LysfnE/wZOB+fT14/71ZozMjcef2sQ7JH
+5zlTy+nz+hmY45jVz34H0ax5/bzDU4h9bP68fgzvclhKfV/mzevnndVPjxiaN6+fGSrlJLrPEJXm
+M2cnOcJZtpw+r593Vr8F4D7O6xfktHr+vH7erZj5+OaPe3DP6jd9Pr5ZknPbozkm8/rNHvdg3szs
+fEf39HEP3ln93PWX6fL6zR+VFiSvn7c4b0QMzZnXzzouu7Y4gzTumNdveml8lrx+Lq3c9ebWXtm8
+ft6tBMjHNwsa2lrBMOZjAQsaTOKe1W+mG3Uc8vptemb1mzwZ8Qy2cM3rN3VU2qLSFzNZ/dwi66fN
+6+ctM/ne2hQwr1+gfHwB4nCD5NFzs2ZNm49vNgvmRD6+ue+0csjqJ1o1vtnz+jmcKgW4O33avH7e
+di3dAj9vXj+nmCcHLjZnXj/bJG1qu8M9VzPl9fNW27kF5fXzPs1kVmyuvH6WnZzI6uelV7oQLse8
+frN6D06X189bMCRa0vx5/bwEw+oQ+fQuIq/fnmdWP6xZLCCvn/eJDZbGF5DXz/PADEXXLiSv355n
+Vj/rWdLsef3cLJ1uN7fMltfPfUjILd812+/0SV8bE+eM+Dubn5J1yIQz+Fxiyjdvt5J20y58Z0dm
+q48ibtbN8d4WtmiBp77NhgWbc1kw9UHrvnxsdtlFwGECRghUZalboOupN0Zfe28UBoO969ZBcrRz
+LAu5+xtxbW9JxVVQNBWK5SlfVgbhyMvmahiZgsJrb4df4cTut7y5vfeb39zZvn7cLLd+erymfSd5
+7Tu+xRdPrlS+2Gud8qWrfJw/PTp/5087zU/+ot344m/OpDxfPmrd8bfDryZ/x48QVt697Y75+/hd
+lH+K3a7zr9WlC/7t7aHJv19LI/5DeljjP86iV4PBQEsOhi+97cFY6N4Nxu+56HAtu4oEgusRiuxc
+i7fqhxeH5/nmwd3r02d4YzXycLmS226D1Be5vCkdr379RJaW8snz6HK7FjlK5Vcvqt8P6s6GHgoY
+Hsf6qfMPvCUk7E0ulssRfqVRh+8ue44UhO7LKVBLGMVwiAJKT8Nx5THFpICkeQS3FJfF2krBcox/
++Y+dt/XB4Dy+6TpT1Etq/WFzR1o74IvKicIXm7VjvnRx3hkuv2WqKHY1TPvb+9U2d3Pnz3yy+B5G
+MYlXvHaXfcdp/vjkRSNmwyYTffS4VxbQoh3T3spMzeQ+xkqg3VgNr7fae+F49+olvA==
+
+
+ WYtfhTefogfhFTV3gQJwj9GvbS4Sjsvp9XA8uXYejudi7ySfJvx5h56r4Y3fZZh15TdHoZsk0hQ3
+EQVdETYKwnahVUkKaH7vB9un4QHepqImnuXg001fiH1+7mEKc/eLFXw++bOUwG9LK/nOiOejiST+
+E5HHKP303diANw7XSX/Ntd9N9Ocm/XMrGkd/xumfpynSANIsbrdGWu3nN88n00e83OmdDuWT+/tX
+oAejPB3oXnbdfMDOYG93k3lQWSns6g8KcfMB4i9Pt/v6o6Ok+QiksE9Zf3AhGA/eYOsibT5Z2t0w
+v2N7LhVizAPUMxfRHx0lYL1jG8DUXjahneV18XX4PYYH1wL+U9q/DcOflwdm2+9YWITvijFUZQOk
+7YaC6QoiiTmgqqc5IEwXAwRjlxdJZGWOYRYMf97iZjfI5iQvn6Xk2c2PBG+XYfmXd5bR003oINHh
+k4+n5sJ86L18wMZnnuJqsrKzuvXZXbvlIsUdLfVtkk9KXEsPV6wKq+uxOh8+zevEc6JFp/aIddSn
+RZ3C4hbXj3NX+VypeLDWKKtHdZqmEmb1IOjwWxY31VhkXIweHh2J6+33ZS5CweuxkjKmXmHBq3oR
+R0sUg0XNduHP2yQF++oDL1RPj9bh07NApN9k9U3cyx+JsFfVioQ/GVaF/6+9a/9rG1f2f0H+B7eF
+NoHEsWRZsqClkPDcUt4U6AMakhSyhYSGcLp7fzh/+52RZFlOQknS7mHvubv9bOuM5ZFGmsd3Ropj
+YmDVDXqgRa4DsFY5rgP4qBwA2D788xqN/bcnxW8327rRUAfQ/0u65ecoZN5kFuCsjUDbzRllixB2
+92fUPKDtr95d4bvM8Xc+o0CxCF8frdRWzwof3qDZ+2jOef2Tm83br3jYeX3GWDd5WqbLpQ+zYNGv
+ism6oO0DcABa1UegcpxUR+GvgkHM0Wp5eJkEPEOiKljtSEoeYLMsr6QKGvn8XGLHc0qMPFk5nXtp
+rXJhUVkWoou9b/Bx1U+9AEh6/rVy9bS9Soo31WD5t5edYNAfQBKuFxGcAgFksABSbc0az+/iNYVX
+EMumi7zw6iY9+KkUO+qv1vXbWoI9FLCYfbW/0kA0Pt1e7nZf1bO/DIuw5OUbnUqp5rR6cM5SKKZo
++EO/bxMGn6f7Gdyd73yDMBjfmd9HfvL8Pf3NidiK9uTVyXUCHW4PM69CQP1lJzuKhWEQdVZd3Wf7
++rvxygeqk5BbFMv0qBjrs3jlW1rZ0kD5ivuwYL18V9sxRJ/3drKeW5kvZ6ZfPvnsvJ8AVTw3bX/N
++SO4JrYGt4jfF6CNQKxw6sCAl8u3+wkCUK9CkM+G/K6x/s1Zsy63T1cb5dnh7zlY/qo3JOyPQNs3
+HnzIvlBixhHoQzc8TwSaI30Iln0bPu6+d1v0Fr7pNb/7vBjOpj/ADJPVSQeHBuCbtzcoFvYtEPhC
+BvnUiF7ffov+4unA6yFm3/r3jFt1qoBhdFnIv/7wSS0D4LGBhVi8+7mF0K9e1Qw+KgZGkwF0X+9Z
+Fsc/YqFeGznmGPrePPnxW98oxh3DWXcYA1yXkVmolxxNMpXJe60X1i7vWQ0YQ0b7P94zY31quHPm
+qKt6c8u9HJt28OplK6YdAP+XO5l2nSf3jlAJqTH/D023+9R2de10tf72pJ5JDz9azTr56A7p03r/
+e0d3rjMf99t9uXbm49WTzGjeZRrvnHQyZxUWds4zb8rZucww2/l6l2TBGJZ7r2cxyPA+Rxk0e4ux
+8gJpZEvhElbhpq4/qhgPYfIk0rigcnymQmfJxOvo4y1+LCdIYv2Fvcor4ICAYCYLCBQ+KKqP+vyY
+wg++fbA8u/LueB3H8zF8/e6mkgRtlncygmyMd4A/Bvo0zKsbuWkd2V+83lxIbmVD/t3pYnJj08k7
+3O7X5goqWLk9ry2mKccp1vrSvtdWU2x9qr4BC7TNssFZa9sBgqlZA9PXDqlC7S4Q3anOKmBvgOjO
+RslWerHIpMPozqav0f+LV8dgKjt7AXpvAn818OOxZhu+PmjrnI0WpvyCAbQnG2olZ91M5mTbN72E
+lTiM55unhS/VS766XbmKn8UOQFFLi9BWM+vfUU42gYHjXllxHMYv862B0TkeBilHfvhqrrp0+Hz+
+c/VSvLlZOlhqH+lUofJh5lRpL2R8hfpxK8luD0KrXp/d9T3fLDoZgU6Qzvd8nQysfFwu6Kva03c6
+QUghMiSU+OYWhHknoEovN/RoMdSlwF9BHpN1L8UvlColGr/TMWpx/HU2MbPTW51pt57uPLeZ9q3N
+XyJfl65NqhixgjprBANdxI9zswkoBUOz1gRPvAu0rWHxHQ+C+wpAk7VT/702vYr9NZNsyXY9UOVZ
+u4n6PLnxJq8smRSD9udkjt/MGFp1+tzSioZ2SNDe3/jgx6y3IcWLV+UEam8GQXT+Bne53hCnyVrl
+GwdVudhGqA0dnHTU4hT0a4rSOkzn3ws5IST1YgZ/lffurprd7W7rotX2irn5XHlpg5DDdqOz2m02
+D5p/9JY79bvrZrvnzXnlpf3qxkYcLTfrnUbTK2Z+ltIprWZKgVoP3/Pr9y9Ln1c74igMGoOFwlp7
+7erd7+eVz293l5aKbfJp/jV5Fy8/a9yt5KaXq+sfPylDH1LqVfYxDzbcqyx/kWtf15/tvaotfwlO
+FhzrUSD7xc3BNyyerePb2KYxE/zwpEhX95/k129BFiSc6JClU5BsQRXLPWn1tW+3UWUNC3x6f3pV
+Tu01qp9+e7Y+K6ObnaX18HJ38cvBzfzKUeUtJKWLXw4Ptr7uPjt6sbTO69uzksv3y+9Xm8dK1uqn
+jc8tVU3KmkaezH4V+Bauk9NEYd6204pIarIQ3a58tdX9rJjEoJOucWm9PKrWWc+YExhJckXyWIbJ
+G2caCWW5+F7ijRuVmaqPYB8fuiopTY6EYhZqk9bA1dcXl7Ze9qbg3pC9mr0x697YnK3bG6VMoC2e
+iqa9VXafuale2Bt9tjCjzcChHeatsW0V3RsXDNJFe8tXrhb8w2Kg/dF6aRWB+RbRBrr+eg8/7rq8
+zy9mcWZ3jQ3Xp8Sc8dqQxutKeb30iih72S2rRIjUX2/gtO0atvXdQ8U2dMpQ62fdaROXSgyLggcl
+t2DzenHe6v5e5cq/mFnaqX/ZBHt5s/FkP1VOtbTWPQ04r8Q1VGhhffXlMI7D+JnDmg9x3N18ldpn
+1NuZaq59eh9fLO3fTbVW3jd20N8ekFR/Xaxxchrmpm2tijmiL78WVlmOdKGULu9WMaM8KidqfwS8
+zz/hed0jkoSSI1VN6uBVqK8yR6kyJeq0QJ04AGuV4zqA5bvaPIRA5QIqhavuzmK5x9crK/Rg+R4H
+YH3NuLFRbRAOj46/MDbqHycbGh1/YWxMrXIgOv7C2Jj90uyDhUml2AMHLwdsbcsJPFMrp5HaINTF
+oN2BYhC9LbnFoHr8ZqCa1MvfWgY7g9WkmTWfrS9dp2Wvzsxg2av01il75eVJmCl78WdPpitTy311
+s0T3ISHSJVGVloCyzJfC5/MfCMSI5SKqgN6VVTRUFl/TPt2ehSoNSuz4rJfZd3z2Ik2C+wopSUni
+R6WUF2OVUgYLKbNtuy4/TqFPiu1RClf4In+3gGAE+tj/AtbZe0tXmeGJ7igVA/2teBicKhUBi7R0
+tXg0U4O1ml3Vr3lFf2Hn5Kr/RzQHx33qVrSuDrfUMqTFAkeg8k8uRMEt5mF1EnQsW598sDpZuG9S
+fzCGvkJhofjjGunDYygNY6DWZWQW45UHUwbpK58KwT0sMq+iXf9cHFENi8605KZ/yNEOHmxD7BW2
+kvfRXgTZduT+ETrF6B9pTJGmXWk9112tvalm2pVnnCG1w/mdZEjX1Ky+2oAAx714q6Gafa+r9k8L
+a0d648QJKE4lY7vZNoH1+GuJnq03irh1VdK4DbeFNBr3zcbQ4VMVel4k+zZwhQfpVBzWoNvGYQ26
+9R5MtFjSHz/dNjUaD6devvys95i+nC5eOLHSHWhfaHVuZHNP58YhadgbfXH2i9OLC/dLUxuXFkDr
+bW2ytvnUIv0tF+lDXLDgbavk3riZQ8XdKtvjrdFWoMHyOt/E5d7SO3Tk/HTa8t6d1U3Obwga327J
++qQp+mIhjyfCdn0DuXkVuewGymWCh6mvbyuCYVt//4Ek1Z/VWbszrLEHLfA5OzEHvu4lKEzFAb3a
+n14pygKkZsG7qQwqyF/rg0F7BpQOfGXRntE5KI/KcRi/3DCOgcORlJ/dvpw9nO/yhUO2tSQ+NfIG
+ob/ff5Js+n6g6X53ql60cNf4qgRX+ctR0QXi66/Q4o98g8HfbxCt+Mv1bVMSXb46pObq7sOpwlZ0
+pVA7S45AbYq+wmvyVUNIdvWBCbCIJWWBM4la7N+YJmBoSYLL8mmCa3PSF3pXp/l7Ux2xKOhNWDxx
+oWTBMxcGC4KhLT75ZOypqtDMTlGVq8qt456vcWurODervEU4Nb/y27AvioSv32290TqkvwJqvvaR
+bxwaLN93QEMl3H1nM1TWvVAt6U3Y7HkMi2/BMsS79ernr0uQvfZVYlFZ3qq5BecS6yXBBDjWIFjD
+2KV/L+Tmc9NY7zlbaTfcWk9uehoo+83e3Q02iM4qzYtWe7P2Z7ObI57+E8Af/FtIj9DYo1EEHyKk
+bp7n8tXa1be7pkcK3iY487PyUre33Kr3Wp12rfunN4ek47ebhxvL3pxnGp9B43kvD+MJzqA53Ctg
+iemMeOVKp3OFd/ZXj7yVP2463Z6nBuO9a922zq+a3kHHq+7vP9zebQeyn+UCbwn+P/6eu8sdPjjO
+sz/C6tl57bYJFytnD4x2/93aWbXbrPWajcqfG9c4iGZXt0GWW1hBU/z7+gOmf1xfteF2qdbrdVvn
+d73mrXluqdutpaO6l8Uv4O+0ql+2rhrdZlu3oV55o91L7+JfvT9vmvpu/kvt6hauy4ftFtYI96GD
+9kW29b9qV3dJ89vLzveLbqvx4yfatWvzAAwrfeQXTeWkoj77ov4bXdib2kWz3rnqdMeQ1nnmkcVl
+go4uaqv99bZeu2nOfW+1G53vpT/GEHnIs48sOpr8GLKPo81/Bz3m6r/RBTzvdBvN7rianHnqkUWm
+zOeU8iicQKPrf06iy/jUIwst/VhKBn8mEPp/Op3rScTWzz32ak8gMPrd28sa+J9JxHaffmzhI19I
+yTmZRNUnctv1x3fYve7dOA47GTnCitL5eWcisZ2HH1l6LqPJI/Vls3Vx2fuJcJ0weORJuHlgEYfO
+QcPkP6W7dqt3O8kk9HN45FkQIphcFb63Gr3Ln9AE8/wjT8GYGYkVAvOMn4sC/RweeSICnwgaMRmM
+EQ81aOvc1Oqt3ji4p++5R5d8EivApRtf8uGPP/IEEC4mdwMTSZ8++8iiX2HdZyLwc9ftoiNXDCbC
+QVkGxZ8XlfxQVK/8YLWl02jdwP9zOODGv1pNdGsPCVT8K0eERbKDy9btylUTo+YIww==
+
+
+ GXzE1vKkly94x0e5uxzxlm5ygbcN/+/lAp+FJBShF/g8jKhkWLb0GcVrvNC0wKcihoZwEWjKMVYG
+dZ0z8I7/hA+/wcXvHvEl9757zHvrffgUeA2sH+7lWBD7PKCRB335LIq4dw007ocxF0AjPpE89pAS
+RxG0CoQPg6JAkT6PAgYU5oeSEK+eY4T6jMUUaMTnDGiMcD+C9opCmeBAiX0Rhvhc6EcBD/E5Gvgy
+ogRogPp5BM8BhcWqFaR/lMIIiPB5zDiMifqRCGLVH/PjOMZxRn5IhIRWATQPqaIIwpg3KF89VzmH
+mc4ftpU6eRfdWqOFBwUJmFtg6sOlAB4PWczUVRDwIHKu7E0ioxgkDKgXB4wgf+JVLnIlGAYJCfek
+L1kMS4iEOBQxXBBYJwECMp9AUqsEDCg0Ob7OlSIBchPCqRdxmDlYAjr4KAexfMpBklKEyxGHMvYq
+9Yk6rYzaKU51QAROf+xLwQn2eJ6jXqWSG15+dj975a1Ob69Zx+jaUIqv59fOqf3XkIfNa3mvWbt6
+WwM7+wNtNF9d2lgzS3fwpdO91resvS01OufNs6UNiWXu/d6fV82zdEg2wArBQTEc+61UluoAhfc6
+vRq2dcwUNw+OG6g89AHlSTcZAtSGACeJGyMHU4HFkxl7CyVcxhFL7Q0pAeE8tbdQgqVTKlx7C2OB
+/iBO7S2MQz+M1AobewtjYBmijaT2BgvrSyJlam+hkGDxqpWxtzCmPolF5NpbGDNfKqtM7C2MQZFY
+HKf2NijfSPY2xNwGra0EfgP0koPEGXPrV3ytvJFRXvRjAkZHCTWKDzMN1hYJiU5GhqD3cQTOUYrB
+J0sRar7gMUFrExx6YCHq/gR9VkbsM4Q7cRQaU2M/a2p9lpY1tKFT+t9haYEOpniT6khIIBIS7/cc
+RiVGI7Qb6sP/FGOeosFyUEl9SVXMi2FhIo/GqOywZKGUMD/g+jRFMK+aQ7MM4iChQXM0HCZA7xWj
+QFJDCYTqjsacK1NyaTKI+lrBumcpaphV/RzHoYO2gFZqx6DMBE0wCJQJwjhDaSgkUCEWhSGcGVqk
+QzOjRGpO4G+97LRQE2JdGmF9jUhAvMHZVBYfmEWqXA43fsjmQCVJQAOBcIYQSpjAJ5T/0RoKjgVZ
+lPQlhCgKQmB4YFEMUiOwQPMPAYmAKSpVMNcgPrgqomEGhDyO1vdDI0q3S29qvUvAEGL4RunfdQez
+1q3fA0OHQmn95MOwte+BR86KAMtxGoAXHUdUdEJjCNp9/OQvJGgPXMbjiKmq3qOL+Tcod0+2muOJ
+2X18MQnE/yDmlIy1muMpbbJP98iZ+q/Ki4UZB97cv6zdNA9S7/Mg2hkhavx6hNMHXJzoNxTDPBj9
+foxsUvxDdL4PLCAlhNSbJGk/gIgQkIL3XaXJISaJGbgDNAaoj0pI7ISEMA6ZBheQAlDMKhRuSfEO
+UgCRVnX6ElKmaNAAUQrzIw4JtuLEI0OJVPLi4B2XJgdaabzjUCzeQRqmPQCT4d9YJxgELyAx4QCw
+XLyDFBbDc0oaAJyGJnUGGyI+Q0YMKwOZaSFcmoqCQxtopOBO/2zWc7cjYQpIztg/mOIfTPEPpvjb
+reY/mOL/NaYwwTspvoOhCI7h2JeSBxBqdHVdUkwyfY0uBqrsPqUiVOEWC20IMrAAIJggqqJuaQQW
+jkoIt9QPWAhxVPpRzJEALDDkWApETRn7DAt1lhZKLEFBcLaMHIrpDp+zNAbZLxb4LCdoxUjkdGcI
+WCMwQ7JN7KANl0HRRkr1g3sLNhibsdqo8FrywRkage64m7vfwR+7oQGTjXl+TDlKyrEgF6tyKvfj
+mCC2MZAGpSeCovTSp0Go50MytX0RAI5REAXuCU71XkUE0qmBgCvhqk4aY0kOKfBErCki0tOGgIJm
+G8VhLF1GBNxSQJ3ecLJV1cQOCSdXEO4MG8bnC8FYKhw+ZwUGZBTjHksAN8ETACUEZISFHGgT0kir
+BMFNE3wOmgN2UpNKeKQUMBKKgCVJxDqJcJoiQqOBAFKjtBXOrqo3JYxwCaiImNtbiBoTRlE6JqQI
+3cqMe3DpqiMoU3yvLnGfx5wIrUvJB6VLUqJMoAJxIFCXvmg4faj6ArzO7QYcmj8FGw8NazBstVAh
+5UoUwYhCz7CeSlVQZJBY90MCJTBQYlhibBOEMVEUqm0FaRIrejh3POBMLTrlnCuKylKQIkPDyexz
+4drJWA/BPAYgVKs48+PIMGKR0oIIjNV0B0uMmzZ6hoVQrQLNieGOAfcGxbu3Xh9ltsdgsCH+G+Ew
+kn8NmUjQLNASyAo4bi0oI8J9MXAwnOC+mc8EeBSvBEoBiYXEBYuEMDuNlKsRYn0cNAc3xjgXgfZo
+TAjQMoJ9DjwLMyt0blBiTIDImP/gztgk3VZG7hYXg6pFhTQJfQp0aVRswq2xsef2L6jYRwikqOAj
+VeyDH1bso1G3xsBEudBazsF/XisSbjgpW4BpV3bGJNNWFZNIV7shSdX2opy89lo8DKSOICE6Z1ib
+MNQhRWk5ujHVCT7Gw0iYsKliKo4gCqluRUms7UzEVDMiuBml7IyyOHGS2pVykwJDqwh3BdDZaUKf
+bKNYWZ8iZPWgBB5TgKrCCDI2RvEK3AbqOs6PUleISlpdY+2Jw1BoCWIJngYsDE/S+xzcANgN8CJy
+8LkSODzM58FI0LxCn1C1EzZBh5WROsTJh2cjZVghbkv/nGGNP53/FWZ1aA+YpFd9FaSaOXAiInCB
++sCJAbsRni3BUyZ4hyIkhiAKN/HcCf6rLhAuRwOIWJ83yaEpAKjQkAnAI1VmbWlg1xgtFTxQOAHR
+FG67YZ0njoVIKVhFQs9HIqdVzHF3ljucUorpD5+ztBigpRReyomAQ2FR7PSXUDSM0aNKW9mRJ5wG
+5MPdWoVNQaECmJuM5CkNHEIg9RY6kSJUfcBUsuxIFEWPBMt7TiMUKeIOo5SSCp7SKG75M88yQpBK
+VEbhzHOsy2DpmGyrdNwJowHpRsoFXO8mKTP6Am4BvCWnAGagV0DRvqBC7e0jhWONFFEdYBYYFddj
+xid033p376c8w4ND+YsqxsHIFePRjB3tMUrBKy4SBT1XE0VDKo0KGpoAAK7OiEhwtAFXRxUkVaVf
+8OoxSwnGFgRnbiPIMjkWYC2jlGK6M7moplHlVzyHE1NHO5zuDEGroBlT0igdd8JoQLpRVJCNr4KB
+BGenVRDAOcNSfTpkjrMh/vs1kI167OKXRxJoKgkLhYomDPFTNpgkJIbnZ7g6PGWORVE8WuN61IRS
+Vyc3wohFTiv0eoFkDqeU4sQSS4OVl+gAU07giiXN+FRDqeecUdlWycAtoz7hRlHncFx1RiQtRWRr
+LkIodR7iUX/q0NFj6fPIe3Dh6B7VKQfoohNk71iwyGihpTFAxoFWw5BL7a+kDPQkg6LLlKLVECAw
+d1qh5wtC4XBKKRk1NDTQnkBoNTScYjyzyd3+DEWroRmV08qM3HLql+/ebIXeO4mQH0gGblupGZ4S
+5IiR7KhJoHuH3ANQONPUTNsSqGmUNgTsPyLLyr0s0WkzGWeYGqf9H0TEqggTRRlc6NAMjlVFPHWU
+KcG6eIZLlbAcRMzw0GDApNOKhLidKh1OKcUup0MzODbllGDdtL8UEaejSlvZkSecBuRLEDH2OiA5
+cZ5XQFYd4hZYIUzAbmYkBhHjSMyhWdsq1LW+lFNKSSVPaQbJppwStJuZ6TjZGk5GZVsRZ800pwH5
+xsTEpUG/SSLQOIAa0KHrxUvoTQVlDjA2KyZE0v9P4+IRh/PYyGQybIzfVlClUwcbOzQDaXHZuVCJ
+qYG9eLRAxiwDjlGFlJ+1bcBXaXiY8EkpFqs6NINoLR+DeZ2+LDJ2RpS0Sked8BmQbUxkPJYiBnCb
+WXgMgJ+bgdNfho//j2ji3wIjKx8tcWfGjS+WZrAtVrw5C3iKfx2vZ1Eyfs1HEANZdCuCX9ZRSVfC
+KaU48cXSDLh1OBn86/RnUbIzKtvKjtxy6pdvTJw8hnIrsCyFA5aT8NDvZn/uyzCPqNz/AcCMEwbA
+jWc10tIMzFVrr6tOBgqriWbEAcdaI6M4dkA06prgGU4pJaORhmZgrsPJQGGnPwuYnVE5rczILad+
++UYBzKVkFgkncezj/pyazRLiXC7iLHZNx+9A55KQ8CTHSnymcYy7IqEQGaQ7Kt/K/XzRrYNvYsMQ
+9ESaP2wK/nInPky5709ksp570i9l1rJfRcE9QxmqTUPw3JzoQyIJLUbfFzC1OavCOMVvw0nm7mcn
+lLqqpgsGSmdpuLXOBe5/JZxSStJfPefQKNgNJgMpJ9xUE8ztz1D0trIZlW1lpTGcBuVDPUk3IDYr
++gV9K+2GesNdqYS/RVq7aB50a62rZjd3cVv7V9Ortdu4K9LEL6XDWjVve51u00teUACPJM2np1e2
+V3P/C7HLWtI=
+
+</i:pgf>
+</svg:svg> \ No newline at end of file
diff --git a/docs/zeroconf-stack-de.dia b/docs/zeroconf-stack-de.dia
new file mode 100644
index 0000000..988c57c
--- /dev/null
+++ b/docs/zeroconf-stack-de.dia
@@ -0,0 +1,563 @@
+<?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="Standard - Box" version="0" id="O0">
+ <dia:attribute name="obj_pos">
+ <dia:point val="20,2"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="19.95,1.95;29.05,15.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="20,2"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="9"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="13"/>
+ </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:object>
+ <dia:object type="Standard - Box" version="0" id="O1">
+ <dia:attribute name="obj_pos">
+ <dia:point val="4,2"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="3.95,1.95;19.05,15.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="4,2"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="15"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="13"/>
+ </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:object>
+ <dia:object type="Flowchart - Box" version="0" id="O2">
+ <dia:attribute name="obj_pos">
+ <dia:point val="5,8"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="4.95,7.95;19.05,11.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="5,8"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </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>#Namensauflösung
+ohne zentrale Instanz#</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,9.25"/>
+ </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="5,11"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="4.95,10.95;19.05,14.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="5,11"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </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>#Automatische Addressenvergabe
+für IPv4 ohne zentrale Instanz#</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,12.25"/>
+ </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="5,5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="4.95,4.95;19.05,8.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="5,5"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="14"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </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>#Suche und Registrierung von
+Netzwerkdiensten ohne zentrale Instanz#</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,6.25"/>
+ </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 - Text" version="0" id="O5">
+ <dia:attribute name="obj_pos">
+ <dia:point val="5,4"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="5,3.4325;12.8675,4.435"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#ZeroConf-Stack: Theorie ...#</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="5,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="Flowchart - Box" version="0" id="O6">
+ <dia:attribute name="obj_pos">
+ <dia:point val="20,8"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="19.95,7.95;28.05,11.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="20,8"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="8"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </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="monospace" style="80" name="Courier"/>
+ </dia:attribute>
+ <dia:attribute name="height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="pos">
+ <dia:point val="24,9.65"/>
+ </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="20,11"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="19.95,10.95;28.05,14.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="20,11"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="8"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </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>#zeroconf#</dia:string>
+ </dia:attribute>
+ <dia:attribute name="font">
+ <dia:font family="monospace" style="80" name="Courier"/>
+ </dia:attribute>
+ <dia:attribute name="height">
+ <dia:real val="0.80000000000000004"/>
+ </dia:attribute>
+ <dia:attribute name="pos">
+ <dia:point val="24,12.65"/>
+ </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="20,5"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="19.95,4.95;28.05,8.05"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="20,5"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="8"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="3"/>
+ </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#</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,6.65"/>
+ </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 - Text" version="0" id="O9">
+ <dia:attribute name="obj_pos">
+ <dia:point val="22,4"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="22,3.45;25.7,4.4"/>
+ </dia:attribute>
+ <dia:attribute name="text">
+ <dia:composite type="text">
+ <dia:attribute name="string">
+ <dia:string>#... und Praxis#</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="22,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="Geometric - Left-Right Arrow" version="0" id="O10">
+ <dia:attribute name="obj_pos">
+ <dia:point val="18,5.75006"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="17.9293,5.62935;21.0705,7.37065"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="18,5.75006"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="2.999755859375"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="1.4998779296875"/>
+ </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 - Left-Right Arrow" version="0" id="O11">
+ <dia:attribute name="obj_pos">
+ <dia:point val="18,8.75006"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="17.9293,8.62935;21.0705,10.3706"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="18,8.75006"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="2.999755859375"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="1.4998779296875"/>
+ </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 - Left-Right Arrow" version="0" id="O12">
+ <dia:attribute name="obj_pos">
+ <dia:point val="18,11.7501"/>
+ </dia:attribute>
+ <dia:attribute name="obj_bb">
+ <dia:rectangle val="17.9293,11.6294;21.0705,13.3707"/>
+ </dia:attribute>
+ <dia:attribute name="elem_corner">
+ <dia:point val="18,11.7501"/>
+ </dia:attribute>
+ <dia:attribute name="elem_width">
+ <dia:real val="2.999755859375"/>
+ </dia:attribute>
+ <dia:attribute name="elem_height">
+ <dia:real val="1.4998779296875"/>
+ </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:layer>
+</dia:diagram>
diff --git a/doxygen.cfg b/doxygen.cfg
new file mode 100644
index 0000000..5c03609
--- /dev/null
+++ b/doxygen.cfg
@@ -0,0 +1,213 @@
+# 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/doxygen_to_devhelp.xsl b/doxygen_to_devhelp.xsl
new file mode 100644
index 0000000..ca6aa97
--- /dev/null
+++ b/doxygen_to_devhelp.xsl
@@ -0,0 +1,66 @@
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+<!-- Based on the XSL stylesheet from gtkmm - Lennart -->
+
+<xsl:output method="xml" version="1.0" indent="yes"/>
+
+<xsl:param name="reference_prefix">../../../doc/avahi-docs/html/</xsl:param>
+
+<xsl:template match="/">
+ <book title="Avahi Reference Manual"
+ name="avahi"
+ link="{$reference_prefix}main.html">
+ <chapters>
+ <sub name="Headers" link="{$reference_prefix}files.html">
+ <xsl:apply-templates select="doxygenindex/compound[@kind='file']">
+ <xsl:sort select="."/>
+ </xsl:apply-templates>
+ </sub>
+ </chapters>
+
+ <functions>
+ <!-- @todo: maybe select only the real functions, ie those with kind=="function"? -->
+ <xsl:apply-templates select="doxygenindex/compound/function" mode="as-function"/>
+ </functions>
+ </book>
+</xsl:template>
+
+<xsl:template match="compound">
+ <xsl:param name="name"><xsl:value-of select="name"/></xsl:param>
+ <xsl:param name="link"><xsl:value-of select="@refid"/>.html</xsl:param>
+ <sub name="{$name}" link="{$reference_prefix}{$link}">
+ <xsl:apply-templates select="member" mode="as-sub">
+ <xsl:sort select="."/>
+ </xsl:apply-templates>
+ </sub>
+</xsl:template>
+
+<xsl:template match="member" mode="as-function">
+ <!--
+ <function name="atk_set_value" link="atk-atkvalue.html#ATK-SET-VALUE"/>
+ -->
+ <xsl:param name="name"><xsl:value-of select="name"/></xsl:param>
+ <!-- Link is refid attribute of parent element + "#" + diff between refid of parent and own refid -->
+ <xsl:param name="refid_parent"><xsl:value-of select="parent::node()/@refid"/></xsl:param>
+ <xsl:param name="own_refid"><xsl:value-of select="@refid"/></xsl:param>
+ <xsl:param name="offset"><xsl:value-of select="string-length($refid_parent) + 3"/></xsl:param>
+ <xsl:param name="ref_diff"><xsl:value-of select="substring($own_refid, $offset, 32)"/></xsl:param>
+ <xsl:param name="link"><xsl:value-of select="$refid_parent"/>.html#<xsl:value-of select="$ref_diff"/></xsl:param>
+ <function name="{$name}" link="{$reference_prefix}{$link}"/>
+</xsl:template>
+
+<xsl:template match="member" mode="as-sub">
+ <xsl:param name="name"><xsl:value-of select="name"/></xsl:param>
+ <!-- Link is refid attribute of parent element + "#" + diff between refid of parent and own refid -->
+ <xsl:param name="refid_parent"><xsl:value-of select="parent::node()/@refid"/></xsl:param>
+ <xsl:param name="own_refid"><xsl:value-of select="@refid"/></xsl:param>
+ <xsl:param name="offset"><xsl:value-of select="string-length($refid_parent) + 3"/></xsl:param>
+ <xsl:param name="ref_diff"><xsl:value-of select="substring($own_refid, $offset, 32)"/></xsl:param>
+ <xsl:param name="link"><xsl:value-of select="$refid_parent"/>.html#<xsl:value-of select="$ref_diff"/></xsl:param>
+ <sub name="{$name}" link="{$reference_prefix}{$link}"/>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644
index 0000000..1e1ae08
--- /dev/null
+++ b/examples/.gitignore
@@ -0,0 +1,12 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+client-browse-services
+client-publish-service
+core-browse-services
+core-publish-service
+glib-integration
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 0000000..dbb7f00
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,63 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/examples/client-browse-services.c b/examples/client-browse-services.c
new file mode 100644
index 0000000..f7ded2a
--- /dev/null
+++ b/examples/client-browse-services.c
@@ -0,0 +1,197 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 failure: %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/examples/client-publish-service.c b/examples/client-publish-service.c
new file mode 100644
index 0000000..facc965
--- /dev/null
+++ b/examples/client-publish-service.c
@@ -0,0 +1,280 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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);
+ group = g;
+
+ /* 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 with a remote service
+ * 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 *n, r[128];
+ int ret;
+ assert(c);
+
+ /* If this is the first time we're called, let's create a new
+ * entry group if necessary */
+
+ 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;
+ }
+
+ /* If the group is empty (either because it was just created, or
+ * because it was reset previously, add our entries. */
+
+ if (avahi_entry_group_is_empty(group)) {
+ fprintf(stderr, "Adding service '%s'\n", name);
+
+ /* Create some random TXT data */
+ snprintf(r, sizeof(r), "random=%i", rand());
+
+ /* We will now add two services and one subtype to the entry
+ * group. The two services have the same name, but differ in
+ * the service type (IPP vs. BSD LPR). Only services with the
+ * same name should be put in the same entry group. */
+
+ /* 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) {
+
+ if (ret == AVAHI_ERR_COLLISION)
+ goto collision;
+
+ 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) {
+
+ if (ret == AVAHI_ERR_COLLISION)
+ goto collision;
+
+ 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;
+
+collision:
+
+ /* A service name collision with a local service 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);
+
+ avahi_entry_group_reset(group);
+
+ create_services(c);
+ 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 */
+ 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 10s 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/examples/core-browse-services.c b/examples/core-browse-services.c
new file mode 100644
index 0000000..e062e3e
--- /dev/null
+++ b/examples/core-browse-services.c
@@ -0,0 +1,213 @@
+/* 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/examples/core-publish-service.c b/examples/core-publish-service.c
new file mode 100644
index 0000000..a78a464
--- /dev/null
+++ b/examples/core-publish-service.c
@@ -0,0 +1,244 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/examples/glib-integration.c b/examples/glib-integration.c
new file mode 100644
index 0000000..d2a2457
--- /dev/null
+++ b/examples/glib-integration.c
@@ -0,0 +1,146 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/initscript/.gitignore b/initscript/.gitignore
new file mode 100644
index 0000000..282522d
--- /dev/null
+++ b/initscript/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/initscript/Makefile.am b/initscript/Makefile.am
new file mode 100644
index 0000000..e5e1928
--- /dev/null
+++ b/initscript/Makefile.am
@@ -0,0 +1,58 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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_LFS
+SUBDIRS += lfs
+endif
+
+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/initscript/archlinux/Makefile.am b/initscript/archlinux/Makefile.am
new file mode 100644
index 0000000..2070975
--- /dev/null
+++ b/initscript/archlinux/Makefile.am
@@ -0,0 +1,38 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/archlinux/avahi-daemon.in b/initscript/archlinux/avahi-daemon.in
new file mode 100644
index 0000000..6ae252d
--- /dev/null
+++ b/initscript/archlinux/avahi-daemon.in
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/archlinux/avahi-dnsconfd.in b/initscript/archlinux/avahi-dnsconfd.in
new file mode 100755
index 0000000..c57260e
--- /dev/null
+++ b/initscript/archlinux/avahi-dnsconfd.in
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/darwin/Makefile.am b/initscript/darwin/Makefile.am
new file mode 100644
index 0000000..d01e5a4
--- /dev/null
+++ b/initscript/darwin/Makefile.am
@@ -0,0 +1,36 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 = /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' $< > $@
+
+org.freedesktop.avahi-dnsconfd.plist: org.freedesktop.avahi-dnsconfd.plist.in
+ sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
diff --git a/initscript/darwin/org.freedesktop.avahi-daemon.plist.in b/initscript/darwin/org.freedesktop.avahi-daemon.plist.in
new file mode 100644
index 0000000..135e40c
--- /dev/null
+++ b/initscript/darwin/org.freedesktop.avahi-daemon.plist.in
@@ -0,0 +1,16 @@
+<?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/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in b/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in
new file mode 100644
index 0000000..822a2c0
--- /dev/null
+++ b/initscript/darwin/org.freedesktop.avahi-dnsconfd.plist.in
@@ -0,0 +1,16 @@
+<?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/initscript/debian/Makefile.am b/initscript/debian/Makefile.am
new file mode 100644
index 0000000..314983d
--- /dev/null
+++ b/initscript/debian/Makefile.am
@@ -0,0 +1,44 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/debian/avahi-daemon.in b/initscript/debian/avahi-daemon.in
new file mode 100755
index 0000000..97fa157
--- /dev/null
+++ b/initscript/debian/avahi-daemon.in
@@ -0,0 +1,178 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+ }
+
+ 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
+
+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.
+#
+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/initscript/debian/avahi-dnsconfd.in b/initscript/debian/avahi-dnsconfd.in
new file mode 100755
index 0000000..67c2873
--- /dev/null
+++ b/initscript/debian/avahi-dnsconfd.in
@@ -0,0 +1,184 @@
+#!/bin/sh
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+ }
+
+ 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
+
+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.
+#
+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/initscript/fedora/.gitignore b/initscript/fedora/.gitignore
new file mode 100644
index 0000000..fd8f359
--- /dev/null
+++ b/initscript/fedora/.gitignore
@@ -0,0 +1,4 @@
+Makefile
+Makefile.in
+avahi-daemon
+avahi-dnsconfd
diff --git a/initscript/fedora/Makefile.am b/initscript/fedora/Makefile.am
new file mode 100644
index 0000000..93a4138
--- /dev/null
+++ b/initscript/fedora/Makefile.am
@@ -0,0 +1,38 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+ $(AM_V_GEN)sed \
+ -e 's,@sbindir\@,$(sbindir),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ $< > $@ && \
+ chmod +x $@
+
+avahi-dnsconfd: avahi-dnsconfd.in
+ $(AM_V_GEN)sed \
+ -e 's,@sbindir\@,$(sbindir),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ $< > $@ && \
+ chmod +x $@
diff --git a/initscript/fedora/avahi-daemon.in b/initscript/fedora/avahi-daemon.in
new file mode 100644
index 0000000..5a8f430
--- /dev/null
+++ b/initscript/fedora/avahi-daemon.in
@@ -0,0 +1,116 @@
+#!/bin/sh
+#
+# avahi-daemon: Starts the Avahi mDNS/DNS-SD Stack
+#
+# chkconfig: 345 24 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
+# pidfile: @localstatedir@/run/avahi-daemon/pid
+
+### BEGIN INIT INFO
+# Required-Start: messagebus
+# Required-Stop: messagebus
+# Should-Start: $syslog $network $local_fs
+# Should-Stop: $syslog $local_fs
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Starts the Avahi Daemon
+# 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.
+### END INIT INFO
+
+AVAHI_BIN=@sbindir@/avahi-daemon
+AVAHI_OPTS="-D"
+
+if [ "$1" = 'status' ]; then
+ test -x $AVAHI_BIN || exit 4
+else
+ test -x $AVAHI_BIN || exit 5
+fi
+
+# Source function library.
+. /etc/init.d/functions
+. /etc/sysconfig/network
+
+LOCKFILE=@localstatedir@/lock/subsys/avahi-daemon
+PIDFILE=@localstatedir@/run/avahi-daemon/pid
+RETVAL=0
+
+base=${0##*/}
+
+start() {
+ # Check that networking is configured.
+ [ ${NETWORKING} = "no" ] && exit 1
+
+ echo -n $"Starting Avahi daemon... "
+ if [ -s /etc/localtime ]; then
+ cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
+ fi;
+ daemon --pidfile=${PIDFILE} $AVAHI_BIN $AVAHI_OPTS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch ${LOCKFILE}
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Shutting down Avahi daemon: "
+ killproc -p ${PIDFILE} $AVAHI_BIN
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
+ echo
+ return $RETVAL
+}
+
+reload() {
+ echo -n $"Reloading Avahi daemon... "
+ killproc -p ${PIDFILE} $AVAHI_BIN -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+RETVAL=0
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status -p ${PIDFILE} $AVAHI_BIN
+ RETVAL=$?
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ condrestart)
+ if [ -f $LOCKFILE ]; then
+ restart
+ fi
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart}"
+ exit 2
+ ;;
+esac
+
+exit $RETVAL
diff --git a/initscript/fedora/avahi-dnsconfd.in b/initscript/fedora/avahi-dnsconfd.in
new file mode 100644
index 0000000..bd4182e
--- /dev/null
+++ b/initscript/fedora/avahi-dnsconfd.in
@@ -0,0 +1,113 @@
+#!/bin/sh
+#
+# avahi-dnsconfd: Starts the Avahi DNS Configuration Daemon
+#
+# chkconfig: - 96 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
+# pidfile: @localstatedir@/run/avahi-dnsconfd.pid
+
+### BEGIN INIT INFO
+# Required-Start: avahi-daemon
+# Required-Stop: avahi-daemon
+# Should-Start: $syslog $network $local_fs
+# Should-Stop: $syslog $local_fs
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Starts the Avahi DNS Configuration Daemon
+# 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.
+### END INIT INFO
+
+AVAHI_BIN=@sbindir@/avahi-dnsconfd
+AVAHI_OPTS="-D"
+
+if [ "$1" = 'status' ]; then
+ test -x $AVAHI_BIN || exit 4
+else
+ test -x $AVAHI_BIN || exit 5
+fi
+
+# Source function library.
+. /etc/init.d/functions
+. /etc/sysconfig/network
+
+LOCKFILE=@localstatedir@/lock/subsys/avahi-dnsconfd
+PIDFILE=@localstatedir@/run/avahi-dnsconfd.pid
+RETVAL=0
+
+base=${0##*/}
+
+start() {
+ # Check that networking is configured.
+ [ ${NETWORKING} = "no" ] && exit 1
+
+ echo -n $"Starting Avahi DNS daemon... "
+ daemon --pidfile=${PIDFILE} $AVAHI_BIN $AVAHI_OPTS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch ${LOCKFILE}
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Shutting down Avahi DNS daemon: "
+ killproc -p ${PIDFILE} $AVAHI_BIN
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
+ echo
+ return $RETVAL
+}
+
+reload() {
+ echo -n $"Reloading Avahi DNS daemon... "
+ killproc -p ${PIDFILE} $AVAHI_BIN -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+RETVAL=0
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status -p ${PIDFILE} $AVAHI_BIN
+ RETVAL=$?
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ reload
+ ;;
+ condrestart)
+ if [ -f $LOCKFILE ]; then
+ restart
+ fi
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart}"
+ exit 2
+ ;;
+esac
+
+exit $RETVAL
diff --git a/initscript/freebsd/Makefile.am b/initscript/freebsd/Makefile.am
new file mode 100644
index 0000000..c32830e
--- /dev/null
+++ b/initscript/freebsd/Makefile.am
@@ -0,0 +1,41 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/freebsd/avahi-daemon.sh.in b/initscript/freebsd/avahi-daemon.sh.in
new file mode 100644
index 0000000..f3da39f
--- /dev/null
+++ b/initscript/freebsd/avahi-daemon.sh.in
@@ -0,0 +1,36 @@
+#!/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/initscript/freebsd/avahi-dnsconfd.sh.in b/initscript/freebsd/avahi-dnsconfd.sh.in
new file mode 100644
index 0000000..c034dca
--- /dev/null
+++ b/initscript/freebsd/avahi-dnsconfd.sh.in
@@ -0,0 +1,39 @@
+#!/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/avahi-dnsconfd.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/initscript/gentoo/Makefile.am b/initscript/gentoo/Makefile.am
new file mode 100644
index 0000000..0d20ca6
--- /dev/null
+++ b/initscript/gentoo/Makefile.am
@@ -0,0 +1,43 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/gentoo/avahi-daemon.in b/initscript/gentoo/avahi-daemon.in
new file mode 100644
index 0000000..02eefe6
--- /dev/null
+++ b/initscript/gentoo/avahi-daemon.in
@@ -0,0 +1,29 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+opts="reload"
+
+depend() {
+ before netmount nfsmount
+ 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/initscript/gentoo/avahi-dnsconfd.in b/initscript/gentoo/avahi-dnsconfd.in
new file mode 100644
index 0000000..376067e
--- /dev/null
+++ b/initscript/gentoo/avahi-dnsconfd.in
@@ -0,0 +1,28 @@
+#!/sbin/runscript
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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/initscript/lfs/Makefile.am b/initscript/lfs/Makefile.am
new file mode 100644
index 0000000..ed8dcb8
--- /dev/null
+++ b/initscript/lfs/Makefile.am
@@ -0,0 +1,31 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.in
+
+initd_SCRIPTS = avahi
+
+CLEANFILES = avahi
+
+avahi: avahi.in
+ $(AM_V_GEN)sed \
+ -e 's,@sbindir\@,$(sbindir),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ $< > $@ && \
+ chmod +x $@
diff --git a/initscript/lfs/avahi.in b/initscript/lfs/avahi.in
new file mode 100644
index 0000000..ba3672a
--- /dev/null
+++ b/initscript/lfs/avahi.in
@@ -0,0 +1,49 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/avahi
+#
+# Description : Avahi daemon loader
+#
+# Authors : William Immendorf - will.immendorf@gmail.com
+#
+# Version : 00.00
+#
+# Notes : Based off of the LFS 6.4 sysklogd script.
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+ start)
+ boot_mesg "Starting the Avahi daemon..."
+ loadproc avahi-daemon -D
+ ;;
+
+ stop)
+ boot_mesg "Stopping the Avahi daemon..."
+ avahi-daemon -k
+ evaluate_retval
+ ;;
+
+ reload)
+ boot_mesg "Reloading the Avahi daemon..."
+ reloadproc avahi-daemon -r
+ ;;
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+
+ status)
+ statusproc avahi-daemon
+ ;;
+ *)
+ echo "Usage: ${0} {start|stop|reload|restart|status}"
+ exit 1
+ ;;
+esac
+
+# End $rc_base/init.d/avahi
diff --git a/initscript/mandriva/Makefile.am b/initscript/mandriva/Makefile.am
new file mode 100644
index 0000000..480426b
--- /dev/null
+++ b/initscript/mandriva/Makefile.am
@@ -0,0 +1,32 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/mandriva/avahi-daemon.in b/initscript/mandriva/avahi-daemon.in
new file mode 100644
index 0000000..d81b9a2
--- /dev/null
+++ b/initscript/mandriva/avahi-daemon.in
@@ -0,0 +1,94 @@
+#! /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
+
+AVAHI_BIN=@sbindir@/avahi-daemon
+test -x $AVAHI_BIN || exit 5
+
+# Source function library.
+. /etc/init.d/functions
+
+. /etc/sysconfig/network
+
+# Check that networking is configured.
+[ "${NETWORKING}" = "no" ] && exit 0
+
+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/initscript/mandriva/avahi-dnsconfd.in b/initscript/mandriva/avahi-dnsconfd.in
new file mode 100644
index 0000000..a221356
--- /dev/null
+++ b/initscript/mandriva/avahi-dnsconfd.in
@@ -0,0 +1,94 @@
+#! /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
+
+AVAHI_BIN=@sbindir@/avahi-dnsconfd
+test -x $AVAHI_BIN || exit 5
+
+# Source function library.
+. /etc/init.d/functions
+
+. /etc/sysconfig/network
+
+# Check that networking is configured.
+[ ${NETWORKING} = "no" ] && exit 0
+
+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/initscript/slackware/Makefile.am b/initscript/slackware/Makefile.am
new file mode 100644
index 0000000..d415387
--- /dev/null
+++ b/initscript/slackware/Makefile.am
@@ -0,0 +1,32 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/slackware/avahi-daemon.in b/initscript/slackware/avahi-daemon.in
new file mode 100644
index 0000000..76bf2f2
--- /dev/null
+++ b/initscript/slackware/avahi-daemon.in
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/slackware/avahi-dnsconfd.in b/initscript/slackware/avahi-dnsconfd.in
new file mode 100644
index 0000000..ea1554d
--- /dev/null
+++ b/initscript/slackware/avahi-dnsconfd.in
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/suse/Makefile.am b/initscript/suse/Makefile.am
new file mode 100644
index 0000000..5624bdc
--- /dev/null
+++ b/initscript/suse/Makefile.am
@@ -0,0 +1,32 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/initscript/suse/avahi-daemon.in b/initscript/suse/avahi-daemon.in
new file mode 100644
index 0000000..0dc5f9f
--- /dev/null
+++ b/initscript/suse/avahi-daemon.in
@@ -0,0 +1,60 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: avahi
+# Required-Start: $network $remote_fs dbus
+# Required-Stop: $network $remote_fs dbus
+# Default-Start: 3 5
+# Default-Stop:
+# Short-Description: ZeroConf daemon
+# 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 "
+ $AVAHI_BIN -D
+ rc_status -v
+ ;;
+ stop)
+ echo -n "Shutting down Avahi daemon "
+ $AVAHI_BIN -k 2>/dev/null || /bin/true
+ rc_status -v
+ ;;
+ try-restart|condrestart)
+ if test "$1" = "condrestart"; then
+ echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
+ fi
+ $0 status
+ if test $? = 0; then
+ $0 restart
+ else
+ rc_reset
+ fi
+ rc_status
+ ;;
+ 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=3
+ rc_status -v
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
+ exit 1
+ ;;
+esac
diff --git a/initscript/suse/avahi-dnsconfd.in b/initscript/suse/avahi-dnsconfd.in
new file mode 100644
index 0000000..b88660b
--- /dev/null
+++ b/initscript/suse/avahi-dnsconfd.in
@@ -0,0 +1,60 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: avahi-dnsconfd
+# Required-Start: $remote_fs avahi
+# Required-Stop: $remote_fs avahi
+# Default-Start: 3 5
+# Default-Stop:
+# Short-Description: ZeroConf daemon
+# 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 "
+ $AVAHI_BIN -D
+ rc_status -v
+ ;;
+ stop)
+ echo -n "Shutting down Avahi DNS Configuration daemon "
+ $AVAHI_BIN -k 2>/dev/null || /bin/true
+ rc_status -v
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ rc_status
+ ;;
+ try-restart|condrestart)
+ if test "$1" = "condrestart"; then
+ echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
+ fi
+ $0 status
+ if test $? = 0; then
+ $0 restart
+ else
+ rc_reset
+ fi
+ 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=3
+ rc_status -v
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
+ exit 1
+ ;;
+esac
diff --git a/man/.gitignore b/man/.gitignore
new file mode 100644
index 0000000..b86c09c
--- /dev/null
+++ b/man/.gitignore
@@ -0,0 +1,8 @@
+*.1
+*.8
+*.5
+*.1.xml
+*.8.xml
+*.5.xml
+Makefile
+Makefile.in
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..d38267c
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,154 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 \
+ bssh.1.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_GTK
+man_MANS += \
+ bssh.1
+endif
+
+if HAVE_PYTHON
+man_MANS += \
+ avahi-bookmarks.1
+if HAVE_GTK
+man_MANS += \
+ avahi-discover.1
+endif
+endif
+endif
+
+if ENABLE_AUTOIPD
+if HAVE_LIBDAEMON
+
+man_MANS += \
+ avahi-autoipd.8 \
+ avahi-autoipd.action.8
+
+endif
+endif
+
+%.xml: %.xml.in Makefile
+ $(AM_V_GEN) 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' $< > $@
+
+if USE_XMLTOMAN
+
+CLEANFILES += $(man_MANS)
+
+%.1: %.1.xml Makefile
+ $(AM_V_GEN)xmltoman $< > $@
+
+%.5: %.5.xml Makefile
+ $(AM_V_GEN)xmltoman $< > $@
+
+%.8: %.8.xml Makefile
+ $(AM_V_GEN)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 \
+ bssh.1.xml.in \
+ xmltoman.css \
+ xmltoman.xsl \
+ xmltoman.dtd
+
+
+if HAVE_DBUS
+
+BSSH_LN =
+if HAVE_GTK
+if HAVE_GLIB
+BSSH_LN += $(LN_S) bssh.1 bvnc.1 &&
+endif
+endif
+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 bvnc.1 && \
+ $(BSSH_LN) \
+ $(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/man/avahi-autoipd.8.xml.in b/man/avahi-autoipd.8.xml.in
new file mode 100644
index 0000000..7137c30
--- /dev/null
+++ b/man/avahi-autoipd.8.xml.in
@@ -0,0 +1,164 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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-autoipd" section="8" desc="IPv4LL network address configuration daemon">
+
+ <synopsis>
+ <cmd>avahi-autoipd [<arg>options</arg>] <arg>interface</arg></cmd>
+ <cmd>avahi-autoipd <opt>--kill</opt> <arg>interface</arg></cmd>
+ <cmd>avahi-autoipd <opt>--refresh</opt> <arg>interface</arg></cmd>
+ <cmd>avahi-autoipd <opt>--check</opt> <arg>interface</arg></cmd>
+ </synopsis>
+
+ <description>
+ <p>avahi-autoipd implements IPv4LL, "Dynamic Configuration of
+ IPv4 Link-Local Addresses" (IETF RFC3927), a protocol for
+ automatic IP address configuration from the link-local
+ 169.254.0.0/16 range without the need for a central server. It
+ is primarily intended to be used in ad-hoc networks which lack a
+ DHCP server.</p>
+
+ <p>IPv4LL is part of the Zeroconf stack.</p>
+
+ <p>avahi-autoipd can be used as stand-alone address allocator
+ or as plugin for a DHCP client such as ISC's dhclient, where it
+ can be used as fallback solution if no DHCP server is found.</p>
+
+ <p>To allow communication between hosts that have only an IPv4LL
+ address assigned and hosts that only have a routable IP address
+ assigned you may add the following routes to both network
+ configurations:</p>
+
+ <p><opt>route add -net 169.254.0.0 netmask 255.255.0.0 dev eth0 metric 99</opt></p>
+ <p><opt>route add default dev eth0 metric 99</opt></p>
+
+ <p>See http://developer.apple.com/qa/qa2004/qa1357.html for more information.</p>
+ </description>
+
+ <options>
+
+ <option>
+ <p><opt>-D | --daemonize</opt></p>
+ <optdesc><p>Daemonize after startup. Implies <opt>--syslog</opt>.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-k | --kill</opt></p>
+ <optdesc><p>Kill an already running avahi-autoipd on the specified network interface. (Equivalent to sending a SIGTERM)</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-r | --refresh</opt></p>
+ <optdesc><p>Tell an already running avahi-autoipd to re-announce the acquired IP address on the specified network interface. (Equivalent to sending a SIGHUP)</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-c | --check</opt></p>
+ <optdesc><p>Return 0 as return code if avahi-autoipd is already running for the specified network interface.</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>Enable verbose mode.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>--no-drop-root</opt></p>
+ <optdesc><p>Don't drop root privileges after startup. 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>-S | --start=</opt></p>
+ <optdesc><p>Try to acquire the specified IP address, which must be from the IPv4LL range 169.254.0.0/16.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-w | --wait</opt></p>
+ <optdesc><p>Wait until a IP address has been successfully acquired before detaching. Only valid in combination with <opt>--daemonize</opt>.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>--force-bind</opt></p>
+ <optdesc><p>Acquire an IPv4LL address, even if a routable address has been configured on the interface.</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-autoipd will
+ reflect its current state and the IP address in the process
+ title.</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-autoipd.action</file>: the script to run when an IP address as been acquired or is lost.</p>
+
+ </section>
+
+ <section name="Signals">
+ <p><arg>SIGINT, SIGTERM</arg>: avahi-autoipd will shutdown. (Same as <opt>--kill</opt>)</p>
+ <p><arg>SIGHUP</arg>: avahi-autoipd will re-announce the acquired IP address. (Same as <opt>--refresh</opt>)</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="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">
+ <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/man/avahi-autoipd.action.8.xml.in b/man/avahi-autoipd.action.8.xml.in
new file mode 100644
index 0000000..5e4986f
--- /dev/null
+++ b/man/avahi-autoipd.action.8.xml.in
@@ -0,0 +1,83 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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-autoipd.action" section="8" desc="avahi-autoipd action script">
+
+ <synopsis>
+ <cmd>@pkgsysconfdir@/avahi-autoipd.action</cmd>
+ </synopsis>
+
+ <description>
+ <p><file>avahi-autoipd.action</file> is the action script that
+ is called whenever an IP address has been acquired by
+ avahi-autoipd or when it detected an IP address conflict. The
+ script should add or remove the specified address from the
+ specified network interface.</p>
+ </description>
+
+ <section name="Parameters">
+
+ <option>
+ <p><opt>argv[1]</opt> An event string: one of BIND, CONFLICT,
+ UNBIND or STOP. If BIND is passed an IP address has been
+ successfully acquired and the script shall add it to the
+ network interface. If CONFLICT is passed avahi-autopid
+ detected a IP address on the local network, the action script
+ should remove the configured IP address. If UNBIND is passed
+ the IP address should be removed from the interface, too,
+ because a routable address has been configured to the
+ interface by some other program. If STOP is passed the
+ avahi-autoipd is being shutdown and the action script should
+ remove the IP address. In short: on BIND the address should be
+ added to the interface, on CONFLICT, UNBIND or STOP it should
+ be removed.
+ </p>
+ </option>
+
+ <option>
+ <p><opt>argv[2]</opt> The network interface name.</p>
+ </option>
+
+ <option>
+ <p><opt>argv[3]</opt> An IP address from the IPv4LL range.</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-autoipd" section="8"/>, <manref name="dhclient-script" section="8"/>, <manref name="ip" section="8"/>, <manref name="ifconfig" 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/man/avahi-bookmarks.1.xml.in b/man/avahi-bookmarks.1.xml.in
new file mode 100644
index 0000000..d863e2b
--- /dev/null
+++ b/man/avahi-bookmarks.1.xml.in
@@ -0,0 +1,99 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/man/avahi-browse.1.xml.in b/man/avahi-browse.1.xml.in
new file mode 100644
index 0000000..b13d4fc
--- /dev/null
+++ b/man/avahi-browse.1.xml.in
@@ -0,0 +1,135 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 [<arg>options</arg>] <opt>--dump-db</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 "-". If <opt>--resolve</opt> is passed items that are resolved 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>-p | --parsable</opt></p>
+ <optdesc><p>Make output easily parsable for usage in scripts. If enabled fields are separated by semicolons (;), service names are escaped. It is recommended to combine this with <opt>--no-db-lookup</opt>.</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>-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>
+
+ <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/man/avahi-daemon.8.xml.in b/man/avahi-daemon.8.xml.in
new file mode 100644
index 0000000..0c2990d
--- /dev/null
+++ b/man/avahi-daemon.8.xml.in
@@ -0,0 +1,170 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 implements 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 privileges 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
+ its 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</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>
+
+ <p>http://avahi.org/wiki/AvahiAndUnicastDotLocal documents the problems when using Avahi in a unicast DNS zone .local.</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/man/avahi-daemon.conf.5.xml.in b/man/avahi-daemon.conf.5.xml.in
new file mode 100644
index 0000000..2d15017
--- /dev/null
+++ b/man/avahi-daemon.conf.5.xml.in
@@ -0,0 +1,385 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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>host-name-from-machine-id=</opt> Takes a boolean
+ value ("yes" or "no"). If set to "yes" avahi-daemon
+ will use the machine-id as name on the LAN.</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 separated 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 separated domains or by adding them to the XDG config
+ file <file>~/.config/avahi/browse-domains</file> (separated 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>allow-interfaces=</opt> Set a comma separated list of
+ allowed network interfaces that should be used by the
+ avahi-daemon. Traffic on other interfaces will be ignored. If
+ set to an empty list all local interfaces except loopback and
+ point-to-point will be used.</p>
+ </option>
+
+ <option>
+ <p><opt>deny-interfaces=</opt> Set a comma separated list of
+ network interfaces that should be ignored by avahi-daemon.
+ Other not specified interfaces will be used, unless
+ <opt>allow-interfaces=</opt> is set. This option takes
+ precedence over <opt>allow-interfaces=</opt>.</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 not 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>
+
+ <option>
+ <p><opt>cache-entries-max=</opt> Takes an unsigned integer
+ specifying how many resource records are cached per
+ interface. Bigger values allow mDNS work correctly in large LANs
+ but also increase memory consumption.</p>
+ </option>
+
+ <option>
+ <p><opt>clients-max=</opt> Takes an unsigned integer. The
+ maximum number of concurrent D-Bus clients allowed. If the
+ maximum number is reached further clients will be refused until
+ at least one existing client disconnects.</p>
+ </option>
+
+ <option>
+ <p><opt>objects-per-client-max=</opt> Takes an unsigned
+ integer. The maximum number of objects (entry groups, browsers,
+ resolvers) that may be registered per D-Bus client at a time. If the
+ maximum number is reached further object creation will be
+ refused until at least one object is freed.</p>
+ </option>
+
+ <option>
+ <p><opt>entries-per-entry-group-max=</opt> Takes an unsigned
+ integer. The maximum number of entries (resource records) per
+ entry group registered by a D-Bus client at a time. If the
+ maximum number is reached further resource records may not be
+ added to an entry group.</p>
+ </option>
+
+ <option>
+ <p><opt>ratelimit-interval-usec=</opt> Takes an unsigned
+ integer. Sets the per-interface packet rate-limiting interval
+ parameter. Together with <opt>ratelimit-burst=</opt> this may be
+ used to control the maximum number of packets Avahi will
+ generated in a specific period of time on an interface.</p>
+ </option>
+
+ <option>
+ <p><opt>ratelimit-burst=</opt> Takes an unsigned
+ integer. Sets the per-interface packet rate-limiting burst
+ parameter. Together with <opt>ratelimit-interval-usec=</opt> this may be
+ used to control the maximum number of packets Avahi will
+ generated in a specific period of time on an interface.</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
+ "no".</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
+ "no".</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 "no".</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 separated
+ 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>
+
+ <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]">
+ <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/man/avahi-discover.1.xml.in b/man/avahi-discover.1.xml.in
new file mode 100644
index 0000000..e311f1f
--- /dev/null
+++ b/man/avahi-discover.1.xml.in
@@ -0,0 +1,59 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/man/avahi-dnsconfd.8.xml.in b/man/avahi-dnsconfd.8.xml.in
new file mode 100644
index 0000000..7b09cd4
--- /dev/null
+++ b/man/avahi-dnsconfd.8.xml.in
@@ -0,0 +1,107 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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>-s | --syslog</opt></p>
+ <optdesc><p>Log to syslog instead of STDERR. Implied by <opt>--daemonize</opt>.</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</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/man/avahi-dnsconfd.action.8.xml.in b/man/avahi-dnsconfd.action.8.xml.in
new file mode 100644
index 0000000..f4ae37e
--- /dev/null
+++ b/man/avahi-dnsconfd.action.8.xml.in
@@ -0,0 +1,90 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/man/avahi-publish.1.xml.in b/man/avahi-publish.1.xml.in
new file mode 100644
index 0000000..bb8dbda
--- /dev/null
+++ b/man/avahi-publish.1.xml.in
@@ -0,0 +1,122 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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 mapping. 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/man/avahi-resolve.1.xml.in b/man/avahi-resolve.1.xml.in
new file mode 100644
index 0000000..e444cb9
--- /dev/null
+++ b/man/avahi-resolve.1.xml.in
@@ -0,0 +1,105 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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, specify 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/man/avahi-set-host-name.1.xml.in b/man/avahi-set-host-name.1.xml.in
new file mode 100644
index 0000000..407bbe7
--- /dev/null
+++ b/man/avahi-set-host-name.1.xml.in
@@ -0,0 +1,73 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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-set-host-name" section="1" desc="Change mDNS host name">
+
+ <synopsis>
+ <cmd>avahi-set-host-name <arg>host-name</arg></cmd>
+ </synopsis>
+
+ <description>
+ <p>Set the mDNS host name of a currently running Avahi
+ daemon. The effect of this operation is not persistent across
+ daemon restarts. This operation is usually privileged.</p>
+ </description>
+
+ <options>
+
+ <option>
+ <p><opt>-v | --verbose</opt></p>
+ <optdesc><p>Enable verbose mode.</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-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/man/avahi.hosts.5.xml.in b/man/avahi.hosts.5.xml.in
new file mode 100644
index 0000000..eff2848
--- /dev/null
+++ b/man/avahi.hosts.5.xml.in
@@ -0,0 +1,60 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/man/avahi.service.5.xml.in b/man/avahi.service.5.xml.in
new file mode 100644
index 0000000..6598617
--- /dev/null
+++ b/man/avahi.service.5.xml.in
@@ -0,0 +1,122 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/man/bssh.1.xml.in b/man/bssh.1.xml.in
new file mode 100644
index 0000000..6df640d
--- /dev/null
+++ b/man/bssh.1.xml.in
@@ -0,0 +1,88 @@
+<?xml version="1.0"?><!--*-nxml-*-->
+<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
+<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
+
+<!--
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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="bssh/bvnc/bshell" section="1" desc="Browse for SSH/VNC servers on the local network">
+
+ <synopsis>
+ <cmd>bssh</cmd>
+ <cmd>bvnc</cmd>
+ <cmd>bshell</cmd>
+ </synopsis>
+
+ <description>
+ <p>bssh/bvnc/bshell browses for SSH/VNC servers on the local
+ network, shows them in a GUI for the user to select one and
+ finally calls ssh/vncviewer after a selection was made.</p>
+
+ <p>If the binary is called as bssh only ssh servers will be shown. If the binary is called as bvnc only VNC servers will be shown. If the binary is called as bshell both VNC and SSH servers are shown.</p>
+
+ </description>
+
+ <options>
+
+ <option>
+ <p><opt>-s | --ssh</opt></p>
+ <optdesc><p>Browse for SSH servers (and only SSH servers) regardless under which name the binary is called.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-v | --vnc</opt></p>
+ <optdesc><p>Browse for VNC servers (and only VNC servers) regardless under which name the binary is called.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-S | --shell</opt></p>
+ <optdesc><p>Browse for both VNC and SSH servers regardless under which name the binary is called.</p></optdesc>
+ </option>
+
+ <option>
+ <p><opt>-d | --domain=</opt> <arg>DOMAIN</arg></p>
+ <optdesc><p>Browse in the specified domain. If omitted
+ bssh/bvnc/bshell will browse in the default browsing domain
+ (usually .local)</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="ssh" section="1"/>, <manref name="vncviewer" 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/man/xmltoman.css b/man/xmltoman.css
new file mode 100644
index 0000000..6b3235b
--- /dev/null
+++ b/man/xmltoman.css
@@ -0,0 +1,28 @@
+/***
+ 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/man/xmltoman.dtd b/man/xmltoman.dtd
new file mode 100644
index 0000000..968dd5f
--- /dev/null
+++ b/man/xmltoman.dtd
@@ -0,0 +1,37 @@
+<!--
+ 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/man/xmltoman.xsl b/man/xmltoman.xsl
new file mode 100644
index 0000000..1a344c2
--- /dev/null
+++ b/man/xmltoman.xsl
@@ -0,0 +1,127 @@
+<?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.
+-->
+
+<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/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000..c0baddf
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1,17 @@
+*.pot
+.intltool-merge-cache
+ChangeLog
+Makefile
+Makefile.in
+Makefile.in.in
+Makevars.template
+POTFILES
+Rules-quot
+boldquot.sed
+en@boldquot.header
+en@quot.header
+insert-header.sin
+quot.sed
+remove-potcdate.sin
+stamp-it
+*.gmo
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..8526235
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1,33 @@
+bg
+ca
+cs
+da
+de
+el
+en_AU
+en_CA
+en_GB
+en_NZ
+es
+fi
+fo
+fr
+gl
+he
+hu
+id
+it
+ja
+ms
+nl
+pl
+pt_BR
+ro
+ru
+sl
+sr
+sr@latin
+sv
+uk
+zh_CN
+zh_TW
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..ea5f64d
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,13 @@
+# List of source files which contain translatable strings.
+avahi-common/error.c
+[type: gettext/glade]avahi-discover-standalone/avahi-discover.ui
+avahi-python/avahi-discover/avahi-discover.desktop.in.in
+avahi-python/avahi-discover/avahi-discover.py
+avahi-ui/avahi-ui.c
+avahi-ui/bssh.c
+avahi-ui/bssh.desktop.in.in
+avahi-ui/bvnc.desktop.in.in
+avahi-utils/avahi-browse.c
+avahi-utils/avahi-publish.c
+avahi-utils/avahi-resolve.c
+avahi-utils/avahi-set-host-name.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
new file mode 100644
index 0000000..7ee0ef4
--- /dev/null
+++ b/po/POTFILES.skip
@@ -0,0 +1,4 @@
+avahi-ui/bssh.desktop.in
+avahi-ui/bvnc.desktop.in
+tests/c-plus-plus-test-gen.py
+avahi-python/avahi-discover/avahi-discover.desktop.in
diff --git a/po/bg.po b/po/bg.po
new file mode 100644
index 0000000..f59d43a
--- /dev/null
+++ b/po/bg.po
@@ -0,0 +1,860 @@
+# Bulgarian translation of avahi po-file.
+# Copyright (C) 2010 Free Software Foundation, Inc.
+# This file is distributed under the same license as the avahi package.
+# Alexander Shopov <ash@kambanaria.org>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi master\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-03-01 07:55+0200\n"
+"Last-Translator: Alexander Shopov <ash@kambanaria.org>\n"
+"Language-Team: Bulgarian <dict@fsa-bg.org>\n"
+"Language: bg\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "Добре"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "ÐеуÑпешна операциÑ"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Лошо ÑÑŠÑтоÑние"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Ðеправилно име на машина"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Ðеправилно име на домейн"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "ЛипÑва подходÑщ мрежови протокол"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Ðеправилно време за живот за DNS"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Ключът за Ð·Ð°Ð¿Ð¸Ñ Ð½Ð° реÑÑƒÑ€Ñ Ðµ шаблон"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Съвпадение на локални имена"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Ðеправилен запиÑ"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Ðеправилно име на уÑлуга"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Ðеправилен вид уÑлуга"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Ðеправилен номер на порт"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Ðеправилен ключ за запиÑ"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ðеправилен адреÑ"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Времето изтече"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Прекалено много клиенти"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Прекалено много обекти"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Прекалено много запиÑи"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Грешка на операционната ÑиÑтема"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "ДоÑтъпът е отказан"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Ðеправилна операциÑ"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Ðеочаквана грешка от D-Bus"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "ÐеуÑпешна връзка Ñ Ð´ÐµÐ¼Ð¾Ð½Ð°"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "ÐедоÑтатъчно памет"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "ПодадениÑÑ‚ обект е неправилен"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Демонът не е Ñтартиран"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ðеправилен Ð¸Ð½Ð´ÐµÐºÑ Ð½Ð° интерфейÑ"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Ðеправилно указан протокол"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Ðеправилни флагове"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ðе е намерено"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Ðеправилни наÑтройки"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Разлика във верÑиите"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Ðеправилен подвид на уÑлугата"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Ðеправилен пакет"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Ðеправилен код върнат от DNS"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Грешка от DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Грешка от DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Грешка от DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Грешка от DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Грешка от DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Грешка от DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Грешка от DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Грешка от DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Грешка от DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Грешка от DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Ðеправилни данни RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Ðеправилен вид DNS"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Ðеправилен ÐºÐ»Ð°Ñ DNS"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ðе Ñе поддържа"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Ðе е позволено"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Ðеправилен аргумент"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Е празно"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "ЗаÑвената Ð¾Ð¿ÐµÑ€Ð°Ñ†Ð¸Ñ Ðµ излишна и затова неправилна"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Ðеправилен код на грешка"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Ðе е избрана уÑлуга.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Откриване Ñ Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Преглед на улеÑнените уÑлуги Ñ Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Преглед на улеÑнените уÑлуги (Zeroconf) в мрежата ви"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "Данни Ñ Ð²Ð¸Ð´ TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Е празно"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Вид уÑлуга"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Име на уÑлугата"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Домейн"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "ÐдреÑ"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Преглед на видовете уÑлуги"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "СпиÑък завършващ Ñ NULL на видовете уÑлуги, които да Ñе прегледат"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Домейн"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Домейнът, в който да е прегледът. NULL означава ÑÑ‚Ð°Ð½Ð´Ð°Ñ€Ñ‚Ð½Ð¸Ñ Ð´Ð¾Ð¼ÐµÐ¹Ð½"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Вид уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Видът на избраната уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Име на уÑлугата"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Име на избраната уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "ÐдреÑ"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "ÐдреÑÑŠÑ‚ на откритата уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Порт"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Портът по IP на откритата уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Име на машина"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Името на машината на откритата уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Данни Ñ Ð²Ð¸Ð´ TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Данни Ñ Ð²Ð¸Ð´ TXT за откритата уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Откриване на уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Откриване на името на машината Ñ ÑƒÑлугата"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Ð¤Ð°Ð¼Ð¸Ð»Ð¸Ñ Ð°Ð´Ñ€ÐµÑи"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "ФамилиÑта адреÑи за откриване на име на машина"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Проблем Ñ ÐºÐ»Ð¸ÐµÐ½Ñ‚Ð° на Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Проблем Ñ Ð¾Ñ‚ÐºÑ€Ð¸Ð²Ð°Ð½ÐµÑ‚Ð¾ на Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "ÐеуÑпешен преглед за уÑлуга от вида %s в домейна %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "нÑма"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Проблем Ñ Ð¿Ñ€ÐµÐ³Ð»ÐµÐ´Ð° на домейна Ñ Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Проблем Ñ Ð¿Ñ€Ð¾Ñ‡Ð¸Ñ‚Ð°Ð½ÐµÑ‚Ð¾ на домейна Ñ Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "СпиÑъкът Ñ ÑƒÑлуги за преглед е празен!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "ÐеуÑпех при Ñвързването ÑÑŠÑ Ñървър на Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Преглед на уÑлугите в <b>локалната мрежа</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Преглед на уÑлугите в домейна <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "ÐеуÑпешно Ñъздаване на компонент за преглед на %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"ÐеуÑпешно Ñъздаване на компонент за откриване на %s от вида %s в домейна %s: "
+"%s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "ÐеуÑпешно Ñъздаване на компонент за преглед на домейн: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "СмÑна на домейна"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Преглед…"
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Инициализиране…"
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "МеÑтоположение"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Име"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Вид"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Домейн…"
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [опции]\n"
+"\n"
+" -h --help Извеждане на тази помощ\n"
+" -s --ssh Преглед на Ñървърите за SSH\n"
+" -v --vnc Преглед на Ñървърите за VNC\n"
+" -S --shell Преглед на Ñървърите за VNC и SSH\n"
+" -d --domain=ДОМЕЙРДомейнът, който да Ñе разгледа\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Прекалено много аргументи\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Избор на Ñървър за доÑтъп"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "С графична Ñреда"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "За команден ред"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Избор на Ñървър за VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Избор на Ñървър за SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Свързване към „%s“…\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "ÐеуÑпешно изпълнение на execlp(): %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "ОтмÑна.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Преглед Ñ Avahi на Ñървърите за SSH"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Преглед на Ñървърите за SSH Ñ ÑƒÐ»ÐµÑнение"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Преглед Ñ Avahi на Ñървърите за VNC"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Преглед на Ñървърите за VNC Ñ ÑƒÐ»ÐµÑнение"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": вÑички за Ñега\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": кешът е изчерпан\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "УÑлуга „%s“ Ñ Ð²Ð¸Ð´ „%s“ не е открита в домейна „%s“: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Проблем ÑÑŠÑ service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Проблем Ñ avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Проблем Ñ service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Проблем Ñ avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Проблем Ñ avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "ÐеуÑпешно запитване за низа за верÑиÑта: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "ÐеуÑпешно запитване за името на машината: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "ВерÑÐ¸Ñ Ð½Ð° Ñървъра: %s. Име на машината: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Сбт Ð˜Ð½Ñ„Ñ ÐŸÑ€Ñ‚Ðº Домейн\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "Сбт Ð˜Ð½Ñ„Ñ ÐŸÑ€Ñ‚Ðº %-*s %-20s Домейн\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "ПрекъÑната връзка, подновÑване…\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "ÐеуÑпех при Ñъздаване на клиентÑки обект: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Грешка в клиента, изход: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Изчакване на демона…\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Извеждане на тази помощ\n"
+" -V --version Извеждане на верÑиÑта\n"
+" -D --browse-domains Преглед на възможните домейни, а не на уÑлугите\n"
+" -a --all Показване на вÑички уÑлуги\n"
+" -d --domain=ДОМЕЙРДомейнът, който да Ñе разгледа\n"
+" -v --verbose Включване на подробен режим\n"
+" -t --terminate Изход Ñлед извеждането на възможно пълен ÑпиÑък\n"
+" -c --cache Изход Ñлед извеждането на вÑички запиÑи в кеша\n"
+" -l --ignore-local Без локалните уÑлуги\n"
+" -r --resolve Откриване на адреÑите на намерените уÑлуги\n"
+" -f --no-fail Продължаване на работа дори и без демон\n"
+" -p --parsable Изходът да може да Ñе анализира\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Без преглед на видовете уÑлуги\n"
+" -b --dump-db Извеждане на различните видове уÑлуги\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Прекалено малко аргументи\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "ÐеуÑпех при Ñъздаването на проÑÑ‚ обект за запитване.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "УÑтановен под име „%s“\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "ÐеуÑпешно региÑтриране: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Съвпадение на имена. Избира Ñе ново име: „%s“.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "ÐеуÑпешно Ñъздаване на група запиÑи: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "ÐеуÑпешно добавÑне на адреÑ: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "ÐеуÑпешно добавÑне на уÑлуга: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "ÐеуÑпешно добавÑне на подтип „%s“: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Съвпадение на имена на машини\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [опции] %s <име> <вид> <порт> [<txt…>]\n"
+"%s [fm[rr] %s <име-на-машина> <адреÑ>\n"
+"\n"
+" -h --help Извеждане на тази помощ\n"
+" -V --version Извеждане на верÑиÑта\n"
+" -s --service Публикуване на уÑлуга\n"
+" -a --address Публикуване на адреÑ\n"
+" -v --verbose Включване на подробен режим\n"
+" -d --domain=ДОМЕЙРДомейн за публикуване на уÑлугата\n"
+" -H --host=ДОМЕЙРМашина, на коÑто е уÑлугата\n"
+" --subtype=ПОДТИП Допълнителен подтип за региÑтриране на уÑлугата\n"
+" -R --no-reverse Без публикуване на обратен Ð·Ð°Ð¿Ð¸Ñ Ð·Ð° адреÑа\n"
+" -f --no-fail Продължаване на работа дори и без демон\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Ðеправилен брой аргументи\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "ÐеуÑпешно разпознаване на номер на порт: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Ðе е указана команда.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "ÐеуÑпешно откриване на името „%s“: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "ÐеуÑпешно откриване на Ð°Ð´Ñ€ÐµÑ â€ž%s“: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [опции] %s <име на машина…>\n"
+"%s [опции] %s <адреÑ… >\n"
+"\n"
+" -h --help Извеждане на тази помощ\n"
+" -V --version Извеждане на верÑиÑта\n"
+" -n --name Откриване на име на машина\n"
+" -a --address Откриване на адреÑ\n"
+" -v --verbose Включване на подробен режим\n"
+" -6 Откриване на Ð°Ð´Ñ€ÐµÑ Ð¿Ð¾ IPv6\n"
+" -4 Откриване на Ð°Ð´Ñ€ÐµÑ Ð¿Ð¾ IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "ÐеуÑпешно Ñъздаване на компонент за откриване на имена: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "ÐдреÑÑŠÑ‚ „%s“ не може да Ñе анализира.\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "ÐеуÑпешно Ñъздаване на компонент за откриване на имена: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [опции] <ново име на машината>\n"
+"\n"
+" -h --help Извеждане на тази помощ\n"
+" -V --version Извеждане на верÑиÑта\n"
+" -v --verbose Включване на подробен режим\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ðеправилен брой аргументи. Очаква Ñе точно един.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Името на машината е променено на %s\n"
diff --git a/po/ca.po b/po/ca.po
new file mode 100644
index 0000000..d3cff9c
--- /dev/null
+++ b/po/ca.po
@@ -0,0 +1,869 @@
+# Catalan translations for avahi package.
+# Copyright (C) 2008 Red Hat, Inc.
+# This file is distributed under the same license as the
+# avahi package.
+#
+# Oriol Miro <oriolmiro@gmail.com>, 2008
+#
+# This file is translated according to the glossary and style guide of
+# Softcatalà. If you plan to modify this file, please read first the page
+# of the Catalan translation team for the Fedora project at:
+# http://www.softcatala.org/projectes/fedora/
+# and contact the previous translator
+#
+# Aquest fitxer s'ha de traduir d'acord amb el recull de termes i la guia
+# d'estil de Softcatalà. Si voleu modificar aquest fitxer, llegiu si
+# us plau la pàgina de catalanització del projecte Fedora a:
+# http://www.softcatala.org/projectes/fedora/
+# i contacteu l'anterior traductor/a.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-10-17 12:57+0100\n"
+"Last-Translator: el_libre - - www.catmidia.cat <el.libre@gmail.com>\n"
+"Language-Team: Catalan <fedora@softcatala.net>\n"
+"Language: ca\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "D'acord"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operació fallida"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Estat erroni"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nom de host no vàlid"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nom de domini no vàlid"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "No hi ha disponible el protocol de xarxa"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "El TTL (temps de vida) del DNS no és vàlid"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "La clau del registre del recurs és un patró"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Col·lisió de nom local"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Registre no vàlid"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nom de servei no vàlid"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Tipus de servei no vàlid"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Número de port no vàlid"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Clau de registre no vàlid"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Adreça no vàlida"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Temps d'espera expirat"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Massa clients"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Massa objectes"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Massa entrades"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Error del SO"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Accés denegat"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Operació no vàlida"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "S'ha produït un error inesperat al D-Bus"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Ha fallat la connexió amb el dimoni"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memòria exhaurida"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "L'objecte passat no es vàlid"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "El dimoni no s'està executant"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "L'índex de la interfície no és vàlid"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Especificació de protocol no vàlida"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Indicador no vàlid"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "No s'ha trobat"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Configuració no vàlida"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "La versió no coincideix"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Subtipus de servei no vàlid"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Paquet no vàlid"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "El codi retornat pel DNS no és vàlid"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Error de DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Error de DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Error de DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Error de DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Error de DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Error de DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Error de DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Error de DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Error de DNS: NOAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Error de DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA no vàlid"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Tipus DNS no vàlid"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Classe DNS no vàlida"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "No s'admet"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "No és permès"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argument no vàlid"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "És buit"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "L'operació sol·licitada no és vàlida per redundant"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Codi d'error no vàlid"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>No hi ha cap servei seleccionat.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Descobridor Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Navegador zeroconf Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Navegueu pels serveis Zeroconf disponibles a la vostra xarxa"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Dades TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "És buit"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Tipus de servei:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Nom del servei:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Nom de domini:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Interfície:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Adreça:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Explora els tipus de servei"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Una llista dels tipus de servei acabada en NULL per a explorar"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domini"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "El domini a explorar, o NULL pel domini predeterminat"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tipus de servei"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "El tipus de servei del servei seleccionat"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nom del servei"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "El nom del servei del servei seleccionat"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adreça"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "L'adreça del servei resolt"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "El número de port IP del servei resolt"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Ordinador"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "El nom de l'ordinador del servei resolt"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Dades TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Dades TXT del servei resolt"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Resol servei"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Resol el servei seleccionat automàticament abans de retornar-ho"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Resol el nom de servidor del servei"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"Resol el nom de l'hoste del servei seleccionat automàticament abans de "
+"retornar-lo"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Família de l'adreça"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "La família de l'adreça per la resolució del nom"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Error en el client Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Fallada del resoletor de Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Error en la cerca de tipus de serveis %s en el domini %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "No disponible"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Error en la navegació del domini Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Error en la lectura del domini Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "La llista d'exploració de tipus de serveis és buida!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Error al connectar al servidor Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Cercant serveis en <b>xarxa local</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Cercant serveis en el domini <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Error en crear un navegador per a %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Error en crear el sistema de resolució per a %s del tipus %s en el domini "
+"%s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Error en crear navegador de domini: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Canvia el domini"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Explorant..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Inicialitzant..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Ubicació"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nom"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Tipus"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domini..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opcions]\n"
+"\n"
+" -h --help Mostra aquesta ajuda\n"
+" -s --ssh Explora els servidors SSH\n"
+" -v --vnc Explora els servidors VNC\n"
+" -S --shell Explora SSH i VNC\n"
+" -d --domain=DOMAIN El domini on cercar\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Massa arguments\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Escull servidor d'intèrpret d'ordres"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Escriptori"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Escull servidor VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Escull servidor SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Connectant a '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Error en execlp(): %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancel·lat.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Navegador de servidors SSH Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Explora els servidors SSH configurats amb Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Navegador de servidors VNC Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Explora els servidors de VNC configurats amb Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Això és tot per ara\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Memòria cau exhaurida\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Error en resoldre el servei '%s' del tipus '%s' en el domini '%s': %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Error en service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Error en avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Error en service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Error en avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Error en avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Error en consultar la versió de la cadena: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Error en consultar el nom del ordinador: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Versió del servidor: %s; Nom de l'ordinador: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Inter Prot Domini\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Inter Prot %-*s %-20s Domini\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Desconnectat, tornant a connectar ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Error en crear l'objecte client: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Error en client, sortint: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Esperant al dimoni ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Mostra aquesta ajuda\n"
+" -V --version Mostra la versió\n"
+" -D --browse-domains Mostra els dominis en el lloc dels serveis\n"
+" -a --all Mostra tots els serveis, a pesar del tipus\n"
+" -d --domain=DOMINI El domini a cercar\n"
+" -v --verbose Activa el mode amb detalls\n"
+" -t --terminate Finalitza després d'enmagatzemar una llista més o "
+"menys completa\n"
+" -c --cache Acabar després de volcar totes les entrades de la "
+"memòria cau\n"
+" -l --ignore-local Ignora els serveis locals\n"
+" -r --resolve Resol els serveis trobats\n"
+" -f --no-fail No fallis si el dimoni no és disponible\n"
+" -p --parsable Imprimeix en un format analitzable\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup No busquis tipus de serveis\n"
+" -b --dump-db Volca la base de dades dels tipus de serveis\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Manquen arguments\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Error al crear un objecte d'enquestes simple.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Estableix sota el nom '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Error en registrar: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Conflicte amb els noms, s'ha escollit un nou nom '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "No s'ha pogut crear el grup buit: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "no s'ha pogut afegir l'adreça: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "No s'ha pogut afegir el servei: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "No s'ha pogut afegir el subtipus '%s': %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Conflicte amb el nom de l'ordinador\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opcions] %s <nom> <tipus> <port> [<txt ...>]\n"
+"%s [opcions] %s <nom del host> <adreça>\n"
+"\n"
+" -h --help Mostra aquesta ajuda\n"
+" -V --version Mostra la versió\n"
+" -s --service Publica el servei\n"
+" -a --address Publica l'adreça\n"
+" -v --verbose Activa el mode amb detalls\n"
+" -d --domain=DOMINI Domini dins el que publicar el servei\n"
+" -H --host=DOMINI L'ordinador on està el servei\n"
+" --subtype=SUBTIPUS Un subtipus adicional amb el que registrar el "
+"servei\n"
+" -f --no-fail No fallar si el dimoni no està disponible\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Nombre erroni d'arguments\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Error en analitzar el número de port: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Ordre no especificada.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "No s'ha pogut resoldre el nom de l'ordinador '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "No s'ha pogut analitzar l'adreça '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opcions] %s <nom de l'ordinador ...>\n"
+"%s [options] %s <adreça ... >\n"
+"\n"
+" -h --help Mostra aquesta ajuda\n"
+" -V --version Mostra la versió\n"
+" -n --name Resol el nom del host\n"
+" -a --address Resol l'adreça\n"
+" -v --verbose Activa el mode amb detalls\n"
+" -6 Llista les adreces IPv6\n"
+" -4 Llista les adreces IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "No s'ha pogut crear el resoledor del nom de l'ordinador: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "No s'ha pogut analitzar l'adreça '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "No s'ha pogut crear el resolutor de l'adreça: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opcions] <nou nom de host>\n"
+"\n"
+" -h --help Mostra aquesta ajuda\n"
+" -V --version Mostra la versió\n"
+" -v --verbose Activa el mode amb detalls\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Nombre d'arguments incorrecte, s'esperava un exactament.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "S'ha canviat correctament el mon del host a %s\n"
diff --git a/po/cs.po b/po/cs.po
new file mode 100644
index 0000000..349bfbe
--- /dev/null
+++ b/po/cs.po
@@ -0,0 +1,867 @@
+# Czech translation of avahi.
+# Copyright (C) 2009 the author(s) of avahi.
+# This file is distributed under the same license as the avahi package.
+# Petr Kovar <pknbe@volny.cz>, 2009.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-08-17 02:10+0200\n"
+"Last-Translator: Petr Kovar <pknbe@volny.cz>\n"
+"Language-Team: Czech <translation-team-cs@lists.sourceforge.net>\n"
+"Language: cs\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "Budiž"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operace selhala"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Nevyhovující stav"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Neplatný název poÄítaÄe"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Neplatný název domény"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Žádný vyhovující síťový protokol není dostupný"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Neplatné DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+#, fuzzy
+msgid "Local name collision"
+msgstr "Lokální jméno souboru"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Neplatný záznam"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Neplatný název služby"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Neplatný typ služby"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Neplatné Äíslo portu"
+
+#: ../avahi-common/error.c:44
+#, fuzzy
+msgid "Invalid record key"
+msgstr "Uložit klÃ­Ä záznamu"
+
+#: ../avahi-common/error.c:45
+#, fuzzy
+msgid "Invalid address"
+msgstr "%s: adresa %s je nesprávná.\n"
+
+#: ../avahi-common/error.c:46
+#, fuzzy
+msgid "Timeout reached"
+msgstr "Čas vypršel"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Příliš mnoho klientů"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Příliš mnoho objektů"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Příliš mnoho položek"
+
+#: ../avahi-common/error.c:50
+#, fuzzy
+msgid "OS Error"
+msgstr "Chyba při tisku"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Přístup zamítnut"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Neplatná operace"
+
+#: ../avahi-common/error.c:54
+#, fuzzy
+msgid "An unexpected D-Bus error occurred"
+msgstr "Došlo k následující chybě:"
+
+#: ../avahi-common/error.c:55
+#, fuzzy
+msgid "Daemon connection failed"
+msgstr "Selhalo vzdálené připojení"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Paměť vyÄerpána"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr ""
+
+#: ../avahi-common/error.c:58
+#, fuzzy
+msgid "Daemon not running"
+msgstr "KlíÄenkový démon neběží"
+
+#: ../avahi-common/error.c:59
+#, fuzzy
+msgid "Invalid interface index"
+msgstr "GIF: Neplatný index."
+
+#: ../avahi-common/error.c:60
+#, fuzzy
+msgid "Invalid protocol specification"
+msgstr "Neplatná specifikace portu"
+
+#: ../avahi-common/error.c:61
+#, fuzzy
+msgid "Invalid flags"
+msgstr "neplatné příznaky"
+
+#: ../avahi-common/error.c:63
+#, fuzzy
+msgid "Not found"
+msgstr "Nenalezeno"
+
+#: ../avahi-common/error.c:64
+#, fuzzy
+msgid "Invalid configuration"
+msgstr "Nekompletní nebo neplatná konfigurace"
+
+#: ../avahi-common/error.c:65
+#, fuzzy
+msgid "Version mismatch"
+msgstr "Verze ABI %d.%d.x nesouhlasí (potřebuji %d.%d.x)"
+
+#: ../avahi-common/error.c:66
+#, fuzzy
+msgid "Invalid service subtype"
+msgstr "neplatné jméno autentizaÄní služby \"%s\", ignorováno\n"
+
+#: ../avahi-common/error.c:67
+#, fuzzy
+msgid "Invalid packet"
+msgstr "Chybná délka NCP rámce"
+
+#: ../avahi-common/error.c:68
+#, fuzzy
+msgid "Invalid DNS return code"
+msgstr "špatná návratová hodnota eof()."
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Selhání DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Selhání DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Selhání DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Selhání DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Selhání DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Selhání DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Selhání DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Selhání DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Selhání DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Selhání DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Neplatné RDATA"
+
+#: ../avahi-common/error.c:81
+#, fuzzy
+msgid "Invalid DNS type"
+msgstr "Neplatná funkce typu: \"%s\""
+
+#: ../avahi-common/error.c:82
+#, fuzzy
+msgid "Invalid DNS class"
+msgstr "Neplatné jméno třídy znaků"
+
+#: ../avahi-common/error.c:83
+#, fuzzy
+msgid "Not supported"
+msgstr "Nepodporováno"
+
+#: ../avahi-common/error.c:85
+#, fuzzy
+msgid "Not permitted"
+msgstr "Glob není dovolen: %s\n"
+
+#: ../avahi-common/error.c:86
+#, fuzzy
+msgid "Invalid argument"
+msgstr "Neplatný argument"
+
+#: ../avahi-common/error.c:87
+#, fuzzy
+msgid "Is empty"
+msgstr "(je prázdný)"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr ""
+
+#: ../avahi-common/error.c:94
+#, fuzzy
+msgid "Invalid Error Code"
+msgstr "Neznámý kód chyby %d"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+#, fuzzy
+msgid "<i>No service currently selected.</i>"
+msgstr "Klikněte k odstranění právě zvolené služby"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+#, fuzzy
+msgid "Avahi Discovery"
+msgstr "* Objev %s způsobí, že %s zastarajá.\n"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi Zeroconf Browser"
+msgstr "Webový prohlížeÄ Epiphany"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "Základní data"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "(je prázdný)"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Typ služby"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Pojmenovávací služba"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Doména"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Adresa"
+
+#: ../avahi-ui/avahi-ui.c:185
+#, fuzzy
+msgid "Browse Service Types"
+msgstr "typy musí souhlasit\n"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+#, fuzzy
+msgid "Domain"
+msgstr "Doména"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+#, fuzzy
+msgid "Service Type"
+msgstr "Typ služby"
+
+#: ../avahi-ui/avahi-ui.c:196
+#, fuzzy
+msgid "The service type of the selected service"
+msgstr "Neznámý typ služby: %s."
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+#, fuzzy
+msgid "Service Name"
+msgstr "Pojmenovávací služba"
+
+#: ../avahi-ui/avahi-ui.c:202
+#, fuzzy
+msgid "The service name of the selected service"
+msgstr "Název vybraného písma"
+
+#: ../avahi-ui/avahi-ui.c:208
+#, fuzzy
+msgid "Address"
+msgstr "Adresa"
+
+#: ../avahi-ui/avahi-ui.c:208
+#, fuzzy
+msgid "The address of the resolved service"
+msgstr "Služba momentálně není k dispozici"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+#, fuzzy
+msgid "The IP port number of the resolved service"
+msgstr "Číslo TCP/IP portu indexovacího serveru"
+
+#: ../avahi-ui/avahi-ui.c:219
+#, fuzzy
+msgid "Host Name"
+msgstr "Jméno poÄítaÄe"
+
+#: ../avahi-ui/avahi-ui.c:219
+#, fuzzy
+msgid "The host name of the resolved service"
+msgstr "Služba Knihy Adres"
+
+#: ../avahi-ui/avahi-ui.c:225
+#, fuzzy
+msgid "TXT Data"
+msgstr "Základní data"
+
+#: ../avahi-ui/avahi-ui.c:225
+#, fuzzy
+msgid "The TXT data of the resolved service"
+msgstr "Požadavek Äiní data služby zastaralými"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Nelze najít službu"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr " -f, --fqdn, --long dlouhé jméno poÄítaÄe (kanonické)\n"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+#, fuzzy
+msgid "Address family"
+msgstr "Třída adres `%s' není známa.\n"
+
+#: ../avahi-ui/avahi-ui.c:242
+#, fuzzy
+msgid "The address family for host name resolution"
+msgstr "požadovaná rodina nepodporovaná tímto hostitelem"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, fuzzy, c-format
+msgid "Avahi client failure: %s"
+msgstr "Chyba pÅ™i Ätení formátu GIF: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, fuzzy, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Chyba pÅ™i Ätení formátu GIF: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+#, fuzzy
+msgid "n/a"
+msgstr "neznámo"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, fuzzy, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "ProhlížeÄ serverů SSH Avahi"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, fuzzy, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "NepodaÅ™ilo se Äíst metadata z „%s“: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, fuzzy, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Spojení se serverem selhalo po %d pokusech\n"
+
+#: ../avahi-ui/avahi-ui.c:735
+#, fuzzy
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Vyhledávání SMPPPD v místní síti..."
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, fuzzy, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Nelze vytvoÅ™it klÃ­Ä registrů pro soubory '%s'."
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, fuzzy, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Nemohu vytvořit socket IPv4: %s\n"
+
+#: ../avahi-ui/avahi-ui.c:989
+#, fuzzy
+msgid "Change domain"
+msgstr "Doména autentizace"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+#, fuzzy
+msgid "Browsing..."
+msgstr "Prohlížení"
+
+#: ../avahi-ui/avahi-ui.c:1120
+#, fuzzy
+msgid "Initializing..."
+msgstr "Inicializuje se..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+#, fuzzy
+msgid "Location"
+msgstr "Umístění"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+#, fuzzy
+msgid "Name"
+msgstr "Název"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+#, fuzzy
+msgid "Type"
+msgstr "Typ"
+
+#: ../avahi-ui/avahi-ui.c:1166
+#, fuzzy
+msgid "_Domain..."
+msgstr "Doména"
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, fuzzy, c-format
+msgid "Too many arguments\n"
+msgstr "%s: příliš mnoho argumentů\n"
+
+#: ../avahi-ui/bssh.c:149
+#, fuzzy
+msgid "Choose Shell Server"
+msgstr "*** Prosím zvolte server"
+
+#: ../avahi-ui/bssh.c:151
+#, fuzzy
+msgid "Desktop"
+msgstr "Pracovní plocha"
+
+#: ../avahi-ui/bssh.c:152
+#, fuzzy
+msgid "Terminal"
+msgstr "Terminál"
+
+#: ../avahi-ui/bssh.c:156
+#, fuzzy
+msgid "Choose VNC server"
+msgstr "*** Prosím zvolte server"
+
+#: ../avahi-ui/bssh.c:161
+#, fuzzy
+msgid "Choose SSH server"
+msgstr "*** Prosím zvolte server"
+
+#: ../avahi-ui/bssh.c:185
+#, fuzzy, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Připojuji se k: %s"
+
+#: ../avahi-ui/bssh.c:240
+#, fuzzy, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Autentizace selhala"
+
+#: ../avahi-ui/bssh.c:250
+#, fuzzy, c-format
+msgid "Canceled.\n"
+msgstr "Zrušeno"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi SSH Server Browser"
+msgstr "Úspěšně přihlášen k SSH serveru %s\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi VNC Server Browser"
+msgstr "ProhlížeÄ serverů SSH Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, fuzzy, c-format
+msgid ": All for now\n"
+msgstr "Statistiky pro všechny:\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, fuzzy, c-format
+msgid ": Cache exhausted\n"
+msgstr "paměť vyÄerpána"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, fuzzy, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Příkaz pro prohlížeÄ selhal: %s"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:414
+#, fuzzy, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Typ [%s] se nepodařilo zjistit.\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, fuzzy, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Nelze vytvořit DDE řeťezec"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, fuzzy, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Pokus o spojení s hostitelem selhal."
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, fuzzy, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Jméno nebo adresa serveru."
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, fuzzy, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "UrÄit název domény"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, fuzzy, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Znovu se připojuji na %s"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, fuzzy, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "sdílený objekt `%s' se nepodařilo zavést"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, fuzzy, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Nelze spustit %s. Konec."
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, fuzzy, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "ÄŒekám na odpovÄ›Ä..."
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, fuzzy, c-format
+msgid "Too few arguments\n"
+msgstr "Příliš málo argumentů."
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, fuzzy, c-format
+msgid "Established under name '%s'\n"
+msgstr "Název ikony s logem"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, fuzzy, c-format
+msgid "Failed to register: %s\n"
+msgstr ""
+"Nepodařilo se zaregistrovat funkci pro obsloužení události \"zavření okna\""
+
+#: ../avahi-utils/avahi-publish.c:94
+#, fuzzy, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Zadání názvu nové složky"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, fuzzy, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Nelze vytvoÅ™it klÃ­Ä registrů pro soubory '%s'."
+
+#: ../avahi-utils/avahi-publish.c:124
+#, fuzzy, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Přidat do adresáře"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, fuzzy, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Klikněte k přidání služby"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, fuzzy, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Nepodařilo se přidat zprávu:\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, fuzzy, c-format
+msgid "Host name conflict\n"
+msgstr " -s, --short krátké jméno poÄítaÄe\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, fuzzy, c-format
+msgid "Bad number of arguments\n"
+msgstr "chybný poÄet argumentů"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, fuzzy, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Nemohu zpracovat soubor XML \"%s\""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, fuzzy, c-format
+msgid "No command specified.\n"
+msgstr "Nebyl uveden žádný příkaz."
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, fuzzy, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Pokus o spojení s hostitelem selhal."
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, fuzzy, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Nemohu rozpoznat nebo rozšířit '%s"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, fuzzy, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Nelze vytvoÅ™it jméno doÄasného souboru"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, fuzzy, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Analýza vCard se nezdařila."
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, fuzzy, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Nemohu vytvořit socket IPv4: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, fuzzy, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Místní adresář úspěšně změněn na %s\n"
diff --git a/po/da.po b/po/da.po
new file mode 100644
index 0000000..0b231cb
--- /dev/null
+++ b/po/da.po
@@ -0,0 +1,878 @@
+# Danish translation for avahi.
+# Copyright (C) 2010 avahi & nedenstående oversættere.
+# This file is distributed under the same license as the avahi package.
+# Joe Hansen <joedalton2@yahoo.dk>, 2010.
+# Korrekturlæst Ask, 2010.
+#
+# konventioner:
+# browse -> gennemse
+# resolve -> opløs
+# resolver -> opløser ? (gnome gvfs)
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-08-24 21:06+0100\n"
+"Last-Translator: Joe Hansen <joedalton2@yahoo.dk>\n"
+"Language-Team: Danish <dansk@dansk-gruppen.dk>\n"
+"Language: da\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "O.k."
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Handling mislykkedes"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Ugyldig tilstand"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Ugyldigt værtsnavn"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Ugyldigt domænenavn"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Ingen egnet netværksprotokol tilgængelig"
+
+# TTL -> var en forkortelse for Time to live
+# måske bedre at sige DNS-tidslængde fremfor DNS-TTL?
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Ugyldig DNS-TTL"
+
+# hvad er dette?
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Ressourcepostnøgle er mønster"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Lokal navnekollision"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Ugyldig post"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Ugyldigt tjenestenavn"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Ugyldig tjenestetype"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Ugyldigt portnummer"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Ugyldig postnøgle"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ugyldig adresse"
+
+# Tidsudløb nået
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Tiden løb ud"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "For mange klienter"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "For mange objekter"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "For mange punkter"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "OS-fejl"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Adgang nægtet"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Ugyldig handling"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Der opstod en uventet D-Bus-fejl"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Dæmonforbindelse mislykkedes"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Hukommelse opbrugt"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Objektet, der blev sat ind, var ikke gyldigt"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Dæmon kører ikke"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ugyldigt grænsefladeindeks"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Ugyldig protokolspecifikation"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Ugyldige flag"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ikke fundet"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Ugyldig konfiguration"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Forskellige versioner"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Ugyldig tjenesteundertype"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Ugyldig pakke"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Ugyldig DNS-returkode"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS-fejl: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS-fejl: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS-fejl: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS-fejl: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS-fejl: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS-fejl: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS-fejl: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS-fejl: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS-fejl: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS-fejl: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Ugyldige RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Ugyldig DNS-type"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Ugyldig DNS-klasse"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ikke understøttet"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Ikke tilladt"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Ugyldigt argument"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Er tom"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Den forespurgte handling er ugyldig på grund af redundans"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Ugyldig fejlkode"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Ingen tjeneste valgt i øjeblikket.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi Discovery"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf-browser"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Kig efter tilgængelige Zeroconftjenester på dit netværk"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT-data:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "tom"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Tjenestetype:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Tjenestenavn:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Domænenavn:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Grænseflade:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Adresse:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Kig efter tjenestetyper"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "En NULL-afgrænset liste af tjenestetyper at kigge efter"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domæne"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Domænet som der skal kigges i, eller NULL for standarddomænet"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tjenestetype"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Tjenestetypen på den valgte tjeneste"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Tjenestenavn"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Tjenestenavnet på den valgte tjeneste"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adresse"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Adressen på den klarlagte tjeneste"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "IP-portnummeret på den klarlagte tjeneste"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Værtsnavn"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Værtsnavnet på den klarlagte tjeneste"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT-data"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "TXT-dataene på den klarlagte tjeneste"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Opløs tjeneste"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Opløs den valgte tjeneste automatisk før returnering"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Opløs tjenesteværtsnavn"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "Opløs værtsnavnet på den valgte tjeneste automatisk før returnering"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Adressefamilie"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Adressefamilien for værtsnavnsopløsning"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Klientfejl for Avahi: %s"
+
+# GNOME gvfs: har opløser for resolver.
+# måske klarlægger
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Opløserfejl for Avahi: %s"
+
+# måske omvendt og omarrangér %s'erne:
+# Kunne ikke gennemse domæne %$2s for tjenestetype %$1s: %$3s
+# (det er muligt at det er $%2s el. tilsv., kan ikke lige huske formatet)
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Kunne ikke gennemse domæne $%2s for tjenestetype $%1s: $%3s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "-"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Domænebrowserfejl for Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Kunne ikke læse Avahidomæne: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Listen over typer af gennemsynstjenester er tom!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Kunne ikke forbinde til Avahiserver: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Gennemser for tjenester på <b>lokalnetværk</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Gennemser efter tjenester i domæne <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Kunne ikke oprette browser for %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Kunne ikke oprette opløser for %s af typen %s i domæne %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Kunne ikke oprette domænebrowser: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Ændr domæne"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Gennemser..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Initialiserer..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Sted"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Navn"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Type"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domæne..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [tilvalg]\n"
+"\n"
+" -h --help Vis denne hjælp\n"
+" -s --ssh Gennemse SSH-servere\n"
+" -v --vnc Gennemse VNC-servere\n"
+" -S --shell Gennemse både SSH og VNC\n"
+" -d --domain=DOMÆNE Domænet der skal gennemses\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "For mange argumenter\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Vælg skalserver"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Skrivebord"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Vælg VNC-server"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Vælg SSH-server"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Forbinder til '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() mislykkedes: %s\n"
+
+# engelsk fejl?
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Afbrudt.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahibrowser for SSH-server"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Gennemse for Zeroconf-aktiverede SSH-servere"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahibrowser for VNC-server"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Gennemse for Zeroconf-aktiverede VNC-servere"
+
+# eller alle?
+# (tror den er o.k.)
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Alt for nu\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Mellemlager opbrugt\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "Kunne ikke løse tjeneste '%s' af typen '%s' i domæne '%s': %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser mislykkedes: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() mislykkedes: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser mislykkedes: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() mislykkedes: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() mislykkedes: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Kunne ikke forespørge versionsstreng: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Kunne ikke forespørge værtsnavn: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Serverversion: %s; værtsnavn: %s\n"
+
+# Ifce ~ interface ~ grænseflade ~ GrFl
+# dog er det måske en dum idé at skrive dette hvis der ikke er en
+# oversat dokumentation for dette også
+# E er også event, burde blive til B. Igen, hvis vi ikke kan oversætte
+# dokumentationen, bør det nok beholdes...
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifce Prot-domæne\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s domæne\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Afbrudt, forbinder igen ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Kunne ikke oprette klientobjekt: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Klientfejl, afslutter: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Venter på dæmon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Vis denne hjælp\n"
+" -V --version Vis version\n"
+" -D --browse-domains Gennemse efter browsingdomæner i steden for "
+"tjenester\n"
+" -a --all Vis alle tjenester, uanset typen\n"
+" -d --domain=DOMÆNE Domænet der skal gennemses i\n"
+" -v --verbose Aktiver uddybende tilstand\n"
+" -t --terminate Afslut efter dumpning af en mere eller mindre "
+"fuldstændig liste\n"
+" -c --cache Afslut efter dumpning af alle punkter i "
+"mellemlageret\n"
+" -l --ignore-local Ignorer lokale tjenester\n"
+" -r --resolve Løs fundne tjenester\n"
+" -f --no-fail Giv ikke fejl hvis dæmonen ikke er tilgængelig\n"
+" -p --parsable Uddata i fortolkeligt format\n"
+
+# evt. smid -> dump
+# (tror det er i betydningen 'gem')
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Slå ikke tjenestetyper op\n"
+" -b --dump-db Dump tjenestetypedatabase\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "For få argumenter\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Kunne ikke oprette simpelt poll-objekt.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Etableret under navnet '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Kunne ikke registrere: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Navnesammenstød, vælger nyt navn '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Kunne ikke oprette punktgruppe: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Kunne ikke tilføje adresse: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Kunne ikke tilføje tjeneste: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Kunne ikke tilføje undertype '%s': %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Værtsnavnskonflikt\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [tilvalg] %s <navn> <type> <port> [<tekst ...>]\n"
+"%s [tilvalg] %s <værtsnavn> <adresse>\n"
+"\n"
+" -h --help Vis denne hjælp\n"
+" -V --version Vis version\n"
+" -s --service Udgiv tjeneste\n"
+" -a --address Udgiv adresse\n"
+" -v --verbose Aktiver uddybende tilstand\n"
+" -d --domain=DOMÆNE Domæne hvor tjeneste skal udgives i\n"
+" -H --host=DOMÆNE Vært hvor tjeneste residerer\n"
+" --subtype=UNDERTYPE En ekstra undertype til at registrere denne\n"
+" tjeneste med\n"
+" -R --no-reverse Udgiv ikke modsat punkt med adresse\n"
+" -f --no-fail Fejl ikke hvis dæmonen ikke er tilgængelig\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Ugyldigt antal argumenter\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Kunne ikke fortolke portnummer: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Ingen kommando angivet.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Kunne ikke løse værtsnavn '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Kunne ikke løse adresse '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [tilvalg] %s <værtsnavn ...>\n"
+"%s [tilvalg] %s <adresse ... >\n"
+"\n"
+" -h --help Vis denne hjælp\n"
+" -V --version Vis version\n"
+" -n --name Løs værtsnavn\n"
+" -a --address Løs adresse\n"
+" -v --verbose Vis uddybende tilstand\n"
+" -6 Slå IPv6-adresse op\n"
+" -4 Slå IPv4-adresse op\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Kunne ikke oprette værtsnavnsopløser: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Kunne ikke fortolke adresse '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Kunne ikke oprette adresseopløser: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [tilvalg] <nyt værtsnavn>\n"
+"\n"
+" -h --help Vis denne hjælp\n"
+" -V --version Vis version\n"
+" -v --verbose Aktiver uddybende tilstand\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ugyldigt antal argumenter, forventede præcist et.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Værtsnavn ændret til %s\n"
diff --git a/po/de.po b/po/de.po
new file mode 100644
index 0000000..5b0a017
--- /dev/null
+++ b/po/de.po
@@ -0,0 +1,1455 @@
+# German translation of avahi
+# Copyright (C) 2008 Avahi
+# This file is distributed under the same license as the avahi package.
+# Fabian Affolter <fab@fedoraproject.org>, 2008-2009.
+# Cornelius Neckenig <tbull@fedoraproject.org>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: audit-viewer\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-04-18 22:48+0100\n"
+"Last-Translator: Cornelius Neckenig <tbull@fedoraproject.org>\n"
+"Language-Team: German <fedora-trans-de@redhat.com>\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-Language: German\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operation fehlgeschlagen"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Ungültiger Zustand"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Ungültiger Rechnername"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Ungültiger Domainname"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Kein passendes Netzwerkprotokoll verfügbar"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Ungültige DNS-TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Datensatzschlüssel ist Muster"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Lokale Namenskollision"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Ungültiger Datensatz"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Ungültiger Dienstname"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Ungültiger Diensttyp"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Ungültige Port-Nummer"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Ungültiger Datensatzschlüssel"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ungültige Adresse"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Auszeit erreicht"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Zu viele Clients"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Zu viele Objekte"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Zu viele Einträge"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Betriebssystemfehler"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Zugriff verweigert"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Ungültige Operation"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Ein unerwarteter DBus-Fehler ist aufgetreten"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Verbindung zum Daemon fehlgeschlagen"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Verfügbarer Speicher ausgeschöpft"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Das übergebene Objekt ist nicht gültig"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Daemon läuft nicht"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ungültiger Schnittstellenindex"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Ungültige Protokollspezifikation"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Ungültige Flags"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Nicht gefunden"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Ungültige Konfiguration"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Unpassende Version"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Ungültiger Dienst-Untertyp"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Ungültiges Paket"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Ungültiger DNS-Rückgabewert"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS-Fehler: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS-Fehler: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS-Fehler: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS-Fehler: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS-Fehler: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS-Fehler: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS-Fehler: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS-Fehler: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS-Fehler: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS-Fehler: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Ungültige RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Ungültiger DNS-Typ"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Ungültige DNS-Klasse"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Nicht unterstützt"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Nicht erlaubt"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Ungültiges Argument"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "ist leer"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Die angeforderte Operation ist ungültig, da sie redundant ist"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Ungültiger Fehlercode"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Momentan ist kein Dienst ausgewählt.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi Discovery"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf Browser"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Durchsuchen nach Zeroconf-aktivierten Diensten in Ihrem Netzwerk"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT-Daten:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "ist leer"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Diensttyp:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Dienstname:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Domainname:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Schnittstelle:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Adresse:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Durchsuche Dienst-Typen"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Ein mit NULL abgeschlossene Liste der Dienst-Typen zum Durchsuchen "
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domain"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "DIe Domain zum Durchsuchen oder NULL für die Standard-Domain"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Diensttyp"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Der Service-Type des gewählten Diensts"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Dienstname"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Der Dienst-Name des gewählten Diensts"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adresse"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Die Adresse des Auflösungsdiensts"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Die IP-Port-Nummer des Auflösungsdienst"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Rechner-Name"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Der Rechner-Name des aufgelösten Dienstes"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT-Daten"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Die TXT-Daten des aufgelösten Dienstes"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Auflösungsdienst"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Vor dem Rücksprung den selektierten Dienst automatisch auflösen"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Dienst-Rechner-Name auflösen"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"Vor dem Rücksprung den Hostname des selektierten Dienstes\r\n"
+"automatisch auflösen"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Adress-Familie"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Die Adress-Familie zum Auflösen der Rechner-Namen"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi-Client-Fehler: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi-Auflösungsfehler: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Durchsuchen nach Dienst-Typen %s in Domain %s fehlgeschlagen: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "k.A."
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi-Domainbrowser-Fehler: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Fehler beim Lesen der Avahi-Domain: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Die Liste der Service-Typen ist leer!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Verbindung zu Avahi-Server fehlgeschlagen: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Durchsuche <b>lokales Netzwerk</b> nach Diensten:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Durchsuche Domain <b>%s</b> nach Diensten:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Browser-Erzeugung für %s fehlgeschlagen: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Erzeugen eines Resolvers für %s vom Typ %s in Domain %s fehlgeschlagen: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Erzeugen eines Domainbrowser fehlgeschlagen: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Domain ändern"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Durchsuchen ..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Initialisieren ..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Standort"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Name"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Typ"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domain ..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [options]\n"
+"\n"
+" -h --help Zeigt diese Hilfe an\n"
+" -s --ssh Durchsuchen nach SSH-Servern\n"
+" -v --vnc Durchsuchen nach VNC-Server\n"
+" -S --shell Durchsuchen nach beiden (SSH und VNC)\n"
+" -d --domain=DOMAIN Die Domain zum Durchsuchen\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Zu viele Argumente\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Shell-Server auswählen"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Desktop"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "VNC-Server auswählen"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "SSH-Dienst auswählen"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Verbinde zu '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() fehlgeschlagen: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Abgebrochen.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH Server Browser"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Durchsuchen nach Zeroconf-aktivierten SSH-Servern"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC-Server-Browser"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Durchsuchen nach Zeroconf-aktivierten VNC-Servern"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Alle Einträge bisher\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Datencache erschöpft\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Fehler beim Auflösen des Dienstes '%s' des Typ '%s' in Domain '%s': %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Versionsstring-Abfrage fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Hostname-Abfrage fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Server-Version: %s; Rechnername: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifce Prot-Domain\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s-Domain\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Nicht verbunden, neu verbinden ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Clientobjekt-Erzeugung fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Client-Fehler, beende: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Warte auf Daemon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Zeigt diese Hilfe an\n"
+" -V --version Zeigt die Version an\n"
+" -D --browse-domains Durchsuche nach suchenden Domain statt nach "
+"Diensten\n"
+" -a --all Zeigt alle Dienste, ohne Rücksicht auf die Typen\n"
+" -d --domain=DOMAIN Die Domain zum Durchsuchen\n"
+" -v --verbose Aktiviert detaillierten Modus\n"
+" -t --terminate Beenden nach Ausgeben einer mehr oder weniger "
+"kompletten Liste\n"
+" -c --cache Beenden nach Ausgeben aller Einträge aus dem Cache\n"
+" -l --ignore-local Ignoriere lokale Dienste\n"
+" -r --resolve Löse gefundene Dienste auf\n"
+" -f --no-fail Schlägt nicht fehl, wenn der Daemon nicht verfügbar "
+"ist\n"
+" -p --parsable Ausgabe in parsbaren Format\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Schlage Dienst-Typen nicht nach\n"
+" -b --dump-db Anzeigen der Dienst-Typen-Datenbank\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Zu wenige Argumente\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Fehler beim Erzeugen eines einfachen Abfrage-Objekts: \n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Eingerichtet unter dem Namen '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Registrierung fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Namenskollision, wähle neuen Name '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Fehler bei der Erzeugung der Einstiegsgruppe: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Fehler beim Hinzufügen der Adresse: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Fehler beim Hinzufügen des Dienstes: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Fehler beim Hinzufügen des Untertyps: '%s': %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Rechnername-Konflikt\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [options] %s <name> <type> <port> [<txt ...>]\n"
+"%s [options] %s <host-name> <address>\n"
+"\n"
+" -h --help Zeigt diese Hilfe an\n"
+" -V --version Zeigt die Version an\n"
+" -s --service Veröffentlicht Service\n"
+" -a --address Veröffentlicht Addresse\n"
+" -v --verbose Aktiviert detaillierten Modus\n"
+" -d --domain=DOMAIN Domain zum Veröffentlichen des Dienstes auf\n"
+" -H --host=DOMAIN Host, wo sich der Service befindet\n"
+" --subtype=SUBTYPE Ein zusätzlicher Untertyp zum Registrieren des "
+"Dienstes mit\n"
+" -f --no-fail Schlägt nicht fehl, wenn der Daemon nicht verfügbar "
+"ist\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Ungültige Anzahl von Argumenten\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Parsen der Port-Nummer fehlgeschlagen: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Kein Befehl angegeben.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Fehler beim Auflösen des Rechnernamens '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Fehler beim Auflösen der Adresse '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [options] %s <host name ...>\n"
+"%s [options] %s <address ... >\n"
+"\n"
+" -h --help Zeigt diese Hilfe an\n"
+" -V --version Zeigt die Version an\n"
+" -n --name Löst Hostname auf\n"
+" -a --address Löst Addresse auf\n"
+" -v --verbose Aktiviert detaillierten Modus\n"
+" -6 Schlägt IPv6-Addresse nach\n"
+" -4 Schlägt IPv4-Addresse nach\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Fehler beim Erzeugen des Rechneramen-Auflösers: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Fehler beim Parsern der Adresse '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Fehler beim Erzeugen des Adress-Auflösers: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Zeigt diese Hilfe an\n"
+" -V --version Zeigt die Version an\n"
+" -v --verbose Aktiviert detaillierten Modus\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ungültige Anzahl von Argumenten, erwartet wird genau eines.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Rechnername erfolgreich geändert auf %s\n"
+
+#~ msgid "."
+#~ msgstr "."
+
+#~ msgid ":"
+#~ msgstr ":"
+
+#~ msgid "<b>Event Order</b>"
+#~ msgstr "<b>Ereignis-Reihenfolge</b>"
+
+#~ msgid "<b>Group Columns _by:</b>"
+#~ msgstr "<b>Gruppiere Spalte _nach:</b>"
+
+#~ msgid "<b>Group Rows by:</b>"
+#~ msgstr "<b>Gruppiere Zeile nach:</b>"
+
+#~ msgid "<b>Identification</b>"
+#~ msgstr "<b>Identifikation</b>"
+
+#~ msgid "<b>Limit to events _before:</b>"
+#~ msgstr "<b>Limit zu Er _before:</b>"
+
+#~ msgid "<b>Limit to events not _earlier than:</b>"
+#~ msgstr "<b>Limitieren auf Ereignisse nicht _später als:</b>"
+
+#~ msgid "<b>Records</b>"
+#~ msgstr "<b>Aufzeichnungen</b>"
+
+#~ msgid "<b>Tab</b>"
+#~ msgstr "<b>Tab</b>"
+
+#~ msgid "<b>_File</b>"
+#~ msgstr "<b>_Datei</b>"
+
+#~ msgid "<b>_System audit log</b>"
+#~ msgstr "<b>_System-Audit-Protokoll</b>"
+
+#~ msgid "Audit Event Source"
+#~ msgstr "Audit-Ewreignis-Quelle"
+
+#~ msgid "Audit Viewer"
+#~ msgstr "Audit Viewer"
+
+#~ msgid "Automatic file type e_xtension"
+#~ msgstr "Automatische Dateityp-Er_weiterung"
+
+#~ msgid "Change _event source..."
+#~ msgstr "Ändere _Ereignis-Quelle..."
+
+#~ msgid "Columns"
+#~ msgstr "Spalte"
+
+#~ msgid "Current Co_lumn"
+#~ msgstr "Aktuelle Sp_alte"
+
+#~ msgid "Current _Cell"
+#~ msgstr "Aktuelle _Zelle"
+
+#~ msgid "Current _Row"
+#~ msgstr "Aktuelle _Zeile"
+
+#~ msgid "Date Filter"
+#~ msgstr "Datum-Filter"
+
+#~ msgid "Event Details"
+#~ msgstr "_Ereignis-Details"
+
+#~ msgid "Expression"
+#~ msgstr "Ausdruck"
+
+#~ msgid "F_ield:"
+#~ msgstr "F_eld:"
+
+#~ msgid "File _type:"
+#~ msgstr "Datei-_Typ:"
+
+#~ msgid "Filter"
+#~ msgstr "Filter"
+
+#~ msgid "Filter:"
+#~ msgstr "Filter:"
+
+#~ msgid "General"
+#~ msgstr "Allgemeines"
+
+#~ msgid "Group _values by:"
+#~ msgstr "_Werte gruppieren nach:"
+
+#~ msgid "Grouping"
+#~ msgstr "Gruppierung"
+
+#~ msgid "LIST/REPORT"
+#~ msgstr "LISTE/BERICHT"
+
+#~ msgid "New _List"
+#~ msgstr "Neue _Liste"
+
+#~ msgid "New _Report on this View..."
+#~ msgstr "Neuer _Bericht aus dieser Ansicht..."
+
+#~ msgid "New _Report..."
+#~ msgstr "Neuer _Bericht..."
+
+#~ msgid "Order:"
+#~ msgstr "Reihenfolge:"
+
+#~ msgid "Re_fresh"
+#~ msgstr "Aktu_alisieren"
+
+#~ msgid "Serial number:"
+#~ msgstr "Seriennummer:"
+
+#~ msgid "Sort by:"
+#~ msgstr "Sortieren nach:"
+
+#~ msgid ""
+#~ "The chart has too many data points. Please restrict your data filter or "
+#~ "use coarser data grouping criteria."
+#~ msgstr ""
+#~ "Das Diagramm hat zu viele Datenpunkte. Bitte beschränken Sie Ihren "
+#~ "Datenfilter oder benutzen Sie coarser-Datengruppierungkriterien."
+
+#~ msgid "Time:"
+#~ msgstr "Zeit:"
+
+#~ msgid ""
+#~ "You can add aditional conditions using the <tt>ausearch</tt> expression "
+#~ "language. Run <tt>(man ausearch-expression)</tt> to read the "
+#~ "documentation of the language."
+#~ msgstr ""
+#~ "Sie können zusätzliche Bedingungen hinzufügen mit der <tt>ausearch</tt>-"
+#~ "Ausdruckssprache. Führen Sie <tt>(man ausearch-expression)</tt> aus, um "
+#~ "die Dokumentaion dieser Sprache zu lesen."
+
+#~ msgid "_Ascending"
+#~ msgstr "_Aufsteigend"
+
+#~ msgid "_Close"
+#~ msgstr "_Schliessen"
+
+#~ msgid "_Descending"
+#~ msgstr "_Absteigend"
+
+#~ msgid "_Event Details"
+#~ msgstr "_Ereignis-Details"
+
+#~ msgid "_Event Time"
+#~ msgstr "_Ereignis-Zeit"
+
+#~ msgid "_Export..."
+#~ msgstr "_Exportieren..."
+
+#~ msgid "_Expression:"
+#~ msgstr "_Ausdruck:"
+
+#~ msgid "_Field:"
+#~ msgstr "_Feld:"
+
+#~ msgid "_Group values by:"
+#~ msgstr "_Gruppen-Wert nach:"
+
+#~ msgid "_Help"
+#~ msgstr "_Hilfe"
+
+#~ msgid "_List Events for"
+#~ msgstr "_Auflisten der Ereignissen nach"
+
+#~ msgid "_Log file:"
+#~ msgstr "_Protokolldatei:"
+
+#~ msgid "_Next Event"
+#~ msgstr "_Nächstes Ereignis"
+
+#~ msgid "_Open in new window"
+#~ msgstr "_In neuem Fenster öffnen"
+
+#~ msgid "_Path:"
+#~ msgstr "_Pfad:"
+
+#~ msgid "_Previous Event"
+#~ msgstr "_Vorheriges Ereignis"
+
+#~ msgid "_Save Configuration as..."
+#~ msgstr "_Speichere Konfiguration als..."
+
+#~ msgid "_Save layout as..."
+#~ msgstr "_Speichere Anordnung als…"
+
+#~ msgid "_Show as a chart"
+#~ msgstr "_Zeige als Diagramm"
+
+#~ msgid "_View"
+#~ msgstr "_Ansicht"
+
+#~ msgid "_Window"
+#~ msgstr "_Fenster"
+
+#~ msgid "gtk-about"
+#~ msgstr "gtk-about"
+
+#~ msgid "gtk-apply"
+#~ msgstr "gtk-apply"
+
+#~ msgid "gtk-close"
+#~ msgstr "gtk-close"
+
+#~ msgid "gtk-open"
+#~ msgstr "gtk-open"
+
+#~ msgid "gtk-properties"
+#~ msgstr "gtk-properties"
+
+#~ msgid "gtk-quit"
+#~ msgstr "gtk-quit"
+
+#~ msgid "Not enough data available"
+#~ msgstr "Nicht genügend Daten verfügbar"
+
+#~ msgid "Field"
+#~ msgstr "Feld"
+
+#~ msgid "Value"
+#~ msgstr "Wert"
+
+#~ msgid "Record Type"
+#~ msgstr "Aufzeichnungstyp"
+
+#~ msgid "date %s %s.%03d"
+#~ msgstr "Datum %s %s.%03d"
+
+#~ msgid "%x %H:%M:%S"
+#~ msgstr "%x %H:%M:%S"
+
+#~ msgid "date %s now"
+#~ msgstr "Datum %s heute"
+
+#~ msgid "date %s %d minute ago"
+#~ msgid_plural "date %s %d minutes ago"
+#~ msgstr[0] "Datum %s %d Minute vergangen"
+#~ msgstr[1] "Datum %s %d Minuten vergangen"
+
+#~ msgid "date %s today 00:00"
+#~ msgstr "Datum %s Heute 00:00"
+
+#~ msgid "date %s yesterday 00:00"
+#~ msgstr "Datum %s Gestern 00:00"
+
+#~ msgid "date %s start of this week"
+#~ msgstr "Datum %s Start dieser Woche"
+
+#~ msgid "date %s start of this month"
+#~ msgstr "Datum %s Start dieses Monat"
+
+#~ msgid "date %s start of this year"
+#~ msgstr "Datum %s Start von diesem Jahr"
+
+#~ msgid "Event date"
+#~ msgstr "Ereignisdatum"
+
+#~ msgid "Other fields"
+#~ msgstr "Andere Felder"
+
+#~ msgid "Column"
+#~ msgstr "Spalte"
+
+#~ msgid "Field name must not be empty"
+#~ msgstr "Feldname darf nicht leer sein"
+
+#~ msgid "_List"
+#~ msgstr "_Liste"
+
+#~ msgid "List %d"
+#~ msgstr "Liste %d"
+
+#~ msgid "HTML"
+#~ msgstr "HTML"
+
+#~ msgid "CSV"
+#~ msgstr "CSV"
+
+#~ msgid "Raw log data"
+#~ msgstr "Rohe Log-Daten"
+
+#~ msgid "Export..."
+#~ msgstr "Export..."
+
+#~ msgid "Error writing to %s: %s"
+#~ msgstr "Fehler beim Schreiben von %s: %s"
+
+#~ msgid ", "
+#~ msgstr ", "
+
+#~ msgid "None"
+#~ msgstr "Nichts"
+
+#~ msgid "Other Fields"
+#~ msgstr "Andere Felder"
+
+#~ msgid "Date"
+#~ msgstr "Datum"
+
+#~ msgid "%prog [OPTION]... [FILE]..."
+#~ msgstr "%prog [OPTION]... [DATEI]..."
+
+#~ msgid "Start an audit event viewer."
+#~ msgstr "Starte eine Audit-Ereignis-Betrachter"
+
+#~ msgid ""
+#~ "do not attempt to start the privileged backend for reading system audit "
+#~ "logs"
+#~ msgstr ""
+#~ "versuchen Sie nicht das privilegierte Backend zum Lesen der System-Audit-"
+#~ "Berichte zu starten"
+
+#~ msgid "Error running audit-viewer-server: %s"
+#~ msgstr "Fehler beim Laufenlassen von audit-viewer-server: %s"
+
+#~ msgid "Audit viewer layout"
+#~ msgstr "Audit-Ansicht-Anordnung"
+
+#~ msgid "A file named \"%s\" already exists. Do you want to replace it?"
+#~ msgstr "Die Datei \"%s\" existiert bereits. Wollen Sie sie ersetzen?"
+
+#~ msgid ""
+#~ "The file already exists in \"%s\". Replacing it will overwrite its "
+#~ "contents."
+#~ msgstr ""
+#~ "Die Datei existiert bereits in \"%s\" . Falls Sie sie ersetzen, wird ihre "
+#~ "Inhalt überschreiben."
+
+#~ msgid "_Replace"
+#~ msgstr "_Ersetzen"
+
+#~ msgid "Error reading audit events: %s"
+#~ msgstr "Fehler beim Lesen der Audit-Ereignisse: %s"
+
+#~ msgid "All files"
+#~ msgstr "Alle Dateien"
+
+#~ msgid "Unexpected top element contents"
+#~ msgstr "Unerwarteter Top-Elementinhalt"
+
+#~ msgid "Unsupported file version %s"
+#~ msgstr "Nicht unterstützte Datei-Version %s"
+
+#~ msgid "Unexpected top element"
+#~ msgstr "Unerwartetes Topelement"
+
+#~ msgid "Error reading %s: %s"
+#~ msgstr "Fehler beim Lesen %s: %s"
+
+#~ msgid "Invalid contents of %s: %s"
+#~ msgstr "Ungültiger Inhalt von %s: %s"
+
+#~ msgid "Open..."
+#~ msgstr "Öffnen..."
+
+#~ msgid "Save Layout As..."
+#~ msgstr "Sichere Aufbau als..."
+
+#~ msgid "Save Configuration As..."
+#~ msgstr "Sichere Konfiguration als..."
+
+#~ msgid "translator-credits"
+#~ msgstr "Fabian Affolter <fab@fedoraproject.org>, 2008."
+
+#~ msgid "no such option: %s"
+#~ msgstr "Keine solche Option: %s"
+
+#~ msgid "ambiguous option: %s (%s?)"
+#~ msgstr "Mehrdeutige Option: %s (%s?)"
+
+#~ msgid "Usage: %s\n"
+#~ msgstr "Verwendung: %s\n"
+
+#~ msgid "Usage"
+#~ msgstr "Verwendung"
+
+#~ msgid "integer"
+#~ msgstr "Ganzzahl"
+
+#~ msgid "long integer"
+#~ msgstr "Lange Ganzzahl"
+
+#~ msgid "floating-point"
+#~ msgstr "Gleitkomma"
+
+#~ msgid "complex"
+#~ msgstr "Komplex"
+
+#~ msgid "option %s: invalid %s value: %r"
+#~ msgstr "Option %s: ungültiger %s Wert: %r"
+
+#~ msgid "option %s: invalid choice: %r (choose from %s)"
+#~ msgstr "Option %s: ungültige Wahl: %r (Wahl von %s)"
+
+#~ msgid "show this help message and exit"
+#~ msgstr "Diese Hilfe-Meldung ausgeben und beenden"
+
+#~ msgid "show program's version number and exit"
+#~ msgstr "Version des Programms anzeigen und beenden"
+
+#~ msgid "%prog [options]"
+#~ msgstr "%prog [Optionen]"
+
+#~ msgid "%s option requires an argument"
+#~ msgstr "%s Option benötigt ein Argument"
+
+#~ msgid "%s option requires %d arguments"
+#~ msgstr "%s Option benötigt %d Argumente"
+
+#~ msgid "%s option does not take a value"
+#~ msgstr "%s Option benötigt keine Wert"
+
+#~ msgid "Options"
+#~ msgstr "Optionen"
+
+#~ msgid "_Report"
+#~ msgstr "_Bericht"
+
+#~ msgid "Report %d"
+#~ msgstr "Bericht %d"
+
+#~ msgid "Listing events for this column is not supported."
+#~ msgstr "Auflisten von Ereignissen für diese Spalte ist nicht unterstützt."
+
+#~ msgid "Listing events for this cell is not supported."
+#~ msgstr "Auflisten von Ereignissen für diese Zelle ist nicht unterstützt."
+
+#~ msgid "Listing events for this row is not supported."
+#~ msgstr "Auflisten von Ereignissen für diese Zeile ist nicht unterstützt."
+
+#~ msgid "Count"
+#~ msgstr "Anzahl"
+
+#~ msgid "Search..."
+#~ msgstr "Suche..."
+
+#~ msgid ""
+#~ "This program is only for use by audit-viewer and it should not be run "
+#~ "manually.\n"
+#~ msgstr ""
+#~ "Dieses Programm ist nur für die Benutzung durch audit-viewer und es "
+#~ "sollte nicht manuell gestartet werden.\n"
+
+#~ msgid ""
+#~ "\n"
+#~ "Report bugs to %s.\n"
+#~ msgstr ""
+#~ "\n"
+#~ "Melden Sie Fehler an %s.\n"
+
+#~ msgid ""
+#~ "Copyright (C) 2008 Red Hat, Inc. All rights reserved.\n"
+#~ "This software is distributed under the GPL v.2.\n"
+#~ "\n"
+#~ "This program is provided with NO WARRANTY, to the extent permitted by law."
+#~ msgstr ""
+#~ "Copyright (C) 2008 Red Hat, Inc. Alle Rechte vorbehalten.\n"
+#~ "Diese Software wird unter der GPL v.2 verteilt.\n"
+#~ "\n"
+#~ "Dieses Programm wird OHNE GEWÄHRLEISTUNG bereitgestellt, im gesetzlich "
+#~ "ermöglichten Umfang."
+
+#~ msgid "The control file is not a socket"
+#~ msgstr "Die Kontrolldatei ist keine Socket"
+
+#~ msgid "Unknown server request %<PRIu32>"
+#~ msgstr "Unbekannte Serveranforderung %<PRIu32>"
+
+#~ msgid "Audit Log File"
+#~ msgstr "Audit-Protokoll-Datei"
+
+#~ msgid "Error opening %s: %s"
+#~ msgstr "Fehler beim Öffnen von %s: %s"
+
+#~ msgid "%x %X"
+#~ msgstr "%x %X"
+
+#~ msgid "%x %H:%M"
+#~ msgstr "%x %H:%M"
+
+#~ msgid "%x %H"
+#~ msgstr "%x %H"
+
+#~ msgid "hour"
+#~ msgstr "Stunde"
+
+#~ msgid "%d hour"
+#~ msgid_plural "%d hours"
+#~ msgstr[0] "%d Stunde"
+#~ msgstr[1] "%d Stunden"
+
+#~ msgid "minute"
+#~ msgstr "Minute"
+
+#~ msgid "%d minute"
+#~ msgid_plural "%d minutes"
+#~ msgstr[0] "%d Minute"
+#~ msgstr[1] "%d Minuten"
+
+#~ msgid "second"
+#~ msgstr "Sekunde"
+
+#~ msgid "%d second"
+#~ msgid_plural "%d seconds"
+#~ msgstr[0] "%d Sekunde"
+#~ msgstr[1] "%d Sekunden"
+
+#~ msgid "day"
+#~ msgstr "Tag"
+
+#~ msgid "week"
+#~ msgstr "Woche"
+
+#~ msgid "%b %Y"
+#~ msgstr "%b %Y"
+
+#~ msgid "month"
+#~ msgstr "Monat"
+
+#~ msgid "Specific time"
+#~ msgstr "Angegebene Zeit"
+
+#~ msgid "Now"
+#~ msgstr "Jetzt"
+
+#~ msgid "10 minutes ago"
+#~ msgstr "Vor 10 Minuten"
+
+#~ msgid "Today"
+#~ msgstr "Heute"
+
+#~ msgid "Yesterday"
+#~ msgstr "Gestern"
+
+#~ msgid "This week"
+#~ msgstr "Diese Woche"
+
+#~ msgid "This month"
+#~ msgstr "Diesen Monat"
+
+#~ msgid "This year"
+#~ msgstr "Dieses Jahr"
+
+#~ msgid "Unsupported date filter \"%s\""
+#~ msgstr "Nicht unterstützter Datumsfilter \"%s\""
+
+#~ msgid "Rule"
+#~ msgstr "Regel"
+
+#~ msgid "Unsupported timestamp operator in \"%s\""
+#~ msgstr "Nicht unterstützter Zeitstempel in \"%s\""
+
+#~ msgid "Editing of some filters is not supported"
+#~ msgstr "Bearbeiten von gewissen Filtern ist nicht unterstützt"
+
+#~ msgid ""
+#~ "If you edit properties of this tab, these filters will be dropped from "
+#~ "the tab's configuration:\n"
+#~ "%s\n"
+#~ "Do you still want to edit properties of this tab?"
+#~ msgstr ""
+#~ "Wenn Sie die Eigenschaften dieses Registers bearbeiten, diese Filter aus "
+#~ "der Register-Konfiguration werden verworfen:\n"
+#~ "%s\n"
+#~ "Wollen Sie immer nich die Eigenschaften dieses Registers bearbeiten?"
+
+#~ msgid "Tab name must not be empty"
+#~ msgstr "Tab-Name darf nicht leer sein"
+
+#~ msgid "%s Properties"
+#~ msgstr "%s-Eigenschaften"
+
+#~ msgid "Invalid <%s %s> value %s"
+#~ msgstr "Ungültiger <%s %s>-Wert %s"
+
+#~ msgid "Unknown <%s %s> value %s"
+#~ msgstr "Wert <%s %s> unbekannt %s"
+
+#~ msgid "Attribute %s missing in <%s>"
+#~ msgstr "Fehlendes %s-Attribut in <%s>"
+
+#~ msgid "Audit Logs"
+#~ msgstr "Audit-Protokolle"
+
+#~ msgid "View audit logs"
+#~ msgstr "Audit-Protokoll ansehen"
+
+#~ msgid "Report Properties"
+#~ msgstr "Bericht-Eigenschaften"
+
+#~ msgid "_File"
+#~ msgstr "_Datei"
diff --git a/po/el.po b/po/el.po
new file mode 100644
index 0000000..53c53fb
--- /dev/null
+++ b/po/el.po
@@ -0,0 +1,840 @@
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+#
+# Dimitris Glezos <dimitris@glezos.com>, 2008.
+# Thalia Papoutsaki <saliyath@gmail.com>, 2009.
+msgid ""
+msgstr ""
+"Project-Id-Version: el\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-10-26 14:42+0200\n"
+"Last-Translator: Thalia Papoutsaki <saliyath@gmail.com>\n"
+"Language-Team: American English <fedora-trans-el@redhat.com>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KAider 0.1\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "Εντάξει"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Η λειτουÏγία απέτυχε"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Κακή κατάσταση"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Λανθασμένο όνομα εξυπηÏετητή"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Λανθασμένο όνομα domain"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Δεν υπάÏχει διαθέσιμο Ï€Ïωτόκολλο δικτÏου"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Λανθασμένο DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr ""
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Μη έγκυÏη καταγÏαφή"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Μη έγκυÏο όνομα υπηÏεσίας"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Μη έγκυÏος Ï„Ïπος υπηÏεσίας"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Μη έγκυÏος αÏιθμός θÏÏας"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Μη έγκυÏη καταγÏαφή κλειδιοÏ"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Μη έγκυÏη διεÏθυνση"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr ""
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Μεγάλος αÏιθμός πελατών"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Μεγάλος αÏιθμός αντικειμένων"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Μεγάλος αÏιθμός καταχωÏήσεων"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Σφάλμα OS"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Αποτυχία Ï€Ïόσβασης"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Λανθασμένη λειτουÏγία"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr ""
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr ""
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr ""
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr ""
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr ""
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr ""
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr ""
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr ""
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Δε βÏέθηκε"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Λανθασμένη ÏÏθμιση"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr ""
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr ""
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr ""
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr ""
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Αποτυχία DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Αποτυχία DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Αποτυχία DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Αποτυχία DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Αποτυχία DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Αποτυχία DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Αποτυχία DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Αποτυχία DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Αποτυχία DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Αποτυχία DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Μη έγκυÏο RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Μη έγκυÏος Ï„Ïπος DNS"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr ""
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Δεν υποστηÏίζεται"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Δεν επιτÏέπεται"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Λανθασμένο ÏŒÏισμα "
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Είναι κενό"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr ""
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Δεν επιλέχθηκε υπηÏεσία.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Είναι κενό"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Μη έγκυÏος Ï„Ïπος υπηÏεσίας"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Όνομα ΥπηÏεσίας"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "ΔιεÏθυνση"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+#, fuzzy
+msgid "Service Type"
+msgstr "Μη έγκυÏος Ï„Ïπος υπηÏεσίας"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Όνομα ΥπηÏεσίας"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "ΔιεÏθυνση"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+#, fuzzy
+msgid "Host Name"
+msgstr "Όνομα"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Μη έγκυÏο όνομα υπηÏεσίας"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Μη έγκυÏο όνομα υπηÏεσίας"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Αποτυχία Avahi client: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Αποτυχία Avahi resolver: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "μη διαθέσιμο"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1144
+#, fuzzy
+msgid "Location"
+msgstr "ΠεÏιοχή"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Όνομα"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "ΤÏπος"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr ""
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:151
+#, fuzzy
+msgid "Desktop"
+msgstr "Επιφάνεια εÏγασίας"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "ΣÏνδεση με το '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "ΑκυÏώθηκε.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "ΑποσÏνδεση, γίνεται επανασÏνδεση ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Αποτυχία εγγÏαφής: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [options] %s <name> <type> <port> [<txt ...>]\n"
+"%s [options] %s <host-name> <address>\n"
+"\n"
+" -h --help Εμφάνιση βοήθειας\n"
+" -V --version Εμφάνιση έκδοσης\n"
+" -s --service Δημοσίευση υπηÏεσίας\n"
+" -a --address Δημοσίευση διεÏθυνσης\n"
+" -v --verbose ΕνεÏγοποίηση verbose mode\n"
+" -d --domain=DOMAIN Domain για τη δημοσίευση υπηÏεσίας\n"
+" -H --host=DOMAIN Host όπου υπάÏχει η υπηÏεσία\n"
+" --subtype=SUBTYPE Ένας επιπλέον Ï„Ïπος για καταχώÏηση της υπηÏεσίας\n"
+" -f --no-fail Îα μη γίνει αποτυχία αν αυτή η υπηÏεσία συστήματος "
+"δεν είναι διαθέσιμη\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [επιλογές] %s <host name ...>\n"
+"%s [επιλογές] %s <διεÏθυνση ... >\n"
+"\n"
+" -h --help Εμφάνιση βοήθειας\n"
+" -V --version Εμφάνιση έκδοσης\n"
+" -n --name ΜετάφÏαση host name\n"
+" -a --address ΜετάφÏαση διεÏθυνσης\n"
+" -v --verbose ΕνεÏγοποίηση verbose mode\n"
+" -6 Αναζήτηση διεÏθυνσης IPv6\n"
+" -4 Αναζήτηση διεÏθυνσης IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [επιλογές] <νέο host name>\n"
+"\n"
+" -h --help Εμφάνιση βοήθειας\n"
+" -V --version Εμφάνιση έκδοσης\n"
+" -v --verbose ΕνεÏγοποίηση verbose mode\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Επιτυχής αλλαγή του host name σε %s\n"
diff --git a/po/en_AU.po b/po/en_AU.po
new file mode 100644
index 0000000..5e8918d
--- /dev/null
+++ b/po/en_AU.po
@@ -0,0 +1,797 @@
+# British English translation
+# This file is distributed under the same license as the Avahi package.
+# Ted Percival <ted@midg3t.net>, 2008.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2008-03-31 15:24+1000\n"
+"Last-Translator: Ted Percival <ted@midg3t.net>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr ""
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr ""
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr ""
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr ""
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr ""
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr ""
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr ""
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr ""
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr ""
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr ""
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr ""
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr ""
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr ""
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr ""
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr ""
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr ""
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr ""
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr ""
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr ""
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr ""
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr ""
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr ""
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr ""
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr ""
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr ""
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr ""
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr ""
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr ""
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr ""
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr ""
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr ""
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr ""
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr ""
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr ""
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr ""
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr ""
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr ""
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr ""
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr ""
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr ""
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr ""
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr ""
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr ""
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr ""
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr ""
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr ""
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr ""
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr ""
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr ""
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr ""
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr ""
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr ""
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr ""
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Initialising..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr ""
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancelled.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr ""
diff --git a/po/en_CA.po b/po/en_CA.po
new file mode 100644
index 0000000..3c28764
--- /dev/null
+++ b/po/en_CA.po
@@ -0,0 +1,797 @@
+# Canadian English translation
+# This file is distributed under the same license as the Avahi package.
+# Ted Percival <ted@midg3t.net>, 2008.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2008-03-31 15:24+1000\n"
+"Last-Translator: Ted Percival <ted@midg3t.net>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr ""
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr ""
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr ""
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr ""
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr ""
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr ""
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr ""
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr ""
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr ""
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr ""
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr ""
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr ""
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr ""
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr ""
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr ""
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr ""
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr ""
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr ""
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr ""
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr ""
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr ""
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr ""
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr ""
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr ""
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr ""
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr ""
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr ""
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr ""
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr ""
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr ""
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr ""
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr ""
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr ""
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr ""
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr ""
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr ""
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr ""
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr ""
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr ""
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr ""
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr ""
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr ""
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr ""
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr ""
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr ""
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr ""
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr ""
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr ""
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr ""
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr ""
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr ""
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr ""
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr ""
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr ""
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancelled.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr ""
diff --git a/po/en_GB.po b/po/en_GB.po
new file mode 100644
index 0000000..aab6526
--- /dev/null
+++ b/po/en_GB.po
@@ -0,0 +1,858 @@
+# British English translation of Avahi
+# Copyright (C) 2009 Avahi's COPYRIGHT HOLDER
+# This file is distributed under the same licence as the Avahi package.
+# Bruce Cowan <bcowan@fastmail.co.uk>, 2009.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-11-11 17:00+0000\n"
+"Last-Translator: Bruce Cowan <bcowan@fastmail.co.uk>\n"
+"Language-Team: British English <en@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=( n != 1 );\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operation failed"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Bad state"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Invalid host name"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Invalid domain name"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "No suitable network protocol available"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Invalid DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Resource record key is pattern"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Local name collision"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Invalid record"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Invalid service name"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Invalid service type"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Invalid port number"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Invalid record key"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Invalid address"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Timeout reached"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Too many clients"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Too many objects"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Too many entries"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "OS Error"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Access denied"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Invalid operation"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "An unexpected D-Bus error occurred"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Daemon connection failed"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memory exhausted"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "The object passed in was not valid"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Daemon not running"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Invalid interface index"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Invalid protocol specification"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Invalid flags"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Not found"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Invalid configuration"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Version mismatch"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Invalid service subtype"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Invalid packet"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Invalid DNS return code"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS failure: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS failure: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS failure: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS failure: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS failure: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS failure: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS failure: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS failure: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS failure: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS failure: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Invalid RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Invalid DNS type"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Invalid DNS class"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Not supported"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Not permitted"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Invalid argument"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Is empty"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "The requested operation is invalid because redundant"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Invalid Error Code"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>No service currently selected.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi Discovery"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf Browser"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Browse for Zeroconf services available on your network"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "TXT Data"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Is empty"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Service Type"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Service Name"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Domain"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Address"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Browse Service Types"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "A NULL terminated list of service types to browse for"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domain"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "The domain to browse in, or NULL for the default domain"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Service Type"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "The service type of the selected service"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Service Name"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "The service name of the selected service"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Address"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "The address of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "The IP port number of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Host Name"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "The host name of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT Data"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "The TXT data of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Resolve service"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Resolve service host name"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Address family"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "The address family for host name resolution"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi client failure: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi resolver failure: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Browsing for service type %s in domain %s failed: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi domain browser failure: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Failed to read Avahi domain: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Browse service type list is empty!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Failed to connect to Avahi server: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Browsing for services on <b>local network</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Browsing for services in domain <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Failed to create browser for %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Failed to create resolver for %s of type %s in domain %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Failed to create domain browser: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Change domain"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Browsing..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Initialising..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Location"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Name"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Type"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domain..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Too many arguments\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Choose Shell Server"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Desktop"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Choose VNC server"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Choose SSH server"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Connecting to '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() failed: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancelled.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH Server Browser"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Browse for Zeroconf-enabled SSH Servers"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC Server Browser"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Browse for Zeroconf-enabled VNC Servers"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": All for now\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Cache exhausted\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Failed to query version string: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Failed to query host name: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Server version: %s; Host name: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifce Prot Domain\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s Domain\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Disconnected, reconnecting ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Failed to create client object: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Client failure, exiting: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Waiting for daemon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -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"
+" -p --parsable Output in parsable format\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Too few arguments\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Failed to create simple poll object.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Established under name '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Failed to register: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Name collision, picking new name '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Failed to create entry group: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Failed to add address: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Failed to add service: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Failed to add subtype '%s': %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Host name conflict\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%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"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Bad number of arguments\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Failed to parse port number: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "No command specified.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Failed to resolve host name '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Failed to resolve address '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%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"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Failed to create host name resolver: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Failed to parse address '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Failed to create address resolver: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Invalid number of arguments, expecting exactly one.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Host name successfully changed to %s\n"
diff --git a/po/en_NZ.po b/po/en_NZ.po
new file mode 100644
index 0000000..aab6526
--- /dev/null
+++ b/po/en_NZ.po
@@ -0,0 +1,858 @@
+# British English translation of Avahi
+# Copyright (C) 2009 Avahi's COPYRIGHT HOLDER
+# This file is distributed under the same licence as the Avahi package.
+# Bruce Cowan <bcowan@fastmail.co.uk>, 2009.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-11-11 17:00+0000\n"
+"Last-Translator: Bruce Cowan <bcowan@fastmail.co.uk>\n"
+"Language-Team: British English <en@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=( n != 1 );\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operation failed"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Bad state"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Invalid host name"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Invalid domain name"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "No suitable network protocol available"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Invalid DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Resource record key is pattern"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Local name collision"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Invalid record"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Invalid service name"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Invalid service type"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Invalid port number"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Invalid record key"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Invalid address"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Timeout reached"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Too many clients"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Too many objects"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Too many entries"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "OS Error"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Access denied"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Invalid operation"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "An unexpected D-Bus error occurred"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Daemon connection failed"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memory exhausted"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "The object passed in was not valid"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Daemon not running"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Invalid interface index"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Invalid protocol specification"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Invalid flags"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Not found"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Invalid configuration"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Version mismatch"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Invalid service subtype"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Invalid packet"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Invalid DNS return code"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS failure: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS failure: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS failure: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS failure: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS failure: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS failure: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS failure: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS failure: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS failure: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS failure: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Invalid RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Invalid DNS type"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Invalid DNS class"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Not supported"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Not permitted"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Invalid argument"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Is empty"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "The requested operation is invalid because redundant"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Invalid Error Code"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>No service currently selected.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi Discovery"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf Browser"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Browse for Zeroconf services available on your network"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "TXT Data"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Is empty"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Service Type"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Service Name"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Domain"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Address"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Browse Service Types"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "A NULL terminated list of service types to browse for"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domain"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "The domain to browse in, or NULL for the default domain"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Service Type"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "The service type of the selected service"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Service Name"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "The service name of the selected service"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Address"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "The address of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "The IP port number of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Host Name"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "The host name of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT Data"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "The TXT data of the resolved service"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Resolve service"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Resolve service host name"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Address family"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "The address family for host name resolution"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi client failure: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi resolver failure: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Browsing for service type %s in domain %s failed: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi domain browser failure: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Failed to read Avahi domain: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Browse service type list is empty!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Failed to connect to Avahi server: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Browsing for services on <b>local network</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Browsing for services in domain <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Failed to create browser for %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Failed to create resolver for %s of type %s in domain %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Failed to create domain browser: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Change domain"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Browsing..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Initialising..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Location"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Name"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Type"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domain..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Too many arguments\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Choose Shell Server"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Desktop"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Choose VNC server"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Choose SSH server"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Connecting to '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() failed: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancelled.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH Server Browser"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Browse for Zeroconf-enabled SSH Servers"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC Server Browser"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Browse for Zeroconf-enabled VNC Servers"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": All for now\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Cache exhausted\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() failed: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Failed to query version string: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Failed to query host name: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Server version: %s; Host name: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifce Prot Domain\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s Domain\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Disconnected, reconnecting ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Failed to create client object: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Client failure, exiting: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Waiting for daemon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -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"
+" -p --parsable Output in parsable format\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Too few arguments\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Failed to create simple poll object.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Established under name '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Failed to register: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Name collision, picking new name '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Failed to create entry group: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Failed to add address: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Failed to add service: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Failed to add subtype '%s': %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Host name conflict\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%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"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Bad number of arguments\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Failed to parse port number: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "No command specified.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Failed to resolve host name '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Failed to resolve address '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%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"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Failed to create host name resolver: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Failed to parse address '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Failed to create address resolver: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Invalid number of arguments, expecting exactly one.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Host name successfully changed to %s\n"
diff --git a/po/es.po b/po/es.po
new file mode 100644
index 0000000..56974da
--- /dev/null
+++ b/po/es.po
@@ -0,0 +1,864 @@
+# Fedora Spanish translation for avahi
+# This file is distributed under the same license as the avahi package.
+#
+# Carlos Albornoz <caralbornozc@gmail.com>, 2010
+# Jorge González <jorgegonz@svn.gnome.org>, 2008, 2010.
+# Héctor Daniel Cabrera <logan@fedoraproject.org>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-06-30 20:33-0300\n"
+"Last-Translator: Héctor Daniel Cabrera <logan@fedoraproject.org>\n"
+"Language-Team: Fedora Spanish <trans-es@lists.fedoraproject.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2008-10-27 02:52+0000\n"
+"X-Generator: Launchpad (build Unknown)\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-Language: Spanish\n"
+"X-Poedit-Country: ARGENTINA\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "Aceptar"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Falló la operación"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Estado incorrecto"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nombre de equipo no válido"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nombre de dominio no válido"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "No hay disponible ningún protocolo de red apropiado"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "El TTL del DNS no es válido"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "La clave del recurso de registro es un patrón"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Colisión de nombre local"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Registro no válido"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nombre de servicio no válido"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Tipo de servicio no válido"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Número de puerto no válido"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Clave de registro no válida"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Dirección no válida"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Se ha alcanzado el tiempo de espera establecido"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Demasiados clientes"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Demasiados objetos"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Demasiadas entradas"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Error de SO"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Acceso denegado"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Operación no válida"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Ocurrió un error de D-Bus no esperado"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Falló la conexión con el demonio"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memoria agotada"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "El objeto pasado no era válido"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "El demonio no se está ejecutando"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ãndice de interfaz no válido"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Especificación de protocolo no válida"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Opciones no válidas"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "No encontrado"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Configuración no válida"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Incompatibilidad de versiones"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Subtipo de servicio no válido"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Paquete no válido"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Código de retorno de DNS no válido"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Fallo de DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Fallo de DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Fallo de DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Fallo de DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Fallo de DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Fallo de DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Fallo de DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Fallo de DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Fallo de DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Fallo de DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA no válido"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Tipo de DNS no válido"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Clase de DNS no válida"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "No soportado"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "No permitido"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argumento no válido"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Está vacío"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "La operación solicitada no es válida porque es redundante"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Código de error no válido"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>No hay un servicio actualmente seleccionado.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Descubrimiento de Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Navegador Zeroconf de Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Navegar en busca de servicios Zeroconf disponibles en su red"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Datos TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "vacío"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Tipo de servicio:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Nombre del servicio:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Nombre del dominio:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Interfaz:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Dirección:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Tipos de Servicios a Examinar"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Una lista terminada en NULL con los tipos de servicios a buscar"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Dominio"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "El dominio a examinar, o NULL para el dominio predeterminado"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tipo de Servicio"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "El tipo de servicio del servicio seleccionado"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nombre del servicio"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "El nombre de servicio del servicio seleccionado"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Dirección"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "La dirección del servicio resuelto"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Puerto"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "El número de puerto IP del servicio resuelto"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nombre de Equipo"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "El nombre de equipo del servicio resuelto"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Datos TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Los datos TXT del servicio resuelto"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Resolver servicio"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+"Resolver el servicio seleccionado de manera automática antes de la devolución"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Resolver el nombre de equipo del servicio"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"Resolver el nombre del equipo del servicio seleccionado de manera automática "
+"antes de la devolución"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Familia de direcciones"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "La familia de direcciones para la resolución de nombre de equipo"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Fallo del cliente de Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Fallo del resolutor de Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Falló la exploración del tipo de servicio %s en el dominio %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/d"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Fallo de exploración de dominios de Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Falló al leer el dominio de Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "¡La lista de Tipos de Servicios está vacía!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Falló al conectar con el servidor de Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Examinando los servicios en la <b>red local</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Examinando los servicios en el dominio <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Falló al crear el examinador para %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Falló al crear el resolutor para %s de tipo %s en el dominio %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Falló al crear el dominio de exploración: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Cambiar el dominio"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Examinando…"
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Inicializando…"
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Ubicación"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nombre"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Tipo"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Dominio…"
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opciones]\n"
+"\n"
+" -h --help Mostrar esta ayuda\n"
+" -s --ssh Examinar servidores SSH\n"
+" -v --vnc Examinar servidores VNC\n"
+" -S --shell Examinar servidores SSH y VNC\n"
+" -d --domain=DOMINIO El dominio que examinar\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Demasiados argumentos\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Elegir el servidor de intérprete de comandos"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Escritorio"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Elegir el servidor VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Elegir el servidor SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Conectando con «%s» …\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() falló: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancelado.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Examinador de servidores SSH de Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Examinar servidores SSH con zeroconf activado"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Examinador de servidores VNC de Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Examinar servidores VNC con zeroconf activado"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Todo por ahora\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Caché agotada\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Error al resolver el servicio «%s» de tipo «%s» en el dominio «%s»: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Falló service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Falló avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Falló service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Falló avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Falló avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Error al consultar la cadena de versión: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Error al consultar el nombre del equipo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Versión del servidor: %s; Nombre del equipo: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifaz Prot Dominio\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifaz Prot %-*s %-20s Dominio\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Desconectado; volviendo a conectar…\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Falló al crear el objeto cliente: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Fallo del cliente; saliendo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Esperando al demonio…\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Muestra esta ayuda\n"
+" -V --version Muestra la versión\n"
+" -D --browse-domains Explora dominios de búsqueda en lugar de servicios\n"
+" -a --all Muestra todos los servicios independientemente del "
+"tipo.\n"
+" -d --domain=DOMAIN El dominio que examinar\n"
+" -v --verbose Activa el modo detallado\n"
+" -t --terminate Terminar al volcar una lista más o menos completa\n"
+" -c --cache Terminar después de volcar todas las entradas de la "
+"cache\n"
+" -l --ignore-local Ignorar los servicios locales\n"
+" -r --resolve Resolver servicios encontrados\n"
+" -f --no-fail No fallar si el demonio no está disponible\n"
+" -p --parsable Salida en formato analizable\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup No busca los tipos de servicios\n"
+" -b --dump-db Vuelva la base de datos de tipos de servicios\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Muy pocos argumentos\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Falló al crear un objeto de encuesta simple.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Establecido bajo el nombre «%s»\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Falló al registrar: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Colisión de nombres; se usa el nombre nuevo «%s».\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Falló al crear el grupo de la entrada: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Falló al añadir la dirección: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Falló al añadir el servicio: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Falló al añadir el subtipo «%s»: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Conflicto de nombres de equipo\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opciones] %s <nombre> <tipo> <puerto> [<txt …>]\n"
+"%s [opciones] %s <nombre-del-equipo> <dirección>\n"
+"\n"
+" -h --help Mostrar esta ayuda\n"
+" -V --version Mostrar la versión\n"
+" -s --service Publicar el servicio\n"
+" -a --address Publicar la dirección\n"
+" -v --verbose Activar el modo detallado\n"
+" -d --domain=DOMINIO Dominio donde publicar el servicio\n"
+" -H --host=DOMINIO Equipo donde reside el servicio\n"
+" --subtype=SUBTIPO Un subtipo adicional con el que registrar este "
+"servicio\n"
+" -R --no-reverse No publicar entrada de reverso con esta dirección\n"
+" -f --no-fail No fallar en caso que el demonio no esté "
+"disponible\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Número de argumentos incorrecto\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Falló al analizar el número de puerto: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "No se especificó ningún comando.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Error al resolver el nombre del equipo «%s»: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Error al resolver la dirección «%s»: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opciones] %s <nombre del servidor …>\n"
+"%s [opciones] %s <dirección …>\n"
+"\n"
+" -h --help Mostrar esta ayuda\n"
+" -V --version Mostrar la versión\n"
+" -n --name Resolver el nombre del servidor\n"
+" -a --address Resolver la dirección\n"
+" -v --vervose Activar el modo detallado\n"
+" -6 Buscar dirección IPv6\n"
+" -4 Buscar dirección IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Falló al crear el resolutor de nombres de equipo: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Falló al analizar la dirección «%s»\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Falló al crear el resolutor de direcciones: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opciones] <nuevo nombre de servidor>\n"
+"\n"
+" -h --help Mostrar esta ayuda\n"
+" -V --version Mostrar la versión\n"
+" -v --verbose Activar el modo detallado\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Número de argumentos incorrecto; se esperaba exactamente uno.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "El nombre del equipo se ha cambiado con éxito a %s\n"
diff --git a/po/fi.po b/po/fi.po
new file mode 100644
index 0000000..d37ec3a
--- /dev/null
+++ b/po/fi.po
@@ -0,0 +1,853 @@
+# Avahi Finnish translation.
+# Copyright (C) 2008-2009 Timo Jyrinki
+# This file is distributed under the same license as the avahi package.
+# Timo Jyrinki <timo.jyrinki@iki.fi>, 2008-2009.
+# Ville-Pekka Vainio <vpivaini@cs.helsinki.fi>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-10-31 12:00+0200\n"
+"Last-Translator: Ville-Pekka Vainio <vpivaini@cs.helsinki.fi>\n"
+"Language-Team: Finnish <gnome-fi-laatu@lists.sourceforge.net>\n"
+"Language: fi\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Virtaal 0.6.1\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Toiminto epäonnistui"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Huono tila"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Kelvoton verkkonimi"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Kelvoton verkkoalueen nimi"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Sopivaa verkkoyhteyskäytäntöä ei ole saatavilla"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Virheellinen DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Resurssin tietueavain on lauseke"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Paikallinen nimien yhteentörmäys"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Virheellinen tietue"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Virheellinen palvelun nimi"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Virheellinen palvelun tyyppi"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Virheellinen porttinumero"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Virheellinen tietueavain"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Virheellinen osoite"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Tapahtui aikakatkaisu"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Liian monta asiakasta"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Liian monta objektia"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Liian monta kohdetta"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "OS-virhe"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Pääsy evätty"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Virheellinen toiminto"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Tapahtui odottamaton D-Bus-virhe"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Taustaprosessiyhteys epäonnistui"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Muisti loppui"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Annettu objekti ei ollut kelvollinen"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Taustaprosessi ei käynnissä"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Virheellinen liitännän järjestysnumero"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Virheellinen yhteyskäytännön määrittely"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Virheelliset liput"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ei löytynyt"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Virheelliset asetukset"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Versioristiriita"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Virheellinen palvelun alatyyppi"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Virheellinen paketti"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Virheellinen DNS-palautuskoodi"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS-toimintahäiriö: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS-toimintahäiriö: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS-toimintahäiriö: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS-toimintahäiriö: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS-toimintahäiriö: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS-toimintahäiriö: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS-toimintahäiriö: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS-toimintahäiriö: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS-toimintahäiriö: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS-toimintahäiriö: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Virheellinen RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Virheellinen DNS-tyyppi"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Virheellinen DNS-luokka"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ei tuettu"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Ei sallittu"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Virheellinen argumentti"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "On tyhjä"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Pyydetty toiminto on tarpeettomuudesta johtuen virheellinen"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Kelvoton virhekoodi"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Palvelua ei tällä hetkellä ole valittu.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi-löytäjä"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahin Zeroconf-selain"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Selaa verkossa saatavilla olevia Zeroconf-palveluita"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT-data:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "tyhjä"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Palvelun tyyppi:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Palvelun nimi:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Verkkotunnus:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Verkkoliitäntä:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Osoite:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Selaa palvelutyyppejä"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "NULL-päätetty luettelo selattavista palvelutyypeistä"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Verkkoalue"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Selattava verkkoalue, tai NULL oletusverkkoalueen valitsemiseksi"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Palvelun tyyppi"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Valitun palvelun palvelutyyppi"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Palvelun nimi"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Valitun palvelun palvelunimi"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Osoite"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Selvitetyn palvelun osoite"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Portti"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Selvitetyn palvelun IP-porttinumero"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Verkkonimi"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Selvitetyn palvelun verkkonimi"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT-data"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Selvitetyn palvelun TXT-data"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Selvitä palvelu"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Selvitä valittu palvelu automaattisesti ennen palaamista"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Selvitä palvelun verkkonimi"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "Selvitä valitun palvelun verkkonimi automaattisesti ennen palaamista"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Osoiteperhe"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Osoiteperhe verkkonimen selvittämistä varten"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi-asiakkaan toimintahäiriö: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi-selvittimen toimintahäiriö: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Palvelutyypin %s selaaminen verkkoaluuessa %s epäonnistui: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "-"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi-verkkoalueselaimen toimintahäiriö: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Avahi-verkkoaluetta ei voi lukea: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Selattavien palvelutyyppien luettelo on tyhjä."
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Avahi-palvelimeen ei voi yhdistää: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Selataan palveluita <b>paikallisessa verkossa</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Selataan palveluita verkkoalueessa <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Selainta ei voi luoda kohteelle %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Kohteelle %s ei voi luoda selvitintyyppiä %s verkkoalueessa %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Verkkoalueselainta ei voi luoda: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Vaihda verkkoaluetta"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Selataan..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Alustetaan..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Sijainti"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nimi"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Tyyppi"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Verkkoalue..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [valitsimet]\n"
+"\n"
+" -h --help Näytä tämä ohje\n"
+" -s --ssh Selaa SSH-palvelimia\n"
+" -v --vnc Selaa VNC-palvelimia\n"
+" -S --shell Selaa sekä SSH- että VNC-palvelimia\n"
+" -d --domain=DOMAIN Selattava verkkoalue\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Liian monta argumenttia\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Valitse päätepalvelin"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Työpöytä"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Pääte"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Valitse VNC-palvelin"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Valitse SSH-palvelin"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Yhdistetään kohteeseen \"%s\"...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() epäonnistui: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Peruttu.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahin SSH-palvelinselain"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Selaa Zeroconf-varustettuja SSH-palvelimia"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahin VNC-palvelinselain"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Selaa Zeroconf-varustettuja VNC-palvelimia"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Kaikki toistaiseksi\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Välimuisti kulutettu loppuun\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Palvelua \"%s\", tyypiltään \"%s\", ei voi selvittää verkkoalueessa \"%s\": "
+"%s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Versiomerkkijonon pyyntö epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Verkko-osoitteen pyyntö epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Palvelimen versio: %s, verkkonimi: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "T Liit Yhtk Verkkonimi\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "T Liit Yhtk %-*s %-20s Verkkonimi\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Yhteys katkaistiin, yhdistetään uudelleen...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Asiakasobjektia ei voi luoda: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Asiakkaan toimintahäiriö, poistutaan: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Odotetaan taustaprosessia...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Näytä tämä ohje\n"
+" -V --version Näytä versio\n"
+" -D --browse-domains Selaa selaavia verkkoalueita palveluiden sijaan\n"
+" -a --all Näytä kaikki palvelut tyypistä riippumatta\n"
+" -d --domain=DOMAIN Selattava verkkoalue\n"
+" -v --verbose Ota käyttöön suulaampi tila\n"
+" -t --terminate Poistu enemmän tai vähemmän täydellisen luettelon "
+"tulostuksen jälkeen\n"
+" -c --cache Poistu kun kaikki kohteet tulostettu välimuistista\n"
+" -l --ignore-local Jätä paikalliset palvelut huomiotta\n"
+" -r --resolve Selvitä löydetyt palvelut\n"
+" -f --no-fail Älä epäonnistu jos taustaprosessia ei saatavilla\n"
+" -p --parsable Tulosta jäsennettävissä olevassa muodossa\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Älä etsi palvelutyyppejä\n"
+" -b --dump-db Tulosta palvelutyyppien tietokanta\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Liian vähän argumentteja\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Yksinkertaisen kyselyobjektin luonti epäonnistui.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Muodostettiin nimellä \"%s\"\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Rekisteröiminen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Nimien yhteentörmäys, valitaan uusi nimi \"%s\".\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Kohderyhmän luominen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Osoitteen lisääminen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Palvelun lisääminen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Alatyypin \"%s\" lisääminen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Palvelinnimen ristiriita\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [valitsimet] %s <nimi> <tyyppi> <portti> [<teksti ...>]\n"
+"%s [valitsimet] %s <verkkonimi> <osoite>\n"
+"\n"
+" -h --help Näytä ohje\n"
+" -V --version Näytä versio\n"
+" -s --service Julkista palvelu\n"
+" -a --address Julkista osoite\n"
+" -v --verbose Ota suulaampi tila käyttöön\n"
+" -d --domain=DOMAIN Verkkoalue jossa palvelu julkaistaan\n"
+" -H --host=DOMAIN Palvelin jolla palvelu sijaitsee\n"
+" --subtype=SUBTYPE Lisäalatyyppi, jolle tämä palvelu rekisteröidään\n"
+" -f --no-fail Älä epäonnistui jos taustaprosessia ei saatavilla\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Virheellinen argumenttien lukumäärä\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Porttinumeron jäsentäminen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Komentoa ei määritelty.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Verkko-osoitteen \"%s\" selvittäminen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Osoitteen \"%s\" selvittäminen epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [valitsimet] %s <verkkonimi ...>\n"
+"%s [valitsimet] %s <osoite ... >\n"
+"\n"
+" -h --help Näytä ohje\n"
+" -V --version Näytä versio\n"
+" -n --name Selvitä verkkonimi\n"
+" -a --address Selvitä osoite\n"
+" -v --verbose Ota suulaampi tila käyttöön\n"
+" -6 Etsi IPv6-osoite\n"
+" -4 Etsi IPv4-osoite\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Verkko-osoitteen selvittimen luonti epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Osoitetta \"%s\" ei voi jäsentää\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Osoitteen selvittimen luonti epäonnistui: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [valitsimet] <uusi verkkonimi>\n"
+"\n"
+" -h --help Näytä tämä ohje\n"
+" -V --version Näytä versio\n"
+" -v --verbose Ota suulaampi tila käyttöön\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Virheellinen argumenttien lukumäärä, odotettiin täsmälleen yhtä.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Verkko-osoite muutettiin onnistuneesti nimelle %s\n"
diff --git a/po/fo.po b/po/fo.po
new file mode 100644
index 0000000..8b122af
--- /dev/null
+++ b/po/fo.po
@@ -0,0 +1,816 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Gunleif Joensen <gunleif@gmail.com>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-09-10 14:36+0200\n"
+"Last-Translator: Gunleif Joensen <gunleif@gmail.com>\n"
+"Language-Team: Føroyabólkurin\n"
+"Language: fo\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Virtaal 0.6.1\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Atgerð miseydaðist"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Ringur standur"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Ógildugt vertsnavn"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Ógildugt økisnavn"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr ""
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Ógildugt DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr ""
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr ""
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Ógildugt tænastunavn"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Ógildug tænastuslag"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Ógildugt portursnummar"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr ""
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ógildugt atsetur"
+
+#: ../avahi-common/error.c:46
+#, fuzzy
+msgid "Timeout reached"
+msgstr "Leikbrá rokki"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Ov nógvir viðskiftarir"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Ov nógvir lutir"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr ""
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr ""
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Atgongd noktað"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Ógildug atgerð"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Ein óvantað D-BUS villa hendi"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Demónsambinding miseydnaðist"
+
+#: ../avahi-common/error.c:56
+#, fuzzy
+msgid "Memory exhausted"
+msgstr "Minni uppbrúkt"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr ""
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Demónin koyrir ikki"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ógildugt markamótsskrá"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr ""
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Ógildug fløgg"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ikki funnið"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Ógildug samanseting"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Útgávur samsvara ikki"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Ógildugt tænastu undirslag"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Ógildugir pakki"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr ""
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS svíkur: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS svíkur: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS svíkur: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS svíkur: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS svíkur: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS svíkur: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS svíkur: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS svíkur: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS svíkur: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS svíkur: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Ógildugt RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Ógildugt DNS-slag"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Ógildigur DNS-flokkur"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ikki stuðlað"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Ikki loyvt"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Ógildugt ávirki"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Er tómt"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Umbidna atgerðin er ógildug, tí hon er óneyðug"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Ógildug villukota"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Eingin tænasta er vald í løtuni.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+#, fuzzy
+msgid "Avahi Discovery"
+msgstr "Avahi uppdagan"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf kagi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Kaga eftir Zeroconf-tænastum, tøkar á tínum neti"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT Dáta:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "tómt"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Tænastuslag:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Tænastunavn:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Økisnavn:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Markamót:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Atsetur:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Kaga eftir tænastusløgum"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Øki:"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tænastuslag:"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Tænastuslagið á valdu tænastuni"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Tænastunavn:"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Tænastunavnið á valdu tænastuni"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Atsetur:"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Atsetur á avgjørdu tænastuni"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Portur:"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "IP-portursnummarið á avgjørdu tænastuni"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Vertsnavn"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Vertsnavnið á avgjørdu tænastuni"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT Dáta"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "TXT-dáta á avgjørdu tænastuni"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Avgerð tænastu"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Avgerð vertsnavn á tænastu"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Atsetursfamilja"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Atseturfamiljan til at avgera vertsnavn"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi viðskiftara svíkur: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi avgerara svíkur: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Kagan eftir tænastuslagnum %s í økinum %s miseydnaðist: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi økiskagari svíkur: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Miseydnaðist at lesa Avahi-øki: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Miseydnaðist at sambinda við Avahi-ambætaran: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Kagi eftir tænastum á <b>nærnet</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Kagi eftir tænastum í økinum <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Miseydnaðist at stovna kagara fyri %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Miseydnaðist at stovna økiskagara: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Skift øki"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Kagi..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Innleiði..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Staður"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Navn"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Slag"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Øki..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [kostir]\n"
+"\n"
+" -h --help Sýn hesa hjálp\n"
+" -s --ssh Kaga eftir SSH ambætarum\n"
+" -v --vnc Kaga eftir VNC ambætarum\n"
+" -S --shell Kaga bæði eftir SSH og VNC\n"
+" -d --domain=DOMAIN Øki at kaga í\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Ov nógv ávirki\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Vel skelambætara"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Skriviborð"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Útstøð"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Vel VNC-ambætara"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Vel SSH-ambætara"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Sambindi við '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() miseydnaðist: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Ógildað.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH-tænastu kagi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Kaga eftir Zeroconf-virkjaðum SSH-ambætarum"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC-tænastu kagi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Kaga eftir Zeroconf-virkjaðum VNC-ambætarum"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Tað var so tað\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Kovin er tømdur\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "tænastu_kagari miseydnaðist: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, fuzzy, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() miseydnaðist: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Ov fá ávirki\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Miseydnaðist at skráseta: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Navnasamanstoytur, velji nýtt navn '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Miseydnaðist at greina atseturin '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, fuzzy, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Miseydnaðist at stovna atseturs-avgerara"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [kostir] <nýtt vertsnavn>\n"
+"\n"
+" -h --help Sýn hesa hjálp\n"
+" -V --version Sýn útgávunummar\n"
+" -v --verbose Sýn orðamiklan stand\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ógildugt tal av ávirkjum, vænti akkurát eitt.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Vertsnavn broytt til %s\n"
diff --git a/po/fr.po b/po/fr.po
new file mode 100644
index 0000000..59143da
--- /dev/null
+++ b/po/fr.po
@@ -0,0 +1,861 @@
+# Copyright (C) 2008 THE avahi-fr'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the avahi-fr package.
+#
+#
+# Matthieu Rondeau <milanito1985@yahoo.fr>, 2008.
+# Pablo Martin-Gomez <pablo.martin-gomez@laposte.net>, 2008.
+# Martin-Gomez Pablo <pablo.martin-gomez@laposte.net>, 2008.
+# Bruno Patri <bruno.patri@gmail.com>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: Avahi 2008\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-09-05 10:33+0200\n"
+"Last-Translator: Bruno Patri <bruno.patri@gmail.com>\n"
+"Language-Team: French <fedora-trans-fr@redhat.com>\n"
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Generator: Lokalize 1.1\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "Ok"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "L'opération a échoué "
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Mauvais état"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nom d'hôte invalide"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nom de domaine invalide"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Pas de protocole réseau approprié disponible"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "TTL DNS invalide"
+
+#: ../avahi-common/error.c:37
+#, fuzzy
+msgid "Resource record key is pattern"
+msgstr "La clef de l'enregistrement de la ressource est modélisée"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Conflit de noms locaux"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Enregistrement invalide"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nom de service invalide"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Type de service invalide"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Numéro de port invalide"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Clé d'enregistrement invalide"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Adresse invalide"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Temps d'attente écoulé"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Trop de clients"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Trop d'objets"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Trop d'entrées"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Erreur du système d'exploitation"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Accès refusé"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Opération invalide "
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Une erreur inattendue de D-Bus s'est produite"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "La connexion au démon a échoué "
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Mémoire saturée"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "L'objet transmis n'était pas valide "
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Le démon n'est pas en cours d'exécution"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Index d'interface invalide "
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Spécification de protocole invalide"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Drapeaux invalides"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Non trouvé"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Configuration invalide"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Les versions ne correspondent pas"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Sous-type de service invalide"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Paquet invalide"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Code de retour DNS invalide"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Échec DNS : FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Échec DNS  : SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Échec DNS  : NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Échec DNS  : NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Échec DNS  : REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Échec DNS  : YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Échec DNS  : YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Échec DNS  : NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Échec DNS  : NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Échec DNS  : NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA invalide"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Type de DNS invalide"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Classe de DNS invalide"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Non pris en charge"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Non autorisé"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argument invalide"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Est vide"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "L'opération demandée est invalide car redondante"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Code d'erreur invalide"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Aucun service actuellement sélectionné</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Découverte Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Explorateur Zeroconf d'Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Explorer les services Zeroconf disponibles sur votre réseau"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Données TXT :"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "vide"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Type de service :"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Nom du service :"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Nom de domaine :"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Interface :"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Adresse :"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Parcourir les types de service"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Une liste, terminée par NULL, de type de services à parcourir"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domaine"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Le domaine à parcourir, ou NULL pour le domaine par défaut"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Type de service"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Le type de service pour celui sélectionné"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nom de service"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Nom du service sélectionné"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adresse"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "L'adresse du service résolu"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Le numéro du port IP du service résolu"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nom d'hôte"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Le nom d'hôte du service résolu"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Données TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Les données TXT du service résolu"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Résoudre le service"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Résolution automatiquement du service sélectionné avant renvoi"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Résolution du nom d'hôte du service"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"Résolution automatique du nom d'hôte du service sélectionné avant renvoi"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Famille d'adresses"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "La famille d'adresses pour la résolution du nom d'hôte"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Échec du client Avahi  : %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Échec de résolution Avahi  : %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Échec de l'exploration de type de service %s dans le domaine %s  : %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Échec de l'explorateur de domaine Avahi  : %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Échec de la lecture du domaine Avahi  : %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "La liste des types de services à explorer est vide !"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Échec de la connexion au serveur Avahi  : %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Explorer les services sur <b>le réseau local</b> :"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Explorer les services du domaine <b>%s</b> :"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Échec de création de l'explorateur pour %s  : %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Échec de la création du résolveur pour %s de type %s dans le domaine %s  : %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Échec de création de l'explorateur de domaine  : %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Changer de domaine"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Exploration..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Initialisation..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Emplacement"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nom"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Type"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domaine..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [options]\n"
+"\n"
+" -h --help Affiche cette aide\n"
+" -s --ssh Explore les serveurs SSH\n"
+" -v --vnc Explore les serveurs VNC\n"
+" -S --shell Explore SSH et VNC\n"
+" -d --domain=DOMAIN Le domaine à explorer\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Trop d'arguments\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Choisir un serveur Shell"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Bureau"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Choisir un serveur VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Choisir un serveur SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Connexion à « %s »...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Échec de execlp()  : %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Annulé.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Explorateur de serveur SSH Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Explorer les serveurs SSH avec Zeroconf activé"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Explorateur de serveurs VNC Avahi "
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Explorer les serveurs VNC avec Zeroconf activé"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr " : c'est tout pour le moment\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr " : mémoire cache saturée\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Échec de résolution du service « %s » de type « %s » dans le domaine « %s » "
+" : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Échec de service_browser : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Échec de avahi_service_browser_new()  : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Échec de service_type_browser : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Échec de avahi_service_type_browser_new() : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Échec de avahi_domain_browser_new() : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Échec de la demande de la chaîne de version  : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Échec de la demande de nom d'hôte  : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Version du serveur  : %s ; nom d'hôte  : %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Domaine E Ifce Prot\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "Domaine E Ifce Prot %-*s %-20s\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Déconnecté, reconnexion...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Échec de la création de l'objet client  : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Échec du client, arrêt  : %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "En attente du démon...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Affiche cette aide\n"
+" -V --version Affiche la version\n"
+" -D --browse-domains Explore les domaines au lieu des services\n"
+" -a --all Explore tous les services, sans se soucier du type\n"
+" -d --domain=DOMAIN Le domaine à explorer\n"
+" -v --verbose Active le mode verbeux\n"
+" -t --terminate Arrêt après avoir récupéré une liste plus ou moins "
+"complète\n"
+" -c --cache Arrêt après avoir récupéré toutes les entrées du "
+"cache\n"
+" -l --ignore-local Ignore les services locaux\n"
+" -r --resolve Résout les services trouvés\n"
+" -f --no-fail N'échoue pas si le démon n'est pas disponible\n"
+" -p --parsable Sortie en format analysable\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Ne cherche pas les types de service\n"
+" -b --dump-db Récupère la base de données des types de service\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Trop peu d'arguments\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Échec de création d'un objet d'interrogation simple\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Établi sous le nom « %s »\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Échec d'enregistrement  : %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Conflit de noms, choix d'un nouveau nom « %s ».\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Échec de création de l'entrée de groupe  : %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Échec de l'ajout de l'adresse  : %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Échec de l'ajout de service  : %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Échec de l'ajout du sous-type « %s »  : %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Conflit de noms d'hôtes\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [options] %s <nom> <type> <port> [<texte...>]\n"
+"%s [options] %s <nom d'hôte> <adresse>\n"
+"\n"
+" -h --help Affiche cette aide\n"
+" -V --version Affiche la version\n"
+" -s --service Publie le service\n"
+" -a --address Publie l'adresse\n"
+" -v --verbose Active le mode verbeux\n"
+" -d --domain=DOMAIN Domaine dans lequel publier le service\n"
+" -H --host=DOMAIN Hôte où le service réside\n"
+" --subtype=SUBTYPE Un sous-type additionnel avec lequel enregistrer le "
+"service\n"
+" -f --no-fail N'échoue pas si le démon n'est pas disponible\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Nombre d'arguments erroné\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Échec de l'analyse du numéro de port  : %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Aucune commande spécifiée.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Échec de la résolution du nom d'hôte « %s »  : %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Échec de la résolution de l'adresse « %s »  : %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [options] %s <nom d'hôte ...>\n"
+"%s [options] %s <adresse ... >\n"
+"\n"
+" -h --help Affiche cette aide\n"
+" -V --version Affiche la version\n"
+" -n --name Résout le nom d'hôte\n"
+" -a --address Résout l'adresse\n"
+" -v --verbose Active le mode verbeux\n"
+" -6 Cherche l'adresse IPv6\n"
+" -4 Cherche l'adresse IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Échec de la création du résolveur de nom d'hôte  : %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Échec de l'analyse de l'adresse « %s »\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Échec de la création du résolveur d'adresse  : %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [options] <nouveau nom d'hôte>\n"
+"\n"
+" -h --help Affiche cette aide\n"
+" -V --version Affiche la version\n"
+" -v --verbose Active le mode verbeux\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Nombre d'arguments invalide, il en faut exactement un.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Nom d'hôte changé avec succès pour %s\n"
diff --git a/po/gl.po b/po/gl.po
new file mode 100644
index 0000000..46f8a8f
--- /dev/null
+++ b/po/gl.po
@@ -0,0 +1,870 @@
+# Galician translation for avahi.
+# Copyright (C) 2010 avahi's COPYRIGHT HOLDER
+# This file is distributed under the same license as the avahi package.
+#
+# Miguel Anxo Bouzada <mbouzada@gmail.com>, 2010.
+# Fran Diéguez <frandieguez@ubuntu.com>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi master\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-03-04 11:23+0100\n"
+"Last-Translator: Fran Diéguez <frandieguez@ubuntu.com>\n"
+"Language-Team: Galician <proxecto@trasno.net>\n"
+"Language: gl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "Aceptar"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Produciuse un fallo na operación"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Estado incorrecto"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "O nome do servidor é incorrecto"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "O nome do dominio é incorrecto"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Non hai dispoñíbel ningún protocolo de rede apropiado"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "TTL do DNS incorrecto"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "A chave do rexistro do recurso é un patrón"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Hai un conflito de nomes locais"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Rexistro incorrecto"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "O nome do servizo é incorrecto"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "O tipo de servizo é incorrecto"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "O número de porto é incorrecto"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "A chave do rexistro é incorrecta"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "O enderezo é incorrecto"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Rematou o tempo de espera"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Demasiados clientes"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Demasiados obxectos"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Demasiadas entradas"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Prodicuse un erro do SO"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Acceso denegado"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Operación incorrecta"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Produciuse un erro inesperado de D-BUS"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Produciuse un fallo na conexión co daemon"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memoria esgotada"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "O obxecto indicado non é correcto"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "O daemon non está executándose"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "O índice de interface é incorrecto"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "A especificación do protocolo é incorrecta"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Marcas incorrectas"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Non encontrado"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "A configuración é incorrecta"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Versións non coincidentes"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "O subtipo de servizo é incorrecto"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "O paquete é incorrecto"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "O código de retorno do DNS é incorrecto"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Produciuse un erro no DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Produciuse un erro no DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Produciuse un erro no DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Produciuse un erro no DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Produciuse un erro no DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Produciuse un erro no DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Produciuse un erro no DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Produciuse un erro no DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Produciuse un erro no DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Produciuse un erro no DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA incorrecto"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Tipo de DNS incorrecto"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Clase de DNS incorrecta"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Non admitido"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Non permitido"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argumento incorrecto"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Está baleiro"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "A operación solicitada non é correcta por ser redundante"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Código do erro incorrecto"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Non hai ningún servizo seleccionado actualmente.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Descubrimento de Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Navegador Zeroconf de Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Navegar na busca de servizos Zeroconf dispoñíbeis na súa rede"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "Datos TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Está baleiro"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Tipo de servizo"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Nome do servizo"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Dominio"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Enderezo"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Navegar polos tipos de servizo"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Unha lista rematada en NULL de tipos de servizo polos que navegar"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Dominio"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+"O dominio polo que navegar, ou NULL para empregar o dominio predefinido"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tipo de servizo"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "O tipo de servizo do servizo seleccionado"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nome do servizo"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "O nome de servizo do servizo seleccionado"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Enderezo"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "O enderezo do servizo localizado"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Porto"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "O número de porto IP do servizo localizado"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nome do servidor"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "O nome do servidor do servizo localizado"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Datos TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Os datos TXT do servizo localizado"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Servizo de localización"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Nome do servidor do servizo de localización"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Familia de enderezos"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "A familia de enderezos para a localización de nomes de servidor"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Produciuse un erro no cliente Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Produciuse un erro no localizador Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+"Produciuse un erro ao navegar polo tipo de servizo %s no dominio %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/d"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Produciuse un erro no navegador de dominios Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Non foi posíbel ler o dominio de Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "A lista de navegación por tipo de servizo está baleira!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Non foi posíbel conectar co servidor Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Navegando polos servizos na <b>rede local</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Navegando polos servizos no dominio <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Produciuse un erro ao crear un navegador para %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Produciuse un erro ao crear un localizador para %s do tipo %s no dominio %s: "
+"%s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Produciuse un erro ao crear un navegador de dominios: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Cambiar o dominio"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Navegando..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Inicializando..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Localización"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nome"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Tipo"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Dominio..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opcións]\n"
+"\n"
+" -h --help Mostra esta axuda\n"
+" -s --ssh Navegar polos servidores SSH\n"
+" -v --vnc Navegar polos servidores VNC\n"
+" -S --shell Navegar por ambos, SSH e VNC\n"
+" -d --domain=DOMINIO O dominio polo que navegar\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Demasiados argumentos\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Seleccione o servidor de intérprete de ordes"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Escritorio"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Escolla o servidor VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Escolla o servidor SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Conectando a '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Produciuse un erro con execlp(): %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancelado.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Navegador de servidores SSH de Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Navegar por servidores SSH con Zeroconf activado"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Navegador de servidores VNC de Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Navegar por servidores VNC con Zeroconf activado"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Todo por agora\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Cache esgotada\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Produciuse un erro ao resolver o servizo «%s» do tipo «%s» no dominio «%s»: "
+"%s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Produciuse un erro con service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Produciuse un erro con avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Produciuse un erro con service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Produciuse un erro con avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Produciuse un erro con avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Produciuse un erro ao consultar a cadea de versión: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Produciuse un erro ao consultar o nome do servidor: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Versión do servidor: %s; Nome do servidor: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Dominio E Ifce Prot\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "Dominio E Ifce Prot %-*s %-20s \n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Desconectado, reconectando...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Produciuse un erro ao crear o obxecto cliente: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Produciuse un erro no cliente, saíndo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Esperando polo daemon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Mostra esta axuda\n"
+" -V --version Mostra a versión\n"
+" -D --browse-domains Navegar polos dominios de navegación no canto de "
+"polos servizos\n"
+" -a --all Mostra todos os servizos, sen importar o tipo\n"
+" -d --domain=DOMINIO O dominio polo que navegar\n"
+" -v --verbose Activar o modo detallado\n"
+" -t --terminate Rematar despois de envorcar unha lista máis ou "
+"menos completa\n"
+" -c --cache Rematar despois de envorcar todas as entradas dende "
+"a caché\n"
+" -l --ignore-local Ignorar servizos locais\n"
+" -r --resolve Localizar os servizos encontrados\n"
+" -f --no-fail Non producir erro se o daemon non está dispoñíbel\n"
+" -p --parsable Producir unha saída en formato procesábel\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Non buscar tipos de servizo\n"
+" -b --dump-db Envorcar a base de datos de tipos de servizo\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Poucos argumentos\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Produciuse un erro ao crear un obxecto simple de consulta.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Estabelecido baixo o nome '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Produciuse un erro ao rexistrar: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Conflito de nomes, escollendo o novo nome '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Produciuse un erro ao crear o grupo de entradas: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Produciuse un erro ao engadir o enderezo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Produciuse un erro ao engadir o servizo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Produciuse un erro ao engadir o subtipo «%s»: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Conflito de nomes de servidor\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opcións] %s <nome> <tipo> <porto> [<txt ...>]\n"
+"%s [opcións] %s <nome-de-servidor> <enderezo>\n"
+"\n"
+" -h --help Mostrar esta axuda\n"
+" -V --version Mostrar a versión\n"
+" -s --service Publicar un servizo\n"
+" -a --address Publicar un enderezo\n"
+" -v --verbose Activar o modo detallado\n"
+" -d --domain=DOMINIO Dominio no que publicar o servizo\n"
+" -H --host=DOMINIO Computador no que reside o servizo\n"
+" --subtype=SUBTIPO Un subtipo adicional co que rexistrar este servizo\n"
+" -f --no-fail Non producir un erro se o daemon non está "
+"dispoñíbel\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "O número de argumento é erróneo\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Produciuse un erro ao procesar o número de porto: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Non se especificou ningunha orde.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Produciuse un erro ao localizar o nome de servidor «%s»: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Produciuse un erro ao localizar o enderezo «%s»: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opcións] %s <nome de servidor...>\n"
+"%s [opcións] %s <enderezo ... >\n"
+"\n"
+" -h --help Mostrar esta axuda\n"
+" -V --version Mostrar a versión\n"
+" -n --name Localizar o nome de computador\n"
+" -a --address Localizar o enderezo\n"
+" -v --verbose Activar o modo detallado\n"
+" -6 Buscar enderezos IPv6\n"
+" -4 Buscar enderezos IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+"Produciuse un erro ao crear o proceso de localización de nomes de servidor: "
+"%s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Produciuse un erro ao procesar o enderezo «%s»\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Produciuse un erro ao crear o localizador de enderezos: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opcións] <novo nome de servidor>\n"
+"\n"
+" -h --help Mostrar esta axuda\n"
+" -V --version Mostrar a versión\n"
+" -v --verbose Activar o modo detallado\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "O número de argumentos non é correcto, esperábase exactamente un.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Cambiouse o nome de servidor correctamente a %s\n"
diff --git a/po/he.po b/po/he.po
new file mode 100644
index 0000000..f5a50c7
--- /dev/null
+++ b/po/he.po
@@ -0,0 +1,806 @@
+# Hebrew translation for avahi
+# Copyright (c) 2008 Rosetta Contributors and Canonical Ltd 2008
+# This file is distributed under the same license as the avahi package.
+# Yaron Shahrabani <sh.yaron@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-07-18 13:19+0200\n"
+"Last-Translator: Yaron Shahrabani <sh.yaron@gmail.com>\n"
+"Language-Team: Hebrew <he@li.org>\n"
+"Language: he\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2010-07-18 10:16+0000\n"
+"X-Generator: Launchpad (build Unknown)\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "×ישור"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "הפעולה נכשלה"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "מצב בעייתי"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "×©× ×”×ž×רח שגוי"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "×©× ×”×ž×ª×—× ×©×’×•×™"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "×ין פרוטוקול תו×× ×–×ž×™×Ÿ"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "זמן תחיית ה-DNS שגוי"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "מפתח הקלטת המש×ב הינו תבנית"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "התנגשות ×©× ×ž×§×•×ž×™×ª"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "רשומה שגויה"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "×©× ×”×©×™×¨×•×ª שגוי"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "סוג השירות שגוי"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "מספר הפתחה שגוי"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "מפתח הרשומה שגוי"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "הכתובת שגויה"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "×”×’×™×¢ ×ª×•× ×”×–×ž×Ÿ"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "יותר מדי לקוחות"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "יותר מדי פריטי×"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "יותר מדי רשומות"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "שגי×ת מערכת ההפעלה"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "הגישה נדחתה"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "פעולה שגויה"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "×רעה שגי×ת D-Bus ×œ× ×™×“×•×¢×”"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "החיבור לסוכן נכשל"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "הזכרון הותש"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "הפריט שהועבר פנימה שגוי"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "הסוכן ×ינו פעיל"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "מפתח תוכן המנשק שגוי"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "×פיון פרוטוקול שגוי"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "×“×’×œ×•× ×™× ×©×’×•×™×™×"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "×œ× × ×ž×¦×"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "הגדרות שגויות"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "חוסר תי××•× ×’×™×¨×¡×ות"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "תת-סוג השירות שגוי"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "מנה שגויה"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "קוד תגובה שגוי מה-DNS"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "שגי×ת DNS: FORMER"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "שגי×ת DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "שגי×ת DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "שגי×ת DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "שגי×ת DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS שגי×ת: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "שגי×ת DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "שגי×ת DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "שגי×ת DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "שגי×ת DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA שגוי"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "סוג ה-DNS שגוי"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "רמת ה-DNS שגויה"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "×œ× × ×ª×ž×š"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "×œ× ×ž×•×¨×©×”"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "×רגומנט שגוי"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "הינו ריק"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "הפעולה המבוקשת שגויה כיוון ×©×”×™× ×ž×™×•×ª×¨×ª"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "קוד שגי××” שגוי"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>×œ×‘×™× ×ª×™×™× ×œ× × ×‘×—×¨ ××£ שירות.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "גילוי Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "סייר ×”Ö¾Zeroconf של â€Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "סיור ×חר שירותי Zeroconf ×”×–×ž×™× ×™× ×‘×¨×©×ª שלך"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "נתוני TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "ריק"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "סוג השירות:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "×©× ×”×©×™×¨×•×ª:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "×©× ×”×ž×ª×—×:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "מנשק:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "כתובת:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "סיור בסוגי השירותי×"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "מתח×"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "×”×ž×ª×—× ×œ×¡×™×•×¨, ×ו NULL ×œ×ž×ª×—× ×‘×¨×™×¨×ª המחדל"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "סוג השירות"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "סוג השירות של השירות הנבחר"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "×©× ×”×©×™×¨×•×ª"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "×©× ×”×©×™×¨×•×ª של השירות הנבחר"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "כתובת"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "כתובת השירות שנפתר"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "פתחה"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "מספר פתחת ה־IP של השירות שנפתר"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "×©× ×”×ž×רח"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "×©× ×”×ž×רח של השירות שנפתר"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "נתוני TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "נתוני ה־TXT של השירות שנפתר"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "שירות הפתירה"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "×©× ×ž×רח שירות הפתירה"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "משפחת כתובות"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "כשל בלקוח Avahi:%s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, fuzzy, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Error creating Avahi resolver: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "×œ× ×–×ž×™×Ÿ"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "כשל בדפדפן ×”×ž×ª×—×ž×™× Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, fuzzy, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "נכשל בפתירת ×©× ×ž×רח avahi:†%s\n"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, fuzzy, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr ""
+"נכשל בהתחברות לשרת Jamendo.â€\n"
+"%s."
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, fuzzy, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "×רע כשל ביצירת שרת HTTP עבור %s:†%s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, fuzzy, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "×רע כשל בהפעלת סייר ×”Ö¾mDNS:†%s\n"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "החלפת מתח×"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "בעיון..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "בהליכי הפעלה..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "מיקו×"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+#, fuzzy
+msgid "Name"
+msgstr "ש×"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "סוג"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_מתח×..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "יותר מדי ×רגומנטי×\n"
+
+#: ../avahi-ui/bssh.c:149
+#, fuzzy
+msgid "Choose Shell Server"
+msgstr "שרת מעטפת מרוחק"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "שולחן העבודה"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "מסוף"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "בחירת שרת VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "בחירת שרת SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "מתבצע חיבור ×ל '%s'...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, fuzzy, c-format
+msgid "execlp() failed: %s\n"
+msgstr "×”×ימות נכשל."
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "בוטל.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, fuzzy, c-format
+msgid ": All for now\n"
+msgstr "ל×, ×–×” הכל לעכשיו"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, fuzzy, c-format
+msgid ": Cache exhausted\n"
+msgstr "טוען ×ת המטמון"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, fuzzy, c-format
+msgid "service_browser failed: %s\n"
+msgstr "×רע כשל בעת %s שירות Rygel:†%s"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, fuzzy, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "×רע כשל בהוספת סייר ×”Ö¾mDNS לשירות %s."
+
+#: ../avahi-utils/avahi-browse.c:414
+#, fuzzy, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "×רע כשל בעת %s שירות Rygel:†%s"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, fuzzy, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "×רע כשל בתש×ול סוג התוכן עבור '%s'"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, fuzzy, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "×ימות ×¢× ×”×ž×רח %s נכשל"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, fuzzy, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "×©× ×”×ž×רח ×ו כתובת השרת."
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, fuzzy, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "שרת שמות מתח×"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, fuzzy, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "â€%s התנתק"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, fuzzy, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "×רע כשל ביצירת פריט מסוג GdkPixbufLoader."
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, fuzzy, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "שגי××” בקרי×ת GIF:†%s"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, fuzzy, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "מחכה לתקליטור..."
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, fuzzy, c-format
+msgid "Too few arguments\n"
+msgstr "יותר מדי ×רגומנטי×\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, fuzzy, c-format
+msgid "Established under name '%s'\n"
+msgstr "×©× ×”×ª×§×Ÿ ALSA"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, fuzzy, c-format
+msgid "Failed to register: %s\n"
+msgstr "שגי××” בטעינת %s: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, fuzzy, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "×”×©× ×”×—×“×© ריק."
+
+#: ../avahi-utils/avahi-publish.c:114
+#, fuzzy, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "×רע כשל בקבלת רשימת הקבוצות"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, fuzzy, c-format
+msgid "Failed to add address: %s\n"
+msgstr "×רע כשל ביצירת ספר הכתובות '%s':†%s"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, fuzzy, c-format
+msgid "Failed to add service: %s\n"
+msgstr "×רע כשל בעת %s שירות Rygel:†%s"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, fuzzy, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "×רע כשל בהוספת התקן וירטו×לי"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, fuzzy, c-format
+msgid "Host name conflict\n"
+msgstr "שנה ×©× ×ž_×רח"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, fuzzy, c-format
+msgid "Bad number of arguments\n"
+msgstr "Los posibles argumentos son:"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, fuzzy, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Failed to parse saved session file: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, fuzzy, c-format
+msgid "No command specified.\n"
+msgstr "no command specified to execute"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, fuzzy, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Unable to resolve host address"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, fuzzy, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Unable to resolve host address"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, fuzzy, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Failed to parse arguments: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, fuzzy, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "×רע כשל ביצירת ספר הכתובות '%s':†%s"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "×©× ×”×ž×רח השתנה בהצלחה ל־%s\n"
diff --git a/po/hu.po b/po/hu.po
new file mode 100644
index 0000000..800b90e
--- /dev/null
+++ b/po/hu.po
@@ -0,0 +1,863 @@
+# Hungarian translation of avahi
+# Copyright (C) 2008, 2009, Free Software Foundation, Inc.
+# This file is distributed under the same license as the avahi package.
+#
+# Gabor Kelemen <kelemeng@gnome.hu>, 2008, 2009, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi master\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-03-22 12:57+0100\n"
+"Last-Translator: Gabor Kelemen <kelemeng@gnome.hu>\n"
+"Language-Team: Hungarian <gnome@fsf.hu>\n"
+"Language: hu\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: KBabel 1.11.4\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "A művelet meghiúsult"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Hibás állapot"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Érvénytelen gépnév"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Érvénytelen tartománynév"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Nem áll rendelkezésre megfelelő hálózati protokoll"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Érvénytelen DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Az erőforrásrekord kulcsa minta"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Helyi névütközés"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Érvénytelen rekord"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Érvénytelen szolgáltatásnév"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Érvénytelen szolgáltatástípus"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Érvénytelen portszám"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Érvénytelen rekordkulcs"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Érvénytelen cím"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Időtúllépés"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Túl sok kliens"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Túl sok objektum"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Túl sok bejegyzés"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "OS hiba"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Hozzáférés megtagadva"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Érvénytelen művelet"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Váratlan D-Bus hiba történt"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "A csatlakozás meghiúsult a démonhoz"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Elfogyott a memória"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Az átadott objektum érvénytelen volt"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "A démon nem fut"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Érvénytelen felületindex"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Érvénytelen protokollmeghatározás"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Érvénytelen jelzők"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Nem található"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Érvénytelen konfiguráció"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Verzióeltérés"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Érvénytelen szolgáltatásaltípus"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Érvénytelen csomag"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Érvénytelen DNS visszatérési érték"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS hiba: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS hiba: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS hiba: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS hiba: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS hiba: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS hiba: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS hiba: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS hiba: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS hiba: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS hiba: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Érvénytelen RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Érvénytelen DNS-típus"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Érvénytelen DNS-osztály"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Nem támogatott"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Nem engedélyezett"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Érvénytelen paraméter"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Ãœres"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "A kért művelet érvénytelen, mivel redundáns"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Érvénytelen hibakód"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Nincs kiválasztva szolgáltatás.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi feltérképezés"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf-böngésző"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Zeroconf szolgáltatások keresése a hálózaton"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT adat:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "üres"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Szolgáltatástípus:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Szolgáltatásnév:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Tartománynév:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Csatoló:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Cím:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Szolgáltatástípusok tallózása"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "A tallózandó szolgáltatástípusok NULL végű listája"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Tartomány"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "A tallózandó tartomány, vagy NULL az alapértelmezetthez"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Szolgáltatástípus"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "A kiválasztott szolgáltatás típusa"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Szolgáltatásnév"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "A kiválasztott szolgáltatás neve"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Cím"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "A feloldott szolgáltatás címe"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "A feloldott szolgáltatás IP portszáma"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Gépnév"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "A feloldott szolgáltatás gépneve"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT adat"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "A feloldott szolgáltatás TXT adatai"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Szolgáltatás feloldása"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "A kiválasztott szolgáltatás automatikus feloldása visszatérés előtt"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Szolgáltatás gépnevének feloldása"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"A kiválasztott szolgáltatás gépnevének automatikus feloldása visszatérés "
+"előtt"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Címcsalád"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Címcsalád a gépnév-feloldáshoz"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi klienshiba: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi feloldási hiba: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "A szolgáltatástípus (%s) tallózása a tartományban (%s) meghiúsult: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "ismeretlen"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi tartományböngésző-hiba: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Az Avahi tartomány olvasása meghiúsult: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "A tallózandó szolgáltatástípusok listája üres."
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "A csatlakozás meghiúsult az Avahi kiszolgálóhoz: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Szolgáltatások tallózása a <b>helyi hálózaton</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Szolgáltatások tallózása a(z) <b>%s</b> tartományban:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Nem sikerült tallózót létrehozni a következőhöz: %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Nem sikerült $%2s típusú feloldót létrehozni a következőhöz: $%1s a(z) $%3s "
+"tartományban: $%4s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Nem sikerült tartománytallózót létrehozni: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Tartomány módosítása"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Tallózás…"
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Előkészítés…"
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Hely"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Név"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Típus"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Tartomány…"
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [kapcsolók]\n"
+"\n"
+" -h --help Ezen súgó megjelenítése\n"
+" -s --ssh SSH kiszolgálók tallózása\n"
+" -v --vnc VNC kiszolgálók tallózása\n"
+" -S --shell SSH és VNC kiszolgálók tallózása\n"
+" -d --domain=TARTOMÃNY A tallózandó tartomány\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Túl sok paraméter\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Válassza ki a shell kiszolgálót"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Asztal"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminál"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Válasszon VNC kiszolgálót"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Válasszon SSH kiszolgálót"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Csatlakozás ehhez: „%s†…\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Az execlp() meghiúsult: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Megszakítva.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH-kiszolgálóböngésző"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Zeroconf-képes SSH kiszolgálók keresése"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC-kiszolgálóböngésző"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Zeroconf-képes VNC kiszolgálók keresése"
+
+# fixme: wtf?
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": most mind\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": a gyorsítótár elfogyott\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"A(z) $%2s típusú $%1s szolgáltatás feloldása meghiúsult a(z) $%3s "
+"tartományban: $%4s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "a service_browser sikertelen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "az avahi_service_browser_new() sikertelen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "a service_type_browser sikertelen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "az avahi_service_type_browser_new() sikertelen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "az avahi_domain_browser_new() sikertelen: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "A verzió-karakterlánc lekérdezése meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "A gépnév lekérdezése meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Kiszolgálóverzió: %s; gépnév: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Csat Prot Tartom\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Csat Prot %-*s %-20s Tartom\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Leválasztva, újracsatlakozás…\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Kliensobjektum létrehozása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Klienshiba, kilépés: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Várakozás a démonra…\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Ezen súgó megjelenítése\n"
+" -V --version Verziószám megjelenítése\n"
+" -D --browse-domains Szolgáltatások helyett tartományok tallózása\n"
+" -a --all Minden szolgáltatás megjelenítése, "
+"típusfüggetlenül\n"
+" -d --domain=TARTOMÃNY A tallózandó tartomány\n"
+" -v --verbose Részletes mód engedélyezése\n"
+" -t --terminate Befejezés a többé-kevésbé teljes lista kiírása "
+"után\n"
+" -c --cache Befejezés a gyorsítótár bejegyzéseinek kiírása "
+"után\n"
+" -l --ignore-local Helyi szolgáltatások figyelmen kívül hagyása\n"
+" -r --resolve Talált szolgáltatások feloldása\n"
+" -f --no-fail Ne hibázzon, ha a démon nem érhető el\n"
+" -p --parsable Kimenet feldolgozható formában\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Ne keresse ki a szolgáltatástípusokat\n"
+" -b --dump-db Szolgáltatástípus-adatbázis kiírása\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Túl kevés paraméter\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Az egyszerű lekérdezési objektum létrehozása meghiúsult.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Létrehozva ezen név alatt: „%sâ€\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "A regisztráció meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Névütközés, új név választása: „%sâ€.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "A bejegyzéscsoport létrehozása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "A cím hozzáadása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "A szolgáltatás hozzáadása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Az altípus („%sâ€) hozzáadása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Gépnévütközés\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [kapcsolók] %s <név> <típus> <port> [<txt …>]\n"
+"%s [kapcsolók] %s <gépnév> <cím>\n"
+"\n"
+" -h --help Ezen súgó megjelenítése\n"
+" -V --version Verziószám megjelenítése\n"
+" -s --service Szolgáltatás közzététele\n"
+" -a --address Cím közzététele\n"
+" -v --verbose Részletes mód engedélyezése\n"
+" -d --domain=TARTOMÃNY Szolgáltatás közzététele ebben a tartományban\n"
+" -H --host=TARTOMÃNY A szolgáltatás ezen a gépen található\n"
+" --subtype=ALTÃPUS További altípus, amellyel a szolgáltatás "
+"regisztrálandó\n"
+" -f --no-fail Ne hibázzon, ha a démon nem érhető el\n"
+" -R --no-reverse Ne tegye közzé a fordított bejegyzést címmel\n"
+" -f --no-fail Ne hibázzon, ha a démon nem érhető el\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "A paraméterek száma nem megfelelő\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "A portszám feldolgozása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Nincs megadva parancs.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "A gépnév („%sâ€) feloldása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "A cím („%sâ€) feloldása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [kapcsolók] %s <gépnév …>\n"
+"%s [kapcsolók] %s <cím … >\n"
+"\n"
+" -h --help Ezen súgó megjelenítése\n"
+" -V --version Verziószám megjelenítése\n"
+" -n --name Gépnév feloldása\n"
+" -a --address Cím feloldása\n"
+" -v --verbose Részletes mód engedélyezése\n"
+" -6 IPv6 cím kikeresése\n"
+" -4 IPv4 cím kikeresése\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "A gépnévfeloldó létrehozása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "A cím („%sâ€) feldolgozása meghiúsult\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "A címfeloldó létrehozása meghiúsult: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [kapcsolók] <új gépnév>\n"
+"\n"
+" -h --help Ezen súgó megjelenítése\n"
+" -V --version Verziószám megjelenítése\n"
+" -v --verbose Részletes mód engedélyezése\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Érvénytelen számú argumentum, pontosan egy szükséges.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "A gépnév sikeresen módosítva a következőre: %s\n"
diff --git a/po/id.po b/po/id.po
new file mode 100644
index 0000000..453086a
--- /dev/null
+++ b/po/id.po
@@ -0,0 +1,856 @@
+# Indonesian translation for avahi.
+# Copyright (C) 2010 avahi's COPYRIGHT HOLDER
+# This file is distributed under the same license as the avahi package.
+# Andika Triwidada <andika@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi master\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-08-15 12:01+0700\n"
+"Last-Translator: Andika Triwidada <andika@gmail.com>\n"
+"Language-Team: GNOME Indonesian Translation Team <gnome@i15n.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Poedit-Language: Indonesian\n"
+"X-Poedit-Country: Indonesia\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operasi gagal"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Keadaan buruk"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nama host tak valid"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nama domain tak valid"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Tak ada protokol jaringan yang cocok"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "TTL DNS tak valid"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Kunci resource record adalah pola"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Tabrakan nama lokal"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Record tak valid"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nama layanan tak valid"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Jenis layanan tak valid"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Nomor port tak valid"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Kunci record tak valid"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Alamat tidak valid"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Waktu tunggu habis"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Terlalu banyak klien"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Terlalu banyak objek"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Terlalu banyak entri"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Galat OS"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Akses ditolak"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Operasi tidak valid"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Terjadi galat D-Bus yang tak diharapkan"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Koneksi daemon gagal"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Kehabisan memori"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Objek yang dilewatkan tak valid"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Daemon tak berjalan"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Indeks antarmuka tak valid"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Spesifikasi protokol tak valid"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Flag tak valid"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Tidak ditemukan"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Konfigurasi tak valid"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Versi tak cocok"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Sub jenis layanan tak valid"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Paket tak valid"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Kode balikan DNS tak valid"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Kegagalan DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Kegagalan DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Kegagalan DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Kegagalan DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Kegagalan DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Kegagalan DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Kegagalan DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Kegagalan DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Kegagalan DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Kegagalan DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA tak valid"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Jenis DNS tak valid"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Kelas DNS tak valid"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Tidak didukung"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Tidak diijinkan"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argumen tidak valid"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Kosong"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Operasi yang diminta tak valid karena redundan"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Kode Galat Tak Valid"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Tak ada layanan yang kini dipilih.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Penemuan Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Peramban Zeroconf Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Ramban layanan Zeroconf yang tersedia pada jaringan Anda"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Data TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "kosong"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Jenis Layanan:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Nama Layanan:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Nama Domain:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Antarmuka:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Alamat:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Ramban Jenis Layanan"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Suatu daftar berakhiran NULL dari jenis layanan untuk diramban"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domain"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Domain untuk diramban, atau NULL untuk domain bawaan"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Jenis Layanan"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Jenis layanan dari layanan yang dipilih"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nama Layanan"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Nama layanan dari layanan yang dipilih"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Alamat"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Alamat dari layanan yang di-resolve"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Nomor port IP dari layanan yang di-resolve"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nama Host"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Nama host dari layanan yang di-resolve"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Data TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Data TXT dari layanan yang di-resolve"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Resolve Layanan"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Resolve layanan yang dipilih secara otomatis sebelum kembali"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Resolve Nama Host Layanan"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"Resolve nama host dari layanan yang dipilih secara otomatis sebelum kembali"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Famili alamat"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Famili alamat bagi resolusi nama host"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Kegagalan klien Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Kegagalan resolver Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Meramban jenis layanan %s pada domain %s gagal: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Kegagalan peramban domain Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Gagal membaca domain Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Daftar jenis layanan ramban kosong!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Gagal menyambung ke server Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Meramban layanan pada <b>jaringan lokal</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Meramban layanan pada domain <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Gagal membuat peramban bagi %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Gagal membuat resolver bagi %s dengan jenis %s pada domain %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Gagal membuat peramban domain: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Ubah domain"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Meramban..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Menginisialisasi..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Lokasi"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nama"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Jenis"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domain..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opsi]\n"
+"\n"
+" -h --help Tampilkan bantuan ini\n"
+" -s --ssh Ramban server SSH\n"
+" -v --vnc Ramban server VNC\n"
+" -S --shell Ramban SSH dan VNC\n"
+" -d --domain=DOMAIN Domain untuk diramban\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Terlalu banyak argumen\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Pilih Server Shell"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Desktop"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Pilih server VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Pilih server SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Menyambung ke '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() gagal: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Dibatalkan.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Peramban Server SSH Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Meramban Server SSH Teraktifkan-Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Peramban Server VNC Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Meramban Server VNC Teraktifkan-Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Semua untuk saat ini\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Singgahan habis\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "Gagal meresolve layanan '%s' dengan jenis '%s' pada domain '%s': %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser gagal: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() gagal: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser gagal: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() gagal: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() gagal: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Gagal meng-query string versi: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Gagal meng-query nama host: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Versi server: %s; Nama host: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifce Prot Domain\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s Domain\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Diputus, sedang menyambung ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Gagal membuat objek klien: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Kegagalan klien, keluar: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Menunggu daemon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Tampilkan bantuan ini\n"
+" -V --version Tampilkan versi\n"
+" -D --browse-domains Meramban domain ramban sebagai ganti layanan\n"
+" -a --all Tampilkan semua layanan, tak peduli jenisnya\n"
+" -d --domain=DOMAIN Domain yang akan diramban\n"
+" -v --verbose Aktifkan mode verbose\n"
+" -t --terminate Akhiri setelah membongkar daftar yang kurang lebih "
+"lengkap\n"
+" -c --cache Akhiri setelah membongkar semua entri dari "
+"singgahan\n"
+" -l --ignore-local Abaikan layanan lokal\n"
+" -r --resolve Layanan resolve ditemukan\n"
+" -f --no-fail Jangan gagal bila daemon tak tersedia\n"
+" -p --parsable Keluaran dalam bentuk yang dapat diurai\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Jangan lihat jenis layanan\n"
+" -b --dump-db Bongkar basis data jenis layanan\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Argumen terlalu sedikit\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Gagal membuat objek poll sederhana.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Terjalin dengan nama '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Gagal mendaftar: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Tabrakan nama, mengambil nama baru '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Gagal membuat grup entri: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Gagal menambah alamat: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Gagal menambah layanan: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Gagal menambah sub jenis '%s' %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Nama host konflik\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opsi] %s <nama> <jenis> <port> [<txt ...>]\n"
+"%s [opsi] %s <nama-host> <alamat>\n"
+"\n"
+" -h --help Tampilkan bantuan ini\n"
+" -V --version Tampilkan versi\n"
+" -s --service Publikasikan layanan\n"
+" -a --address Publikasikan alamat\n"
+" -v --verbose Aktifkan mode verbose\n"
+" -d --domain=DOMAIN Domain tempat mempublikasikan layanan\n"
+" -H --host=DOMAIN Host tempat layanan berada\n"
+" --subtype=SUBTYPE Sub jenis tambahan yang disertakan saat mendaftar "
+"layanan ini\n"
+" -R --no-reverse Jangan publikasikan entri balikan dengan alamat\n"
+" -f --no-fail Jangan gagal bila daemon tak tersedia\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Cacah argumen salah\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Gagal mengurai nomor port: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Tak ada perintah yang dinyatakan.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Gagal meresolve nama host '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Gagal meresolve alamat '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opsi] %s <nama host ...>\n"
+"%s [opsi] %s <alamat ... >\n"
+"\n"
+" -h --help Tampilkan bantuan ini\n"
+" -V --version Tampilkan versi\n"
+" -n --name Resolve nama host\n"
+" -a --address Resolve alamat\n"
+" -v --verbose Aktifkan mode verbose\n"
+" -6 Lihat alamat IPv6\n"
+" -4 Lihat alamat IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Gagal membuat resolver nama host: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Gagal mengurai alamat '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Gagal membuat resolver alamat: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opsi] <nama host baru>\n"
+"\n"
+" -h --help Tampilkan bantuan ini\n"
+" -V --version Tampilkan versi\n"
+" -v --verbose Aktifkan mode verbose\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Cacah argumen tak valid, hanya perlu satu.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Nama host sukses diubah menjadi %s\n"
diff --git a/po/it.po b/po/it.po
new file mode 100644
index 0000000..1448cd3
--- /dev/null
+++ b/po/it.po
@@ -0,0 +1,867 @@
+# Italian translation of avahi
+# Copyright (C) 2008, 2009, 2010 the avahi copyright holder
+# This file is distributed under the same license as the avahi package.
+#
+# Silvio Pierro <perplesso82@gmail.com>, 2008.
+# Gianluca Busiello <busiello@ceinge.unina.it>, 2008.
+# Francesco Tombolini <tombo@adamantio.net>, 2008.
+# Luca Ferretti <elle.uca@ubuntu-it.org>, 2009.
+# Luca Ferretti <elle.uca@libero.it>, 2009.
+# Milo Casagrande <milo@ubuntu.com>, 2009, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi.master-tx.it\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-09-05 16:48+0200\n"
+"Last-Translator: Milo Casagrande <milo@ubuntu.com>\n"
+"Language-Team: Italian <tp@lists.linux.it>\n"
+"Language: it\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2009-12-08 18:32+0000\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Launchpad (build Unknown)\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operazione non riuscita"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Stato errato"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nome host non valido"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nome di dominio non valido"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Nessun protocollo di rete adatto disponibile"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "DNS TTL non valido"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "La risorsa key record è un pattern"
+
+# (ndt) messa al plurale
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Collisione nomi locale"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Record non valido"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nome di servizio non valido"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Tipo di servizio non valido"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Numero di porta non valido"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Chiave di record non valida"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Indirizzi non validi"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Raggiunto il timeout"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Troppi client"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Troppi oggetti"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Troppe voci"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Errore di SO"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Accesso negato"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Operazione non valida"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Si è verificato un errore D-Bus inatteso"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Connessione al demone non riuscita"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memoria terminata"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "L'oggetto dato in ingresso non è valido"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Demone non in esecuzione"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Indice di interfaccia non valido"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Specifica di protocollo non valida"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Flag non validi"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Non trovato"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "configurazione non valida"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Discrepanza di versione"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Sottotipo di servizio non valido"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Pacchetto non valido"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Codice di ritorno DNS non valido"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Insuccesso DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Insuccesso DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Insuccesso DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Insuccesso DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Insuccesso DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Insuccesso DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Insuccesso DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Insuccesso DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Insuccesso DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Insuccesso DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA non valido"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Tipo di DNS non valido"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Classe di DNS non valida"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Non supportato"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Non permesso"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argomento non valido"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "È vuoto"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "L'operazione richiesta non è valida in quanto ridondante"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Codice di errore non valido"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Nessun servizio attualmente selezionato.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi Discovery"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Esploratore Zeroconf Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Esplora i servizi Zeroconf disponibili sulla propria rete"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Dati TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "vuoto"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Tipo di servizio:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Nome del servizio:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Nome del dominio:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Interfaccia:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Indirizzo:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Esplora tipi di servizio"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Un elenco terminato da NULL dei tipi di servizio da esplorare"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Dominio"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Il dominio da esplorare, oppure NULL per il dominio predefinito"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tipo di servizio"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Il tipo di servizio del servizio selezionato"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nome di servizio"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Il nome di servizio del servizio selezionato"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Indirizzo"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "L'indirizzo del servizio risolto"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Porta"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Il numero di porta IP del servizio risolto"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nome host"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Il nome host del servizio risolto"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Dati TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "I dati TXT del servizio risolto"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Risoluzione del servizio"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Risolve automaticamente il servizio selezionato prima di uscire"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Risoluzione del nome host del servizio"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"Risolve automaticamente il l'hostname del servizio selezionato prima di "
+"uscire"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Famiglia indirizzi"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "La famiglia di indirizzi per la risoluzione dei nomi host"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Fallimento client avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Fallimento risolutore Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Esplorazione del tipo di servizio %s nel dominio %s non riuscita: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/d"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Fallimento esploratore di domini Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Lettura del dominio di Avahi non riuscita: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "L'elenco esplora tipo di servizio è vuoto."
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Connessione al server Avahi non riuscita: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Esplorazione dei servizi su <b>rete locale</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Esplorazione dei servizi nel dominio <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Creazione dell'esploratore per %s non riuscita: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Creazione del risolutore per %s di tipo %s nel dominio %s non riuscita: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Creazione dell'esploratore di domini non riuscita: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Cambia dominio"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Esplorazione..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Inizializzazione..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Posizione"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nome"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Tipo"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Dominio..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [OPZIONE...]\n"
+"\n"
+" -h --help Mostra questo aiuto\n"
+" -s --ssh Esplora i server SSH\n"
+" -v --vnc Esplora i server VNC\n"
+" -S --shell Esplora sia SSH che VNC\n"
+" -d --domain=DOMINIO Il dominio da esplorare\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Troppi argomenti\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Scegliere il server shell"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Desktop"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminale"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Scegliere il server VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Scegliere il server SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Connessione a «%s» ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() non riuscita: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancellato.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Esploratore Avahi per server SSH"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Esplora i server SSH con Zeroconf abilitato"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Esploratore Avahi per server VNC"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Esplora i server VNC con Zeroconf abilitato"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Tutto per ora\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Cache esaurita\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Risoluzione del servizio «%s» di tipo «%s» nel dominio «%s» non riuscita: "
+"%s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Interrogazione della stringa di versione non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Interrogazione del nome host non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Versione server: %s; Nome host: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Inte Prot Dominio\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Inte Prot %-*s %-20s Dominio\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Disconnessi, riconnessione...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Creazione dell'oggetto client non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Fallimento client, uscita: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "In attesa del demone...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Mostra questo aiuto\n"
+" -V --version Mostra la versione\n"
+" -D --browse-domains Esplora per domini di esplorazione invece\n"
+" che per servizi\n"
+" -a --all Mostra tutti i servizi, indifferentemente dal tipo\n"
+" -d --domain=DOMINIO Il dominio da esplorare\n"
+" -v --verbose Abilita la modalità prolissa\n"
+" -t --terminate Termina dopo aver riversato un elenco più\n"
+" o meno completo\n"
+" -c --cache Termina dopo aver riversato tutte le voci dalla "
+"cache\n"
+" -l --ignore-local Ignora i servizi locali\n"
+" -r --resolve Risolve i servizi trovati\n"
+" -f --no-fail Non fallisce se il demone non è disponibile\n"
+" -p --parsable Output nel formato analizzabile\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Non controlla i tipi di servizi\n"
+" -b --dump-db Scarica il database dei tipi di servizi\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Troppo pochi argomenti\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Creazione oggetto simple poll non riuscita.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Stabilito sotto il nome «%s»\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Registrazione non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Collisione di nome, selezionato il nuovo nome «%s».\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Creazione del gruppo di voci non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Aggiunta dell'indirizzo non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Aggiunta del servizio non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Aggiunta del sottotipo «%s» non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Conflitto di nome host\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [OPZIONE...] %s <nome> <tipo> <porta> [<txt ...>]\n"
+"%s [OPZIONE...] %s <nome-host> <indirizzo>\n"
+"\n"
+" -h --help Mostra questo aiuto\n"
+" -V --version Mostra la versione\n"
+" -s --service Pubblica il servizio\n"
+" -a --address Pubblica l'indirizzo\n"
+" -v --verbose Abilita la modalità verbosa\n"
+" -d --domain=DOMAIN Dominio in cui pubblicare servizi\n"
+" -H --host=DOMAIN L'host dove risiedono i servizi\n"
+" --subtype=SUBTYPE Un sottotipo addizionale con cui registrare questo\n"
+" servizio\n"
+" -R --no-reverse Non pubblica le voci invertite con l'indirizzo\n"
+" -f --no-fail Non fallisce se il demone non è disponibile\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Numero di argomenti non valido\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Analisi del numero di porta non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Nessun comando specificato.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Risoluzione del nome host «%s» non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Risoluzione dell'indirizzo «%s» non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [OPZIONE...] %s <nome host ...>\n"
+"%s [OPZIONE...] %s <indirizzo ... >\n"
+"\n"
+" -h --help Mostra questo aiuto\n"
+" -V --version Mostra la versione\n"
+" -n --name Risolve il nome host\n"
+" -a --address Risolve l'indirizzo\n"
+" -v --verbose Abilita la modalità verbosa\n"
+" -6 Cerca indirizzi IPv6\n"
+" -4 Cerca indirizzi IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Creazione del risolutore di nome host non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Analisi dell'indirizzo «%s» non riuscita\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Creazione del risolutore di indirizzi non riuscita: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [OPZIONE...] <nuovo nome host>\n"
+"\n"
+" -h --help Mostra questo aiuto\n"
+" -V --version Mostra la versione\n"
+" -v --verbose Abilita la modalità verbosa\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Numero di argomenti non valido, ne è atteso esattamente uno.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Nome host cambiato con successo in %s\n"
diff --git a/po/ja.po b/po/ja.po
new file mode 100644
index 0000000..ec3a05c
--- /dev/null
+++ b/po/ja.po
@@ -0,0 +1,859 @@
+# Japanese translation of avahi messages.
+# Copyright (C) 2008-2010 avahi
+# This file is distributed under the same license as avahi.
+# Hideki Yamane (Debian-JP) <henrich@debian.or.jp>, 2009.
+# Takayuki KUSANO <AE5T-KSN@asahi-net.or.jp>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi master\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-09-05 17:46+0900\n"
+"Last-Translator: Hideki Yamane (Debian-JP) <henrich@debian.or.jp>\n"
+"Language-Team: Japanese <debian-japanese@lists.debian.org>\n"
+"Language: ja\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "æ“作ã«å¤±æ•—ã—ã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "ä¸æ­£ãªçŠ¶æ…‹ã§ã™"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "ä¸æ­£ãªãƒ›ã‚¹ãƒˆåã§ã™"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "ä¸æ­£ãªãƒ‰ãƒ¡ã‚¤ãƒ³åã§ã™"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "é©åˆ‡ãªãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ãƒ—ロトコルãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "ä¸æ­£ãª DNS TTL 値ã§ã™"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "リソースレコードキーãŒç¹°ã‚Šè¿”ã—ã«ãªã£ã¦ã„ã¾ã™"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "ローカルåã®è¡çªãŒç™ºç”Ÿã—ã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "ä¸æ­£ãªãƒ¬ã‚³ãƒ¼ãƒ‰ã§ã™"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "ä¸æ­£ãªã‚µãƒ¼ãƒ“スåã§ã™"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "ä¸æ­£ãªã‚µãƒ¼ãƒ“スタイプã§ã™"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "ä¸æ­£ãªãƒãƒ¼ãƒˆç•ªå·ã§ã™"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "ä¸æ­£ãªãƒ¬ã‚³ãƒ¼ãƒ‰ã‚­ãƒ¼ã§ã™"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "ä¸æ­£ãªã‚¢ãƒ‰ãƒ¬ã‚¹ã§ã™"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "タイムアウトã«é”ã—ã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "クライアントãŒå¤šã™ãŽã¾ã™"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "オブジェクトãŒå¤šã™ãŽã¾ã™"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "エントリãŒå¤šã™ãŽã¾ã™"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "OS エラー"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "アクセスãŒæ‹’å¦ã•ã‚Œã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "ä¸æ­£ãªæ“作ã§ã™"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "予期ã—ãªã„ D-Bus ã®ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "デーモンã®æŽ¥ç¶šãŒå¤±æ•—ã—ã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "メモリä¸è¶³ã§ã™"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "ä¸æ­£ãªã‚ªãƒ–ジェクトãŒæ¸¡ã•ã‚Œã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "デーモンãŒå‹•ä½œã—ã¦ã„ã¾ã›ã‚“"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "ä¸æ­£ãªã‚¤ãƒ³ã‚¿ãƒ¼ãƒ•ã‚§ã‚¤ã‚¹ä¸€è¦§ã§ã™"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "ä¸æ­£ãªãƒ—ロトコル定義ã§ã™"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "ä¸æ­£ãªãƒ•ãƒ©ã‚°ã§ã™"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "見ã¤ã‹ã‚Šã¾ã›ã‚“"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "ä¸æ­£ãªè¨­å®šã§ã™"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒä¸€è‡´ã—ã¾ã›ã‚“"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "サービスã®ã‚µãƒ–タイプãŒä¸æ­£ã§ã™"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "ä¸æ­£ãªãƒ‘ケットã§ã™"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "DNS ã®ãƒªã‚¿ãƒ¼ãƒ³ã‚³ãƒ¼ãƒ‰ãŒä¸æ­£ã§ã™"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: NOAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS ãŒå¤±æ•—ã—ã¾ã—ãŸ: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "ä¸æ­£ãª RDATA ã§ã™"
+
+# http://jprs.jp/tech/index.html#dns-rfc-info ã§ã€Œã‚¿ã‚¤ãƒ—ã€ãŒä½¿ç”¨ã•ã‚Œã¦ã„ã‚‹
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "ä¸æ­£ãª DNS タイプã§ã™"
+
+# http://jprs.jp/tech/index.html#dns-rfc-info ã§ã€Œã‚¯ãƒ©ã‚¹ã€ãŒä½¿ç”¨ã•ã‚Œã¦ã„ã‚‹
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "ä¸æ­£ãª DNS クラスã§ã™"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "サãƒãƒ¼ãƒˆã•ã‚Œã¦ã„ã¾ã›ã‚“"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "許å¯ã•ã‚Œã¦ã„ã¾ã›ã‚“"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "引数ãŒä¸æ­£ã§ã™"
+
+# AVAHI_ERR_IS_EMPTY ã®ã‚¨ãƒ©ãƒ¼
+# NEWS より引用:
+# * API: Return AVAHI_ERR_IS_EMPTY when the user tries to commit an
+# empty entry group.
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "グループãŒç©ºã§ã™"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "è¦æ±‚ã•ã‚ŒãŸæ“作ãŒéŽå‰°ã§ã‚ã£ãŸç‚ºã€æ“作ãŒç•°å¸¸ã‚’èµ·ã“ã—ã¾ã—ãŸ"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "ä¸æ­£ãªã‚¨ãƒ©ãƒ¼ã‚³ãƒ¼ãƒ‰"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>ç¾åœ¨ã¯ã©ã®ã‚µãƒ¼ãƒ“スもé¸æŠžã•ã‚Œã¦ã„ã¾ã›ã‚“。</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi 検索"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf ブラウザ"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "ãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯ä¸Šã®åˆ©ç”¨å¯èƒ½ãª Zeroconf サービスを検索"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT データ"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "空"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "サービスタイプ:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "サービスå:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "ドメインå:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "インターフェイス:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "アドレス:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "サービスタイプã®æ¤œç´¢"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "NULL ã§çµ‚端ã•ã‚ŒãŸæ¤œç´¢å¯¾è±¡ã®ã‚µãƒ¼ãƒ“スタイプã®ãƒªã‚¹ãƒˆ"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "ドメイン"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+"検索ã™ã‚‹ãƒ‰ãƒ¡ã‚¤ãƒ³ã‚’入力ã™ã‚‹ã‹ã€ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã®ãƒ‰ãƒ¡ã‚¤ãƒ³ã¨ã—㦠NULL を指定ã™ã‚‹"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "サービスタイプ"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "é¸æŠžã•ã‚ŒãŸã‚µãƒ¼ãƒ“スã®ã‚µãƒ¼ãƒ“スタイプ"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "サービスå"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "é¸æŠžã•ã‚ŒãŸã‚µãƒ¼ãƒ“スã®ã‚µãƒ¼ãƒ“スå"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "アドレス"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "解決ã•ã‚ŒãŸã‚µãƒ¼ãƒ“スã®ã‚¢ãƒ‰ãƒ¬ã‚¹"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "ãƒãƒ¼ãƒˆ"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "解決ã•ã‚ŒãŸã‚µãƒ¼ãƒ“ス㮠IP ãƒãƒ¼ãƒˆç•ªå·"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "ホストå"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "解決ã•ã‚ŒãŸã‚µãƒ¼ãƒ“スã®ãƒ›ã‚¹ãƒˆå"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT データ"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "解決ã•ã‚ŒãŸã‚µãƒ¼ãƒ“ス㮠TXT データ"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "サービスã®è§£æ±º"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "戻るå‰ã«é¸æŠžã—ãŸã‚µãƒ¼ãƒ“スを自動的ã«è§£æ±º"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "サービスホストåã®è§£æ±º"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "戻るå‰ã«é¸æŠžã—ãŸã‚µãƒ¼ãƒ“スã®ãƒ›ã‚¹ãƒˆåを自動的ã«è§£æ±º"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "アドレスファミリ"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "ホストå解決ã«åˆ©ç”¨ã™ã‚‹ã‚¢ãƒ‰ãƒ¬ã‚¹ãƒ•ã‚¡ãƒŸãƒª"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi クライアントãŒå¤±æ•—ã—ã¾ã—ãŸ: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi リゾルãƒãŒå¤±æ•—ã—ã¾ã—ãŸ: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "ドメイン %2$s ã«ã¦ã‚µãƒ¼ãƒ“スタイプ %1$s ã®æ¤œç´¢ã«å¤±æ•—ã—ã¾ã—ãŸ: %3$s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi ドメインブラウザãŒå¤±æ•—ã—ã¾ã—ãŸ: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Avahi ドメインã®èª­ã¿è¾¼ã¿ã«å¤±æ•—ã—ã¾ã—ãŸ: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "検索サービスタイプã®ãƒªã‚¹ãƒˆãŒç©ºã§ã™!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Avahi サーãƒã¸ã®æŽ¥ç¶šãŒå¤±æ•—ã¾ã—ãŸ: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "<b>ローカルãƒãƒƒãƒˆãƒ¯ãƒ¼ã‚¯</b>ã§ã®ã‚µãƒ¼ãƒ“ス検索:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "ドメイン <b>%s</b> ã§ã®ã‚µãƒ¼ãƒ“ス検索:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "%1$s ã®ãƒ–ラウザ作æˆã«å¤±æ•—ã—ã¾ã—ãŸ: %2$s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "ドメイン %3$s ã®ã‚¿ã‚¤ãƒ— %2$s ã® %1$s ã®ãƒªã‚¾ãƒ«ãƒä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ: %4$s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "ドメインブラウザã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "ドメインã®å¤‰æ›´"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "検索中…"
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "åˆæœŸåŒ–中…"
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "場所"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "åå‰"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "タイプ"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "ドメイン(_D)…"
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [オプション]\n"
+"\n"
+" -h --help ã“ã®ãƒ˜ãƒ«ãƒ—を表示ã™ã‚‹\n"
+" -s --ssh SSH サーãƒã®æ¤œç´¢\n"
+" -v --vnc VNC サーãƒã®æ¤œç´¢\n"
+" -S --shell SSH 㨠VNC を検索ã™ã‚‹\n"
+" -d --domain=DOMAIN 検索ã™ã‚‹ãƒ‰ãƒ¡ã‚¤ãƒ³ã‚’指定\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "引数ãŒå¤šã™ãŽã¾ã™\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "シェルサーãƒã‚’é¸æŠž"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "デスクトップ"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "ターミナル"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "VNC サーãƒã‚’é¸æŠž"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "SSH サーãƒã‚’é¸æŠž"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "'%s' ã¸æŽ¥ç¶šä¸­â€¦\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() ãŒå¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "キャンセルã•ã‚Œã¾ã—ãŸã€‚\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH サーãƒã®æ¤œç´¢"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Zeroconf を有効ã«ã—㟠SSH サーãƒã‚’検索"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC サーãƒã®æ¤œç´¢"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Zeroconf を有効ã«ã—㟠VNC サーãƒã‚’検索"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": ã¨ã‚Šã‚ãˆãšå…¨ã¦\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": キャッシュãŒä¸è¶³ã—ã¦ã„ã¾ã™\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"ドメイン '%3$s' ã®ã‚¿ã‚¤ãƒ— '%2$s' ã®ã‚µãƒ¼ãƒ“ス '%1$s' ã®è§£æ±ºã«å¤±æ•—ã—ã¾ã—ãŸ: "
+"%4$s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser ãŒå¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() ãŒå¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser ãŒå¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() ãŒå¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() ãŒå¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "ãƒãƒ¼ã‚¸ãƒ§ãƒ³æ–‡å­—列ã®ã‚¯ã‚¨ãƒªã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "ホストåã®ã‚¯ã‚¨ãƒªã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "サーãƒã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³: %1$s; ホストå: %2$s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifce Prot ドメイン\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s ドメイン\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "切断ã•ã‚Œã¾ã—ãŸã€‚å†æŽ¥ç¶šã—ã¦ã„ã¾ã™â€¦\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "クライアントオブジェクトã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "クライアントãŒå¤±æ•—ã—ã¾ã—ãŸã€‚終了ã—ã¦ã„ã¾ã™: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "デーモンを待ã£ã¦ã„ã¾ã™...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help ã“ã®ãƒ˜ãƒ«ãƒ—を表示ã™ã‚‹\n"
+" -V --version ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’表示ã™ã‚‹\n"
+" -D --browse-domains サービスã§ã¯ãªãドメインを検索\n"
+" -a --all タイプã§ã¯ãªãã€å…¨ã¦ã®ã‚µãƒ¼ãƒ“スを表示ã™ã‚‹\n"
+" -d --domain=DOMAIN 検索ã™ã‚‹ãƒ‰ãƒ¡ã‚¤ãƒ³ã‚’指定\n"
+" -v --verbose 冗長出力モードを有効ã«ã™ã‚‹\n"
+" -t --terminate ã»ã¼å®Œå…¨ãªãƒªã‚¹ãƒˆã‚’出力ã—ãŸå¾Œã§çµ‚了ã™ã‚‹\n"
+" -c --cache キャッシュã‹ã‚‰å…¨ã¦ã®ã‚¨ãƒ³ãƒˆãƒªã‚’出力ã—ã¦çµ‚了ã™ã‚‹\n"
+" -l --ignore-local ローカルサービスを無視ã™ã‚‹\n"
+" -r --resolve 見ã¤ã‘ãŸã‚µãƒ¼ãƒ“スを解決ã™ã‚‹\n"
+" -f --no-fail デーモンãŒåˆ©ç”¨ã§ããªã„éš›ã€fail ã—ãªã„\n"
+" -p --parsable パース処ç†ãŒå¯èƒ½ãªå½¢å¼ã§å‡ºåŠ›ã™ã‚‹\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup サービスタイプを検索ã—ãªã„\n"
+" -b --dump-db サービスタイプã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’出力ã™ã‚‹\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "引数ãŒå°‘ãªã™ãŽã¾ã™\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "simple poll オブジェクトã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "åå‰ '%s' ã§æŽ¥ç¶šã‚’確立ã—ã¾ã™\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "登録ã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "åå‰ãŒè¡çªã—ã¾ã—ãŸã€‚æ–°ã—ã„åå‰ '%s' を利用ã—ã¾ã™ã€‚\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "エントリグループã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "アドレスã®è¿½åŠ ã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "サービスã®è¿½åŠ ã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "サブタイプ '%1$s' ã®è¿½åŠ ã«å¤±æ•—ã—ã¾ã—ãŸ: %2$s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "ホストåã®è¡çª\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [オプション] %s <åå‰> <タイプ> <ãƒãƒ¼ãƒˆ> [<txt ...>]\n"
+"%s [オプション] %s <ホストå> <アドレス>\n"
+"\n"
+" -h --help ã“ã®ãƒ˜ãƒ«ãƒ—を表示ã™ã‚‹\n"
+" -V --version ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’表示ã™ã‚‹\n"
+" -s --service サービスを公開ã™ã‚‹\n"
+" -a --address アドレスを公開ã™ã‚‹\n"
+" -v --verbose 冗長出力モードを有効ã«ã™ã‚‹\n"
+" -d --domain=DOMAIN サービスを公開ã™ã‚‹ãƒ‰ãƒ¡ã‚¤ãƒ³ã‚’指定\n"
+" -H --host=DOMAIN サービスãŒå­˜åœ¨ã™ã‚‹ãƒ›ã‚¹ãƒˆã‚’指定\n"
+" --subtype=SUBTYPE ã“ã®ã‚µãƒ¼ãƒ“スを登録ã™ã‚‹è¿½åŠ ã‚µãƒ–タイプを指定\n"
+" -R --no-reverse アドレスã®é€†å¼•ãエントリを公開ã—ãªã„\n"
+" -f --no-fail デーモンãŒåˆ©ç”¨ã§ããªã„際㫠fail ã—ãªã„\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "引数ã®æ•°ãŒé–“é•ã£ã¦ã„ã¾ã™\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "ãƒãƒ¼ãƒˆç•ªå·ã‚’パースã™ã‚‹ã®ã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "コマンドãŒæŒ‡å®šã•ã‚Œã¦ã„ã¾ã›ã‚“。\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "ホストå '%1$s' ã®è§£æ±ºã«å¤±æ•—ã—ã¾ã—ãŸ: %2$s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "アドレス '%1$s' ã®è§£æ±ºã«å¤±æ•—ã—ã¾ã—ãŸ: %2$s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [オプション] %s <ホストå ...>\n"
+"%s [オプション] %s <アドレス ... >\n"
+"\n"
+" -h --help ã“ã®ãƒ˜ãƒ«ãƒ—を表示\n"
+" -V --version ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’表示\n"
+" -n --name ホストåを解決\n"
+" -a --address アドレスを解決\n"
+" -v --verbose 冗長出力モードを有効ã«ã™ã‚‹\n"
+" -6 IPv6 アドレスã§æ¤œç´¢\n"
+" -4 IPv4 アドレスã§æ¤œç´¢\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "ホストåã®ãƒªã‚¾ãƒ«ãƒä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "アドレス '%s' ã®å‡¦ç†ã«å¤±æ•—ã—ã¾ã—ãŸ\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "アドレスã®ãƒªã‚¾ãƒ«ãƒä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸ: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [オプション] <æ–°ã—ã„ホストå>\n"
+"\n"
+" -h --help ã“ã®ãƒ˜ãƒ«ãƒ—を表示\n"
+" -V --version ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã‚’表示\n"
+" -v --verbose 冗長出力モードを有効ã«ã™ã‚‹\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "引数ã®æ•°ãŒä¸æ­£ã§ã™ã€ä¸€ã¤ã ã‘を指定ã—ã¦ãã ã•ã„。\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "ホストå㯠%s ã«å¤‰æ›´ã•ã‚Œã¾ã—ãŸ\n"
diff --git a/po/ms.po b/po/ms.po
new file mode 100644
index 0000000..58db564
--- /dev/null
+++ b/po/ms.po
@@ -0,0 +1,851 @@
+# avahi Bahasa Melayu (Malay) (ms)
+# Copyright (C) 2008 Avahi Project
+# This file is distributed under the same license as the avahi package.
+# Sharuzzaman Ahmat Raslan <sharuzzaman@myrealbox.com>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-10-12 22:23+0800\n"
+"Last-Translator: Ahmed Noor Kader Mustajir Md Eusoff <sir.ade@gmail.com>\n"
+"Language-Team: Malay <translation-team-ms@lists.sourceforge.net>\n"
+"Language: ms\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operasi gagal"
+
+#: ../avahi-common/error.c:32
+#, fuzzy
+msgid "Bad state"
+msgstr "Keadaan jasad"
+
+#: ../avahi-common/error.c:33
+#, fuzzy
+msgid "Invalid host name"
+msgstr "Nama Kumpulan Volum Tidak Sah"
+
+#: ../avahi-common/error.c:34
+#, fuzzy
+msgid "Invalid domain name"
+msgstr "Nama domain tetamu"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr ""
+
+#: ../avahi-common/error.c:36
+#, fuzzy
+msgid "Invalid DNS TTL"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+#, fuzzy
+msgid "Local name collision"
+msgstr "Name=Jaringan Setempat"
+
+#: ../avahi-common/error.c:39
+#, fuzzy
+msgid "Invalid record"
+msgstr "Rekod melimpah"
+
+#: ../avahi-common/error.c:41
+#, fuzzy
+msgid "Invalid service name"
+msgstr "Nama Kumpulan Volum Tidak Sah"
+
+#: ../avahi-common/error.c:42
+#, fuzzy
+msgid "Invalid service type"
+msgstr "Jenis Senarai Semasa"
+
+#: ../avahi-common/error.c:43
+#, fuzzy
+msgid "Invalid port number"
+msgstr "Port FTP mestilah nombor."
+
+#: ../avahi-common/error.c:44
+#, fuzzy
+msgid "Invalid record key"
+msgstr "Kekunci ID tidak sah (%s)"
+
+#: ../avahi-common/error.c:45
+#, fuzzy
+msgid "Invalid address"
+msgstr "Buku Alamat"
+
+#: ../avahi-common/error.c:46
+#, fuzzy
+msgid "Timeout reached"
+msgstr "Pelayan masatamat"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Terlalu banyak klien"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Terlalu banyak objek"
+
+#: ../avahi-common/error.c:49
+#, fuzzy
+msgid "Too many entries"
+msgstr "Terlalu banyak gantian"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Ralat OS"
+
+#: ../avahi-common/error.c:52
+#, fuzzy
+msgid "Access denied"
+msgstr "Akses telah dihalang"
+
+#: ../avahi-common/error.c:53
+#, fuzzy
+msgid "Invalid operation"
+msgstr "Tanda operasi:"
+
+#: ../avahi-common/error.c:54
+#, fuzzy
+msgid "An unexpected D-Bus error occurred"
+msgstr ""
+"Ralat tidak dijangka telah berlaku:\n"
+"%s"
+
+#: ../avahi-common/error.c:55
+#, fuzzy
+msgid "Daemon connection failed"
+msgstr "Pelaksanaan gpg gagal (%d)\n"
+
+#: ../avahi-common/error.c:56
+#, fuzzy
+msgid "Memory exhausted"
+msgstr "kehabisan memori"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr ""
+
+#: ../avahi-common/error.c:58
+#, fuzzy
+msgid "Daemon not running"
+msgstr "%s tidak dilaksanakan.\n"
+
+#: ../avahi-common/error.c:59
+#, fuzzy
+msgid "Invalid interface index"
+msgstr "Papar Indeks Bantuan"
+
+#: ../avahi-common/error.c:60
+#, fuzzy
+msgid "Invalid protocol specification"
+msgstr "Guna protokol TCP"
+
+#: ../avahi-common/error.c:61
+#, fuzzy
+msgid "Invalid flags"
+msgstr "Nama path tidak sah."
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Tidak dijumpai"
+
+#: ../avahi-common/error.c:64
+#, fuzzy
+msgid "Invalid configuration"
+msgstr "Tetapan KFish"
+
+#: ../avahi-common/error.c:65
+#, fuzzy
+msgid "Version mismatch"
+msgstr "Katalaluan Tidak Sepadan"
+
+#: ../avahi-common/error.c:66
+#, fuzzy
+msgid "Invalid service subtype"
+msgstr "Konfigur penemuan servis"
+
+#: ../avahi-common/error.c:67
+#, fuzzy
+msgid "Invalid packet"
+msgstr "Nama path tidak sah."
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr ""
+
+#: ../avahi-common/error.c:69
+#, fuzzy
+msgid "DNS failure: FORMERR"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:70
+#, fuzzy
+msgid "DNS failure: SERVFAIL"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:71
+#, fuzzy
+msgid "DNS failure: NXDOMAIN"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:72
+#, fuzzy
+msgid "DNS failure: NOTIMP"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:74
+#, fuzzy
+msgid "DNS failure: REFUSED"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:75
+#, fuzzy
+msgid "DNS failure: YXDOMAIN"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:76
+#, fuzzy
+msgid "DNS failure: YXRRSET"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:77
+#, fuzzy
+msgid "DNS failure: NXRRSET"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:78
+#, fuzzy
+msgid "DNS failure: NOTAUTH"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:79
+#, fuzzy
+msgid "DNS failure: NOTZONE"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:80
+#, fuzzy
+msgid "Invalid RDATA"
+msgstr "Nama path tidak sah."
+
+#: ../avahi-common/error.c:81
+#, fuzzy
+msgid "Invalid DNS type"
+msgstr "Jenis Senarai Semasa"
+
+#: ../avahi-common/error.c:82
+#, fuzzy
+msgid "Invalid DNS class"
+msgstr "Pelayan Nama DNS"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Tidak disokong"
+
+#: ../avahi-common/error.c:85
+#, fuzzy
+msgid "Not permitted"
+msgstr "Tiada"
+
+#: ../avahi-common/error.c:86
+#, fuzzy
+msgid "Invalid argument"
+msgstr "hujah tidak sah %s untuk %s"
+
+#: ../avahi-common/error.c:87
+#, fuzzy
+msgid "Is empty"
+msgstr "Pilihan Semasa adalah Kosong"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr ""
+
+#: ../avahi-common/error.c:94
+#, fuzzy
+msgid "Invalid Error Code"
+msgstr "(kod ralat tidak diketahui)"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi Zeroconf Browser"
+msgstr "Pelayan VNC kini terlaksana."
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Data TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "kosong"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Jenis Servis:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Nama Servis:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Nama Domain:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Alamat:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domain"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Jenis Servis"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nama Servis"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Alamat"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nama Hos"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Data TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Nama Kumpulan Volum Tidak Sah"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Nama Kumpulan Volum Tidak Sah"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:326
+#, fuzzy, c-format
+msgid "Avahi client failure: %s"
+msgstr "Klien Pelayan Terminal"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, fuzzy, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Memulakan daemon Avahi:"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, fuzzy, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Penambahan %s ke Pelayan Terminal gagal!\n"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Tukar domain"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+#, fuzzy
+msgid "Browsing..."
+msgstr "Konfigur pelayaran lanjutan"
+
+#: ../avahi-ui/avahi-ui.c:1120
+#, fuzzy
+msgid "Initializing..."
+msgstr "Persediaan..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Lokasi"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nama"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Jenis"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domain..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, fuzzy, c-format
+msgid "Too many arguments\n"
+msgstr "%s: terlalu banyak hujah\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Pilih Pelayan Shell"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Desktop"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Pilih Pelayan VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Pilih Pelayan SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Menyambung ke %s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, fuzzy, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Sambungan Gagal"
+
+#: ../avahi-ui/bssh.c:250
+#, fuzzy, c-format
+msgid "Canceled.\n"
+msgstr "Pengguna membatalkan"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi VNC Server Browser"
+msgstr "Pelayan VNC kini terlaksana."
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, fuzzy, c-format
+msgid ": All for now\n"
+msgstr "Pemasang akan keluar sekarang..."
+
+#: ../avahi-utils/avahi-browse.c:118
+#, fuzzy, c-format
+msgid ": Cache exhausted\n"
+msgstr "kehabisan memori"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, fuzzy, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Gagal untuk Menerbitkan Servis"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:414
+#, fuzzy, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Gagal untuk Menerbitkan Servis"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, fuzzy, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Name=Pelayan Fail Awam"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, fuzzy, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "domain NIS default"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, fuzzy, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Mandriva - Kali Pertama - Tidak bersambung"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, fuzzy, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Klien Pelayan Terminal"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, fuzzy, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Menunggu sambungan telnet..."
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, fuzzy, c-format
+msgid "Too few arguments\n"
+msgstr "%s: terlalu banyak hujah\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, fuzzy, c-format
+msgid "Established under name '%s'\n"
+msgstr "Simpan dokumen dengan nama lain"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, fuzzy, c-format
+msgid "Failed to register: %s\n"
+msgstr "Menulis ke %s gagal!"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, fuzzy, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Name=Ada Berita Mutakhir"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Gagal untuk menambah alamat: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Gagal untuk menambah servis: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Gagal untuk menambah sub jenis '%s': %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Konflik nama hos\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Jumlah hujah tidak tepat\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Tiada arahan dinyatakan.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Gagal untuk menyelesai alamat '%s': %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Gagal untuk menghurai alamat '%s'\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr ""
diff --git a/po/nl.po b/po/nl.po
new file mode 100644
index 0000000..f287d38
--- /dev/null
+++ b/po/nl.po
@@ -0,0 +1,802 @@
+# Dutch translation of avahi
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+# Geert Warrink <geert.warrink@onsnet.nu>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-09-01 17:59+0200\n"
+"Last-Translator: Geert Warrink <geert.warrink@onsnet.nu>\n"
+"Language-Team: nl <nl@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr ""
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr ""
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr ""
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr ""
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr ""
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr ""
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr ""
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr ""
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr ""
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr ""
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr ""
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr ""
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr ""
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr ""
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr ""
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr ""
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr ""
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr ""
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr ""
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr ""
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr ""
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr ""
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr ""
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr ""
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr ""
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr ""
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr ""
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr ""
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr ""
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr ""
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr ""
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr ""
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr ""
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr ""
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr ""
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr ""
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr ""
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr ""
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr ""
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr ""
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr ""
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr ""
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr ""
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr ""
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr ""
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr ""
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr ""
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr ""
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr ""
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr ""
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr ""
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr ""
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr ""
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr ""
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr ""
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr ""
diff --git a/po/pl.po b/po/pl.po
new file mode 100644
index 0000000..a0b2f10
--- /dev/null
+++ b/po/pl.po
@@ -0,0 +1,853 @@
+# translation of pl.po to Polish
+# Piotr DrÄ…g <piotrdrag@gmail.com>, 2007.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: pl\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-06-29 10:36+0200\n"
+"Last-Translator: Piotr DrÄ…g <piotrdrag@gmail.com>\n"
+"Language-Team: Polish <trans-pl@lists.fedoraproject.org>\n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Działanie nie powiodło się"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Błędny stan"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nieprawidłowa nazwa komputera"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nieprawidłowa nazwa domeny"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Brak dostępnych odpowiednich protokołów sieciowych"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Nieprawidłowe TTL serwera DNS"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Klucz wpisu zasobu jest wzorem"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Kolizja nazwy lokalnej"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Nieprawidłowy wpis"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nieprawidłowa nazwa usługi"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Nieprawidłowy typ usługi"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Nieprawidłowy numer portu"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Nieprawidłowy klucz wpisu"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Nieprawidłowy adres"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Przekroczono czas oczekiwania"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Za dużo klientów"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Za dużo obiektów"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Za dużo wpisów"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "BÅ‚Ä…d systemu operacyjnego"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Brak dostępu"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Nieprawidłowe działanie"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Wystąpił nieoczekiwany błąd usługi D-Bus"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Połączenie z demonem nie powiodło się"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Wyczerpano pamięć"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Przepuszczony obiekt nie był prawidłowy"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Demon nie jest uruchomiony"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Nieprawidłowy indeks interfejsu"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Nieprawidłowa specyfikacja protokołu"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Nieprawidłowe flagi"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Nie odnaleziono"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Nieprawidłowa konfiguracja"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Wersje nie zgadzajÄ… siÄ™"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Nieprawidłowy podtyp usługi"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Nieprawidłowy pakiet"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Nieprawidłowy kod zwrotny DNS"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS nie powiodło się: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS nie powiodło się: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS nie powiodło się: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS nie powiodło się: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS nie powiodło się: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS nie powiodło się: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS nie powiodło się: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS nie powiodło się: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS nie powiodło się: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS nie powiodło się: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Nieprawidłowe RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Nieprawidłowy typ DNS"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Nieprawidłowa klasa DNS"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Nieobsługiwane"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Niedozwolone"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Nieprawidłowy parametr"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Jest puste"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Zażądane działanie jest nieprawidłowe, ponieważ jest nadmiarowe"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Nieprawidłowy kod błędu"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Nie wybrano żadnej usługi.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Wykrywanie Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "PrzeglÄ…darka Zeroconf Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Przeglądanie usług Zeroconf dostępnych w sieci"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "Tekst"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Dane tekstowe:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "puste"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Typ usługi:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Nazwa usługi:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Nazwa domeny:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Interfejs:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Adres:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Przeglądanie typów usług"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Lista typów usług do przeglądania zakończona NULL"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domena"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Domena do przeglądania lub NULL dla domyślnej domeny"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Typ usługi"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Typ wybranej usługi"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nazwa usługi"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Nazwa wybranej usługi"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adres"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Adres rozwiązanej usługi"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Numer portu IP rozwiązanej usługi"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nazwa komputera"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Nazwa komputera rozwiązanej usługi"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Dane tekstowe"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Dane tekstowe rozwiązanej usługi"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Rozwiązywanie usługi"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Rozwiązywanie wybranej usługi automatycznie przed zwracaniem"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Rozwiązywanie nazwy komputera usługi"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+"Rozwiązywanie nazwy komputera wybranej usługi automatycznie przed zwracaniem"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Rodzina adresów"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Rodzina adresów do rozwiązywania nazwy komputera"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Klient Avahi nie powiódł się: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Rozwiązywanie Avahi nie powiodło się: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Przeglądanie typu usług %s w domenie %s nie powiodło się: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "Nie dotyczy"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Przeglądarka domen Avahi nie powiodła się: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Odczytanie domeny Avahi nie powiodło się: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Przeglądana lista typów usług jest pusta."
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Połączenie się z serwerem Avahi nie powiodło się: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Przeglądanie usług w <b>lokalnej sieci</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Przeglądanie usług w domenie <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Utworzenie przeglądarki dla %s nie powiodło się: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Utworzenie rozwiązania dla %s typu %s w domenie %s nie powiodło się: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Utworzenie przeglądarki domen nie powiodło się: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Zmiana domeny"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "PrzeglÄ…danie..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Inicjowanie..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Położenie"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nazwa"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Typ"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domena..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opcje]\n"
+"\n"
+" -h --help Wyświetla tę pomoc\n"
+" -s --ssh PrzeglÄ…da serwery SSH\n"
+" -v --vnc PrzeglÄ…da serwery VNC\n"
+" -S --shell PrzeglÄ…da SSH i VNC\n"
+" -d --domain=DOMENA Domena do przeglÄ…dania\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Za dużo parametrów\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Wybór powłoki serwera"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Pulpit"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Wybór serwera VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Wybór serwera SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "ÅÄ…czenie z \"%s\"...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() nie powiodło się: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Anulowano.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Przeglądarka serwerów SSH Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Przeglądanie serwerów SSH z włączonym Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Przeglądarka serwerów VNC Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Przeglądanie serwerów VNC z włączonym Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Wszystko\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Wyczerpano pamięć podręczną\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Rozwiązanie usługi \"%s\" typu \"%s\" w domenie \"%s\" nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Odpytanie łańcucha wersji nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Odpytanie nazwy komputera nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Wersja serwera: %s; nazwa komputera: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Interfejs Protokół Domena\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Interfejs Protokół %-*s %-20s Domena\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Rozłączono, ponowne łączenie...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Utworzenie obiektu klienta nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Klient nie powiódł się, kończenie działania: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Oczekiwanie na demona...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Wyświetla tę pomoc\n"
+" -V --version Wyświetla wersję\n"
+" -D --browse-domains Przegląda domeny zamiast usług\n"
+" -a --all Wyświetla wszystkie usługi, niezależnie od ich\n"
+" typu\n"
+" -d --domain=DOMENA Domena do przeglÄ…dania\n"
+" -v --verbose Wyświetla więcej informacji\n"
+" -t --terminate Wyłącza po zrzuceniu bardziej lub mniej\n"
+" kompletnej listy\n"
+" -c --cache Wyłącza po zrzuceniu wszystkich wpisów z pamięci\n"
+" podręcznej\n"
+" -l --ignore-local Ignoruje lokalne usługi\n"
+" -r --resolve Rozwiązuje znalezione usługi\n"
+" -f --no-fail Nie wyłącza, jeśli demon nie jest dostępny\n"
+" -p --parsable Wyjście w formacie do przetwarzania\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Nie przeszukuje typów usług\n"
+" -b --dump-db Zrzuca bazę danych typów usług\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Za mało parametrów\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Utworzenie prostego obiektu typu \"poll\" nie powiodło się.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Ustanowiono pod nazwÄ… \"%s\"\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Zarejestrowanie nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Kolizja nazw, wybieranie nowej nazwy \"%s\".\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Utworzenie grupy wpisów nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Dodanie adresu nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Dodanie usługi nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Dodanie podtypu \"%s\" nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Konflikt nazw komputerów\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opcje] %s <nazwa> <typ> <port> [<tekst...>]\n"
+"%s [opcje] %s <nazwa-komputera> <adres>\n"
+"\n"
+" -h --help Wyświetla tę pomoc\n"
+" -V --version Wyświetla wersję\n"
+" -s --service Publikuję usługę\n"
+" -a --address Publikuje adres\n"
+" -v --verbose Wyświetla więcej informacji\n"
+" -d --domain=DOMENA Domena, w której opublikować usługę\n"
+" -H --host=DOMENA Komputer, na jakim znajduje się usługa\n"
+" --subtype=PODTYP Dodatkowy podtyp do zarejestrowania tej usługi\n"
+" -R --no-reverse Nie publikuje odwróconego wpisu z adresem\n"
+" -f --no-fail Nie wyłącza, jeśli demon nie jest dostępny\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Błędna liczba parametrów\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Przetworzenie numeru portu nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Nie podano polecenia.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Rozwiązanie nazwy komputera \"%s\" nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Rozwiązanie adresu \"%s\" nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opcje] %s <nazwa komputera...>\n"
+"%s [opcje] %s <adres...>\n"
+"\n"
+" -h --help Wyświetla tę pomoc\n"
+" -V --version Wyświetla wersję\n"
+" -n --name RozwiÄ…zuje nazwÄ™ komputera\n"
+" -a --address RozwiÄ…zuje adres\n"
+" -v --verbose Wyświetla więcej informacji\n"
+" -6 Przeszukuje adresy IPv6\n"
+" -4 Przeszukuje adresy IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Utworzenie rozwiązania nazwy komputera nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Przetworzenie adresu \"%s\" nie powiodło się\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Utworzenie rozwiązania adresu nie powiodło się: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opcje] <nowa nazwa komputera>\n"
+"\n"
+" -h --help Wyświetla tę pomoc\n"
+" -V --version Wyświetla wersję\n"
+" -v --verbose Wyświetla więcej informacji\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Nieprawidłowa liczba parametrów, oczekiwano dokładnie jednego.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Zmiana nazwy komputera na %s powiodła się\n"
diff --git a/po/pt_BR.po b/po/pt_BR.po
new file mode 100644
index 0000000..bde3e62
--- /dev/null
+++ b/po/pt_BR.po
@@ -0,0 +1,863 @@
+# Brazilian Portuguese translation of Avahi.
+# This file is distributed under the same license as the avahi package.
+#
+# Lucas Saboya <lucas@cefetce.br>, 2008.
+# Igor Pires Soares <igor@projetofedora.org>, 2008.
+# Taylon Silmer <taylonsilva@gmail.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-03-16 11:15-0300\n"
+"Last-Translator: Taylon <taylonsilva@gmail.com>\n"
+"Language-Team: Brazilian Portuguese <fedora-trans-pt_br@redhat.com>\n"
+"Language: pt_BR\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+"X-Poedit-Language: Portuguese\n"
+"X-Poedit-Country: BRAZIL\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "A operação falhou"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Estado inválido"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nome de máquina inválido"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nome de domínio inválido"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Não há nenhum protocolo de rede apropriado disponível"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "DNS TTL Inválido"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Chave de gravação de recurso é a padrão"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Conflito de nome local"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Registro inválido"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nome de serviço inválido"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Tipo de serviço inválido"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Número de porta inválido"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Chave de gravação inválida"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Endereço inválido"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Tempo limite esgotado"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Muitos clientes simultâneos"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Muitos objetos simultâneos"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Muitas entradas simultâneas"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Erro do SO"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Acesso negado"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Operação inválida"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Ocorreu um erro inesperado do D-BUS"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "A conexão com o daemon falhou"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memória esgotada"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "O objeto submetido não é válido"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "O daemon não está em execução"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ãndice de interface inválido"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Especificação do protocolo inválida"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Sinalizadores inválidos"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Não encontrado"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Configuração inválida"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Incompatibilidade de versões"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Subtipo de serviço inválido"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Pacote inválido"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Código de retorno de DNS inválido"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Falha de DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Falha de DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Falha de DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Falha de DNS: NO TIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Falha de DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Falha de DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Falha de DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Falha de DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Falha de DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Falha de DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA inválido"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Tipo de DNS inválido"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Classe de DNS inválida"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Não suportado(a)"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Não permitido(a)"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argumento inválido"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Está vazio"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "A operação de requisição é inválida porque é redundante"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Código de Erro Inválido"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Nenhum serviço selecionado atualmente.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi Discovery"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Navegador Zeroconf do Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Procurar por serviços Zeroconf disponíveis em sua rede"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "Dados TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Está vazio"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Tipo do serviço"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Nome do serviço"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Domínio"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Endereço"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Procurar tipos de serviços"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Uma lista NÃO terminada dos tipos de serviços para navegar"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domínio"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "O domínio a navegar ou ZERO para o domínio padrão"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tipo do serviço"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "O tipo de serviço do serviço selecionado"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nome do serviço"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "O nome do serviço selecionado"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Endereço"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "O endereço do serviço resolvido"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Porta"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "O número IP da porta do serviço resolvido"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nome da máquina"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "O nome da máquina do serviço resolvido"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Dados TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Os dados TXT do serviço resolvido"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Resolver serviço"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Resolver serviço de nome da máquina"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Família do endereço"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "A família do endereço para o resolução de nome da máquina"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Falha no cliente do Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Falha no resolvedor do Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "A navegação pelo serviço %s no domínio %s falhou: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Falha no navegador de domínios do Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Falha ao ler o domínio do Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "A lista de tipos de serviços está vazia!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Falha ao conectar no servidor do Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Procurando por serviços na <b>Rede local</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Procurando por serviços no domínio <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Falha ao criar navegador para %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Falha ao criar um resolvedor para %s do tipo %s no domínio %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Falha ao criar o navegador de domínios: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Alterar domínio"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Procurando..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Inicializando..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Localização"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nome"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Type"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domínio..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opções]\n"
+"\n"
+" -h --help Mostra essa ajuda\n"
+" -s --ssh Procura por servidores SSH\n"
+" -v --vnc Procura por servidores VNC\n"
+" -S --shell Procura por servidores SSH e VNC\n"
+" -d --domain=DOMAIN O domínio no qual se deseja que seja procurado\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Muitos argumentos\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Escolha um servidor de shell"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Ãrea de trabalho"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Escolha um servidor VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Escolha um servidor SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Conectando a \"%s\" ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() falhou: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Cancelado.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Navegador de servidores SSH do Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Procurar por Servidores SSH com o Zeroconf Habilitado"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Navegador de servidores VNC do Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Procurar por Servidores VNC com Zeroconf Habilitado"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Tudo por enquanto\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Cache esgotado\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Falha ao resolver o serviço \"%s\" do tipo \"%s\" no domínio \"%s\": %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser falhou: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() falhou: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser falhou: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() falhou: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() falhou: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Falha ao consultar a string de versão: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Falha ao consultar o nome de máquina: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Versão do servidor: %s; Nome de máquina: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Inter Prot Domínio\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Inter Prot %-*s %-20s Domínio\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Desconectado, reconectando...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Falha ao criar objeto cliente: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Falha no cliente, saindo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Esperando pelo daemon...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Mostra essa ajuda\n"
+" -V --version Mostra a versão\n"
+" -D --browse-domains Procura por domínios de navegação no lugar de "
+"serviços\n"
+" -a --all Mostra todos os serviços, independente do tipo\n"
+" -d --domain=DOMAIN Nome do domínio em que será procurado\n"
+" -v --verbose Habilita o modo detalhado\n"
+" -t --terminate Terminar após compilar a lista de more/less\n"
+" -c --cache Terminar após compilar todas as entradas do cache\n"
+" -l --ignore-local Ignorar serviços locais\n"
+" -r --resolve Resolver serviços encontrados\n"
+" -f --no-fail Não falhar se o daemon não estiver disponível\n"
+" -p --parsable Saída em formato analisável\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Ignorar tipos de serviços\n"
+" -b --dump-db Compilar base de dados de tipos de serviço\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Poucos argumentos\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Falha ao criar objeto de enquete simples.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Estabelecida no nome \"%s\"\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Falha ao registrar: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Colisão de nomes, escolhendo um novo nome \"%s\".\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Falha ao criar entrada de grupo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Falha ao adicionar endereço: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Falha ao adicionar serviço: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Falha ao adicionar subtipo \"%s\": %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Conflito de nome de máquina\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opções] %s <nome> <tipo> <porta> [<txt ...>]\n"
+"%s [opções] %s <nome-de-máquina> <endereço>\n"
+"\n"
+" -h --help Mostra essa ajuda\n"
+" -V --version Mostra a versão\n"
+" -s --service Publica o serviço \n"
+" -a --address Publica o endereço\n"
+" -v --verbose Habilita o modo detalhado\n"
+" -d --domain=DOMAIN Domínio onde se quer publicar o serviço\n"
+" -H --host=DOMAIN Máquina onde o serviço está\n"
+" --subtype=SUBTYPE Subtipo adicional para registrar junto ao serviço\n"
+" -f --no-fail Não falha se o daemon não estiver disponível\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Número de argumentos inválido\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Falha ao analisar o número da porta: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Nenhum comando especificado.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Falha ao resolver o nome da máquina \"%s\": %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Falha ao resolver o endereço \"%s\": %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opções] %s <nome de máquina ...>\n"
+"%s [opções] %s <endereço ... >\n"
+"\n"
+" -h --help Mostra essa ajuda\n"
+" -V --version Mostra a versão\n"
+" -n --name Resolve o nome de máquina fornecido\n"
+" -a --address Resolve o endereço fornecido\n"
+" -v --verbose Habilita o modo detalhado\n"
+" -6 Procura por endereços IPv6\n"
+" -4 Procura por endereços IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Falha ao criar o resolvedor de nomes de máquina: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Falha ao analisar o endereço \"%s\"\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Falha ao criar o resolvedor de endereços: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opções] <novo nome de máquina>\n"
+"\n"
+" -h --help Mostra essa ajuda\n"
+" -V --version Mostra a versão\n"
+" -v --verbose Habilita o modo detalhado\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Número de argumentos inválido, esperando exatamente um.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Nome de máquina alterado para %s com sucesso\n"
diff --git a/po/ro.po b/po/ro.po
new file mode 100644
index 0000000..e270063
--- /dev/null
+++ b/po/ro.po
@@ -0,0 +1,855 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Fedora 10\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-10-03 13:23+0200\n"
+"Last-Translator: Adi Roiban <adi@roiban.ro>\n"
+"Language-Team: Romanian <LL@li.org>\n"
+"Language: ro\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n == 1 ? 0: (((n % 100 > 19) || ((n % 100 "
+"== 0) && (n != 0))) ? 2: 1));\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operațiune eșuată"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Stare greșită"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Nume gazdă nevalid"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Nume domeniu nevalid"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Nu este disponibil nici un protocol de rețea"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "DNS TTL nevalid"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Înregistrarea cheie resursă este model"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Coliziune nume local"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Înregistrare nevalidă"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Nume serviciu nevalid"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Tip serviciu nevalid"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Număr port nevalid"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Cheie înregistrare nevalidă"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Adresă nevalidă"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Timp expirat"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Prea mulți clienți"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Prea multe obiecte"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Prea multe intrări"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Eroare SO"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Acces refuzat"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Operație nevalidă"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "S-a produs o eroare D-Bus"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Conxiune serviciu eșuată"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memorie epuizată"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Obiectul trimis nu este valid"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Serviciul nu funcționează"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Index interfeță nevalid"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Protocol specificat nevalid"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Marcaje nevalide"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Nu a fost găsit"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Configurație nevalidă"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Versiunea nu corespunde"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Subtip serviciu nevalid"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Pachet nevalid"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Cod returnat DNS nevalid"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS eșuat: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS eșuat: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS eșuat: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS eșuat: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS eșuat: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS eșuat: YXDMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS eșuat: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS eșuat: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS eșuat: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS eșuat: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "RDATA nevalid"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Tip DNS nevalid"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Clasă DNS nevalidă"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Nu este suportat"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Nu este permis"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Argument nevalid"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Este gol"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Operația cerută nu este validă deoarece este redundantă"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Cod de eroare nevalid"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Nici un serviciu selectat curent.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Descoperire Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Navigator Avahi Zeroconf"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Descoperă serviciile Zeroconf disponibile în rețeaua dumneavoastră."
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "Date TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Este gol"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Tip serviciu"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Nume serviciu"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Domeniu"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Adresă"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Navigare tipuri servicii"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "O listă terminată în NULL de servicii care să fie descoperite"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domeniu"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Domeniu pentru care să se descopere, sau NULL pentru domeniul implicit"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tip serviciu"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Tipul serviciului pentru serviciul selectat"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Nume serviciu"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Numele serviciului selectat"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adresă"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Adresa serviciului rezolvat"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Numărul portului IP al serviciului rezolvat"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Nume gazdă"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Numele de gazdă a serviciului rezolvat"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Date TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Datele TXT a serviciului rezolvat"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Rezolvare serviciu"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Rezolvă nume de gazdă a serviciului"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Familie adresă"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Familia adresei pentru rezolvarea numelui de gazdă"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Clientul Avahi a eșuat: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Eroare rezolvare Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Căutarea pentru tipul serviciului %s în domeniul %s a eșuat: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Navigatorul domeniu Avahi a eșuat: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Încercare de citire domeniu Avahi eșuată: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Lista tipului de servici este vidă!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Conectarea la serverul Avahi a eșuat: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Navigare servicii în <b>rețea locală</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Navigare servicii în domeniu <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Creare navigator a eșuat pentru %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "A eșuat crearea resolver-ului pentru %s de tipul %s în domeniul %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Creare navigator domeniu a eșuat: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Schimbă domeniu"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Se descoperă..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Se inițializează..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Locație"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Nume"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Tip"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domeniu..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opțiuni]\n"
+"\n"
+" -h --help Afișează acest ajutor\n"
+" -s --ssh Navigare servere SSH\n"
+" -v --vnc Navigare servere VNC\n"
+" -S --shell Navigare SSH și VNC\n"
+" -d --domain=DOMAIN Domeniul de navigare\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Prea mulţi parametri\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Alegeți consolă server"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Desktop"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Alegeți server VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Alegeți server SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Se conectează la „%s†...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() a eșuat: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Anulat.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Navigator de servere SSH Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Navighează servere SSH având activat Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Navigator Avahi de server VNC"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Navigheză serverele VNC având activat Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Deocamdată atât\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Cache epuizat\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"A eÈ™uat rezolvarea serviciului „%s†de tipul „%s†din domeniul „%sâ€: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser a eșuat: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() a eșuat: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser a eșuat: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() a eșuat: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() a eșuat: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Interogare șir versiune eșuată: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Interogare nume gazdă eșuată: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Versiune server: %s; Nume server: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Domeniu E Ifce Prot\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "Domeniu E Ifce Prot %-*s %-20s\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Deconectat, se reconectează...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Crearea obiectului client a eșuat: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Clientul a eșuat, ieșire: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Se așteaptă pentru serviciu...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Afișează acest ajutor\n"
+" -V --version Afișează versiunia\n"
+" -D --browse-domains Navigare domenii de navigare în loc de servicii\n"
+" -a --all Afișează toate serviciile, indiferent de tip\n"
+" -d --domain=DOMENIU Domeniul pentru navigare\n"
+" -v --verbose Activare modul detaliat\n"
+" -t --terminate Termină după afișarea unei liste mai mult sau mai puțin "
+"complete\n"
+" -c --cache Termină după afișarea tuturor întrărilor din cache\n"
+" -l --ignore-local Ignorare servicii locale\n"
+" -r --resolve Rezolvă serviciile găsite\n"
+" -f --no-fail Nu eșua dacă serviciul nu este disponibil\n"
+" -p --parsable Ieșire în format prelucrabil\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k ---no-db-lookup Nu căuta tipuri de servicii\n"
+" -b --dump-db Arată baza de date tip serviciu\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Prea puțini parametrii\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Creare obiect interogare eșuată.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Sub nume stabilit „%sâ€\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Înregistrare eșuată: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Coloziune de nume, se alege nume nou „%sâ€.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Creare intrare grup eșuată: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Adăugare adresă eșuată: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Adăugare serviciu eșuată: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Adăugare subtip „%s†eșuată: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Conflict nume gazdă\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opțiuni] %s <nume> <tip> <port> [<txt ...>]\n"
+"%s [opțiuni] %s <nume-gazdă> <adresă>\n"
+"\n"
+" -h --help Afișarea acestui ajutor\n"
+" -V --version Afișare versiuni\n"
+" -s --service Publicare serviciu\n"
+" -a --address Publicare adresă\n"
+" -v --verbose Activare mod detaliat\n"
+" -d --domain=DOMENIU Domeniu pentru publicare serviciu\n"
+" -H --host=DOMENIU Gazda serviciului\n"
+" --subtype=SUBTIP Subtip adiționalt pentru înregistrare serviciu\n"
+" -f --no-fail Nu eșua dacă serviciul nu este disponibil\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Număr incorect de parametri\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Prelucrare număr port eșuată: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Nici o comandă specificată.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Rezolvare nume calculator gazdă „%s†a eșuat: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Rezolvare adresă „%s†eșuată: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opțiuni] %s <nume gazdă ...>\n"
+"%s [opțiuni] %s <adresă ... >\n"
+"\n"
+" -h --help Afișează acest ajutor\n"
+" -V --version Afișează versiune\n"
+" -n --name Rezolvare nume domeniu\n"
+" -a --address Rezolvare adresă\n"
+" -v --verbose Activare mod detaliat\n"
+" -6 Căutare adresă IPv6\n"
+" -4 Căutare adresă IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "A eșuat crearea rezolvatorului de nume: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Prelucrare adresă „%s†eșuată\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "A eșuat crearea rezolvatorului de adresă: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opțiuni] <nou nume calculator>\n"
+"\n"
+" -h --help Afișează acest ajutor\n"
+" -V --version Afișează versiunea\n"
+" -v --verbose Activează mod detaliat\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Numărul de parametri nu este valid. Se așteaptă unul singur.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Numele gazdei a fost modificat în %s\n"
diff --git a/po/ru.po b/po/ru.po
new file mode 100644
index 0000000..675a1d8
--- /dev/null
+++ b/po/ru.po
@@ -0,0 +1,855 @@
+# Russian translation for avahi
+# Copyright (c) 2008 Rosetta Contributors and Canonical Ltd 2008
+# This file is distributed under the same license as the avahi package.
+#
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2008.
+# Yuri Kozlov <yuray@komyakino.ru>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-08-15 13:16+0400\n"
+"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
+"Language-Team: Russian <debian-l10n-russian@lists.debian.org>\n"
+"Language: ru\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Launchpad-Export-Date: 2008-04-01 04:32+0000\n"
+"X-Generator: Lokalize 1.0\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "ОК"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Сбой операции"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Ðеверное ÑоÑтоÑние"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Ðеверное Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð°"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Ðеверное Ð¸Ð¼Ñ Ð´Ð¾Ð¼ÐµÐ½Ð°"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Ðе найден подходÑщий Ñетевой протокол"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Ðеверный TTL DNS"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Ключ запиÑи реÑурÑа ÑвлÑетÑÑ ÑˆÐ°Ð±Ð»Ð¾Ð½Ð¾Ð¼"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Перекрытие локальных имён"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "ÐÐµÐ²ÐµÑ€Ð½Ð°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Ðеверное Ð¸Ð¼Ñ Ñлужбы"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Ðеверный тип Ñлужбы"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Ðеверный номер порта"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Ðеверный ключ запиÑи"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ðеверный адреÑ"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Ð’Ñ€ÐµÐ¼Ñ Ð¾Ð¶Ð¸Ð´Ð°Ð½Ð¸Ñ Ð¸Ñтекло"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Слишком много клиентов"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Слишком много объектов"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Слишком много Ñлементов"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Ошибка ОС"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "ДоÑтуп запрещён"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "ÐÐµÐ²ÐµÑ€Ð½Ð°Ñ Ð¾Ð¿ÐµÑ€Ð°Ñ†Ð¸Ñ"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "ÐÐµÐ¾Ð¶Ð¸Ð´Ð°Ð½Ð½Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ° D-Bus"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Ðе удалоÑÑŒ ÑоединитьÑÑ Ñо Ñлужбой"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "ПамÑÑ‚ÑŒ иÑчерпана"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Переданный объект недейÑтвителен"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Служба не запущена"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ðеверный Ð¸Ð½Ð´ÐµÐºÑ Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñа"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "ÐÐµÐ²ÐµÑ€Ð½Ð°Ñ ÑÐ¿ÐµÑ†Ð¸Ñ„Ð¸ÐºÐ°Ñ†Ð¸Ñ Ð¿Ñ€Ð¾Ñ‚Ð¾ÐºÐ¾Ð»Ð°"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Ðеверные флаги"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ðе найден"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "ÐÐµÐ²ÐµÑ€Ð½Ð°Ñ ÐºÐ¾Ð½Ñ„Ð¸Ð³ÑƒÑ€Ð°Ñ†Ð¸Ñ"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "ÐеÑоответÑтвие верÑий"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Ðеверный подтип Ñлужбы"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Ðеверный пакет"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Ðеверный код возврата DNS"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Ошибка DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Ошибка DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Ошибка DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Ошибка DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Ошибка DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Ошибка DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Ошибка DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Ошибка DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Ошибка DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Ошибка DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Ðеверный формат RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Ðеверный тип DNS"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Ðеверный клаÑÑ DNS"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ðе поддерживаетÑÑ"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Ðе разрешено"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Ðеверный аргумент"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "ПуÑÑ‚Ð°Ñ Ð³Ñ€ÑƒÐ¿Ð¿Ð°"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Ð—Ð°Ð¿Ñ€Ð¾ÑˆÐµÐ½Ð½Ð°Ñ Ð¾Ð¿ÐµÑ€Ð°Ñ†Ð¸Ñ Ð½ÐµÐ²ÐµÑ€Ð½Ð°, поÑкольку ÑвлÑетÑÑ Ð¸Ð·Ð»Ð¸ÑˆÐ½ÐµÐ¹"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Ðеверный код ошибки"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Служба не выбрана.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi Discovery"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Обозреватель Avahi Zeroconf"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "ПоиÑк Ñлужб Zeroconf в локальной Ñети"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Данные TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "пуÑто"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Тип Ñлужбы:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Ð˜Ð¼Ñ Ñлужбы:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Ðазвание домена:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "ИнтерфейÑ:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "ÐдреÑ:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Типы иÑкомых Ñлужб"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "СпиÑок типов иÑкомых Ñлужб, завершающийÑÑ NULL"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Домен"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Домен поиÑка или домен по умолчанию, еÑли NULL"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Тип Ñлужбы"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Тип выбранной Ñлужбы"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Ð˜Ð¼Ñ Ñлужбы"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Ð˜Ð¼Ñ Ð²Ñ‹Ð±Ñ€Ð°Ð½Ð½Ð¾Ð¹ Ñлужбы"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "ÐдреÑ"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "ÐÐ´Ñ€ÐµÑ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»Ñ‘Ð½Ð½Ð¾Ð³Ð¾ уÑтройÑтва"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Порт"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Ðомер порта протокола IP определённого уÑтройÑтва"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Ð˜Ð¼Ñ ÑƒÐ·Ð»Ð°"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Ð˜Ð¼Ñ ÑƒÐ·Ð»Ð° определённого уÑтройÑтва"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Данные TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Данные TXT определённого уÑтройÑтва"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Определение Ñлужбы"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "ÐвтоматичеÑки определить выбранную Ñлужбу перед возвратом"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Определить Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð° Ñлужбы"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "ÐвтоматичеÑки определить Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð° выбранной Ñлужбы перед возвратом"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "ÐдреÑное ÑемейÑтво"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Определение адреÑного ÑемейÑтва Ð´Ð»Ñ Ð¸Ð¼ÐµÐ½Ð¸ узла"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Ошибка клиента Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Ошибка Ð¿Ñ€ÐµÐ¾Ð±Ñ€Ð°Ð·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ Ð¸Ð¼Ñ‘Ð½ Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Ðе удалоÑÑŒ выполнить поиÑк Ñлужбы %s в домене %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "н/д"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Ошибка Ð¾Ð±Ð¾Ð·Ñ€ÐµÐ²Ð°Ñ‚ÐµÐ»Ñ Ð´Ð¾Ð¼ÐµÐ½Ð¾Ð² Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Ðе удалоÑÑŒ открыть домен Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "СпиÑок типов иÑкомых Ñлужб пуÑÑ‚!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Ðе удалоÑÑŒ подключитьÑÑ Ðº Ñерверу Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "ПоиÑк Ñлужб в <b>локальной Ñети</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "ПоиÑк Ñлужб в домене <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Ðе удалоÑÑŒ Ñоздать обозреватель Ð´Ð»Ñ %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Ðе удалоÑÑŒ Ñоздать преобразователь имён Ð´Ð»Ñ %s типа %s в домене %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Ðе удалоÑÑŒ Ñоздать обозреватель доменов: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Изменить домен"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "ПоиÑк..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "ИнициализациÑ..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "РаÑположение"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "ИмÑ"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Тип"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Домен..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [параметры]\n"
+"\n"
+" -h --help Показать Ñту Ñправку\n"
+" -s --ssh ВывеÑти ÑпиÑок доÑтупных Ñерверов SSH\n"
+" -v --vnc ВывеÑти ÑпиÑок доÑтупных Ñерверов VNC\n"
+" -S --shell ВывеÑти ÑпиÑок доÑтупных Ñерверов SSH и VNC\n"
+" -d --domain=ДОМЕРДомен поиÑка Ñерверов\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Слишком много аргументов\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Выберите Ñервер оболочки"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Рабочий Ñтол"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Терминал"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Выберите VNC-Ñервер"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Выберите SSH-Ñервер"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Соединение Ñ Â«%s»...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Сбой Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ execlp(): %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Отменено.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Ðавигатор Avahi по Ñерверам SSH"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "ПроÑмотр ÑпиÑка Ñерверов SSH Ñ Ð²ÐºÐ»ÑŽÑ‡Ñ‘Ð½Ð½Ð¾Ð¹ Ñлужбой Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Ðавигатор Avahi по Ñерверам VNC"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "ПроÑмотр ÑпиÑка Ñерверов VNC Ñ Ð²ÐºÐ»ÑŽÑ‡Ñ‘Ð½Ð½Ð¾Ð¹ Ñлужбой Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Больше ничего на данный момент\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": КÑш иÑчерпан\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "Ðе удалоÑÑŒ преобразовать Ñлужбу «%s» типа «%s» в домене «%s»: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Ошибка в service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Сбой Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Ошибка в service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Сбой Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Сбой Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Ðе удалоÑÑŒ запроÑить Ñтроку верÑии: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Ðе удалоÑÑŒ запроÑить Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð°: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "ВерÑÐ¸Ñ Ñервера: %s; Ð˜Ð¼Ñ ÑƒÐ·Ð»Ð°: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "РИнтр Прот Домен\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "РИнтр Прот %-*s %-20s Домен\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Соединение разорвано, повторное подключение...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Ðе удалоÑÑŒ Ñоздать объект клиента: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Ошибка клиента, завершение работы: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Ожидание демона...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help ВывеÑти данную Ñправку\n"
+" -V --version ВывеÑти верÑию\n"
+" -D --browse-domains ИÑкать домены вмеÑто Ñлужб\n"
+" -a --all Показывать вÑе Ñлужбы вне завиÑимоÑти от типа\n"
+" -d --domain=DOMAIN ИÑкать в домене\n"
+" -v --verbose Включить подробный режим\n"
+" -t --terminate Показать более или менее полный ÑпиÑок и выйти\n"
+" -c --cache Показать вÑе Ñлементы в кÑше и выйти\n"
+" -l --ignore-local Игнорировать локальные Ñлужбы\n"
+" -r --resolve Преобразовывать найденные Ñлужбы\n"
+" -f --no-fail Ðе завершать работу, еÑли демон недоÑтупен\n"
+" -p --parsable Выводить в машинном формате\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Ðе иÑкать типы Ñлужб\n"
+" -b --dump-db ВывеÑти базу типов Ñлужб\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Слишком мало аргументов\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Ðе удалоÑÑŒ Ñоздать объект проÑтого опроÑа.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Образована под именем «%s»\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Ðе удалоÑÑŒ зарегиÑтрировать: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "ÐšÐ¾Ð»Ð»Ð¸Ð·Ð¸Ñ Ð¸Ð¼Ñ‘Ð½, выбрано новое Ð¸Ð¼Ñ Â«%s».\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Ðе удалоÑÑŒ Ñоздать группу Ñлементов: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Ðе удалоÑÑŒ добавить адреÑ: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Ðе удалоÑÑŒ добавить Ñлужбу: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Ðе удалоÑÑŒ добавить подтип «%s»: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Конфликт имени узла\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [параметры] %s <имÑ> <тип> <порт> [<текÑÑ‚...>]\n"
+"%s [параметры] %s <Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð°> <адреÑ>\n"
+"\n"
+" -h --help ВывеÑти Ñту Ñправку\n"
+" -V --version ВывеÑти верÑию\n"
+" -s --service Опубликовать Ñлужбу\n"
+" -a --address Опубликовать адреÑ\n"
+" -v --verbose Включить подробный режим\n"
+" -d --domain=ДОМЕРДомен Ð´Ð»Ñ Ð¿ÑƒÐ±Ð»Ð¸ÐºÐ°Ñ†Ð¸Ð¸ Ñлужбы\n"
+" -H --host=ДОМЕРУзел, на котором размещаетÑÑ Ñлужба\n"
+" --subtype=ПОДТИП Дополнительный подтип Ð´Ð»Ñ Ñ€ÐµÐ³Ð¸Ñтрации Ñтой Ñлужбы\n"
+" -R --no-reverse Ðе опубликовывать Ñлемент обратного адреÑа\n"
+" -f --no-fail Ðе завершать работу, еÑли процеÑÑ Ñлужбы "
+"недоÑтупен\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Ðеверное количеÑтво аргументов\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Ошибка разбора номера порта: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Ðе указана команда.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Ðе удалоÑÑŒ преобразовать Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð° «%s»: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Ðе удалоÑÑŒ преобразовать Ð°Ð´Ñ€ÐµÑ Â«%s»: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [параметры] %s <Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð°...>\n"
+"%s [параметры] %s <адреÑ... >\n"
+"\n"
+" -h --help ВывеÑти данную Ñправку\n"
+" -V --version ВывеÑти верÑию\n"
+" -n --name Преобразовать Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð°\n"
+" -a --address Преобразовать адреÑ\n"
+" -v --verbose Включить подробный режим\n"
+" -6 ИÑкать Ð°Ð´Ñ€ÐµÑ IPv6\n"
+" -4 ИÑкать Ð°Ð´Ñ€ÐµÑ IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Ðе удалоÑÑŒ Ñоздать преобразователь имён узлов: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Ðе удалоÑÑŒ разобрать Ð°Ð´Ñ€ÐµÑ Â«%s»\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Ðе удалоÑÑŒ Ñоздать преобразователь адреÑов: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [параметры] <новое Ð¸Ð¼Ñ ÑƒÐ·Ð»Ð°>\n"
+"\n"
+" -h --help ВывеÑти данную Ñправку\n"
+" -V --version ВывеÑти верÑию\n"
+" -v --verbose Включить подробный режим\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ðеверное чиÑло аргументов, ожидаетÑÑ Ñ€Ð¾Ð²Ð½Ð¾ один.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Ð˜Ð¼Ñ ÑƒÐ·Ð»Ð° уÑпешно изменено на %s\n"
diff --git a/po/sl.po b/po/sl.po
new file mode 100644
index 0000000..ab8e663
--- /dev/null
+++ b/po/sl.po
@@ -0,0 +1,817 @@
+# Slovenian translation for avahi
+# Copyright (c) 2008 Rosetta Contributors and Canonical Ltd 2008
+# This file is distributed under the same license as the avahi package.
+#
+# Matej UrbanÄiÄ <matej.urban@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi master\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-09-22 08:10+0100\n"
+"Last-Translator: Matej UrbanÄiÄ <matej.urban@gmail.com>\n"
+"Language-Team: Slovenian GNOME Translation Team <gnome-si@googlegroups.com>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n"
+"%100==4 ? 3 : 0);\n"
+"X-Poedit-Country: SLOVENIA\n"
+"X-Poedit-Language: Slovenian\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Launchpad-Export-Date: 2010-09-21 09:00+0000\n"
+"X-Generator: Launchpad (build Unknown)\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "V redu"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Dejanje je spodletelo"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Slabo stanje"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Neveljavno ime gostitelja"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Neveljavno ime domene"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Na voljo ni nobenega ustreznega omrežnega protokola"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Neveljaven DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "KljuÄ zapisa vira je vzorec"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Krajevno poimenovanje je v sporu"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Neveljaven zapis"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Neveljavno ime storitve"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Neveljavna vrsta storitve"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Neveljavna Å¡tevilka vrat"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Neveljaven kljuÄ zapisa"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Neveljaven naslov"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "ÄŒas je potekel"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "PreveÄ odjemalcev"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "PreveÄ predmetov"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "PreveÄ vnosov"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Napaka operacijskega okolja"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Dostop je zavrnjen"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Neveljavno dejanje"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "PriÅ¡lo je do nepriÄakovane napake vodila D-Bus."
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Povezava z ozadnjim programom je spodletela"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Pomnilnik je izÄrpan"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Poslan predmet ni veljaven"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Ozadnji program ni zagnan"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Neveljavno kazalo vmesnika"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Neveljavna specifikacija protokola"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Neveljavne zastavice"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ni zadetkov"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Neveljavna nastavitev"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Neskladje razliÄic"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Neveljavna podvrsta storitve"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Neveljaven paket"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Neveljavna DNS vrnitvena koda"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Spodletel odziv DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Spodletel odziv DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Spodletel odziv DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Spodletel odziv DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Spodletel odziv DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Spodletel odziv DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Spodletel odziv DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Spodletel odziv DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Spodletel odziv DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Spodletel odziv DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Neveljaven podatek RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Neveljavna vrsta DNS"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Neveljaven razred DNS"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ni podprto"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Ni dovoljeno"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Neveljaven argument"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Je prazno"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Zahtevana operacija je zaradi odveÄnosti neveljavna"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Neveljavna koda napake"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Trenutno ni izbrane storitve.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Odkrivanje storitev Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Brskalnik Avahi Zeroconf"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Brskanje med razpoložljivimi storitvami Zeroconf v omrežju"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Podatki TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "prazno"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Vrsta storitve:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Ime storitve:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Ime domene:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Vmesnik:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Naslov:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Brskanje med vrstami storitev"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "NiÄno zakljuÄen seznam vrst storitev za brskanje"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domena"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Domena za brskanje oziroma NULL za privzeto domeno"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Vrsta storitve"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Vrsta izbrane storitve"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Ime storitve"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Ime izbrane storitve"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Naslov"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Naslov razrešene storitve"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Vrata"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Številka vrat IP za razrešeno storitev"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Ime gostitelja"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Ime gostitelja razrešene storitve"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Podatki TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Podatki TXT razrešene storitve"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Razrešene storitve"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Samodejno razreši izbrano storitev pred povrnitvijo"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Ime gostitelja storitve razreševanja"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "Samodejno razreši ime gostitelja izbrane storitve pred povratkom"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Družina naslova"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Družina naslova za razreševanje imena gostitelja"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Dejanje odjemalca Avahi je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Razreševanje podatkov Avahi je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Brskanje za storitev vrste %s v domeni %s je spodletela: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "ni na voljo"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Dejanje domenskega brskalnika Avahi je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Branje domene Avahi je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Seznam brskanja vrst storitev je prazen!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Povezovanje s strežnikom Avahi je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Brskanje za storitvami na <b>krajevnem omrežju</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Brskanje za storitvami v domeni <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Ustvarjanje brskalnika za %s je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Ustvarjanje razreševalnika za %s vrste %s v domeni %s je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Ustvarjanje brskalnika domen je spodletelo: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Spremeni domeno"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Brskanje ..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "ZaÄenjanje ..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Mesto"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Ime"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Vrsta"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domena ..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [možnosti]\n"
+"\n"
+" -h --help Pokaže to pomoÄ\n"
+" -s --ssh Brskanje za SSH strežniki\n"
+" -v --vnc Brskanje za VNC strežniki\n"
+" -S --shell Brskanje za SSH in VNC strežniki\n"
+" -d --domain=DOMENA Domena za brskanje\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "PreveÄ argumentov\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Izbor lupinskega strežnika"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Namizje"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Izbor strežnika VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Izbor strežnika SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Povezovanje z '%s' ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "ukaz execlp() je spodletel: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Preklicano.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi brskalnik strežnika SSH"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Brskanje med omogoÄenimi strežniki Zeroconf SSH"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi brskalnik strežnika VNC"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Brskanje med omogoÄenimi strežniki Zeroconf VNC"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Vse za zdaj\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Predpomnilnik je izÄrpan\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Razreševanje storitve '%s' vrste '%s' v domeni '%s' je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "brskalnik storitev je spodletel: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "ukaz avahi_service_browser_new() spodletel: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "ukaz service_type_browser spodletel: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "ukaz avahi_service_type_browser_new() je spodletel: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "ukaz avahi_domain_browser_new() je spodletel: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Poizvedovanje niza razliÄice je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Poizvedovanje imena gostitelja je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "RazliÄica strežnika: %s; ime gostitelja: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Domena Ifce Prot\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s domena\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Povezava je prekinjena; poteka ponovno povezovanje ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Ustvarjanje predmeta odjemalca je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Spodletelo izvajanje odjemalca, zato bo dejanje konÄano: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "ÄŒakanje na ozadnji program ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Premalo argumentov\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Ustvarjanje predmeta enostavne ankete je spodletelo.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Vzpostavljeno pod imenom '%s'\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Vpisovanje je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Poimenovanje je v sporu, zato bo izbrano novo ime '%s'.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Ustvarjanje skupine vnosa je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Dodajanje naslova je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Dodajanje storitve je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Dodajanje podvrste '%s' je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Ime gostitelja je v sporu\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "NapaÄno Å¡tevilo argumentov.\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Razreševanje številke vrat je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Ni doloÄenega ukaza.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Razreševanje imena gostitelja '%s' je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Razreševanje naslova '%s' je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Ustvarjanje razreševalnika gostiteljskih imen je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "RazÄlenjevanje naslova '%s' je spodletelo\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Ustvarjanje naslovnega razreševalnika je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Neveljavno Å¡tevilo argumentov, saj je priÄakovan le en.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Ime gostitelja je uspešno spremenjeno v %s\n"
diff --git a/po/sl.si b/po/sl.si
new file mode 100644
index 0000000..0765c7b
--- /dev/null
+++ b/po/sl.si
@@ -0,0 +1,901 @@
+# -*- mode:po; coding:utf-8; -*- Slovenian message catalogue for avahi.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+#
+# Matej UrbanÄiÄ <matej.urban@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi master\n"
+"Report-Msgid-Bugs-To: http://avahi.org/report\n"
+"POT-Creation-Date: 2010-09-16 15:24+0000\n"
+"PO-Revision-Date: 2010-09-16 19:31+0100\n"
+"Last-Translator: Matej UrbanÄiÄ <mateju@svn.gnome.org>\n"
+"Language-Team: Slovenian GNOME Translation Team <gnome-si@googlegroups.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || n%100==4 ? 3 : 0);\n"
+"X-Poedit-Country: SLOVENIA\n"
+"X-Poedit-Language: Slovenian\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "V redu"
+
+#: ../avahi-common/error.c:31
+#, fuzzy
+msgid "Operation failed"
+msgstr "Dejanje ni uspelo"
+
+#: ../avahi-common/error.c:32
+#, fuzzy
+msgid "Bad state"
+msgstr "Preklopi stanje"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Neveljavno ime gostitelja"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Neveljavno ime domene"
+
+#: ../avahi-common/error.c:35
+#, fuzzy
+msgid "No suitable network protocol available"
+msgstr "Na voljo ni nobenega ponudnika za protokol '%s'"
+
+#: ../avahi-common/error.c:36
+#, fuzzy
+msgid "Invalid DNS TTL"
+msgstr "Omejitev poskoka (TTL)"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+#, fuzzy
+msgid "Local name collision"
+msgstr "Krajevno ime datoteke:"
+
+#: ../avahi-common/error.c:39
+#, fuzzy
+msgid "Invalid record"
+msgstr "Posnemi _namizje"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Neveljavno ime storitve"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Neveljavna vrsta storitve"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Neveljavna Å¡tevilka vrat"
+
+#: ../avahi-common/error.c:44
+#, fuzzy
+msgid "Invalid record key"
+msgstr "Neveljavno ime kljuÄa: %s"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Neveljaven naslov"
+
+#: ../avahi-common/error.c:46
+#, fuzzy
+msgid "Timeout reached"
+msgstr "ÄŒas je potekel"
+
+#: ../avahi-common/error.c:47
+#, fuzzy
+msgid "Too many clients"
+msgstr "PreveÄ skokov"
+
+#: ../avahi-common/error.c:48
+#, fuzzy
+msgid "Too many objects"
+msgstr "PreveÄ skokov"
+
+#: ../avahi-common/error.c:49
+#, fuzzy
+msgid "Too many entries"
+msgstr "PreveÄ skokov"
+
+#: ../avahi-common/error.c:50
+#, fuzzy
+msgid "OS Error"
+msgstr "Napaka vsebuje"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Dostop je zavrnjen"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Neveljavno dejanje"
+
+#: ../avahi-common/error.c:54
+#, fuzzy
+msgid "An unexpected D-Bus error occurred"
+msgstr "Med obdelavo \"{0}\": {1} je prišlo do napake"
+
+#: ../avahi-common/error.c:55
+#, fuzzy
+msgid "Daemon connection failed"
+msgstr "Neuspela VPN povezava "
+
+#: ../avahi-common/error.c:56
+#, fuzzy
+msgid "Memory exhausted"
+msgstr "Uhajanje pomnilnika"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Poslan predmet ni veljaven"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Ozadnji program ni zagnan"
+
+#: ../avahi-common/error.c:59
+#, fuzzy
+msgid "Invalid interface index"
+msgstr "Pridobivanje seznama razširitev"
+
+#: ../avahi-common/error.c:60
+#, fuzzy
+msgid "Invalid protocol specification"
+msgstr "Neveljavna doloÄilo vrat"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Neveljavna zastavica"
+
+#: ../avahi-common/error.c:63
+#, fuzzy
+msgid "Not found"
+msgstr "Ni zadetkov"
+
+#: ../avahi-common/error.c:64
+#, fuzzy
+msgid "Invalid configuration"
+msgstr "Neveljavne nastavitve IR"
+
+#: ../avahi-common/error.c:65
+#, fuzzy
+msgid "Version mismatch"
+msgstr "Velikost ne ustreza"
+
+#: ../avahi-common/error.c:66
+#, fuzzy
+msgid "Invalid service subtype"
+msgstr "Neznana podvrsta mnogokotne Ärte: %d\n"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Neveljaven paket"
+
+#: ../avahi-common/error.c:68
+#, fuzzy
+msgid "Invalid DNS return code"
+msgstr "Vrnjena neveljavna vrednost %s"
+
+#: ../avahi-common/error.c:69
+#, fuzzy
+msgid "DNS failure: FORMERR"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:70
+#, fuzzy
+msgid "DNS failure: SERVFAIL"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:71
+#, fuzzy
+msgid "DNS failure: NXDOMAIN"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:72
+#, fuzzy
+msgid "DNS failure: NOTIMP"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:74
+#, fuzzy
+msgid "DNS failure: REFUSED"
+msgstr "Prenos datoteke je zavrnjen: %s"
+
+#: ../avahi-common/error.c:75
+#, fuzzy
+msgid "DNS failure: YXDOMAIN"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:76
+#, fuzzy
+msgid "DNS failure: YXRRSET"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:77
+#, fuzzy
+msgid "DNS failure: NXRRSET"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:78
+#, fuzzy
+msgid "DNS failure: NOTAUTH"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:79
+#, fuzzy
+msgid "DNS failure: NOTZONE"
+msgstr "ZaÄasna napaka overitve"
+
+#: ../avahi-common/error.c:80
+#, fuzzy
+msgid "Invalid RDATA"
+msgstr "Neveljaven podpis"
+
+#: ../avahi-common/error.c:81
+#, fuzzy
+msgid "Invalid DNS type"
+msgstr "Neveljavna vrsta GbfAmConfigValue"
+
+#: ../avahi-common/error.c:82
+#, fuzzy
+msgid "Invalid DNS class"
+msgstr "Nasledstvo osnovnega razreda:"
+
+#: ../avahi-common/error.c:83
+#, fuzzy
+msgid "Not supported"
+msgstr "Ni podprto"
+
+#: ../avahi-common/error.c:85
+#, fuzzy
+msgid "Not permitted"
+msgstr "Nedovoljeno dejanje"
+
+#: ../avahi-common/error.c:86
+#, fuzzy
+msgid "Invalid argument"
+msgstr "Neveljaven argument"
+
+#: ../avahi-common/error.c:87
+#, fuzzy
+msgid "Is empty"
+msgstr "%s'%s' je prazen"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr ""
+
+#: ../avahi-common/error.c:94
+#, fuzzy
+msgid "Invalid Error Code"
+msgstr "Napaka med razÄlenjevanjem kode: %s"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+#, fuzzy
+msgid "<i>No service currently selected.</i>"
+msgstr "Jezik trenutno izbrane vrste pisave"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+#, fuzzy
+msgid "Avahi Discovery"
+msgstr "Odkrivanje storitev"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi Zeroconf Browser"
+msgstr "Ni mogoÄe ustvariti Avahi brskalnika storitev."
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+#, fuzzy
+msgid "TXT"
+msgstr "bes"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "RazliÄne podrobnosti"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "prazno"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "_Vrsta storitve:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Imenska storitev"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Ime _domene:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+#, fuzzy
+msgid "Interface:"
+msgstr "Vmesnik:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Naslov:"
+
+#: ../avahi-ui/avahi-ui.c:185
+#, fuzzy
+msgid "Browse Service Types"
+msgstr "Prednostne vrste veÄpredstavnostnih datotek"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domena"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+#, fuzzy
+msgid "Service Type"
+msgstr "_Vrsta storitve:"
+
+#: ../avahi-ui/avahi-ui.c:196
+#, fuzzy
+msgid "The service type of the selected service"
+msgstr "Vrsta izbranega datoteÄnega sistema"
+
+#: ../avahi-ui/avahi-ui.c:202
+#: ../avahi-ui/avahi-ui.c:1019
+#, fuzzy
+msgid "Service Name"
+msgstr "Imenska storitev"
+
+#: ../avahi-ui/avahi-ui.c:202
+#, fuzzy
+msgid "The service name of the selected service"
+msgstr "Ime izbrane pisave"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Naslov"
+
+#: ../avahi-ui/avahi-ui.c:208
+#, fuzzy
+msgid "The address of the resolved service"
+msgstr "Sklic na vrsto storitve"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Vrata"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Ime gostitelja"
+
+#: ../avahi-ui/avahi-ui.c:219
+#, fuzzy
+msgid "The host name of the resolved service"
+msgstr "Spremeni prikazano ime storitve."
+
+#: ../avahi-ui/avahi-ui.c:225
+#, fuzzy
+msgid "TXT Data"
+msgstr "RazliÄne podrobnosti"
+
+#: ../avahi-ui/avahi-ui.c:225
+#, fuzzy
+msgid "The TXT data of the resolved service"
+msgstr "<b>Podatki ponudnika internetnih storitev</b>"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Nadzor storitev"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Ime gostitelja ni mogoÄe razreÅ¡iti."
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+#, fuzzy
+msgid "Address family"
+msgstr "Družinsko ime"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:324
+#, fuzzy, c-format
+msgid "Avahi client failure: %s"
+msgstr "Ni mogoÄe ustvariti Avahi odjemalca: %s"
+
+#: ../avahi-ui/avahi-ui.c:386
+#, fuzzy, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Napaka med ustvarjanjem Avahi vtiÄa: %s"
+
+#: ../avahi-ui/avahi-ui.c:516
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:517
+#: ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169
+#: ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "n/a"
+
+#: ../avahi-ui/avahi-ui.c:647
+#, fuzzy, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Ni mogoÄe ustvariti Avahi brskalnika storitev."
+
+#: ../avahi-ui/avahi-ui.c:682
+#, fuzzy, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Napaka med razÄlenjevanjem avahi imena gostitelja: %s\n"
+
+#: ../avahi-ui/avahi-ui.c:704
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:715
+#, fuzzy, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr ""
+"Napaka med povezovanjem s strežnikom Jamendo.\n"
+"%s."
+
+#: ../avahi-ui/avahi-ui.c:733
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:735
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:771
+#, fuzzy, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Napaka med dodajanjem mDNS brskalnika za storitev %s."
+
+#: ../avahi-ui/avahi-ui.c:901
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:976
+#, fuzzy, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Napaka med zaganjanjem mDNS brskalnika: %s\n"
+
+#: ../avahi-ui/avahi-ui.c:987
+#, fuzzy
+msgid "Change domain"
+msgstr "Dana domena"
+
+#: ../avahi-ui/avahi-ui.c:1027
+#: ../avahi-ui/avahi-ui.c:1158
+msgid "Browsing..."
+msgstr "Brskanje ..."
+
+#: ../avahi-ui/avahi-ui.c:1116
+#, fuzzy
+msgid "Initializing..."
+msgstr "Zaganjanje ..."
+
+#: ../avahi-ui/avahi-ui.c:1140
+msgid "Location"
+msgstr "Mesto"
+
+#: ../avahi-ui/avahi-ui.c:1145
+#: ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Ime"
+
+#: ../avahi-ui/avahi-ui.c:1150
+#: ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Vrsta"
+
+#: ../avahi-ui/avahi-ui.c:1162
+msgid "_Domain..."
+msgstr "_Domena ..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101
+#: ../avahi-utils/avahi-browse.c:775
+#, fuzzy, c-format
+msgid "Too many arguments\n"
+msgstr "RreveÄ argumentov\n"
+
+#: ../avahi-ui/bssh.c:149
+#, fuzzy
+msgid "Choose Shell Server"
+msgstr "Strežnik oddaljene ukazne lupine"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Namizje"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+#, fuzzy
+msgid "Choose VNC server"
+msgstr "- VNC strežnik za GNOME"
+
+#: ../avahi-ui/bssh.c:161
+#, fuzzy
+msgid "Choose SSH server"
+msgstr "Uspešna prijava v SSH strežnik %s\n"
+
+#: ../avahi-ui/bssh.c:185
+#, fuzzy, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Povezovanje z {0}"
+
+#: ../avahi-ui/bssh.c:240
+#, fuzzy, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Spodleteli vnosi"
+
+#: ../avahi-ui/bssh.c:250
+#, fuzzy, c-format
+msgid "Canceled.\n"
+msgstr "Preklicano"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi SSH Server Browser"
+msgstr "Uspešna prijava v SSH strežnik %s\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr ""
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+#, fuzzy
+msgid "Avahi VNC Server Browser"
+msgstr "- VNC strežnik za GNOME"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:107
+#, fuzzy, c-format
+msgid ": All for now\n"
+msgstr "Ne, to je trenutno vse"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, fuzzy, c-format
+msgid ": Cache exhausted\n"
+msgstr "Predpomnilnik TTL:"
+
+#: ../avahi-utils/avahi-browse.c:239
+#: ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, fuzzy, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Napaka med zaganjanjem mDNS brskalnika: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, fuzzy, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Ni mogoÄe ustvariti Avahi brskalnika storitev."
+
+#: ../avahi-utils/avahi-browse.c:414
+#, fuzzy, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Napaka med zaganjanjem mDNS brskalnika: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535
+#: ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280
+#: ../avahi-utils/avahi-set-host-name.c:168
+#, fuzzy, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "OPOZORILO: ni mogoÄe razÄleniti vrednost niza `%s'\n"
+
+#: ../avahi-utils/avahi-browse.c:540
+#: ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285
+#: ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, fuzzy, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Neuspešen poskus overitve gostitelja %s."
+
+#: ../avahi-utils/avahi-browse.c:544
+#: ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289
+#: ../avahi-utils/avahi-set-host-name.c:177
+#, fuzzy, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Ime gostitelja ali naslov strežnika."
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, fuzzy, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Jackson - oblikovana domena"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, fuzzy, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s Domain\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585
+#: ../avahi-utils/avahi-publish.c:163
+#, fuzzy, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Povovno povezovanje s strežnikom '%s'"
+
+#: ../avahi-utils/avahi-browse.c:599
+#: ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170
+#: ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272
+#: ../avahi-utils/avahi-set-host-name.c:160
+#, fuzzy, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Ni mogoÄe preoblikovati predmeta v IOR"
+
+#: ../avahi-utils/avahi-browse.c:604
+#: ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143
+#: ../avahi-utils/avahi-set-host-name.c:59
+#, fuzzy, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Izhod (prejet SIGTERM) ..."
+
+#: ../avahi-utils/avahi-browse.c:623
+#: ../avahi-utils/avahi-publish.c:206
+#, fuzzy, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "ÄŒakanje na overitev"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766
+#: ../avahi-utils/avahi-resolve.c:219
+#, fuzzy, c-format
+msgid "Too few arguments\n"
+msgstr "premalo argumenotv"
+
+#: ../avahi-utils/avahi-browse.c:821
+#: ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264
+#: ../avahi-utils/avahi-set-host-name.c:152
+#, fuzzy, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Ustvarjanje predmeta predvajanja GStreamer je spodletelo"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, fuzzy, c-format
+msgid "Established under name '%s'\n"
+msgstr "Ime profila vstavkov"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Vpisovanje je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, fuzzy, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Novo ime je prazno."
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Ustvarjanje skupine vnosa spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Dodajanje naslova je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Dodajanje storitve je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, fuzzy, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Dodajanje predmeta %s je spodletelo"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Ime gostitelja v sporu\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303
+#: ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "NapaÄno Å¡tevilo argumentov.\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Razreševanje številke vrat je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361
+#: ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Ni doloÄenega ukaza.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Razreševanje imena gostitelja '%s' je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Razreševanje naslova '%s' je spodletelo: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299
+#: ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Napaka med ustvarjanjem razreševalnika imena gostitelja: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "RazÄlenjevanje naslova '%s' je spodletelo\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Napaka med ustvarjanjem razreševalnika naslova: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Neveljavno Å¡tevilo argumentov, saj je priÄakovan le en.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Ime gostitelja je uspešno spremenjeno v %s\n"
+
diff --git a/po/sr.po b/po/sr.po
new file mode 100644
index 0000000..3a9f112
--- /dev/null
+++ b/po/sr.po
@@ -0,0 +1,865 @@
+# Serbian translations for avahi
+# Copyright (C) 2006 Red Hat, Inc.
+# This file is distributed under the same license as the avahi package.
+# Nikola Pajtić <salgeras@gmail.com>, 2008.
+# Milos Mijatovic <mijatix@gmail.com>, 2008.
+# MiloÅ¡ KomarÄević <kmilos@gmail.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-03-21 15:58+0100\n"
+"Last-Translator: MiloÅ¡ KomarÄević <kmilos@gmail.com>\n"
+"Language-Team: Serbian (sr) <fedora-trans-sr@redhat.com>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "У реду"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Операција неуÑпешна"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Лоше Ñтање"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "ÐеиÑправан назив домаћина"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "ÐеиÑправан назив домена"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Одговарајући мрежни протокол није доÑтупан"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "ÐеиÑправан DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Кључ запиÑа реÑурÑа је шаблон"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Сукоб локалних назива"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "ÐеиÑправан запиÑ"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "ÐеиÑправан назив уÑлуге"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "ÐеиÑправна врÑта уÑлуге"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "ÐеиÑправан број прикључка"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "ÐеиÑправан кључ запиÑа"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ðетачна адреÑа"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Пауза је доÑтигнута"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Превише клијената"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Превише објеката"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Превише запиÑа"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Грешка оперативног ÑиÑтема"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Забрањен приÑтуп"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Ðетачна операција"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "ДеÑила Ñе неочекивана грешка у D-Bus Ñофтверу"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Повезивање ÑиÑтемÑке уÑлуге неуÑпешно"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Меморија препуњена"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "ÐŸÑ€ÐµÐ½Ð¾Ñ Ð¾Ð±Ñ˜ÐµÐºÑ‚Ð° није био иÑправан"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "СиÑтемÑка уÑлуга Ñе не покреће"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "ÐеиÑправан Ð¸Ð½Ð´ÐµÐºÑ Ñпреге"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "ÐеиÑправна Ñпецификација протокола"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "ÐеиÑправни индикатори"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ðије пронађено"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "ÐеиÑправно подешавање"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "ÐеÑлагање верзије"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "ÐеиÑправна подврÑта уÑлуга"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "ÐеиÑправан пакет"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "ÐеиÑправан повратни код DNS уÑлуге"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS квар: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS квар: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS квар: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS квар: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS квар: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS квар: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS квар: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS квар: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS квар: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS квар: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "ÐеиÑправна RDATA врÑта података"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "ÐеиÑправна врÑта DNS уÑлуге"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "ÐеиÑправна клаÑа DNS уÑлуге"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ðије подржано"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Ðије дозвољено"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "ÐеиÑправан аргумент"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Празно"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Тражена операција је неиÑправна јер је редундантна"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "ÐеиÑправан код грешке"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Ðиједна уÑлуга тренутно није изабрана.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Ðвахи откривање"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Ðвахи Zeroconf претраживач"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Претражујем доÑтупне Zeroconf уÑлуге на вашој мрежи"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "TXT подаци"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Празно"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Ð’Ñ€Ñта уÑлуге"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Ðазив уÑлуге"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Домен"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "ÐдреÑа"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Прегледај врÑте уÑлуга"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "СпиÑак врÑта уÑлуга за прегледање ограничен Ñа NULL"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Домен"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Домен за прегледање, или NULL за подразумевани домен"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Ð’Ñ€Ñта уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Ð’Ñ€Ñта изабране уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Ðазив уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Ðазив изабране уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "ÐдреÑа"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "ÐдреÑа разрешене уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Порт"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Број IP порта разрешене уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Ðазив домаћина"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Ðазив домаћина разрешене уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT подаци"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "TXT подаци разрешене уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Разреши уÑлугу"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Разреши назив домаћина уÑлуге"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Породица адреÑа"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Породица адреÑа за разрешавање назива домаћина"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Квар Ðвахи клијента: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Квар Ðвахи разрешивача: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Претраживање за врÑтом уÑлуге %s у домену %s неуÑпешно: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "непознато"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Квар Ðвахи претраживача домена: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "ÐеуÑпешно читање Ðвахи домена: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "СпиÑак врÑта ÑервиÑа за преглед је празан!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "ÐеуÑпешно повезивање на Ðвахи Ñервер: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Претраживање за уÑлугом на <b>локалној мрежи</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Претраживање за уÑлугом у домену <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "ÐеуÑпешно прављење претраживача за %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "ÐеуÑпешно прављење разрешивача за %s врÑте %s у домену %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "ÐеуÑпешно прављење претраживача домена: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Промени домен"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Претражујем..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Покрећем..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "МеÑто"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Ðазив"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Ð’Ñ€Ñта"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Домен..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [опције]\n"
+"\n"
+" -h --help Прикажи ову помоћ\n"
+" -s --ssh Претражи SSH Ñервере\n"
+" -v --vnc Претражи VNC Ñервере\n"
+" -S --shell Претражи и SSH и VNC\n"
+" -d --domain=ДОМЕРДомен у коме ће Ñе вршити претраживање\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Превише аргумената\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Изаберите Ñервер командног окружења"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Радна површина"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Терминал"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Изаберите VNC Ñервер"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Изаберите SSH Ñервер"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Повезујем Ñе на „%s“ ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Функција execlp() неуÑпешна: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Отказано.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Претраживач Ðвахи SSH Ñервера"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Претражујем SSH Ñервере на којима је омогућен Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Претраживач Ðвахи VNC Ñервера"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Претражујем VNC Ñервере на којима је омогућен Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": за Ñада Ñве\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": кеш је препуњен\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "ÐеуÑпешно резрешавање уÑлуге „%s“ врÑте „%s“ у домену „%s“: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "ÐеуÑпешна функција service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "ÐеуÑпешна функција avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "ÐеуÑпешна функција service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "ÐеуÑпешна функција avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "ÐеуÑпешна функција avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "ÐеуÑпешно извршавање упита за ниÑком верзије: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "ÐеуÑпешно извршавање упита за називом домаћина: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Верзија Ñервера : %s; назив домаћина: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Д Спр Прот Домен\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "Д Спр Прот %-*s %-20s Домен\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Ðеповезан, поновно повезивање ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "ÐеуÑпешно прављење објекта клијента: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Квар клијента, излазим: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Чекам на ÑиÑтемÑку уÑлугу ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Прикажи ову помоћ\n"
+" -V --version Прикажи верзију\n"
+" -D --browse-domains Претражи домене који Ñе могу претраживати умеÑто "
+"уÑлуга\n"
+" -a --all Прикажи Ñве уÑлуге, без обзира на врÑту\n"
+" -d --domain=ДОМЕРДомен за претраживање\n"
+" -v --verbose Укључи режим опширног иÑпиÑа\n"
+" -t --terminate Прекини поÑле избацивања више или мање завршене "
+"лиÑте\n"
+" -c --cache Прекини поÑле избацивања Ñвих запиÑа из кеша\n"
+" -l --ignore-local Игнориши локалне уÑлуге\n"
+" -r --resolve Разреши пронађене уÑлуге\n"
+" -f --no-fail Ðемој да откажеш ако ÑиÑтемÑка уÑлуга није "
+"доÑтупна\n"
+" -p --parsable Излаз у формату који Ñе може рашчланити\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Ðемој тражити врÑте уÑлуге\n"
+" -b --dump-db Избаци базу података врÑте уÑлуге\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Сувише мало аргумената\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "ÐеуÑпешно прављење објекта једноÑтавне анкете.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "УÑпоÑтављено под именом „%s“\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "ÐеуÑпешна региÑтрација: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Сукоб назива, узимам нови назив „%s“.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "ÐеуÑпешно прављење запиÑа групе: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "ÐеуÑпешно додавање адреÑе: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "ÐеуÑпешно додавање уÑлуге: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "ÐеуÑпешно додавање подврÑте „%s“: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Сукоб назива домаћина\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [опције] %s <назив> <врÑта> <порт> [<txt ...>]\n"
+"%s [опције] %s <назив-домаћина> <адреÑа>\n"
+"\n"
+" -h --help Прикажи ову помоћ\n"
+" -V --version Прикажи верзију\n"
+" -s --service Објави уÑлугу\n"
+" -a --address Објави адреÑу\n"
+" -v --verbose Укључи режим опширног иÑпиÑа\n"
+" -d --domain=ДОМЕРДомен у којем ће Ñе објавити уÑлуге\n"
+" -H --host=ДОМЕРДомаћин на којем Ñе налазе уÑлуге\n"
+" --subtype=ПОДВРСТРДодатна подврÑта Ñа којом ће Ñе региÑтровати ова "
+"уÑлуга\n"
+" -f --no-fail Ðемој да откажеш ако ÑиÑтемÑка уÑлуга није "
+"доÑтупна\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Лош број аргумената\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "ÐеуÑпешно разрешавање броја прикључка: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Команда није одређена.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "ÐеуÑпешно разрешавање назива домаћина „%s“: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "ÐеуÑпешно разрешавање адреÑе „%s“: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [опције] %s <назив домаћина ...>\n"
+"%s [опције] %s <адреÑа ... >\n"
+"\n"
+" -h --help Прикажи ову помоћ\n"
+" -V --version Прикажи верзију\n"
+" -n --name Разреши назив домаћина\n"
+" -a --address Разреши адреÑу\n"
+" -v --verbose Укључи режим опширног иÑпиÑа\n"
+" -6 Тражи IPv6 адреÑу\n"
+" -4 Тражи IPv4 адреÑу\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "ÐеуÑпешно прављење разрешивача назива домаћина: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "ÐеуÑпешно рашчлањивање адреÑе „%s“\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "ÐеуÑпешно прављење разрешивача адреÑе: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [опције] <нови назив домаћина>\n"
+"\n"
+" -h --help Прикажи ову помоћ\n"
+" -V --version Прикажи верзију\n"
+" -v --verbose Укључи режим опширног иÑпиÑа\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "ÐеиÑправан број аргумената, очекујем тачно један.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Ðазив домаћина уÑпешно промењен у %s\n"
diff --git a/po/sr@latin.po b/po/sr@latin.po
new file mode 100644
index 0000000..be1779c
--- /dev/null
+++ b/po/sr@latin.po
@@ -0,0 +1,865 @@
+# Serbian(Latin) translations for avahi
+# Copyright (C) 2006 Red Hat, Inc.
+# This file is distributed under the same license as the avahi package.
+# Nikola Pajtić <salgeras@gmail.com>, 2008.
+# Milos Mijatovic <mijatix@gmail.com>, 2008.
+# MiloÅ¡ KomarÄević <kmilos@gmail.com>, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2009-03-21 15:58+0100\n"
+"Last-Translator: MiloÅ¡ KomarÄević <kmilos@gmail.com>\n"
+"Language-Team: Serbian (sr) <fedora-trans-sr@redhat.com>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "U redu"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Operacija neuspešna"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Loše stanje"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Neispravan naziv domaćina"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Neispravan naziv domena"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Odgovarajući mrežni protokol nije dostupan"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Neispravan DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "KljuÄ zapisa resursa je Å¡ablon"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Sukob lokalnih naziva"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Neispravan zapis"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Neispravan naziv usluge"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Neispravna vrsta usluge"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Neispravan broj prikljuÄka"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Neispravan kljuÄ zapisa"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "NetaÄna adresa"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Pauza je dostignuta"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Previše klijenata"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Previše objekata"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Previše zapisa"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Greška operativnog sistema"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Zabranjen pristup"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "NetaÄna operacija"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Desila se neoÄekivana greÅ¡ka u D-Bus softveru"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Povezivanje sistemske usluge neuspešno"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Memorija prepunjena"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Prenos objekta nije bio ispravan"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Sistemska usluga se ne pokreće"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Neispravan indeks sprege"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Neispravna specifikacija protokola"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Neispravni indikatori"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Nije pronađeno"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Neispravno podešavanje"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Neslaganje verzije"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Neispravna podvrsta usluga"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Neispravan paket"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Neispravan povratni kod DNS usluge"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS kvar: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS kvar: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS kvar: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS kvar: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS kvar: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS kvar: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS kvar: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS kvar: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS kvar: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS kvar: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Neispravna RDATA vrsta podataka"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Neispravna vrsta DNS usluge"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Neispravna klasa DNS usluge"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Nije podržano"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Nije dozvoljeno"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Neispravan argument"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Prazno"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Tražena operacija je neispravna jer je redundantna"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Neispravan kod greške"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Nijedna usluga trenutno nije izabrana.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi otkrivanje"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf pretraživaÄ"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Pretražujem dostupne Zeroconf usluge na vašoj mreži"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "TXT Data:"
+msgstr "TXT podaci"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+#, fuzzy
+msgid "empty"
+msgstr "Prazno"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+#, fuzzy
+msgid "Service Type:"
+msgstr "Vrsta usluge"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+#, fuzzy
+msgid "Service Name:"
+msgstr "Naziv usluge"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+#, fuzzy
+msgid "Domain Name:"
+msgstr "Domen"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr ""
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+#, fuzzy
+msgid "Address:"
+msgstr "Adresa"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Pregledaj vrste usluga"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Spisak vrsta usluga za pregledanje ograniÄen sa NULL"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domen"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Domen za pregledanje, ili NULL za podrazumevani domen"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Vrsta usluge"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Vrsta izabrane usluge"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Naziv usluge"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Naziv izabrane usluge"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adresa"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Adresa razrešene usluge"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Broj IP porta razrešene usluge"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Naziv domaćina"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Naziv domaćina razrešene usluge"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT podaci"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "TXT podaci razrešene usluge"
+
+#: ../avahi-ui/avahi-ui.c:230
+#, fuzzy
+msgid "Resolve Service"
+msgstr "Razreši uslugu"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:236
+#, fuzzy
+msgid "Resolve Service Host Name"
+msgstr "Razreši naziv domaćina usluge"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Porodica adresa"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Porodica adresa za razrešavanje naziva domaćina"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Kvar Avahi klijenta: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Kvar Avahi razreÅ¡ivaÄa: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Pretraživanje za vrstom usluge %s u domenu %s neuspešno: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "nepoznato"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Kvar Avahi pretraživaÄa domena: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "NeuspeÅ¡no Äitanje Avahi domena: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Spisak vrsta servisa za pregled je prazan!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Neuspešno povezivanje na Avahi server: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Pretraživanje za uslugom na <b>lokalnoj mreži</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Pretraživanje za uslugom u domenu <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "NeuspeÅ¡no pravljenje pretraživaÄa za %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "NeuspeÅ¡no pravljenje razreÅ¡ivaÄa za %s vrste %s u domenu %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "NeuspeÅ¡no pravljenje pretraživaÄa domena: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Promeni domen"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Pretražujem..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Pokrećem..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Mesto"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Naziv"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Vrsta"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domen..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [opcije]\n"
+"\n"
+" -h --help Prikaži ovu pomoć\n"
+" -s --ssh Pretraži SSH servere\n"
+" -v --vnc Pretraži VNC servere\n"
+" -S --shell Pretraži i SSH i VNC\n"
+" -d --domain=DOMEN Domen u kome će se vršiti pretraživanje\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Previše argumenata\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Izaberite server komandnog okruženja"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Radna površina"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Izaberite VNC server"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Izaberite SSH server"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Povezujem se na „%s“ ...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Funkcija execlp() neuspešna: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Otkazano.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "PretraživaÄ Avahi SSH servera"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Pretražujem SSH servere na kojima je omogućen Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "PretraživaÄ Avahi VNC servera"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Pretražujem VNC servere na kojima je omogućen Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": za sada sve\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": keš je prepunjen\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "Neuspešno rezrešavanje usluge „%s“ vrste „%s“ u domenu „%s“: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Neuspešna funkcija service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Neuspešna funkcija avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Neuspešna funkcija service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Neuspešna funkcija avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Neuspešna funkcija avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Neuspešno izvršavanje upita za niskom verzije: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Neuspešno izvršavanje upita za nazivom domaćina: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Verzija servera : %s; naziv domaćina: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "D Spr Prot Domen\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "D Spr Prot %-*s %-20s Domen\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Nepovezan, ponovno povezivanje ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Neuspešno pravljenje objekta klijenta: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Kvar klijenta, izlazim: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "ÄŒekam na sistemsku uslugu ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Prikaži ovu pomoć\n"
+" -V --version Prikaži verziju\n"
+" -D --browse-domains Pretraži domene koji se mogu pretraživati umesto "
+"usluga\n"
+" -a --all Prikaži sve usluge, bez obzira na vrstu\n"
+" -d --domain=DOMEN Domen za pretraživanje\n"
+" -v --verbose UkljuÄi režim opÅ¡irnog ispisa\n"
+" -t --terminate Prekini posle izbacivanja više ili manje završene "
+"liste\n"
+" -c --cache Prekini posle izbacivanja svih zapisa iz keša\n"
+" -l --ignore-local Ignoriši lokalne usluge\n"
+" -r --resolve Razreši pronađene usluge\n"
+" -f --no-fail Nemoj da otkažeš ako sistemska usluga nije "
+"dostupna\n"
+" -p --parsable Izlaz u formatu koji se može raÅ¡Älaniti\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Nemoj tražiti vrste usluge\n"
+" -b --dump-db Izbaci bazu podataka vrste usluge\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Suviše malo argumenata\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Neuspešno pravljenje objekta jednostavne ankete.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Uspostavljeno pod imenom „%s“\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Neuspešna registracija: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Sukob naziva, uzimam novi naziv „%s“.\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Neuspešno pravljenje zapisa grupe: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Neuspešno dodavanje adrese: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Neuspešno dodavanje usluge: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Neuspešno dodavanje podvrste „%s“: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Sukob naziva domaćina\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, fuzzy, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [opcije] %s <naziv> <vrsta> <port> [<txt ...>]\n"
+"%s [opcije] %s <naziv-domaćina> <adresa>\n"
+"\n"
+" -h --help Prikaži ovu pomoć\n"
+" -V --version Prikaži verziju\n"
+" -s --service Objavi uslugu\n"
+" -a --address Objavi adresu\n"
+" -v --verbose UkljuÄi režim opÅ¡irnog ispisa\n"
+" -d --domain=DOMEN Domen u kojem će se objaviti usluge\n"
+" -H --host=DOMEN Domaćin na kojem se nalaze usluge\n"
+" --subtype=PODVRSTA Dodatna podvrsta sa kojom će se registrovati ova "
+"usluga\n"
+" -f --no-fail Nemoj da otkažeš ako sistemska usluga nije "
+"dostupna\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Loš broj argumenata\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "NeuspeÅ¡no razreÅ¡avanje broja prikljuÄka: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Komanda nije određena.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Neuspešno razrešavanje naziva domaćina „%s“: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Neuspešno razrešavanje adrese „%s“: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [opcije] %s <naziv domaćina ...>\n"
+"%s [opcije] %s <adresa ... >\n"
+"\n"
+" -h --help Prikaži ovu pomoć\n"
+" -V --version Prikaži verziju\n"
+" -n --name Razreši naziv domaćina\n"
+" -a --address Razreši adresu\n"
+" -v --verbose UkljuÄi režim opÅ¡irnog ispisa\n"
+" -6 Traži IPv6 adresu\n"
+" -4 Traži IPv4 adresu\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "NeuspeÅ¡no pravljenje razreÅ¡ivaÄa naziva domaćina: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "NeuspeÅ¡no raÅ¡Älanjivanje adrese „%s“\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "NeuspeÅ¡no pravljenje razreÅ¡ivaÄa adrese: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [opcije] <novi naziv domaćina>\n"
+"\n"
+" -h --help Prikaži ovu pomoć\n"
+" -V --version Prikaži verziju\n"
+" -v --verbose UkljuÄi režim opÅ¡irnog ispisa\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Neispravan broj argumenata, oÄekujem taÄno jedan.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Naziv domaćina uspešno promenjen u %s\n"
diff --git a/po/sv.po b/po/sv.po
new file mode 100644
index 0000000..74f9d87
--- /dev/null
+++ b/po/sv.po
@@ -0,0 +1,855 @@
+# Swedish translation for avahi.
+# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# This file is distributed under the same license as the avahi package.
+# Daniel Nylander <po@danielnylander.se>, 2008, 2009, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-08-12 01:12+0100\n"
+"Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
+"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
+"Language: sv\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "OK"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Åtgärden misslyckades"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Felaktigt tillstånd"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Ogiltigt värdnamn"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Ogiltigt domännamn"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Inget lämpligt nätverksprotokoll tillgängligt"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Ogiltigt DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Resursens postnyckel är mönster"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Lokal namnkollision"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Ogiltig post"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Ogiltigt tjänstenamn"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Ogiltig tjänstetyp"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Ogiltigt portnummer"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Ogiltig postnyckel"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ogiltig adress"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Tidsgräns nåddes"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "För många klienter"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "För många objekt"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "För många poster"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Operativsystemsfel"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Ã…tkomst nekad"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Ogiltig åtgärd"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "Ett oväntat D-Bus-fel har inträffat"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Anslutning till demon misslyckades"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Minnet är slut"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Objektet som skickades in var inte giltigt"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Demonen är inte igång"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ogiltigt gränssnittsindex"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Ogiltig protokollspecifikation"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "Ogiltiga flaggor"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Hittades inte"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Ogiltig konfiguration"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "Versionen stämmer inte"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Ogiltig undertyp för tjänst"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Ogiltigt paket"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Ogiltig DNS-svarskod"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS-fel: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS-fel: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS-fel: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS-fel: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS-fel: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS-fel: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS-fel: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS-fel: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS-fel: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS-fel: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Ogiltig RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Ogiltig DNS-typ"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Ogiltig DNS-klass"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Stöds inte"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Inte tillåten"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Ogiltigt argument"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "Är tom"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Den begärda åtgärden är ogiltig därför den är redundant"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Ogiltig felkod"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Ingen tjänst har markerats.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi-upptäckning"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf-bläddrare"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "Bläddra efter Zeroconf-tjänster tillgängliga på ditt nätverk"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT Data:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "tom"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Tjänstetyp:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Tjänstenamn:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Domännamn:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "Gränssnitt:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "Adress:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "Bläddra efter tjänstetyper"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "En NULL-terminerad lista över tjänstetyper att bläddra efter"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Domän"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Domänen att bläddra i, eller NULL för standarddomänen"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Tjänstetyp"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Tjänstetypen för den markerade tjänsten"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Tjänstenamn"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Tjänstenamnet för den markerade tjänsten"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "Adress"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "Adressen för den uppslagna tjänsten"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Port"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "IP-portnumret för den uppslagna tjänsten"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Värdnamn"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Värdnamnet för den uppslagna tjänsten"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT Data"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "TXT-data för den uppslagna tjänsten"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Slå upp tjänst"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Slå upp den valda tjänsten automatiskt före återgång"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Slå upp tjänstens värdnamn"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "Slå upp värdnamnet för den valda tjänsten automatiskt före återgång"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "Adressfamilj"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "Adressfamiljen för värdnamnets uppslag"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Fel i Avahi-klient: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Fel i Avahi-uppslag: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Bläddring efter tjänstetypen %s i domänen %s misslyckades: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "Inte tillgänglig"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Fel i Avahi-domänbläddrare: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Misslyckades att läsa Avahi-domän: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "Listan över tjänstetyper är tom!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Misslyckades att ansluta till Avahi-server: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "Bläddrar efter tjänster på <b>lokalt nätverk</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "Bläddring efter tjänster i domänen <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Misslyckades med att skapa bläddrare för %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+"Misslyckades med att skapa uppslagare för %s av typen %s i domänen %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Misslyckades med att skapa domänbläddrare: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Byt domän"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "Bläddrar..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "Initierar..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "Plats"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Namn"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Typ"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Domän..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [flaggor]\n"
+"\n"
+" -h --help Visa denna hjälp\n"
+" -s --ssh Bläddra bland SSH-servrar\n"
+" -v --vnc Bläddra bland VNC-servrar\n"
+" -S --shell Bläddra bland både SSH och VNC\n"
+" -d --domain=DOMÄN Domänen att bläddra i\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "För många argument\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Välj skalserver"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "Skrivbord"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Terminal"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Välj VNC-server"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Välj SSH-server"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Ansluter till \"%s\"...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() misslyckades: %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "Avbruten.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH-serverbläddrare"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "Bläddra efter Zeroconf-aktiverade SSH-servrar"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC-serverbläddrare"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "Bläddra efter Zeroconf-aktiverade VNC-servrar"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": Alla just nu\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": Cachen är full\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+"Misslyckades med att slå upp tjänsten \"%s\" av typen \"%s\" i domänen \"%s"
+"\": %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser misslyckades: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() misslyckades: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser misslyckades: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() misslyckades: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() misslyckades: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Misslyckades med att fråga efter versionssträng: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Misslyckades med att fråga efter värdnamn: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "Serverversion: %s; Värdnamn: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "H Grän Prot Domän\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "H Grän Prot %-*s %-20s Domän\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Frånkopplad, återansluter ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Misslyckades med att skapa klientobjekt: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Klientfel, avslutar: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "Väntar på demon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Visa denna hjälp\n"
+" -V --version Visa version\n"
+" -D --browse-domains Bläddra efter bläddringsdomäner istället för "
+"tjänster\n"
+" -a --all Visa alla tjänster, oavsett typen\n"
+" -d --domain=DOMÄN Domänen att bläddra i\n"
+" -v --verbose Aktivera informativt läge\n"
+" -t --terminate Avsluta efter dumpning av en mer eller mindre "
+"komplett lista\n"
+" -c --cache Avsluta efter dumpning av alla poster från cachen\n"
+" -l --ignore-local Ignorera lokala tjänster\n"
+" -r --resolve Slå upp tjänster som hittats\n"
+" -f --no-fail Misslycka inte om demonen inte är tillgänglig\n"
+" -p --parsable Skriv ut i tolkningsbart format\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Slå inte upp tjänstetyper\n"
+" -b --dump-db Dumpa databasen över tjänstetyper\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "För få argument\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Misslyckades med att skapa enkelt poll-objekt.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Etablerad under namnet \"%s\"\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Misslyckades att registrera: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Namnkollision, väljer nytt namn \"%s\".\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Misslyckades med att skapa postgrupp: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Misslyckades att lägga till adress: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Misslyckades att lägga till tjänst: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Misslyckades med att lägga till undertypen \"%s\": %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Värdnamnskonflikt\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [flaggor] %s <namn> <typ> <port> [<txt ...>]\n"
+"%s [flaggor] %s <värdnamn> <adress>\n"
+"\n"
+" -h --help Visa denna hjälp\n"
+" -V --version Visa version\n"
+" -s --service Publicera tjänst\n"
+" -a --address Publicera adress\n"
+" -v --verbose Aktivera informativt läge\n"
+" -d --domain=DOMÄN Domän att publicera tjänst i\n"
+" -H --host=DOMÄN Värd där tjänsten finns\n"
+" --subtype=UNDERTYP En ytterligare undertyp att registrera denna "
+"tjänst med\n"
+" -R --no-reverse Publicera inte baklängespost med address\n"
+" -f --no-fail Misslycka inte om demonen inte är tillgänglig\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "DÃ¥ligt antal argument\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Misslyckades med att tolka portnummer: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Inget kommando specificerat.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Misslyckades med att slå upp värdnamnet \"%s\": %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Misslyckades med att slå upp adressen \"%s\": %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [flaggor] %s <värdnamn ...>\n"
+"%s [flaggor] %s <adress ... >\n"
+"\n"
+" -h --help Visa denna hjälp\n"
+" -V --version Visa version\n"
+" -n --name Slå upp värdnamn\n"
+" -a --address Slå upp adress\n"
+" -v --verbose Aktivera informativt läge\n"
+" -6 Slå upp IPv6-adress\n"
+" -4 Slå upp IPv4-adress\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "Misslyckades med att skapa uppslagare för värdnamn: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Misslyckades med att tolka adressen \"%s\"\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Misslyckades med att skapa adressuppslagare: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [flaggor] <nytt värdnamn>\n"
+"\n"
+" -h --help Visa denna hjälp\n"
+" -V --version Visa version\n"
+" -v --verbose Aktivera informativt läge\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ogiltigt antal argument, exakt ett argument förväntas.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Värdnamnet ändrades till %s\n"
diff --git a/po/uk.po b/po/uk.po
new file mode 100644
index 0000000..76f57fe
--- /dev/null
+++ b/po/uk.po
@@ -0,0 +1,857 @@
+# Free Software Foundation, Inc (C) 2009
+# This file is distributed under the same license as the avahi package.
+#
+# Yuri Chornoivan <yurchor@ukr.net>, 2009, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: avahi.master-tx.uk\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-07-01 07:30+0300\n"
+"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n"
+"Language-Team: Ukrainian <translation@linux.org.ua>\n"
+"Language: uk\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Lokalize 1.1\n"
+"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "Гаразд"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "Спроба Ð²Ð¸ÐºÐ¾Ð½Ð°Ð½Ð½Ñ Ð´Ñ–Ñ— була невдалою"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "Стан помилки"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "Ðекоректна назва вузла"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "Ðекоректна назва домену"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "Ðе знайдено відповідного мережевого протоколу"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "Ðекоректне TTL DNS"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "Ключ запиÑу реÑурÑу Ñ” шаблоном"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "Збіг локальних назв"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "Ðекоректний запиÑ"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "Ðекоректна назва Ñлужби"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "Ðекоректний тип Ñлужби"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "Ðекоректний номер порту"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "Ðекоректний ключ запиÑу"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "Ðекоректна адреÑа"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "Перевищено Ñ‡Ð°Ñ Ð¾Ñ‡Ñ–ÐºÑƒÐ²Ð°Ð½Ð½Ñ"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "Забагато клієнтів"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "Забагато об’єктів"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "Забагато запиÑів"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "Помилка ОС"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "Заборонено доÑтуп"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "Ðекоректна діÑ"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "СталаÑÑ Ð½ÐµÐ¿ÐµÑ€ÐµÐ´Ð±Ð°Ñ‡ÐµÐ½Ð° помилка D-Bus"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Спроба вÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ð·Ð²â€™Ñзку з фоновою Ñлужбою завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "Пам’ÑÑ‚ÑŒ вичерпано"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "Переданий об’єкт є некоректним"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Фонову Ñлужбу не запущено"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "Ðекоректний Ñ–Ð½Ð´ÐµÐºÑ Ñ–Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñу"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "Ðекоректна ÑÐ¿ÐµÑ†Ð¸Ñ„Ñ–ÐºÐ°Ñ†Ñ–Ñ Ð¿Ñ€Ð¾Ñ‚Ð¾ÐºÐ¾Ð»Ñƒ"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "некоректні прапорці"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "Ðе знайдено"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "Ðекоректне налаштуваннÑ"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "ÐевідповідніÑÑ‚ÑŒ верÑій"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "Ðекоректний підтип Ñлужби"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "Ðекоректний пакет"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "Ðекоректний код Ð¿Ð¾Ð²ÐµÑ€Ð½ÐµÐ½Ð½Ñ DNS"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "Помилка DNS: FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "Помилка DNS: SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "Помилка DNS: NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "Помилка DNS: NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "Помилка DNS: REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "Помилка DNS: YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "Помилка DNS: YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "Помилка DNS: NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "Помилка DNS: NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "Помилка DNS: NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "Ðекоректне Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "Ðекоректний тип DNS"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "Ðекоректний ÐºÐ»Ð°Ñ DNS"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "Ðе підтримуєтьÑÑ"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "Заборонено"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "Ðекоректний аргумент"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "порожній"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "Бажана Ð´Ñ–Ñ Ñ” некоректною через Ñвою невизначеніÑÑ‚ÑŒ"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "Ðекоректний код помилки"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>Ðе обрано жодної Ñлужби.</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Служба виÑÐ²Ð»ÐµÐ½Ð½Ñ Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "ПереглÑдач Zeroconf Avahi"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr ""
+"ПереглÑнути Ñлужби Zeroconf, доÑтуп до Ñких можна отримати у вашій мережі"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "Дані TXT:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "порожній"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "Тип Ñлужби:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "Ðазва Ñлужби:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "Ðазва домену:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "ІнтерфейÑ:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "ÐдреÑа:"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "ПереглÑд типів Ñлужб"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "Завершений NULL ÑпиÑок типів Ñлужб, Ñкі можна переглÑдати"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "Домен"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "Домен Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ³Ð»Ñду (NULL — типовий домен)"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "Тип Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "Тип позначеної Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "Ðазва Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "Ðазва позначеної Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "ÐдреÑа"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "ÐдреÑа виÑвленої Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "Порт"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "Ðомер порту IP виÑвленої Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "Ðазва вузла"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "Ðазва вузла виÑвленої Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "Дані TXT"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "Дані TXT виÑвленої Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "Визначити Ñлужбу"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "Визначити параметри вибраної Ñлужби автоматично перед поверненнÑм"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "Визначити назву вузла Ñлужби"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "Визначити назву вузла вибраної Ñлужби автоматично перед поверненнÑм"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "СімейÑтво адреÑ"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "СімейÑтво Ð°Ð´Ñ€ÐµÑ Ð´Ð»Ñ Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ð°Ð·Ð²Ð¸ вузла"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Помилка клієнта Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Помилка інÑтрументу Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "Помилка переглÑду типу Ñлужби %s у домені %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "н/д"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Помилка переглÑду домену Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "Спроба Ñ‡Ð¸Ñ‚Ð°Ð½Ð½Ñ Ð´Ð¾Ð¼ÐµÐ½Ñƒ Avahi завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "СпиÑок типів переглÑду Ñлужб порожній!"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "Ðе вдалоÑÑ Ð·â€™Ñ”Ð´Ð½Ð°Ñ‚Ð¸ÑÑ Ð· Ñервером Avahi: %s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "ПереглÑд Ñлужб у <b>локальній мережі</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "ПереглÑд Ñлужб у домені <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "Ðе вдалоÑÑ Ñтворити заÑіб переглÑду Ð´Ð»Ñ %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "Спроба ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð·Ð°Ñобу Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð´Ð»Ñ %s типу %s у домені %s: %s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "Спроба ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð·Ð°Ñобу переглÑду домену зазнала невдачі: %s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "Змінити домен"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "ÐавігаціÑ..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "ІніціалізаціÑ..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "ÐдреÑа"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "Ðазва"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "Тип"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_Домен:"
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [параметри]\n"
+"\n"
+" -h --help Показати цю довідку\n"
+" -s --ssh ПереглÑнути Ñервери SSH\n"
+" -v --vnc ПереглÑнути Ñервери VNC\n"
+" -S --shell ПереглÑнути Ñервери SSH Ñ– VNC\n"
+" -d --domain=ДОМЕРДомен Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ³Ð»Ñду\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "Занадто багато аргументів\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "Оберіть Ñервер оболонки"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "СтільницÑ"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "Термінал"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "Вибір Ñервера VNC"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "Вибір Ñервера SSH"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "Ð’ÑÑ‚Ð°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ñ Ð·â€™Ñ”Ð´Ð½Ð°Ð½Ð½Ñ Ð· «%s»...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "Помилка execlp(): %s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "СкаÑовано.\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "ПереглÑдач Ñерверів SSH Avahi"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "ПереглÑд Ñерверів SSH з увімкненим Zeroconf"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "ПереглÑдач Ñерверів VNC Avahi"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "ПереглÑд Ñерверів VNC з увімкненим Zeroconf"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ": вÑÑ– на цей момент\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": кеш вичерпано\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "Ðе вдалоÑÑ Ð²Ð¸Ð·Ð½Ð°Ñ‡Ð¸Ñ‚Ð¸ Ñлужбу «%s» типу «%s» у домені «%s»: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "Помилка service_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "Помилка avahi_service_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "Помилка service_type_browser: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "Помилка avahi_service_type_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "Помилка avahi_domain_browser_new(): %s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "Спроба запиту запиту щодо Ñ€Ñдка верÑÑ–Ñ— була невдалою: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "Спроба запиту щодо назви вузла була невдалою: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "ВерÑÑ–Ñ Ñервера: %s; назва вузла: %s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "Домен E Ifce Prot\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "Домен E Ifce Prot %-*s %-20s\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "Ð—â€™Ñ”Ð´Ð½Ð°Ð½Ð½Ñ Ñ€Ð¾Ð·Ñ–Ñ€Ð²Ð°Ð½Ð¾, повторна Ñпроба з’єднаннÑ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "Спроба ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ ÐºÐ»Ñ–Ñ”Ð½Ñ‚Ñького об’єкта завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "Ðварійне Ð·Ð°Ð²ÐµÑ€ÑˆÐµÐ½Ð½Ñ ÐºÐ»Ñ–Ñ”Ð½Ñ‚Ñької програми, вихід: %s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "ÐžÑ‡Ñ–ÐºÑƒÐ²Ð°Ð½Ð½Ñ Ð½Ð° Ð¿Ñ–Ð´Ñ‚Ð²ÐµÑ€Ð´Ð¶ÐµÐ½Ð½Ñ Ñ„Ð¾Ð½Ð¾Ð²Ð¾ÑŽ Ñлужбою...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help Показати цю довідку\n"
+" -V --version Показати дані щодо верÑÑ–Ñ—\n"
+" -D --browse-domains ПереглÑдати домени заміÑÑ‚ÑŒ Ñлужб\n"
+" -a --all Показати вÑÑ– Ñлужби вÑÑ–Ñ… типів\n"
+" -d --domain=ДОМЕРДомен Ð´Ð»Ñ Ð¿ÐµÑ€ÐµÐ³Ð»Ñду\n"
+" -v --verbose Увімкнути докладний режим\n"
+" -t --terminate Перервати роботу піÑÐ»Ñ Ð¾Ñ‚Ñ€Ð¸Ð¼Ð°Ð½Ð½Ñ Ð±Ñ–Ð»ÑŒÑˆÐ¾ÑŽ чи меншою "
+"мірою повного ÑпиÑку\n"
+" -c --cache Перервати роботу піÑÐ»Ñ Ð¾Ñ‚Ñ€Ð¸Ð¼Ð°Ð½Ð½Ñ Ð²ÑÑ–Ñ… запиÑів з "
+"кешу\n"
+" -l --ignore-local Ігнорувати локальні Ñлужби\n"
+" -r --resolve Визначати адреÑи Ñ– назви знайдених Ñлужб\n"
+" -f --no-fail Ðе переривати роботу, Ñкщо не буде знайдено фонової "
+"Ñлужби\n"
+" -p --parsable ВивеÑти дані у придатному Ð´Ð»Ñ Ð¾Ð±Ñ€Ð¾Ð±ÐºÐ¸ форматі\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup Ðе визначати типи Ñлужб\n"
+" -b --dump-db Створити дамп бази даних типів Ñлужб\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "Занадто мало аргументів\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "Ðе вдалоÑÑ Ñтворити проÑтий об’єкт опитуваннÑ.\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "Ð’Ñтановлено під назвою «%s»\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "Спроба реєÑтрації завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "Збіг назв, обрано нову назву «%s».\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "Спроба ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð³Ñ€ÑƒÐ¿Ð¸ запиÑів завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "Спроба Ð´Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ Ð°Ð´Ñ€ÐµÑи завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "Спроба Ð´Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ Ñлужби завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "Спроба Ð´Ð¾Ð´Ð°Ð²Ð°Ð½Ð½Ñ Ð¿Ñ–Ð´Ñ‚Ð¸Ð¿Ñƒ «%s» завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "Конфлікт назв вузлів\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [параметри] %s <назва> <тип> <порт> [<txt ...>]\n"
+"%s [параметри] %s <назва вузла> <адреÑа>\n"
+"\n"
+" -h --help Показати цю верÑÑ–ÑŽ\n"
+" -V --version Показати дані щодо верÑÑ–Ñ—\n"
+" -s --service Оприлюднити Ñлужбу\n"
+" -a --address Оприлюднити адреÑу\n"
+" -v --verbose Увімкнути докладний режим\n"
+" -d --domain=ДОМЕРДомен Ð´Ð»Ñ Ð¾Ð¿Ñ€Ð¸Ð»ÑŽÐ´Ð½ÐµÐ½Ð½Ñ Ñлужби\n"
+" -H --host=ДОМЕРВузол, на Ñкому працює Ñлужба\n"
+" --subtype=ПІДТИП Додатковий підтип Ð´Ð»Ñ Ñ€ÐµÑ”Ñтрації цієї Ñлужби\n"
+" -R --no-reverse Ðе оприлюднювати зворотний Ð·Ð°Ð¿Ð¸Ñ Ñ€Ð°Ð·Ð¾Ð¼ з адреÑою\n"
+" -f --no-fail Ðе завершувати роботу, Ñкщо не вдаÑÑ‚ÑŒÑÑ Ð¾Ñ‚Ñ€Ð¸Ð¼Ð°Ñ‚Ð¸ "
+"доÑтуп до фонової Ñлужби\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "Ðеправильна кількіÑÑ‚ÑŒ аргументів\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "Ðе вдалоÑÑ Ð¾Ð±Ñ€Ð¾Ð±Ð¸Ñ‚Ð¸ номер порту: %s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "Ðе вказано команди.\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "Спроба Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ð°Ð·Ð²Ð¸ вузла «%s» завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "Спроба Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð°Ð´Ñ€ÐµÑи «%s» завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [параметри] %s <назва вузла ...>\n"
+"%s [параметри] %s <адреÑа ... >\n"
+"\n"
+" -h --help Показати цю довідку\n"
+" -V --version Показати дані щодо верÑÑ–Ñ—\n"
+" -n --name Визначити назву вузла\n"
+" -a --address Визначити адреÑу\n"
+" -v --verbose Увімкнути докладний режим\n"
+" -6 Визначити адреÑу IPv6\n"
+" -4 Визначити адреÑу IPv4\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+"Спроба ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð·Ð°Ñобу Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð½Ð°Ð·Ð²Ð¸ вузла завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "Спроба обробки адреÑи «%s» завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "Спроба ÑÑ‚Ð²Ð¾Ñ€ÐµÐ½Ð½Ñ Ð·Ð°Ñобу Ð²Ð¸Ð·Ð½Ð°Ñ‡ÐµÐ½Ð½Ñ Ð°Ð´Ñ€ÐµÑи завершилаÑÑ Ð½ÐµÐ²Ð´Ð°Ð»Ð¾: %s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [параметри] <нова назва вузла>\n"
+"\n"
+" -h --help Показати цю довідку\n"
+" -V --version Показати дані щодо верÑÑ–Ñ—\n"
+" -v --verbose Увімкнути докладний режим\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "Ðекоректна кількіÑÑ‚ÑŒ аргументів, Ñлід вказати рівно один аргумент.\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "Ðазву вузла уÑпішно змінено на %s\n"
diff --git a/po/zh_CN.po b/po/zh_CN.po
new file mode 100644
index 0000000..de850fa
--- /dev/null
+++ b/po/zh_CN.po
@@ -0,0 +1,850 @@
+# translation of zh_CN.po to 简体中文
+# Copyright (C) 2008 Avahi contributors
+# This file is distributed under the same license as the Avahi package.
+#
+# Ni Hui <shuizhuyuanluo@126.com>, 2008.
+msgid ""
+msgstr ""
+"Project-Id-Version: zh_CN\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-07-01 17:45+0700\n"
+"Last-Translator: 甘露(Gan Lu) <rhythm.gan@gmail.com>\n"
+"Language-Team: 简体中文 <kde-china@kde.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "确定"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "æ“作失败"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "错误状æ€"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "无效的主机å"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "无效的域å"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "没有适当的网络åè®®å¯ç”¨"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "无效的 DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr "资æºè®°å½•å¯†é’¥æ˜¯æ ·å“"
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "本地å称冲çª"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "无效的记录"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "无效的æœåŠ¡å称"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "无效的æœåŠ¡ç±»åž‹"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "无效的端å£å·"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "无效的记录密钥"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "无效的地å€"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "已超时"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "客户端太多"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "对象太多"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr "æ¡ç›®å¤ªå¤š"
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "æ“作系统错误"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "访问被拒ç»"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "无效的æ“作"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "å‘生了一个未预期的 D-Bus 错误"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "Daemon 连接失败"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "内存已用尽"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "传入的对象无效"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "Daemon 未è¿è¡Œ"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "无效的接å£ç´¢å¼•"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "无效的å议规范"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "无效的属性标志"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "没有找到"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "无效的é…ç½®"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "版本ä¸åŒ¹é…"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "无效的æœåŠ¡å­ç±»åž‹"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "无效的数æ®åŒ…"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "无效的 DNS 返回代ç "
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS 失败:FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS 失败:SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS 失败:NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS 失败:NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS 失败:REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS 失败:YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS 失败:YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS 失败:NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS 失败:NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS 失败:NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "无效的 RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "无效的 DNS 类型"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr "无效的 DNS 类"
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "ä¸æ”¯æŒ"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "ä¸å…许"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "无效的å‚æ•°"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "为空"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "请求的æ“作无效,因为过于冗长"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "无效的错误代ç "
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>没有当å‰é€‰å®šçš„æœåŠ¡ã€‚<i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahiå‘现"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroæµè§ˆå™¨"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "æµè§ˆç½‘络内的ZeroconfæœåŠ¡"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT æ•°æ®ï¼š"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "为空"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "æœåŠ¡ç±»åž‹ï¼š"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "æœåŠ¡å称:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "域å称:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "接å£ï¼š"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "地å€ï¼š"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "æµè§ˆæœåŠ¡ç±»åž‹"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr "以NULL结尾的æœåŠ¡ç±»åž‹åˆ—表用于æµè§ˆ"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "域"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr "è¦æµè§ˆçš„域,或NULL表示默认域"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "æœåŠ¡ç±»åž‹"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "选定æœåŠ¡çš„æœåŠ¡ç±»åž‹"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "æœåŠ¡å称"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "选定æœåŠ¡çš„æœåŠ¡å称"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "地å€"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr "已解æžæœåŠ¡çš„地å€"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "端å£"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "已解æžæœåŠ¡çš„IP端å£å·"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "主机å"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr "已解æžæœåŠ¡çš„主机å"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXTæ•°æ®"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr "已解æžæœåŠ¡çš„TXTæ•°æ®"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "解æžæœåŠ¡ï¼š"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "回转å‰è‡ªåŠ¨è§£æžé€‰å®šçš„æœåŠ¡"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "解æžæœåŠ¡ä¸»æœºå:"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "回转å‰è‡ªåŠ¨è§£æžé€‰å®šæœåŠ¡çš„主机å"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr "地å€ç±»åˆ«"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr "用于主机å称解æžçš„地å€ç±»åˆ«"
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi 客户端失败:%s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi 解æžå™¨å¤±è´¥ï¼š%s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr "æµè§ˆæœåŠ¡ç±»åž‹ %s 于域 %s 失败:%s"
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "ä¸å¯ç”¨"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr "Avahi 域æµè§ˆå™¨å¤±è´¥ï¼š%s"
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr "è¯»å– Avahi 域失败:%s"
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr "æµè§ˆæœåŠ¡ç±»åž‹åˆ—表为空ï¼"
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr "连接到 Avahi æœåŠ¡å™¨å¤±è´¥ï¼š%s"
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr "æµè§ˆæœåŠ¡äºŽ <b>本地网络</b>:"
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr "æµè§ˆæœåŠ¡äºŽåŸŸ <b>%s</b>:"
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr "为 %s 创建æµè§ˆå™¨å¤±è´¥ï¼š%s"
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr "为类型 %s çš„ %s 创建解æžå™¨äºŽåŸŸ %s 失败:%s"
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr "创建域æµè§ˆå™¨å¤±è´¥ï¼š%s"
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "更改域"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "正在æµè§ˆ..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "正在åˆå§‹åŒ–..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "ä½ç½®"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "å称"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "类型"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "_域..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+"%s [options]\n"
+"\n"
+" -h --help 显示该帮助信æ¯\n"
+" -s --ssh æµè§ˆSSHæœåŠ¡å™¨\n"
+" -v --vnc æµè§ˆVNCæœåŠ¡å™¨\n"
+" -S --shell æµè§ˆSSHå’ŒVNC\n"
+" -d --domain=DOMAIN è¦æµè§ˆçš„域å\n"
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "å‚数太多\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "选择 Shell æœåŠ¡å™¨"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "æ¡Œé¢"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "终端"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "选择 VNC æœåŠ¡å™¨"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "选择 SSH æœåŠ¡å™¨"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "正在连接“%sâ€...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr "execlp() 失败:%s\n"
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "å·²å–消。\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSHæœåŠ¡å™¨æµè§ˆå™¨"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "æµè§ˆå…·æœ‰Zeroconf功能的SSHæœåŠ¡å™¨"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNCæœåŠ¡å™¨æµè§ˆå™¨"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "æµè§ˆå…·æœ‰Zeroconf功能的VNCæœåŠ¡å™¨"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, c-format
+msgid ": All for now\n"
+msgstr ":当å‰æ‰€æœ‰\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ":缓存用尽\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr "解æžç±»åž‹â€œ%sâ€çš„æœåŠ¡â€œ%sâ€äºŽåŸŸâ€œ%sâ€å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr "service_browser 失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr "avahi_service_browser_new() 失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr "service_type_browser 失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr "avahi_service_type_browser_new() 失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr "avahi_domain_browser_new() 失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr "查询版本字符串失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr "查询主机å失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr "æœåŠ¡å™¨ç‰ˆæœ¬ï¼š%s;主机å:%s\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr "E Ifce Prot 域\n"
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr "E Ifce Prot %-*s %-20s 域\n"
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "已断开,正在é‡æ–°è¿žæŽ¥ ...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr "创建客户端对象失败:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "客户端失败,退出:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr "正在等待 daemon ...\n"
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+" -h --help 显示本帮助\n"
+" -V --version 显示版本\n"
+" -D --browse-domains æµè§ˆåŸŸè€Œä¸æ˜¯æœåŠ¡\n"
+" -a --all 显示所有æœåŠ¡ï¼Œå¿½ç•¥ç±»åž‹\n"
+" -d --domain=DOMAIN è¦æµè§ˆçš„域\n"
+" -v --verbose å¯ç”¨è¯¦è¿°æ¨¡å¼\n"
+" -t --terminate 导出一个完整列表åŽç»ˆæ­¢\n"
+" -c --cache 导出缓存中的所有æ¡ç›®åŽç»ˆæ­¢\n"
+" -l --ignore-local 忽略本地æœåŠ¡\n"
+" -r --resolve 解æžæ‰¾åˆ°çš„æœåŠ¡\n"
+" -f --no-fail 如果 daemon ä¸å¯ç”¨ä¹Ÿä¸ä¸­æ–­\n"
+" -p --parsable 输出å¯è§£æžæ ¼å¼\n"
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+" -k --no-db-lookup ä¸æŸ¥è¯¢æœåŠ¡ç±»åž‹\n"
+" -b --dump-db 导出æœåŠ¡ç±»åž‹æ•°æ®åº“\n"
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "过少的å‚æ•°\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr "创建简å•æŸ¥è¯¢å¯¹è±¡å¤±è´¥ã€‚\n"
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr "已以å称“%sâ€å»ºç«‹\n"
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "注册失败:%s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "å称冲çªï¼ŒæŒ‘选新å称“%sâ€ã€‚\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr "创建æ¡ç›®ç»„失败:%s\n"
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr "添加地å€å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr "添加æœåŠ¡å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr "添加å­ç±»åž‹â€œ%sâ€å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "主机å冲çª\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+"%s [选项] %s <å称> <类型> <端å£> [<txt ...>]\n"
+"%s [选项] %s <主机å> <地å€>\n"
+"\n"
+" -h --help 显示本帮助\n"
+" -V --version 显示版本\n"
+" -s --service å‘布æœåŠ¡\n"
+" -a --address å‘布地å€\n"
+" -v --verbose å¯ç”¨è¯¦è¿°æ¨¡å¼\n"
+" -d --domain=DOMAIN è¦å‘布æœåŠ¡çš„域\n"
+" -H --host=DOMAIN æœåŠ¡å®¿å±žçš„主机\n"
+" --subtype=SUBTYPE 用于注册此æœåŠ¡çš„é¢å¤–å­ç±»åž‹\n"
+" -R --no-reverse ä¸å‘布带地å€çš„å转æ¡ç›® -f --no-fail 如果 "
+"daemon ä¸å¯ç”¨ä¹Ÿä¸ä¸­æ–­\n"
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr "无效的å‚数个数\n"
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr "解æžç«¯å£å·å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr "没有指定的命令。\n"
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr "解æžä¸»æœºå“%sâ€å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr "解æžåœ°å€â€œ%sâ€å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+"%s [选项] %s <主机å ...>\n"
+"%s [选项] %s <åœ°å€ ... >\n"
+"\n"
+" -h --help 显示本帮助\n"
+" -V --version 显示版本\n"
+" -n --name 解æžä¸»æœºå\n"
+" -a --address 解æžåœ°å€\n"
+" -v --verbose å¯ç”¨è¯¦è¿°æ¨¡å¼\n"
+" -6 检查 IPv6 地å€\n"
+" -4 检查 IPv4 地å€\n"
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr "创建主机å解æžå™¨å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr "分æžåœ°å€â€œ%sâ€å¤±è´¥\n"
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr "创建地å€è§£æžå™¨å¤±è´¥ï¼š%s\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+"%s [选项] <新主机å>\n"
+"\n"
+" -h --help 显示本帮助\n"
+" -V --version 显示版本\n"
+" -v --verbose å¯ç”¨è¯¦è¿°æ¨¡å¼\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr "无效的å‚数个数,åªæŽ¥å—一个å‚数。\n"
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "主机åæˆåŠŸæ›´æ”¹ä¸º %s\n"
diff --git a/po/zh_TW.po b/po/zh_TW.po
new file mode 100644
index 0000000..696173b
--- /dev/null
+++ b/po/zh_TW.po
@@ -0,0 +1,800 @@
+# Traditional Chinese Translation for avahi
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Cheng-Chia Tseng <pswo10680@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Master\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-04-02 03:23+0200\n"
+"PO-Revision-Date: 2010-08-18 01:01+0800\n"
+"Last-Translator: Cheng-Chia Tseng <pswo10680@gmail.com>\n"
+"Language-Team: chinese-l10n <chinese-l10n@googlegroups.com>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../avahi-common/error.c:30
+msgid "OK"
+msgstr "確èª"
+
+#: ../avahi-common/error.c:31
+msgid "Operation failed"
+msgstr "æ“作失敗"
+
+#: ../avahi-common/error.c:32
+msgid "Bad state"
+msgstr "狀態ä¸è‰¯"
+
+#: ../avahi-common/error.c:33
+msgid "Invalid host name"
+msgstr "無效的主機å稱"
+
+#: ../avahi-common/error.c:34
+msgid "Invalid domain name"
+msgstr "無效的網域å稱"
+
+#: ../avahi-common/error.c:35
+msgid "No suitable network protocol available"
+msgstr "沒有åˆé©çš„網路å”定å¯ç”¨"
+
+#: ../avahi-common/error.c:36
+msgid "Invalid DNS TTL"
+msgstr "無效的 DNS TTL"
+
+#: ../avahi-common/error.c:37
+msgid "Resource record key is pattern"
+msgstr ""
+
+#: ../avahi-common/error.c:38
+msgid "Local name collision"
+msgstr "本機å稱è¡çª"
+
+#: ../avahi-common/error.c:39
+msgid "Invalid record"
+msgstr "無效的紀錄"
+
+#: ../avahi-common/error.c:41
+msgid "Invalid service name"
+msgstr "無效的æœå‹™å稱"
+
+#: ../avahi-common/error.c:42
+msgid "Invalid service type"
+msgstr "無效的æœå‹™é¡žåž‹"
+
+#: ../avahi-common/error.c:43
+msgid "Invalid port number"
+msgstr "無效的連接埠編號"
+
+#: ../avahi-common/error.c:44
+msgid "Invalid record key"
+msgstr "無效的紀錄金鑰"
+
+#: ../avahi-common/error.c:45
+msgid "Invalid address"
+msgstr "無效的ä½å€"
+
+#: ../avahi-common/error.c:46
+msgid "Timeout reached"
+msgstr "å·²é”逾時é™åˆ¶"
+
+#: ../avahi-common/error.c:47
+msgid "Too many clients"
+msgstr "太多用戶端"
+
+#: ../avahi-common/error.c:48
+msgid "Too many objects"
+msgstr "éŽå¤šç‰©ä»¶"
+
+#: ../avahi-common/error.c:49
+msgid "Too many entries"
+msgstr ""
+
+#: ../avahi-common/error.c:50
+msgid "OS Error"
+msgstr "OS 錯誤"
+
+#: ../avahi-common/error.c:52
+msgid "Access denied"
+msgstr "拒絕存å–"
+
+#: ../avahi-common/error.c:53
+msgid "Invalid operation"
+msgstr "無效的æ“作"
+
+#: ../avahi-common/error.c:54
+msgid "An unexpected D-Bus error occurred"
+msgstr "é­é‡åˆ°æœªé æœŸçš„ D-Bus 錯誤"
+
+#: ../avahi-common/error.c:55
+msgid "Daemon connection failed"
+msgstr "幕後程å¼é€£ç·šå¤±æ•—"
+
+#: ../avahi-common/error.c:56
+msgid "Memory exhausted"
+msgstr "記憶體已耗盡"
+
+#: ../avahi-common/error.c:57
+msgid "The object passed in was not valid"
+msgstr "傳入的物件無效"
+
+#: ../avahi-common/error.c:58
+msgid "Daemon not running"
+msgstr "幕後程å¼æ²’有在執行中"
+
+#: ../avahi-common/error.c:59
+msgid "Invalid interface index"
+msgstr "無效的介é¢ç´¢å¼•"
+
+#: ../avahi-common/error.c:60
+msgid "Invalid protocol specification"
+msgstr "無效的å”定è¦æ ¼"
+
+#: ../avahi-common/error.c:61
+msgid "Invalid flags"
+msgstr "無效的旗標"
+
+#: ../avahi-common/error.c:63
+msgid "Not found"
+msgstr "找ä¸åˆ°"
+
+#: ../avahi-common/error.c:64
+msgid "Invalid configuration"
+msgstr "無效的組態"
+
+#: ../avahi-common/error.c:65
+msgid "Version mismatch"
+msgstr "版本ä¸ç¬¦"
+
+#: ../avahi-common/error.c:66
+msgid "Invalid service subtype"
+msgstr "無效的æœå‹™å­é¡žåž‹"
+
+#: ../avahi-common/error.c:67
+msgid "Invalid packet"
+msgstr "無效的å°åŒ…"
+
+#: ../avahi-common/error.c:68
+msgid "Invalid DNS return code"
+msgstr "無效的 DNS 回傳碼"
+
+#: ../avahi-common/error.c:69
+msgid "DNS failure: FORMERR"
+msgstr "DNS 失敗:FORMERR"
+
+#: ../avahi-common/error.c:70
+msgid "DNS failure: SERVFAIL"
+msgstr "DNS 失敗:SERVFAIL"
+
+#: ../avahi-common/error.c:71
+msgid "DNS failure: NXDOMAIN"
+msgstr "DNS 失敗:NXDOMAIN"
+
+#: ../avahi-common/error.c:72
+msgid "DNS failure: NOTIMP"
+msgstr "DNS 失敗:NOTIMP"
+
+#: ../avahi-common/error.c:74
+msgid "DNS failure: REFUSED"
+msgstr "DNS 失敗:REFUSED"
+
+#: ../avahi-common/error.c:75
+msgid "DNS failure: YXDOMAIN"
+msgstr "DNS 失敗:YXDOMAIN"
+
+#: ../avahi-common/error.c:76
+msgid "DNS failure: YXRRSET"
+msgstr "DNS 失敗:YXRRSET"
+
+#: ../avahi-common/error.c:77
+msgid "DNS failure: NXRRSET"
+msgstr "DNS 失敗:NXRRSET"
+
+#: ../avahi-common/error.c:78
+msgid "DNS failure: NOTAUTH"
+msgstr "DNS 失敗:NOTAUTH"
+
+#: ../avahi-common/error.c:79
+msgid "DNS failure: NOTZONE"
+msgstr "DNS 失敗:NOTZONE"
+
+#: ../avahi-common/error.c:80
+msgid "Invalid RDATA"
+msgstr "無效的 RDATA"
+
+#: ../avahi-common/error.c:81
+msgid "Invalid DNS type"
+msgstr "無效的 DNS 類型"
+
+#: ../avahi-common/error.c:82
+msgid "Invalid DNS class"
+msgstr ""
+
+#: ../avahi-common/error.c:83
+msgid "Not supported"
+msgstr "未支æ´"
+
+#: ../avahi-common/error.c:85
+msgid "Not permitted"
+msgstr "未許å¯"
+
+#: ../avahi-common/error.c:86
+msgid "Invalid argument"
+msgstr "無效的引數"
+
+#: ../avahi-common/error.c:87
+msgid "Is empty"
+msgstr "是空的"
+
+#: ../avahi-common/error.c:88
+msgid "The requested operation is invalid because redundant"
+msgstr "請求的æ“作無效,因為é‡è¤‡"
+
+#: ../avahi-common/error.c:94
+msgid "Invalid Error Code"
+msgstr "無效的錯誤代碼"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:1
+#: ../avahi-python/avahi-discover/avahi-discover.py:76
+msgid "<i>No service currently selected.</i>"
+msgstr "<i>ç›®å‰æœªé¸å–æœå‹™ã€‚</i>"
+
+#: ../avahi-discover-standalone/avahi-discover.ui.h:2
+msgid "Avahi Discovery"
+msgstr "Avahi 探索"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:1
+msgid "Avahi Zeroconf Browser"
+msgstr "Avahi Zeroconf ç€è¦½ç¨‹å¼"
+
+#: ../avahi-python/avahi-discover/avahi-discover.desktop.in.in.h:2
+msgid "Browse for Zeroconf services available on your network"
+msgstr "在您的網路上ç€è¦½å¯ç”¨çš„ Zeroconf æœå‹™"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:224
+msgid "TXT"
+msgstr "TXT"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "TXT Data:"
+msgstr "TXT 資料:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:226
+msgid "empty"
+msgstr "空的"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:228
+msgid "Service Type:"
+msgstr "æœå‹™é¡žåž‹ï¼š"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:229
+msgid "Service Name:"
+msgstr "æœå‹™å稱:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:230
+msgid "Domain Name:"
+msgstr "網域å稱:"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:231
+msgid "Interface:"
+msgstr "介é¢ï¼š"
+
+#: ../avahi-python/avahi-discover/avahi-discover.py:232
+msgid "Address:"
+msgstr "ä½å€ï¼š"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "Browse Service Types"
+msgstr "ç€è¦½æœå‹™é¡žåž‹"
+
+#: ../avahi-ui/avahi-ui.c:185
+msgid "A NULL terminated list of service types to browse for"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "Domain"
+msgstr "網域"
+
+#: ../avahi-ui/avahi-ui.c:190
+msgid "The domain to browse in, or NULL for the default domain"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "Service Type"
+msgstr "æœå‹™é¡žåž‹"
+
+#: ../avahi-ui/avahi-ui.c:196
+msgid "The service type of the selected service"
+msgstr "所é¸æœå‹™çš„æœå‹™é¡žåž‹"
+
+#: ../avahi-ui/avahi-ui.c:202 ../avahi-ui/avahi-ui.c:1023
+msgid "Service Name"
+msgstr "æœå‹™å稱"
+
+#: ../avahi-ui/avahi-ui.c:202
+msgid "The service name of the selected service"
+msgstr "所é¸æœå‹™çš„æœå‹™å稱"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "Address"
+msgstr "ä½å€"
+
+#: ../avahi-ui/avahi-ui.c:208
+msgid "The address of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "Port"
+msgstr "連接埠"
+
+#: ../avahi-ui/avahi-ui.c:213
+msgid "The IP port number of the resolved service"
+msgstr "解æžæœå‹™çš„ IP 連接埠號碼"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "Host Name"
+msgstr "主機å稱"
+
+#: ../avahi-ui/avahi-ui.c:219
+msgid "The host name of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "TXT Data"
+msgstr "TXT 資料"
+
+#: ../avahi-ui/avahi-ui.c:225
+msgid "The TXT data of the resolved service"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve Service"
+msgstr "解æžæœå‹™"
+
+#: ../avahi-ui/avahi-ui.c:230
+msgid "Resolve the selected service automatically before returning"
+msgstr "在回傳之å‰è‡ªå‹•è§£æžæ‰€é¸çš„æœå‹™"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid "Resolve Service Host Name"
+msgstr "解æžæœå‹™ä¸»æ©Ÿå稱"
+
+#: ../avahi-ui/avahi-ui.c:236
+msgid ""
+"Resolve the host name of the selected service automatically before returning"
+msgstr "在回傳之å‰è‡ªå‹•è§£æžæ‰€é¸æœå‹™çš„主機å稱"
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "Address family"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:242
+msgid "The address family for host name resolution"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:326
+#, c-format
+msgid "Avahi client failure: %s"
+msgstr "Avahi 用戶端失敗:%s"
+
+#: ../avahi-ui/avahi-ui.c:388
+#, c-format
+msgid "Avahi resolver failure: %s"
+msgstr "Avahi 解æžå¤±æ•—:%s"
+
+#: ../avahi-ui/avahi-ui.c:518
+#, c-format
+msgid "Browsing for service type %s in domain %s failed: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:519 ../avahi-utils/avahi-browse.c:168
+#: ../avahi-utils/avahi-browse.c:169 ../avahi-utils/avahi-browse.c:178
+#: ../avahi-utils/avahi-browse.c:179
+msgid "n/a"
+msgstr "無法使用"
+
+#: ../avahi-ui/avahi-ui.c:649
+#, c-format
+msgid "Avahi domain browser failure: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:684
+#, c-format
+msgid "Failed to read Avahi domain: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:706
+msgid "Browse service type list is empty!"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:717
+#, c-format
+msgid "Failed to connect to Avahi server: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:735
+msgid "Browsing for services on <b>local network</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:737
+#, c-format
+msgid "Browsing for services in domain <b>%s</b>:"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:773
+#, c-format
+msgid "Failed to create browser for %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:903
+#, c-format
+msgid "Failed to create resolver for %s of type %s in domain %s: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:978
+#, c-format
+msgid "Failed to create domain browser: %s"
+msgstr ""
+
+#: ../avahi-ui/avahi-ui.c:989
+msgid "Change domain"
+msgstr "變更網域"
+
+#: ../avahi-ui/avahi-ui.c:1031 ../avahi-ui/avahi-ui.c:1162
+msgid "Browsing..."
+msgstr "正在ç€è¦½..."
+
+#: ../avahi-ui/avahi-ui.c:1120
+msgid "Initializing..."
+msgstr "正在åˆå§‹åŒ–..."
+
+#: ../avahi-ui/avahi-ui.c:1144
+msgid "Location"
+msgstr "ä½ç½®"
+
+#: ../avahi-ui/avahi-ui.c:1149 ../avahi-utils/avahi-browse.c:553
+msgid "Name"
+msgstr "å稱"
+
+#: ../avahi-ui/avahi-ui.c:1154 ../avahi-utils/avahi-browse.c:553
+msgid "Type"
+msgstr "é¡žåž‹"
+
+#: ../avahi-ui/avahi-ui.c:1166
+msgid "_Domain..."
+msgstr "網域(_D)..."
+
+#: ../avahi-ui/bssh.c:55
+#, c-format
+msgid ""
+"%s [options]\n"
+"\n"
+" -h --help Show this help\n"
+" -s --ssh Browse SSH servers\n"
+" -v --vnc Browse VNC servers\n"
+" -S --shell Browse both SSH and VNC\n"
+" -d --domain=DOMAIN The domain to browse in\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:101 ../avahi-utils/avahi-browse.c:775
+#, c-format
+msgid "Too many arguments\n"
+msgstr "太多引數\n"
+
+#: ../avahi-ui/bssh.c:149
+msgid "Choose Shell Server"
+msgstr "é¸æ“‡ Shell 伺æœå™¨"
+
+#: ../avahi-ui/bssh.c:151
+msgid "Desktop"
+msgstr "æ¡Œé¢"
+
+#: ../avahi-ui/bssh.c:152
+msgid "Terminal"
+msgstr "終端機"
+
+#: ../avahi-ui/bssh.c:156
+msgid "Choose VNC server"
+msgstr "é¸æ“‡ VNC 伺æœå™¨"
+
+#: ../avahi-ui/bssh.c:161
+msgid "Choose SSH server"
+msgstr "é¸æ“‡ SSH 伺æœå™¨"
+
+#: ../avahi-ui/bssh.c:185
+#, c-format
+msgid "Connecting to '%s' ...\n"
+msgstr "正在連接到「%sã€...\n"
+
+#: ../avahi-ui/bssh.c:240
+#, c-format
+msgid "execlp() failed: %s\n"
+msgstr ""
+
+#: ../avahi-ui/bssh.c:250
+#, c-format
+msgid "Canceled.\n"
+msgstr "å·²å–消。\n"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:1
+msgid "Avahi SSH Server Browser"
+msgstr "Avahi SSH 伺æœå™¨ç€è¦½ç¨‹å¼"
+
+#: ../avahi-ui/bssh.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled SSH Servers"
+msgstr "ç€è¦½å•Ÿç”¨ Zeroconf çš„ SSH 伺æœå™¨"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:1
+msgid "Avahi VNC Server Browser"
+msgstr "Avahi VNC 伺æœå™¨ç€è¦½ç¨‹å¼"
+
+#: ../avahi-ui/bvnc.desktop.in.in.h:2
+msgid "Browse for Zeroconf-enabled VNC Servers"
+msgstr "ç€è¦½å•Ÿç”¨ Zeroconf çš„ VNC 伺æœå™¨"
+
+#: ../avahi-utils/avahi-browse.c:107
+#, fuzzy, c-format
+msgid ": All for now\n"
+msgstr ": ç¾åœ¨æ˜¯å…¨éƒ¨\n"
+
+#: ../avahi-utils/avahi-browse.c:118
+#, c-format
+msgid ": Cache exhausted\n"
+msgstr ": å¿«å–已耗盡\n"
+
+#: ../avahi-utils/avahi-browse.c:239 ../avahi-utils/avahi-browse.c:261
+#, c-format
+msgid "Failed to resolve service '%s' of type '%s' in domain '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:340
+#, c-format
+msgid "service_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:378
+#, c-format
+msgid "avahi_service_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:414
+#, c-format
+msgid "service_type_browser failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:444
+#, c-format
+msgid "avahi_service_type_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:519
+#, c-format
+msgid "avahi_domain_browser_new() failed: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:535 ../avahi-utils/avahi-publish.c:394
+#: ../avahi-utils/avahi-resolve.c:280 ../avahi-utils/avahi-set-host-name.c:168
+#, c-format
+msgid "Failed to query version string: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:540 ../avahi-utils/avahi-publish.c:399
+#: ../avahi-utils/avahi-resolve.c:285 ../avahi-utils/avahi-set-host-name.c:173
+#: ../avahi-utils/avahi-set-host-name.c:189
+#, c-format
+msgid "Failed to query host name: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:544 ../avahi-utils/avahi-publish.c:403
+#: ../avahi-utils/avahi-resolve.c:289 ../avahi-utils/avahi-set-host-name.c:177
+#, c-format
+msgid "Server version: %s; Host name: %s\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:549
+#, c-format
+msgid "E Ifce Prot Domain\n"
+msgstr ""
+
+#. Translators: This is a column heading with abbreviations for
+#. * Event (+/-), Network Interface, Protocol (IPv4/v6), Domain
+#: ../avahi-utils/avahi-browse.c:553
+#, c-format
+msgid "E Ifce Prot %-*s %-20s Domain\n"
+msgstr ""
+
+#. We have been disconnected, so let reconnect
+#: ../avahi-utils/avahi-browse.c:585 ../avahi-utils/avahi-publish.c:163
+#, c-format
+msgid "Disconnected, reconnecting ...\n"
+msgstr "已斷線,正在é‡æ–°é€£æŽ¥...\n"
+
+#: ../avahi-utils/avahi-browse.c:599 ../avahi-utils/avahi-browse.c:829
+#: ../avahi-utils/avahi-publish.c:170 ../avahi-utils/avahi-publish.c:386
+#: ../avahi-utils/avahi-resolve.c:272 ../avahi-utils/avahi-set-host-name.c:160
+#, c-format
+msgid "Failed to create client object: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:604 ../avahi-utils/avahi-publish.c:175
+#: ../avahi-utils/avahi-resolve.c:143 ../avahi-utils/avahi-set-host-name.c:59
+#, c-format
+msgid "Client failure, exiting: %s\n"
+msgstr "用戶端失敗,正在退出:%s\n"
+
+#: ../avahi-utils/avahi-browse.c:623 ../avahi-utils/avahi-publish.c:206
+#, c-format
+msgid "Waiting for daemon ...\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:647
+msgid ""
+" -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"
+" -p --parsable Output in parsable format\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:660
+msgid ""
+" -k --no-db-lookup Don't lookup service types\n"
+" -b --dump-db Dump service type database\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-browse.c:766 ../avahi-utils/avahi-resolve.c:219
+#, c-format
+msgid "Too few arguments\n"
+msgstr "éŽå°‘引數\n"
+
+#: ../avahi-utils/avahi-browse.c:821 ../avahi-utils/avahi-publish.c:378
+#: ../avahi-utils/avahi-resolve.c:264 ../avahi-utils/avahi-set-host-name.c:152
+#, c-format
+msgid "Failed to create simple poll object.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:76
+#, c-format
+msgid "Established under name '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:81
+#, c-format
+msgid "Failed to register: %s\n"
+msgstr "註冊失敗:%s\n"
+
+#: ../avahi-utils/avahi-publish.c:94
+#, c-format
+msgid "Name collision, picking new name '%s'.\n"
+msgstr "å稱è¡çªï¼Œæ€é¸æ–°å稱 '%s'。\n"
+
+#: ../avahi-utils/avahi-publish.c:114
+#, c-format
+msgid "Failed to create entry group: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:124
+#, c-format
+msgid "Failed to add address: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:134
+#, c-format
+msgid "Failed to add service: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:140
+#, c-format
+msgid "Failed to add subtype '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:191
+#, c-format
+msgid "Host name conflict\n"
+msgstr "主機å稱è¡çª\n"
+
+#: ../avahi-utils/avahi-publish.c:216
+#, c-format
+msgid ""
+"%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"
+" -R --no-reverse Do not publish reverse entry with address\n"
+" -f --no-fail Don't fail if the daemon is not available\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:303 ../avahi-utils/avahi-publish.c:318
+#, c-format
+msgid "Bad number of arguments\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:329
+#, c-format
+msgid "Failed to parse port number: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-publish.c:361 ../avahi-utils/avahi-resolve.c:246
+#, c-format
+msgid "No command specified.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:89
+#, c-format
+msgid "Failed to resolve host name '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:126
+#, c-format
+msgid "Failed to resolve address '%s': %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:157
+#, c-format
+msgid ""
+"%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"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:299 ../avahi-utils/avahi-set-host-name.c:181
+#, c-format
+msgid "Failed to create host name resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:309
+#, c-format
+msgid "Failed to parse address '%s'\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-resolve.c:314
+#, c-format
+msgid "Failed to create address resolver: %s\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:73
+#, c-format
+msgid ""
+"%s [options] <new host name>\n"
+"\n"
+" -h --help Show this help\n"
+" -V --version Show version\n"
+" -v --verbose Enable verbose mode\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:114
+#, c-format
+msgid "Invalid number of arguments, expecting exactly one.\n"
+msgstr ""
+
+#: ../avahi-utils/avahi-set-host-name.c:193
+#, c-format
+msgid "Host name successfully changed to %s\n"
+msgstr "主機å稱æˆåŠŸè®Šæ›´ç‚º %s\n"
diff --git a/service-type-database/.gitignore b/service-type-database/.gitignore
new file mode 100644
index 0000000..581f192
--- /dev/null
+++ b/service-type-database/.gitignore
@@ -0,0 +1,4 @@
+Makefile
+Makefile.in
+service-types.db
+build-db
diff --git a/service-type-database/Makefile.am b/service-type-database/Makefile.am
new file mode 100644
index 0000000..b43e2cb
--- /dev/null
+++ b/service-type-database/Makefile.am
@@ -0,0 +1,64 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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
+
+pkglibdatadir=$(libdir)/avahi
+
+pkgdata_DATA=service-types
+pkglibdata_DATA=
+
+if HAVE_PYTHON
+if HAVE_GDBM
+
+noinst_SCRIPTS=build-db
+pkglibdata_DATA+=service-types.db
+
+build-db: build-db.in
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,gdbm,g' $< > $@ && \
+ chmod +x $@
+
+service-types.db: service-types build-db
+ $(AM_V_GEN)$(PYTHON) build-db $< $@.coming && \
+ mv $@.coming $@
+
+CLEANFILES = service-types.db build-db
+
+endif
+if HAVE_DBM
+
+noinst_SCRIPTS=build-db
+pkglibdata_DATA+=service-types.db.pag service-types.db.dir
+
+build-db: build-db.in
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,dbm,g' $< > $@ && \
+ chmod +x $@
+
+service-types.db.pag: service-types.db
+ $(AM_V_GEN)mv service-types.db.coming.pag service-types.db.pag
+service-types.db.dir: service-types.db
+ $(AM_V_GEN)mv service-types.db.coming.dir service-types.db.dir
+service-types.db: service-types build-db
+ $(AM_V_GEN)$(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
new file mode 100755
index 0000000..4cda425
--- /dev/null
+++ b/service-type-database/build-db.in
@@ -0,0 +1,44 @@
+#!@PYTHON@
+# -*-python-*-
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/service-type-database/service-types b/service-type-database/service-types
new file mode 100644
index 0000000..6e7e2cd
--- /dev/null
+++ b/service-type-database/service-types
@@ -0,0 +1,233 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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.
+
+
+# Devices
+
+_workstation._tcp:Workstation
+_workstation._tcp[de]:Arbeitsplatzrechner
+_workstation._tcp[it]:Macchine
+
+
+# Web
+
+_http._tcp:Web Site
+_http._tcp[de]:Web-Angebot
+_http._tcp[it]:Sito Web
+
+_https._tcp:Secure Web Site
+_https._tcp[de]:Sicheres Web-Angebot
+_https._tcp[it]:Sito Web sicuro
+
+_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
+_smb._tcp[it]:Rete Microsoft Windows
+
+_airport._tcp:Apple AirPort
+
+
+# File and data access
+
+_ftp._tcp:FTP File Transfer
+_ftp._tcp[de]:FTP-Dateifreigabe
+
+_tftp._udp:TFTP Trivial File Transfer
+
+_webdav._tcp:WebDAV File Share
+_webdav._tcp[it]:WebDAV Condivisione File
+
+_webdavs._tcp:Secure WebDAV File Share
+_webdavs._tcp[it]:WebDAV Condivisione File Sicuro
+
+_afpovertcp._tcp:Apple File Sharing
+
+_nfs._tcp:Network File System
+
+_sftp-ssh._tcp:SFTP File Transfer
+
+_apt._tcp:APT Package Repository
+_apt._tcp[it]:APT - Repository dei Pacchetti
+
+_odisk._tcp:DVD or CD Sharing
+
+_adisk._tcp:Apple TimeMachine
+
+
+# Remote machine access
+
+_ssh._tcp:SSH Remote Terminal
+_ssh._tcp[de]:SSH-Fernzugriff
+_ssh._tcp[it]:SSH Terminale remoto
+
+_rfb._tcp:VNC Remote Access
+_rfb._tcp[it]:Controllo remoto VNC
+
+_telnet._tcp:Telnet Remote Terminal
+_telnet._tcp[it]:Telnet Terminale Remoto
+
+_timbuktu._tcp:Timbuktu Remote Desktop Control
+
+_net-assistant._udp:Apple Net Assistant
+
+_udisks-ssh._tcp:Remote Disk Management
+
+# Mail
+
+_imap._tcp:IMAP Mail Access
+_imap._tcp[it]:Posta - IMAP
+
+_pop3._tcp:POP3 Mail Access
+_pop3._tcp:Posta - POP3
+
+
+# Printing
+
+_printer._tcp:UNIX Printer
+_printer._tcp[it]:Stampante UNIX
+
+_pdl-datastream._tcp:PDL Printer
+_pdl-datastream._tcp[it]:Stampante PDL
+
+_ipp._tcp:Internet Printer
+
+
+# Multimedia
+
+_daap._tcp:iTunes Audio Access
+_daap._tcp[de]:iTunes Audio-Zugriff
+_daap._tcp[it]:Accesso Audio iTunes
+
+_dacp._tcp:iTunes Remote Control
+
+_realplayfavs._tcp:RealPlayer Shared Favorites
+_realplayfavs._tcp[it]:RealPlayer - Preferiti Condivisi
+
+_raop._tcp:AirTunes Remote Audio
+
+_rtsp._tcp:RTSP Realtime Streaming Server
+_rtp._udp:RTP Realtime Streaming Server
+
+_dpap._tcp:Digital Photo Sharing
+_dpap._tcp[it]:Condivisione Foto
+
+_pulse-server._tcp:PulseAudio Sound Server
+_pulse-sink._tcp:PulseAudio Sound Sink
+_pulse-source._tcp:PulseAudio Sound Source
+
+_mpd._tcp:Music Player Daemon
+
+_remote-jukebox._tcp:Remote Jukebox
+
+# DAAP share provided by iTunes on behalf of an iPod Touch
+_touch-able._tcp:iPod Touch Music Library
+
+_vlc-http._tcp:VLC Streaming
+
+
+# Communication, presence, working together
+
+_presence._tcp:iChat Presence
+
+_sip._udp:SIP Telephony
+_sip._udp[de]:SIP-Telefonie
+_sip._udp[it]:Telefonia-SIP
+
+_h323._tcp:H.323 Telephony
+_h323._tcp[de]:H.323-Telefonie
+_h323._tcp[it]:Telefonia-H.323
+
+_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
+
+_mumble._tcp:Mumble Server
+
+
+# Databases
+
+_postgresql._tcp:PostgreSQL Server
+
+
+# Development
+
+_svn._tcp:Subversion Revision Control
+_svn._tcp[it]:Subversion - Versionatore
+
+_distcc._tcp:Distributed Compiler
+_distcc._tcp[de]:Verteilter Compiler
+_distcc._tcp[it]:Compilatore Distribuito
+
+_bzr._tcp:Bazaar
+
+
+# Vendor specific
+
+_MacOSXDupSuppress._tcp:MacOS X Duplicate Machine Suppression
+
+_ksysguard._tcp:KDE System Guard
+
+_omni-bookmark._tcp:OmniWeb Bookmark Sharing
+
+_acrobatSRV._tcp:Adobe Acrobat
+
+_adobe-vc._tcp:Adobe Version Cue
+
+_home-sharing._tcp:Apple Home Sharing
+
+
+# Other
+
+_pgpkey-hkp._tcp:GnuPG/PGP HKP Key Server
+
+_ldap._tcp:LDAP Directory Server
+
+_tp._tcp:Thousand Parsec Server
+_tps._tcp:Thousand Parsec Server (Secure)
+_tp-http._tcp:Thousand Parsec Server (HTTP Tunnel)
+_tp-https._tcp:Thousand Parsec Server (Secure HTTP Tunnel)
+
+_shifter._tcp:Window Shifter
+
+_libvirt._tcp:Virtual Machine Manager
diff --git a/specs/draft-cheshire-dnsext-dns-sd-02.txt b/specs/draft-cheshire-dnsext-dns-sd-02.txt
new file mode 100644
index 0000000..bebc28d
--- /dev/null
+++ b/specs/draft-cheshire-dnsext-dns-sd-02.txt
@@ -0,0 +1,1798 @@
+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/specs/draft-cheshire-dnsext-dns-sd-03.txt b/specs/draft-cheshire-dnsext-dns-sd-03.txt
new file mode 100644
index 0000000..c412806
--- /dev/null
+++ b/specs/draft-cheshire-dnsext-dns-sd-03.txt
@@ -0,0 +1,1856 @@
+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/specs/draft-cheshire-dnsext-dns-sd-04.txt b/specs/draft-cheshire-dnsext-dns-sd-04.txt
new file mode 100644
index 0000000..3179028
--- /dev/null
+++ b/specs/draft-cheshire-dnsext-dns-sd-04.txt
@@ -0,0 +1,2205 @@
+Document: draft-cheshire-dnsext-dns-sd-04.txt Stuart Cheshire
+Internet-Draft Marc Krochmal
+Category: Standards Track Apple Computer, Inc.
+Expires 10th February 2007 10th August 2006
+
+ DNS-Based Service Discovery
+
+ <draft-cheshire-dnsext-dns-sd-04.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 becomes
+ aware will be disclosed, in accordance with Section 6 of BCP 79.
+ For the purposes of this document, the term "BCP 79" refers
+ exclusively to RFC 3979, "Intellectual Property Rights in IETF
+ Technology", published March 2005.
+
+ 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/1id-abstracts.html
+
+ The list of Internet-Draft Shadow Directories can be accessed at
+ http://www.ietf.org/shadow.html
+
+
+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 10th February 2007 Cheshire & Krochmal [Page 1]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+Table of Contents
+
+ 1. Introduction...................................................3
+ 2. Conventions and Terminology Used in this Document..............4
+ 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...................................8
+ 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............................................17
+ 6.7 Version Tag...................................................17
+ 7. Application Protocol Names....................................18
+ 7.1 Selective Instance Enumeration................................19
+ 7.2 Service Name Length Limits....................................20
+ 8. Flagship Naming...............................................22
+ 9. Service Type Enumeration......................................23
+ 10. Populating the DNS with Information...........................24
+ 11. Relationship to Multicast DNS.................................24
+ 12. Discovery of Browsing and Registration Domains................25
+ 13. DNS Additional Record Generation..............................26
+ 14. Comparison with Alternative Service Discovery Protocols.......27
+ 15. Real Examples.................................................29
+ 16. User Interface Considerations.................................30
+ 16.1 Service Advertising User-Interface Considerations.............30
+ 16.2 Client Browsing User-Interface Considerations.................31
+ 17. IPv6 Considerations...........................................34
+ 18. Security Considerations.......................................34
+ 19. IANA Considerations...........................................34
+ 20. Acknowledgments...............................................35
+ 21. Deployment History............................................35
+ 22. Copyright Notice..............................................36
+ 23. Normative References..........................................37
+ 24. Informative References........................................37
+ 25. Authors' Addresses............................................38
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 2]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+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].
+
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 3]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+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].
+
+
+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 10th February 2007 Cheshire & Krochmal [Page 4]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+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 10th February 2007 Cheshire & Krochmal [Page 5]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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
+ 3629]. 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 specifies the DNS
+ subdomain within which the service names are registered. It may be
+ "local", meaning "link-local Multicast DNS" [mDNS], or it may be
+ a conventional unicast DNS domain name, such as "apple.com.",
+ "cs.stanford.edu.", or "eng.us.ibm.com." Because service names are
+ not host names, they are not constrained by the usual rules for host
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 6]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ names [RFC 1033][RFC 1034][RFC 1035], and rich-text service
+ subdomains are allowed and encouraged, for example:
+
+ Building 2, 1st Floor.apple.com.
+ Building 2, 2nd Floor.apple.com.
+ Building 2, 3rd Floor.apple.com.
+ Building 2, 4th Floor.apple.com.
+
+ In addition, because Service Instance Names are not constrained by
+ the limitations of host names, this document recommends that they
+ be stored in the DNS, and communicated over the wire, encoded as
+ straightforward canonical precomposed UTF-8, Unicode Normalization
+ Form C [UAX15]. In cases where the DNS server returns an NXDOMAIN
+ error for the name in question, client software MAY choose to retry
+ the query using "Punycode" [RFC 3492] encoding, if possible.
+
+
+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-
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 7]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+ 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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 8]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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 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>
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 9]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+ 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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 10]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+
+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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 11]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+
+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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 12]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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).
+
+
+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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 13]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+
+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!
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 14]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+ 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. The rule that a given attribute name may not appear more than
+ once simplifies these abstractions because they aren't required to
+ support the case of returning more than one value for a given key.
+
+ 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 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.
+
+ 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'
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 15]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+
+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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 16]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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 |
+ ---------------------------------------------------------------
+
+
+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 10th February 2007 Cheshire & Krochmal [Page 17]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+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 an underscore
+ character followed by the Application Protocol Name, and the second
+ label is either "_tcp" or "_udp".
+
+ Application Protocol Names may be no more than fourteen characters
+ (not counting the mandatory underscore), conforming to normal DNS
+ host name rules: Only lower-case letters, digits, and hyphens; must
+ begin and end with lower-case letter or digit.
+
+ Wise selection of an 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 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.
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 18]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ Another common mistake is to assume that the service type advertised
+ by iTunes should be "_daap._http._tcp." This is also incorrect.
+ Similarly, a protocol designer implementing a network service that
+ happens to use Simple Object Access Protocol [SOAP] should not feel
+ compelled to have "_soap" appear somewhere in the Application
+ Protocol Name. 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. All that is required is that the service be
+ identified by a unique Application Protocol Name. Making the
+ Application Protocol Name at least marginally descriptive of
+ what the service does is desirable, though not essential.
+
+ 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 responsibility for service discovery to a different DNS
+ server, if so desired.
+
+
+7.1. 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 hypothetical 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.
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 19]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ Subtypes are appropriate when it is desirable for different kinds
+ of clients to be able to browse for services at two levels of
+ granularity. In the example above, we hypothesize two classes of
+ ftp client: clients that can provide username and password when
+ connecting, and clients that can only do anonymous login. The set of
+ ftp servers on the network is the same in both cases; the difference
+ is that the more capable client wants to discover all of them,
+ whereas the more limited client only wants to find the subset of
+ those ftp servers that it can talk to. Subtypes are only appropriate
+ in two-level scenarios such as this one, where some clients want to
+ find the full set of services of a given type, and at the same time
+ other clients only want to find some subset. Generally speaking, if
+ there is no client that wants to find the entire set, then it's
+ neither necessary nor desirable to use the subtype mechanism. If all
+ clients are browsing for some particular subtype, and no client
+ exists that browses for the parent type, then an Application Protocol
+ Name representing the logical service should be defined, and software
+ should simply advertise and browse for that particular service type
+ directly. In particular, just because a particular network service
+ happens to be implemented in terms of some other underlying protocol,
+ like HTTP, Sun RPC, or SOAP, doesn't mean that it's sensible for that
+ service to be defined as a subtype of "_http", "_sunrpc", or "_soap".
+ That would only be useful if there were some class of client for
+ which it is sensible to say, "I want to discover a service on the
+ network, and I don't care what it does, as long as it does it using
+ the SOAP XML RPC mechanism."
+
+ 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. Note that the example given here using "_ftp" is a
+ hypothetical one. The "_ftp" service type does not (currently) have
+ any subtypes defined. Subtypes are currently a little-used feature
+ of DNS-SD, and experience will show whether or not they ultimately
+ prove to have broad applicability.
+
+
+7.2 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>.
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 20]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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 (see "Selective Instance Enumeration").
+
+ 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
+ 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.
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 21]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+8. 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 10th February 2007 Cheshire & Krochmal [Page 22]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+
+9. 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 10th February 2007 Cheshire & Krochmal [Page 23]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+10. 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]
+
+
+11. 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 10th February 2007 Cheshire & Krochmal [Page 24]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+12. 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 10th February 2007 Cheshire & Krochmal [Page 25]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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.
+
+
+13. 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.
+
+
+13.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 10th February 2007 Cheshire & Krochmal [Page 26]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+13.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.
+
+
+13.3 TXT Records
+
+ When including a TXT record in a response packet, no additional
+ records are required.
+
+
+13.4 Other Record Types
+
+ In response to address queries, or other record types, no additional
+ records are required by this document.
+
+
+14. 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 10th February 2007 Cheshire & Krochmal [Page 27]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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 10th February 2007 Cheshire & Krochmal [Page 28]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+15. Real Examples
+
+ 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.
+
+15.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.
+
+15.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.
+
+15.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 10th February 2007 Cheshire & Krochmal [Page 29]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+16. User Interface Considerations
+
+ DNS-Based Service Discovery was designed by first giving careful
+ consideration to what constitutes a good user experience for service
+ discovery, and then designing a protocol with the features necessary
+ to enable that good user experience. This section covers two issues
+ in particular: Choice of factory-default names (and automatic
+ renaming behavior) for devices advertising services, and the
+ "continuous live update" user-experience model for clients
+ browsing to discover services.
+
+
+16.1 Service Advertising User-Interface Considerations
+
+ When a DNS-SD service is advertised using Multicast DNS [mDNS],
+ automatic name conflict and resolution will occur if there is already
+ another service of the same type advertising with the same name.
+ As described in the Multicast DNS specification [mDNS], upon a
+ conflict, the service should:
+
+ 1. Automatically select a new name (typically by appending
+ or incrementing a digit at the end of the name),
+ 2. try advertising with the new name, and
+ 3. upon success, record the new name in persistent storage.
+
+ This renaming behavior is very important, because it is the key
+ to providing user-friendly service names in the out-of-the-box
+ factory-default configuration. Some product developers may not
+ have realized this, because there are some products today where
+ the factory-default name is distinctly unfriendly, containing
+ random-looking strings of characters, like the device's Ethernet
+ address in hexadecimal. This is unnecessary, and undesirable, because
+ the point of the user-visible name is that it should be friendly and
+ useful to human users. If the name is not unique on the local network
+ the protocol will rememdy this as necessary. It is ironic that many
+ of the devices with this mistake are network printers, given that
+ these same printers also simultaneously support AppleTalk-over-
+ Ethernet, with nice user-friendly default names (and automatic
+ conflict detection and renaming). Examples of good factory-default
+ names are as follows:
+
+ Brother 5070N
+ Canon W2200 [ Apologies to makers of ]
+ HP LaserJet 4600 [ DNS-SD/mDNS printers ]
+ Lexmark W840 [ not listed. Email ]
+ Okidata C5300 [ the authors and we'll ]
+ Ricoh Aficio CL7100 [ add you to the list. ]
+ Xerox Phaser 6200DX
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 30]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ To complete the case for why adding long ugly serial numbers to
+ the end of names is neither necessary nor desirable, consider
+ the cases where the user has (a) only one network printer,
+ (b) two network printers, and (c) many network printers.
+
+ (a) In the case where the user has only one network printer, a simple
+ name like (to use a vendor-neutral example) "Printer" is more
+ user-friendly than an ugly name like "Printer 0001E68C74FB".
+ Appending ugly hexadecimal goop to the end of the name to make
+ sure the name is unique is irrelevant to a user who only has one
+ printer anyway.
+
+ (b) In the case where the user gets a second network printer,
+ having it detect that the name "Printer" is already in use
+ and automatically instead name itself "Printer (2)" provides a
+ good user experience. For the users, remembering that the old
+ printer is "Printer" and the new one is "Printer (2)" is easy
+ and intuitive. Seeing two printers called "Printer 0001E68C74FB"
+ and "Printer 00306EC3FD1C" is a lot less helpful.
+
+ (c) In the case of a network with ten network printers, seeing a
+ list of ten names all of the form "Printer xxxxxxxxxxxx" has
+ effectively taken what was supposed to be a list of user-friendly
+ rich-text names (supporting mixed case, spaces, punctuation,
+ non-Roman characters and other symbols) and turned it into
+ just about the worst user-interface imaginable: a list of
+ incomprehensible random-looking strings of letters and digits.
+ In a network with a lot of printers, it would be desirable for
+ the people setting up the printers to take a moment to give each
+ one a descriptive name, but in the event they don't, presenting
+ the users with a list of sequentially-numbered printers is a much
+ more desirable default user experience than showing a list of raw
+ Ethernet addresses.
+
+
+16.2 Client Browsing User-Interface Considerations
+
+ Of particular concern in the design of DNS-SD was the dynamic nature
+ of service discovery in a changing network environment. Other service
+ discovery protocols have been designed with an implicit unstated
+ assumption that the usage model is:
+
+ (a) client calls the service discovery code
+ (b) client gets list of discovered services
+ as of a particular instant in time, and then
+ (c) client displays list for user to select from
+
+ Superficially this usage model seems reasonable, but the problem is
+ that it's too optimistic. It only considers the success case, where
+ the user successfully finds the service they're looking for. In the
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 31]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ case where the user is looking for (say) a particular printer, and
+ that printer's not turned on or not connected, the user first has
+ to attempt to remedy the problem, and then has to click a "refresh"
+ button to retry the service discovery (or, worse, dismiss the
+ browsing window entirely, and open a new one to initiate a new
+ network search attempt) to find out whether they were successful.
+ Because nothing happens instantaneously in networking, and packets
+ can be lost, necessitating some number of retransmissions, a service
+ discovery search typically takes a few seconds. A fairly typical user
+ experience model is:
+
+ (a) display an empty window,
+ (b) display some animation like a searchlight
+ sweeping back and forth for ten seconds, and then
+ (c) at the end of the ten-second search, display
+ a static list showing what was discovered.
+
+ Every time the user clicks the "refresh" button they have to endure
+ another ten-second wait, and every time the discovered list is
+ finally shown at the end of the ten-second wait, the moment it's
+ displayed on the screen it's already beginning to get stale and
+ out-of-date.
+
+ The service discovery user experience that the DNS-SD designers had
+ in mind has some rather different properties:
+
+ 1. Displaying a list of discovered services should be effectively
+ instantaneous -- i.e. typically 1/10 second, not 10 seconds.
+
+ 2. The list of discovered services should not be getting stale
+ and out-of-date from the moment it's displayed. The list
+ should be 'live' and should continue to update as new services
+ are discovered. Because of the delays, packet losses, and
+ retransmissions inherent in networking, it is to be expected
+ that sometimes, after the initial list is displayed showing
+ the majority of discovered services, a few remaining stragglers
+ may continue to trickle in during the subsequent few seconds.
+ Even after this initial stable list has been built and displayed,
+ the list should remain 'live' and should continue to update.
+ At any future time, be it minutes, hours, or even days later,
+ if a new service of the desired type is discovered, it should be
+ displayed in the list automatically, without the user having to
+ click a "refresh" button or take any other explicit action to
+ update the display.
+
+ 3. With users getting to be in the habit of leaving service discovery
+ windows open, and coming to expect to be able to rely on them
+ to show a continuous 'live' view of current network reality,
+ this creates a new requirement for us: deletion of stale services.
+ When a service discovery list shows just a static snapshot at a
+ moment in time, then the situation is simple: either a service was
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 32]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ discovered and appears in the list, or it was not, and does not.
+ However, when our list is live and updates continuously with the
+ discovery of new services, then this implies the corollary: when
+ a service goes away, it needs to *disappear* from the service
+ discovery list. Otherwise, the result would be unacceptable: the
+ service discovery list would simply grow monotonically over time,
+ and would require a periodic "refresh" (or complete dismissal and
+ recreation) to clear out old stale data.
+
+ 4. With users getting to be in the habit of leaving service discovery
+ windows open, these windows need to update not only in response
+ to services coming and going, but also in response to changes
+ in configuration and connectivity of the client machine itself.
+ For example, if a user opens a service discovery window when no
+ Ethernet cable is connected to the client machine, and the window
+ appears empty with no discovered services, then when the user
+ connects the cable the window should automatically populate with
+ discovered services without requiring any explicit user action.
+ If the user disconnects the Ethernet cable, all the services
+ discovered via that network interface should automatically
+ disappear. If the user switches from one 802.11 wireless base
+ station to another, the service discovery window should
+ automatically update to remove all the services discovered
+ via the old wireless base station, and add all the services
+ discovered via the new one.
+
+ If these requirements seem to be setting an arbitrary and
+ unreasonably high standard for service discovery, bear in mind that
+ while it may have seemed that way to some, back in the 1990s when
+ these ideas were first proposed, in the years since then Apple and
+ other companies have shipped multiple implementations of DNS-SD/mDNS
+ that meet and exceed these requirements. In the years since Apple
+ shipped Mac OS X 10.2 Jaguar with the Open Source mDNSResponder
+ daemon, this service discovery "live browsing" paradigm has been
+ adopted and implemented in a wide range of Apple and third-party
+ applications, including printer discovery, Safari discovery of
+ devices with embedded web servers (for status and configuration),
+ iTunes music sharing, iPhoto photo sharing, the iChat Bonjour buddy
+ list, SubEthaEdit multi-user document editing, etc.
+
+ With so many different applications demonstrating that the "live
+ browsing" paradigm is clearly achievable, these four requirements
+ should not be regarded as idealistic unattainable goals, but
+ instead as the bare minimum baseline functionality that any
+ credible service discovery protocol needs to achieve.
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 33]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+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
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 34]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ 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/ServiceTypes.html>. As of August 2006, there
+ are roughly 300 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. Deployment History
+
+ The first implementations of DNS-Based Service Discovery and
+ Multicast DNS were initially developed during the late 1990s,
+ but the event that put them into the media spotlight was Steve Jobs
+ demonstrating it live on stage in his keynote presentation opening
+ Apple's annual Worldwide Developers Conference in May 2002, and
+ announcing Apple's adoption of the technology throughout its hardware
+ and software product line. Three months later, in August 2002, Apple
+ shipped Mac OS X 10.2 Jaguar, and millions of end-users got their
+ first exposure to Zero Configuration Networking with DNS-SD/mDNS
+ in applications like Safari, iChat, and printer setup. A month later,
+ in September 2002, Apple released the entire source code for the
+ mDNS Responder daemon under its Darwin Open Source project, with
+ code not just for Mac OS X, but also for a range of other platforms
+ including Windows, VxWorks, Linux, Solaris, FreeBSD, etc.
+
+ Many hardware makers were quick to see the benefits of Zero
+ Configuration Networking. Printer makers especially were enthusiastic
+ early adopters, and within a year every major printer manufacturer
+ was shipping DNS-SD/mDNS-enabled network printers. If you've bought
+ any network printer at all in the last few years, it was probably one
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 35]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ that supports DNS-SD/mDNS, even if you didn't know that at the time.
+ For Mac OS X users, telling if you have DNS-SD/mDNS printers on your
+ network is easy because they automatically appear in the "Bonjour"
+ submenu in the "Print" dialog of every Mac application. Microsoft
+ Windows users can get a similar experience by installing Bonjour for
+ Windows (takes about 90 seconds, no restart required) and running the
+ Bonjour for Windows Printer Setup Wizard [B4W].
+
+ The Open Source community has produced several independent
+ implementations of DNS-Based Service Discovery and Multicast DNS,
+ some in C like Apple's mDNSResponder daemon, and others in a variety
+ of different languages including Java, Python, Perl, and C#/Mono.
+
+
+22. Copyright Notice
+
+ Copyright (C) The Internet Society (2006).
+
+ This document is subject to the rights, licenses and restrictions
+ contained in BCP 78, and except as set forth therein, the authors
+ retain all their rights. For the purposes of this document,
+ the term "BCP 78" refers exclusively to RFC 3978, "IETF Rights
+ in Contributions", published March 2005.
+
+ This document and the information contained herein are provided on an
+ "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
+ OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
+ ENGINEERING TASK FORCE DISCLAIM 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 10th February 2007 Cheshire & Krochmal [Page 36]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+23. 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 2782] Gulbrandsen, A., et al., "A DNS RR for specifying the
+ location of services (DNS SRV)", RFC 2782, February 2000.
+
+ [RFC 3629] Yergeau, F., "UTF-8, a transformation format of ISO
+ 10646", RFC 3629, November 2003.
+
+ [UAX15] "Unicode Normalization Forms"
+ http://www.unicode.org/reports/tr15/
+
+
+24. Informative References
+
+ [B4W] Bonjour for Windows <http://www.apple.com/bonjour/>
+
+ [mDNS] Cheshire, S., and M. Krochmal, "Multicast DNS",
+ Internet-Draft (work in progress),
+ draft-cheshire-dnsext-multicastdns-06.txt, August 2006.
+
+ [NBP] Cheshire, S., and M. Krochmal,
+ "Requirements for a Protocol to Replace AppleTalk NBP",
+ Internet-Draft (work in progress),
+ draft-cheshire-dnsext-nbp-05.txt, August 2006.
+
+ [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 10th February 2007 Cheshire & Krochmal [Page 37]
+
+Internet Draft DNS-Based Service Discovery 10th August 2006
+
+
+ [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.
+
+ [SOAP] Nilo Mitra, "SOAP Version 1.2 Part 0: Primer",
+ W3C Proposed Recommendation, 24 June 2003
+ http://www.w3.org/TR/2003/REC-soap12-part0-20030624
+
+ [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.
+
+
+25. Authors' Addresses
+
+ Stuart Cheshire
+ Apple Computer, Inc.
+ 1 Infinite Loop
+ Cupertino
+ California 95014
+ USA
+
+ Phone: +1 408 974 3207
+ EMail: rfc [at] stuartcheshire [dot] org
+
+
+ Marc Krochmal
+ Apple Computer, Inc.
+ 1 Infinite Loop
+ Cupertino
+ California 95014
+ USA
+
+ Phone: +1 408 974 4368
+ EMail: marc [at] apple [dot] com
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 38]
diff --git a/specs/draft-cheshire-dnsext-multicastdns-03.txt b/specs/draft-cheshire-dnsext-multicastdns-03.txt
new file mode 100644
index 0000000..f9505d9
--- /dev/null
+++ b/specs/draft-cheshire-dnsext-multicastdns-03.txt
@@ -0,0 +1,2494 @@
+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/specs/draft-cheshire-dnsext-multicastdns-04.txt b/specs/draft-cheshire-dnsext-multicastdns-04.txt
new file mode 100644
index 0000000..8750583
--- /dev/null
+++ b/specs/draft-cheshire-dnsext-multicastdns-04.txt
@@ -0,0 +1,2494 @@
+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/specs/draft-cheshire-dnsext-multicastdns-05.txt b/specs/draft-cheshire-dnsext-multicastdns-05.txt
new file mode 100644
index 0000000..0e2be99
--- /dev/null
+++ b/specs/draft-cheshire-dnsext-multicastdns-05.txt
@@ -0,0 +1,2640 @@
+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/specs/draft-cheshire-dnsext-multicastdns-06.txt b/specs/draft-cheshire-dnsext-multicastdns-06.txt
new file mode 100644
index 0000000..1dbe8b6
--- /dev/null
+++ b/specs/draft-cheshire-dnsext-multicastdns-06.txt
@@ -0,0 +1,3074 @@
+Document: draft-cheshire-dnsext-multicastdns-06.txt Stuart Cheshire
+Internet-Draft Marc Krochmal
+Category: Standards Track Apple Computer, Inc.
+Expires 10th February 2007 10th August 2006
+
+ Multicast DNS
+
+ <draft-cheshire-dnsext-multicastdns-06.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 becomes
+ aware will be disclosed, in accordance with Section 6 of BCP 79.
+ For the purposes of this document, the term "BCP 79" refers
+ exclusively to RFC 3979, "Intellectual Property Rights in IETF
+ Technology", published March 2005.
+
+ 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/1id-abstracts.html
+
+ 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 10th February 2007 Cheshire & Krochmal [Page 1]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+Table of Contents
+
+ 1. Introduction....................................................3
+ 2. Conventions and Terminology Used in this Document...............3
+ 3. Multicast DNS Names.............................................4
+ 4. Source Address Check............................................8
+ 5. Reverse Address Mapping.........................................9
+ 6. Querying.......................................................10
+ 7. Duplicate Suppression..........................................15
+ 8. Responding.....................................................17
+ 9. Probing and Announcing on Startup..............................20
+ 10. Conflict Resolution............................................26
+ 11. Resource Record TTL Values and Cache Coherency.................28
+ 12. Special Characteristics of Multicast DNS Domains...............33
+ 13. Multicast DNS for Service Discovery............................34
+ 14. Enabling and Disabling Multicast DNS...........................34
+ 15. Considerations for Multiple Interfaces.........................35
+ 16. Considerations for Multiple Responders on the Same Machine.....36
+ 17. Multicast DNS and Power Management.............................38
+ 18. Multicast DNS Character Set....................................39
+ 19. Multicast DNS Message Size.....................................41
+ 20. Multicast DNS Message Format...................................42
+ 21. Choice of UDP Port Number......................................45
+ 22. Summary of Differences Between Multicast DNS and Unicast DNS...46
+ 23. Benefits of Multicast Responses................................47
+ 24. IPv6 Considerations............................................48
+ 25. Security Considerations........................................49
+ 26. IANA Considerations............................................50
+ 27. Acknowledgments................................................50
+ 28. Deployment History.............................................50
+ 29. Copyright Notice...............................................51
+ 30. Normative References...........................................51
+ 31. Informative References.........................................52
+ 32. Authors' Addresses.............................................53
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 2]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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.
+
+
+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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 3]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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 conceptually under the control
+ or ownership of a single responder, and it is expected that at most
+ one responder should respond to a query for that name, rrtype, and
+ rrclass. 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".
+ For fault-tolerance and other reasons it is permitted sometimes to
+ have more than one responder answering for a particular "unique"
+ resource record set, but such cooperating responders MUST give
+ answers containing identical rdata for these records or the
+ answers will be perceived to be in conflict with each other.
+
+ 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.
+
+
+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).
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 4]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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 that 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
+ 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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 5]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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 burning it onto CD-R, copying it onto a USB "keychain"
+ flash drive, or similar removable media.
+
+ In a world of gigabit Ethernet and ubiquitous wireless networking it
+ is a sad indictment of the networking community that most users still
+ prefer sneakernet.
+
+ 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.
+
+ This document advocates a single flat namespace for dot-local host
+ names, (i.e. the names of DNS address records), but other DNS record
+ types (such as those used by DNS Service Discovery [DNS-SD]) may
+ contain as many labels as appropriate for the desired usage, subject
+ to the 255-byte name length limit specified below in Section 3.3
+ "Maximum Multicast DNS Name Length".
+
+ 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 10th February 2007 Cheshire & Krochmal [Page 6]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+3.1 Governing Standards Body
+
+ Note that this use of the ".local." suffix falls under IETF/IANA
+ 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.
+
+ This allocation of responsibility is formally established in
+ "Memorandum of Understanding Concerning the Technical Work of the
+ Internet Assigned Numbers Authority" [RFC 2860]. Exception (a) of
+ clause 4.3 states that the IETF has the authority to instruct IANA
+ to reserve pseudo-TLDs as required for protocol design purposes.
+ For example, "Reserved Top Level DNS Names" [RFC 2606] defines
+ the following pseudo-TLDs:
+
+ .test
+ .example
+ .invalid
+ .localhost
+
+
+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
+ .lan
+
+ Another alternative naming scheme, advocated by Professor D. J.
+ Bernstein, is to use a numerical suffix, such as ".6." [djbdl].
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 7]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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 |
+ ------------------------------------------------------
+
+
+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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 8]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ * 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.
+
+
+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.
+
+ Likewise, any DNS query for a name within the reverse mapping domains
+ for IPv6 Link-Local addresses ("8.e.f.ip6.arpa.", "9.e.f.ip6.arpa.",
+ "a.e.f.ip6.arpa.", and "b.e.f.ip6.arpa.") MUST be sent to the IPv6
+ mDNS link-local multicast address FF02::FB.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 9]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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 Multicast DNS Queries
+
+ An unsophisticated DNS client may simply send its DNS queries blindly
+ to 224.0.0.251:5353, without necessarily even being aware what a
+ multicast address is. This change can typically be implemented with
+ just a few lines of code in an existing DNS resolver library. Any
+ time the name being queried for falls within one of the reserved
+ mDNS domains (see Section 12 "Special Characteristics of Multicast
+ DNS Domains") the query is sent to 224.0.0.251:5353 instead of the
+ configured unicast DNS server address that would otherwise be used.
+ Typically the timeout would also be shortened to two or three
+ seconds, but it's possible to make a minimal mDNS client with no
+ other changes apart from these.
+
+ A simple DNS client like this will typically just take the first
+ response it receives. It will not listen for additional UDP
+ responses, 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.
+
+ While an unsophisticated DNS client like this is perfectly adequate
+ for simple hostname lookup, it may not get ideal behavior in
+ other cases. Additional refinements that may be adopted by more
+ sophisticated clients are described below.
+
+
+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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 10]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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
+ "Known Answer Suppression". 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, when retransmitting queries, the interval between the first
+ two queries SHOULD be one second, and the intervals between
+ subsequent queries SHOULD double.
+
+
+6.3 Continuous Multicast DNS 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.
+
+ iTunes users are accustomed to seeing a list of shared network music
+ libraries in the sidebar of the iTunes window. There is no "refresh"
+ button for the user to click because the list is always accurate,
+ always reflecting the currently available libraries. When a new
+ library becomes available it promptly appears in the list, and when
+ a library becomes unavailable it promptly disappears. It is vitally
+ important that this responsive user interface be achieved without
+ naive polling that would place an unreasonable burden on the network.
+
+ Therefore, when retransmitting mDNS queries to implement this kind
+ of continuous monitoring, the interval between the first two queries
+ SHOULD be one second, the intervals between the 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. To avoid accidental
+ synchronization when for some reason multiple clients begin querying
+ at exactly the same moment (e.g. because of some common external
+ trigger event), a Multicast DNS Querier SHOULD also delay the first
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 11]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ query of the series by a randomly-chosen amount in the range
+ 20-120ms.
+
+ 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 which has clients with an active interest in
+ the state of that record (e.g. a network browsing window displaying
+ a list of discovered services to the user) SHOULD re-issue its query
+ to determine whether the record is still valid.
+
+ 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. A Multicast DNS Querier MUST
+ NOT perform this cache maintenance for records for which it has no
+ clients with an active interest. If the expiry of a particular record
+ from the cache would result in no net effect to any client software
+ running on the Querier device, and no visible effect to the human
+ user, then there is no reason for the Multicast DNS Querier to
+ waste network bandwidth checking whether the record remains valid.
+
+ 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 10th February 2007 Cheshire & Krochmal [Page 12]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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. Some examples are a laptop
+ computer waking from sleep, or the Ethernet cable being connected to
+ a running machine, or a previously inactive interface being activated
+ through a configuration change. At the instant of wake-up or link
+ activation, the machine is a brand new participant on a new network.
+ Its Multicast DNS cache for that interface is empty, and it has no
+ knowledge of its peers on that link. It may have a significant number
+ of questions 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, triggering a large sudden flood of
+ multicast responses may impose an unreasonable burden on the network.
+
+ To avoid large floods of potentially unnecessary responses in these
+ cases, Multicast DNS defines the top bit in the class field of a DNS
+ question as the "unicast response" bit. When this bit is set in a
+ question, it indicates that the Querier 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). A Multicast DNS Querier sending its
+ initial batch of questions immediately on wake from sleep or
+ interface activation SHOULD set the "QU" bit in those questions.
+
+ When a question is retransmitted (as described in Section 6.3
+ "Continuous Multicast DNS Querying") the "QU" bit SHOULD NOT be set
+ in subsequent retransmissions of that question. Subsequent
+ retransmissions SHOULD be usual "QM" questions. 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). In addition, the "QU" bit
+ SHOULD be set only for questions that are active and ready to be sent
+ the moment of wake from sleep or interface activation. New questions
+ issued by clients afterwards should be treated as normal "QM"
+ questions and SHOULD NOT have the "QU" bit set on the first question
+ of the series.
+
+ 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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 13]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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. In the case of
+ answering a probe question with the "unicast response" bit set, the
+ responder should always generate the requested unicast response, but
+ may also send a multicast announcement too if the time since the last
+ multicast announcement of that record is more than a quarter of its
+ TTL.
+
+ Except when defending a unique name against a probe from another host
+ 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").
+
+
+6.6 Delaying 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 delay its initial query by imposing a random
+ delay from 500-1000ms. This is to avoid the situation where a group
+ of hosts are synchronized by some external event and all perform
+ the same query simultaneously. This means that when the first host
+ (selected randomly by this algorithm) transmits its query, all the
+ other hosts that were about to transmit the same query can suppress
+ their superfluous queries, as described in "Duplicate Question
+ Suppression" below.
+
+
+6.7 Direct Unicast Queries to port 5353
+
+ In specialized applications there may be rare situations where it
+ makes sense for a Multicast DNS Querier to send its query via unicast
+ to a specific machine. When a Multicast DNS Responder receives a
+ query via direct unicast, it SHOULD respond as it would for a
+ "QU" query, as described above in Section 6.5 "Questions Requesting
+ Unicast Responses". Since it is possible for a unicast query to be
+ received from a machine outside the local link, Responders SHOULD
+ check that the source address in the query packet matches the local
+ subnet for that link, and silently ignore the packet if not.
+
+ There may be specialized situations, outside the scope of this
+ document, where it is intended and desirable to create a Responder
+ that does answer queries originating outside the local link. Such
+ a Responder would need to ensure that these non-local queries are
+ always answered via unicast back to the Querier, since an answer sent
+ via link-local multicast would not reach a Querier outside the local
+ link.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 14]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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 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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 15]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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.
+
+ If the Responder receives additional Known Answer packets with the TC
+ bit set, it SHOULD extend the delay as necessary to ensure a pause of
+ 400-500ms after the last such packet before it sends its answer. This
+ opens the potential risk that a continuous stream of Known Answer
+ packets could, theoretically, prevent a Responder from answering
+ indefinitely. In practice answers are never actually delayed
+ significantly, and should a situation arise where significant delays
+ did happen, that would be a scenario where the network is so
+ overloaded that it would be desirable to err on the side of caution.
+ The consequence of delaying an answer may be that it takes a user
+ longer than usual to discover all the services on the local network;
+ in contrast the consequence of incorrectly answering before all the
+ Known Answer packets have been received would be wasting bandwidth
+ sending unnecessary answers on an already overloaded network. In this
+ (rare) situation, sacrificing speed to preserve reliable network
+ operation is the right trade-off.
+
+
+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 17, "Multicast DNS and Power Management").
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 16]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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 a large number of 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 time window of 25.6us. On higher-speed variants of
+ Ethernet, the vulnerable time window is shorter.
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 17]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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 (i.e. because it is able to answer every
+ question in the query packet, and for all of those answer records it
+ has previously verified that the name, rrtype and rrclass are unique
+ on the link) 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 with the
+ "unicast response" bit set. 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").
+
+ Responding immediately without delay is appropriate for records like
+ 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.
+ The reason for requiring that the delay be at least 20ms is to
+ accommodate the situation where two or more query packets are sent
+ back-to-back, because in that case we want a Responder with answers
+ to more than one of those queries to have the opportunity to
+ aggregate all of its answers into a single response packet.
+
+ 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,
+ as described in Section 7.2 "Multi-Packet Known Answer Suppression".
+
+ Except when a unicast response has been explicitly requested via the
+ "unicast response" 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 10th February 2007 Cheshire & Krochmal [Page 18]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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
+ (except in the one special case of answering probe queries) multicast
+ a record on a given interface until at least one second has elapsed
+ since the last time that record was multicast on that particular
+ interface. 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. In the special case of answering probe
+ queries, because of the limited time before the probing host will
+ make its decision about whether or not to use the name, a Multicast
+ DNS Responder MUST respond quickly. In this special case only, when
+ responding via multicast to a probe, a Multicast DNS Responder is
+ only required to delay its transmission as necessary to ensure an
+ interval of at least 250ms since the last time the record was
+ multicast on that interface.
+
+
+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.)
+
+
+8.2 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.
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 19]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+8.3 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 11 "Resource Record TTL
+ Values and Cache Coherency" 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".
+
+ Note that while legacy queries usually contain exactly one question,
+ they are permitted to contain multiple questions, and responders
+ listening for multicast queries on 224.0.0.251:5353 MUST be prepared
+ to handle this correctly, responding by generating a unicast response
+ containing the list of question(s) they are answering in the Question
+ Section, and the records answering those question(s) in the Answer
+ Section.
+
+
+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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 20]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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
+ 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.)
+
+ When sending probe queries, a host MUST NOT consult its cache for
+ potential answers. Only conflicting Multicast DNS responses received
+ "live" from the network are considered valid for the purposes of
+ determining whether probing has succeeded or failed.
+
+ In order to allow services to announce their presence without
+ unreasonable delay, the time window for probing is intentionally set
+ quite short. As a result of this, from the time the first probe
+ packet is sent, another device on the network using that name has
+ just 750ms to respond to defend its name. On networks that are slow,
+ or busy, or both, it is possible for round-trip latency to account
+ for a few hundred milliseconds, and software delays in slow devices
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 21]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ can add additional delay. For this reason, it is important that when
+ a device receives a probe query for a name that it is currently using
+ for unique records, it SHOULD generate its response to defend that
+ name immediately and send it as quickly as possible. The usual rules
+ about random delays before responding, to avoid sudden bursts of
+ simultaneous answers from different hosts, do not apply here since
+ at most one host should ever respond to a given probe question. Even
+ when a single DNS query packet contains multiple probe questions,
+ it would be unusual for that packet to elicit a defensive response
+ from more than one other host. Because of the mDNS multicast rate
+ limiting rules, the first two probes SHOULD be sent as "QU" questions
+ with the "unicast response" bit set, to allow a defending host to
+ respond immediately via unicast, instead of potentially having to
+ wait before replying via multicast. At the present time, this
+ document recommends that the third probe SHOULD be sent as a standard
+ "QM" question, for backwards compatibility with the small number of
+ old devices still in use that don't implement unicast responses.
+
+ If, at any time during probing, from the beginning of the initial
+ random 0-250ms delay onward, 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 before
+ trying again.
+
+ 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.
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 22]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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 Query packets's Authority Section with the record or
+ records with 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 way it is used as the "Update Section" in a DNS
+ Update packet [RFC 2136].
+
+ When a host is probing for a group of related records with the same
+ name (e.g. the SRV and TXT record describing a DNS-SD service), only
+ a single question need be placed in the Question Section, since query
+ type T_ANY (255) is used, which will elicit answers for all records
+ with that name. However, for tie-breaking to work correctly in all
+ cases, the Authority Section must contain *all* the records and
+ proposed rdata being probed for uniqueness.
+
+ 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(s) there which answers the
+ query, then it compares the data of that (those) resource record(s)
+ with its own tentative data. We consider first the simple case of a
+ host probing for a single record, receiving a simultaneous probe from
+ another host also probing for a single record. The two records are
+ compared and 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.)
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 23]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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 in the range 0-255, or the wrong outcome may result. In
+ the example above, if the byte with value 200 had been incorrectly
+ interpreted as a signed eight-bit value then it would be interpreted
+ as value -56, and the wrong address record would be deemed the
+ winner.
+
+
+9.2.1 Simultaneous Probe Tie-Breaking for Multiple Records
+
+ When a host is probing for a set of records with the same name, or a
+ packet is received containing multiple tie-breaker records answering
+ a given probe question in the Question Section, the host's records
+ and the tie-breaker records from the packet are each sorted into
+ order, and then compared pairwise, using the same comparison
+ technique described above, until a difference is found.
+
+ The records are sorted using the same lexicographical order as
+ described above, that is: if the record classes differ, the record
+ with the lower class number comes first. If the classes are the same
+ but the rrtypes differ, the record with the lower rrtype number comes
+ first. If the class and rrtype match, then the rdata is compared
+ bytewise until a difference is found. For example, in the common case
+ of advertising DNS-SD services with a TXT record and an SRV record,
+ the TXT record comes first (the rrtype for TXT is 16) and the SRV
+ record comes second (the rrtype for SRV is 33).
+
+ When comparing the records, if the first records match perfectly,
+ then the second records are compared, and so on. If either list of
+ records runs out of records before any difference is found, then the
+ list with records remaining is deemed to have won the tie-break. If
+ both lists run out of records at the same time without any difference
+ being found, then this indicates that two devices are advertising
+ identical sets of records, as is sometimes done for fault tolerance,
+ and there is in fact no conflict.
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 24]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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
+ 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 eight
+ gratuitous Responses, provided that the interval between gratuitous
+ responses doubles with every response sent.
+
+ 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. It is not
+ uncommon for protocol designers to encounter some problem which they
+ decide to solve using regular periodic announcements, but this is
+ generally not a wise protocol design choice. In the small scale
+ periodic announcements may seem to remedy the short-term problem,
+ but they do not scale well if the protocol becomes successful.
+ If every host on the network implements the protocol -- if multiple
+ applications on every host on the network are implementing the
+ protocol -- then even a low periodic rate of just one announcement
+ per minute per application per host can add up to multiple packets
+ per second in total. While gigabit Ethernet may be able to carry
+ a million packets per second, other network technologies cannot.
+ For example, while IEEE 802.11g wireless has a nominal data rate of
+ up to 54Mb/sec, multicasting just 100 packets per second can consume
+ the entire available bandwidth, leaving nothing for anything else.
+
+ With the increasing popularity of hand-held devices, unnecessary
+ continuous packet transmission can have bad implications for battery
+ life. It's worth pointing out the precedent that TCP was also
+ designed with this "no regular periodic idle packets" philosophy.
+ Standard TCP sends packets only when it has data to send or
+ acknowledge. If neither client nor server sends any bytes, then the
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 25]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ TCP code will send no packets, and a TCP connection can remain active
+ in this state indefinitely, with no packets being exchanged for
+ hours, days, weeks or months.
+
+ 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.
+
+ 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 a Multicast DNS
+ response packet containing a 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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 26]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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.
+
+ 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].
+
+ o If after one minute of probing the Multicast DNS Responder has been
+ unable to find any unused name, it should display a message to the
+ user or operator informing them of this fact. This situation should
+ never occur in normal operation. The only situations that would
+ cause this to happen would be either a deliberate denial-of-service
+ attack, or some kind of very obscure hardware or software bug that
+ acts like a deliberate denial-of-service attack.
+
+ 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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 27]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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.
+
+
+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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 28]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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
+ cooperating Responders one second to send out their own response to
+ "rescue" the records before they expire and are deleted.
+
+
+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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 29]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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
+ 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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 30]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ Section 9.3 "Announcing", 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
+ 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.
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 31]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+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.
+
+ 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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 32]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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." or
+ "254.169.in-addr.arpa." have only local significance. The same is
+ true of names within the IPv6 Link-Local reverse mapping domains.
+
+ Conventional Unicast 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. In contrast, each IP link has its own private ".local.",
+ "254.169.in-addr.arpa." and IPv6 Link-Local reverse mapping
+ namespaces, and the answer to any query for a name within those
+ domains depends on where that query is asked. (This characteristic is
+ not unique to Multicast DNS. Although the original concept of DNS was
+ a single global namespace, in recent years split views, firewalls,
+ intranets, and the like have increasingly meant that the answer to a
+ given DNS query has become dependent on the location of the querier.)
+
+ 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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 33]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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.
+
+
+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.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 34]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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.
+
+ 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
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 35]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ link-local Multicast DNS query, and to discover on what interface a
+ Multicast DNS response was received.
+
+ There is one other special precaution that multi-homed hosts need to
+ take. It's common with today's laptop computers to have an Ethernet
+ connection and an 802.11 wireless connection active at the same time.
+ What the software on the laptop computer can't easily tell is whether
+ the wireless connection is in fact bridged onto the same network
+ segment as its Ethernet connection. If the two networks are bridged
+ together, then packets the host sends on one interface will arrive on
+ the other interface a few milliseconds later, and care must be taken
+ to ensure that this bridging does not cause problems:
+
+ When the host announces its host name (i.e. its address records) on
+ its wireless interface, those announcement records are sent with the
+ cache-flush bit set, so when they arrive on the Ethernet segment,
+ they will cause all the peers on the Ethernet to flush the host's
+ Ethernet address records from their caches. The mDNS protocol has a
+ safeguard to protect against this situation: when records are
+ received with the cache-flush bit set, other records are not deleted
+ from peer caches immediately, but are marked for deletion in one
+ second. When the host sees its own wireless address records arrive on
+ its Ethernet interface, with the cache-flush bit set, this one-second
+ grace period gives the host time to respond and re-announce its
+ Ethernet address records, to reinstate those records in peer caches
+ before they are deleted.
+
+ As described, this solves one problem, but creates another, because
+ when those Ethernet announcement records arrive back on the wireless
+ interface, the host would again respond defensively to reinstate its
+ wireless records, and this process would continue forever,
+ continuously flooding the network with traffic. The mDNS protocol has
+ a second safeguard, to solve this problem: the cache-flush bit does
+ not apply to records received very recently, within the last second.
+ This means that when the host sees its own Ethernet address records
+ arrive on its wireless interface, with the cache-flush bit set, it
+ knows there's no need to re-announce its wireless address records
+ again because it already sent them less than a second ago, and this
+ makes them immune from deletion from peer caches.
+
+16. Considerations for Multiple Responders on the Same Machine
+
+ It is possible to have more than one Multicast DNS Responder and/or
+ Querier implementation coexist on the same machine, but there are
+ some known issues.
+
+16.1 Receiving Unicast Responses
+
+ In most operating systems, incoming multicast packets can be
+ delivered to *all* open sockets bound to the right port number,
+ provided that the clients take the appropriate steps to allow this.
+ For this reason, all Multicast DNS implementations SHOULD use the
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 36]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ SO_REUSEPORT and/or SO_REUSEADDR options (or equivalent as
+ appropriate for the operating system in question) so they will all be
+ able to bind to UDP port 5353 and receive incoming multicast packets
+ addressed to that port. However, incoming unicast UDP packets are
+ typically delivered only to the first socket to bind to that port.
+ This means that "QU" responses and other packets sent via unicast
+ will be received only by the first Multicast DNS Responder and/or
+ Querier on a system. This limitation can be partially mitigated if
+ Multicast DNS implementations detect when they are not the first
+ to bind to port 5353, and in that case they do not request "QU"
+ responses. One way to detect if there is another Multicast DNS
+ implementation already running is to attempt binding to port 5353
+ without using SO_REUSEPORT and/or SO_REUSEADDR, and if that fails
+ it indicates that some other socket is already bound to this port.
+
+
+16.2 Multi-Packet Known-Answer lists
+
+ When a Multicast DNS Querier issues a query with too many known
+ answers to fit into a single packet, it divides the known answer list
+ into two or more packets. Multicast DNS Responders associate the
+ initial truncated query with its continuation packets by examining
+ the source IP address in each packet. Since two independent Multicast
+ DNS Queriers running on the same machine will be sending packets with
+ the same source IP address, from an outside perspective they appear
+ to be a single entity. If both Queriers happened to send the same
+ multi-packet query at the same time, with different known answer
+ lists, then they could each end up suppressing answers that the other
+ needs.
+
+
+16.3 Efficiency
+
+ If different clients on a machine were to each have their own
+ separate independent Multicast DNS implementation, they would lose
+ certain efficiency benefits. Apart from the unnecessary code
+ duplication, memory usage, and CPU load, the clients wouldn't get the
+ benefit of a shared system-wide cache, and they would not be able to
+ aggregate separate queries into single packets to reduce network
+ traffic.
+
+
+16.4 Recommendation
+
+ Because of these issues, this document encourages implementers
+ to design systems with a single Multicast DNS implementation that
+ provides Multicast DNS services shared by all clients on that
+ machine. Due to engineering constraints, there may be situations
+ where embedding a Multicast DNS implementation in the client is the
+ most expedient solution, and while this will work in practice,
+ implementers should be aware of the issues outlined in this section.
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 37]
+
+Internet Draft Multicast DNS 10th August 2006
+
+17. 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.
+
+ 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].
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 38]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+18. 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) [UAX15]: 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").
+
+ Some users of 16-bit Unicode have taken to stuffing a "zero-width
+ non-breaking space" character (U+FEFF) at the start of each UTF-16
+ file, as a hint to identify whether the data is big-endian or
+ little-endian, and calling it a "Byte Order Mark" (BOM). Since there
+ is only one possible byte order for UTF-8 data, a BOM is neither
+ necessary nor permitted. Multicast DNS names MUST NOT contain a "Byte
+ Order Mark". Any occurrence of the Unicode character U+FEFF at the
+ start or anywhere else in a Multicast DNS name MUST be interpreted as
+ being an actual intended part of the name, representing (just as for
+ any other legal unicode value) an actual literal instance of that
+ character (in this case a zero-width non-breaking space character).
+
+ 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).
+
+ 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
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 39]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ 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.
+ 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 10th February 2007 Cheshire & Krochmal [Page 40]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+19. 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) [RFC 1035]. 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.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 41]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+20. Multicast DNS Message Format
+
+ This section describes specific restrictions on the allowable
+ values for the header fields of a Multicast DNS message.
+
+
+20.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.
+
+ 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.
+
+
+20.2 QR (Query/Response) Bit
+
+ In query messages, MUST be zero.
+ In response messages, MUST be one.
+
+
+20.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).
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 42]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+20.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.
+
+
+20.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.
+
+
+20.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.
+
+
+20.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.
+
+
+20.8 Z (Zero) Bit
+
+ In both query and response messages, the Zero bit MUST be zero on
+ transmission, and MUST be ignored on reception.
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 43]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+20.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.
+
+
+20.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.
+
+
+20.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.
+
+
+20.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.
+
+
+20.13 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).
+
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 44]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+21. 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.
+
+
+21.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.
+
+
+21.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 10th February 2007 Cheshire & Krochmal [Page 45]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+22. 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 46]
+
+Internet Draft Multicast DNS 10th August 2006
+
+23. Benefits of Multicast Responses
+
+ Some people have argued that sending responses via multicast is
+ inefficient on the network. In fact using multicast responses results
+ in a net lowering of overall multicast traffic, for a variety of
+ reasons, in addition to other benefits.
+
+ * 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 corres-
+ ponding 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, 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.
+
+ * Link-local multicast transcends virtually every conceivable network
+ misconfiguration. Even if you have a collection of devices where
+ every device's IP address, subnet mask, default gateway, and DNS
+ server address are all wrong, packets sent by any of those devices
+ addressed to a link-local multicast destination address will still
+ be delivered to all peers on the local link. 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
+ is unable to communicate on the local network.
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 47]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+24. 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".
+
+
+24.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 10th February 2007 Cheshire & Krochmal [Page 48]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+25. 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)
+ host name containing two or more labels. Appending ".local." to
+ single-label relative host names is acceptable, since the user
+ should have no expectation that a single-label host name will
+ resolve as-is.
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 49]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+26. 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
+ 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.
+
+
+27. 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.
+
+
+28. Deployment History
+
+ Multicast DNS client software first became available to the public
+ in Mac OS 9 in 2001. Multicast DNS Responder software first began
+ shipping to end users in large volumes (i.e. millions) with the
+ launch of Mac OS X 10.2 Jaguar in August 2002, and became available
+ for Microsoft Windows users with the launch of Apple's "Rendezvous
+ for Windows" (now "Bonjour for Windows") in June 2004.
+
+ Apple released the source code for the mDNSResponder daemon as Open
+ Source in September 2002, first under Apple's standard Apple Public
+ Source License, and then later, in August 2006, under the Apache
+ License, Version 2.0.
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 50]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+ In addition to desktop and laptop computers running Mac OS X and
+ Microsoft Windows, Multicast DNS is implemented in a wide range of
+ hardware devices, such as Apple's "AirPort Extreme" and "AirPort
+ Express" wireless base stations, home gateways from other vendors,
+ network printers, network cameras, TiVo DVRs, etc.
+
+ The Open Source community has produced many independent
+ implementations of Multicast DNS, some in C like Apple's
+ mDNSResponder daemon, and others in a variety of different languages
+ including Java, Python, Perl, and C#/Mono.
+
+
+29. Copyright Notice
+
+ Copyright (C) The Internet Society (2006).
+
+ This document is subject to the rights, licenses and restrictions
+ contained in BCP 78, and except as set forth therein, the authors
+ retain all their rights. For the purposes of this document,
+ the term "BCP 78" refers exclusively to RFC 3978, "IETF Rights
+ in Contributions", published March 2005.
+
+ This document and the information contained herein are provided on an
+ "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
+ OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
+ ENGINEERING TASK FORCE DISCLAIM 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.
+
+
+30. 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 3629] Yergeau, F., "UTF-8, a transformation format of ISO
+ 10646", RFC 3629, November 2003.
+
+ [UAX15] "Unicode Normalization Forms"
+ http://www.unicode.org/reports/tr15/
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 51]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+31. 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-04.txt, August 2006.
+
+ [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-05.txt, August 2006.
+
+ [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 2606] Eastlake, D., and A. Panitz, "Reserved Top Level DNS
+ Names", RFC 2606, June 1999.
+
+ [RFC 2860] Carpenter, B., Baker, F. and M. Roberts, "Memorandum
+ of Understanding Concerning the Technical Work of the
+ Internet Assigned Numbers Authority", RFC 2860, June
+ 2000.
+
+ [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 10th February 2007 Cheshire & Krochmal [Page 52]
+
+Internet Draft Multicast DNS 10th August 2006
+
+
+32. Authors' Addresses
+
+ Stuart Cheshire
+ Apple Computer, Inc.
+ 1 Infinite Loop
+ Cupertino
+ California 95014
+ USA
+
+ Phone: +1 408 974 3207
+ EMail: rfc [at] stuartcheshire [dot] org
+
+
+ Marc Krochmal
+ Apple Computer, Inc.
+ 1 Infinite Loop
+ Cupertino
+ California 95014
+ USA
+
+ Phone: +1 408 974 4368
+ EMail: marc [at] apple [dot] com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Expires 10th February 2007 Cheshire & Krochmal [Page 53]
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..6c1b075
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,8 @@
+*.o
+*.lo
+*.la
+Makefile
+Makefile.in
+.deps
+.libs
+c-plus-plus-test
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..e28b0b7
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,53 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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/tests/c-plus-plus-test-gen.py b/tests/c-plus-plus-test-gen.py
new file mode 100755
index 0000000..a2836f0
--- /dev/null
+++ b/tests/c-plus-plus-test-gen.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it 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 """/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/tests/c-plus-plus-test.cc b/tests/c-plus-plus-test.cc
new file mode 100644
index 0000000..ad7a529
--- /dev/null
+++ b/tests/c-plus-plus-test.cc
@@ -0,0 +1,82 @@
+/***
+ This file is part of avahi.
+
+ avahi is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
+
+ avahi is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+ Public License for more details.
+
+ You should have received a copy of the GNU Lesser General 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/tests/fuzz-mdns.py b/tests/fuzz-mdns.py
new file mode 100755
index 0000000..aeea295
--- /dev/null
+++ b/tests/fuzz-mdns.py
@@ -0,0 +1,8 @@
+#!/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")
+
+