summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am103
-rwxr-xr-xautogen.sh38
-rw-r--r--avahi-autoipd/Makefile.am12
-rwxr-xr-xavahi-autoipd/avahi-autoipd.action.bsd2
-rwxr-xr-xavahi-autoipd/avahi-autoipd.action.linux23
-rwxr-xr-xavahi-autoipd/dhclient-enter-hook.in2
-rwxr-xr-xavahi-autoipd/dhclient-exit-hook.in6
-rw-r--r--avahi-autoipd/iface-linux.c66
-rw-r--r--avahi-autoipd/iface.h8
-rw-r--r--avahi-autoipd/main.c113
-rw-r--r--avahi-autoipd/main.h8
-rw-r--r--avahi-client/Makefile.am22
-rw-r--r--avahi-client/browser.c108
-rw-r--r--avahi-client/check-nss-test.c8
-rw-r--r--avahi-client/check-nss.c16
-rw-r--r--avahi-client/client-test.c50
-rw-r--r--avahi-client/client.c3
-rw-r--r--avahi-client/client.h12
-rw-r--r--avahi-client/entrygroup.c140
-rw-r--r--avahi-client/internal.h14
-rw-r--r--avahi-client/lookup.h12
-rw-r--r--avahi-client/publish.h22
-rw-r--r--avahi-client/resolver.c114
-rw-r--r--avahi-client/rr-test.c22
-rw-r--r--avahi-client/srv-test.c14
-rw-r--r--avahi-client/xdg-config-test.c10
-rw-r--r--avahi-client/xdg-config.c2
-rw-r--r--avahi-client/xdg-config.h8
-rw-r--r--avahi-common/Makefile.am4
-rw-r--r--avahi-common/address.c2
-rw-r--r--avahi-common/address.h8
-rw-r--r--avahi-common/alternative-test.c18
-rw-r--r--avahi-common/alternative.c36
-rw-r--r--avahi-common/alternative.h8
-rw-r--r--avahi-common/cdecl.h8
-rw-r--r--avahi-common/dbus-watch-glue.c46
-rw-r--r--avahi-common/dbus-watch-glue.h8
-rw-r--r--avahi-common/dbus.c18
-rw-r--r--avahi-common/dbus.h8
-rw-r--r--avahi-common/defs.h12
-rw-r--r--avahi-common/domain-test.c20
-rw-r--r--avahi-common/domain.c114
-rw-r--r--avahi-common/domain.h8
-rw-r--r--avahi-common/error.c2
-rw-r--r--avahi-common/error.h18
-rw-r--r--avahi-common/gccmacro.h8
-rw-r--r--avahi-common/i18n.c2
-rw-r--r--avahi-common/i18n.h2
-rw-r--r--avahi-common/llist.h8
-rw-r--r--avahi-common/malloc.c28
-rw-r--r--avahi-common/malloc.h8
-rw-r--r--avahi-common/rlist.c12
-rw-r--r--avahi-common/rlist.h8
-rw-r--r--avahi-common/simple-watch.c108
-rw-r--r--avahi-common/simple-watch.h8
-rw-r--r--avahi-common/strlst-test.c30
-rw-r--r--avahi-common/strlst.c74
-rw-r--r--avahi-common/strlst.h8
-rw-r--r--avahi-common/thread-watch.c2
-rw-r--r--avahi-common/thread-watch.h8
-rw-r--r--avahi-common/timeval-test.c10
-rw-r--r--avahi-common/timeval.c20
-rw-r--r--avahi-common/timeval.h8
-rw-r--r--avahi-common/utf8-test.c10
-rw-r--r--avahi-common/utf8.c20
-rw-r--r--avahi-common/utf8.h8
-rw-r--r--avahi-common/watch-test.c16
-rw-r--r--avahi-common/watch.h12
-rw-r--r--avahi-compat-howl/Makefile.am6
-rw-r--r--avahi-compat-howl/address-test.c12
-rw-r--r--avahi-compat-howl/address.c28
-rw-r--r--avahi-compat-howl/browse-domain-test.c16
-rw-r--r--avahi-compat-howl/compat.c210
-rw-r--r--avahi-compat-howl/funcs.txt2
-rw-r--r--avahi-compat-howl/include/corby/buffer.h40
-rw-r--r--avahi-compat-howl/include/corby/channel.h6
-rw-r--r--avahi-compat-howl/include/corby/corby.h6
-rw-r--r--avahi-compat-howl/include/corby/message.h4
-rw-r--r--avahi-compat-howl/include/corby/object.h4
-rw-r--r--avahi-compat-howl/include/corby/orb.h8
-rw-r--r--avahi-compat-howl/include/discovery/discovery.h18
-rw-r--r--avahi-compat-howl/include/discovery/text_record.h2
-rw-r--r--avahi-compat-howl/include/howl.h2
-rw-r--r--avahi-compat-howl/include/rendezvous/rendezvous.h2
-rw-r--r--avahi-compat-howl/include/rendezvous/text_record.h2
-rw-r--r--avahi-compat-howl/include/salt/address.h4
-rw-r--r--avahi-compat-howl/include/salt/debug.h4
-rw-r--r--avahi-compat-howl/include/salt/interface.h2
-rw-r--r--avahi-compat-howl/include/salt/platform.h14
-rw-r--r--avahi-compat-howl/include/salt/salt.h24
-rw-r--r--avahi-compat-howl/include/salt/signal.h6
-rw-r--r--avahi-compat-howl/include/salt/socket.h54
-rw-r--r--avahi-compat-howl/include/salt/time.h6
-rw-r--r--avahi-compat-howl/samples/Makefile.am2
-rw-r--r--avahi-compat-howl/samples/browse.c4
-rw-r--r--avahi-compat-howl/samples/publish.c2
-rw-r--r--avahi-compat-howl/samples/query.c4
-rw-r--r--avahi-compat-howl/samples/resolve.c4
-rw-r--r--avahi-compat-howl/text-test.c16
-rw-r--r--avahi-compat-howl/text.c46
-rw-r--r--avahi-compat-howl/unsupported.c42
-rw-r--r--avahi-compat-howl/warn.c8
-rw-r--r--avahi-compat-howl/warn.h8
-rw-r--r--avahi-compat-libdns_sd/Makefile.am6
-rw-r--r--avahi-compat-libdns_sd/compat.c186
-rw-r--r--avahi-compat-libdns_sd/dns_sd.h66
-rw-r--r--avahi-compat-libdns_sd/funcs.txt2
-rw-r--r--avahi-compat-libdns_sd/null-test.c8
-rw-r--r--avahi-compat-libdns_sd/txt-test.c20
-rw-r--r--avahi-compat-libdns_sd/txt.c58
-rw-r--r--avahi-compat-libdns_sd/unsupported.c20
-rw-r--r--avahi-compat-libdns_sd/warn.c26
-rw-r--r--avahi-compat-libdns_sd/warn.h8
-rw-r--r--avahi-core/Makefile.am5
-rw-r--r--avahi-core/addr-util.c27
-rw-r--r--avahi-core/addr-util.h12
-rw-r--r--avahi-core/announce.c108
-rw-r--r--avahi-core/announce.h8
-rw-r--r--avahi-core/avahi-reflector.c12
-rw-r--r--avahi-core/avahi-test.c42
-rw-r--r--avahi-core/browse-dns-server.c66
-rw-r--r--avahi-core/browse-domain.c60
-rw-r--r--avahi-core/browse-service-type.c30
-rw-r--r--avahi-core/browse-service.c32
-rw-r--r--avahi-core/browse.c100
-rw-r--r--avahi-core/browse.h10
-rw-r--r--avahi-core/cache.c102
-rw-r--r--avahi-core/cache.h16
-rw-r--r--avahi-core/conformance-test.c28
-rw-r--r--avahi-core/core.h9
-rw-r--r--avahi-core/dns-spin-test.c8
-rw-r--r--avahi-core/dns-srv-rr.h10
-rw-r--r--avahi-core/dns-test.c16
-rw-r--r--avahi-core/dns.c170
-rw-r--r--avahi-core/dns.h8
-rw-r--r--avahi-core/domain-util.c28
-rw-r--r--avahi-core/domain-util.h10
-rw-r--r--avahi-core/entry.c204
-rw-r--r--avahi-core/fdutil.c18
-rw-r--r--avahi-core/fdutil.h8
-rw-r--r--avahi-core/hashmap-test.c12
-rw-r--r--avahi-core/hashmap.c38
-rw-r--r--avahi-core/hashmap.h8
-rw-r--r--avahi-core/iface-linux.c44
-rw-r--r--avahi-core/iface-linux.h12
-rw-r--r--avahi-core/iface-pfroute.c64
-rw-r--r--avahi-core/iface-pfroute.h8
-rw-r--r--avahi-core/iface.c2
-rw-r--r--avahi-core/iface.h18
-rw-r--r--avahi-core/internal.h30
-rw-r--r--avahi-core/log.c12
-rw-r--r--avahi-core/log.h8
-rw-r--r--avahi-core/lookup.h12
-rw-r--r--avahi-core/multicast-lookup.c56
-rw-r--r--avahi-core/multicast-lookup.h8
-rw-r--r--avahi-core/netlink.c28
-rw-r--r--avahi-core/netlink.h8
-rw-r--r--avahi-core/prioq-test.c18
-rw-r--r--avahi-core/prioq.c52
-rw-r--r--avahi-core/prioq.h8
-rw-r--r--avahi-core/probe-sched.c64
-rw-r--r--avahi-core/probe-sched.h8
-rw-r--r--avahi-core/publish.h24
-rw-r--r--avahi-core/querier-test.c22
-rw-r--r--avahi-core/querier.c46
-rw-r--r--avahi-core/querier.h8
-rw-r--r--avahi-core/query-sched.c70
-rw-r--r--avahi-core/query-sched.h8
-rw-r--r--avahi-core/resolve-address.c50
-rw-r--r--avahi-core/resolve-host-name.c58
-rw-r--r--avahi-core/resolve-service.c102
-rw-r--r--avahi-core/response-sched.c68
-rw-r--r--avahi-core/response-sched.h8
-rw-r--r--avahi-core/rr-util.h8
-rw-r--r--avahi-core/rr.c114
-rw-r--r--avahi-core/rr.h27
-rw-r--r--avahi-core/rrlist.c32
-rw-r--r--avahi-core/rrlist.h8
-rw-r--r--avahi-core/server.c23
-rw-r--r--avahi-core/socket.c13
-rw-r--r--avahi-core/socket.h8
-rw-r--r--avahi-core/timeeventq-test.c12
-rw-r--r--avahi-core/timeeventq.c34
-rw-r--r--avahi-core/timeeventq.h8
-rw-r--r--avahi-core/update-test.c18
-rw-r--r--avahi-core/util.c26
-rw-r--r--avahi-core/util.h8
-rw-r--r--avahi-core/wide-area.c112
-rw-r--r--avahi-core/wide-area.h8
-rw-r--r--avahi-daemon/.gitignore2
-rw-r--r--avahi-daemon/Makefile.am75
-rw-r--r--avahi-daemon/avahi-daemon.conf8
-rw-r--r--avahi-daemon/avahi-daemon.service.in31
-rw-r--r--avahi-daemon/avahi-daemon.socket.in27
-rw-r--r--avahi-daemon/avahi-service.dtd2
-rw-r--r--avahi-daemon/caps.c20
-rw-r--r--avahi-daemon/caps.h8
-rw-r--r--avahi-daemon/chroot.c96
-rw-r--r--avahi-daemon/chroot.h8
-rw-r--r--avahi-daemon/dbus-async-address-resolver.c39
-rw-r--r--avahi-daemon/dbus-async-host-name-resolver.c38
-rw-r--r--avahi-daemon/dbus-async-service-resolver.c48
-rw-r--r--avahi-daemon/dbus-domain-browser.c40
-rw-r--r--avahi-daemon/dbus-entry-group.c107
-rw-r--r--avahi-daemon/dbus-internal.h34
-rw-r--r--avahi-daemon/dbus-protocol.c222
-rw-r--r--avahi-daemon/dbus-protocol.h15
-rw-r--r--avahi-daemon/dbus-record-browser.c49
-rw-r--r--avahi-daemon/dbus-service-browser.c45
-rw-r--r--avahi-daemon/dbus-service-type-browser.c41
-rw-r--r--avahi-daemon/dbus-sync-address-resolver.c22
-rw-r--r--avahi-daemon/dbus-sync-host-name-resolver.c22
-rw-r--r--avahi-daemon/dbus-sync-service-resolver.c41
-rw-r--r--avahi-daemon/dbus-util.c134
-rw-r--r--avahi-daemon/dbus-util.h8
-rw-r--r--avahi-daemon/example.service2
-rw-r--r--avahi-daemon/hosts2
-rw-r--r--avahi-daemon/ini-file-parser-test.c10
-rw-r--r--avahi-daemon/ini-file-parser.c38
-rw-r--r--avahi-daemon/ini-file-parser.h8
-rw-r--r--avahi-daemon/introspect.xsl2
-rw-r--r--avahi-daemon/main.c85
-rw-r--r--avahi-daemon/main.h8
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.AddressResolver.xml (renamed from avahi-daemon/AddressResolver.introspect)8
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.DomainBrowser.xml (renamed from avahi-daemon/DomainBrowser.introspect)11
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.EntryGroup.xml (renamed from avahi-daemon/EntryGroup.introspect)4
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.HostNameResolver.xml (renamed from avahi-daemon/HostNameResolver.introspect)2
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.RecordBrowser.xml (renamed from avahi-daemon/RecordBrowser.introspect)10
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.Server.xml (renamed from avahi-daemon/Server.introspect)4
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.ServiceBrowser.xml (renamed from avahi-daemon/ServiceBrowser.introspect)10
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.ServiceResolver.xml (renamed from avahi-daemon/ServiceResolver.introspect)8
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.ServiceTypeBrowser.xml (renamed from avahi-daemon/ServiceTypeBrowser.introspect)10
-rw-r--r--avahi-daemon/org.freedesktop.Avahi.service24
-rw-r--r--avahi-daemon/sd-daemon.c448
-rw-r--r--avahi-daemon/sd-daemon.h257
-rw-r--r--avahi-daemon/setproctitle.c20
-rw-r--r--avahi-daemon/setproctitle.h8
-rw-r--r--avahi-daemon/sftp-ssh.service6
-rw-r--r--avahi-daemon/simple-protocol.c129
-rw-r--r--avahi-daemon/simple-protocol.h8
-rw-r--r--avahi-daemon/ssh.service2
-rw-r--r--avahi-daemon/static-hosts.c30
-rw-r--r--avahi-daemon/static-hosts.h8
-rw-r--r--avahi-daemon/static-services.c2
-rw-r--r--avahi-daemon/static-services.h8
-rw-r--r--avahi-discover-standalone/Makefile.am31
-rw-r--r--avahi-discover-standalone/avahi-discover.glade91
-rw-r--r--avahi-discover-standalone/avahi-discover.gladep8
-rw-r--r--avahi-discover-standalone/avahi-discover.ui84
-rw-r--r--avahi-discover-standalone/main.c57
-rw-r--r--avahi-dnsconfd/.gitignore1
-rw-r--r--avahi-dnsconfd/Makefile.am20
-rwxr-xr-xavahi-dnsconfd/avahi-dnsconfd.action2
-rw-r--r--avahi-dnsconfd/avahi-dnsconfd.service.in30
-rw-r--r--avahi-dnsconfd/main.c107
-rw-r--r--avahi-glib/Makefile.am2
-rw-r--r--avahi-glib/glib-malloc.c8
-rw-r--r--avahi-glib/glib-malloc.h8
-rw-r--r--avahi-glib/glib-watch-test.c14
-rw-r--r--avahi-glib/glib-watch.c60
-rw-r--r--avahi-glib/glib-watch.h8
-rw-r--r--avahi-gobject/.gitignore2
-rw-r--r--avahi-gobject/AvahiCore-0.6.gir59
-rw-r--r--avahi-gobject/Makefile.am46
-rw-r--r--avahi-gobject/ga-entry-group.c2
-rw-r--r--avahi-python/Makefile.am4
-rwxr-xr-xavahi-python/avahi-bookmarks.in2
-rw-r--r--avahi-python/avahi-discover/Makefile.am15
-rw-r--r--avahi-python/avahi-discover/SimpleGladeApp.py341
-rwxr-xr-xavahi-python/avahi-discover/__init__.py2
-rwxr-xr-xavahi-python/avahi-discover/avahi-discover.in67
-rw-r--r--avahi-python/avahi/Makefile.am10
-rw-r--r--avahi-python/avahi/ServiceTypeDatabase.py.in73
-rw-r--r--avahi-python/avahi/__init__.py2
-rw-r--r--avahi-qt/Makefile.am18
-rw-r--r--avahi-qt/qt-watch.cpp2
-rw-r--r--avahi-qt/qt-watch.h8
-rw-r--r--avahi-sharp/AddressResolver.cs10
-rw-r--r--avahi-sharp/AssemblyInfo.cs10
-rw-r--r--avahi-sharp/AvahiTest.cs14
-rw-r--r--avahi-sharp/BrowserBase.cs2
-rw-r--r--avahi-sharp/Client.cs22
-rw-r--r--avahi-sharp/ClientException.cs8
-rw-r--r--avahi-sharp/DomainBrowser.cs10
-rw-r--r--avahi-sharp/EntryGroup.cs22
-rw-r--r--avahi-sharp/HostNameResolver.cs6
-rw-r--r--avahi-sharp/Makefile.am14
-rw-r--r--avahi-sharp/RecordBrowser.cs14
-rw-r--r--avahi-sharp/ResolverBase.cs2
-rw-r--r--avahi-sharp/ServiceBrowser.cs16
-rw-r--r--avahi-sharp/ServiceResolver.cs8
-rw-r--r--avahi-sharp/ServiceTypeBrowser.cs10
-rw-r--r--avahi-sharp/Utility.cs8
-rw-r--r--avahi-ui-gtk3.pc.in11
-rw-r--r--avahi-ui-sharp/Makefile.am12
-rw-r--r--avahi-ui-sharp/ServiceDialog.cs14
-rw-r--r--avahi-ui-sharp/bssh.cs8
-rw-r--r--avahi-ui.pc.in2
-rw-r--r--avahi-ui/Makefile.am41
-rw-r--r--avahi-ui/avahi-ui.c19
-rw-r--r--avahi-ui/avahi-ui.h2
-rw-r--r--avahi-ui/bssh.c3
-rw-r--r--avahi-utils/Makefile.am2
-rw-r--r--avahi-utils/avahi-browse.c2
-rw-r--r--avahi-utils/avahi-publish.c15
-rw-r--r--avahi-utils/avahi-resolve.c2
-rw-r--r--avahi-utils/avahi-set-host-name.c2
-rw-r--r--avahi-utils/sigint.c20
-rw-r--r--avahi-utils/sigint.h8
-rw-r--r--avahi-utils/stdb.c28
-rw-r--r--avahi-utils/stdb.h8
-rwxr-xr-xbootstrap.sh3
-rw-r--r--common/.gitignore1
-rw-r--r--common/Makefile.am2
-rw-r--r--common/introspection.m494
-rw-r--r--configure.ac94
-rw-r--r--docs/API-CHANGES-0.63
-rw-r--r--docs/COMPAT-LAYERS2
-rw-r--r--docs/DBUS-API2
-rw-r--r--docs/HACKING20
-rw-r--r--docs/INSTALL2
-rw-r--r--docs/MALLOC2
-rw-r--r--docs/NEWS6
-rw-r--r--docs/socket-auto-port.c6
-rw-r--r--examples/Makefile.am4
-rw-r--r--examples/client-browse-services.c30
-rw-r--r--examples/client-publish-service.c2
-rw-r--r--examples/core-browse-services.c40
-rw-r--r--examples/core-publish-service.c50
-rw-r--r--examples/glib-integration.c14
-rw-r--r--initscript/Makefile.am4
-rw-r--r--initscript/archlinux/Makefile.am2
-rw-r--r--initscript/archlinux/avahi-daemon.in2
-rwxr-xr-xinitscript/archlinux/avahi-dnsconfd.in2
-rw-r--r--initscript/darwin/Makefile.am4
-rw-r--r--initscript/debian/Makefile.am2
-rwxr-xr-xinitscript/debian/avahi-daemon.in2
-rwxr-xr-xinitscript/debian/avahi-dnsconfd.in2
-rw-r--r--initscript/fedora/Makefile.am12
-rw-r--r--initscript/fedora/avahi-daemon.in45
-rw-r--r--initscript/fedora/avahi-dnsconfd.in59
-rw-r--r--initscript/freebsd/Makefile.am2
-rw-r--r--initscript/gentoo/Makefile.am4
-rw-r--r--initscript/gentoo/avahi-daemon.in1
-rw-r--r--initscript/gentoo/avahi-dnsconfd.in1
-rw-r--r--initscript/lfs/Makefile.am2
-rw-r--r--initscript/mandriva/Makefile.am2
-rw-r--r--initscript/mandriva/avahi-daemon.in2
-rw-r--r--initscript/slackware/Makefile.am2
-rw-r--r--initscript/slackware/avahi-daemon.in2
-rw-r--r--initscript/slackware/avahi-dnsconfd.in2
-rw-r--r--initscript/suse/Makefile.am2
-rw-r--r--initscript/suse/avahi-daemon.in2
-rw-r--r--man/Makefile.am121
-rw-r--r--man/avahi-autoipd.8.xml.in28
-rw-r--r--man/avahi-autoipd.action.8.xml.in20
-rw-r--r--man/avahi-bookmarks.1.xml.in26
-rw-r--r--man/avahi-browse.1.xml.in4
-rw-r--r--man/avahi-daemon.8.xml.in28
-rw-r--r--man/avahi-daemon.conf.5.xml.in654
-rw-r--r--man/avahi-discover.1.xml.in24
-rw-r--r--man/avahi-dnsconfd.8.xml.in29
-rw-r--r--man/avahi-dnsconfd.action.8.xml.in24
-rw-r--r--man/avahi-publish.1.xml.in24
-rw-r--r--man/avahi-resolve.1.xml.in24
-rw-r--r--man/avahi-set-host-name.1.xml.in22
-rw-r--r--man/avahi.hosts.5.xml.in18
-rw-r--r--man/avahi.service.5.xml.in22
-rw-r--r--man/bssh.1.xml.in2
-rw-r--r--man/xmltoman.css2
-rw-r--r--man/xmltoman.dtd6
-rw-r--r--man/xmltoman.xsl2
-rw-r--r--po/POTFILES.in2
-rw-r--r--po/POTFILES.skip1
-rw-r--r--service-type-database/Makefile.am20
-rwxr-xr-xservice-type-database/build-db.in2
-rw-r--r--service-type-database/service-types21
-rw-r--r--tests/Makefile.am4
-rwxr-xr-xtests/c-plus-plus-test-gen.py14
-rw-r--r--tests/c-plus-plus-test.cc2
380 files changed, 5620 insertions, 5296 deletions
diff --git a/Makefile.am b/Makefile.am
index c19e72c..a800687 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -50,7 +48,9 @@ EXTRA_DIST = \
avahi-compat-libdns_sd.pc.in \
avahi-compat-howl.pc.in \
avahi-ui.pc.in \
- doxygen_to_devhelp.xsl
+ avahi-ui-gtk3.pc.in \
+ doxygen_to_devhelp.xsl \
+ common/introspection.m4
SUBDIRS = \
common \
@@ -151,136 +151,68 @@ DX_INPUT += \
endif
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = avahi-core.pc
-avahi-core.pc: avahi-core.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
+%.pc: %.pc.in
+ $(AM_V_GEN)sed -e 's,@prefix\@,$(prefix),g' \
-e 's,@libdir\@,$(libdir),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
-
-avahi-client.pc: avahi-client.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
CLEANFILES += avahi-client.pc
if ENABLE_COMPAT_HOWL
-
pkgconfig_DATA += avahi-compat-howl.pc
-
-avahi-compat-howl.pc: avahi-compat-howl.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@HOWL_COMPAT_VERSION\@,$(HOWL_COMPAT_VERSION),g' $< > $@
-
CLEANFILES += avahi-compat-howl.pc
-
endif
if ENABLE_COMPAT_LIBDNS_SD
-
pkgconfig_DATA += avahi-compat-libdns_sd.pc
-
-avahi-compat-libdns_sd.pc: avahi-compat-libdns_sd.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
CLEANFILES += avahi-compat-libdns_sd.pc
-
endif
if HAVE_MONO
-
pkgconfig_DATA += avahi-sharp.pc avahi-ui-sharp.pc
-
-avahi-sharp.pc: avahi-sharp.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
- -e 's,@libdir\@,$(libdir),g' $< > $@
-
-avahi-ui-sharp.pc: avahi-ui-sharp.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
- -e 's,@libdir\@,$(libdir),g' $< > $@
-
CLEANFILES += avahi-sharp.pc avahi-ui-sharp.pc
-
endif
endif
if HAVE_GLIB
-
pkgconfig_DATA += avahi-glib.pc
-
-avahi-glib.pc: avahi-glib.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
CLEANFILES += avahi-glib.pc
if HAVE_GOBJECT
-
pkgconfig_DATA += avahi-gobject.pc
-
-avahi-gobject.pc: avahi-gobject.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
CLEANFILES += avahi-gobject.pc
-
endif
endif
if HAVE_GTK
if HAVE_DBUS
-
pkgconfig_DATA += avahi-ui.pc
-
-avahi-ui.pc: avahi-ui.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
CLEANFILES += avahi-ui.pc
+endif
+endif
+if HAVE_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
-
-avahi-qt3.pc: avahi-qt3.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
CLEANFILES += avahi-qt3.pc
-
endif
if HAVE_QT4
-
pkgconfig_DATA += avahi-qt4.pc
-
-avahi-qt4.pc: avahi-qt4.pc.in
- sed -e 's,@prefix\@,$(prefix),g' \
- -e 's,@libdir\@,$(libdir),g' \
- -e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' $< > $@
-
CLEANFILES += avahi-qt4.pc
-
endif
CLEANFILES += avahi.devhelp
@@ -291,7 +223,9 @@ avahi.devhelp: doxygen-run
MOSTLYCLEANFILES = $(DX_CLEANFILES)
DISTCHECK_CONFIGURE_FLAGS = \
- --disable-monodoc
+ --disable-monodoc \
+ --enable-introspection \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
homepage:
$(MAKE) -C man
@@ -304,12 +238,5 @@ homepage:
ssh tango rm -rf www/avahi.org/tree/download/doxygen
scp -r doxygen/html tango:www/avahi.org/tree/download/doxygen
-dist-hook:
- if test -d .svn ; then \
- svn update ; \
- chmod u+w ${distdir}/ChangeLog || true ; \
- svn2cl -o ${distdir}/ChangeLog ; \
- fi
-
DISTCLEANFILES = \
po/.intltool-merge-cache
diff --git a/autogen.sh b/autogen.sh
index 78f26c9..2c68a6c 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,5 +1,4 @@
-#!/bin/sh
-# $Id$
+#!/bin/bash
# This file is part of avahi.
#
@@ -18,22 +17,23 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-VERSION=1.9
+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`" ] ; then
- P="$1$V"
+
+ if [ -e "`which $1$V 2> /dev/null`" ] ; then
+ P="$1$V"
else
- if [ -e "`which $1-$2`" ] ; then
- P="$1-$2"
- else
- P="$1"
- fi
+ if [ -e "`which $1-$2 2> /dev/null`" ] ; then
+ P="$1-$2"
+ else
+ P="$1"
+ fi
fi
shift 2
@@ -42,8 +42,14 @@ run_versioned() {
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 "$VERSION" -a -c --foreign
+ run_versioned automake "$AM_VERSION" -a -c --foreign
./config.status
else
rm -rf autom4te.cache
@@ -59,10 +65,10 @@ else
intltoolize --copy --force --automake
"$LIBTOOLIZE" -c --force
- run_versioned aclocal "$VERSION" -I common
- run_versioned autoconf 2.59 -Wall
- run_versioned autoheader 2.59
- run_versioned automake "$VERSION" -a -c --foreign
+ 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 "$@"
diff --git a/avahi-autoipd/Makefile.am b/avahi-autoipd/Makefile.am
index 2f99592..dc43b54 100644
--- a/avahi-autoipd/Makefile.am
+++ b/avahi-autoipd/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
@@ -54,10 +52,10 @@ nodist_pkgsysconf_SCRIPTS = avahi-autoipd.action
if TARGET_FREEBSD
avahi-autoipd.action: avahi-autoipd.action.bsd
- cp $< $@
+ $(AM_V_GEN)cp $< $@
else
avahi-autoipd.action: avahi-autoipd.action.linux
- cp $< $@
+ $(AM_V_GEN)cp $< $@
endif
if TARGET_DEBIAN
@@ -65,11 +63,11 @@ if TARGET_DEBIAN
noinst_SCRIPTS = dhclient-enter-hook dhclient-exit-hook
dhclient-enter-hook: dhclient-enter-hook.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
+ $(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ && \
chmod +x $@
dhclient-exit-hook: dhclient-exit-hook.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
+ $(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ && \
chmod +x $@
BUILD = dhclient-exit-hook dhclient-enter-hook
diff --git a/avahi-autoipd/avahi-autoipd.action.bsd b/avahi-autoipd/avahi-autoipd.action.bsd
index db39c4e..06084fb 100755
--- a/avahi-autoipd/avahi-autoipd.action.bsd
+++ b/avahi-autoipd/avahi-autoipd.action.bsd
@@ -1,7 +1,5 @@
#!/bin/sh
-# $Id$
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-autoipd/avahi-autoipd.action.linux b/avahi-autoipd/avahi-autoipd.action.linux
index 27f00bb..c2db994 100755
--- a/avahi-autoipd/avahi-autoipd.action.linux
+++ b/avahi-autoipd/avahi-autoipd.action.linux
@@ -1,9 +1,7 @@
#!/bin/sh
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
@@ -30,17 +28,26 @@ set -e
# $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 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 addr del "$3"/16 brd 169.254.255.255 label "$2:avahi" scope link dev "$2"
+ 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"
;;
*)
@@ -55,11 +62,13 @@ elif [ -x /bin/ifconfig -o -x /sbin/ifconfig ] ; then
case "$1" in
BIND)
- ifconfig "$2:3" inet "$3" netmask 255.255.0.0 broadcast 169.254.255.255 up
+ 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)
- ifconfig "$2:3" down
+ route del default dev "$2:avahi" metric "$METRIC" ||:
+ ifconfig "$2:avahi" down
;;
*)
diff --git a/avahi-autoipd/dhclient-enter-hook.in b/avahi-autoipd/dhclient-enter-hook.in
index 10449f1..a746856 100755
--- a/avahi-autoipd/dhclient-enter-hook.in
+++ b/avahi-autoipd/dhclient-enter-hook.in
@@ -1,7 +1,5 @@
#!/bin/sh
-# $Id$
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-autoipd/dhclient-exit-hook.in b/avahi-autoipd/dhclient-exit-hook.in
index 3dcb7df..379cb46 100755
--- a/avahi-autoipd/dhclient-exit-hook.in
+++ b/avahi-autoipd/dhclient-exit-hook.in
@@ -1,9 +1,7 @@
#!/bin/sh
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
@@ -26,7 +24,7 @@ case "$reason" in
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
;;
diff --git a/avahi-autoipd/iface-linux.c b/avahi-autoipd/iface-linux.c
index 5bc0300..fc27829 100644
--- a/avahi-autoipd/iface-linux.c
+++ b/avahi-autoipd/iface-linux.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -67,7 +65,7 @@ AVAHI_LLIST_HEAD(Address, addresses) = NULL;
int iface_init(int i) {
struct sockaddr_nl addr;
int on = 1;
-
+
if ((fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)) < 0) {
daemon_log(LOG_ERR, "socket(PF_NETLINK): %s", strerror(errno));
goto fail;
@@ -82,22 +80,22 @@ int iface_init(int i) {
daemon_log(LOG_ERR, "bind(): %s", strerror(errno));
goto fail;
}
-
+
if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)) < 0) {
daemon_log(LOG_ERR, "SO_PASSCRED: %s", strerror(errno));
goto fail;
}
ifindex = i;
-
+
return fd;
-
+
fail:
if (fd >= 0) {
close(fd);
fd = -1;
}
-
+
return -1;
}
@@ -112,14 +110,14 @@ static int process_nlmsg(struct nlmsghdr *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) {
@@ -136,7 +134,7 @@ static int process_nlmsg(struct nlmsghdr *n) {
int l;
uint32_t address = 0;
Address *i;
-
+
ifa = NLMSG_DATA(n);
if (ifa->ifa_family != AF_INET || (int) ifa->ifa_index != ifindex)
@@ -154,7 +152,7 @@ static int process_nlmsg(struct nlmsghdr *n) {
memcpy(&address, RTA_DATA(a), sizeof(uint32_t));
break;
}
-
+
a = RTA_NEXT(a, l);
}
@@ -180,7 +178,7 @@ static int process_nlmsg(struct nlmsghdr *n) {
static int process_response(int wait_for_done, unsigned seq) {
assert(fd >= 0);
-
+
do {
size_t bytes;
ssize_t r;
@@ -189,39 +187,39 @@ static int process_response(int wait_for_done, unsigned seq) {
struct msghdr msghdr;
struct cmsghdr *cmsghdr;
struct ucred *ucred;
- struct iovec iov;
+ struct iovec iov;
struct nlmsghdr *p = (struct nlmsghdr *) replybuf;
-
+
memset(&iov, 0, sizeof(iov));
- iov.iov_base = replybuf;
+ 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_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.");
+ 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) {
@@ -258,7 +256,7 @@ int iface_get_initial_state(State *state) {
assert(fd >= 0);
assert(state);
-
+
memset(&req, 0, sizeof(req));
n = (struct nlmsghdr*) req;
n->nlmsg_len = NLMSG_LENGTH(sizeof(*ifi));
@@ -278,7 +276,7 @@ int iface_get_initial_state(State *state) {
if (process_response(1, 0) < 0)
return -1;
-
+
n->nlmsg_type = RTM_GETADDR;
n->nlmsg_len = NLMSG_LENGTH(sizeof(*ifa));
n->nlmsg_seq = ++seq;
@@ -286,7 +284,7 @@ int iface_get_initial_state(State *state) {
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;
@@ -296,7 +294,7 @@ int iface_get_initial_state(State *state) {
return -1;
*state = addresses ? STATE_SLEEPING : STATE_START;
-
+
return 0;
}
@@ -305,7 +303,7 @@ int iface_process(Event *event) {
assert(fd >= 0);
b = !!addresses;
-
+
if (process_response(0, 0) < 0)
return -1;
@@ -313,13 +311,13 @@ int iface_process(Event *event) {
*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;
diff --git a/avahi-autoipd/iface.h b/avahi-autoipd/iface.h
index e3f913e..95c97fd 100644
--- a/avahi-autoipd/iface.h
+++ b/avahi-autoipd/iface.h
@@ -1,21 +1,19 @@
#ifndef fooavahiifacehfoo
#define fooavahiifacehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-autoipd/main.c b/avahi-autoipd/main.c
index eb71c3b..4b35f7c 100644
--- a/avahi-autoipd/main.c
+++ b/avahi-autoipd/main.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -566,8 +564,7 @@ fail:
return -1;
}
-static void
-close_socket(int fd) {
+static void close_socket(int fd) {
close(fd);
}
@@ -582,16 +579,14 @@ static uint8_t __lladdr[ETHER_ADDRLEN];
#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;
+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;
@@ -603,20 +598,15 @@ __get_ether_addr(int ifindex, u_char *lladdr)
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);
+ 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);
+ return -1;
}
lim = buf + len;
@@ -627,34 +617,31 @@ __get_ether_addr(int ifindex, u_char *lladdr)
memcpy(lladdr, LLADDR(sdl), ETHER_ADDRLEN);
}
}
- free(buf);
+ avahi_free(buf);
- return (0);
+ 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;
+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);
- }
+ 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
@@ -728,10 +715,7 @@ open_socket(int iface, uint8_t *hw_address)
return (fd);
}
-static void
-close_socket(int fd __unused)
-{
-
+static void close_socket(int fd AVAHI_GCC_UNUSED) {
assert(__pp != NULL);
pcap_close(__pp);
__pp = NULL;
@@ -741,10 +725,7 @@ close_socket(int fd __unused)
* We trick avahi into allocating sizeof(packet) + sizeof(ether_header),
* and prepend the required ethernet header information before sending.
*/
-static int
-send_packet(int fd __unused, int iface __unused, ArpPacket *packet,
- size_t packet_len)
-{
+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);
@@ -758,14 +739,12 @@ send_packet(int fd __unused, int iface __unused, ArpPacket *packet,
return (pcap_inject(__pp, (void *)eh, packet_len + sizeof(*eh)));
}
-static int
-recv_packet(int fd __unused, ArpPacket **packet, size_t *packet_len)
-{
- struct pcap_pkthdr *ph;
- u_char *pd;
- ArpPacket *ap;
- int err;
- int retval;
+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);
@@ -791,10 +770,9 @@ recv_packet(int fd __unused, ArpPacket **packet, size_t *packet_len)
* didn't match the filter, in which case we'll get 0 packets.
*/
retval = 0;
- } else {
+ } else
daemon_log(LOG_ERR, "pcap_next_ex(%d): %s",
err, pcap_geterr(__pp));
- }
return (retval);
}
@@ -843,8 +821,6 @@ static FILE* fork_dispatcher(void) {
daemon_retval_done();
- setsid();
-
avahi_set_proc_title(argv0, "%s: [%s] callout dispatcher", argv0, interface_name);
close(fds[1]);
@@ -1097,7 +1073,7 @@ static int loop(int iface, uint32_t addr) {
char *address_fn = NULL;
const char *p;
- daemon_signal_init(SIGINT, SIGTERM, SIGCHLD, SIGHUP,0);
+ daemon_signal_init(SIGINT, SIGTERM, SIGCHLD, SIGHUP, 0);
if (!(dispatcher = fork_dispatcher()))
goto fail;
@@ -1244,9 +1220,14 @@ static int loop(int iface, uint32_t addr) {
int conflict = 0;
if (info.sender_ip_address == addr) {
- /* Normal conflict */
- conflict = 1;
- daemon_log(LOG_INFO, "Received conflicting normal ARP packet.");
+
+ 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);
diff --git a/avahi-autoipd/main.h b/avahi-autoipd/main.h
index adadc99..cc02df7 100644
--- a/avahi-autoipd/main.h
+++ b/avahi-autoipd/main.h
@@ -1,21 +1,19 @@
#ifndef fooavahimainhfoo
#define fooavahimainhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-client/Makefile.am b/avahi-client/Makefile.am
index cd62e32..f11b11d 100644
--- a/avahi-client/Makefile.am
+++ b/avahi-client/Makefile.am
@@ -1,7 +1,5 @@
-# $Id: Makefile.am 90 2005-05-23 16:15:12Z lennart $
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
@@ -40,7 +38,7 @@ noinst_PROGRAMS = \
endif
-lib_LTLIBRARIES = libavahi-client.la
+lib_LTLIBRARIES = libavahi-client.la
libavahi_client_la_SOURCES = \
client.c client.h \
@@ -58,23 +56,23 @@ libavahi_client_la_LIBADD = $(AM_LDADD) $(DBUS_LIBS) ../avahi-common/libavahi-co
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
+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
+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
+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_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_CFLAGS = $(AM_CFLAGS)
check_nss_test_LDADD = $(AM_LDADD)
if HAVE_DLOPEN
diff --git a/avahi-client/browser.c b/avahi-client/browser.c
index 24393b8..f92ed0d 100644
--- a/avahi-client/browser.c
+++ b/avahi-client/browser.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,7 +42,7 @@ 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;
@@ -60,17 +58,17 @@ static void parse_environment(AvahiDomainBrowser *b) {
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);
}
@@ -112,7 +110,7 @@ AvahiDomainBrowser* avahi_domain_browser_new(
AvahiLookupFlags flags,
AvahiDomainBrowserCallback callback,
void *userdata) {
-
+
AvahiDomainBrowser *db = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
@@ -156,7 +154,7 @@ AvahiDomainBrowser* avahi_domain_browser_new(
}
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;
@@ -208,10 +206,10 @@ AvahiDomainBrowser* avahi_domain_browser_new(
goto fail;
}
}
-
+
dbus_message_unref(message);
dbus_message_unref(reply);
-
+
return db;
fail:
@@ -223,7 +221,7 @@ fail:
if (db)
avahi_domain_browser_free(db);
-
+
if (message)
dbus_message_unref(message);
@@ -241,13 +239,13 @@ AvahiClient* avahi_domain_browser_get_client (AvahiDomainBrowser *b) {
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))
@@ -257,7 +255,7 @@ int avahi_domain_browser_free (AvahiDomainBrowser *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);
@@ -276,7 +274,7 @@ DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserE
assert(client);
assert(message);
-
+
dbus_error_init (&error);
if (!(path = dbus_message_get_path(message)))
@@ -295,7 +293,7 @@ DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserE
switch (event) {
case AVAHI_BROWSER_NEW:
case AVAHI_BROWSER_REMOVE:
-
+
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_INT32, &interface,
@@ -309,14 +307,14 @@ DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserE
}
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,
@@ -325,7 +323,7 @@ DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserE
fprintf(stderr, "Failed to parse browser event.\n");
goto fail;
}
-
+
avahi_client_set_errno(db->client, avahi_error_dbus_to_number(etxt));
break;
}
@@ -337,7 +335,7 @@ DBusHandlerResult avahi_domain_browser_event (AvahiClient *client, AvahiBrowserE
/* 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;
@@ -354,10 +352,10 @@ AvahiServiceTypeBrowser* avahi_service_type_browser_new(
AvahiIfIndex interface,
AvahiProtocol protocol,
const char *domain,
- AvahiLookupFlags flags,
+ AvahiLookupFlags flags,
AvahiServiceTypeBrowserCallback callback,
void *userdata) {
-
+
AvahiServiceTypeBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
@@ -398,12 +396,12 @@ AvahiServiceTypeBrowser* avahi_service_type_browser_new(
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;
@@ -446,7 +444,7 @@ AvahiServiceTypeBrowser* avahi_service_type_browser_new(
return b;
fail:
-
+
if (dbus_error_is_set(&error)) {
avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
@@ -454,7 +452,7 @@ fail:
if (b)
avahi_service_type_browser_free(b);
-
+
if (message)
dbus_message_unref(message);
@@ -497,7 +495,7 @@ DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBr
assert(client);
assert(message);
-
+
dbus_error_init (&error);
if (!(path = dbus_message_get_path(message)))
@@ -513,7 +511,7 @@ DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBr
domain = b->domain;
interface = b->interface;
protocol = b->protocol;
-
+
switch (event) {
case AVAHI_BROWSER_NEW:
case AVAHI_BROWSER_REMOVE:
@@ -530,14 +528,14 @@ DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBr
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,
@@ -546,7 +544,7 @@ DBusHandlerResult avahi_service_type_browser_event (AvahiClient *client, AvahiBr
fprintf(stderr, "Failed to parse browser event.\n");
goto fail;
}
-
+
avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
break;
}
@@ -569,10 +567,10 @@ AvahiServiceBrowser* avahi_service_browser_new(
AvahiProtocol protocol,
const char *type,
const char *domain,
- AvahiLookupFlags flags,
+ AvahiLookupFlags flags,
AvahiServiceBrowserCallback callback,
void *userdata) {
-
+
AvahiServiceBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
@@ -598,7 +596,7 @@ AvahiServiceBrowser* avahi_service_browser_new(
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
b->client = client;
b->callback = callback;
b->userdata = userdata;
@@ -613,13 +611,13 @@ AvahiServiceBrowser* avahi_service_browser_new(
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;
@@ -664,7 +662,7 @@ AvahiServiceBrowser* avahi_service_browser_new(
dbus_message_unref(message);
dbus_message_unref(reply);
-
+
return b;
fail:
@@ -675,7 +673,7 @@ fail:
if (b)
avahi_service_browser_free(b);
-
+
if (message)
dbus_message_unref(message);
@@ -737,7 +735,7 @@ DBusHandlerResult avahi_service_browser_event(AvahiClient *client, AvahiBrowserE
switch (event) {
case AVAHI_BROWSER_NEW:
case AVAHI_BROWSER_REMOVE:
-
+
if (!dbus_message_get_args (
message, &error,
DBUS_TYPE_INT32, &interface,
@@ -759,7 +757,7 @@ DBusHandlerResult avahi_service_browser_event(AvahiClient *client, AvahiBrowserE
case AVAHI_BROWSER_FAILURE: {
char *etxt;
-
+
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_STRING, &etxt,
@@ -768,7 +766,7 @@ DBusHandlerResult avahi_service_browser_event(AvahiClient *client, AvahiBrowserE
fprintf(stderr, "Failed to parse browser event.\n");
goto fail;
}
-
+
avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
break;
}
@@ -795,7 +793,7 @@ AvahiRecordBrowser* avahi_record_browser_new(
AvahiLookupFlags flags,
AvahiRecordBrowserCallback callback,
void *userdata) {
-
+
AvahiRecordBrowser *b = NULL;
DBusMessage *message = NULL, *reply = NULL;
DBusError error;
@@ -818,7 +816,7 @@ AvahiRecordBrowser* avahi_record_browser_new(
avahi_client_set_errno(client, AVAHI_ERR_NO_MEMORY);
goto fail;
}
-
+
b->client = client;
b->callback = callback;
b->userdata = userdata;
@@ -835,7 +833,7 @@ AvahiRecordBrowser* avahi_record_browser_new(
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;
@@ -881,7 +879,7 @@ AvahiRecordBrowser* avahi_record_browser_new(
dbus_message_unref(message);
dbus_message_unref(reply);
-
+
return b;
fail:
@@ -892,7 +890,7 @@ fail:
if (b)
avahi_record_browser_free(b);
-
+
if (message)
dbus_message_unref(message);
@@ -978,7 +976,7 @@ DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEv
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;
@@ -987,12 +985,12 @@ DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEv
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;
}
@@ -1002,7 +1000,7 @@ DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEv
case AVAHI_BROWSER_FAILURE: {
char *etxt;
-
+
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_STRING, &etxt,
@@ -1011,7 +1009,7 @@ DBusHandlerResult avahi_record_browser_event(AvahiClient *client, AvahiBrowserEv
fprintf(stderr, "Failed to parse browser event.\n");
goto fail;
}
-
+
avahi_client_set_errno(b->client, avahi_error_dbus_to_number(etxt));
break;
}
diff --git a/avahi-client/check-nss-test.c b/avahi-client/check-nss-test.c
index 52aa81e..7c15500 100644
--- a/avahi-client/check-nss-test.c
+++ b/avahi-client/check-nss-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-client/check-nss.c b/avahi-client/check-nss.c
index 0a933fa..ea266c4 100644
--- a/avahi-client/check-nss.c
+++ b/avahi-client/check-nss.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -32,19 +30,19 @@
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);
diff --git a/avahi-client/client-test.c b/avahi-client/client-test.c
index 7d30651..7d04a6a 100644
--- a/avahi-client/client-test.c
+++ b/avahi-client/client-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -58,7 +56,7 @@ static void avahi_domain_browser_callback(
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);
}
@@ -76,7 +74,7 @@ static void avahi_service_resolver_callback(
AvahiStringList *txt,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void *userdata) {
-
+
char addr[64];
char *txtr;
if (event == AVAHI_RESOLVER_FAILURE) {
@@ -99,14 +97,14 @@ static void avahi_service_browser_callback (
const char *domain,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void *userdata) {
-
+
AvahiServiceResolver *sr;
printf ("SERVICE-BROWSER: Callback on %p, interface (%d), protocol (%d), event (%d), name (%s), type (%s), domain (%s), data (%s)\n", (void*) b, interface, protocol, event, name ? name : "NULL", type, domain ? domain : "NULL", (char*)userdata);
if (b && name)
{
- sr = avahi_service_resolver_new (avahi_service_browser_get_client (b), interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, avahi_service_resolver_callback, "xxXXxx");
+ 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);
}
}
@@ -120,7 +118,7 @@ static void avahi_service_type_browser_callback (
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);
}
@@ -133,7 +131,7 @@ static void avahi_address_resolver_callback (
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");
@@ -152,17 +150,17 @@ static void avahi_host_name_resolver_callback (
const AvahiAddress *a,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void *userdata) {
-
+
AvahiClient *client;
AvahiAddressResolver *ar;
char addr[64];
-
+
if (event == AVAHI_RESOLVER_FAILURE) {
printf ("HOST-NAME-RESOLVER: Callback on HostNameResolver, timed out.\n");
return;
}
client = avahi_host_name_resolver_get_client (r);
- ar = avahi_address_resolver_new(client, interface, protocol, a, 0, avahi_address_resolver_callback, "omghai6u");
+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");
@@ -227,8 +225,8 @@ int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
simple_poll = avahi_simple_poll_new();
poll_api = avahi_simple_poll_get(simple_poll);
-
- if (!(avahi = avahi_client_new(poll_api, 0, avahi_client_callback, "omghai2u", &error))) {
+
+ 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;
}
@@ -246,15 +244,15 @@ int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
ret = avahi_client_get_host_name_fqdn (avahi);
printf("FQDN: %s (Error Return: %s)\n", ret, ret ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
-
+
cookie = avahi_client_get_local_service_cookie(avahi);
printf("Local service cookie: %u (Error Return: %s)\n", cookie, cookie != AVAHI_SERVICE_COOKIE_INVALID ? "OK" : avahi_strerror(avahi_client_errno(avahi)));
- group = avahi_entry_group_new(avahi, avahi_entry_group_callback, "omghai");
+ 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)));
@@ -262,26 +260,26 @@ int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_entry_group_commit (group);
- domain = avahi_domain_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, avahi_domain_browser_callback, "omghai3u");
-
+ 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, "omghai3u");
+ 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, "omghai3u");
+ 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, "omghai4u");
+ 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
@@ -291,7 +289,7 @@ int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
if (aar == NULL) {
printf ("failed to create address object\n");
} else {
- group2 = avahi_entry_group_new (avahi, avahi_entry_group2_callback, "omghai222");
+ 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));
@@ -317,7 +315,7 @@ int main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_simple_poll_loop(simple_poll);
printf("terminating...\n");
-
+
fail:
if (avahi)
diff --git a/avahi-client/client.c b/avahi-client/client.c
index 389a3d1..6435723 100644
--- a/avahi-client/client.c
+++ b/avahi-client/client.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -35,6 +33,7 @@
#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"
diff --git a/avahi-client/client.h b/avahi-client/client.h
index 2f86d02..1039da5 100644
--- a/avahi-client/client.h
+++ b/avahi-client/client.h
@@ -1,21 +1,19 @@
#ifndef fooclienthfoo
#define fooclienthfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,7 +42,7 @@ typedef enum {
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. */
+ 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 {
@@ -93,7 +91,7 @@ const char* avahi_client_get_domain_name (AvahiClient*);
const char* avahi_client_get_host_name_fqdn (AvahiClient*);
/** Get state */
-AvahiClientState avahi_client_get_state(AvahiClient *client);
+AvahiClientState avahi_client_get_state(AvahiClient *client);
/** @{ \name Error Handling */
diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c
index e2fc3b9..d809d60 100644
--- a/avahi-client/entrygroup.c
+++ b/avahi-client/entrygroup.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -57,23 +55,23 @@ static int retrieve_state(AvahiEntryGroup *group) {
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);
@@ -84,7 +82,7 @@ static int retrieve_state(AvahiEntryGroup *group) {
dbus_message_unref(reply);
return state;
-
+
fail:
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
@@ -120,14 +118,14 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall
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,
@@ -148,7 +146,7 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall
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 */
@@ -161,7 +159,7 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall
avahi_client_set_errno(client, state);
goto fail;
}
-
+
avahi_entry_group_set_state(group, (AvahiEntryGroupState) state);
dbus_message_unref(message);
@@ -177,13 +175,13 @@ fail:
if (group)
avahi_entry_group_free(group);
-
+
if (message)
dbus_message_unref(message);
if (reply)
dbus_message_unref(reply);
-
+
return NULL;
}
@@ -192,23 +190,23 @@ static int entry_group_simple_method_call(AvahiEntryGroup *group, const char *me
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);
@@ -219,7 +217,7 @@ static int entry_group_simple_method_call(AvahiEntryGroup *group, const char *me
dbus_message_unref(reply);
return AVAHI_OK;
-
+
fail:
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
@@ -238,12 +236,12 @@ fail:
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);
@@ -255,7 +253,7 @@ int avahi_entry_group_free(AvahiEntryGroup *group) {
int avahi_entry_group_commit(AvahiEntryGroup *group) {
int ret;
assert(group);
-
+
if (!group->path || !avahi_client_is_connected(group->client))
return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE);
@@ -269,13 +267,13 @@ int avahi_entry_group_commit(AvahiEntryGroup *group) {
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;
}
@@ -285,13 +283,13 @@ int avahi_entry_group_get_state (AvahiEntryGroup *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;
}
@@ -301,7 +299,7 @@ int avahi_entry_group_is_empty (AvahiEntryGroup *group) {
int r = AVAHI_OK;
int b;
AvahiClient *client;
-
+
assert(group);
client = group->client;
@@ -309,18 +307,18 @@ int avahi_entry_group_is_empty (AvahiEntryGroup *group) {
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);
@@ -331,7 +329,7 @@ int avahi_entry_group_is_empty (AvahiEntryGroup *group) {
dbus_message_unref(reply);
return !!b;
-
+
fail:
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
@@ -349,16 +347,16 @@ fail:
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;
}
@@ -373,7 +371,7 @@ static int append_string_list(DBusMessage *message, AvahiStringList *txt) {
/* 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;
@@ -381,7 +379,7 @@ static int append_string_list(DBusMessage *message, AvahiStringList *txt) {
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)))
@@ -412,7 +410,7 @@ int avahi_entry_group_add_service_strlst(
const char *host,
uint16_t port,
AvahiStringList *txt) {
-
+
DBusMessage *message = NULL, *reply = NULL;
int r = AVAHI_OK;
DBusError error;
@@ -434,9 +432,9 @@ int avahi_entry_group_add_service_strlst(
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;
@@ -461,13 +459,13 @@ int avahi_entry_group_add_service_strlst(
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);
@@ -480,7 +478,7 @@ int avahi_entry_group_add_service_strlst(
return AVAHI_OK;
fail:
-
+
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
@@ -506,7 +504,7 @@ int avahi_entry_group_add_service(
const char *host,
uint16_t port,
...) {
-
+
va_list va;
int r;
AvahiStringList *txt;
@@ -552,7 +550,7 @@ int avahi_entry_group_add_service_subtype(
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;
@@ -575,13 +573,13 @@ int avahi_entry_group_add_service_subtype(
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);
@@ -594,7 +592,7 @@ int avahi_entry_group_add_service_subtype(
return AVAHI_OK;
fail:
-
+
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
@@ -615,9 +613,9 @@ int avahi_entry_group_update_service_txt(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
...) {
va_list va;
@@ -637,9 +635,9 @@ int avahi_entry_group_update_service_txt_strlst(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
AvahiStringList *txt) {
DBusMessage *message = NULL, *reply = NULL;
@@ -660,9 +658,9 @@ int avahi_entry_group_update_service_txt_strlst(
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;
@@ -691,7 +689,7 @@ int avahi_entry_group_update_service_txt_strlst(
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);
@@ -704,7 +702,7 @@ int avahi_entry_group_update_service_txt_strlst(
return AVAHI_OK;
fail:
-
+
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
@@ -745,7 +743,7 @@ int avahi_entry_group_add_address(
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;
@@ -754,7 +752,7 @@ int avahi_entry_group_add_address(
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);
@@ -772,13 +770,13 @@ int avahi_entry_group_add_address(
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);
@@ -791,7 +789,7 @@ int avahi_entry_group_add_address(
return AVAHI_OK;
fail:
-
+
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
@@ -834,7 +832,7 @@ int avahi_entry_group_add_record(
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;
@@ -843,7 +841,7 @@ int avahi_entry_group_add_record(
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,
@@ -857,13 +855,13 @@ int avahi_entry_group_add_record(
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);
@@ -876,7 +874,7 @@ int avahi_entry_group_add_record(
return AVAHI_OK;
fail:
-
+
if (dbus_error_is_set(&error)) {
r = avahi_client_set_dbus_error(client, &error);
dbus_error_free(&error);
diff --git a/avahi-client/internal.h b/avahi-client/internal.h
index e49dd15..e5f3beb 100644
--- a/avahi-client/internal.h
+++ b/avahi-client/internal.h
@@ -1,21 +1,19 @@
#ifndef foointernalhfoo
#define foointernalhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -39,10 +37,10 @@ struct AvahiClient {
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);
@@ -65,7 +63,7 @@ struct AvahiEntryGroup {
struct AvahiDomainBrowser {
int ref;
-
+
char *path;
AvahiClient *client;
AvahiDomainBrowserCallback callback;
diff --git a/avahi-client/lookup.h b/avahi-client/lookup.h
index 79224a0..52407f4 100644
--- a/avahi-client/lookup.h
+++ b/avahi-client/lookup.h
@@ -1,8 +1,6 @@
#ifndef fooclientlookuphfoo
#define fooclientlookuphfoo
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -190,11 +188,11 @@ typedef void (*AvahiServiceResolverCallback) (
* resp. AAAA resource record. */
AvahiServiceResolver * avahi_service_resolver_new(
AvahiClient *client,
- AvahiIfIndex interface, /**< Pass the interface argument you recieved in AvahiServiceBrowserCallback here. */
- AvahiProtocol protocol, /**< Pass the protocol argument you recieved in AvahiServiceBrowserCallback here. */
- const char *name, /**< Pass the name argument you recieved in AvahiServiceBrowserCallback here. */
- const char *type, /**< Pass the type argument you recieved in AvahiServiceBrowserCallback here. */
- const char *domain, /**< Pass the domain argument you recieved in AvahiServiceBrowserCallback here. */
+ 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,
diff --git a/avahi-client/publish.h b/avahi-client/publish.h
index 1efc85f..ea731f2 100644
--- a/avahi-client/publish.h
+++ b/avahi-client/publish.h
@@ -1,21 +1,19 @@
#ifndef fooclientpublishhfoo
#define fooclientpublishhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -92,7 +90,7 @@ int avahi_entry_group_add_service(
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 *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;
@@ -127,9 +125,9 @@ int avahi_entry_group_update_service_txt(
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. */,
+ 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. */
@@ -138,9 +136,9 @@ int avahi_entry_group_update_service_txt_strlst(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ const char *name,
+ const char *type,
+ const char *domain,
AvahiStringList *strlst);
/** \cond fulldocs */
diff --git a/avahi-client/resolver.c b/avahi-client/resolver.c
index 4403a12..6ee15e9 100644
--- a/avahi-client/resolver.c
+++ b/avahi-client/resolver.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,7 +46,7 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
assert(client);
assert(message);
-
+
dbus_error_init (&error);
if (!(path = dbus_message_get_path(message)))
@@ -70,7 +68,7 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
uint16_t port;
DBusMessageIter iter, sub;
AvahiAddress a;
-
+
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_INT32, &interface,
@@ -84,48 +82,48 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
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);
}
@@ -137,23 +135,23 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
}
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,
@@ -162,7 +160,7 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
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;
@@ -171,7 +169,7 @@ DBusHandlerResult avahi_service_resolver_event (AvahiClient *client, AvahiResolv
return DBUS_HANDLER_RESULT_HANDLED;
-
+
fail:
dbus_error_free (&error);
avahi_string_list_free(strlst);
@@ -196,7 +194,7 @@ AvahiServiceResolver * avahi_service_resolver_new(
int32_t i_interface, i_protocol, i_aprotocol;
uint32_t u_flags;
char *path;
-
+
assert(client);
assert(type);
@@ -205,7 +203,7 @@ AvahiServiceResolver * avahi_service_resolver_new(
if (!name)
name = "";
-
+
dbus_error_init (&error);
if (!avahi_client_is_connected(client)) {
@@ -225,7 +223,7 @@ AvahiServiceResolver * avahi_service_resolver_new(
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])
@@ -244,8 +242,8 @@ AvahiServiceResolver * avahi_service_resolver_new(
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;
@@ -290,13 +288,13 @@ AvahiServiceResolver * avahi_service_resolver_new(
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)) {
@@ -306,13 +304,13 @@ fail:
if (r)
avahi_service_resolver_free(r);
-
+
if (message)
dbus_message_unref(message);
if (reply)
dbus_message_unref(reply);
-
+
return NULL;
}
@@ -353,7 +351,7 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
assert(client);
assert(message);
-
+
dbus_error_init (&error);
if (!(path = dbus_message_get_path(message)))
@@ -372,7 +370,7 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
uint32_t flags;
char *name, *address;
AvahiAddress a;
-
+
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_INT32, &interface,
@@ -386,20 +384,20 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
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,
@@ -408,7 +406,7 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
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;
@@ -416,7 +414,7 @@ DBusHandlerResult avahi_host_name_resolver_event (AvahiClient *client, AvahiReso
}
return DBUS_HANDLER_RESULT_HANDLED;
-
+
fail:
dbus_error_free (&error);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -439,7 +437,7 @@ AvahiHostNameResolver * avahi_host_name_resolver_new(
int32_t i_interface, i_protocol, i_aprotocol;
uint32_t u_flags;
char *path;
-
+
assert(client);
assert(name);
@@ -462,7 +460,7 @@ AvahiHostNameResolver * avahi_host_name_resolver_new(
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))) {
@@ -517,7 +515,7 @@ AvahiHostNameResolver * avahi_host_name_resolver_new(
dbus_message_unref(reply);
return r;
-
+
fail:
if (dbus_error_is_set(&error)) {
@@ -527,7 +525,7 @@ fail:
if (r)
avahi_host_name_resolver_free(r);
-
+
if (message)
dbus_message_unref(message);
@@ -572,7 +570,7 @@ DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolv
assert(client);
assert(message);
-
+
dbus_error_init (&error);
if (!(path = dbus_message_get_path(message)))
@@ -591,7 +589,7 @@ DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolv
uint32_t flags;
char *name, *address;
AvahiAddress a;
-
+
if (!dbus_message_get_args(
message, &error,
DBUS_TYPE_INT32, &interface,
@@ -605,20 +603,20 @@ DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolv
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,
@@ -627,7 +625,7 @@ DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolv
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;
@@ -635,7 +633,7 @@ DBusHandlerResult avahi_address_resolver_event (AvahiClient *client, AvahiResolv
}
return DBUS_HANDLER_RESULT_HANDLED;
-
+
fail:
dbus_error_free (&error);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -646,7 +644,7 @@ AvahiAddressResolver * avahi_address_resolver_new(
AvahiIfIndex interface,
AvahiProtocol protocol,
const AvahiAddress *a,
- AvahiLookupFlags flags,
+ AvahiLookupFlags flags,
AvahiAddressResolverCallback callback,
void *userdata) {
@@ -685,7 +683,7 @@ AvahiAddressResolver * avahi_address_resolver_new(
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"))) {
@@ -720,7 +718,7 @@ AvahiAddressResolver * avahi_address_resolver_new(
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 */
@@ -733,7 +731,7 @@ AvahiAddressResolver * avahi_address_resolver_new(
dbus_message_unref(reply);
return r;
-
+
fail:
if (dbus_error_is_set(&error)) {
@@ -743,7 +741,7 @@ fail:
if (r)
avahi_address_resolver_free(r);
-
+
if (message)
dbus_message_unref(message);
diff --git a/avahi-client/rr-test.c b/avahi-client/rr-test.c
index 9fffa5d..0402585 100644
--- a/avahi-client/rr-test.c
+++ b/avahi-client/rr-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,11 +35,11 @@ static void hexdump(const void* p, size_t size) {
assert(p);
printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
-
+
while (size > 0) {
unsigned i;
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
if (i < size)
printf("%02x ", c[i]);
else
@@ -54,14 +52,14 @@ static void hexdump(const void* p, size_t size) {
else
printf(" ");
}
-
+
printf("\n");
c += 16;
if (size <= 16)
break;
-
+
size -= 16;
}
}
@@ -91,13 +89,13 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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);
diff --git a/avahi-client/srv-test.c b/avahi-client/srv-test.c
index 5242947..650bd77 100644
--- a/avahi-client/srv-test.c
+++ b/avahi-client/srv-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -56,13 +54,13 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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);
diff --git a/avahi-client/xdg-config-test.c b/avahi-client/xdg-config-test.c
index 2e1c88f..a7ee63e 100644
--- a/avahi-client/xdg-config-test.c
+++ b/avahi-client/xdg-config-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -32,7 +30,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
FILE *f;
f = avahi_xdg_config_open("foo");
-
+
if (f)
fclose(f);
diff --git a/avahi-client/xdg-config.c b/avahi-client/xdg-config.c
index e333f90..fc65016 100644
--- a/avahi-client/xdg-config.c
+++ b/avahi-client/xdg-config.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-client/xdg-config.h b/avahi-client/xdg-config.h
index 88f66a8..6c855ab 100644
--- a/avahi-client/xdg-config.h
+++ b/avahi-client/xdg-config.h
@@ -1,21 +1,19 @@
#ifndef fooxdgconfighfoo
#define fooxdgconfighfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/Makefile.am b/avahi-common/Makefile.am
index b4bc917..79d062f 100644
--- a/avahi-common/Makefile.am
+++ b/avahi-common/Makefile.am
@@ -1,5 +1,3 @@
-# $Id: Makefile.am 90 2005-05-23 16:15:12Z lennart $
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -71,7 +69,7 @@ libavahi_common_la_SOURCES = \
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) $(LIBINTL)
+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 = \
diff --git a/avahi-common/address.c b/avahi-common/address.c
index 270292c..e8f6148 100644
--- a/avahi-common/address.c
+++ b/avahi-common/address.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-common/address.h b/avahi-common/address.h
index 6023a03..a14104f 100644
--- a/avahi-common/address.h
+++ b/avahi-common/address.h
@@ -1,21 +1,19 @@
#ifndef fooaddresshfoo
#define fooaddresshfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/alternative-test.c b/avahi-common/alternative-test.c
index 28ae789..9255435 100644
--- a/avahi-common/alternative-test.c
+++ b/avahi-common/alternative-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -60,19 +58,19 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
"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;
@@ -81,7 +79,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
assert(avahi_is_valid_service_name(n));
else
assert(avahi_is_valid_host_name(n));
-
+
printf("%s\n", r);
}
}
diff --git a/avahi-common/alternative.c b/avahi-common/alternative.c
index 6ff9c35..b3d39f0 100644
--- a/avahi-common/alternative.c
+++ b/avahi-common/alternative.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,12 +35,12 @@ 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;
@@ -58,12 +56,12 @@ char *avahi_alternative_host_name(const char *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;
@@ -94,11 +92,11 @@ char *avahi_alternative_host_name(const char *s) {
}
drop_incomplete_utf8(c);
-
+
r = avahi_strdup_printf("%s-%s", c, m);
avahi_free(c);
avahi_free(m);
-
+
} else {
char *c;
@@ -106,7 +104,7 @@ char *avahi_alternative_host_name(const char *s) {
return NULL;
drop_incomplete_utf8(c);
-
+
r = avahi_strdup_printf("%s-2", c);
avahi_free(c);
}
@@ -124,11 +122,11 @@ char *avahi_alternative_service_name(const char *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;
@@ -141,7 +139,7 @@ char *avahi_alternative_service_name(const char *s) {
if (e && (*e == '0' || *e == 0))
e = NULL;
}
-
+
if (e) {
char *c, *m;
size_t l;
@@ -162,7 +160,7 @@ char *avahi_alternative_service_name(const char *s) {
}
drop_incomplete_utf8(c);
-
+
r = avahi_strdup_printf("%s #%s", c, m);
avahi_free(c);
avahi_free(m);
@@ -171,14 +169,14 @@ char *avahi_alternative_service_name(const char *s) {
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
index f4216f6..9b044de 100644
--- a/avahi-common/alternative.h
+++ b/avahi-common/alternative.h
@@ -1,21 +1,19 @@
#ifndef fooalternativehfoo
#define fooalternativehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/cdecl.h b/avahi-common/cdecl.h
index fc89197..aef6aba 100644
--- a/avahi-common/cdecl.h
+++ b/avahi-common/cdecl.h
@@ -1,21 +1,19 @@
#ifndef foocdeclhfoo
#define foocdeclhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/dbus-watch-glue.c b/avahi-common/dbus-watch-glue.c
index 35e2b45..b18f555 100644
--- a/avahi-common/dbus-watch-glue.c
+++ b/avahi-common/dbus-watch-glue.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -116,7 +114,7 @@ static void dispatch_timeout_callback(AvahiTimeout *t, void *userdata) {
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);
@@ -127,13 +125,13 @@ static void watch_callback(AvahiWatch *avahi_watch, AVAHI_GCC_UNUSED int fd, Ava
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(
@@ -149,14 +147,14 @@ static dbus_bool_t update_watch(const AvahiPoll *poll_api, DBusWatch *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));
}
@@ -166,7 +164,7 @@ static dbus_bool_t update_watch(const AvahiPoll *poll_api, DBusWatch *dbus_watch
static dbus_bool_t add_watch(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
-
+
assert(dbus_watch);
assert(d);
@@ -176,7 +174,7 @@ static dbus_bool_t add_watch(DBusWatch *dbus_watch, void *userdata) {
static void remove_watch(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
AvahiWatch *avahi_watch;
-
+
assert(dbus_watch);
assert(d);
@@ -188,7 +186,7 @@ static void remove_watch(DBusWatch *dbus_watch, void *userdata) {
static void watch_toggled(DBusWatch *dbus_watch, void *userdata) {
ConnectionData *d = userdata;
-
+
assert(dbus_watch);
assert(d);
@@ -217,7 +215,7 @@ static void timeout_data_unref(TimeoutData *t) {
if (--t->ref <= 0) {
if (t->avahi_timeout)
t->poll_api->timeout_free(t->avahi_timeout);
-
+
avahi_free(t);
}
}
@@ -225,7 +223,7 @@ static void timeout_data_unref(TimeoutData *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);
@@ -238,7 +236,7 @@ static void update_timeout(TimeoutData *timeout) {
static void timeout_callback(AvahiTimeout *avahi_timeout, void *userdata) {
TimeoutData *timeout = userdata;
-
+
assert(avahi_timeout);
assert(timeout);
@@ -249,7 +247,7 @@ static void timeout_callback(AvahiTimeout *avahi_timeout, void *userdata) {
if (timeout->avahi_timeout)
update_timeout(timeout);
-
+
timeout_data_unref(timeout);
}
@@ -271,7 +269,7 @@ static dbus_bool_t add_timeout(DBusTimeout *dbus_timeout, void *userdata) {
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,
@@ -311,14 +309,14 @@ static void timeout_toggled(DBusTimeout *dbus_timeout, AVAHI_GCC_UNUSED void *us
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);
@@ -328,10 +326,10 @@ int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
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;
@@ -344,7 +342,7 @@ int avahi_dbus_connection_glue(DBusConnection *c, const AvahiPoll *poll_api) {
request_dispatch(d, 1);
connection_data_unref(d);
-
+
return 0;
fail:
diff --git a/avahi-common/dbus-watch-glue.h b/avahi-common/dbus-watch-glue.h
index 101fa3f..138ea97 100644
--- a/avahi-common/dbus-watch-glue.h
+++ b/avahi-common/dbus-watch-glue.h
@@ -1,21 +1,19 @@
#ifndef foodbuswatchgluehfoo
#define foodbuswatchgluehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/dbus.c b/avahi-common/dbus.c
index ac54848..f19c77c 100644
--- a/avahi-common/dbus.c
+++ b/avahi-common/dbus.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,7 +39,7 @@ static const char * const table[- AVAHI_ERR_MAX] = {
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,
@@ -52,7 +50,7 @@ static const char * const table[- AVAHI_ERR_MAX] = {
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,
@@ -63,7 +61,7 @@ static const char * const table[- AVAHI_ERR_MAX] = {
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,
@@ -74,7 +72,7 @@ static const char * const table[- AVAHI_ERR_MAX] = {
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,
@@ -128,7 +126,7 @@ int avahi_error_dbus_to_number(const char *s) {
for (m = error_map; m->dbus_error; m++)
if (strcmp(m->dbus_error, s) == 0)
return m->avahi_error;
-
+
return AVAHI_ERR_DBUS_ERROR;
}
diff --git a/avahi-common/dbus.h b/avahi-common/dbus.h
index a93988d..ea3e8a2 100644
--- a/avahi-common/dbus.h
+++ b/avahi-common/dbus.h
@@ -1,21 +1,19 @@
#ifndef foodbushfoo
#define foodbushfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/defs.h b/avahi-common/defs.h
index ddeaf9e..bb73a9d 100644
--- a/avahi-common/defs.h
+++ b/avahi-common/defs.h
@@ -1,8 +1,6 @@
#ifndef foodefshfoo
#define foodefshfoo
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -182,13 +180,15 @@
* avahi_client_new(). If the client is forced to disconnect from the
* server it will enter AVAHI_CLIENT_FAILURE state with
* avahi_client_errno() == AVAHI_ERR_DISCONNECTED. Free the
- * AvahiClient object in that case and reconnect to the server anew -
- * again with passing AVAHI_CLIENT_NO_FAIL to avahi_client_new().
+ * 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 in software like iChat
- * compatible IM software.
+ * 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.
*
diff --git a/avahi-common/domain-test.c b/avahi-common/domain-test.c
index 0f7d851..cf763ec 100644
--- a/avahi-common/domain-test.c
+++ b/avahi-common/domain-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,14 +34,14 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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);
@@ -60,7 +58,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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);
@@ -73,7 +71,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
size = sizeof(r);
s = r;
-
+
printf("escaped: <%s>\n", avahi_escape_label(t, strlen(t), &s, &size));
p = r;
@@ -90,7 +88,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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(""));
@@ -120,6 +118,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index 8d339c7..3b1ab68 100644
--- a/avahi-common/domain.c
+++ b/avahi-common/domain.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,13 +41,13 @@
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;
@@ -58,10 +56,10 @@ char *avahi_unescape_label(const char **name, char *dest, size_t size) {
(*name)++;
break;
}
-
+
if (**name == 0)
break;
-
+
if (**name == '\\') {
/* Escaped character */
@@ -70,7 +68,7 @@ char *avahi_unescape_label(const char **name, char *dest, size_t size) {
if (**name == 0)
/* Ending NUL */
return NULL;
-
+
else if (**name == '\\' || **name == '.') {
/* Escaped backslash or dot */
*(d++) = *((*name) ++);
@@ -79,7 +77,7 @@ char *avahi_unescape_label(const char **name, char *dest, size_t size) {
int n;
/* Escaped literal ASCII character */
-
+
if (!isdigit(*(*name+1)) || !isdigit(*(*name+2)))
return NULL;
@@ -87,18 +85,18 @@ char *avahi_unescape_label(const char **name, char *dest, size_t size) {
if (n > 255 || n == 0)
return NULL;
-
+
*(d++) = (char) n;
i++;
(*name) += 3;
} else
return NULL;
-
+
} else {
/* Normal character */
-
+
*(d++) = *((*name) ++);
i++;
}
@@ -130,14 +128,14 @@ char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, si
if (*src == '.' || *src == '\\') {
/* Dot or backslash */
-
+
if (*ret_size < 3)
return NULL;
-
+
*((*ret_name) ++) = '\\';
*((*ret_name) ++) = *src;
(*ret_size) -= 2;
-
+
} else if (
*src == '_' ||
*src == '-' ||
@@ -146,13 +144,13 @@ char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, si
(*src >= 'A' && *src <= 'Z')) {
/* Proper character */
-
+
if (*ret_size < 2)
return NULL;
-
+
*((*ret_name)++) = *src;
(*ret_size) --;
-
+
} else {
/* Everything else */
@@ -164,7 +162,7 @@ char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, si
*((*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;
}
@@ -180,7 +178,7 @@ char *avahi_escape_label(const char* src, size_t src_length, char **ret_name, si
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);
@@ -201,17 +199,17 @@ char *avahi_normalize_name(const char *s, char *ret_s, size_t size) {
return NULL;
}
-
+
if (!empty) {
if (size < 1)
return NULL;
-
+
*(r++) = '.';
size--;
-
+
} else
empty = 0;
-
+
avahi_escape_label(label, strlen(label), &r, &size);
}
@@ -234,7 +232,7 @@ int avahi_domain_equal(const char *a, const char *b) {
if (a == b)
return 1;
-
+
for (;;) {
char ca[AVAHI_LABEL_MAX], cb[AVAHI_LABEL_MAX], *r;
@@ -245,7 +243,7 @@ int avahi_domain_equal(const char *a, const char *b) {
if (strcasecmp(ca, cb))
return 0;
-
+
if (!*a && !*b)
return 1;
}
@@ -267,7 +265,7 @@ int avahi_is_valid_service_type_generic(const char *t) {
if (strlen(label) <= 2 || label[0] != '_')
return 0;
-
+
} while (*t);
return 1;
@@ -281,7 +279,7 @@ int avahi_is_valid_service_type_strict(const char *t) {
return 0;
/* Application name */
-
+
if (!(avahi_unescape_label(&t, label, sizeof(label))))
return 0;
@@ -292,7 +290,7 @@ int avahi_is_valid_service_type_strict(const char *t) {
return 0;
/* _tcp or _udp boilerplate */
-
+
if (!(avahi_unescape_label(&t, label, sizeof(label))))
return 0;
@@ -301,7 +299,7 @@ int avahi_is_valid_service_type_strict(const char *t) {
if (*t)
return 0;
-
+
return 1;
}
@@ -314,7 +312,7 @@ const char *avahi_get_type_from_subtype(const char *t) {
return NULL;
/* Subtype name */
-
+
if (!(avahi_unescape_label(&t, label, sizeof(label))))
return NULL;
@@ -325,7 +323,7 @@ const char *avahi_get_type_from_subtype(const char *t) {
return NULL;
/* String "_sub" */
-
+
if (!(avahi_unescape_label(&t, label, sizeof(label))))
return NULL;
@@ -336,7 +334,7 @@ const char *avahi_get_type_from_subtype(const char *t) {
return NULL;
ret = t;
-
+
/* Application name */
if (!(avahi_unescape_label(&t, label, sizeof(label))))
@@ -347,9 +345,9 @@ const char *avahi_get_type_from_subtype(const char *t) {
if (!*t)
return NULL;
-
+
/* _tcp or _udp boilerplate */
-
+
if (!(avahi_unescape_label(&t, label, sizeof(label))))
return NULL;
@@ -384,12 +382,12 @@ int avahi_is_valid_domain_name(const char *t) {
/* 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;
@@ -400,7 +398,7 @@ int avahi_is_valid_service_name(const char *t) {
if (strlen(t) >= AVAHI_LABEL_MAX || !*t)
return 0;
-
+
return 1;
}
@@ -425,7 +423,7 @@ int avahi_is_valid_host_name(const char *t) {
unsigned avahi_domain_hash(const char *s) {
unsigned hash = 0;
-
+
while (*s) {
char c[AVAHI_LABEL_MAX], *p, *r;
@@ -443,22 +441,22 @@ int avahi_service_name_join(char *p, size_t size, const char *name, const char *
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;
@@ -473,7 +471,7 @@ int avahi_service_name_join(char *p, size_t size, const char *name, const char *
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;
@@ -484,12 +482,12 @@ int avahi_service_name_join(char *p, size_t size, const char *name, const char *
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);
}
@@ -502,7 +500,7 @@ int avahi_service_name_split(const char *p, char *name, size_t name_size, char *
DOMAIN
} state;
int type_empty = 1, domain_empty = 1;
-
+
assert(p);
assert(type);
assert(type_size > 0);
@@ -515,12 +513,12 @@ int avahi_service_name_split(const char *p, char *name, size_t name_size, char *
state = NAME;
} else
state = TYPE;
-
+
*type = *domain = 0;
-
+
while (*p) {
char buf[64];
-
+
if (!(avahi_unescape_label(&p, buf, sizeof(buf))))
return -1;
@@ -537,18 +535,18 @@ int avahi_service_name_split(const char *p, char *name, size_t name_size, char *
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 */
@@ -558,7 +556,7 @@ int avahi_service_name_split(const char *p, char *name, size_t name_size, char *
if (!domain_empty) {
if (!domain_size)
return AVAHI_ERR_NO_MEMORY;
-
+
*(domain++) = '.';
domain_size --;
} else
@@ -603,7 +601,7 @@ int avahi_is_valid_fqdn(const char *t) {
/* 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;
diff --git a/avahi-common/domain.h b/avahi-common/domain.h
index 14d069d..a0dcd0f 100644
--- a/avahi-common/domain.h
+++ b/avahi-common/domain.h
@@ -1,21 +1,19 @@
#ifndef foodomainhfoo
#define foodomainhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/error.c b/avahi-common/error.c
index fb9bd38..b0b66ea 100644
--- a/avahi-common/error.c
+++ b/avahi-common/error.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-common/error.h b/avahi-common/error.h
index 3e4d25f..392aaf5 100644
--- a/avahi-common/error.h
+++ b/avahi-common/error.h
@@ -1,21 +1,19 @@
#ifndef fooerrorhfoo
#define fooerrorhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -29,7 +27,7 @@
AVAHI_C_DECL_BEGIN
/** Error codes used by avahi */
-enum {
+enum {
AVAHI_OK = 0, /**< OK */
AVAHI_ERR_FAILURE = -1, /**< Generic error code */
AVAHI_ERR_BAD_STATE = -2, /**< Object was in a bad state */
@@ -79,17 +77,17 @@ enum {
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_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
@@ -97,7 +95,7 @@ enum {
****
**** Also remember to update the MAX value below.
****/
-
+
AVAHI_ERR_MAX = -54
};
diff --git a/avahi-common/gccmacro.h b/avahi-common/gccmacro.h
index dd49502..4c97111 100644
--- a/avahi-common/gccmacro.h
+++ b/avahi-common/gccmacro.h
@@ -1,21 +1,19 @@
#ifndef foogccmacrohfoo
#define foogccmacrohfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/i18n.c b/avahi-common/i18n.c
index 20f3b3a..51c93e4 100644
--- a/avahi-common/i18n.c
+++ b/avahi-common/i18n.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-common/i18n.h b/avahi-common/i18n.h
index e246736..2a613e5 100644
--- a/avahi-common/i18n.h
+++ b/avahi-common/i18n.h
@@ -1,8 +1,6 @@
#ifndef fooi18nhfoo
#define fooi18nhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-common/llist.h b/avahi-common/llist.h
index 37474e1..e37056d 100644
--- a/avahi-common/llist.h
+++ b/avahi-common/llist.h
@@ -1,21 +1,19 @@
#ifndef foollistfoo
#define foollistfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/malloc.c b/avahi-common/malloc.c
index 51b8ff6..23b13a9 100644
--- a/avahi-common/malloc.c
+++ b/avahi-common/malloc.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,13 +42,13 @@ 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;
@@ -90,7 +88,7 @@ static void *xrealloc(void *p, size_t size) {
/* Default implementation for avahi_calloc() */
static void *xcalloc(size_t nmemb, size_t size) {
void *p;
-
+
if (size == 0 || nmemb == 0)
return NULL;
@@ -104,7 +102,7 @@ void *avahi_malloc(size_t size) {
if (size <= 0)
return NULL;
-
+
if (!allocator)
return xmalloc(size);
@@ -135,7 +133,7 @@ void avahi_free(void *p) {
if (!p)
return;
-
+
if (!allocator) {
free(p);
return;
@@ -162,7 +160,7 @@ void *avahi_realloc(void *p, size_t size) {
char *avahi_strdup(const char *s) {
char *r;
size_t size;
-
+
if (!s)
return NULL;
@@ -178,14 +176,14 @@ 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;
@@ -202,7 +200,7 @@ void avahi_set_allocator(const AvahiAllocator *a) {
char *avahi_strdup_vprintf(const char *fmt, va_list ap) {
size_t len = 80;
char *buf;
-
+
assert(fmt);
if (!(buf = avahi_malloc(len)))
@@ -239,7 +237,7 @@ char *avahi_strdup_printf(const char *fmt, ... ) {
va_list ap;
assert(fmt);
-
+
va_start(ap, fmt);
s = avahi_strdup_vprintf(fmt, ap);
va_end(ap);
diff --git a/avahi-common/malloc.h b/avahi-common/malloc.h
index 511b51c..ffaac3f 100644
--- a/avahi-common/malloc.h
+++ b/avahi-common/malloc.h
@@ -1,21 +1,19 @@
#ifndef foomallochfoo
#define foomallochfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/rlist.c b/avahi-common/rlist.c
index f24ab03..17dcb24 100644
--- a/avahi-common/rlist.c
+++ b/avahi-common/rlist.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -35,7 +33,7 @@ AvahiRList* avahi_rlist_prepend(AvahiRList *r, void *data) {
return NULL;
n->data = data;
-
+
AVAHI_LLIST_PREPEND(AvahiRList, rlist, r, n);
return r;
}
@@ -56,7 +54,7 @@ AvahiRList* avahi_rlist_remove(AvahiRList *r, void *data) {
AvahiRList* avahi_rlist_remove_by_link(AvahiRList *r, AvahiRList *n) {
assert(n);
-
+
AVAHI_LLIST_REMOVE(AvahiRList, rlist, r, n);
avahi_free(n);
diff --git a/avahi-common/rlist.h b/avahi-common/rlist.h
index 0b88955..9bcc1d5 100644
--- a/avahi-common/rlist.h
+++ b/avahi-common/rlist.h
@@ -1,21 +1,19 @@
#ifndef foorlistfoo
#define foorlistfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/simple-watch.c b/avahi-common/simple-watch.c
index c970c3c..8df18dd 100644
--- a/avahi-common/simple-watch.c
+++ b/avahi-common/simple-watch.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,7 +40,7 @@ struct AvahiWatch {
int idx;
struct pollfd pollfd;
-
+
AvahiWatchCallback callback;
void *userdata;
@@ -55,10 +53,10 @@ struct AvahiTimeout {
int enabled;
struct timeval expiry;
-
+
AvahiTimeoutCallback callback;
void *userdata;
-
+
AVAHI_LLIST_FIELDS(AvahiTimeout, timeouts);
};
@@ -111,7 +109,7 @@ static void clear_wakeup(AvahiSimplePoll *s) {
return;
s->wakeup_issued = 0;
-
+
for(;;)
if (read(s->wakeup_pipe[0], &c, sizeof(c)) != sizeof(c))
break;
@@ -119,7 +117,7 @@ static void clear_wakeup(AvahiSimplePoll *s) {
static int set_nonblock(int fd) {
int n;
-
+
assert(fd >= 0);
if ((n = fcntl(fd, F_GETFL)) < 0)
@@ -134,7 +132,7 @@ static int set_nonblock(int fd) {
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);
@@ -147,7 +145,7 @@ static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event
/* 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;
@@ -198,7 +196,7 @@ static void remove_pollfd(AvahiWatch *w) {
if (w->idx == -1)
return;
-
+
w->simple_poll->rebuild_pollfds = 1;
}
@@ -209,9 +207,9 @@ static void watch_free(AvahiWatch *w) {
/* 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;
@@ -225,7 +223,7 @@ static void destroy_watch(AvahiWatch *w) {
if (!w->dead)
w->simple_poll->n_watches --;
-
+
avahi_free(w);
}
@@ -246,7 +244,7 @@ static void cleanup_watches(AvahiSimplePoll *s, int all) {
static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
AvahiTimeout *t;
AvahiSimplePoll *s;
-
+
assert(api);
assert(callback);
@@ -258,13 +256,13 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
/* 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;
@@ -278,7 +276,7 @@ static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
/* 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;
}
@@ -330,7 +328,7 @@ AvahiSimplePoll *avahi_simple_poll_new(void) {
set_nonblock(s->wakeup_pipe[0]);
set_nonblock(s->wakeup_pipe[1]);
-
+
s->api.userdata = s;
s->api.watch_new = watch_new;
@@ -341,14 +339,14 @@ AvahiSimplePoll *avahi_simple_poll_new(void) {
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;
@@ -357,7 +355,7 @@ AvahiSimplePoll *avahi_simple_poll_new(void) {
s->state = STATE_INIT;
s->wakeup_issued = 0;
-
+
avahi_simple_poll_set_func(s, NULL, NULL);
AVAHI_LLIST_HEAD_INIT(AvahiWatch, s->watches);
@@ -372,7 +370,7 @@ void avahi_simple_poll_free(AvahiSimplePoll *s) {
cleanup_timeouts(s, 1);
cleanup_watches(s, 1);
assert(s->n_watches == 0);
-
+
avahi_free(s->pollfds);
if (s->wakeup_pipe[0] >= 0)
@@ -380,34 +378,34 @@ void avahi_simple_poll_free(AvahiSimplePoll *s) {
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)
@@ -429,10 +427,10 @@ static AvahiTimeout* find_next_timeout(AvahiSimplePoll *s) {
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;
}
@@ -451,11 +449,11 @@ static void timeout_callback(AvahiTimeout *t) {
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);
@@ -492,7 +490,7 @@ int avahi_simple_poll_prepare(AvahiSimplePoll *s, int timeout) {
timeout = 0;
goto finish;
}
-
+
gettimeofday(&now, NULL);
usec = avahi_timeval_diff(&next_timeout->expiry, &now);
@@ -520,17 +518,27 @@ finish:
int avahi_simple_poll_run(AvahiSimplePoll *s) {
assert(s);
assert(s->state == STATE_PREPARED || s->state == STATE_FAILURE);
-
+
s->state = STATE_RUNNING;
- if (s->poll_func(s->pollfds, s->n_pollfds, s->prepared_timeout, s->poll_func_userdata) < 0) {
- s->state = STATE_FAILURE;
- return -1;
+ 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;
@@ -545,17 +553,17 @@ int avahi_simple_poll_dispatch(AvahiSimplePoll *s) {
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 */
@@ -566,13 +574,13 @@ int avahi_simple_poll_dispatch(AvahiSimplePoll *s) {
/* 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;
@@ -596,7 +604,7 @@ int avahi_simple_poll_iterate(AvahiSimplePoll *s, int timeout) {
if ((r = avahi_simple_poll_dispatch(s)) != 0)
return r;
-
+
return 0;
}
@@ -611,7 +619,7 @@ void avahi_simple_poll_quit(AvahiSimplePoll *s) {
const AvahiPoll* avahi_simple_poll_get(AvahiSimplePoll *s) {
assert(s);
-
+
return &s->api;
}
@@ -633,7 +641,7 @@ 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)
diff --git a/avahi-common/simple-watch.h b/avahi-common/simple-watch.h
index 7c83db3..72c1905 100644
--- a/avahi-common/simple-watch.h
+++ b/avahi-common/simple-watch.h
@@ -1,21 +1,19 @@
#ifndef foosimplewatchhfoo
#define foosimplewatchhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/strlst-test.c b/avahi-common/strlst-test.c
index 71f748d..0945b37 100644
--- a/avahi-common/strlst-test.c
+++ b/avahi-common/strlst-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,7 +35,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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");
@@ -50,18 +48,18 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
a = avahi_string_list_add_pair(a, "blubb", "blaa");
a = avahi_string_list_add_pair(a, "uxknurz", NULL);
a = avahi_string_list_add_pair_arbitrary(a, "uxknurz2", (const uint8_t*) "blafasel\0oerks", 14);
-
+
a = avahi_string_list_add(a, "end");
t = avahi_string_list_to_string(a);
printf("--%s--\n", t);
avahi_free(t);
-
+
n = avahi_string_list_serialize(a, NULL, 0);
size = avahi_string_list_serialize(a, data, sizeof(data));
assert(size == n);
- printf("%u\n", size);
+ printf("%zu\n", size);
for (t = (char*) data, n = 0; n < size; n++, t++) {
if (*t <= 32)
@@ -71,11 +69,11 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
}
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);
@@ -92,12 +90,12 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
p = avahi_string_list_find(a, "seven");
assert(p);
-
- r = avahi_string_list_get_pair(p, &t, &v, NULL);
+
+ 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);
@@ -113,7 +111,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
printf("<%s>=<%s>\n", t, v);
avahi_free(t);
avahi_free(v);
-
+
avahi_string_list_free(a);
avahi_string_list_free(b);
@@ -124,6 +122,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index f8be273..b861cf8 100644
--- a/avahi-common/strlst.c
+++ b/avahi-common/strlst.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -38,7 +36,7 @@ AvahiStringList*avahi_string_list_add_anonymous(AvahiStringList *l, size_t size)
if (!(n = avahi_malloc(sizeof(AvahiStringList) + size)))
return NULL;
-
+
n->next = l;
n->size = size;
@@ -71,14 +69,14 @@ AvahiStringList *avahi_string_list_add(AvahiStringList *l, const char *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--;
@@ -88,18 +86,18 @@ int avahi_string_list_parse(const void* data, size_t size, AvahiStringList **ret
if (k > 0) { /* Ignore empty strings */
AvahiStringList *n;
- if (!(n = avahi_string_list_add_arbitrary(r, c, k)))
+ if (!(n = avahi_string_list_add_arbitrary(r, c, k)))
goto fail; /* OOM */
r = n;
}
-
+
c += k;
size -= k;
}
*ret = r;
-
+
return 0;
fail:
@@ -146,7 +144,7 @@ char* avahi_string_list_to_string(AvahiStringList *l) {
return NULL;
l = avahi_string_list_reverse(l);
-
+
for (n = l; n; n = n->next) {
if (n != l)
*(e++) = ' ';
@@ -161,7 +159,7 @@ char* avahi_string_list_to_string(AvahiStringList *l) {
}
l = avahi_string_list_reverse(l);
-
+
*e = 0;
return t;
@@ -176,18 +174,18 @@ size_t avahi_string_list_serialize(AvahiStringList *l, void *data, size_t size)
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;
@@ -195,15 +193,15 @@ size_t avahi_string_list_serialize(AvahiStringList *l, void *data, size_t size)
*(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)*/
@@ -211,19 +209,19 @@ size_t avahi_string_list_serialize(AvahiStringList *l, void *data, size_t size)
*(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;
}
@@ -260,7 +258,7 @@ AvahiStringList *avahi_string_list_add_many(AvahiStringList *r, ...) {
va_start(va, r);
r = avahi_string_list_add_many_va(r, va);
va_end(va);
-
+
return r;
}
@@ -328,7 +326,7 @@ unsigned avahi_string_list_length(const AvahiStringList *l) {
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)))
@@ -338,7 +336,7 @@ AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *f
int n;
AvahiStringList *nr;
va_list va2;
-
+
va_copy(va2, va);
n = vsnprintf((char*) r->text, len, format, va2);
va_end(va2);
@@ -358,28 +356,28 @@ AvahiStringList *avahi_string_list_add_vprintf(AvahiStringList *l, const char *f
r = nr;
}
-
+
r->next = l;
- r->size = strlen((char*) r->text);
+ 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;
+ return l;
}
AvahiStringList *avahi_string_list_find(AvahiStringList *l, const char *key) {
size_t n;
-
+
assert(key);
n = strlen(key);
@@ -411,7 +409,7 @@ AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const
return avahi_string_list_add(l, key);
n = strlen(key);
-
+
if (!(l = avahi_string_list_add_anonymous(l, n + 1 + size)))
return NULL;
@@ -424,12 +422,12 @@ AvahiStringList *avahi_string_list_add_pair_arbitrary(AvahiStringList *l, const
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)
if (!(*key = avahi_strdup((char*) l->text)))
return -1;
@@ -447,9 +445,9 @@ int avahi_string_list_get_pair(AvahiStringList *l, char **key, char **value, siz
return -1;
e++; /* Advance after '=' */
-
+
n = l->size - (e - (char*) l->text);
-
+
if (value) {
if (!(*value = avahi_memdup(e, n+1))) {
@@ -487,7 +485,7 @@ 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;
@@ -502,6 +500,6 @@ uint32_t avahi_string_list_get_service_cookie(AvahiStringList *l) {
}
avahi_free(value);
-
+
return ret;
}
diff --git a/avahi-common/strlst.h b/avahi-common/strlst.h
index 8d827d6..94adcea 100644
--- a/avahi-common/strlst.h
+++ b/avahi-common/strlst.h
@@ -1,21 +1,19 @@
#ifndef footxtlisthfoo
#define footxtlisthfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/thread-watch.c b/avahi-common/thread-watch.c
index 4f23608..c0cadeb 100644
--- a/avahi-common/thread-watch.c
+++ b/avahi-common/thread-watch.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-common/thread-watch.h b/avahi-common/thread-watch.h
index 92b5dfc..dec0cf3 100644
--- a/avahi-common/thread-watch.h
+++ b/avahi-common/thread-watch.h
@@ -1,21 +1,19 @@
#ifndef foothreadedwatchhfoo
#define foothreadedwatchhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/timeval-test.c b/avahi-common/timeval-test.c
index 92fcab2..387c180 100644
--- a/avahi-common/timeval-test.c
+++ b/avahi-common/timeval-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -39,7 +37,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
printf("%li.%li\n", a.tv_sec, a.tv_usec);
- printf("%lli\n", avahi_timeval_diff(&a, &b));
+ printf("%lli\n", (long long) avahi_timeval_diff(&a, &b));
return 0;
}
diff --git a/avahi-common/timeval.c b/avahi-common/timeval.c
index edab241..cdb0f09 100644
--- a/avahi-common/timeval.c
+++ b/avahi-common/timeval.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -77,7 +75,7 @@ struct timeval* avahi_timeval_add(struct timeval *a, AvahiUsec usec) {
AvahiUsec avahi_age(const struct timeval *a) {
struct timeval now;
-
+
assert(a);
gettimeofday(&now, NULL);
@@ -100,7 +98,7 @@ struct timeval *avahi_elapse_time(struct timeval *tv, unsigned msec, unsigned ji
time_t now;
int r;
-
+
now = time(NULL);
pthread_mutex_lock(&mutex);
@@ -108,18 +106,18 @@ struct timeval *avahi_elapse_time(struct timeval *tv, unsigned msec, unsigned ji
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
index a441c08..6470f01 100644
--- a/avahi-common/timeval.h
+++ b/avahi-common/timeval.h
@@ -1,21 +1,19 @@
#ifndef footimevalhfoo
#define footimevalhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/utf8-test.c b/avahi-common/utf8-test.c
index d8ffc1b..d12ed58 100644
--- a/avahi-common/utf8-test.c
+++ b/avahi-common/utf8-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -34,6 +32,6 @@ 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
index f52ce55..fa6a318 100644
--- a/avahi-common/utf8.c
+++ b/avahi-common/utf8.c
@@ -1,5 +1,3 @@
-/* $Id */
-
/* This file is based on the GLIB utf8 validation functions. The
* original license text follows. */
@@ -37,8 +35,8 @@
(((Char) & 0xFFFFF800) != 0xD800) && \
((Char) < 0xFDD0 || (Char) > 0xFDEF) && \
((Char) & 0xFFFE) != 0xFFFE)
-
-
+
+
#define CONTINUATION_CHAR \
do { \
if ((*(const unsigned char *)p & 0xc0) != 0x80) /* 10xxxxxx */ \
@@ -60,10 +58,10 @@ avahi_utf8_valid (const char *str)
{
if (*(const unsigned char *)p < 128)
/* done */;
- else
+ else
{
const char *last;
-
+
last = p;
if ((*(const unsigned char *)p & 0xe0) == 0xc0) /* 110xxxxx */
{
@@ -88,7 +86,7 @@ avahi_utf8_valid (const char *str)
}
else
goto error;
-
+
p++;
CONTINUATION_CHAR;
TWO_REMAINING:
@@ -96,16 +94,16 @@ avahi_utf8_valid (const char *str)
CONTINUATION_CHAR;
p++;
CONTINUATION_CHAR;
-
+
if ( (val < min))
goto error;
if ( (!UNICODE_VALID(val)))
goto error;
- }
-
+ }
+
continue;
-
+
error:
return NULL;
}
diff --git a/avahi-common/utf8.h b/avahi-common/utf8.h
index 93c9b59..dc1ce4b 100644
--- a/avahi-common/utf8.h
+++ b/avahi-common/utf8.h
@@ -1,21 +1,19 @@
#ifndef fooutf8hfoo
#define fooutf8hfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-common/watch-test.c b/avahi-common/watch-test.c
index 870045d..6c178ba 100644
--- a/avahi-common/watch-test.c
+++ b/avahi-common/watch-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,7 +46,7 @@ static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNU
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);
@@ -91,7 +89,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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);
@@ -110,8 +108,8 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index 31adad7..86e63d3 100644
--- a/avahi-common/watch.h
+++ b/avahi-common/watch.h
@@ -1,21 +1,19 @@
#ifndef foowatchhfoo
#define foowatchhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -62,7 +60,7 @@ typedef void (*AvahiTimeoutCallback)(AvahiTimeout *t, void *userdata);
struct AvahiPoll {
/** Some abstract user data usable by the provider of the API */
- void* userdata;
+ void* userdata;
/** Create a new watch for the specified file descriptor and for
* the specified events. The API will call the callback function
@@ -88,7 +86,7 @@ struct AvahiPoll {
/** 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);
};
diff --git a/avahi-compat-howl/Makefile.am b/avahi-compat-howl/Makefile.am
index 0940daf..bc67142 100644
--- a/avahi-compat-howl/Makefile.am
+++ b/avahi-compat-howl/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -89,7 +87,7 @@ address_test_SOURCES = \
$(HOWLHEADERS) \
address.c \
address-test.c \
- warn.c warn.h
+ 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
@@ -97,7 +95,7 @@ text_test_SOURCES = \
$(HOWLHEADERS) \
text.c \
text-test.c \
- warn.c warn.h
+ 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
diff --git a/avahi-compat-howl/address-test.c b/avahi-compat-howl/address-test.c
index 05276aa..d9e152f 100644
--- a/avahi-compat-howl/address-test.c
+++ b/avahi-compat-howl/address-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,13 +39,13 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index 1d9fbbe..81b6e6b 100644
--- a/avahi-compat-howl/address.c
+++ b/avahi-compat-howl/address.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -85,10 +83,10 @@ sw_result sw_ipv4_address_init_from_name(
assert(name);
AVAHI_WARN_LINKAGE;
-
+
if (!(he = gethostbyname(name)))
return SW_E_UNKNOWN;
-
+
self->m_addr = *(uint32_t*) he->h_addr;
return SW_OKAY;
}
@@ -113,7 +111,7 @@ sw_result sw_ipv4_address_init_from_this_host(sw_ipv4_address *self) {
assert(self);
AVAHI_WARN_LINKAGE;
-
+
/* This is so fucked up ... */
memset(&sa, 0, sizeof(sa));
@@ -135,7 +133,7 @@ sw_result sw_ipv4_address_init_from_this_host(sw_ipv4_address *self) {
close(fd);
self->m_addr = sa.sin_addr.s_addr;
-
+
return SW_OKAY;
}
@@ -144,7 +142,7 @@ sw_result sw_ipv4_address_fina(AVAHI_GCC_UNUSED sw_ipv4_address self) {
AVAHI_WARN_LINKAGE;
/* This is ridiculous ... */
-
+
return SW_OKAY;
}
@@ -170,10 +168,10 @@ sw_string sw_ipv4_address_name(
if (len < INET_ADDRSTRLEN)
return NULL;
-
+
if (!(inet_ntop(AF_INET, &self.m_addr, name, len)))
return NULL;
-
+
return name;
}
@@ -187,9 +185,9 @@ sw_result sw_ipv4_address_decompose(
uint32_t a;
AVAHI_WARN_LINKAGE;
-
+
a = ntohl(self.m_addr);
-
+
assert(a1);
assert(a2);
assert(a3);
@@ -199,7 +197,7 @@ sw_result sw_ipv4_address_decompose(
*a2 = (uint8_t) (a >> 16);
*a3 = (uint8_t) (a >> 8);
*a4 = (uint8_t) (a);
-
+
return SW_OKAY;
}
diff --git a/avahi-compat-howl/browse-domain-test.c b/avahi-compat-howl/browse-domain-test.c
index be99d92..b5a4a01 100644
--- a/avahi-compat-howl/browse-domain-test.c
+++ b/avahi-compat-howl/browse-domain-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -54,7 +52,7 @@ static sw_result reply(
case SW_DISCOVERY_BROWSE_INVALID:
fprintf(stderr, "some kind of failure happened: %s\n", domain);
break;
-
+
default:
abort();
}
@@ -65,12 +63,12 @@ static sw_result reply(
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
index e436208..9b8b18c 100644
--- a/avahi-compat-howl/compat.c
+++ b/avahi-compat-howl/compat.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -87,7 +85,7 @@ struct _sw_discovery {
sw_discovery_oid oid_index;
int thread_fd, main_fd;
-
+
pthread_t thread;
int thread_running;
@@ -121,7 +119,7 @@ static sw_result map_error(int error) {
switch (error) {
case AVAHI_OK:
return SW_OKAY;
-
+
case AVAHI_ERR_NO_MEMORY:
return SW_E_MEM;
}
@@ -134,7 +132,7 @@ static int read_command(int fd) {
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;
@@ -157,9 +155,9 @@ static int write_command(int fd, char reply) {
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));
@@ -173,7 +171,7 @@ static void * thread_func(void *data) {
sigfillset(&mask);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
+
self->thread = pthread_self();
self->thread_running = 1;
@@ -184,7 +182,7 @@ static void * thread_func(void *data) {
break;
/* fprintf(stderr, "Command: %c\n", command); */
-
+
switch (command) {
case COMMAND_POLL: {
@@ -194,30 +192,30 @@ static void * thread_func(void *data) {
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;
@@ -231,13 +229,13 @@ static int oid_alloc(sw_discovery self, oid_type type) {
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 ++;
}
@@ -245,7 +243,7 @@ static int oid_alloc(sw_discovery self, oid_type type) {
}
/* No free entry found */
-
+
return (sw_discovery_oid) -1;
}
@@ -271,22 +269,22 @@ static oid_data* oid_get(sw_discovery self, sw_discovery_oid oid) {
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) {
@@ -294,7 +292,7 @@ static void service_data_free(sw_discovery self, service_data* sdata) {
assert(sdata);
AVAHI_LLIST_REMOVE(service_data, services, self->services, sdata);
-
+
avahi_free(sdata->name);
avahi_free(sdata->regtype);
avahi_free(sdata->domain);
@@ -308,12 +306,12 @@ 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) {
@@ -341,16 +339,16 @@ sw_result sw_discovery_init(sw_discovery * self) {
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;
@@ -365,7 +363,7 @@ sw_result sw_discovery_init(sw_discovery * self) {
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);
@@ -384,7 +382,7 @@ sw_result sw_discovery_init(sw_discovery * self) {
result = map_error(error);
goto fail;
}
-
+
/* Start simple poll */
if (avahi_simple_poll_prepare((*self)->simple_poll, -1) < 0)
goto fail;
@@ -392,12 +390,12 @@ sw_result sw_discovery_init(sw_discovery * self) {
/* 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:
@@ -416,9 +414,9 @@ static int stop_thread(sw_discovery self) {
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;
@@ -459,24 +457,24 @@ static void discovery_unref(sw_discovery self) {
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);
@@ -484,7 +482,7 @@ sw_result sw_discovery_run(sw_discovery self) {
sw_result sw_discovery_stop_run(sw_discovery self) {
assert(self);
-
+
AVAHI_WARN_LINKAGE;
return sw_salt_stop_run((sw_salt) self);
@@ -492,7 +490,7 @@ sw_result sw_discovery_stop_run(sw_discovery self) {
int sw_discovery_socket(sw_discovery self) {
assert(self);
-
+
AVAHI_WARN_LINKAGE;
return self->main_fd;
@@ -500,17 +498,17 @@ int sw_discovery_socket(sw_discovery self) {
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;
@@ -525,26 +523,26 @@ sw_result sw_discovery_read_socket(sw_discovery self) {
/* 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;
}
@@ -557,34 +555,34 @@ sw_result sw_salt_step(sw_salt self, sw_uint32 * msec) {
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;
}
@@ -594,7 +592,7 @@ sw_result sw_salt_run(sw_salt self) {
AVAHI_WARN_LINKAGE;
assert(self);
-
+
for (;;)
if ((ret = sw_salt_step(self, NULL)) != SW_OKAY)
return ret;
@@ -622,7 +620,7 @@ sw_result sw_salt_lock(sw_salt self) {
sw_result sw_salt_unlock(sw_salt self) {
assert(self);
-
+
AVAHI_WARN_LINKAGE;
ASSERT_SUCCESS(pthread_mutex_unlock(&((sw_discovery) self)->salt_mutex));
@@ -634,9 +632,9 @@ 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,
@@ -646,11 +644,11 @@ static void reg_report_status(oid_data *data, sw_discovery_publish_status status
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,
@@ -663,7 +661,7 @@ static int reg_create_service(oid_data *data) {
data->service_data->port,
data->service_data->txt)) < 0)
return ret;
-
+
if (real_type) {
/* Create a subtype entry */
@@ -692,12 +690,12 @@ static void reg_client_callback(oid_data *data, AvahiClientState state) {
/* 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;
@@ -706,10 +704,10 @@ static void reg_client_callback(oid_data *data, AvahiClientState state) {
reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
return;
}
-
+
break;
}
-
+
case AVAHI_CLIENT_S_COLLISION:
case AVAHI_CLIENT_S_REGISTERING:
@@ -749,7 +747,7 @@ static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState st
case AVAHI_ENTRY_GROUP_FAILURE:
reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
break;
-
+
}
}
@@ -771,13 +769,13 @@ sw_result sw_discovery_publish(
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)
@@ -820,7 +818,7 @@ sw_result sw_discovery_publish(
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;
@@ -832,8 +830,8 @@ sw_result sw_discovery_publish(
finish:
ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
- if (result != SW_OKAY)
+
+ if (result != SW_OKAY)
if (*oid != (sw_discovery_oid) -1)
sw_discovery_cancel(self, *oid);
@@ -872,7 +870,7 @@ static void domain_browser_callback(
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;
@@ -885,15 +883,15 @@ sw_result sw_discovery_browse_domains(
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)
@@ -903,11 +901,11 @@ sw_result sw_discovery_browse_domains(
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;
@@ -918,7 +916,7 @@ sw_result sw_discovery_browse_domains(
finish:
ASSERT_SUCCESS(pthread_mutex_unlock(&self->mutex));
-
+
if (result != SW_OKAY)
if (*oid != (sw_discovery_oid) -1)
sw_discovery_cancel(self, *oid);
@@ -943,7 +941,7 @@ static void service_resolver_callback(
oid_data* data = userdata;
sw_discovery_resolve_reply reply;
-
+
assert(r);
assert(data);
@@ -960,7 +958,7 @@ static void service_resolver_callback(
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);
@@ -973,7 +971,7 @@ static void service_resolver_callback(
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!",
@@ -996,13 +994,13 @@ sw_result sw_discovery_resolve(
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)
@@ -1012,22 +1010,22 @@ sw_result sw_discovery_resolve(
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);
@@ -1049,7 +1047,7 @@ static void service_browser_callback(
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);
@@ -1070,7 +1068,7 @@ static void service_browser_callback(
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;
@@ -1089,12 +1087,12 @@ sw_result sw_discovery_browse(
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)
@@ -1104,22 +1102,22 @@ sw_result sw_discovery_browse(
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);
@@ -1129,7 +1127,7 @@ finish:
sw_result sw_discovery_cancel(sw_discovery self, sw_discovery_oid oid) {
oid_data *data;
- assert(self);
+ assert(self);
AVAHI_WARN_LINKAGE;
@@ -1141,19 +1139,19 @@ sw_result sw_discovery_cancel(sw_discovery self, sw_discovery_oid oid) {
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:
;
}
@@ -1165,7 +1163,7 @@ sw_result sw_discovery_cancel(sw_discovery self, sw_discovery_oid oid) {
}
oid_release(self, oid);
-
+
return SW_OKAY;
}
diff --git a/avahi-compat-howl/funcs.txt b/avahi-compat-howl/funcs.txt
index 42fbb71..fad8ebf 100644
--- a/avahi-compat-howl/funcs.txt
+++ b/avahi-compat-howl/funcs.txt
@@ -180,5 +180,3 @@ sw_corby_object_set_channel
sw_text_record_string_iterator_init
sw_text_record_string_iterator_fina
sw_text_record_string_iterator_next
-
-$Id$
diff --git a/avahi-compat-howl/include/corby/buffer.h b/avahi-compat-howl/include/corby/buffer.h
index 017ad5d..3c4416e 100644
--- a/avahi-compat-howl/include/corby/buffer.h
+++ b/avahi-compat-howl/include/corby/buffer.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -36,7 +36,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
struct _sw_corby_buffer;
@@ -128,7 +128,7 @@ sw_corby_buffer_fina(
void HOWL_API
sw_corby_buffer_reset(
sw_corby_buffer self);
-
+
sw_result HOWL_API
sw_corby_buffer_set_octets(
@@ -136,21 +136,21 @@ sw_corby_buffer_set_octets(
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(
@@ -193,14 +193,14 @@ 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(
@@ -218,7 +218,7 @@ 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(
@@ -273,7 +273,7 @@ sw_corby_buffer_allocate_and_get_sized_octets(
sw_octets * val,
sw_uint32 * size,
sw_uint8 endian);
-
+
sw_result HOWL_API
sw_corby_buffer_get_zerocopy_sized_octets(
@@ -281,7 +281,7 @@ sw_corby_buffer_get_zerocopy_sized_octets(
sw_octets * val,
sw_uint32 * size,
sw_uint8 endian);
-
+
sw_result HOWL_API
sw_corby_buffer_get_sized_octets(
@@ -297,15 +297,15 @@ sw_corby_buffer_allocate_and_get_cstring(
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(
@@ -313,18 +313,18 @@ sw_corby_buffer_get_cstring(
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
#endif
diff --git a/avahi-compat-howl/include/corby/channel.h b/avahi-compat-howl/include/corby/channel.h
index 823e027..9c91fbb 100644
--- a/avahi-compat-howl/include/corby/channel.h
+++ b/avahi-compat-howl/include/corby/channel.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -38,7 +38,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
struct _sw_corby_channel;
typedef struct _sw_corby_channel * sw_corby_channel;
@@ -180,7 +180,7 @@ sw_corby_channel_fina(
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/avahi-compat-howl/include/corby/corby.h b/avahi-compat-howl/include/corby/corby.h
index 7d68138..5e069ff 100644
--- a/avahi-compat-howl/include/corby/corby.h
+++ b/avahi-compat-howl/include/corby/corby.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -38,9 +38,9 @@
/*
- * protocol tags. the only standard one is TAG_INTERNET_IIOP.
+ * 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
diff --git a/avahi-compat-howl/include/corby/message.h b/avahi-compat-howl/include/corby/message.h
index 406b9b9..a06c358 100644
--- a/avahi-compat-howl/include/corby/message.h
+++ b/avahi-compat-howl/include/corby/message.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -54,7 +54,7 @@ sw_corby_message_fina(
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/avahi-compat-howl/include/corby/object.h b/avahi-compat-howl/include/corby/object.h
index 1bc7407..1cfd516 100644
--- a/avahi-compat-howl/include/corby/object.h
+++ b/avahi-compat-howl/include/corby/object.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -64,7 +64,7 @@ sw_corby_object_init_from_url(
sw_result HOWL_API
sw_corby_object_fina(
sw_corby_object self);
-
+
sw_result HOWL_API
sw_corby_object_start_request(
diff --git a/avahi-compat-howl/include/corby/orb.h b/avahi-compat-howl/include/corby/orb.h
index a674082..76af578 100644
--- a/avahi-compat-howl/include/corby/orb.h
+++ b/avahi-compat-howl/include/corby/orb.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -38,7 +38,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
struct _sw_corby_orb;
@@ -165,7 +165,7 @@ sw_corby_orb_protocol_to_address(
sw_const_string tag,
sw_string addr,
sw_port * port);
-
+
sw_result HOWL_API
sw_corby_orb_protocol_to_url(
@@ -193,7 +193,7 @@ sw_corby_orb_dispatch_message(
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/avahi-compat-howl/include/discovery/discovery.h b/avahi-compat-howl/include/discovery/discovery.h
index 1e8a7d5..082373d 100644
--- a/avahi-compat-howl/include/discovery/discovery.h
+++ b/avahi-compat-howl/include/discovery/discovery.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -52,7 +52,7 @@ typedef sw_uint32 sw_discovery_oid;
/*
* For backwards compatibility
*/
-#define sw_discovery_publish_host_id sw_discovery_oid
+#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
@@ -107,7 +107,7 @@ typedef sw_result
sw_discovery_publish_status status,
sw_opaque extra);
-typedef sw_result
+typedef sw_result
(HOWL_API *sw_discovery_browse_reply)(
sw_discovery session,
sw_discovery_oid oid,
@@ -142,10 +142,10 @@ typedef sw_result
sw_const_string fullname,
sw_uint16 rrtype,
sw_uint16 rrclass,
- sw_uint16 rrdatalen,
+ sw_uint16 rrdatalen,
sw_const_octets rrdata,
sw_uint32 ttl,
- sw_opaque extra);
+ sw_opaque extra);
/*
@@ -254,7 +254,7 @@ sw_discovery_query_record(
sw_const_string fullname,
sw_uint16 rrtype,
sw_uint16 rrclass,
- sw_discovery_query_record_reply reply,
+ sw_discovery_query_record_reply reply,
sw_opaque extra,
sw_discovery_oid * oid);
@@ -263,7 +263,7 @@ sw_result HOWL_API
sw_discovery_cancel(
sw_discovery self,
sw_discovery_oid oid);
-
+
/* ----------------------------------------------------------
@@ -272,7 +272,7 @@ sw_discovery_cancel(
*
* ----------------------------------------------------------
*/
-
+
sw_result HOWL_API
sw_discovery_run(
@@ -282,7 +282,7 @@ sw_discovery_run(
sw_result HOWL_API
sw_discovery_stop_run(
sw_discovery self);
-
+
int HOWL_API
sw_discovery_socket(
diff --git a/avahi-compat-howl/include/discovery/text_record.h b/avahi-compat-howl/include/discovery/text_record.h
index 91f16d7..a5ee802 100644
--- a/avahi-compat-howl/include/discovery/text_record.h
+++ b/avahi-compat-howl/include/discovery/text_record.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
diff --git a/avahi-compat-howl/include/howl.h b/avahi-compat-howl/include/howl.h
index 80a1775..dac6d43 100644
--- a/avahi-compat-howl/include/howl.h
+++ b/avahi-compat-howl/include/howl.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
diff --git a/avahi-compat-howl/include/rendezvous/rendezvous.h b/avahi-compat-howl/include/rendezvous/rendezvous.h
index 1d26b4a..12c85e8 100644
--- a/avahi-compat-howl/include/rendezvous/rendezvous.h
+++ b/avahi-compat-howl/include/rendezvous/rendezvous.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
diff --git a/avahi-compat-howl/include/rendezvous/text_record.h b/avahi-compat-howl/include/rendezvous/text_record.h
index cf8b845..3e2bfc2 100644
--- a/avahi-compat-howl/include/rendezvous/text_record.h
+++ b/avahi-compat-howl/include/rendezvous/text_record.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
diff --git a/avahi-compat-howl/include/salt/address.h b/avahi-compat-howl/include/salt/address.h
index b18a4af..ea83f8d 100644
--- a/avahi-compat-howl/include/salt/address.h
+++ b/avahi-compat-howl/include/salt/address.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -91,7 +91,7 @@ sw_ipv4_address_fina(
sw_bool HOWL_API
sw_ipv4_address_is_any(
sw_ipv4_address self);
-
+
sw_saddr HOWL_API
sw_ipv4_address_saddr(
diff --git a/avahi-compat-howl/include/salt/debug.h b/avahi-compat-howl/include/salt/debug.h
index 03bd453..c53977b 100644
--- a/avahi-compat-howl/include/salt/debug.h
+++ b/avahi-compat-howl/include/salt/debug.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -36,7 +36,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
#define SW_LOG_WARNING 1 << 0
diff --git a/avahi-compat-howl/include/salt/interface.h b/avahi-compat-howl/include/salt/interface.h
index 5356398..a4b1b1d 100644
--- a/avahi-compat-howl/include/salt/interface.h
+++ b/avahi-compat-howl/include/salt/interface.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
diff --git a/avahi-compat-howl/include/salt/platform.h b/avahi-compat-howl/include/salt/platform.h
index fda0c77..6bb9dcc 100644
--- a/avahi-compat-howl/include/salt/platform.h
+++ b/avahi-compat-howl/include/salt/platform.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -33,7 +33,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
#if defined(__VXWORKS__)
@@ -119,7 +119,7 @@ typedef int sw_result;
* for little endian platforms.
*
* The macro WORDS_BIGENDIAN will be defined
- * by autoconf. If you are using Howl on
+ * by autoconf. If you are using Howl on
* a platform that doesn't have autoconf, define
* SW_ENDIAN directly
* --------------------------------------------------------
@@ -185,19 +185,19 @@ 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)
@@ -413,7 +413,7 @@ sw_strerror();
/*
* Obsolete types and macros.
- *
+ *
* These are here for backwards compatibility, but will
* be removed in the future
*/
diff --git a/avahi-compat-howl/include/salt/salt.h b/avahi-compat-howl/include/salt/salt.h
index 88ac0d9..ddb289b 100644
--- a/avahi-compat-howl/include/salt/salt.h
+++ b/avahi-compat-howl/include/salt/salt.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -36,14 +36,14 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
typedef enum _sw_socket_event
{
SW_SOCKET_READ = (1 << 0),
SW_SOCKET_WRITE = (1 << 1),
- SW_SOCKET_OOB = (1 << 2)
+ SW_SOCKET_OOB = (1 << 2)
} sw_socket_event;
@@ -80,7 +80,7 @@ typedef sw_result
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)(
@@ -95,13 +95,13 @@ 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,
@@ -116,8 +116,8 @@ 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,
@@ -126,8 +126,8 @@ sw_salt_register_timer(
sw_timer_handler handler,
sw_timer_handler_func func,
sw_opaque extra);
-
-
+
+
sw_result HOWL_API
sw_salt_unregister_timer(
sw_salt self,
@@ -187,7 +187,7 @@ sw_salt_run(
sw_result HOWL_API
sw_salt_stop_run(
sw_salt self);
-
+
#define SW_FALSE 0
#define SW_TRUE 1
diff --git a/avahi-compat-howl/include/salt/signal.h b/avahi-compat-howl/include/salt/signal.h
index 2ae5bb3..b36e02f 100644
--- a/avahi-compat-howl/include/salt/signal.h
+++ b/avahi-compat-howl/include/salt/signal.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -35,7 +35,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
struct _sw_signal;
@@ -55,7 +55,7 @@ sw_signal_fina(
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/avahi-compat-howl/include/salt/socket.h b/avahi-compat-howl/include/salt/socket.h
index 88773e4..9eaa102 100644
--- a/avahi-compat-howl/include/salt/socket.h
+++ b/avahi-compat-howl/include/salt/socket.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -36,7 +36,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
struct _sw_socket;
@@ -66,8 +66,8 @@ sw_udp_socket_init(
sw_result HOWL_API
sw_multicast_socket_init(
sw_socket * self);
-
-
+
+
sw_result HOWL_API
sw_socket_fina(
sw_socket self);
@@ -97,21 +97,21 @@ 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,
@@ -129,7 +129,7 @@ sw_socket_sendto(
sw_ipv4_address to,
sw_port port);
-
+
sw_result HOWL_API
sw_socket_recv(
sw_socket self,
@@ -154,13 +154,13 @@ 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(
@@ -185,31 +185,31 @@ sw_socket_close(
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,
@@ -221,8 +221,8 @@ 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,
@@ -233,8 +233,8 @@ 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,
@@ -242,7 +242,7 @@ sw_socket_options_set_sndbuf(
int
-sw_socket_error_code(void);
+sw_socket_error_code(void);
#define SW_E_SOCKET_BASE 0x80000200
@@ -257,7 +257,7 @@ sw_socket_error_code(void);
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/avahi-compat-howl/include/salt/time.h b/avahi-compat-howl/include/salt/time.h
index b3ec226..8789b3a 100644
--- a/avahi-compat-howl/include/salt/time.h
+++ b/avahi-compat-howl/include/salt/time.h
@@ -8,7 +8,7 @@
* 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.
+ * 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.
@@ -35,7 +35,7 @@
#ifdef __cplusplus
extern "C"
{
-#endif
+#endif
struct _sw_timer;
@@ -94,7 +94,7 @@ sw_time_cmp(
#ifdef __cplusplus
}
-#endif
+#endif
#endif
diff --git a/avahi-compat-howl/samples/Makefile.am b/avahi-compat-howl/samples/Makefile.am
index bda07b1..5efa19e 100644
--- a/avahi-compat-howl/samples/Makefile.am
+++ b/avahi-compat-howl/samples/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-compat-howl/samples/browse.c b/avahi-compat-howl/samples/browse.c
index b4a8cf3..f55b1cf 100644
--- a/avahi-compat-howl/samples/browse.c
+++ b/avahi-compat-howl/samples/browse.c
@@ -5,7 +5,7 @@
* 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.
+ * 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.
@@ -54,7 +54,7 @@ my_resolver(
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'))
diff --git a/avahi-compat-howl/samples/publish.c b/avahi-compat-howl/samples/publish.c
index cca6040..931e786 100644
--- a/avahi-compat-howl/samples/publish.c
+++ b/avahi-compat-howl/samples/publish.c
@@ -5,7 +5,7 @@
* 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.
+ * 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.
diff --git a/avahi-compat-howl/samples/query.c b/avahi-compat-howl/samples/query.c
index a74a81c..b1c30eb 100644
--- a/avahi-compat-howl/samples/query.c
+++ b/avahi-compat-howl/samples/query.c
@@ -5,7 +5,7 @@
* 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.
+ * 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.
@@ -40,7 +40,7 @@ query_record_reply(
sw_const_string fullname,
sw_uint16 rrtype,
sw_uint16 rrclass,
- sw_uint16 rrdatalen,
+ sw_uint16 rrdatalen,
sw_const_octets rrdata,
sw_uint32 ttl,
sw_opaque extra)
diff --git a/avahi-compat-howl/samples/resolve.c b/avahi-compat-howl/samples/resolve.c
index b921c27..1790849 100644
--- a/avahi-compat-howl/samples/resolve.c
+++ b/avahi-compat-howl/samples/resolve.c
@@ -5,7 +5,7 @@
* 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.
+ * 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.
@@ -54,7 +54,7 @@ my_resolver(
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'))
diff --git a/avahi-compat-howl/text-test.c b/avahi-compat-howl/text-test.c
index fea653c..66ff58b 100644
--- a/avahi-compat-howl/text-test.c
+++ b/avahi-compat-howl/text-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,7 +34,7 @@ static void hexdump(const void* p, size_t size) {
const uint8_t *c = p;
assert(p);
- printf("Dumping %u bytes from %p:\n", size, p);
+ printf("Dumping %zu bytes from %p:\n", size, p);
while (size > 0) {
unsigned i;
@@ -72,12 +70,12 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
char key[255];
uint8_t val[255];
sw_ulong val_len;
-
+
ASSERT_SW_OKAY(sw_text_record_init(&r));
ASSERT_SW_OKAY(sw_text_record_add_string(r, "foo=bar"));
ASSERT_SW_OKAY(sw_text_record_add_string(r, "waldo=baz"));
ASSERT_SW_OKAY(sw_text_record_add_key_and_string_value(r, "quux", "nimpf"));
- ASSERT_SW_OKAY(sw_text_record_add_key_and_binary_value(r, "quux", "\0\0\0\0", 4));
+ 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));
@@ -92,7 +90,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
-
+
ASSERT_SW_OKAY(sw_text_record_fina(r));
return 0;
diff --git a/avahi-compat-howl/text.c b/avahi-compat-howl/text.c
index 3b717be..7ef4df3 100644
--- a/avahi-compat-howl/text.c
+++ b/avahi-compat-howl/text.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,12 +42,12 @@ struct _sw_text_record {
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);
}
@@ -59,17 +57,17 @@ 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;
}
@@ -89,12 +87,12 @@ sw_result sw_text_record_add_string(
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;
@@ -112,7 +110,7 @@ sw_result sw_text_record_add_key_and_string_value(
assert(self);
assert(key);
-
+
AVAHI_WARN_LINKAGE;
if (!(n = avahi_string_list_add_pair(self->strlst, key, val)))
@@ -134,7 +132,7 @@ sw_result sw_text_record_add_key_and_binary_value(
assert(self);
assert(key);
assert(len || !val);
-
+
AVAHI_WARN_LINKAGE;
if (!(n = avahi_string_list_add_pair_arbitrary(self->strlst, key, val, len)))
@@ -152,10 +150,10 @@ static int rebuild(sw_text_record self) {
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;
@@ -177,7 +175,7 @@ sw_uint32 sw_text_record_len(sw_text_record self) {
assert(self);
AVAHI_WARN_LINKAGE;
-
+
if (rebuild(self) < 0)
return (uint32_t) -1;
@@ -186,7 +184,7 @@ sw_uint32 sw_text_record_len(sw_text_record self) {
struct _sw_text_record_iterator {
AvahiStringList *strlst, *index;
-
+
};
sw_result sw_text_record_iterator_init(
@@ -198,7 +196,7 @@ sw_result sw_text_record_iterator_init(
assert(self);
AVAHI_WARN_LINKAGE;
-
+
if (!(*self = avahi_new(struct _sw_text_record_iterator, 1))) {
*self = NULL;
return SW_E_UNKNOWN;
@@ -211,7 +209,7 @@ sw_result sw_text_record_iterator_init(
}
(*self)->index = (*self)->strlst = avahi_string_list_reverse(txt);
-
+
return SW_OKAY;
}
@@ -222,7 +220,7 @@ sw_result sw_text_record_iterator_fina(sw_text_record_iterator self) {
avahi_string_list_free(self->strlst);
avahi_free(self);
-
+
return SW_OKAY;
}
@@ -234,10 +232,10 @@ sw_result sw_text_record_iterator_next(
char *mkey = NULL, *mvalue = NULL;
size_t msize = 0;
-
+
assert(self);
assert(key);
-
+
AVAHI_WARN_LINKAGE;
if (!self->index)
@@ -250,7 +248,7 @@ sw_result sw_text_record_iterator_next(
memset(val, 0, SW_TEXT_RECORD_MAX_LEN);
memcpy(val, mvalue, msize);
*val_len = msize;
-
+
avahi_free(mkey);
avahi_free(mvalue);
diff --git a/avahi-compat-howl/unsupported.c b/avahi-compat-howl/unsupported.c
index 800b3c3..ff440af 100644
--- a/avahi-compat-howl/unsupported.c
+++ b/avahi-compat-howl/unsupported.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -97,14 +95,14 @@ sw_time sw_time_add(
AVAHI_WARN_UNSUPPORTED_ABORT;
}
-AVAHI_GCC_NORETURN
+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
+AVAHI_GCC_NORETURN
sw_int32 sw_time_cmp(
AVAHI_GCC_UNUSED sw_time self,
AVAHI_GCC_UNUSED sw_time y) {
@@ -338,17 +336,17 @@ sw_result sw_socket_set_options(
return SW_E_NO_IMPL;
}
-AVAHI_GCC_NORETURN
+AVAHI_GCC_NORETURN
sw_ipv4_address sw_socket_ipv4_address(AVAHI_GCC_UNUSED sw_socket self) {
AVAHI_WARN_UNSUPPORTED_ABORT;
}
-AVAHI_GCC_NORETURN
+AVAHI_GCC_NORETURN
sw_port sw_socket_port(AVAHI_GCC_UNUSED sw_socket self) {
AVAHI_WARN_UNSUPPORTED_ABORT;
}
-AVAHI_GCC_NORETURN
+AVAHI_GCC_NORETURN
sw_sockdesc_t sw_socket_desc(AVAHI_GCC_UNUSED sw_socket self) {
AVAHI_WARN_UNSUPPORTED_ABORT;
}
@@ -425,7 +423,7 @@ sw_result sw_socket_options_set_sndbuf(
return SW_E_NO_IMPL;
}
-AVAHI_GCC_NORETURN
+AVAHI_GCC_NORETURN
int sw_socket_error_code(void) {
AVAHI_WARN_UNSUPPORTED_ABORT;
}
@@ -478,7 +476,7 @@ sw_result sw_corby_orb_register_channel(
return SW_E_NO_IMPL;
}
-AVAHI_GCC_NORETURN
+AVAHI_GCC_NORETURN
sw_corby_orb_delegate sw_corby_orb_get_delegate(AVAHI_GCC_UNUSED sw_corby_orb self) {
AVAHI_WARN_UNSUPPORTED_ABORT;
}
@@ -581,7 +579,7 @@ sw_result sw_corby_buffer_init_with_size_and_delegate(
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;
@@ -667,7 +665,7 @@ sw_result sw_corby_buffer_put_sized_octets(
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) {
@@ -710,7 +708,7 @@ sw_result sw_corby_buffer_get_int16(
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,
@@ -718,7 +716,7 @@ sw_result sw_corby_buffer_get_uint16(
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,
@@ -815,7 +813,7 @@ sw_result sw_corby_channel_start_request(
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,
@@ -879,9 +877,9 @@ sw_result sw_corby_channel_set_delegate(
AVAHI_GCC_UNUSED sw_corby_channel_delegate delegate) {
AVAHI_WARN_UNSUPPORTED;
return SW_E_NO_IMPL;
-}
+}
-AVAHI_GCC_NORETURN
+AVAHI_GCC_NORETURN
sw_corby_channel_delegate sw_corby_channel_get_delegate(
AVAHI_GCC_UNUSED sw_corby_channel self) {
AVAHI_WARN_UNSUPPORTED_ABORT;
@@ -893,7 +891,7 @@ void sw_corby_channel_set_app_data(
AVAHI_WARN_UNSUPPORTED;
}
-AVAHI_GCC_NORETURN
+AVAHI_GCC_NORETURN
sw_opaque sw_corby_channel_get_app_data(AVAHI_GCC_UNUSED sw_corby_channel self) {
AVAHI_WARN_UNSUPPORTED_ABORT;
}
@@ -938,7 +936,7 @@ sw_result sw_corby_object_send(
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,
@@ -1010,7 +1008,7 @@ 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,
diff --git a/avahi-compat-howl/warn.c b/avahi-compat-howl/warn.c
index 4bff7ee..235bb59 100644
--- a/avahi-compat-howl/warn.c
+++ b/avahi-compat-howl/warn.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-compat-howl/warn.h b/avahi-compat-howl/warn.h
index 785dba4..04bd0ed 100644
--- a/avahi-compat-howl/warn.h
+++ b/avahi-compat-howl/warn.h
@@ -1,21 +1,19 @@
#ifndef foowarnhhowlfoo
#define foowarnhhowlfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-compat-libdns_sd/Makefile.am b/avahi-compat-libdns_sd/Makefile.am
index 1938171..9a66bc0 100644
--- a/avahi-compat-libdns_sd/Makefile.am
+++ b/avahi-compat-libdns_sd/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -66,8 +64,8 @@ null_test_LDADD = $(AM_LDADD) $(PTHREAD_LIBS) $(PTHREAD_CFLAGS) ../avahi-common/
# 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
+ $(LIBTOOL) --mode=compile $(CC) $(AM_CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test.o -c libdns_sd-test.c
+ $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(PTHREAD_CFLAGS) -o libdns_sd-test libdns_sd-test.o $(PTHREAD_LIBS) ../avahi-common/libavahi-common.la libdns_sd.la
CLEANFILES = libdns_sd-test.o libdns_sd-test
diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c
index 7c2686a..360abd7 100644
--- a/avahi-compat-libdns_sd/compat.c
+++ b/avahi-compat-libdns_sd/compat.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -64,7 +62,7 @@ struct type_info {
struct _DNSServiceRef_t {
int n_ref;
-
+
AvahiSimplePoll *simple_poll;
int thread_fd, main_fd;
@@ -73,7 +71,7 @@ struct _DNSServiceRef_t {
int thread_running;
pthread_mutex_t mutex;
-
+
void *context;
DNSServiceBrowseReply service_browser_callback;
DNSServiceResolveReply service_resolver_callback;
@@ -100,10 +98,10 @@ 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:
@@ -137,13 +135,13 @@ static DNSServiceErrorType map_error(int error) {
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;
@@ -179,7 +177,7 @@ static void type_info_free(struct type_info *i) {
static int type_info_parse(struct type_info *i, const char *t) {
char *token = NULL;
-
+
assert(i);
assert(t);
@@ -190,12 +188,12 @@ static int type_info_parse(struct type_info *i, const char *t) {
if (*t == 0)
break;
-
+
l = strcspn(t, ",");
if (l <= 0)
goto fail;
-
+
token = avahi_strndup(t, l);
if (!token)
@@ -211,7 +209,7 @@ static int type_info_parse(struct type_info *i, const char *t) {
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)))
@@ -239,7 +237,7 @@ static int type_info_parse(struct type_info *i, const char *t) {
if (i->type)
return 0;
-
+
fail:
type_info_free(i);
avahi_free(token);
@@ -265,7 +263,7 @@ static int read_command(int fd) {
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;
@@ -288,15 +286,15 @@ static int write_command(int fd, char reply) {
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;
@@ -308,7 +306,7 @@ static void * thread_func(void *data) {
sigfillset(&mask);
pthread_sigmask(SIG_BLOCK, &mask, NULL);
-
+
sdref->thread = pthread_self();
sdref->thread_running = 1;
@@ -319,7 +317,7 @@ static void * thread_func(void *data) {
break;
/* fprintf(stderr, "Command: %c\n", command); */
-
+
switch (command) {
case COMMAND_POLL: {
@@ -329,12 +327,12 @@ static void * thread_func(void *data) {
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));
}
@@ -345,14 +343,14 @@ static void * thread_func(void *data) {
if (write_command(sdref->thread_fd, ret < 0 ? COMMAND_POLL_FAILED : COMMAND_POLL_DONE) < 0)
break;
-
+
break;
}
case COMMAND_QUIT:
return NULL;
}
-
+
}
return NULL;
@@ -402,12 +400,12 @@ static DNSServiceRef sdref_new(void) {
/* 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:
@@ -420,7 +418,7 @@ fail:
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);
@@ -447,9 +445,9 @@ static void sdref_free(DNSServiceRef sdref) {
avahi_free(sdref->service_host);
type_info_free(&sdref->type_info);
-
+
avahi_string_list_free(sdref->service_txt);
-
+
avahi_free(sdref);
}
@@ -471,7 +469,7 @@ static void sdref_unref(DNSServiceRef sdref) {
int DNSSD_API DNSServiceRefSockFD(DNSServiceRef sdref) {
AVAHI_WARN_LINKAGE;
-
+
if (!sdref || sdref->n_ref <= 0)
return -1;
@@ -485,15 +483,15 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) {
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;
@@ -508,13 +506,13 @@ DNSServiceErrorType DNSSD_API DNSServiceProcessResult(DNSServiceRef sdref) {
/* 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;
@@ -546,7 +544,7 @@ static void service_browser_callback(
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);
@@ -559,7 +557,7 @@ static void service_browser_callback(
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;
@@ -569,7 +567,7 @@ static void service_browser_callback(
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);
@@ -609,7 +607,7 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse(
DNSServiceRef sdref = NULL;
AvahiIfIndex ifindex;
struct type_info type_info;
-
+
AVAHI_WARN_LINKAGE;
if (!ret_sdref || !regtype)
@@ -622,7 +620,7 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse(
}
type_info_init(&type_info);
-
+
if (type_info_parse(&type_info, regtype) < 0 || type_info.n_subtypes > 1) {
type_info_free(&type_info);
@@ -630,7 +628,7 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse(
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;
@@ -640,26 +638,26 @@ DNSServiceErrorType DNSSD_API DNSServiceBrowse(
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);
@@ -707,7 +705,7 @@ static void service_resolver_callback(
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);
@@ -753,27 +751,27 @@ DNSServiceErrorType DNSSD_API DNSServiceResolve(
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);
@@ -782,7 +780,7 @@ finish:
int DNSSD_API DNSServiceConstructFullName (
char *fullName,
- const char *service,
+ const char *service,
const char *regtype,
const char *domain) {
@@ -793,7 +791,7 @@ int DNSSD_API DNSServiceConstructFullName (
if (avahi_service_name_join(fullName, kDNSServiceMaxDomainName, service, regtype, domain) < 0)
return -1;
-
+
return 0;
}
@@ -827,7 +825,7 @@ static void domain_browser_callback(
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;
@@ -865,28 +863,28 @@ DNSServiceErrorType DNSSD_API DNSServiceEnumerateDomains(
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);
@@ -904,7 +902,7 @@ static void reg_report_error(DNSServiceRef sdref, DNSServiceErrorType error) {
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,
@@ -916,7 +914,7 @@ static void reg_report_error(DNSServiceRef sdref, DNSServiceErrorType error) {
static int reg_create_service(DNSServiceRef sdref) {
int ret;
AvahiStringList *l;
-
+
assert(sdref);
assert(sdref->n_ref >= 1);
@@ -964,7 +962,7 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us
/* We've not been setup completely */
if (!sdref->entry_group)
return;
-
+
switch (state) {
case AVAHI_CLIENT_FAILURE:
reg_report_error(sdref, kDNSServiceErr_Unknown);
@@ -994,29 +992,29 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us
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:
@@ -1042,7 +1040,7 @@ static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState st
case AVAHI_ENTRY_GROUP_COLLISION: {
char *n;
int ret;
-
+
/* Remove our entry */
avahi_entry_group_reset(sdref->entry_group);
@@ -1061,7 +1059,7 @@ static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState st
reg_report_error(sdref, map_error(ret));
return;
}
-
+
break;
}
@@ -1074,7 +1072,7 @@ static void reg_entry_group_callback(AvahiEntryGroup *g, AvahiEntryGroupState st
/* Inform the user */
reg_report_error(sdref, map_error(avahi_client_errno(sdref->client)));
break;
-
+
}
}
@@ -1082,14 +1080,14 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister (
DNSServiceRef *ret_sdref,
DNSServiceFlags flags,
uint32_t interface,
- const char *name,
+ const char *name,
const char *regtype,
- const char *domain,
- const char *host,
+ const char *domain,
+ const char *host,
uint16_t port,
uint16_t txtLen,
- const void *txtRecord,
- DNSServiceRegisterReply callback,
+ const void *txtRecord,
+ DNSServiceRegisterReply callback,
void *context) {
DNSServiceErrorType ret = kDNSServiceErr_Unknown;
@@ -1103,7 +1101,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister (
if (!ret_sdref || !regtype)
return kDNSServiceErr_BadParam;
*ret_sdref = NULL;
-
+
if (!txtRecord) {
txtLen = 1;
txtRecord = "";
@@ -1114,7 +1112,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister (
return kDNSServiceErr_Unsupported;
}
- if (txtLen > 0)
+ if (txtLen > 0)
if (avahi_string_list_parse(txtRecord, txtLen, &txt) < 0)
return kDNSServiceErr_Invalid;
@@ -1122,7 +1120,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister (
avahi_string_list_free(txt);
return kDNSServiceErr_Invalid;
}
-
+
if (!(sdref = sdref_new())) {
avahi_string_list_free(txt);
type_info_free(&type_info);
@@ -1141,9 +1139,9 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister (
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;
@@ -1185,20 +1183,20 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister (
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);
@@ -1207,7 +1205,7 @@ finish:
DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
DNSServiceRef sdref,
- DNSRecordRef rref,
+ DNSRecordRef rref,
DNSServiceFlags flags,
uint16_t rdlen,
const void *rdata,
@@ -1226,7 +1224,7 @@ DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
return kDNSServiceErr_Unsupported;
}
- if (rdlen > 0)
+ if (rdlen > 0)
if (avahi_string_list_parse(rdata, rdlen, &txt) < 0)
return kDNSServiceErr_Invalid;
@@ -1251,7 +1249,7 @@ DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
sdref->type_info.type,
sdref->service_domain,
sdref->service_txt) < 0) {
-
+
ret = map_error(avahi_client_errno(sdref->client));
goto finish;
}
@@ -1260,10 +1258,10 @@ DNSServiceErrorType DNSSD_API DNSServiceUpdateRecord(
avahi_string_list_free(txt);
ret = kDNSServiceErr_NoError;
-
+
finish:
ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex));
-
+
return ret;
}
diff --git a/avahi-compat-libdns_sd/dns_sd.h b/avahi-compat-libdns_sd/dns_sd.h
index b7eb8a2..66e494e 100644
--- a/avahi-compat-libdns_sd/dns_sd.h
+++ b/avahi-compat-libdns_sd/dns_sd.h
@@ -2,27 +2,27 @@
*
* Copyright (c) 2003-2004, Apple Computer, Inc. All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
+ * 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
+ * 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.
*/
@@ -150,7 +150,7 @@ enum
/* 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.
@@ -316,23 +316,23 @@ enum
*/
-/*
+/*
* 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
@@ -341,7 +341,7 @@ enum
* 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
@@ -494,7 +494,7 @@ typedef void (DNSSD_API *DNSServiceDomainEnumReply)
/* DNSServiceEnumerateDomains() Parameters:
*
*
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
+ * 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().
@@ -578,7 +578,7 @@ typedef void (DNSSD_API *DNSServiceRegisterReply)
/* DNSServiceRegister() Parameters:
*
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
+ * 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().
@@ -843,7 +843,7 @@ typedef void (DNSSD_API *DNSServiceBrowseReply)
/* DNSServiceBrowse() Parameters:
*
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
+ * 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().
@@ -964,7 +964,7 @@ typedef void (DNSSD_API *DNSServiceResolveReply)
/* DNSServiceResolve() Parameters
*
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
+ * 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().
@@ -1190,7 +1190,7 @@ typedef void (DNSSD_API *DNSServiceQueryRecordReply)
/* DNSServiceQueryRecord() Parameters:
*
- * sdRef: A pointer to an uninitialized DNSServiceRef. If the call succeeds
+ * 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().
@@ -1683,7 +1683,7 @@ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex
* 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:
*
@@ -1700,8 +1700,8 @@ 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,
diff --git a/avahi-compat-libdns_sd/funcs.txt b/avahi-compat-libdns_sd/funcs.txt
index a584b4e..bf96aa5 100644
--- a/avahi-compat-libdns_sd/funcs.txt
+++ b/avahi-compat-libdns_sd/funcs.txt
@@ -33,5 +33,3 @@ DNSServiceRemoveRecord
-- Unsupported and Irrelevant --
DNSServiceSetDefaultDomainForUser
-
-$Id$
diff --git a/avahi-compat-libdns_sd/null-test.c b/avahi-compat-libdns_sd/null-test.c
index a6c03df..8cfb98f 100644
--- a/avahi-compat-libdns_sd/null-test.c
+++ b/avahi-compat-libdns_sd/null-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-compat-libdns_sd/txt-test.c b/avahi-compat-libdns_sd/txt-test.c
index 149a38c..9bf29b4 100644
--- a/avahi-compat-libdns_sd/txt-test.c
+++ b/avahi-compat-libdns_sd/txt-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -34,7 +32,7 @@ static void hexdump(const void* p, size_t size) {
const uint8_t *c = p;
assert(p);
- printf("Dumping %u bytes from %p:\n", size, p);
+ printf("Dumping %zu bytes from %p:\n", size, p);
while (size > 0) {
unsigned i;
@@ -87,10 +85,10 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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));
@@ -99,7 +97,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
TXTRecordSetValue(&ref, "kawumm", 6, "bloerb");
hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
+
TXTRecordSetValue(&ref, "one", 1, "1");
hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
@@ -108,7 +106,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
TXTRecordSetValue(&ref, "three", 1, "3");
hexdump(TXTRecordGetBytesPtr(&ref), TXTRecordGetLength(&ref));
-
+
assert(TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "two"));
assert(!TXTRecordContainsKey(TXTRecordGetLength(&ref), TXTRecordGetBytesPtr(&ref), "four"));
@@ -125,6 +123,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index 2b539e6..9d6c116 100644
--- a/avahi-compat-libdns_sd/txt.c
+++ b/avahi-compat-libdns_sd/txt.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -51,7 +49,7 @@ void DNSSD_API TXTRecordCreate(
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
@@ -75,7 +73,7 @@ void DNSSD_API TXTRecordDeallocate(TXTRecordRef *txtref) {
TXTRecordInternal *t;
AVAHI_WARN_LINKAGE;
-
+
assert(txtref);
t = INTERNAL_PTR(txtref);
if (!t)
@@ -91,7 +89,7 @@ void DNSSD_API TXTRecordDeallocate(TXTRecordRef *txtref) {
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)
@@ -101,13 +99,13 @@ static int make_sure_fits_in(TXTRecordInternal *t, size_t size) {
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;
@@ -134,7 +132,7 @@ static int remove_key(TXTRecordInternal *t, const char *key) {
/* 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] == '=')) {
@@ -150,7 +148,7 @@ static int remove_key(TXTRecordInternal *t, const char *key) {
found = 1;
} else {
/* Skip to next */
-
+
i += *p +1;
p += *p +1;
}
@@ -162,7 +160,7 @@ static int remove_key(TXTRecordInternal *t, const char *key) {
DNSServiceErrorType DNSSD_API TXTRecordSetValue(
TXTRecordRef *txtref,
const char *key,
- uint8_t length,
+ uint8_t length,
const void *value) {
TXTRecordInternal *t;
@@ -186,7 +184,7 @@ DNSServiceErrorType DNSSD_API TXTRecordSetValue(
if (n > 0xFF)
return kDNSServiceErr_Invalid;
-
+
if (make_sure_fits_in(t, 1 + n) < 0)
return kDNSServiceErr_NoMemory;
@@ -196,7 +194,7 @@ DNSServiceErrorType DNSSD_API TXTRecordSetValue(
*(p++) = (uint8_t) n;
t->size ++;
-
+
memcpy(p, key, l);
p += l;
t->size += l;
@@ -267,7 +265,7 @@ static const uint8_t *find_key(const uint8_t *buffer, size_t size, const char *k
key_len = strlen(key);
assert(key_len <= 0xFF);
-
+
p = buffer;
i = 0;
@@ -280,7 +278,7 @@ static const uint8_t *find_key(const uint8_t *buffer, size_t size, const char *k
/* 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] == '=')) {
@@ -288,7 +286,7 @@ static const uint8_t *find_key(const uint8_t *buffer, size_t size, const char *k
/* Key matches, so let's return it */
return p;
- }
+ }
/* Skip to next */
i += *p +1;
@@ -326,7 +324,7 @@ const void * DNSSD_API TXTRecordGetValuePtr(
const uint8_t *p;
size_t n, l;
-
+
AVAHI_WARN_LINKAGE;
assert(key);
@@ -336,7 +334,7 @@ const void * DNSSD_API TXTRecordGetValuePtr(
if (*key == 0 || strchr(key, '=') || strlen(key) > 0xFF) /* Empty or invalid key */
return NULL;
-
+
assert(buffer);
if (!(p = find_key(buffer, size, key)))
@@ -351,20 +349,20 @@ const void * DNSSD_API TXTRecordGetValuePtr(
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;
}
@@ -381,12 +379,12 @@ uint16_t DNSSD_API TXTRecordGetCount(
if (!size)
return 0;
-
+
assert(buffer);
-
+
p = buffer;
i = 0;
-
+
while (i < size) {
/* Does the item fit in? */
@@ -418,7 +416,7 @@ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex(
size_t i;
unsigned n = 0;
DNSServiceErrorType ret = kDNSServiceErr_Invalid;
-
+
AVAHI_WARN_LINKAGE;
if (!size)
@@ -428,7 +426,7 @@ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex(
p = buffer;
i = 0;
-
+
while (i < size) {
/* Does the item fit in? */
@@ -451,7 +449,7 @@ DNSServiceErrorType DNSSD_API TXTRecordGetItemAtIndex(
strncpy(key, (const char*) p + 1, l);
key[l] = 0;
-
+
if (d) {
if (value_len)
*value_len = *p - l - 1;
@@ -486,6 +484,6 @@ fail:
if (value_len)
*value_len = 0;
- return ret;
+ return ret;
}
diff --git a/avahi-compat-libdns_sd/unsupported.c b/avahi-compat-libdns_sd/unsupported.c
index a460b41..fe39eb7 100644
--- a/avahi-compat-libdns_sd/unsupported.c
+++ b/avahi-compat-libdns_sd/unsupported.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,7 +41,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRegisterRecord (
AVAHI_GCC_UNUSED void *context) {
AVAHI_WARN_UNSUPPORTED;
-
+
return kDNSServiceErr_Unsupported;
}
@@ -58,7 +56,7 @@ DNSServiceErrorType DNSSD_API DNSServiceQueryRecord (
AVAHI_GCC_UNUSED void *context) {
AVAHI_WARN_UNSUPPORTED;
-
+
return kDNSServiceErr_Unsupported;
}
@@ -72,13 +70,13 @@ DNSServiceErrorType DNSSD_API DNSServiceReconfirmRecord (
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;
}
@@ -92,7 +90,7 @@ DNSServiceErrorType DNSSD_API DNSServiceAddRecord(
AVAHI_GCC_UNUSED uint32_t ttl) {
AVAHI_WARN_UNSUPPORTED;
-
+
return kDNSServiceErr_Unsupported;
}
@@ -102,7 +100,7 @@ DNSServiceErrorType DNSSD_API DNSServiceRemoveRecord(
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
index d3389c1..b311736 100644
--- a/avahi-compat-libdns_sd/warn.c
+++ b/avahi-compat-libdns_sd/warn.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -55,25 +53,25 @@ const char *avahi_exe_name(void) {
/* 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;
@@ -89,14 +87,14 @@ 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);
@@ -106,7 +104,7 @@ void avahi_warn(const char *fmt, ...) {
void avahi_warn_linkage(void) {
int w;
-
+
pthread_mutex_lock(&linkage_mutex);
w = linkage_warning;
linkage_warning = 1;
diff --git a/avahi-compat-libdns_sd/warn.h b/avahi-compat-libdns_sd/warn.h
index da64fab..0a8c2ba 100644
--- a/avahi-compat-libdns_sd/warn.h
+++ b/avahi-compat-libdns_sd/warn.h
@@ -1,21 +1,19 @@
#ifndef foowarnhfoo
#define foowarnhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/Makefile.am b/avahi-core/Makefile.am
index d190c66..2f09596 100644
--- a/avahi-core/Makefile.am
+++ b/avahi-core/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -143,7 +141,8 @@ dns_test_SOURCES = \
util.c util.h \
rr.c rr.h \
hashmap.c hashmap.h \
- domain-util.c domain-util.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
diff --git a/avahi-core/addr-util.c b/avahi-core/addr-util.c
index 9e2d1e9..979b1b7 100644
--- a/avahi-core/addr-util.c
+++ b/avahi-core/addr-util.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -66,7 +64,7 @@ int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a) {
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF
};
-
+
assert(a);
if (a->proto != AVAHI_PROTO_INET6)
@@ -75,5 +73,22 @@ int avahi_address_is_ipv4_in_ipv6(const AvahiAddress *a) {
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
index 4134de1..66a9422 100644
--- a/avahi-core/addr-util.h
+++ b/avahi-core/addr-util.h
@@ -1,21 +1,19 @@
#ifndef fooaddrutilhfoo
#define fooaddrutilhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -40,6 +38,10 @@ uint16_t avahi_port_from_sockaddr(const struct sockaddr* sa);
* 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
index a77fbb6..ccdbf15 100644
--- a/avahi-core/announce.c
+++ b/avahi-core/announce.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -45,7 +43,7 @@ static void remove_announcer(AvahiServer *s, AvahiAnnouncer *a) {
AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_interface, a->interface->announcers, a);
AVAHI_LLIST_REMOVE(AvahiAnnouncer, by_entry, a->entry->announcers, a);
-
+
avahi_free(a);
}
@@ -61,7 +59,7 @@ static void set_timeout(AvahiAnnouncer *a, const struct timeval *tv) {
}
} else {
- if (a->time_event)
+ 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);
@@ -76,28 +74,28 @@ void avahi_s_entry_group_check_probed(AvahiSEntryGroup *g, int immediately) {
assert(!g->dead);
/* Check whether all group members have been probed */
-
- if (g->state != AVAHI_ENTRY_GROUP_REGISTERING || g->n_probing > 0)
+
+ 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 {
@@ -118,17 +116,17 @@ static void next_state(AvahiAnnouncer *a) {
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 {
@@ -142,10 +140,10 @@ static void next_state(AvahiAnnouncer *a) {
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++;
}
@@ -168,10 +166,10 @@ static void next_state(AvahiAnnouncer *a) {
} 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);
}
}
@@ -185,7 +183,7 @@ static void elapse_announce(AvahiTimeEvent *e, void *userdata) {
static AvahiAnnouncer *get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
AvahiAnnouncer *a;
-
+
assert(s);
assert(e);
assert(i);
@@ -200,7 +198,7 @@ static AvahiAnnouncer *get_announcer(AvahiServer *s, AvahiEntry *e, AvahiInterfa
static void go_to_initial_state(AvahiAnnouncer *a) {
AvahiEntry *e;
struct timeval tv;
-
+
assert(a);
e = a->entry;
@@ -212,7 +210,7 @@ static void go_to_initial_state(AvahiAnnouncer *a) {
a->state = AVAHI_ANNOUNCING;
else
a->state = AVAHI_WAITING;
-
+
} else
a->state = AVAHI_ESTABLISHED;
@@ -222,9 +220,9 @@ static void go_to_initial_state(AvahiAnnouncer *a) {
if (a->state == AVAHI_PROBING && e->group)
e->group->n_probing++;
- if (a->state == AVAHI_PROBING)
+ if (a->state == AVAHI_PROBING)
set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_PROBE_JITTER_MSEC));
- else if (a->state == AVAHI_ANNOUNCING)
+ else if (a->state == AVAHI_ANNOUNCING)
set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
else
set_timeout(a, NULL);
@@ -243,13 +241,13 @@ static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
/* We don't want duplicate announcers */
if (get_announcer(s, e, i))
- return;
+ return;
if ((!(a = avahi_new(AvahiAnnouncer, 1)))) {
avahi_log_error(__FILE__": Out of memory.");
return;
}
-
+
a->server = s;
a->interface = i;
a->entry = e;
@@ -263,7 +261,7 @@ static void new_announcer(AvahiServer *s, AvahiInterface *i, AvahiEntry *e) {
void avahi_announce_interface(AvahiServer *s, AvahiInterface *i) {
AvahiEntry *e;
-
+
assert(s);
assert(i);
@@ -277,7 +275,7 @@ void avahi_announce_interface(AvahiServer *s, AvahiInterface *i) {
static void announce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
AvahiEntry *e = userdata;
-
+
assert(m);
assert(i);
assert(e);
@@ -296,7 +294,7 @@ void avahi_announce_entry(AvahiServer *s, AvahiEntry *e) {
void avahi_announce_group(AvahiServer *s, AvahiSEntryGroup *g) {
AvahiEntry *e;
-
+
assert(s);
assert(g);
@@ -315,7 +313,7 @@ int avahi_entry_is_registered(AvahiServer *s, AvahiEntry *e, AvahiInterface *i)
if (!(a = get_announcer(s, e, i)))
return 0;
-
+
return
a->state == AVAHI_ANNOUNCING ||
a->state == AVAHI_ESTABLISHED ||
@@ -332,7 +330,7 @@ int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
if (!(a = get_announcer(s, e, i)))
return 0;
-
+
return
a->state == AVAHI_PROBING ||
(a->state == AVAHI_WAITING && (e->flags & AVAHI_PUBLISH_UNIQUE));
@@ -340,7 +338,7 @@ int avahi_entry_is_probing(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInterface *i) {
AvahiAnnouncer *a;
-
+
assert(s);
assert(e);
assert(i);
@@ -356,12 +354,12 @@ void avahi_entry_return_to_initial_state(AvahiServer *s, AvahiEntry *e, AvahiInt
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;
@@ -370,18 +368,18 @@ static AvahiRecord *make_goodbye_record(AvahiRecord *r) {
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)
+ if ((i == e) || (i->dead))
continue;
if (!avahi_record_equal_no_ttl(i->record, e->record))
continue;
-
+
return 1;
}
@@ -391,7 +389,7 @@ static int is_duplicate_entry(AvahiServer *s, AvahiEntry *e) {
static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
AvahiEntry *e = userdata;
AvahiRecord *g;
-
+
assert(m);
assert(i);
assert(e);
@@ -408,10 +406,10 @@ static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, v
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);
}
@@ -419,7 +417,7 @@ static void send_goodbye_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, v
static void reannounce(AvahiAnnouncer *a) {
AvahiEntry *e;
struct timeval tv;
-
+
assert(a);
e = a->entry;
@@ -430,12 +428,12 @@ static void reannounce(AvahiAnnouncer *a) {
/* 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)
@@ -443,26 +441,26 @@ static void reannounce(AvahiAnnouncer *a) {
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)
+ else if (a->state == AVAHI_ANNOUNCING)
set_timeout(a, avahi_elapse_time(&tv, 0, AVAHI_ANNOUNCEMENT_JITTER_MSEC));
else
set_timeout(a, NULL);
@@ -472,7 +470,7 @@ static void reannounce(AvahiAnnouncer *a) {
static void reannounce_walk_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
AvahiEntry *e = userdata;
AvahiAnnouncer *a;
-
+
assert(m);
assert(i);
assert(e);
@@ -492,7 +490,7 @@ void avahi_reannounce_entry(AvahiServer *s, AvahiEntry *e) {
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);
@@ -500,7 +498,7 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye
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);
@@ -514,7 +512,7 @@ void avahi_goodbye_interface(AvahiServer *s, AvahiInterface *i, int send_goodbye
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);
diff --git a/avahi-core/announce.h b/avahi-core/announce.h
index 3a8bcf3..fd23d8b 100644
--- a/avahi-core/announce.h
+++ b/avahi-core/announce.h
@@ -1,21 +1,19 @@
#ifndef fooannouncehfoo
#define fooannouncehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/avahi-reflector.c b/avahi-core/avahi-reflector.c
index df5539f..dee1e93 100644
--- a/avahi-core/avahi-reflector.c
+++ b/avahi-core/avahi-reflector.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -40,7 +38,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
AvahiSimplePoll *simple_poll;
simple_poll = avahi_simple_poll_new();
-
+
avahi_server_config_init(&config);
config.publish_hinfo = 0;
config.publish_addresses = 0;
@@ -48,7 +46,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
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);
diff --git a/avahi-core/avahi-test.c b/avahi-core/avahi-test.c
index cb7b97e..07d7a8d 100644
--- a/avahi-core/avahi-test.c
+++ b/avahi-core/avahi-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -61,7 +59,7 @@ static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
static void dump_timeout_callback(AvahiTimeout *timeout, void* userdata) {
struct timeval tv;
-
+
AvahiServer *avahi = userdata;
avahi_server_dump(avahi, dump_line, NULL);
@@ -98,7 +96,7 @@ static void record_browser_callback(
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
char *t;
-
+
assert(r);
if (record) {
@@ -113,7 +111,7 @@ 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);
+ avahi_log_debug("entry group state: %i", state);
if (state == AVAHI_ENTRY_GROUP_COLLISION) {
remove_entries();
@@ -127,8 +125,8 @@ static void entry_group_callback(AVAHI_GCC_UNUSED AvahiServer *s, AVAHI_GCC_UNUS
static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
server = s;
- avahi_log_debug("server state: %i", state);
-
+ 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);
@@ -155,11 +153,11 @@ static void create_entries(int new_name) {
remove_entries();
- if (!group)
+ 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) {
@@ -167,7 +165,7 @@ static void create_entries(int new_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;
@@ -190,7 +188,7 @@ static void create_entries(int new_name) {
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");
@@ -291,14 +289,14 @@ static void sr_callback(
const AvahiAddress *a,
uint16_t port,
AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ 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);
@@ -317,9 +315,9 @@ static void dsb_callback(
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);
@@ -344,7 +342,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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]);
@@ -353,7 +351,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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);
@@ -389,7 +387,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_s_dns_server_browser_free(dsb);
if (group)
- avahi_s_entry_group_free(group);
+ avahi_s_entry_group_free(group);
if (server)
avahi_server_free(server);
@@ -398,6 +396,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index 48d23ad..a51c38f 100644
--- a/avahi-core/browse-dns-server.c
+++ b/avahi-core/browse-dns-server.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,13 +42,13 @@ struct AvahiDNSServerInfo {
AvahiSHostNameResolver *host_name_resolver;
AvahiAddress address;
AvahiLookupResultFlags flags;
-
+
AVAHI_LLIST_FIELDS(AvahiDNSServerInfo, info);
};
struct AvahiSDNSServerBrowser {
AvahiServer *server;
-
+
AvahiSRecordBrowser *record_browser;
AvahiSDNSServerBrowserCallback callback;
void* userdata;
@@ -58,14 +56,14 @@ struct AvahiSDNSServerBrowser {
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);
@@ -85,12 +83,12 @@ static void server_info_free(AvahiSDNSServerBrowser *b, AvahiDNSServerInfo *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);
}
@@ -103,9 +101,9 @@ static void host_name_resolver_callback(
const AvahiAddress *a,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiDNSServerInfo *i = userdata;
-
+
assert(r);
assert(host_name);
assert(i);
@@ -113,7 +111,7 @@ static void host_name_resolver_callback(
switch (event) {
case AVAHI_RESOLVER_FOUND: {
i->address = *a;
-
+
i->browser->callback(
i->browser,
i->interface,
@@ -145,7 +143,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSDNSServerBrowser *b = userdata;
assert(rr);
@@ -157,19 +155,19 @@ static void record_browser_callback(
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;
@@ -182,22 +180,22 @@ static void record_browser_callback(
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,
@@ -209,7 +207,7 @@ static void record_browser_callback(
i->srv_record->data.srv.port,
i->flags | flags,
b->userdata);
-
+
server_info_free(b, i);
break;
}
@@ -228,7 +226,7 @@ static void record_browser_callback(
0,
flags,
b->userdata);
-
+
break;
}
}
@@ -248,12 +246,12 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
"_domain._udp",
"_dns-update._udp"
};
-
+
AvahiSDNSServerBrowser *b;
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
@@ -271,12 +269,12 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
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;
@@ -286,15 +284,15 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
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;
@@ -303,7 +301,7 @@ fail:
if (k)
avahi_key_unref(k);
-
+
avahi_s_dns_server_browser_free(b);
return NULL;
}
@@ -313,7 +311,7 @@ void avahi_s_dns_server_browser_free(AvahiSDNSServerBrowser *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)
diff --git a/avahi-core/browse-domain.c b/avahi-core/browse-domain.c
index 0043806..9705b2a 100644
--- a/avahi-core/browse-domain.c
+++ b/avahi-core/browse-domain.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -34,9 +32,9 @@
struct AvahiSDomainBrowser {
int ref;
-
+
AvahiServer *server;
-
+
AvahiSRecordBrowser *record_browser;
AvahiDomainBrowserType type;
@@ -46,7 +44,7 @@ struct AvahiSDomainBrowser {
AvahiTimeEvent *defer_event;
int all_for_now_scheduled;
-
+
AVAHI_LLIST_FIELDS(AvahiSDomainBrowser, browser);
};
@@ -65,7 +63,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSDomainBrowser *b = userdata;
char *n = NULL;
@@ -78,7 +76,7 @@ static void record_browser_callback(
b->all_for_now_scheduled = 1;
return;
}
-
+
/* Filter flags */
flags &= AVAHI_LOOKUP_RESULT_CACHED | AVAHI_LOOKUP_RESULT_MULTICAST | AVAHI_LOOKUP_RESULT_WIDE_AREA;
@@ -90,21 +88,21 @@ static void record_browser_callback(
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);
@@ -117,22 +115,22 @@ static void defer_callback(AvahiTimeEvent *e, void *userdata) {
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)
+
+ 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);
}
@@ -154,12 +152,12 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
"dr",
"lb"
};
-
+
AvahiSDomainBrowser *b;
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
@@ -176,7 +174,7 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
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;
@@ -197,24 +195,24 @@ AvahiSDomainBrowser *avahi_s_domain_browser_new(
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;
}
@@ -224,7 +222,7 @@ void avahi_s_domain_browser_free(AvahiSDomainBrowser *b) {
assert(b->ref >= 1);
if (--b->ref > 0)
return;
-
+
AVAHI_LLIST_REMOVE(AvahiSDomainBrowser, browser, b->server->domain_browsers, b);
if (b->record_browser)
@@ -232,6 +230,6 @@ void avahi_s_domain_browser_free(AvahiSDomainBrowser *b) {
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
index 252e3cb..6fff071 100644
--- a/avahi-core/browse-service-type.c
+++ b/avahi-core/browse-service-type.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -52,7 +50,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSServiceTypeBrowser *b = userdata;
assert(rr);
@@ -63,7 +61,7 @@ static void record_browser_callback(
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) {
@@ -84,12 +82,12 @@ AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
AvahiLookupFlags flags,
AvahiSServiceTypeBrowserCallback callback,
void* userdata) {
-
+
AvahiSServiceTypeBrowser *b;
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
@@ -105,32 +103,32 @@ AvahiSServiceTypeBrowser *avahi_s_service_type_browser_new(
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;
@@ -140,7 +138,7 @@ fail:
avahi_key_unref(k);
avahi_s_service_type_browser_free(b);
-
+
return NULL;
}
diff --git a/avahi-core/browse-service.c b/avahi-core/browse-service.c
index 43778dd..dde36bc 100644
--- a/avahi-core/browse-service.c
+++ b/avahi-core/browse-service.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,7 +34,7 @@ struct AvahiSServiceBrowser {
AvahiServer *server;
char *domain_name;
char *service_type;
-
+
AvahiSRecordBrowser *record_browser;
AvahiSServiceBrowserCallback callback;
@@ -53,7 +51,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSServiceBrowser *b = userdata;
assert(rr);
@@ -61,7 +59,7 @@ static void record_browser_callback(
/* 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];
@@ -76,7 +74,7 @@ static void record_browser_callback(
}
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);
@@ -96,7 +94,7 @@ AvahiSServiceBrowser *avahi_s_service_browser_new(
AvahiKey *k = NULL;
char n[AVAHI_DOMAIN_NAME_MAX];
int r;
-
+
assert(server);
assert(callback);
assert(service_type);
@@ -114,18 +112,18 @@ AvahiSServiceBrowser *avahi_s_service_browser_new(
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)) ||
@@ -133,12 +131,12 @@ AvahiSServiceBrowser *avahi_s_service_browser_new(
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;
@@ -150,7 +148,7 @@ fail:
if (k)
avahi_key_unref(k);
-
+
avahi_s_service_browser_free(b);
return NULL;
}
@@ -162,7 +160,7 @@ void avahi_s_service_browser_free(AvahiSServiceBrowser *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
index 16d8954..eabd7ea 100644
--- a/avahi-core/browse.c
+++ b/avahi-core/browse.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,20 +40,20 @@
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);
};
@@ -89,7 +87,7 @@ static AvahiSRBLookup* lookup_new(
AvahiKey *key) {
AvahiSRBLookup *l;
-
+
assert(b);
assert(AVAHI_IF_VALID(interface));
assert(AVAHI_PROTO_VALID(protocol));
@@ -97,10 +95,10 @@ static AvahiSRBLookup* lookup_new(
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;
@@ -112,11 +110,11 @@ static AvahiSRBLookup* lookup_new(
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;
}
@@ -134,7 +132,7 @@ static void lookup_unref(AvahiSRBLookup *l) {
avahi_wide_area_lookup_free(l->wide_area);
l->wide_area = NULL;
}
-
+
if (l->multicast) {
avahi_multicast_lookup_free(l->multicast);
l->multicast = NULL;
@@ -144,7 +142,7 @@ static void lookup_unref(AvahiSRBLookup *l) {
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);
}
@@ -163,9 +161,9 @@ static AvahiSRBLookup *lookup_find(
AvahiProtocol protocol,
AvahiLookupFlags flags,
AvahiKey *key) {
-
+
AvahiSRBLookup *l;
-
+
assert(b);
for (l = b->lookups; l; l = l->lookups_next) {
@@ -201,7 +199,7 @@ static void lookup_wide_area_callback(
AvahiLookupResultFlags flags,
AvahiRecord *r,
void *userdata) {
-
+
AvahiSRBLookup *l = userdata;
AvahiSRecordBrowser *b;
@@ -215,11 +213,11 @@ static void lookup_wide_area_callback(
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! */
@@ -259,7 +257,7 @@ static void lookup_multicast_callback(
AvahiSRBLookup *l = userdata;
AvahiSRecordBrowser *b;
-
+
assert(e);
assert(l);
@@ -269,11 +267,11 @@ static void lookup_multicast_callback(
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. */
@@ -283,7 +281,7 @@ static void lookup_multicast_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;
@@ -323,12 +321,12 @@ static int lookup_start(AvahiSRBLookup *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);
@@ -341,15 +339,15 @@ static int lookup_start(AvahiSRBLookup *l) {
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);
@@ -360,7 +358,7 @@ static int lookup_scan_cache(AvahiSRBLookup *l) {
static AvahiSRBLookup* lookup_add(AvahiSRecordBrowser *b, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiKey *key) {
AvahiSRBLookup *l;
-
+
assert(b);
assert(!b->dead);
@@ -379,9 +377,9 @@ static int lookup_go(AvahiSRBLookup *l) {
if (l->record_browser->dead)
return 0;
-
+
lookup_ref(l);
-
+
/* Browse the cache for the root request */
n = lookup_scan_cache(l);
@@ -390,7 +388,7 @@ static int lookup_go(AvahiSRBLookup *l) {
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;
}
@@ -403,7 +401,7 @@ static int lookup_go(AvahiSRBLookup *l) {
static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiProtocol protocol, AvahiLookupFlags flags, AvahiRecord *r) {
AvahiKey *k;
AvahiSRBLookup *n;
-
+
assert(l);
assert(r);
@@ -411,7 +409,7 @@ static void lookup_handle_cname(AvahiSRBLookup *l, AvahiIfIndex interface, Avahi
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);
+ n = lookup_add(l->record_browser, interface, protocol, flags, k);
avahi_key_unref(k);
if (!n) {
@@ -446,7 +444,7 @@ static void lookup_drop_cname(AvahiSRBLookup *l, AvahiIfIndex interface, AvahiPr
avahi_key_equal(n->key, k))
break;
}
-
+
avahi_key_unref(k);
if (rl) {
@@ -487,11 +485,11 @@ static void defer_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
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,
@@ -503,7 +501,7 @@ static void defer_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *userdata) {
/* 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);
}
}
@@ -529,7 +527,7 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
AvahiLookupFlags flags,
AvahiSRecordBrowserCallback callback,
void* userdata) {
-
+
AvahiSRecordBrowser *b;
assert(server);
@@ -541,13 +539,13 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
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);
-
+ 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;
@@ -559,13 +557,13 @@ AvahiSRecordBrowser *avahi_s_record_browser_new(
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;
}
@@ -583,30 +581,30 @@ 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);
diff --git a/avahi-core/browse.h b/avahi-core/browse.h
index 36d4e2e..a0dc207 100644
--- a/avahi-core/browse.h
+++ b/avahi-core/browse.h
@@ -1,21 +1,19 @@
#ifndef foobrowsehfoo
#define foobrowsehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,7 +39,7 @@ struct AvahiSRecordBrowser {
AvahiIfIndex interface;
AvahiProtocol protocol;
AvahiLookupFlags flags;
-
+
AvahiTimeEvent *defer_time_event;
AvahiSRecordBrowserCallback callback;
diff --git a/avahi-core/cache.c b/avahi-core/cache.c
index 9d97b6c..454aac5 100644
--- a/avahi-core/cache.c
+++ b/avahi-core/cache.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -34,8 +32,6 @@
#include "log.h"
#include "rr-util.h"
-#define AVAHI_CACHE_ENTRIES_MAX 500
-
static void remove_entry(AvahiCache *c, AvahiCacheEntry *e) {
AvahiCacheEntry *t;
@@ -54,17 +50,18 @@ static void remove_entry(AvahiCache *c, AvahiCacheEntry *e) {
/* 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);
+ assert(c->n_entries >= 1);
+ --c->n_entries;
}
AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *iface) {
@@ -75,7 +72,7 @@ AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *iface) {
avahi_log_error(__FILE__": Out of memory.");
return NULL; /* OOM */
}
-
+
c->server = server;
c->interface = iface;
@@ -89,7 +86,7 @@ AvahiCache *avahi_cache_new(AvahiServer *server, AvahiInterface *iface) {
c->n_entries = 0;
c->last_rand_timestamp = 0;
-
+
return c;
}
@@ -99,9 +96,9 @@ void avahi_cache_free(AvahiCache *c) {
while (c->entries)
remove_entry(c, c->entries);
assert(c->n_entries == 0);
-
+
avahi_hashmap_free(c->hashmap);
-
+
avahi_free(c);
}
@@ -110,34 +107,34 @@ static AvahiCacheEntry *lookup_key(AvahiCache *c, AvahiKey *k) {
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;
}
@@ -170,7 +167,7 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
AvahiCacheEntry *e = userdata;
/* char *txt; */
unsigned percent = 0;
-
+
assert(t);
assert(e);
@@ -184,17 +181,17 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
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;
@@ -203,7 +200,7 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
e->state = AVAHI_CACHE_EXPIRY3;
percent = 95;
break;
-
+
case AVAHI_CACHE_EXPIRY3:
e->state = AVAHI_CACHE_EXPIRY_FINAL;
percent = 100;
@@ -217,10 +214,10 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
/* 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); */
@@ -229,7 +226,7 @@ static void elapse_func(AvahiTimeEvent *t, void *userdata) {
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
@@ -239,11 +236,11 @@ static void update_time_event(AvahiCache *c, AvahiCacheEntry *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;
@@ -257,19 +254,19 @@ static void next_expiry(AvahiCache *c, AvahiCacheEntry *e, unsigned percent) {
}
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 */
@@ -278,7 +275,7 @@ static void expire_in_one_second(AvahiCache *c, AvahiCacheEntry *e, AvahiCacheEn
void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const AvahiAddress *a) {
/* char *txt; */
-
+
assert(c);
assert(r && r->ref >= 1);
@@ -301,7 +298,7 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
/* 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 */
@@ -314,34 +311,34 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
expire_in_one_second(c, e, AVAHI_CACHE_REPLACE_FINAL);
}
}
-
+
/* Look for exactly the same entry */
for (e = first; e; e = e->by_key_next)
if (avahi_record_equal_no_ttl(e->record, r))
break;
}
-
+
if (e) {
-
+
/* avahi_log_debug("found matching cache entry"); */
/* We need to update the hash table key if we replace the
* record */
if (e->by_key_prev == NULL)
avahi_hashmap_replace(c->hashmap, r->key, e);
-
+
/* Update the record */
avahi_record_unref(e->record);
e->record = avahi_record_ref(r);
/* avahi_log_debug("cache: updating %s", txt); */
-
+
} else {
/* No entry found, therefore we create a new one */
-
+
/* avahi_log_debug("cache: couldn't find matching cache entry for %s", txt); */
- if (c->n_entries >= AVAHI_CACHE_ENTRIES_MAX)
+ if (c->n_entries >= c->server->config.n_cache_entries_max)
return;
if (!(e = avahi_new(AvahiCacheEntry, 1))) {
@@ -364,8 +361,8 @@ void avahi_cache_update(AvahiCache *c, AvahiRecord *r, int cache_flush, const Av
/* 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);
@@ -395,7 +392,7 @@ static void dump_callback(void* key, void* data, void* userdata) {
if (!(t = avahi_record_to_string(e->record)))
continue; /* OOM */
-
+
dump_data->callback(t, dump_data->userdata);
avahi_free(t);
}
@@ -420,7 +417,7 @@ int avahi_cache_dump(AvahiCache *c, AvahiDumpCallback callback, void* userdata)
int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e) {
struct timeval now;
unsigned age;
-
+
assert(c);
assert(e);
@@ -429,7 +426,7 @@ int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e) {
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;
}
@@ -483,7 +480,7 @@ static void* start_poof_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEnt
default:
;
}
-
+
return NULL;
}
@@ -514,6 +511,3 @@ void avahi_cache_stop_poof(AvahiCache *c, AvahiRecord *record, const AvahiAddres
next_expiry(c, e, 80);
}
}
-
-
-
diff --git a/avahi-core/cache.h b/avahi-core/cache.h
index fd74005..49ba9b9 100644
--- a/avahi-core/cache.h
+++ b/avahi-core/cache.h
@@ -1,21 +1,19 @@
#ifndef foocachehfoo
#define foocachehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -52,7 +50,7 @@ struct AvahiCacheEntry {
struct timeval expiry;
int cache_flush;
int poof_num;
-
+
AvahiAddress origin;
AvahiCacheEntryState state;
@@ -66,9 +64,9 @@ struct AvahiCacheEntry {
struct AvahiCache {
AvahiServer *server;
-
+
AvahiInterface *interface;
-
+
AvahiHashmap *hashmap;
AVAHI_LLIST_HEAD(AvahiCacheEntry, entries);
@@ -95,7 +93,7 @@ int avahi_cache_entry_half_ttl(AvahiCache *c, AvahiCacheEntry *e);
* 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 */
+/* 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);
diff --git a/avahi-core/conformance-test.c b/avahi-core/conformance-test.c
index dc3c864..632f66b 100644
--- a/avahi-core/conformance-test.c
+++ b/avahi-core/conformance-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -55,7 +53,7 @@ static void dump_line(const char *text, AVAHI_GCC_UNUSED void* userdata) {
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);
@@ -77,8 +75,8 @@ static void create_service(const char *t) {
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_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++;
@@ -86,8 +84,8 @@ static void create_service(const char *t) {
static void rename_timeout_callback(AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) {
struct timeval tv;
-
- if (access("flag", F_OK) == 0) {
+
+ if (access("flag", F_OK) == 0) {
create_service("New - Bonjour Service Name");
return;
}
@@ -112,7 +110,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
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);
@@ -147,14 +145,14 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
/* 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_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
index 94d1970..1f50126 100644
--- a/avahi-core/core.h
+++ b/avahi-core/core.h
@@ -1,21 +1,19 @@
#ifndef foocorehfoo
#define foocorehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -67,6 +65,7 @@ typedef struct AvahiServerConfig {
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 */
} AvahiServerConfig;
/** Allocate a new mDNS responder object. */
diff --git a/avahi-core/dns-spin-test.c b/avahi-core/dns-spin-test.c
index d93e508..f50e691 100644
--- a/avahi-core/dns-spin-test.c
+++ b/avahi-core/dns-spin-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/dns-srv-rr.h b/avahi-core/dns-srv-rr.h
index 1a7f95f..fdd9010 100644
--- a/avahi-core/dns-srv-rr.h
+++ b/avahi-core/dns-srv-rr.h
@@ -1,21 +1,19 @@
#ifndef foodnssrvhfoo
#define foodnssrvhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -76,7 +74,7 @@ AvahiSDNSServerBrowser *avahi_s_dns_server_browser_new(
AvahiProtocol protocol,
const char *domain,
AvahiDNSServerType type,
- AvahiProtocol aprotocol, /**< Address protocol for the DNS server */
+ AvahiProtocol aprotocol, /**< Address protocol for the DNS server */
AvahiLookupFlags flags, /**< Lookup flags. */
AvahiSDNSServerBrowserCallback callback,
void* userdata);
diff --git a/avahi-core/dns-test.c b/avahi-core/dns-test.c
index ae2343d..ebe2305 100644
--- a/avahi-core/dns-test.c
+++ b/avahi-core/dns-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -57,7 +55,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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));
@@ -69,11 +67,11 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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);
@@ -110,6 +108,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
avahi_free(m);
avahi_record_unref(r);
-
+
return 0;
}
diff --git a/avahi-core/dns.c b/avahi-core/dns.c
index 41ccc8f..2fcd91f 100644
--- a/avahi-core/dns.c
+++ b/avahi-core/dns.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -51,10 +49,10 @@ AvahiDnsPacket* avahi_dns_packet_new(unsigned mtu) {
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;
@@ -69,7 +67,7 @@ AvahiDnsPacket* avahi_dns_packet_new_query(unsigned mtu) {
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;
}
@@ -79,7 +77,7 @@ AvahiDnsPacket* avahi_dns_packet_new_response(unsigned mtu, int aa) {
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;
}
@@ -97,7 +95,7 @@ AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int
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;
@@ -120,7 +118,7 @@ AvahiDnsPacket* avahi_dns_packet_new_reply(AvahiDnsPacket* p, unsigned mtu, int
(avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS) & AVAHI_DNS_FLAG_OPCODE));
return r;
-}
+}
void avahi_dns_packet_free(AvahiDnsPacket *p) {
@@ -128,14 +126,14 @@ void avahi_dns_packet_free(AvahiDnsPacket *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);
}
@@ -151,12 +149,12 @@ void avahi_dns_packet_inc_field(AvahiDnsPacket *p, unsigned idx) {
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);
}
@@ -169,23 +167,23 @@ void avahi_dns_packet_cleanup_name_table(AvahiDnsPacket *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));
@@ -203,7 +201,7 @@ uint8_t* avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name) {
}
pname = name;
-
+
if (!(avahi_unescape_label(&name, label, sizeof(label))))
goto fail;
@@ -222,7 +220,7 @@ uint8_t* avahi_dns_packet_append_name(AvahiDnsPacket *p, const char *name) {
if (!(d = avahi_dns_packet_extend(p, 1)))
goto fail;
-
+
*d = 0;
return saved_ptr;
@@ -237,10 +235,10 @@ fail:
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;
@@ -252,7 +250,7 @@ uint8_t *avahi_dns_packet_append_uint32(AvahiDnsPacket *p, uint32_t v) {
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);
@@ -278,13 +276,13 @@ uint8_t *avahi_dns_packet_append_bytes(AvahiDnsPacket *p, const void *b, size_t
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;
@@ -296,15 +294,15 @@ uint8_t* avahi_dns_packet_append_string(AvahiDnsPacket *p, const char *s) {
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;
}
@@ -316,7 +314,7 @@ int avahi_dns_packet_check_valid(AvahiDnsPacket *p) {
return -1;
flags = avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_FLAGS);
-
+
if (flags & AVAHI_DNS_FLAG_OPCODE)
return -1;
@@ -329,9 +327,9 @@ int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *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;
@@ -340,7 +338,7 @@ int avahi_dns_packet_check_valid_multicast(AvahiDnsPacket *p) {
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);
}
@@ -351,7 +349,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
unsigned label_ptr;
int i;
assert(p && ret_name && l);
-
+
for (i = 0; i < AVAHI_DNS_LABELS_MAX; i++) {
uint8_t n;
@@ -368,15 +366,15 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
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;
@@ -393,7 +391,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
return -1;
idx += n;
-
+
if (!compressed)
ret += n;
} else if ((n & 0xC0) == 0xC0) {
@@ -411,7 +409,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
if (!compressed)
ret += 2;
-
+
compressed = 1;
} else
return -1;
@@ -422,7 +420,7 @@ static int consume_labels(AvahiDnsPacket *p, unsigned idx, char *ret_name, size_
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;
@@ -458,7 +456,7 @@ int avahi_dns_packet_consume_uint32(AvahiDnsPacket *p, uint32_t *ret_v) {
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;
}
@@ -466,7 +464,7 @@ 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;
@@ -478,7 +476,7 @@ int avahi_dns_packet_consume_bytes(AvahiDnsPacket *p, void * ret_data, size_t l)
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);
@@ -496,7 +494,7 @@ int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t
memcpy(ret_string, AVAHI_DNS_PACKET_DATA(p)+p->rindex+1, l-1);
ret_string[l-1] = 0;
-
+
p->rindex += 1+k;
return 0;
@@ -504,7 +502,7 @@ int avahi_dns_packet_consume_string(AvahiDnsPacket *p, char *ret_string, size_t
const void* avahi_dns_packet_get_rptr(AvahiDnsPacket *p) {
assert(p);
-
+
if (p->rindex > p->size)
return NULL;
@@ -524,32 +522,32 @@ int avahi_dns_packet_skip(AvahiDnsPacket *p, size_t length) {
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;
@@ -557,12 +555,12 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
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;
@@ -571,12 +569,12 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
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:
@@ -585,27 +583,27 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
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;
-
+ r->data.generic.size = rdlength;
+
if (avahi_dns_packet_skip(p, rdlength) < 0)
return -1;
}
@@ -616,7 +614,7 @@ static int parse_rdata(AvahiDnsPacket *p, AvahiRecord *r, uint16_t rdlength) {
/* 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;
}
@@ -640,16 +638,16 @@ AvahiRecord* avahi_dns_packet_consume_record(AvahiDnsPacket *p, int *ret_cache_f
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:
@@ -675,7 +673,7 @@ AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_respo
*ret_unicast_response = !!(class & AVAHI_DNS_UNICAST_RESPONSE);
class &= ~AVAHI_DNS_UNICAST_RESPONSE;
-
+
if (!(k = avahi_key_new(name, class, type)))
return NULL;
@@ -690,12 +688,12 @@ AvahiKey* avahi_dns_packet_consume_key(AvahiDnsPacket *p, int *ret_unicast_respo
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))) {
@@ -711,16 +709,16 @@ uint8_t* avahi_dns_packet_append_key(AvahiDnsPacket *p, AvahiKey *k, int unicast
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:
@@ -759,16 +757,16 @@ static int append_rdata(AvahiDnsPacket *p, AvahiRecord *r) {
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)
@@ -802,7 +800,7 @@ uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int c
if (append_rdata(p, r) < 0)
goto fail;
-
+
size = avahi_dns_packet_extend(p, 0) - start;
assert(size <= AVAHI_DNS_RDATA_MAX);
@@ -810,7 +808,7 @@ uint8_t* avahi_dns_packet_append_record(AvahiDnsPacket *p, AvahiRecord *r, int c
l[0] = (uint8_t) ((uint16_t) size >> 8);
l[1] = (uint8_t) ((uint16_t) size);
-
+
return t;
@@ -831,17 +829,17 @@ 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;
@@ -850,14 +848,14 @@ int avahi_rdata_parse(AvahiRecord *record, const void* rdata, size_t size) {
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);
@@ -874,6 +872,6 @@ size_t avahi_rdata_serialize(AvahiRecord *record, void *rdata, size_t max_size)
if (ret < 0)
return (size_t) -1;
-
+
return p.size;
}
diff --git a/avahi-core/dns.h b/avahi-core/dns.h
index 7ec9935..52e8d88 100644
--- a/avahi-core/dns.h
+++ b/avahi-core/dns.h
@@ -1,21 +1,19 @@
#ifndef foodnshfoo
#define foodnshfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/domain-util.c b/avahi-core/domain-util.c
index 777a064..6eed27f 100644
--- a/avahi-core/domain-util.c
+++ b/avahi-core/domain-util.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,8 +39,8 @@ static void strip_bad_chars(char *s) {
char *p, *d;
s[strcspn(s, ".")] = 0;
-
- for (p = s, d = s; *p; p++)
+
+ for (p = s, d = s; *p; p++)
if ((*p >= 'a' && *p <= 'z') ||
(*p >= 'A' && *p <= 'Z') ||
(*p >= '0' && *p <= '9') ||
@@ -55,7 +53,7 @@ static void strip_bad_chars(char *s) {
#ifdef __linux__
static int load_lsb_distrib_id(char *ret_s, size_t size) {
FILE *f;
-
+
assert(ret_s);
assert(size > 0);
@@ -100,7 +98,7 @@ char *avahi_get_host_name(char *ret_s, size_t size) {
*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 */
@@ -118,7 +116,7 @@ char *avahi_get_host_name(char *ret_s, size_t size) {
{
/* Try uname() second */
struct utsname utsname;
-
+
if (uname(&utsname) >= 0) {
snprintf(ret_s, size, "%s", utsname.sysname);
strip_bad_chars(ret_s);
@@ -132,8 +130,8 @@ char *avahi_get_host_name(char *ret_s, size_t size) {
}
if (size >= AVAHI_LABEL_MAX)
- ret_s[AVAHI_LABEL_MAX-1] = 0;
-
+ ret_s[AVAHI_LABEL_MAX-1] = 0;
+
return ret_s;
}
@@ -164,7 +162,7 @@ int avahi_binary_domain_cmp(const char *a, const char *b) {
if ((r = strcmp(ca, cb)))
return r;
-
+
if (!*a && !*b)
return 0;
}
@@ -179,12 +177,12 @@ int avahi_domain_ends_with(const char *domain, const char *suffix) {
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
index 01233d8..082fde6 100644
--- a/avahi-core/domain-util.h
+++ b/avahi-core/domain-util.h
@@ -1,21 +1,19 @@
#ifndef foodomainutilhfoo
#define foodomainutilhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,7 +29,7 @@
AVAHI_C_DECL_BEGIN
/** Return the local host name. */
-char *avahi_get_host_name(char *ret_s, size_t size);
+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);
diff --git a/avahi-core/entry.c b/avahi-core/entry.c
index 55c9ea2..b02964c 100644
--- a/avahi-core/entry.c
+++ b/avahi-core/entry.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -107,7 +105,7 @@ void avahi_entry_group_free(AvahiServer *s, AvahiSEntryGroup *g) {
if (g->register_time_event)
avahi_time_event_free(g->register_time_event);
-
+
AVAHI_LLIST_REMOVE(AvahiSEntryGroup, groups, s->groups, g);
avahi_free(g);
}
@@ -117,10 +115,10 @@ void avahi_cleanup_dead_entries(AvahiServer *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);
}
@@ -130,10 +128,10 @@ void avahi_cleanup_dead_entries(AvahiServer *s) {
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);
}
@@ -147,7 +145,7 @@ void avahi_cleanup_dead_entries(AvahiServer *s) {
static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiProtocol protocol, AvahiRecord *r, AvahiPublishFlags flags) {
AvahiEntry *e;
-
+
assert(s);
assert(r);
@@ -157,7 +155,7 @@ static int check_record_conflict(AvahiServer *s, AvahiIfIndex interface, AvahiPr
if (!(flags & AVAHI_PUBLISH_UNIQUE) && !(e->flags & AVAHI_PUBLISH_UNIQUE))
continue;
-
+
if ((flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) && (e->flags & AVAHI_PUBLISH_ALLOW_MULTIPLE) )
continue;
@@ -188,7 +186,7 @@ static AvahiEntry * server_add_internal(
AvahiRecord *r) {
AvahiEntry *e;
-
+
assert(s);
assert(r);
@@ -225,11 +223,11 @@ static AvahiEntry * server_add_internal(
!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 */
@@ -265,14 +263,14 @@ static AvahiEntry * server_add_internal(
/* 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;
@@ -282,7 +280,7 @@ static AvahiEntry * server_add_internal(
avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
return NULL;
}
-
+
e->server = s;
e->record = avahi_record_ref(r);
e->group = g;
@@ -290,20 +288,20 @@ static AvahiEntry * server_add_internal(
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_LLIST_PREPEND(AvahiEntry, by_group, g->entries, e);
+
avahi_announce_entry(s, e);
}
@@ -331,10 +329,10 @@ const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, voi
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;
@@ -343,7 +341,7 @@ const AvahiRecord *avahi_server_iterate(AvahiServer *s, AvahiSEntryGroup *g, voi
int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata) {
AvahiEntry *e;
-
+
assert(s);
assert(callback);
@@ -355,10 +353,10 @@ int avahi_server_dump(AvahiServer *s, AvahiDumpCallback callback, void* userdata
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);
@@ -384,7 +382,7 @@ static AvahiEntry *server_add_ptr_internal(
AvahiRecord *r;
AvahiEntry *e;
-
+
assert(s);
assert(dest);
@@ -398,13 +396,13 @@ static AvahiEntry *server_add_ptr_internal(
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,
@@ -438,7 +436,7 @@ int avahi_server_add_address(
int ret = AVAHI_OK;
AvahiEntry *entry = NULL, *reverse = NULL;
AvahiRecord *r;
-
+
assert(s);
assert(a);
@@ -454,7 +452,7 @@ int avahi_server_add_address(
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 {
@@ -464,29 +462,29 @@ int avahi_server_add_address(
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);
@@ -496,17 +494,17 @@ int avahi_server_add_address(
}
/* 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)) {
@@ -531,7 +529,7 @@ static AvahiEntry *server_add_txt_strlst_nocopy(
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))) {
@@ -539,7 +537,7 @@ static AvahiEntry *server_add_txt_strlst_nocopy(
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);
@@ -580,7 +578,7 @@ static int server_add_service_strlst_nocopy(
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);
@@ -605,7 +603,7 @@ static int server_add_service_strlst_nocopy(
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;
@@ -619,19 +617,19 @@ static int server_add_service_strlst_nocopy(
}
/* 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;
@@ -649,7 +647,7 @@ static int server_add_service_strlst_nocopy(
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;
@@ -659,7 +657,7 @@ static int server_add_service_strlst_nocopy(
}
/* 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;
@@ -676,10 +674,10 @@ fail:
if (enum_entry)
avahi_entry_free(s, enum_entry);
}
-
+
avahi_string_list_free(strlst);
avahi_free(h);
-
+
return ret;
}
@@ -718,11 +716,11 @@ int avahi_server_add_service(
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;
}
@@ -732,15 +730,15 @@ static int server_update_service_txt_strlst_nocopy(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ 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);
@@ -769,17 +767,17 @@ static int server_update_service_txt_strlst_nocopy(
/* 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;
}
@@ -789,9 +787,9 @@ int avahi_server_update_service_txt_strlst(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ 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));
@@ -804,18 +802,18 @@ int avahi_server_update_service_txt(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ 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;
}
@@ -825,14 +823,14 @@ int avahi_server_add_service_subtype(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ 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);
@@ -861,7 +859,7 @@ int avahi_server_add_service_subtype(
goto fail;
fail:
-
+
return ret;
}
@@ -877,7 +875,7 @@ static void hexstring(char *s, size_t sl, const void *p, size_t pl) {
k++;
pl--;
}
-
+
b = !b;
sl--;
@@ -900,9 +898,9 @@ static AvahiEntry *server_add_dns_server_name(
AvahiEntry *e;
char t[AVAHI_DOMAIN_NAME_MAX], normalized_d[AVAHI_DOMAIN_NAME_MAX], *n;
-
+
AvahiRecord *r;
-
+
assert(s);
assert(name);
@@ -911,7 +909,7 @@ static AvahiEntry *server_add_dns_server_name(
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;
@@ -922,17 +920,17 @@ static AvahiEntry *server_add_dns_server_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;
@@ -973,7 +971,7 @@ int avahi_server_add_dns_server_address(
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);
@@ -988,13 +986,13 @@ int avahi_server_add_dns_server_address(
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);
@@ -1016,7 +1014,7 @@ void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState
/* 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) {
@@ -1025,30 +1023,30 @@ void avahi_s_entry_group_change_state(AvahiSEntryGroup *g, AvahiEntryGroupState
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;
@@ -1067,7 +1065,7 @@ AvahiSEntryGroup *avahi_s_entry_group_new(AvahiServer *s, AvahiSEntryGroupCallba
void avahi_s_entry_group_free(AvahiSEntryGroup *g) {
AvahiEntry *e;
-
+
assert(g);
assert(g->server);
@@ -1084,9 +1082,11 @@ void avahi_s_entry_group_free(AvahiSEntryGroup *g) {
}
g->dead = 1;
-
+
g->server->need_group_cleanup = 1;
g->server->need_entry_cleanup = 1;
+
+ avahi_cleanup_dead_entries(g->server);
}
static void entry_group_commit_real(AvahiSEntryGroup *g) {
@@ -1109,14 +1109,14 @@ static void entry_group_register_time_event_callback(AVAHI_GCC_UNUSED AvahiTimeE
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);
@@ -1144,7 +1144,7 @@ int avahi_s_entry_group_commit(AvahiSEntryGroup *g) {
/* 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);
}
@@ -1154,7 +1154,7 @@ int avahi_s_entry_group_commit(AvahiSEntryGroup *g) {
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);
@@ -1166,6 +1166,8 @@ void avahi_s_entry_group_reset(AvahiSEntryGroup *g) {
g->n_probing = 0;
avahi_s_entry_group_change_state(g, AVAHI_ENTRY_GROUP_UNCOMMITED);
+
+ avahi_cleanup_dead_entries(g->server);
}
int avahi_entry_is_commited(AvahiEntry *e) {
diff --git a/avahi-core/fdutil.c b/avahi-core/fdutil.c
index e35016d..c294754 100644
--- a/avahi-core/fdutil.c
+++ b/avahi-core/fdutil.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -34,7 +32,7 @@ int avahi_set_cloexec(int fd) {
int n;
assert(fd >= 0);
-
+
if ((n = fcntl(fd, F_GETFD)) < 0)
return -1;
@@ -46,7 +44,7 @@ int avahi_set_cloexec(int fd) {
int avahi_set_nonblock(int fd) {
int n;
-
+
assert(fd >= 0);
if ((n = fcntl(fd, F_GETFL)) < 0)
@@ -61,13 +59,13 @@ int avahi_set_nonblock(int fd) {
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
index 047b9bb..68607f8 100644
--- a/avahi-core/fdutil.h
+++ b/avahi-core/fdutil.h
@@ -1,21 +1,19 @@
#ifndef foofdutilhfoo
#define foofdutilhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/hashmap-test.c b/avahi-core/hashmap-test.c
index 9826d53..209d0e5 100644
--- a/avahi-core/hashmap-test.c
+++ b/avahi-core/hashmap-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -46,7 +44,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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"));
@@ -57,7 +55,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index 07bd707..9b55bd3 100644
--- a/avahi-core/hashmap.c
+++ b/avahi-core/hashmap.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -49,7 +47,7 @@ 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);
};
@@ -59,7 +57,7 @@ static Entry* entry_get(AvahiHashmap *m, const void *key) {
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;
@@ -87,7 +85,7 @@ static void entry_free(AvahiHashmap *m, Entry *e, int stolen) {
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);
@@ -100,7 +98,7 @@ AvahiHashmap* avahi_hashmap_new(AvahiHashFunc hash_func, AvahiEqualFunc equal_fu
m->value_free_func = value_free_func;
AVAHI_LLIST_HEAD_INIT(Entry, m->entries_list);
-
+
return m;
}
@@ -109,13 +107,13 @@ void avahi_hashmap_free(AvahiHashmap *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)))
@@ -135,7 +133,7 @@ int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value) {
m->key_free_func(key);
if (m->value_free_func)
m->value_free_func(value);
-
+
return 1;
}
@@ -150,7 +148,7 @@ int avahi_hashmap_insert(AvahiHashmap *m, void *key, void *value) {
idx = m->hash_func(key) % HASH_MAP_SIZE;
AVAHI_LLIST_PREPEND(Entry, bucket, m->entries[idx], e);
-
+
return 0;
}
@@ -169,7 +167,7 @@ int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value) {
e->key = key;
e->value = value;
-
+
return 1;
}
@@ -184,13 +182,13 @@ int avahi_hashmap_replace(AvahiHashmap *m, void *key, void *value) {
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)))
@@ -216,7 +214,7 @@ unsigned avahi_string_hash(const void *data) {
unsigned hash = 0;
assert(p);
-
+
for (; *p; p++)
hash = 31 * hash + *p;
@@ -228,7 +226,7 @@ int avahi_string_equal(const void *a, const void *b) {
assert(p);
assert(q);
-
+
return strcmp(p, q) == 0;
}
@@ -236,7 +234,7 @@ unsigned avahi_int_hash(const void *data) {
const int *i = data;
assert(i);
-
+
return (unsigned) *i;
}
@@ -245,6 +243,6 @@ int avahi_int_equal(const void *a, const void *b) {
assert(_a);
assert(_b);
-
+
return *_a == *_b;
}
diff --git a/avahi-core/hashmap.h b/avahi-core/hashmap.h
index 120cf30..9d7e81f 100644
--- a/avahi-core/hashmap.h
+++ b/avahi-core/hashmap.h
@@ -1,21 +1,19 @@
#ifndef foohashmaphfoo
#define foohashmaphfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/iface-linux.c b/avahi-core/iface-linux.c
index c8ed9e0..2782697 100644
--- a/avahi-core/iface-linux.c
+++ b/avahi-core/iface-linux.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -50,7 +48,7 @@ static int netlink_list_items(AvahiNetlink *nl, uint16_t type, unsigned *ret_seq
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));
@@ -69,7 +67,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
AvahiInterfaceMonitor *m = userdata;
/* This routine is called for every RTNETLINK response packet */
-
+
assert(m);
assert(n);
assert(m->osdep.netlink == nl);
@@ -77,7 +75,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
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;
@@ -93,7 +91,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
* 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
@@ -136,10 +134,10 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
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:
;
}
@@ -156,7 +154,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* 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 */
@@ -174,11 +172,11 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* 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;
@@ -207,7 +205,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
switch(a->rta_type) {
case IFA_ADDRESS:
/* Fill in address data */
-
+
if ((raddr.proto == AVAHI_PROTO_INET6 && RTA_PAYLOAD(a) != 16) ||
(raddr.proto == AVAHI_PROTO_INET && RTA_PAYLOAD(a) != 4))
return;
@@ -220,7 +218,7 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
default:
;
}
-
+
a = RTA_NEXT(a, l);
}
@@ -260,16 +258,16 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* 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;
@@ -300,14 +298,14 @@ static void netlink_callback(AvahiNetlink *nl, struct nlmsghdr *n, void* userdat
/* 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));
}
@@ -317,7 +315,7 @@ 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;
@@ -361,7 +359,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *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;
diff --git a/avahi-core/iface-linux.h b/avahi-core/iface-linux.h
index eed648c..677f86d 100644
--- a/avahi-core/iface-linux.h
+++ b/avahi-core/iface-linux.h
@@ -1,21 +1,19 @@
#ifndef fooifacelinuxhfoo
#define fooifacelinuxhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,9 +26,9 @@ typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
struct AvahiInterfaceMonitorOSDep {
AvahiNetlink *netlink;
-
+
unsigned query_addr_seq, query_link_seq;
-
+
enum {
LIST_IFACE,
LIST_ADDR,
diff --git a/avahi-core/iface-pfroute.c b/avahi-core/iface-pfroute.c
index 391081e..9a2e953 100644
--- a/avahi-core/iface-pfroute.c
+++ b/avahi-core/iface-pfroute.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,8 +46,8 @@
#include "iface-pfroute.h"
#include "util.h"
-static int bitcount (unsigned int n)
-{
+static int bitcount (unsigned int n)
+{
int count=0 ;
while (n)
{
@@ -64,39 +62,39 @@ 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======", */
@@ -105,7 +103,7 @@ static void rtm_info(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
/* 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);
}
@@ -155,14 +153,14 @@ static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
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)
+ if (sa->sa_len == 0)
continue;
#endif
switch(sa->sa_family) {
@@ -231,7 +229,7 @@ static void rtm_addr(struct rt_msghdr *rtm, AvahiInterfaceMonitor *m)
return;
avahi_interface_address_free(addriface);
}
-
+
avahi_interface_check_relevant(iface);
avahi_interface_update_rrs(iface, 0);
}
@@ -240,7 +238,7 @@ 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);
@@ -301,15 +299,15 @@ int avahi_interface_monitor_init_osdep(AvahiInterfaceMonitor *m) {
}
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,
+ 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:
@@ -317,10 +315,10 @@ 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;
}
@@ -333,7 +331,7 @@ void avahi_interface_monitor_free_osdep(AvahiInterfaceMonitor *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);
@@ -423,7 +421,7 @@ static void if_add_interface(struct lifreq *lifreq, AvahiInterfaceMonitor *m, in
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)))
+ if (!(hw = avahi_hw_interface_new(m, (AvahiIfIndex) index)))
return; /* OOM */
hw->flags_ok =
@@ -445,7 +443,7 @@ static void if_add_interface(struct lifreq *lifreq, AvahiInterfaceMonitor *m, in
return; /* OOM */
addriface->global_scope = 1;
-
+
avahi_hw_interface_check_relevant(hw);
avahi_hw_interface_update_rrs(hw, 0);
}
@@ -459,7 +457,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
struct rt_msghdr *rtm;
assert(m);
-
+
retry2:
mib[0] = CTL_NET;
mib[1] = PF_ROUTE;
@@ -492,7 +490,7 @@ void avahi_interface_monitor_sync(AvahiInterfaceMonitor *m) {
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);
diff --git a/avahi-core/iface-pfroute.h b/avahi-core/iface-pfroute.h
index 34098da..3766cb0 100644
--- a/avahi-core/iface-pfroute.h
+++ b/avahi-core/iface-pfroute.h
@@ -1,21 +1,19 @@
#ifndef fooifacepfroutehfoo
#define fooifacepfroutehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/iface.c b/avahi-core/iface.c
index 5fbfc19..0736df4 100644
--- a/avahi-core/iface.c
+++ b/avahi-core/iface.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-core/iface.h b/avahi-core/iface.h
index 4106ea7..466c16a 100644
--- a/avahi-core/iface.h
+++ b/avahi-core/iface.h
@@ -1,21 +1,19 @@
#ifndef fooifacehfoo
#define fooifacehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -47,9 +45,9 @@ typedef struct AvahiHwInterface AvahiHwInterface;
#else
typedef struct AvahiInterfaceMonitorOSDep AvahiInterfaceMonitorOSDep;
struct AvahiInterfaceMonitorOSDep {
-
+
unsigned query_addr_seq, query_link_seq;
-
+
enum {
LIST_IFACE,
LIST_ADDR,
@@ -79,7 +77,7 @@ struct AvahiHwInterface {
char *name;
AvahiIfIndex index;
int flags_ok;
-
+
unsigned mtu;
uint8_t mac_address[AVAHI_MAC_ADDRESS_MAX];
@@ -96,7 +94,7 @@ struct AvahiInterface {
AVAHI_LLIST_FIELDS(AvahiInterface, interface);
AVAHI_LLIST_FIELDS(AvahiInterface, by_hardware);
-
+
AvahiProtocol protocol;
int announcing;
AvahiAddress local_mcast_address;
@@ -125,7 +123,7 @@ struct AvahiInterfaceAddress {
unsigned prefix_len;
int global_scope;
-
+
AvahiSEntryGroup *entry_group;
};
diff --git a/avahi-core/internal.h b/avahi-core/internal.h
index d0a10d6..a4b10ed 100644
--- a/avahi-core/internal.h
+++ b/avahi-core/internal.h
@@ -1,21 +1,19 @@
#ifndef foointernalhfoo
#define foointernalhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -53,7 +51,7 @@ typedef struct AvahiLegacyUnicastReflectSlot AvahiLegacyUnicastReflectSlot;
struct AvahiLegacyUnicastReflectSlot {
AvahiServer *server;
-
+
uint16_t id, original_id;
AvahiAddress address;
uint16_t port;
@@ -67,7 +65,7 @@ struct AvahiEntry {
AvahiSEntryGroup *group;
int dead;
-
+
AvahiPublishFlags flags;
AvahiRecord *record;
AvahiIfIndex interface;
@@ -76,7 +74,7 @@ struct AvahiEntry {
AVAHI_LLIST_FIELDS(AvahiEntry, entries);
AVAHI_LLIST_FIELDS(AvahiEntry, by_key);
AVAHI_LLIST_FIELDS(AvahiEntry, by_group);
-
+
AVAHI_LLIST_HEAD(AvahiAnnouncer, announcers);
};
@@ -89,20 +87,20 @@ struct AvahiSEntryGroup {
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;
@@ -110,7 +108,7 @@ struct AvahiServer {
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);
@@ -122,9 +120,9 @@ struct AvahiServer {
AVAHI_LLIST_HEAD(AvahiSDNSServerBrowser, dns_server_browsers);
int need_entry_cleanup, need_group_cleanup, need_browser_cleanup;
-
+
AvahiTimeEventQueue *time_event_queue;
-
+
char *host_name, *host_name_fqdn, *domain_name;
int fd_ipv4, fd_ipv6,
@@ -189,8 +187,8 @@ int avahi_server_add_ptr(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- uint32_t ttl,
- const char *name,
+ uint32_t ttl,
+ const char *name,
const char *dest);
#define AVAHI_CHECK_VALIDITY(server, expression, error) { \
diff --git a/avahi-core/log.c b/avahi-core/log.c
index bfd4021..d110765 100644
--- a/avahi-core/log.c
+++ b/avahi-core/log.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,9 +34,9 @@ void avahi_set_log_function(AvahiLogFunction 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
diff --git a/avahi-core/log.h b/avahi-core/log.h
index 25e3940..878f07a 100644
--- a/avahi-core/log.h
+++ b/avahi-core/log.h
@@ -1,21 +1,19 @@
#ifndef foologhfoo
#define foologhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/lookup.h b/avahi-core/lookup.h
index 0ce6fe8..06dec6e 100644
--- a/avahi-core/lookup.h
+++ b/avahi-core/lookup.h
@@ -1,21 +1,19 @@
#ifndef foolookuphfoo
#define foolookuphfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -80,7 +78,7 @@ void avahi_s_record_browser_free(AvahiSRecordBrowser *b);
/** Callback prototype for AvahiSHostNameResolver events */
typedef void (*AvahiSHostNameResolverCallback)(
AvahiSHostNameResolver *r,
- AvahiIfIndex interface,
+ 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 */
@@ -108,7 +106,7 @@ typedef void (*AvahiSAddressResolverCallback)(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiResolverEvent event,
- const AvahiAddress *a,
+ 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);
diff --git a/avahi-core/multicast-lookup.c b/avahi-core/multicast-lookup.c
index c3afcb0..75988bf 100644
--- a/avahi-core/multicast-lookup.c
+++ b/avahi-core/multicast-lookup.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,17 +39,17 @@ struct AvahiMulticastLookup {
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);
};
@@ -85,10 +83,10 @@ AvahiMulticastLookup *avahi_multicast_lookup_new(
AvahiKey *key,
AvahiMulticastLookupCallback callback,
void *userdata) {
-
+
AvahiMulticastLookup *l, *t;
struct timeval tv;
-
+
assert(e);
assert(AVAHI_IF_VALID(interface));
assert(AVAHI_PROTO_VALID(protocol));
@@ -121,7 +119,7 @@ AvahiMulticastLookup *avahi_multicast_lookup_new(
/* 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;
}
@@ -146,7 +144,7 @@ static void lookup_destroy(AvahiMulticastLookup *l) {
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)
@@ -161,7 +159,7 @@ static void lookup_destroy(AvahiMulticastLookup *l) {
if (l->cname_key)
avahi_key_unref(l->cname_key);
-
+
avahi_free(l);
}
@@ -179,13 +177,13 @@ void avahi_multicast_lookup_free(AvahiMulticastLookup *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);
}
@@ -219,7 +217,7 @@ static void* scan_cache_callback(AvahiCache *c, AvahiKey *pattern, AvahiCacheEnt
cbdata->userdata);
cbdata->n_found ++;
-
+
return NULL;
}
@@ -231,12 +229,12 @@ static void scan_interface_callback(AvahiInterfaceMonitor *m, AvahiInterface *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;
}
@@ -247,9 +245,9 @@ unsigned avahi_multicast_lookup_engine_scan_cache(
AvahiKey *key,
AvahiMulticastLookupCallback callback,
void *userdata) {
-
+
struct cbdata cbdata;
-
+
assert(e);
assert(key);
assert(callback);
@@ -264,9 +262,9 @@ unsigned avahi_multicast_lookup_engine_scan_cache(
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);
@@ -275,12 +273,12 @@ unsigned avahi_multicast_lookup_engine_scan_cache(
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;
@@ -291,7 +289,7 @@ void avahi_multicast_lookup_engine_new_interface(AvahiMulticastLookupEngine *e,
void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiInterface *i, AvahiRecord *record, AvahiBrowserEvent event) {
AvahiMulticastLookup *l;
-
+
assert(e);
assert(record);
assert(i);
@@ -313,7 +311,7 @@ void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiIn
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);
@@ -326,9 +324,9 @@ void avahi_multicast_lookup_engine_notify(AvahiMulticastLookupEngine *e, AvahiIn
AvahiMulticastLookupEngine *avahi_multicast_lookup_engine_new(AvahiServer *s) {
AvahiMulticastLookupEngine *e;
-
+
assert(s);
-
+
e = avahi_new(AvahiMulticastLookupEngine, 1);
e->server = s;
e->cleanup_dead = 0;
diff --git a/avahi-core/multicast-lookup.h b/avahi-core/multicast-lookup.h
index 43e240d..2707666 100644
--- a/avahi-core/multicast-lookup.h
+++ b/avahi-core/multicast-lookup.h
@@ -1,21 +1,19 @@
#ifndef foomulticastlookuphfoo
#define foomulticastlookuphfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/netlink.c b/avahi-core/netlink.c
index 5050801..4ded5ec 100644
--- a/avahi-core/netlink.c
+++ b/avahi-core/netlink.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -53,7 +51,7 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) {
struct iovec iov;
struct nlmsghdr *p;
char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
-
+
assert(nl);
iov.iov_base = nl->buffer;
@@ -70,7 +68,7 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) {
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;
}
@@ -88,18 +86,18 @@ int avahi_netlink_work(AvahiNetlink *nl, int block) {
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;
}
@@ -126,7 +124,7 @@ AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void
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;
@@ -162,7 +160,7 @@ AvahiNetlink *avahi_netlink_new(const AvahiPoll *poll_api, uint32_t groups, void
avahi_log_error(__FILE__": Failed to create watch.");
goto fail;
}
-
+
return nl;
fail:
@@ -186,7 +184,7 @@ void avahi_netlink_free(AvahiNetlink *nl) {
if (nl->fd >= 0)
close(nl->fd);
-
+
avahi_free(nl->buffer);
avahi_free(nl);
}
@@ -194,7 +192,7 @@ void avahi_netlink_free(AvahiNetlink *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;
diff --git a/avahi-core/netlink.h b/avahi-core/netlink.h
index 8f2f8cb..9c6eb28 100644
--- a/avahi-core/netlink.h
+++ b/avahi-core/netlink.h
@@ -1,21 +1,19 @@
#ifndef foonetlinkhfoo
#define foonetlinkhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/prioq-test.c b/avahi-core/prioq-test.c
index d85a222..6d0fd62 100644
--- a/avahi-core/prioq-test.c
+++ b/avahi-core/prioq-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -32,8 +30,8 @@
#include "prioq.h"
-#define POINTER_TO_INT(p) ((int) (p))
-#define INT_TO_POINTER(i) ((void*) (i))
+#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);
@@ -69,7 +67,7 @@ static void rec(AvahiPrioQueueNode *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) {
@@ -101,12 +99,12 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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); */
diff --git a/avahi-core/prioq.c b/avahi-core/prioq.c
index 8d91d87..28b5018 100644
--- a/avahi-core/prioq.c
+++ b/avahi-core/prioq.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -36,11 +34,11 @@ AvahiPrioQueue* avahi_prio_queue_new(AvahiPQCompareFunc compare) {
if (!(q = avahi_new(AvahiPrioQueue, 1)))
return NULL; /* OOM */
-
+
q->root = q->last = NULL;
q->n_nodes = 0;
q->compare = compare;
-
+
return q;
}
@@ -64,7 +62,7 @@ static AvahiPrioQueueNode* get_node_at_xy(AvahiPrioQueue *q, unsigned x, unsigne
for (r = 0; r < y; r++) {
assert(n);
-
+
if ((x >> (y-r-1)) & 1)
n = n->right;
else
@@ -91,7 +89,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
if (a->parent == b) {
/* B is parent of A */
-
+
p = b->parent;
b->parent = a;
@@ -113,7 +111,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
a->right->parent = a;
if ((b->right = r))
b->right->parent = b;
-
+
} else {
if ((b->right = a->right))
b->right->parent = b;
@@ -127,7 +125,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
}
} else if (b->parent == a) {
/* A ist parent of B */
-
+
p = a->parent;
a->parent = b;
@@ -162,7 +160,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
}
} else {
AvahiPrioQueueNode *apl = NULL, *bpl = NULL;
-
+
/* Swap parents */
ap = a->parent;
bp = b->parent;
@@ -171,15 +169,15 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
apl = ap->left;
if (bp)
bpl = bp->left;
-
+
if ((a->parent = bp)) {
if (bpl == b)
bp->left = a;
- else
+ else
bp->right = a;
} else
q->root = a;
-
+
if ((b->parent = ap)) {
if (apl == a)
ap->left = b;
@@ -189,8 +187,8 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
q->root = b;
/* Swap children */
- l = a->left;
- r = a->right;
+ l = a->left;
+ r = a->right;
if ((a->left = b->left))
a->left->parent = a;
@@ -204,7 +202,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
if ((b->right = r))
b->right->parent = b;
}
-
+
/* Swap siblings */
ap = a->prev; an = a->next;
bp = b->prev; bn = b->next;
@@ -221,7 +219,7 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
if ((b->prev = ap))
b->prev->next = b;
-
+
} else if (b->next == a) {
/* B is predecessor of A */
a->next = b;
@@ -240,15 +238,15 @@ static void exchange_nodes(AvahiPrioQueue *q, AvahiPrioQueueNode *a, AvahiPrioQu
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
@@ -295,14 +293,14 @@ AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
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;
@@ -313,7 +311,7 @@ AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
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);
@@ -324,7 +322,7 @@ AvahiPrioQueueNode* avahi_prio_queue_put(AvahiPrioQueue *q, void* data) {
} else {
assert(!q->root);
assert(!q->n_nodes);
-
+
n->y = n->x = 0;
q->root = n;
n->prev = n->parent = NULL;
@@ -358,7 +356,7 @@ void avahi_prio_queue_remove(AvahiPrioQueue *q, AvahiPrioQueueNode *n) {
assert(!n->right);
q->last = n->prev;
-
+
if (n->prev) {
n->prev->next = NULL;
assert(n->parent);
diff --git a/avahi-core/prioq.h b/avahi-core/prioq.h
index ace92f6..b3d31eb 100644
--- a/avahi-core/prioq.h
+++ b/avahi-core/prioq.h
@@ -1,21 +1,19 @@
#ifndef fooprioqhfoo
#define fooprioqhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/probe-sched.c b/avahi-core/probe-sched.c
index 106bb81..1e63411 100644
--- a/avahi-core/probe-sched.c
+++ b/avahi-core/probe-sched.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,13 +39,13 @@ 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);
};
@@ -61,7 +59,7 @@ struct AvahiProbeScheduler {
static AvahiProbeJob* job_new(AvahiProbeScheduler *s, AvahiRecord *record, int done) {
AvahiProbeJob *pj;
-
+
assert(s);
assert(record);
@@ -69,7 +67,7 @@ static AvahiProbeJob* job_new(AvahiProbeScheduler *s, AvahiRecord *record, int d
avahi_log_error(__FILE__": Out of memory");
return NULL; /* OOM */
}
-
+
pj->scheduler = s;
pj->record = avahi_record_ref(record);
pj->time_event = NULL;
@@ -138,13 +136,13 @@ AvahiProbeScheduler *avahi_probe_scheduler_new(AvahiInterface *i) {
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;
}
@@ -157,13 +155,13 @@ void avahi_probe_scheduler_free(AvahiProbeScheduler *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;
@@ -174,7 +172,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
assert(pj);
assert(!pj->chosen);
-
+
/* Estimate the size for this record */
size =
avahi_key_get_estimate_size(pj->record->key) +
@@ -187,7 +185,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
/* 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);
@@ -202,7 +200,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
/* 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;
@@ -212,7 +210,7 @@ static int packet_add_probe_query(AvahiProbeScheduler *s, AvahiDnsPacket *p, Ava
}
avahi_key_unref(k);
-
+
return 1;
}
@@ -234,7 +232,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
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;
@@ -249,7 +247,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
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 */
@@ -257,7 +255,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
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);
@@ -266,8 +264,8 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
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_log_warn("Probe record too large, cannot send");
+
avahi_dns_packet_free(p);
job_mark_done(s, pj);
@@ -279,10 +277,10 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
if (pj->chosen)
continue;
-
+
if (!packet_add_probe_query(s, p, pj))
break;
-
+
n++;
}
@@ -304,15 +302,15 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
/* 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 */
@@ -328,7 +326,7 @@ static AvahiProbeJob* find_scheduled_job(AvahiProbeScheduler *s, AvahiRecord *re
for (pj = s->jobs; pj; pj = pj->jobs_next) {
assert(!pj->done);
-
+
if (avahi_record_equal_no_ttl(pj->record, record))
return pj;
}
@@ -338,7 +336,7 @@ static AvahiProbeJob* find_scheduled_job(AvahiProbeScheduler *s, AvahiRecord *re
static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *record) {
AvahiProbeJob *pj;
-
+
assert(s);
assert(record);
@@ -353,7 +351,7 @@ static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *reco
job_free(s, pj);
return NULL;
}
-
+
return pj;
}
}
@@ -364,7 +362,7 @@ static AvahiProbeJob* find_history_job(AvahiProbeScheduler *s, AvahiRecord *reco
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));
@@ -387,11 +385,11 @@ int avahi_probe_scheduler_post(AvahiProbeScheduler *s, AvahiRecord *record, int
/* 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
index 3af1319..e47de41 100644
--- a/avahi-core/probe-sched.h
+++ b/avahi-core/probe-sched.h
@@ -1,21 +1,19 @@
#ifndef fooprobeschedhfoo
#define fooprobeschedhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/publish.h b/avahi-core/publish.h
index 77c49af..90797de 100644
--- a/avahi-core/publish.h
+++ b/avahi-core/publish.h
@@ -1,21 +1,19 @@
#ifndef foopublishhfoo
#define foopublishhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -83,7 +81,7 @@ int avahi_server_add(
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
@@ -114,7 +112,7 @@ int avahi_server_add_service(
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 *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;
@@ -152,9 +150,9 @@ int avahi_server_update_service_txt_strlst(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ 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 */
@@ -164,9 +162,9 @@ int avahi_server_update_service_txt(
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiPublishFlags flags,
- const char *name,
- const char *type,
- const char *domain,
+ 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*/
diff --git a/avahi-core/querier-test.c b/avahi-core/querier-test.c
index 1c28ea0..e1ce913 100644
--- a/avahi-core/querier-test.c
+++ b/avahi-core/querier-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -73,7 +71,7 @@ static void create_second_service_browser(AvahiTimeout *timeout, AVAHI_GCC_UNUSE
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);
}
@@ -84,10 +82,10 @@ static void quit(AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *
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);
@@ -100,25 +98,25 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index 8a230cd..2b1c919 100644
--- a/avahi-core/querier.c
+++ b/avahi-core/querier.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -47,7 +45,7 @@ struct AvahiQuerier {
unsigned post_id;
int post_id_valid;
-
+
AVAHI_LLIST_FIELDS(AvahiQuerier, queriers);
};
@@ -59,14 +57,14 @@ void avahi_querier_free(AvahiQuerier *q) {
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) {
@@ -84,15 +82,15 @@ static void querier_elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *us
/* 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);
}
@@ -100,12 +98,12 @@ static void querier_elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void *us
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++;
@@ -120,7 +118,7 @@ void avahi_querier_add(AvahiInterface *i, AvahiKey *key, struct timeval *ret_cti
/* 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;
@@ -185,7 +183,7 @@ static void remove_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i,
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);
}
@@ -196,7 +194,7 @@ struct cbdata {
static void add_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, void* userdata) {
struct cbdata *cbdata = userdata;
-
+
assert(m);
assert(i);
assert(cbdata);
@@ -212,7 +210,7 @@ static void add_querier_callback(AvahiInterfaceMonitor *m, AvahiInterface *i, vo
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);
@@ -221,13 +219,13 @@ void avahi_querier_add_for_all(AvahiServer *s, AvahiIfIndex idx, AvahiProtocol p
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);
@@ -237,19 +235,19 @@ int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *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;
@@ -266,6 +264,6 @@ int avahi_querier_shall_refresh_cache(AvahiInterface *i, AvahiKey *key) {
void avahi_querier_free_all(AvahiInterface *i) {
assert(i);
- while (i->queriers)
+ while (i->queriers)
avahi_querier_free(i->queriers);
}
diff --git a/avahi-core/querier.h b/avahi-core/querier.h
index 3f4eead..6a32a3b 100644
--- a/avahi-core/querier.h
+++ b/avahi-core/querier.h
@@ -1,21 +1,19 @@
#ifndef fooquerierhfoo
#define fooquerierhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/query-sched.c b/avahi-core/query-sched.c
index 0319b02..ff833f9 100644
--- a/avahi-core/query-sched.c
+++ b/avahi-core/query-sched.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -40,10 +38,10 @@ typedef struct AvahiKnownAnswer AvahiKnownAnswer;
struct AvahiQueryJob {
unsigned id;
int n_posted;
-
+
AvahiQueryScheduler *scheduler;
AvahiTimeEvent *time_event;
-
+
int done;
struct timeval delivery;
@@ -56,7 +54,7 @@ struct AvahiQueryJob {
* 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);
};
@@ -80,7 +78,7 @@ struct AvahiQueryScheduler {
static AvahiQueryJob* job_new(AvahiQueryScheduler *s, AvahiKey *key, int done) {
AvahiQueryJob *qj;
-
+
assert(s);
assert(key);
@@ -88,14 +86,14 @@ static AvahiQueryJob* job_new(AvahiQueryScheduler *s, AvahiKey *key, int done) {
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))
+
+ if ((qj->done = done))
AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->history, qj);
else
AVAHI_LLIST_PREPEND(AvahiQueryJob, jobs, s->jobs, qj);
@@ -158,11 +156,11 @@ AvahiQueryScheduler *avahi_query_scheduler_new(AvahiInterface *i) {
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);
@@ -180,7 +178,7 @@ void avahi_query_scheduler_free(AvahiQueryScheduler *s) {
void avahi_query_scheduler_clear(AvahiQueryScheduler *s) {
assert(s);
-
+
while (s->jobs)
job_free(s, s->jobs);
while (s->history)
@@ -190,7 +188,7 @@ void avahi_query_scheduler_clear(AvahiQueryScheduler *s) {
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);
@@ -198,12 +196,12 @@ static void* known_answer_walk_callback(AvahiCache *c, AvahiKey *pattern, AvahiC
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);
@@ -221,7 +219,7 @@ static int packet_add_query_job(AvahiQueryScheduler *s, AvahiDnsPacket *p, Avahi
/* 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;
@@ -234,7 +232,7 @@ static void append_known_answers_and_send(AvahiQueryScheduler *s, AvahiDnsPacket
assert(p);
n = 0;
-
+
while ((ka = s->known_answers)) {
int too_large = 0;
@@ -266,7 +264,7 @@ static void append_known_answers_and_send(AvahiQueryScheduler *s, AvahiDnsPacket
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);
@@ -289,10 +287,10 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
}
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;
@@ -320,7 +318,7 @@ static AvahiQueryJob* find_scheduled_job(AvahiQueryScheduler *s, AvahiKey *key)
for (qj = s->jobs; qj; qj = qj->jobs_next) {
assert(!qj->done);
-
+
if (avahi_key_equal(qj->key, key))
return qj;
}
@@ -330,7 +328,7 @@ static AvahiQueryJob* find_scheduled_job(AvahiQueryScheduler *s, AvahiKey *key)
static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
AvahiQueryJob *qj;
-
+
assert(s);
assert(key);
@@ -345,7 +343,7 @@ static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
job_free(s, qj);
return NULL;
}
-
+
return qj;
}
}
@@ -356,13 +354,13 @@ static AvahiQueryJob* find_history_job(AvahiQueryScheduler *s, AvahiKey *key) {
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))) {
@@ -376,25 +374,25 @@ int avahi_query_scheduler_post(AvahiQueryScheduler *s, AvahiKey *key, int immedi
}
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);
@@ -412,14 +410,14 @@ void avahi_query_scheduler_incoming(AvahiQueryScheduler *s, AvahiKey *key) {
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
@@ -428,7 +426,7 @@ int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id) {
for (qj = s->jobs; qj; qj = qj->jobs_next) {
assert(!qj->done);
-
+
if (qj->id == id) {
/* Entry found */
@@ -441,7 +439,7 @@ int avahi_query_scheduler_withdraw_by_id(AvahiQueryScheduler *s, unsigned id) {
* case since there should exist only one querier per
* key, but there are exceptions, notably reflected
* traffic.) */
-
+
job_free(s, qj);
return 1;
}
diff --git a/avahi-core/query-sched.h b/avahi-core/query-sched.h
index 5238558..b45520c 100644
--- a/avahi-core/query-sched.h
+++ b/avahi-core/query-sched.h
@@ -1,21 +1,19 @@
#ifndef fooqueryschedhfoo
#define fooqueryschedhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c
index 25d21ac..dd4adbc 100644
--- a/avahi-core/resolve-address.c
+++ b/avahi-core/resolve-address.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,7 +35,7 @@
struct AvahiSAddressResolver {
AvahiServer *server;
AvahiAddress address;
-
+
AvahiSRecordBrowser *record_browser;
AvahiSAddressResolverCallback callback;
@@ -58,7 +56,7 @@ struct AvahiSAddressResolver {
static void finish(AvahiSAddressResolver *r, AvahiResolverEvent event) {
assert(r);
-
+
if (r->time_event) {
avahi_time_event_free(r->time_event);
r->time_event = NULL;
@@ -78,7 +76,7 @@ static void finish(AvahiSAddressResolver *r, AvahiResolverEvent event) {
static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
AvahiSAddressResolver *r = userdata;
-
+
assert(e);
assert(r);
@@ -105,53 +103,53 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSAddressResolver *r = userdata;
assert(rr);
assert(r);
switch (event) {
- case AVAHI_BROWSER_NEW:
+ 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;
@@ -184,7 +182,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
AvahiLookupFlags flags,
AvahiSAddressResolverCallback callback,
void* userdata) {
-
+
AvahiSAddressResolver *r;
AvahiKey *k;
char n[AVAHI_DOMAIN_NAME_MAX];
@@ -197,7 +195,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
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))) {
@@ -210,7 +208,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
avahi_key_unref(k);
return NULL;
}
-
+
r->server = server;
r->address = *address;
r->callback = callback;
@@ -236,7 +234,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
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) {
@@ -245,7 +243,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new(
}
start_timeout(r);
-
+
return r;
}
@@ -265,6 +263,6 @@ void avahi_s_address_resolver_free(AvahiSAddressResolver *r) {
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
index 59dc3cf..08f209b 100644
--- a/avahi-core/resolve-host-name.c
+++ b/avahi-core/resolve-host-name.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -38,7 +36,7 @@
struct AvahiSHostNameResolver {
AvahiServer *server;
char *host_name;
-
+
AvahiSRecordBrowser *record_browser_a;
AvahiSRecordBrowser *record_browser_aaaa;
@@ -66,20 +64,20 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
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();
}
@@ -88,9 +86,9 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
break;
}
-
+
case AVAHI_RESOLVER_FAILURE:
-
+
r->callback(r, r->interface, r->protocol, event, r->host_name, NULL, r->flags, r->userdata);
break;
}
@@ -98,7 +96,7 @@ static void finish(AvahiSHostNameResolver *r, AvahiResolverEvent event) {
static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
AvahiSHostNameResolver *r = userdata;
-
+
assert(e);
assert(r);
@@ -126,9 +124,9 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSHostNameResolver *r = userdata;
-
+
assert(rr);
assert(r);
@@ -140,20 +138,20 @@ static void record_browser_callback(
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);
}
@@ -169,13 +167,13 @@ static void record_browser_callback(
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);
}
@@ -189,7 +187,7 @@ static void record_browser_callback(
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)
@@ -197,7 +195,7 @@ static void record_browser_callback(
r->record_browser_a = r->record_browser_aaaa = NULL;
r->flags = flags;
-
+
finish(r, AVAHI_RESOLVER_FAILURE);
break;
}
@@ -212,10 +210,10 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
AvahiLookupFlags flags,
AvahiSHostNameResolverCallback callback,
void* userdata) {
-
+
AvahiSHostNameResolver *r;
AvahiKey *k;
-
+
assert(server);
assert(host_name);
assert(callback);
@@ -230,7 +228,7 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
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;
@@ -255,7 +253,7 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
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);
@@ -269,7 +267,7 @@ AvahiSHostNameResolver *avahi_s_host_name_resolver_new(
assert(r->record_browser_aaaa || r->record_browser_a);
start_timeout(r);
-
+
return r;
fail:
@@ -293,7 +291,7 @@ void avahi_s_host_name_resolver_free(AvahiSHostNameResolver *r) {
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
index 1ad6078..3377a50 100644
--- a/avahi-core/resolve-service.c
+++ b/avahi-core/resolve-service.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -54,7 +52,7 @@ struct AvahiSServiceResolver {
AvahiRecord *srv_record, *txt_record, *address_record;
AvahiLookupResultFlags srv_flags, txt_flags, address_flags;
-
+
AvahiSServiceResolverCallback callback;
void* userdata;
AvahiLookupFlags user_flags;
@@ -66,7 +64,7 @@ struct AvahiSServiceResolver {
static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
AvahiLookupResultFlags flags;
-
+
assert(r);
if (r->time_event) {
@@ -78,10 +76,10 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
r->txt_flags |
r->srv_flags |
r->address_flags;
-
+
switch (event) {
case AVAHI_RESOLVER_FAILURE:
-
+
r->callback(
r,
r->interface,
@@ -101,9 +99,9 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
case AVAHI_RESOLVER_FOUND: {
AvahiAddress a;
-
+
assert(event == AVAHI_RESOLVER_FOUND);
-
+
assert(r->srv_record);
if (r->address_record) {
@@ -112,17 +110,17 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
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,
@@ -145,7 +143,7 @@ static void finish(AvahiSServiceResolver *r, AvahiResolverEvent event) {
static void time_event_callback(AvahiTimeEvent *e, void *userdata) {
AvahiSServiceResolver *r = userdata;
-
+
assert(e);
assert(r);
@@ -173,7 +171,7 @@ static void record_browser_callback(
AvahiRecord *record,
AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiSServiceResolver *r = userdata;
assert(rr);
@@ -191,30 +189,30 @@ static void record_browser_callback(
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;
@@ -226,8 +224,8 @@ static void record_browser_callback(
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);
@@ -236,7 +234,7 @@ static void record_browser_callback(
}
}
break;
-
+
case AVAHI_DNS_TYPE_TXT:
assert(!(r->user_flags & AVAHI_LOOKUP_NO_TXT));
@@ -246,7 +244,7 @@ static void record_browser_callback(
changed = 1;
}
break;
-
+
case AVAHI_DNS_TYPE_A:
case AVAHI_DNS_TYPE_AAAA:
@@ -257,7 +255,7 @@ static void record_browser_callback(
changed = 1;
}
break;
-
+
default:
abort();
}
@@ -272,14 +270,14 @@ static void record_browser_callback(
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;
@@ -288,42 +286,42 @@ static void record_browser_callback(
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);
@@ -332,7 +330,7 @@ static void record_browser_callback(
start_timeout(r);
}
break;
-
+
default:
abort();
}
@@ -344,7 +342,7 @@ static void record_browser_callback(
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);
@@ -360,7 +358,7 @@ static void record_browser_callback(
}
/* 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)
@@ -388,12 +386,12 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
AvahiLookupFlags flags,
AvahiSServiceResolverCallback callback,
void* userdata) {
-
+
AvahiSServiceResolver *r;
AvahiKey *k;
char n[AVAHI_DOMAIN_NAME_MAX];
int ret;
-
+
assert(server);
assert(type);
assert(callback);
@@ -413,12 +411,12 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
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);
@@ -448,7 +446,7 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
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;
@@ -456,7 +454,7 @@ AvahiSServiceResolver *avahi_s_service_resolver_new(
}
start_timeout(r);
-
+
return r;
}
@@ -467,7 +465,7 @@ void avahi_s_service_resolver_free(AvahiSServiceResolver *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)
@@ -483,7 +481,7 @@ void avahi_s_service_resolver_free(AvahiSServiceResolver *r) {
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);
diff --git a/avahi-core/response-sched.c b/avahi-core/response-sched.c
index b194ef3..abac0a1 100644
--- a/avahi-core/response-sched.c
+++ b/avahi-core/response-sched.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -55,7 +53,7 @@ typedef enum {
struct AvahiResponseJob {
AvahiResponseScheduler *scheduler;
AvahiTimeEvent *time_event;
-
+
AvahiResponseJobState state;
struct timeval delivery;
@@ -63,7 +61,7 @@ struct AvahiResponseJob {
int flush_cache;
AvahiAddress querier;
int querier_valid;
-
+
AVAHI_LLIST_FIELDS(AvahiResponseJob, jobs);
};
@@ -78,7 +76,7 @@ struct AvahiResponseScheduler {
static AvahiResponseJob* job_new(AvahiResponseScheduler *s, AvahiRecord *record, AvahiResponseJobState state) {
AvahiResponseJob *rj;
-
+
assert(s);
assert(record);
@@ -86,14 +84,14 @@ static AvahiResponseJob* job_new(AvahiResponseScheduler *s, AvahiRecord *record,
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)
+
+ 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);
@@ -161,10 +159,10 @@ AvahiResponseScheduler *avahi_response_scheduler_new(AvahiInterface *i) {
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);
@@ -181,7 +179,7 @@ void avahi_response_scheduler_free(AvahiResponseScheduler *s) {
void avahi_response_scheduler_clear(AvahiResponseScheduler *s) {
assert(s);
-
+
while (s->jobs)
job_free(s, s->jobs);
while (s->history)
@@ -192,7 +190,7 @@ void avahi_response_scheduler_clear(AvahiResponseScheduler *s) {
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);
@@ -212,7 +210,7 @@ static int packet_add_response_job(AvahiResponseScheduler *s, AvahiDnsPacket *p,
* 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;
}
@@ -232,16 +230,16 @@ static void send_response_packet(AvahiResponseScheduler *s, AvahiResponseJob *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 */
@@ -269,7 +267,7 @@ static void elapse_callback(AVAHI_GCC_UNUSED AvahiTimeEvent *e, void* data) {
assert(rj);
- if (rj->state == AVAHI_DONE || rj->state == AVAHI_SUPPRESSED)
+ 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);
@@ -283,7 +281,7 @@ static AvahiResponseJob* find_scheduled_job(AvahiResponseScheduler *s, AvahiReco
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;
}
@@ -293,7 +291,7 @@ static AvahiResponseJob* find_scheduled_job(AvahiResponseScheduler *s, AvahiReco
static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord *record) {
AvahiResponseJob *rj;
-
+
assert(s);
assert(record);
@@ -304,13 +302,13 @@ static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord
/* 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;
}
}
@@ -320,7 +318,7 @@ static AvahiResponseJob* find_history_job(AvahiResponseScheduler *s, AvahiRecord
static AvahiResponseJob* find_suppressed_job(AvahiResponseScheduler *s, AvahiRecord *record, const AvahiAddress *querier) {
AvahiResponseJob *rj;
-
+
assert(s);
assert(record);
assert(querier);
@@ -328,7 +326,7 @@ static AvahiResponseJob* find_suppressed_job(AvahiResponseScheduler *s, AvahiRec
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 */
@@ -350,7 +348,7 @@ int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record
AvahiResponseJob *rj;
struct timeval tv;
/* char *t; */
-
+
assert(s);
assert(record);
@@ -385,7 +383,7 @@ int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record
}
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)"); */
@@ -416,7 +414,7 @@ int avahi_response_scheduler_post(AvahiResponseScheduler *s, AvahiRecord *record
/* 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;
@@ -435,7 +433,7 @@ void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *r
/* 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 */
@@ -461,20 +459,20 @@ void avahi_response_scheduler_incoming(AvahiResponseScheduler *s, AvahiRecord *r
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 */
@@ -490,7 +488,7 @@ void avahi_response_scheduler_suppress(AvahiResponseScheduler *s, AvahiRecord *r
/* Let's update the old entry */
avahi_record_unref(rj->record);
rj->record = avahi_record_ref(record);
-
+
} else {
/* Create a new entry */
diff --git a/avahi-core/response-sched.h b/avahi-core/response-sched.h
index 68c4a9d..548839e 100644
--- a/avahi-core/response-sched.h
+++ b/avahi-core/response-sched.h
@@ -1,21 +1,19 @@
#ifndef fooresponseschedhfoo
#define fooresponseschedhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/rr-util.h b/avahi-core/rr-util.h
index b3c35b4..0eebc00 100644
--- a/avahi-core/rr-util.h
+++ b/avahi-core/rr-util.h
@@ -1,21 +1,19 @@
#ifndef foorrutilhfoo
#define foorrutilhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/rr.c b/avahi-core/rr.c
index 8b7fab7..7fa0bee 100644
--- a/avahi-core/rr.c
+++ b/avahi-core/rr.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -40,6 +38,7 @@
#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;
@@ -49,13 +48,13 @@ AvahiKey *avahi_key_new(const char *name, uint16_t class, uint16_t type) {
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;
@@ -87,7 +86,7 @@ AvahiKey *avahi_key_ref(AvahiKey *k) {
void avahi_key_unref(AvahiKey *k) {
assert(k);
assert(k->ref >= 1);
-
+
if ((--k->ref) <= 0) {
avahi_free(k->name);
avahi_free(k);
@@ -96,14 +95,14 @@ void avahi_key_unref(AvahiKey *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);
@@ -119,7 +118,7 @@ AvahiRecord *avahi_record_new_full(const char *name, uint16_t class, uint16_t ty
AvahiKey *k;
assert(name);
-
+
if (!(k = avahi_key_new(name, class, type))) {
avahi_log_error("avahi_key_new() failed.");
return NULL;
@@ -173,18 +172,18 @@ void avahi_record_unref(AvahiRecord *r) {
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)
+ if (class & AVAHI_DNS_CACHE_FLUSH)
return "FLUSH";
switch (class) {
@@ -227,12 +226,12 @@ const char *avahi_dns_type_to_string(uint16_t type) {
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;
@@ -242,7 +241,7 @@ char *avahi_key_to_string(const AvahiKey *k) {
snprintf(type, sizeof(type), "TYPE%u", k->type);
t = type;
}
-
+
return avahi_strdup_printf("%s\t%s\t%s", k->name, c, t);
}
@@ -252,16 +251,16 @@ char *avahi_record_to_string(const AvahiRecord *r) {
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:
@@ -296,11 +295,11 @@ char *avahi_record_to_string(const AvahiRecord *r) {
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++) {
@@ -317,7 +316,7 @@ char *avahi_record_to_string(const AvahiRecord *r) {
s = avahi_strdup_printf("%s %s ; ttl=%u", p, t, r->ttl);
avahi_free(p);
avahi_free(d);
-
+
return s;
}
@@ -327,7 +326,7 @@ int avahi_key_equal(const AvahiKey *a, const AvahiKey *b) {
if (a == b)
return 1;
-
+
return avahi_domain_equal(a->name, b->name) &&
a->type == b->type &&
a->clazz == b->clazz;
@@ -341,7 +340,7 @@ int avahi_key_pattern_match(const AvahiKey *pattern, const AvahiKey *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);
@@ -359,7 +358,7 @@ unsigned avahi_key_hash(const AvahiKey *k) {
assert(k);
return
- avahi_domain_hash(k->name) +
+ avahi_domain_hash(k->name) +
k->type +
k->clazz;
}
@@ -400,7 +399,7 @@ static int rdata_equal(const AvahiRecord *a, const AvahiRecord *b) {
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) {
@@ -423,7 +422,7 @@ AvahiRecord *avahi_record_copy(AvahiRecord *r) {
avahi_log_error("avahi_new() failed.");
return NULL;
}
-
+
copy->ref = 1;
copy->key = avahi_key_ref(r->key);
copy->ttl = r->ttl;
@@ -471,7 +470,7 @@ AvahiRecord *avahi_record_copy(AvahiRecord *r) {
goto fail;
copy->data.generic.size = r->data.generic.size;
break;
-
+
}
return copy;
@@ -481,7 +480,7 @@ fail:
avahi_key_unref(copy->key);
avahi_free(copy);
-
+
return NULL;
}
@@ -535,7 +534,7 @@ size_t avahi_record_get_estimate_size(AvahiRecord *r) {
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);
@@ -585,7 +584,7 @@ int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) {
(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;
}
@@ -606,15 +605,15 @@ int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) {
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);
@@ -626,13 +625,13 @@ int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) {
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));
@@ -644,7 +643,7 @@ int avahi_record_lexicographical_compare(AvahiRecord *a, AvahiRecord *b) {
b->data.generic.data, b->data.generic.size);
}
-
+
fail:
avahi_log_error(__FILE__": Out of memory");
return -1; /* or whatever ... */
@@ -661,7 +660,7 @@ int avahi_key_is_valid(AvahiKey *k) {
if (!avahi_is_valid_domain_name(k->name))
return 0;
-
+
return 1;
}
@@ -685,7 +684,7 @@ int avahi_record_is_valid(AvahiRecord *r) {
return
strlen(r->data.hinfo.os) <= 255 &&
strlen(r->data.hinfo.cpu) <= 255;
-
+
case AVAHI_DNS_TYPE_TXT: {
AvahiStringList *strlst;
@@ -697,7 +696,38 @@ int avahi_record_is_valid(AvahiRecord *r) {
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
index 6bfe0ec..794b83f 100644
--- a/avahi-core/rr.h
+++ b/avahi-core/rr.h
@@ -1,21 +1,19 @@
#ifndef foorrhfoo
#define foorrhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,8 +35,8 @@ AVAHI_C_DECL_BEGIN
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_TKEY = 249,
+ AVAHI_DNS_TYPE_TSIG = 250,
AVAHI_DNS_TYPE_IXFR = 251,
AVAHI_DNS_TYPE_AXFR = 252
};
@@ -67,16 +65,16 @@ typedef struct AvahiKey {
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;
@@ -106,7 +104,7 @@ typedef struct AvahiRecord {
} aaaa; /**< Data for AAAA records */
} data; /**< Record data */
-
+
} AvahiRecord;
/** Create a new AvahiKey object. The reference counter will be set to 1. */
@@ -121,7 +119,7 @@ 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);
+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);
@@ -152,7 +150,7 @@ 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);
+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);
@@ -169,6 +167,9 @@ 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
index 915ecbb..0a794ab 100644
--- a/avahi-core/rrlist.c
+++ b/avahi-core/rrlist.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -57,7 +55,7 @@ AvahiRecordList *avahi_record_list_new(void) {
avahi_log_error("avahi_new() failed.");
return NULL;
}
-
+
AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->read);
AVAHI_LLIST_HEAD_INIT(AvahiRecordListItem, l->unread);
@@ -76,18 +74,18 @@ static void item_free(AvahiRecordList *l, AvahiRecordListItem *i) {
assert(l);
assert(i);
- if (i->read)
+ 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)
@@ -104,7 +102,7 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, in
return NULL;
assert(!i->read);
-
+
r = avahi_record_ref(i->record);
if (ret_unicast_response)
*ret_unicast_response = i->unicast_response;
@@ -117,7 +115,7 @@ AvahiRecord* avahi_record_list_next(AvahiRecordList *l, int *ret_flush_cache, in
AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->read, i);
i->read = 1;
-
+
return r;
}
@@ -126,7 +124,7 @@ static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) {
assert(l);
assert(r);
-
+
for (i = l->read; i; i = i->items_next)
if (avahi_record_equal_no_ttl(i->record, r))
return i;
@@ -140,7 +138,7 @@ static AvahiRecordListItem *get(AvahiRecordList *l, AvahiRecord *r) {
void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache, int unicast_response, int auxiliary) {
AvahiRecordListItem *i;
-
+
assert(l);
assert(r);
@@ -151,7 +149,7 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache,
avahi_log_error("avahi_new() failed.");
return;
}
-
+
i->unicast_response = unicast_response;
i->flush_cache = flush_cache;
i->auxiliary = auxiliary;
@@ -159,7 +157,7 @@ void avahi_record_list_push(AvahiRecordList *l, AvahiRecord *r, int flush_cache,
i->read = 0;
l->all_flush_cache = l->all_flush_cache && flush_cache;
-
+
AVAHI_LLIST_PREPEND(AvahiRecordListItem, items, l->unread, i);
}
@@ -177,7 +175,7 @@ void avahi_record_list_drop(AvahiRecordList *l, AvahiRecord *r) {
int avahi_record_list_is_empty(AvahiRecordList *l) {
assert(l);
-
+
return !l->unread && !l->read;
}
@@ -185,6 +183,6 @@ 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
index 9c07ecd..c7b5aba 100644
--- a/avahi-core/rrlist.h
+++ b/avahi-core/rrlist.h
@@ -1,21 +1,19 @@
#ifndef foorrlisthfoo
#define foorrlisthfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/server.c b/avahi-core/server.c
index bb625a5..558fec9 100644
--- a/avahi-core/server.c
+++ b/avahi-core/server.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -51,6 +49,8 @@
#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);
@@ -659,7 +659,6 @@ static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInter
avahi_dns_packet_get_field(p, AVAHI_DNS_FIELD_ARCOUNT); n > 0; n--) {
AvahiRecord *record;
int cache_flush = 0;
-/* char *txt; */
if (!(record = avahi_dns_packet_consume_record(p, &cache_flush))) {
avahi_log_warn(__FILE__": Packet too short or invalid while reading response record. (Maybe a UTF-8 problem?)");
@@ -669,7 +668,7 @@ static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInter
if (!avahi_key_is_pattern(record->key)) {
if (handle_conflict(s, i, record, cache_flush)) {
- if (!from_local_iface)
+ 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);
@@ -680,7 +679,7 @@ static void handle_response_packet(AvahiServer *s, AvahiDnsPacket *p, AvahiInter
}
/* If the incoming response contained a conflicting record, some
- records have been scheduling for sending. We need to flush them
+ 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);
@@ -1009,13 +1008,6 @@ static void dispatch_legacy_unicast_packet(AvahiServer *s, AvahiDnsPacket *p) {
avahi_dns_packet_set_field(p, AVAHI_DNS_FIELD_ID, slot->id);
}
-static void cleanup_dead(AvahiServer *s) {
- assert(s);
-
- avahi_cleanup_dead_entries(s);
- avahi_browser_cleanup(s);
-}
-
static void mcast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, void *userdata) {
AvahiServer *s = userdata;
AvahiAddress dest, src;
@@ -1044,11 +1036,11 @@ static void mcast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent events, vo
if (iface != AVAHI_IF_UNSPEC)
dispatch_packet(s, p, &src, port, &dest, iface, ttl);
else
- avahi_log_error("Incoming packet recieved on address that isn't local.");
+ avahi_log_error("Incoming packet received on address that isn't local.");
avahi_dns_packet_free(p);
- cleanup_dead(s);
+ avahi_cleanup_dead_entries(s);
}
}
@@ -1071,7 +1063,7 @@ static void legacy_unicast_socket_event(AvahiWatch *w, int fd, AvahiWatchEvent e
dispatch_legacy_unicast_packet(s, p);
avahi_dns_packet_free(p);
- cleanup_dead(s);
+ avahi_cleanup_dead_entries(s);
}
}
@@ -1593,6 +1585,7 @@ AvahiServerConfig* avahi_server_config_init(AvahiServerConfig *c) {
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;
return c;
}
diff --git a/avahi-core/socket.c b/avahi-core/socket.c
index 4146d5a..be62105 100644
--- a/avahi-core/socket.c
+++ b/avahi-core/socket.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -450,6 +448,9 @@ static int sendmsg_loop(int fd, struct msghdr *msg, int flags) {
if (sendmsg(fd, msg, flags) >= 0)
break;
+ if (errno == EINTR)
+ continue;
+
if (errno != EAGAIN) {
char where[64];
struct sockaddr_in *sin = msg->msg_name;
@@ -652,6 +653,10 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv4(
goto fail;
}
+ /* For corrupt packets FIONREAD returns zero size (See rhbz #607297) */
+ if (!ms)
+ goto fail;
+
p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
io.iov_base = AVAHI_DNS_PACKET_DATA(p);
@@ -805,6 +810,10 @@ AvahiDnsPacket *avahi_recv_dns_packet_ipv6(
goto fail;
}
+ /* For corrupt packets FIONREAD returns zero size (See rhbz #607297) */
+ if (!ms)
+ goto fail;
+
p = avahi_dns_packet_new(ms + AVAHI_DNS_PACKET_EXTRA_SIZE);
io.iov_base = AVAHI_DNS_PACKET_DATA(p);
diff --git a/avahi-core/socket.h b/avahi-core/socket.h
index 237b534..92f12d7 100644
--- a/avahi-core/socket.h
+++ b/avahi-core/socket.h
@@ -1,21 +1,19 @@
#ifndef foosockethfoo
#define foosockethfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/timeeventq-test.c b/avahi-core/timeeventq-test.c
index c66a55a..d7b2e39 100644
--- a/avahi-core/timeeventq-test.c
+++ b/avahi-core/timeeventq-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -32,8 +30,8 @@
#include "timeeventq.h"
#include "log.h"
-#define POINTER_TO_INT(p) ((int) (p))
-#define INT_TO_POINTER(i) ((void*) (i))
+#define POINTER_TO_INT(p) ((int) (long) (p))
+#define INT_TO_POINTER(i) ((void*) (long) (i))
static AvahiTimeEventQueue *q = NULL;
diff --git a/avahi-core/timeeventq.c b/avahi-core/timeeventq.c
index 17334ee..2799bf2 100644
--- a/avahi-core/timeeventq.c
+++ b/avahi-core/timeeventq.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -83,7 +81,7 @@ static void expiration_event(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void *userd
struct timeval now;
gettimeofday(&now, NULL);
-
+
/* Check if expired */
if (avahi_timeval_compare(&now, &e->expiry) >= 0) {
@@ -97,7 +95,7 @@ static void expiration_event(AVAHI_GCC_UNUSED AvahiTimeout *timeout, void *userd
update_timeout(q);
return;
- }
+ }
}
avahi_log_debug(__FILE__": Strange, expiration_event() called, but nothing really happened.");
@@ -129,9 +127,9 @@ AvahiTimeEventQueue* avahi_time_event_queue_new(const AvahiPoll *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)))
+ if (!(q->timeout = poll_api->timeout_new(poll_api, NULL, expiration_event, q)))
goto oom;
-
+
return q;
oom:
@@ -142,13 +140,13 @@ oom:
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)))
@@ -156,7 +154,7 @@ void avahi_time_event_queue_free(AvahiTimeEventQueue *q) {
avahi_prio_queue_free(q->prioq);
q->poll_api->timeout_free(q->timeout);
-
+
avahi_free(q);
}
@@ -165,9 +163,9 @@ AvahiTimeEvent* avahi_time_event_new(
const struct timeval *timeval,
AvahiTimeEventCallback callback,
void* userdata) {
-
+
AvahiTimeEvent *e;
-
+
assert(q);
assert(callback);
assert(userdata);
@@ -176,7 +174,7 @@ AvahiTimeEvent* avahi_time_event_new(
avahi_log_error(__FILE__": Out of memory");
return NULL; /* OOM */
}
-
+
e->queue = q;
e->callback = callback;
e->userdata = userdata;
@@ -187,9 +185,9 @@ AvahiTimeEvent* avahi_time_event_new(
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;
@@ -221,7 +219,7 @@ void avahi_time_event_update(AvahiTimeEvent *e, const struct timeval *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
index cdfa5e6..a695b6a 100644
--- a/avahi-core/timeeventq.h
+++ b/avahi-core/timeeventq.h
@@ -1,21 +1,19 @@
#ifndef footimeeventqhfoo
#define footimeeventqhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/update-test.c b/avahi-core/update-test.c
index 6b92900..feb884a 100644
--- a/avahi-core/update-test.c
+++ b/avahi-core/update-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,11 +40,11 @@ static AvahiSEntryGroup *group = NULL;
static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UNUSED void* userdata) {
- avahi_log_debug("server state: %i", state);
-
+ 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);
@@ -62,7 +60,7 @@ static void modify_txt_callback(AVAHI_GCC_UNUSED AvahiTimeout *e, void *userdata
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);
}
@@ -76,7 +74,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
simple_poll = avahi_simple_poll_new();
assert(simple_poll);
-
+
poll_api = avahi_simple_poll_get(simple_poll);
assert(poll_api);
diff --git a/avahi-core/util.c b/avahi-core/util.c
index b1925f0..21ef94c 100644
--- a/avahi-core/util.c
+++ b/avahi-core/util.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -37,11 +35,11 @@ void avahi_hexdump(const void* p, size_t size) {
assert(p);
printf("Dumping %lu bytes from %p:\n", (unsigned long) size, p);
-
+
while (size > 0) {
unsigned i;
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
if (i < size)
printf("%02x ", c[i]);
else
@@ -54,14 +52,14 @@ void avahi_hexdump(const void* p, size_t size) {
else
printf(" ");
}
-
+
printf("\n");
c += 16;
if (size <= 16)
break;
-
+
size -= 16;
}
}
@@ -74,22 +72,22 @@ char *avahi_format_mac_address(char *r, size_t l, const uint8_t* mac, size_t siz
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++;
}
@@ -97,7 +95,7 @@ char *avahi_format_mac_address(char *r, size_t l, const uint8_t* mac, size_t siz
*(t-1) = 0;
else
*r = 0;
-
+
return r;
}
diff --git a/avahi-core/util.h b/avahi-core/util.h
index 8d2caee..e13c334 100644
--- a/avahi-core/util.h
+++ b/avahi-core/util.h
@@ -1,21 +1,19 @@
#ifndef fooutilhfoo
#define fooutilhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-core/wide-area.c b/avahi-core/wide-area.c
index add81c7..d5e64e5 100644
--- a/avahi-core/wide-area.c
+++ b/avahi-core/wide-area.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,13 +46,13 @@ 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);
};
@@ -62,12 +60,12 @@ struct AvahiWideAreaCacheEntry {
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;
@@ -87,7 +85,7 @@ struct AvahiWideAreaLookupEngine {
AvahiWatch *watch_ipv4, *watch_ipv6;
uint16_t next_id;
-
+
/* Cache */
AVAHI_LLIST_HEAD(AvahiWideAreaCacheEntry, cache);
AvahiHashmap *cache_by_key;
@@ -108,23 +106,23 @@ struct AvahiWideAreaLookupEngine {
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);
@@ -135,20 +133,20 @@ static int send_to_dns_server(AvahiWideAreaLookup *l, AvahiDnsPacket *p) {
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);
}
}
@@ -164,7 +162,7 @@ static void next_dns_server(AvahiWideAreaLookupEngine *e) {
static void lookup_stop(AvahiWideAreaLookup *l) {
assert(l);
-
+
l->callback = NULL;
if (l->time_event) {
@@ -187,7 +185,7 @@ static void sender_timeout_callback(AvahiTimeEvent *e, void *userdata) {
/* 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);
@@ -208,7 +206,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
AvahiKey *key,
AvahiWideAreaLookupCallback callback,
void *userdata) {
-
+
struct timeval tv;
AvahiWideAreaLookup *l, *t;
uint8_t *p;
@@ -234,7 +232,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
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);
@@ -243,7 +241,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
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) {
@@ -257,7 +255,7 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
}
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);
@@ -267,14 +265,14 @@ AvahiWideAreaLookup *avahi_wide_area_lookup_new(
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);
@@ -285,7 +283,7 @@ static void lookup_destroy(AvahiWideAreaLookup *l) {
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);
@@ -294,7 +292,7 @@ static void lookup_destroy(AvahiWideAreaLookup *l) {
if (l->cname_key)
avahi_key_unref(l->cname_key);
-
+
avahi_free(l);
}
@@ -315,10 +313,10 @@ void avahi_wide_area_cleanup(AvahiWideAreaLookupEngine *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);
}
@@ -349,7 +347,7 @@ static void cache_entry_free(AvahiWideAreaCacheEntry *c) {
static void expiry_event(AvahiTimeEvent *te, void *userdata) {
AvahiWideAreaCacheEntry *e = userdata;
-
+
assert(te);
assert(e);
@@ -358,7 +356,7 @@ static void expiry_event(AvahiTimeEvent *te, void *userdata) {
static AvahiWideAreaCacheEntry* find_record_in_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
AvahiWideAreaCacheEntry *c;
-
+
assert(e);
assert(r);
@@ -371,17 +369,17 @@ static AvahiWideAreaCacheEntry* find_record_in_cache(AvahiWideAreaLookupEngine *
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 */
@@ -390,7 +388,7 @@ static void run_callbacks(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
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);
@@ -404,7 +402,7 @@ static void run_callbacks(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
AvahiWideAreaCacheEntry *c;
int is_new;
-
+
assert(e);
assert(r);
@@ -422,7 +420,7 @@ static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
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;
@@ -438,7 +436,7 @@ static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
}
c->record = avahi_record_ref(r);
-
+
gettimeofday(&c->timestamp, NULL);
c->expiry = c->timestamp;
avahi_timeval_add(&c->expiry, r->ttl * 1000000);
@@ -449,7 +447,7 @@ static void add_to_cache(AvahiWideAreaLookupEngine *e, AvahiRecord *r) {
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);
}
@@ -484,7 +482,7 @@ static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
int i, r;
AvahiBrowserEvent final_event = AVAHI_BROWSER_ALL_FOR_NOW;
-
+
assert(e);
assert(p);
@@ -513,7 +511,7 @@ static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
/* 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);
@@ -543,7 +541,7 @@ static void handle_packet(AvahiWideAreaLookupEngine *e, AvahiDnsPacket *p) {
}
finish:
-
+
if (l && !l->dead) {
if (l->callback)
l->callback(e, final_event, AVAHI_LOOKUP_RESULT_WIDE_AREA, NULL, l->userdata);
@@ -555,7 +553,7 @@ finish:
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 {
@@ -571,7 +569,7 @@ static void socket_event(AVAHI_GCC_UNUSED AvahiWatch *w, int fd, AVAHI_GCC_UNUSE
AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
AvahiWideAreaLookupEngine *e;
-
+
assert(s);
e = avahi_new(AvahiWideAreaLookupEngine, 1);
@@ -590,7 +588,7 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
if (e->fd_ipv4 >= 0)
close(e->fd_ipv4);
-
+
avahi_free(e);
return NULL;
}
@@ -598,7 +596,7 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
/* 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)
@@ -622,12 +620,12 @@ AvahiWideAreaLookupEngine *avahi_wide_area_engine_new(AvahiServer *s) {
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);
@@ -640,7 +638,7 @@ void avahi_wide_area_engine_free(AvahiWideAreaLookupEngine *e) {
if (e->fd_ipv6 >= 0)
close(e->fd_ipv6);
-
+
if (e->fd_ipv4 >= 0)
close(e->fd_ipv4);
@@ -660,14 +658,14 @@ void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddres
assert(e);
if (a) {
- for (e->n_dns_servers = 0; n > 0 && e->n_dns_servers < AVAHI_WIDE_AREA_SERVERS_MAX; a++, n--)
+ 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);
@@ -675,12 +673,12 @@ void avahi_wide_area_set_servers(AvahiWideAreaLookupEngine *e, const AvahiAddres
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);
@@ -692,7 +690,7 @@ unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key,
AvahiWideAreaCacheEntry *c;
AvahiKey *cname_key;
unsigned n = 0;
-
+
assert(e);
assert(key);
assert(callback);
@@ -708,7 +706,7 @@ unsigned avahi_wide_area_scan_cache(AvahiWideAreaLookupEngine *e, AvahiKey *key,
callback(e, AVAHI_BROWSER_NEW, AVAHI_LOOKUP_RESULT_WIDE_AREA|AVAHI_LOOKUP_RESULT_CACHED, c->record, userdata);
n++;
}
-
+
avahi_key_unref(cname_key);
}
@@ -722,4 +720,4 @@ int avahi_wide_area_has_servers(AvahiWideAreaLookupEngine *e) {
}
-
+
diff --git a/avahi-core/wide-area.h b/avahi-core/wide-area.h
index 1af613b..b1dc570 100644
--- a/avahi-core/wide-area.h
+++ b/avahi-core/wide-area.h
@@ -1,21 +1,19 @@
#ifndef foowideareahfoo
#define foowideareahfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/.gitignore b/avahi-daemon/.gitignore
index bb2aeab..f1a6f8d 100644
--- a/avahi-daemon/.gitignore
+++ b/avahi-daemon/.gitignore
@@ -1,3 +1,5 @@
+avahi-daemon.service
+avahi-daemon.socket
avahi-daemon
avahi-dbus.conf
ini-file-parser-test
diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am
index 0aac0fc..b5d2bf4 100644
--- a/avahi-daemon/Makefile.am
+++ b/avahi-daemon/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
@@ -27,7 +25,8 @@ if HAVE_XML
pkgsysconfdir=$(sysconfdir)/avahi
servicedir=$(pkgsysconfdir)/services
-introspectiondir=$(pkgdatadir)/introspection
+introspectiondir=$(datadir)/dbus-1/interfaces
+dbussystemservicesdir=$(datadir)/dbus-1/system-services
AM_CFLAGS+= \
-DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \
@@ -53,6 +52,7 @@ avahi_daemon_SOURCES = \
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)
@@ -63,19 +63,37 @@ ini_file_parser_test_SOURCES = \
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
+ini_file_parser_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la
pkgsysconf_DATA = \
avahi-daemon.conf \
hosts
-service_DATA = \
+dist_service_DATA = \
ssh.service \
sftp-ssh.service
-pkgdata_DATA = \
+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 += \
@@ -117,43 +135,32 @@ avahi_daemon_LDADD += \
avahi_daemon_CFLAGS += $(DBUS_CFLAGS) -DDBUS_SYSTEM_BUS_DEFAULT_ADDRESS=\"$(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)\"
-dbusservice_DATA = avahi-dbus.conf
+dist_dbusservice_DATA = avahi-dbus.conf
-introspection_DATA = \
- Server.introspect \
- EntryGroup.introspect \
- DomainBrowser.introspect \
- ServiceTypeBrowser.introspect \
- ServiceBrowser.introspect \
- ServiceResolver.introspect \
- AddressResolver.introspect \
- HostNameResolver.introspect \
- RecordBrowser.introspect
+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-service.dtd \
avahi-daemon.conf \
example.service \
- avahi-dbus.conf \
- Server.introspect \
- EntryGroup.introspect \
- DomainBrowser.introspect \
- ServiceTypeBrowser.introspect \
- ServiceBrowser.introspect \
- ServiceResolver.introspect \
- AddressResolver.introspect \
- HostNameResolver.introspect \
- RecordBrowser.introspect \
- ssh.service \
- sftp-ssh.service \
hosts \
example.service \
introspect.dtd \
- introspect.xsl
+ introspect.xsl \
+ avahi-daemon.service.in \
+ avahi-daemon.socket.in
xmllint:
xmllint --noout --valid example.service
@@ -163,3 +170,7 @@ xmllint:
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
index ad69c73..456f330 100644
--- a/avahi-daemon/avahi-daemon.conf
+++ b/avahi-daemon/avahi-daemon.conf
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
@@ -33,6 +31,10 @@ use-ipv6=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
[wide-area]
enable-wide-area=yes
diff --git a/avahi-daemon/avahi-daemon.service.in b/avahi-daemon/avahi-daemon.service.in
new file mode 100644
index 0000000..d5a9dd4
--- /dev/null
+++ b/avahi-daemon/avahi-daemon.service.in
@@ -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.
+
+[Unit]
+Requires=basic.target avahi-daemon.socket
+After=basic.target syslog.target avahi-daemon.socket
+Conflicts=shutdown.target
+
+[Service]
+Type=dbus
+BusName=org.freedesktop.Avahi
+ExecStart=@sbindir@/avahi-daemon -s
+ExecReload=@sbindir@/avahi-daemon -r
+
+[Install]
+WantedBy=multi-user.target
+Also=avahi-daemon.socket
diff --git a/avahi-daemon/avahi-daemon.socket.in b/avahi-daemon/avahi-daemon.socket.in
new file mode 100644
index 0000000..b8e6b79
--- /dev/null
+++ b/avahi-daemon/avahi-daemon.socket.in
@@ -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.
+
+[Unit]
+After=sysinit.target
+Before=sockets.target
+Conflicts=shutdown.target
+
+[Socket]
+ListenStream=@avahi_runtime_dir@/avahi-daemon/socket
+
+[Install]
+WantedBy=sockets.target
diff --git a/avahi-daemon/avahi-service.dtd b/avahi-daemon/avahi-service.dtd
index c3c25e2..daf9637 100644
--- a/avahi-daemon/avahi-service.dtd
+++ b/avahi-daemon/avahi-service.dtd
@@ -1,5 +1,3 @@
-<!-- $Id$ -->
-
<!ELEMENT service-group (name,service+)>
<!ATTLIST service-group>
<!ELEMENT name (#PCDATA)>
diff --git a/avahi-daemon/caps.c b/avahi-daemon/caps.c
index fbb9d7a..0e21acf 100644
--- a/avahi-daemon/caps.c
+++ b/avahi-daemon/caps.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -38,18 +36,18 @@ 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;
@@ -73,7 +71,7 @@ int avahi_caps_reduce2(void) {
/* 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));
@@ -106,12 +104,12 @@ int avahi_caps_drop_all(void) {
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
index 788aceb..5119bd0 100644
--- a/avahi-daemon/caps.h
+++ b/avahi-daemon/caps.h
@@ -1,21 +1,19 @@
#ifndef foocapshfoo
#define foocapshfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/chroot.c b/avahi-daemon/chroot.c
index 20e2f03..d796a39 100644
--- a/avahi-daemon/chroot.c
+++ b/avahi-daemon/chroot.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -66,15 +64,15 @@ static const char* const get_file_name_table[AVAHI_CHROOT_MAX] = {
NULL,
"/etc/resolv.conf",
#ifdef HAVE_DBUS
- AVAHI_DBUS_INTROSPECTION_DIR"/Server.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/EntryGroup.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/AddressResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/DomainBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/HostNameResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceResolver.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/ServiceTypeBrowser.introspect",
- AVAHI_DBUS_INTROSPECTION_DIR"/RecordBrowser.introspect",
+ 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
@@ -106,19 +104,19 @@ static int send_fd(int fd, int payload_fd) {
struct iovec iov;
struct msghdr msg;
union {
- struct cmsghdr hdr;
- char buf[CMSG_SPACE(sizeof(int))];
+ 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_base = &dummy;
iov.iov_len = sizeof(dummy);
-
+
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_name = NULL;
@@ -127,7 +125,7 @@ static int send_fd(int fd, int payload_fd) {
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;
@@ -146,8 +144,8 @@ static int recv_fd(int fd) {
struct iovec iov;
struct msghdr msg;
union {
- struct cmsghdr hdr;
- char buf[CMSG_SPACE(sizeof(int))];
+ struct cmsghdr hdr;
+ char buf[CMSG_SPACE(sizeof(int))];
} cmsg;
/* Receive a file descriptor from a socket */
@@ -155,10 +153,10 @@ static int recv_fd(int fd) {
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;
@@ -167,12 +165,12 @@ static int recv_fd(int fd) {
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;
@@ -183,7 +181,7 @@ static int recv_fd(int fd) {
errno = EINVAL;
return -1;
}
-
+
if (!(h = CMSG_FIRSTHDR(&msg))) {
avahi_log_error("recvmsg() sent no fd.");
errno = EINVAL;
@@ -197,7 +195,7 @@ static int recv_fd(int fd) {
return *((int*)CMSG_DATA(h));
}
}
-
+
static int helper_main(int fd) {
int ret = 1;
assert(fd >= 0);
@@ -207,7 +205,7 @@ static int helper_main(int fd) {
* mind that this code is security sensitive! */
avahi_log_debug(__FILE__": chroot() helper started");
-
+
for (;;) {
uint8_t command;
ssize_t r;
@@ -217,7 +215,7 @@ static int helper_main(int fd) {
/* EOF? */
if (r == 0)
break;
-
+
avahi_log_error(__FILE__": read() failed: %s", strerror(errno));
goto fail;
}
@@ -250,7 +248,7 @@ static int helper_main(int fd) {
avahi_log_error(__FILE__": write() failed: %s\n", strerror(errno));
goto fail;
}
-
+
break;
}
@@ -258,24 +256,24 @@ static int helper_main(int fd) {
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;
@@ -283,11 +281,11 @@ static int helper_main(int fd) {
}
ret = 0;
-
+
fail:
avahi_log_debug(__FILE__": chroot() helper exiting with return value %i", ret);
-
+
return ret;
}
@@ -296,12 +294,12 @@ int avahi_chroot_helper_start(const char *argv0) {
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]);
@@ -309,15 +307,13 @@ int avahi_chroot_helper_start(const char *argv0) {
return -1;
} else if (pid == 0) {
- setsid();
-
/* Drop all remaining capabilities */
avahi_caps_drop_all();
avahi_set_proc_title(argv0, "%s: chroot helper", argv0);
daemon_retval_done();
-
+
close(sock[0]);
helper_main(sock[1]);
_exit(0);
@@ -342,7 +338,7 @@ 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)
@@ -355,7 +351,7 @@ int avahi_chroot_helper_get_fd(const char *fname) {
}
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;
@@ -386,7 +382,7 @@ 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)
@@ -407,11 +403,11 @@ int avahi_chroot_helper_unlink(const char *fname) {
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
index ea61c5a..2828d54 100644
--- a/avahi-daemon/chroot.h
+++ b/avahi-daemon/chroot.h
@@ -1,21 +1,19 @@
#ifndef foochroothelperhfoo
#define foochroothelperhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/dbus-async-address-resolver.c b/avahi-daemon/dbus-async-address-resolver.c
index f05af8f..a77e03c 100644
--- a/avahi-daemon/dbus-async-address-resolver.c
+++ b/avahi-daemon/dbus-async-address-resolver.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,11 +41,11 @@ void avahi_dbus_async_address_resolver_free(AsyncAddressResolverInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -55,12 +53,17 @@ 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) {
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;
@@ -74,7 +77,7 @@ void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiI
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,
@@ -90,7 +93,7 @@ void avahi_dbus_async_address_resolver_callback(AvahiSAddressResolver *r, AvahiI
avahi_dbus_append_server_error(reply);
}
- dbus_message_set_destination(reply, i->client->name);
+ dbus_message_set_destination(reply, i->client->name);
dbus_connection_send(server->bus, reply, NULL);
dbus_message_unref(reply);
}
@@ -102,7 +105,7 @@ DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c,
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -112,12 +115,12 @@ DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c,
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "AddressResolver.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))
+ 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)) {
@@ -128,12 +131,12 @@ DBusHandlerResult avahi_dbus_msg_async_address_resolver_impl(DBusConnection *c,
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
index a2c99a7..7c2d063 100644
--- a/avahi-daemon/dbus-async-host-name-resolver.c
+++ b/avahi-daemon/dbus-async-host-name-resolver.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -45,8 +43,8 @@ void avahi_dbus_async_host_name_resolver_free(AsyncHostNameResolverInfo *i) {
}
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -54,12 +52,17 @@ 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) {
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;
@@ -73,7 +76,7 @@ void avahi_dbus_async_host_name_resolver_callback(AvahiSHostNameResolver *r, Ava
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,
@@ -88,7 +91,7 @@ void avahi_dbus_async_host_name_resolver_callback(AvahiSHostNameResolver *r, Ava
avahi_dbus_append_server_error(reply);
}
- dbus_message_set_destination(reply, i->client->name);
+ dbus_message_set_destination(reply, i->client->name);
dbus_connection_send(server->bus, reply, NULL);
dbus_message_unref(reply);
}
@@ -100,7 +103,7 @@ DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -110,12 +113,12 @@ DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "HostNameResolver.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))
+ 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)) {
@@ -126,13 +129,12 @@ DBusHandlerResult avahi_dbus_msg_async_host_name_resolver_impl(DBusConnection *c
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
index a9a1364..2b58e2d 100644
--- a/avahi-daemon/dbus-async-service-resolver.c
+++ b/avahi-daemon/dbus-async-service-resolver.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,11 +41,11 @@ void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -64,26 +62,31 @@ void avahi_dbus_async_service_resolver_callback(
const AvahiAddress *a,
uint16_t port,
AvahiStringList *txt,
- AvahiLookupResultFlags flags,
+ 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
@@ -97,9 +100,9 @@ void avahi_dbus_async_service_resolver_callback(
i_interface = (int32_t) interface;
i_protocol = (int32_t) protocol;
- if (a)
+ if (a)
i_aprotocol = (int32_t) a->proto;
- else
+ else
i_aprotocol = AVAHI_PROTO_UNSPEC;
u_flags = (uint32_t) flags;
@@ -127,7 +130,7 @@ void avahi_dbus_async_service_resolver_callback(
avahi_dbus_append_server_error(reply);
}
- dbus_message_set_destination(reply, i->client->name);
+ dbus_message_set_destination(reply, i->client->name);
dbus_connection_send(server->bus, reply, NULL);
dbus_message_unref(reply);
}
@@ -139,7 +142,7 @@ DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c,
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -149,12 +152,12 @@ DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c,
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceResolver.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))
+ 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)) {
@@ -165,13 +168,12 @@ DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c,
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
index b529ede..e51996f 100644
--- a/avahi-daemon/dbus-domain-browser.c
+++ b/avahi-daemon/dbus-domain-browser.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,11 +41,11 @@ void avahi_dbus_domain_browser_free(DomainBrowserInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -59,7 +57,7 @@ DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMess
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -69,12 +67,12 @@ DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMess
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "DomainBrowser.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))
+ 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)) {
@@ -84,15 +82,15 @@ DBusHandlerResult avahi_dbus_msg_domain_browser_impl(DBusConnection *c, DBusMess
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;
}
@@ -101,7 +99,7 @@ void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex int
DBusMessage *m;
int32_t i_interface, i_protocol;
uint32_t u_flags;
-
+
assert(b);
assert(i);
@@ -111,6 +109,11 @@ void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex int
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(
@@ -122,9 +125,8 @@ void avahi_dbus_domain_browser_callback(AvahiSDomainBrowser *b, AvahiIfIndex int
DBUS_TYPE_INVALID);
} else if (event == AVAHI_BROWSER_FAILURE)
avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
+
+ 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
index 0e1a21c..4e879a5 100644
--- a/avahi-daemon/dbus-entry-group.c
+++ b/avahi-daemon/dbus-entry-group.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -47,9 +45,9 @@ void avahi_dbus_entry_group_free(EntryGroupInfo *i) {
}
AVAHI_LLIST_REMOVE(EntryGroupInfo, entry_groups, i->client->entry_groups, i);
+ assert(i->client->n_objects >= 1);
i->client->n_objects--;
- assert(i->client->n_objects >= 0);
-
+
avahi_free(i);
}
@@ -58,13 +56,18 @@ void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiE
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));
@@ -72,13 +75,13 @@ void avahi_dbus_entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiE
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_message_set_destination(m, i->client->name);
dbus_connection_send(server->bus, m, NULL);
dbus_message_unref(m);
}
@@ -90,7 +93,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -100,12 +103,12 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "EntryGroup.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))
+ 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)) {
@@ -115,7 +118,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
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)) {
@@ -125,21 +128,21 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
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;
+ 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)) {
@@ -148,10 +151,10 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
}
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;
@@ -159,14 +162,14 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
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,
@@ -176,7 +179,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
DBUS_TYPE_STRING, &type,
DBUS_TYPE_STRING, &domain,
DBUS_TYPE_STRING, &host,
- DBUS_TYPE_UINT16, &port,
+ DBUS_TYPE_UINT16, &port,
DBUS_TYPE_INVALID) ||
!type || !name ||
avahi_dbus_read_strlst(m, 8, &strlst) < 0) {
@@ -184,7 +187,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
goto fail;
}
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX) {
+ 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);
}
@@ -202,17 +205,17 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
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,
@@ -227,18 +230,18 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
goto fail;
}
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
+ 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)
+ 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")) {
@@ -246,7 +249,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
uint32_t flags;
char *type, *name, *domain;
AvahiStringList *strlst;
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -271,15 +274,15 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
}
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,
@@ -292,9 +295,9 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
goto fail;
}
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
+ 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);
@@ -303,7 +306,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
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;
@@ -312,7 +315,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
char *name;
void *rdata;
AvahiRecord *r;
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -328,7 +331,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
goto fail;
}
- if (!(flags & AVAHI_PUBLISH_UPDATE) && i->n_entries >= ENTRIES_PER_ENTRY_GROUP_MAX)
+ 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))
@@ -341,7 +344,7 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
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);
@@ -349,18 +352,18 @@ DBusHandlerResult avahi_dbus_msg_entry_group_impl(DBusConnection *c, DBusMessage
if (!(flags & AVAHI_PUBLISH_UPDATE))
i->n_entries ++;
-
- avahi_record_unref (r);
+
+ 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
index 11c1094..0b86578 100644
--- a/avahi-daemon/dbus-internal.h
+++ b/avahi-daemon/dbus-internal.h
@@ -1,21 +1,19 @@
#ifndef foodbusinternalhfoo
#define foodbusinternalhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -45,9 +43,9 @@ typedef struct SyncServiceResolverInfo SyncServiceResolverInfo;
typedef struct AsyncServiceResolverInfo AsyncServiceResolverInfo;
typedef struct RecordBrowserInfo RecordBrowserInfo;
-#define CLIENTS_MAX 256
-#define OBJECTS_PER_CLIENT_MAX 250
-#define ENTRIES_PER_ENTRY_GROUP_MAX 20
+#define DEFAULT_CLIENTS_MAX 4096
+#define DEFAULT_OBJECTS_PER_CLIENT_MAX 1024
+#define DEFAULT_ENTRIES_PER_ENTRY_GROUP_MAX 32
struct EntryGroupInfo {
unsigned id;
@@ -55,8 +53,8 @@ struct EntryGroupInfo {
AvahiSEntryGroup *entry_group;
char *path;
- int n_entries;
-
+ unsigned n_entries;
+
AVAHI_LLIST_FIELDS(EntryGroupInfo, entry_groups);
};
@@ -151,8 +149,8 @@ struct Client {
unsigned id;
char *name;
unsigned current_id;
- int n_objects;
-
+ unsigned n_objects;
+
AVAHI_LLIST_FIELDS(Client, clients);
AVAHI_LLIST_HEAD(EntryGroupInfo, entry_groups);
AVAHI_LLIST_HEAD(SyncHostNameResolverInfo, sync_host_name_resolvers);
@@ -171,11 +169,17 @@ struct Server {
const AvahiPoll *poll_api;
DBusConnection *bus;
AVAHI_LLIST_HEAD(Client, clients);
- int n_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;
@@ -224,7 +228,7 @@ void avahi_dbus_sync_service_resolver_callback(
const AvahiAddress *a,
uint16_t port,
AvahiStringList *txt,
- AvahiLookupResultFlags flags,
+ AvahiLookupResultFlags flags,
void* userdata);
void avahi_dbus_async_service_resolver_free(AsyncServiceResolverInfo *i);
@@ -240,7 +244,7 @@ void avahi_dbus_async_service_resolver_callback(
const AvahiAddress *a,
uint16_t port,
AvahiStringList *txt,
- AvahiLookupResultFlags flags,
+ AvahiLookupResultFlags flags,
void* userdata);
DBusHandlerResult avahi_dbus_msg_async_service_resolver_impl(DBusConnection *c, DBusMessage *m, void *userdata);
diff --git a/avahi-daemon/dbus-protocol.c b/avahi-daemon/dbus-protocol.c
index d61935a..91ea8fa 100644
--- a/avahi-daemon/dbus-protocol.c
+++ b/avahi-daemon/dbus-protocol.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -65,13 +63,11 @@
Server *server = NULL;
-static int disable_user_service_publishing = 0;
-
static int dbus_connect(void);
static void dbus_disconnect(void);
static void client_free(Client *c) {
-
+
assert(server);
assert(c);
@@ -83,7 +79,7 @@ static void client_free(Client *c) {
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);
@@ -109,13 +105,13 @@ static void client_free(Client *c) {
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 --;
- assert(server->n_clients >= 0);
}
static Client *client_get(const char *name, int create) {
@@ -131,16 +127,16 @@ static Client *client_get(const char *name, int create) {
if (!create)
return NULL;
- if (server->n_clients >= CLIENTS_MAX)
+ 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);
@@ -157,7 +153,7 @@ static Client *client_get(const char *name, int create) {
server->n_clients++;
assert(server->n_clients > 0);
-
+
return client;
}
@@ -190,11 +186,11 @@ static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection
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
@@ -203,9 +199,9 @@ static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection
avahi_log_warn("Disconnected from D-Bus, exiting.");
raise(SIGQUIT);
}
-
+
return DBUS_HANDLER_RESULT_HANDLED;
-
+
} else if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameAcquired")) {
char *name;
@@ -216,7 +212,7 @@ static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection
/* 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;
@@ -229,7 +225,7 @@ static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection
Client *client;
if ((client = client_get(name, FALSE))) {
- avahi_log_debug(__FILE__": client %s vanished.", name);
+ avahi_log_debug(__FILE__": client %s vanished.", name);
client_free(client);
}
}
@@ -238,7 +234,7 @@ static DBusHandlerResult msg_signal_filter_impl(AVAHI_GCC_UNUSED DBusConnection
fail:
if (dbus_error_is_set(&error))
dbus_error_free(&error);
-
+
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -253,8 +249,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
dbus_message_get_member(m));
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "Server.introspect");
-
+ 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)) {
@@ -263,23 +259,23 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
}
return avahi_dbus_respond_string(c, m, avahi_server_get_host_name(avahi_server));
-
+
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "SetHostName")) {
char *name;
-
+
if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
avahi_log_warn("Error parsing Server::SetHostName message");
goto fail;
}
-
- if (avahi_server_set_host_name(avahi_server, name) < 0)
+
+ 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)) {
@@ -295,9 +291,9 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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");
@@ -305,14 +301,14 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
}
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")) {
@@ -321,17 +317,17 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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);
@@ -341,13 +337,13 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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];
-
+ 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;
@@ -361,14 +357,14 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -382,13 +378,13 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -402,7 +398,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
} 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;
@@ -413,7 +409,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -431,15 +427,15 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
goto fail;
}
- if (disable_user_service_publishing)
+ 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 >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -451,7 +447,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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);
@@ -460,14 +456,14 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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,
@@ -485,7 +481,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -500,9 +496,9 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -510,13 +506,13 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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_UINT32, &flags,
DBUS_TYPE_INVALID) || !address) {
avahi_log_warn("Error parsing Server::ResolveAddress message");
goto fail;
@@ -530,7 +526,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -545,9 +541,9 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -562,7 +558,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
int32_t interface, protocol, type;
uint32_t flags;
char *domain;
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -580,7 +576,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -618,7 +614,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
int32_t interface, protocol;
uint32_t flags;
char *domain;
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -635,7 +631,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -654,11 +650,11 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -673,7 +669,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
int32_t interface, protocol;
uint32_t flags;
char *domain, *type;
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -691,7 +687,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -714,14 +710,14 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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,
@@ -740,8 +736,8 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_log_warn("Too many clients, client request failed.");
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
-
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+
+ 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);
}
@@ -751,7 +747,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
if (!*name)
name = NULL;
-
+
i = avahi_new(SyncServiceResolverInfo, 1);
i->client = client;
i->message = dbus_message_ref(m);
@@ -762,9 +758,9 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -793,13 +789,13 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_log_warn("Error parsing Server::ServiceResolverNew message");
goto fail;
}
-
+
if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
avahi_log_warn(__FILE__": Too many clients, client request failed.");
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -809,7 +805,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
if (!*name)
name = NULL;
-
+
i = avahi_new(AsyncServiceResolverInfo, 1);
i->id = ++client->current_id;
i->client = client;
@@ -823,7 +819,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
}
/* avahi_log_debug(__FILE__": [%s], new service resolver for <%s.%s.%s>", i->path, name, type, domain); */
-
+
i->path = avahi_strdup_printf("/Client%u/ServiceResolver%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -842,7 +838,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
NULL,
NULL
};
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -854,13 +850,13 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
avahi_log_warn("Error parsing Server::HostNameResolverNew message");
goto fail;
}
-
+
if (!(client = client_get(dbus_message_get_sender(m), TRUE))) {
avahi_log_warn(__FILE__": Too many clients, client request failed.");
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -896,7 +892,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
NULL,
NULL
};
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -916,7 +912,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -936,7 +932,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
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;
@@ -953,7 +949,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
char *name;
uint16_t type, clazz;
AvahiKey *key;
-
+
if (!dbus_message_get_args(
m, &error,
DBUS_TYPE_INT32, &interface,
@@ -967,7 +963,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
goto fail;
}
- if (!avahi_is_valid_domain_name(name))
+ 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))) {
@@ -975,7 +971,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
return avahi_dbus_respond_error(c, m, AVAHI_ERR_TOO_MANY_CLIENTS, NULL);
}
- if (client->n_objects >= OBJECTS_PER_CLIENT_MAX) {
+ 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);
}
@@ -997,7 +993,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
}
avahi_key_unref(key);
-
+
i->path = avahi_strdup_printf("/Client%u/RecordBrowser%u", client->id, i->id);
dbus_connection_register_object_path(c, i->path, &vtable, i);
return avahi_dbus_respond_path(c, m, i->path);
@@ -1008,7 +1004,7 @@ static DBusHandlerResult msg_server_impl(DBusConnection *c, DBusMessage *m, AVAH
fail:
if (dbus_error_is_set(&error))
dbus_error_free(&error);
-
+
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -1016,11 +1012,17 @@ 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)
@@ -1029,7 +1031,7 @@ void dbus_protocol_server_state_changed(AvahiServerState state) {
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);
@@ -1052,7 +1054,7 @@ static int dbus_connect(void) {
dbus_error_init(&error);
-#ifdef HAVE_DBUS_BUS_GET_PRIVATE
+#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);
@@ -1064,7 +1066,7 @@ static int dbus_connect(void) {
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);
@@ -1078,14 +1080,14 @@ static int dbus_connect(void) {
}
}
#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,
@@ -1108,14 +1110,14 @@ static int dbus_connect(void) {
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;
@@ -1145,7 +1147,7 @@ static void dbus_disconnect(void) {
while (server->clients)
client_free(server->clients);
-
+
assert(server->n_clients == 0);
if (server->bus) {
@@ -1159,9 +1161,13 @@ static void dbus_disconnect(void) {
}
}
-int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_publishing, int force) {
+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) {
- disable_user_service_publishing = _disable_user_service_publishing;
server = avahi_new(Server, 1);
AVAHI_LLIST_HEAD_INIT(Clients, server->clients);
@@ -1171,6 +1177,10 @@ int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_pub
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;
@@ -1179,11 +1189,11 @@ int dbus_protocol_setup(const AvahiPoll *poll_api, int _disable_user_service_pub
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:
@@ -1209,7 +1219,7 @@ void dbus_protocol_shutdown(void) {
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
index d4404f2..2184487 100644
--- a/avahi-daemon/dbus-protocol.h
+++ b/avahi-daemon/dbus-protocol.h
@@ -1,28 +1,31 @@
#ifndef foodbusprotocolhfoo
#define foodbusprotocolhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
***/
-int dbus_protocol_setup(const AvahiPoll *poll_api, int disable_user_service_publishing, int force);
+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);
diff --git a/avahi-daemon/dbus-record-browser.c b/avahi-daemon/dbus-record-browser.c
index ea23fe4..c0337cf 100644
--- a/avahi-daemon/dbus-record-browser.c
+++ b/avahi-daemon/dbus-record-browser.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -45,8 +43,8 @@ void avahi_dbus_record_browser_free(RecordBrowserInfo *i) {
}
AVAHI_LLIST_REMOVE(RecordBrowserInfo, record_browsers, i->client->record_browsers, i);
+ assert(i->client->n_objects >= 1);
i->client->n_objects--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -58,7 +56,7 @@ DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMess
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -68,12 +66,12 @@ DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMess
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "RecordBrowser.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))
+ 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)) {
@@ -83,15 +81,15 @@ DBusHandlerResult avahi_dbus_msg_record_browser_impl(DBusConnection *c, DBusMess
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;
}
@@ -103,12 +101,12 @@ void avahi_dbus_record_browser_callback(
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);
@@ -118,11 +116,16 @@ void avahi_dbus_record_browser_callback(
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,
@@ -132,28 +135,28 @@ void avahi_dbus_record_browser_callback(
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_message_set_destination(m, i->client->name);
dbus_connection_send(server->bus, m, NULL);
dbus_message_unref(m);
return;
-
+
fail:
if (m)
diff --git a/avahi-daemon/dbus-service-browser.c b/avahi-daemon/dbus-service-browser.c
index 1515ddf..962dca0 100644
--- a/avahi-daemon/dbus-service-browser.c
+++ b/avahi-daemon/dbus-service-browser.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,11 +41,11 @@ void avahi_dbus_service_browser_free(ServiceBrowserInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -59,7 +57,7 @@ DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMes
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -69,12 +67,12 @@ DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMes
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceBrowser.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))
+ 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)) {
@@ -84,15 +82,15 @@ DBusHandlerResult avahi_dbus_msg_service_browser_impl(DBusConnection *c, DBusMes
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;
}
@@ -101,28 +99,33 @@ void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex i
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,
@@ -134,8 +137,8 @@ void avahi_dbus_service_browser_callback(AvahiSServiceBrowser *b, AvahiIfIndex i
DBUS_TYPE_INVALID);
} else if (event == AVAHI_BROWSER_FAILURE)
avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
+
+ 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
index 9207a74..20afdbe 100644
--- a/avahi-daemon/dbus-service-type-browser.c
+++ b/avahi-daemon/dbus-service-type-browser.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,11 +41,11 @@ void avahi_dbus_service_type_browser_free(ServiceTypeBrowserInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -59,7 +57,7 @@ DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DB
assert(c);
assert(m);
assert(i);
-
+
dbus_error_init(&error);
avahi_log_debug(__FILE__": interface=%s, path=%s, member=%s",
@@ -69,12 +67,12 @@ DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DB
/* Introspection */
if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
- return avahi_dbus_handle_introspect(c, m, "ServiceTypeBrowser.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))
+ 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)) {
@@ -84,15 +82,15 @@ DBusHandlerResult avahi_dbus_msg_service_type_browser_impl(DBusConnection *c, DB
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;
}
@@ -101,7 +99,7 @@ void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, Avahi
DBusMessage *m;
int32_t i_interface, i_protocol;
uint32_t u_flags;
-
+
assert(b);
assert(i);
@@ -111,6 +109,11 @@ void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, Avahi
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);
@@ -124,10 +127,8 @@ void avahi_dbus_service_type_browser_callback(AvahiSServiceTypeBrowser *b, Avahi
DBUS_TYPE_INVALID);
} else if (event == AVAHI_BROWSER_FAILURE)
avahi_dbus_append_server_error(m);
-
- dbus_message_set_destination(m, i->client->name);
+
+ 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
index 0a5fa59..9845420 100644
--- a/avahi-daemon/dbus-sync-address-resolver.c
+++ b/avahi-daemon/dbus-sync-address-resolver.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,15 +40,15 @@ void avahi_dbus_sync_address_resolver_free(SyncAddressResolverInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const AvahiAddress *address, const char *host_name, AvahiLookupResultFlags flags, void* userdata) {
SyncAddressResolverInfo *i = userdata;
-
+
assert(r);
assert(address);
assert(i);
@@ -68,8 +66,14 @@ void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIf
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,
@@ -87,6 +91,6 @@ void avahi_dbus_sync_address_resolver_callback(AvahiSAddressResolver *r, AvahiIf
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
index 9750dd4..e511327 100644
--- a/avahi-daemon/dbus-sync-host-name-resolver.c
+++ b/avahi-daemon/dbus-sync-host-name-resolver.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,15 +40,15 @@ void avahi_dbus_sync_host_name_resolver_free(SyncHostNameResolverInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *host_name, const AvahiAddress *a, AvahiLookupResultFlags flags, void* userdata) {
SyncHostNameResolverInfo *i = userdata;
-
+
assert(r);
assert(host_name);
assert(i);
@@ -68,8 +66,14 @@ void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, Avah
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,
@@ -87,6 +91,6 @@ void avahi_dbus_sync_host_name_resolver_callback(AvahiSHostNameResolver *r, Avah
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
index 21ae481..ed7276a 100644
--- a/avahi-daemon/dbus-sync-service-resolver.c
+++ b/avahi-daemon/dbus-sync-service-resolver.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -42,8 +40,8 @@ void avahi_dbus_sync_service_resolver_free(SyncServiceResolverInfo *i) {
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--;
- assert(i->client->n_objects >= 0);
avahi_free(i);
}
@@ -60,11 +58,11 @@ void avahi_dbus_sync_service_resolver_callback(
const AvahiAddress *a,
uint16_t port,
AvahiStringList *txt,
- AvahiLookupResultFlags flags,
+ AvahiLookupResultFlags flags,
void* userdata) {
-
+
SyncServiceResolverInfo *i = userdata;
-
+
assert(r);
assert(i);
@@ -73,13 +71,13 @@ void avahi_dbus_sync_service_resolver_callback(
int32_t i_interface, i_protocol, i_aprotocol;
uint32_t u_flags;
DBusMessage *reply;
-
+
assert(host_name);
if (!name)
name = "";
- if (a)
+ if (a)
avahi_address_snprint(t, sizeof(t), a);
else
t[0] = 0;
@@ -88,16 +86,22 @@ void avahi_dbus_sync_service_resolver_callback(
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;
+ 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,
@@ -112,7 +116,7 @@ void avahi_dbus_sync_service_resolver_callback(
DBUS_TYPE_INVALID);
avahi_dbus_append_string_list(reply, txt);
-
+
dbus_message_append_args(
reply,
DBUS_TYPE_UINT32, &u_flags,
@@ -122,9 +126,10 @@ void avahi_dbus_sync_service_resolver_callback(
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
index ca08d7b..2983b29 100644
--- a/avahi-daemon/dbus-util.c
+++ b/avahi-daemon/dbus-util.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -52,13 +50,19 @@ DBusHandlerResult avahi_dbus_respond_error(DBusConnection *c, DBusMessage *m, in
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;
}
@@ -66,10 +70,16 @@ DBusHandlerResult avahi_dbus_respond_string(DBusConnection *c, DBusMessage *m, c
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;
}
@@ -77,10 +87,16 @@ DBusHandlerResult avahi_dbus_respond_int32(DBusConnection *c, DBusMessage *m, in
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;
}
@@ -88,10 +104,16 @@ DBusHandlerResult avahi_dbus_respond_uint32(DBusConnection *c, DBusMessage *m, 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;
}
@@ -99,10 +121,16 @@ DBusHandlerResult avahi_dbus_respond_boolean(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_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;
}
@@ -110,9 +138,15 @@ 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;
}
@@ -120,10 +154,16 @@ DBusHandlerResult avahi_dbus_respond_path(DBusConnection *c, DBusMessage *m, con
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;
}
@@ -131,7 +171,7 @@ 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,
@@ -166,7 +206,7 @@ static char *file_get_contents(const char *fname) {
char *buf = NULL;
assert(fname);
-
+
#ifdef ENABLE_CHROOT
fd = avahi_chroot_helper_get_fd(fname);
#else
@@ -205,22 +245,22 @@ static char *file_get_contents(const char *fname) {
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);
@@ -235,21 +275,21 @@ DBusHandlerResult avahi_dbus_handle_introspect(DBusConnection *c, DBusMessage *m
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;
}
@@ -257,20 +297,20 @@ fail:
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_append_fixed_array(&sub2, DBUS_TYPE_BYTE, &data, p->size);
dbus_message_iter_close_container(&sub, &sub2);
-
+
}
dbus_message_iter_close_container(&iter, &sub);
}
@@ -281,12 +321,12 @@ int avahi_dbus_read_rdata(DBusMessage *m, int idx, void **rdata, uint32_t *size)
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;
@@ -296,9 +336,9 @@ int avahi_dbus_read_rdata(DBusMessage *m, int idx, void **rdata, uint32_t *size)
*rdata = k;
*size = n;
-
+
return 0;
-
+
fail:
avahi_log_warn("Error parsing data");
@@ -314,49 +354,49 @@ int avahi_dbus_read_strlst(DBusMessage *m, int idx, AvahiStringList **l) {
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");
@@ -381,15 +421,15 @@ int avahi_dbus_is_our_own_service(Client *c, AvahiIfIndex interface, AvahiProtoc
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
index e994915..a513367 100644
--- a/avahi-daemon/dbus-util.h
+++ b/avahi-daemon/dbus-util.h
@@ -1,21 +1,19 @@
#ifndef foodbusutilhfoo
#define foodbusutilhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/example.service b/avahi-daemon/example.service
index 7d6c6b8..46db2ae 100644
--- a/avahi-daemon/example.service
+++ b/avahi-daemon/example.service
@@ -1,8 +1,6 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
diff --git a/avahi-daemon/hosts b/avahi-daemon/hosts
index 495daa7..4483340 100644
--- a/avahi-daemon/hosts
+++ b/avahi-daemon/hosts
@@ -1,5 +1,3 @@
-# $Id$
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-daemon/ini-file-parser-test.c b/avahi-daemon/ini-file-parser-test.c
index 6560ab9..6ca6641 100644
--- a/avahi-daemon/ini-file-parser-test.c
+++ b/avahi-daemon/ini-file-parser-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -52,7 +50,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
for (i = split; *i; i++)
printf("<%s> ", *i);
-
+
avahi_strfreev(split);
printf("\n");
diff --git a/avahi-daemon/ini-file-parser.c b/avahi-daemon/ini-file-parser.c
index 1b50335..0a99ce3 100644
--- a/avahi-daemon/ini-file-parser.c
+++ b/avahi-daemon/ini-file-parser.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -38,14 +36,14 @@ AvahiIniFile* avahi_ini_file_load(const char *fname) {
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;
@@ -54,12 +52,12 @@ AvahiIniFile* avahi_ini_file_load(const char *fname) {
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;
@@ -69,19 +67,19 @@ AvahiIniFile* avahi_ini_file_load(const char *fname) {
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 {
@@ -91,26 +89,26 @@ AvahiIniFile* avahi_ini_file_load(const char *fname) {
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:
@@ -130,7 +128,7 @@ void avahi_ini_file_free(AvahiIniFile *f) {
while ((g = f->groups)) {
AvahiIniFilePair *p;
-
+
while ((p = g->pairs)) {
avahi_free(p->key);
avahi_free(p->value);
@@ -190,7 +188,7 @@ void avahi_strfreev(char **p) {
if (!p)
return;
-
+
for (i = p; *i; i++)
avahi_free(*i);
diff --git a/avahi-daemon/ini-file-parser.h b/avahi-daemon/ini-file-parser.h
index 82c5acf..dd3aace 100644
--- a/avahi-daemon/ini-file-parser.h
+++ b/avahi-daemon/ini-file-parser.h
@@ -1,21 +1,19 @@
#ifndef fooinifileparserhfoo
#define fooinifileparserhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/introspect.xsl b/avahi-daemon/introspect.xsl
index 32a371c..5d68560 100644
--- a/avahi-daemon/introspect.xsl
+++ b/avahi-daemon/introspect.xsl
@@ -19,8 +19,6 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-->
-<!-- $Id$ -->
-
<xsl:output method="xml" version="1.0" encoding="iso-8859-15" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
<xsl:template match="/">
diff --git a/avahi-daemon/main.c b/avahi-daemon/main.c
index c3cbb0e..d1a3b3e 100644
--- a/avahi-daemon/main.c
+++ b/avahi-daemon/main.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -79,6 +77,7 @@
#include "static-services.h"
#include "static-hosts.h"
#include "ini-file-parser.h"
+#include "sd-daemon.h"
#ifdef HAVE_DBUS
#include "dbus-protocol.h"
@@ -107,6 +106,9 @@ typedef struct {
#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;
@@ -528,6 +530,26 @@ static int is_yes(const char *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 load_config_file(DaemonConfig *c) {
int r = -1;
AvahiIniFile *f;
@@ -619,6 +641,44 @@ static int load_config_file(DaemonConfig *c) {
c->server_config.deny_interfaces = avahi_string_list_add(c->server_config.deny_interfaces, *t);
avahi_strfreev(e);
+ } 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;
@@ -1010,7 +1070,12 @@ static int run_server(DaemonConfig *c) {
#ifdef HAVE_DBUS
if (c->enable_dbus) {
- if (dbus_protocol_setup(poll_api, config.disable_user_service_publishing, !c->fail_on_missing_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
@@ -1307,7 +1372,7 @@ static void enforce_rlimits(void) {
#endif
/* the sysctl() call from iface-pfroute.c needs locked memory on FreeBSD */
-#if defined(RLIMIT_MEMLOCK) && !defined(__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
@@ -1348,6 +1413,9 @@ int main(int argc, char *argv[]) {
#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;
@@ -1455,10 +1523,11 @@ int main(int argc, char *argv[]) {
if (config.use_syslog || config.daemonize)
daemon_log_use = DAEMON_LOG_SYSLOG;
- if (daemon_close_all(-1) < 0) {
- avahi_log_error("Failed to close remaining file descriptors: %s", strerror(errno));
- goto finish;
- }
+ if (sd_listen_fds(0) <= 0)
+ if (daemon_close_all(-1) < 0) {
+ avahi_log_error("Failed to close remaining file descriptors: %s", strerror(errno));
+ goto finish;
+ }
if (make_runtime_dir() < 0)
goto finish;
diff --git a/avahi-daemon/main.h b/avahi-daemon/main.h
index 77af0d0..ef04c2d 100644
--- a/avahi-daemon/main.h
+++ b/avahi-daemon/main.h
@@ -1,21 +1,19 @@
#ifndef foomainhfoo
#define foomainhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/AddressResolver.introspect b/avahi-daemon/org.freedesktop.Avahi.AddressResolver.xml
index 3550ecd..bae9c2f 100644
--- a/avahi-daemon/AddressResolver.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.AddressResolver.xml
@@ -2,11 +2,9 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -34,7 +32,7 @@
<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"/>
@@ -48,5 +46,5 @@
<arg name="error" type="s"/>
</signal>
- </interface>
+ </interface>
</node>
diff --git a/avahi-daemon/DomainBrowser.introspect b/avahi-daemon/org.freedesktop.Avahi.DomainBrowser.xml
index 5840060..22c614e 100644
--- a/avahi-daemon/DomainBrowser.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.DomainBrowser.xml
@@ -2,11 +2,9 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -24,7 +22,7 @@
-->
<node>
-
+
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="data" type="s" direction="out" />
@@ -34,7 +32,7 @@
<interface name="org.freedesktop.Avahi.DomainBrowser">
<method name="Free"/>
-
+
<signal name="ItemNew">
<arg name="interface" type="i"/>
<arg name="protocol" type="i"/>
@@ -57,6 +55,5 @@
<signal name="CacheExhausted"/>
- </interface>
+ </interface>
</node>
-
diff --git a/avahi-daemon/EntryGroup.introspect b/avahi-daemon/org.freedesktop.Avahi.EntryGroup.xml
index e49bbe6..43fd63c 100644
--- a/avahi-daemon/EntryGroup.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.EntryGroup.xml
@@ -1,12 +1,10 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-
-<!-- $Id$ -->
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
diff --git a/avahi-daemon/HostNameResolver.introspect b/avahi-daemon/org.freedesktop.Avahi.HostNameResolver.xml
index 9ac2e36..0b43752 100644
--- a/avahi-daemon/HostNameResolver.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.HostNameResolver.xml
@@ -2,8 +2,6 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
diff --git a/avahi-daemon/RecordBrowser.introspect b/avahi-daemon/org.freedesktop.Avahi.RecordBrowser.xml
index 57c1e66..9ba86f4 100644
--- a/avahi-daemon/RecordBrowser.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.RecordBrowser.xml
@@ -2,11 +2,9 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -24,7 +22,7 @@
-->
<node>
-
+
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="data" type="s" direction="out" />
@@ -34,7 +32,7 @@
<interface name="org.freedesktop.Avahi.RecordBrowser">
<method name="Free"/>
-
+
<signal name="ItemNew">
<arg name="interface" type="i"/>
<arg name="protocol" type="i"/>
@@ -63,5 +61,5 @@
<signal name="CacheExhausted"/>
- </interface>
+ </interface>
</node>
diff --git a/avahi-daemon/Server.introspect b/avahi-daemon/org.freedesktop.Avahi.Server.xml
index 9d743ba..c291274 100644
--- a/avahi-daemon/Server.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.Server.xml
@@ -2,11 +2,9 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
diff --git a/avahi-daemon/ServiceBrowser.introspect b/avahi-daemon/org.freedesktop.Avahi.ServiceBrowser.xml
index 4a7b430..d80298d 100644
--- a/avahi-daemon/ServiceBrowser.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.ServiceBrowser.xml
@@ -2,11 +2,9 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -24,7 +22,7 @@
-->
<node>
-
+
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="data" type="s" direction="out" />
@@ -34,7 +32,7 @@
<interface name="org.freedesktop.Avahi.ServiceBrowser">
<method name="Free"/>
-
+
<signal name="ItemNew">
<arg name="interface" type="i"/>
<arg name="protocol" type="i"/>
@@ -61,5 +59,5 @@
<signal name="CacheExhausted"/>
- </interface>
+ </interface>
</node>
diff --git a/avahi-daemon/ServiceResolver.introspect b/avahi-daemon/org.freedesktop.Avahi.ServiceResolver.xml
index 2be9347..623f209 100644
--- a/avahi-daemon/ServiceResolver.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.ServiceResolver.xml
@@ -2,11 +2,9 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -34,7 +32,7 @@
<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"/>
@@ -53,5 +51,5 @@
<arg name="error" type="s"/>
</signal>
- </interface>
+ </interface>
</node>
diff --git a/avahi-daemon/ServiceTypeBrowser.introspect b/avahi-daemon/org.freedesktop.Avahi.ServiceTypeBrowser.xml
index cb07f24..4efec82 100644
--- a/avahi-daemon/ServiceTypeBrowser.introspect
+++ b/avahi-daemon/org.freedesktop.Avahi.ServiceTypeBrowser.xml
@@ -2,11 +2,9 @@
<?xml-stylesheet type="text/xsl" href="introspect.xsl"?>
<!DOCTYPE node SYSTEM "introspect.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -24,7 +22,7 @@
-->
<node>
-
+
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="data" type="s" direction="out" />
@@ -34,7 +32,7 @@
<interface name="org.freedesktop.Avahi.ServiceTypeBrowser">
<method name="Free"/>
-
+
<signal name="ItemNew">
<arg name="interface" type="i"/>
<arg name="protocol" type="i"/>
@@ -59,5 +57,5 @@
<signal name="CacheExhausted"/>
- </interface>
+ </interface>
</node>
diff --git a/avahi-daemon/org.freedesktop.Avahi.service b/avahi-daemon/org.freedesktop.Avahi.service
new file mode 100644
index 0000000..ebc5f31
--- /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=avahi-daemon.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..cb568b5
--- /dev/null
+++ b/avahi-daemon/sd-daemon.c
@@ -0,0 +1,448 @@
+/*-*- Mode: C; c-basic-offset: 8 -*-*/
+
+/***
+ 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 "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 (fstat(fd, &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 == sizeof(sa_family_t);
+
+ if (path[0])
+ /* Normal path socket */
+ return
+ (l >= sizeof(sa_family_t) + length + 1) &&
+ memcmp(path, sockaddr.un.sun_path, length+1) == 0;
+ else
+ /* Abstract namespace socket */
+ return
+ (l == sizeof(sa_family_t) + 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__)
+ return 0;
+#else
+ int fd = -1, r;
+ struct msghdr msghdr;
+ struct iovec iovec;
+ union sockaddr_union sockaddr;
+ struct ucred *ucred;
+ union {
+ struct cmsghdr cmsghdr;
+ uint8_t buf[CMSG_SPACE(sizeof(struct ucred))];
+ } control;
+ 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(&control, 0, sizeof(control));
+ control.cmsghdr.cmsg_level = SOL_SOCKET;
+ control.cmsghdr.cmsg_type = SCM_CREDENTIALS;
+ control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred));
+
+ ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr);
+ ucred->pid = getpid();
+ ucred->uid = getuid();
+ ucred->gid = getgid();
+
+ memset(&msghdr, 0, sizeof(msghdr));
+ msghdr.msg_name = &sockaddr;
+ msghdr.msg_namelen = sizeof(struct sockaddr_un);
+ msghdr.msg_iov = &iovec;
+ msghdr.msg_iovlen = 1;
+ msghdr.msg_control = &control;
+ msghdr.msg_controllen = control.cmsghdr.cmsg_len;
+
+ 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("/cgroup", &a) < 0)
+ return 0;
+
+ if (lstat("/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..fd6221f
--- /dev/null
+++ b/avahi-daemon/sd-daemon.h
@@ -0,0 +1,257 @@
+/*-*- Mode: C; c-basic-offset: 8 -*-*/
+
+#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.
+*/
+
+#if __GNUC__ >= 4
+#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
+#define _sd_hidden_ __attribute__ ((visibility("hidden")))
+#else
+#define _sd_printf_attr_(a,b)
+#define _sd_hidden_
+#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 seperated 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 signalling 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
+ recommened 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 session 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
index 09b7f65..aef3555 100644
--- a/avahi-daemon/setproctitle.c
+++ b/avahi-daemon/setproctitle.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -66,7 +64,7 @@ void avahi_init_proc_title(int argc, char **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]);
@@ -75,7 +73,7 @@ void avahi_init_proc_title(int argc, char **argv) {
environ = new_environ;
#endif
-}
+}
void avahi_set_proc_title(const char *name, const char *fmt,...) {
#ifdef HAVE_SETPROCTITLE
@@ -90,16 +88,16 @@ void avahi_set_proc_title(const char *name, const char *fmt,...) {
#elif __linux__
size_t l;
va_list ap;
-
+
if (!argv_buffer)
return;
-
+
va_start(ap, fmt);
vsnprintf(argv_buffer[0], argv_size, fmt, ap);
va_end(ap);
l = strlen(argv_buffer[0]);
-
+
memset(argv_buffer[0] + l, 0, argv_size - l);
argv_buffer[1] = NULL;
#endif
@@ -108,6 +106,6 @@ void avahi_set_proc_title(const char *name, const char *fmt,...) {
if (name)
prctl(PR_SET_NAME, (unsigned long) name, 0, 0, 0);
-
+
#endif
}
diff --git a/avahi-daemon/setproctitle.h b/avahi-daemon/setproctitle.h
index a8f2a1a..3499e2e 100644
--- a/avahi-daemon/setproctitle.h
+++ b/avahi-daemon/setproctitle.h
@@ -1,21 +1,19 @@
#ifndef foosetproctitlehfoo
#define foosetproctitlehfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/sftp-ssh.service b/avahi-daemon/sftp-ssh.service
index c65535a..dfae4f1 100644
--- a/avahi-daemon/sftp-ssh.service
+++ b/avahi-daemon/sftp-ssh.service
@@ -1,11 +1,9 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2 of the
@@ -26,7 +24,7 @@
<service-group>
- <name replace-wildcards="yes">SFTP File Transfer on %h</name>
+ <name replace-wildcards="yes">%h</name>
<service>
<type>_sftp-ssh._tcp</type>
diff --git a/avahi-daemon/simple-protocol.c b/avahi-daemon/simple-protocol.c
index 33e5db3..7f75562 100644
--- a/avahi-daemon/simple-protocol.c
+++ b/avahi-daemon/simple-protocol.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -44,6 +42,7 @@
#include "simple-protocol.h"
#include "main.h"
+#include "sd-daemon.h"
#ifdef ENABLE_CHROOT
#include "chroot.h"
@@ -75,7 +74,7 @@ struct Client {
Server *server;
ClientState state;
-
+
int fd;
AvahiWatch *watch;
@@ -87,7 +86,7 @@ struct Client {
AvahiSDNSServerBrowser *dns_server_browser;
AvahiProtocol afquery;
-
+
AVAHI_LLIST_FIELDS(Client, clients);
};
@@ -98,7 +97,7 @@ struct Server {
AVAHI_LLIST_HEAD(Client, clients);
unsigned n_clients;
- int bind_successful;
+ int remove_socket;
};
static Server *server = NULL;
@@ -122,7 +121,7 @@ static void client_free(Client *c) {
c->server->poll_api->watch_free(c->watch);
close(c->fd);
-
+
AVAHI_LLIST_REMOVE(Client, clients, c->server->clients, c);
avahi_free(c);
}
@@ -151,7 +150,7 @@ static void client_new(Server *s, int fd) {
static void client_output(Client *c, const uint8_t*data, size_t size) {
size_t k, m;
-
+
assert(c);
assert(data);
@@ -170,7 +169,7 @@ static void client_output(Client *c, const uint8_t*data, size_t size) {
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);
@@ -186,11 +185,11 @@ static void host_name_resolver_callback(
AvahiResolverEvent event,
const char *hostname,
const AvahiAddress *a,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void* userdata) {
Client *c = userdata;
-
+
assert(c);
if (event == AVAHI_RESOLVER_FAILURE)
@@ -213,9 +212,9 @@ static void address_resolver_callback(
const char *hostname,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void* userdata) {
-
+
Client *c = userdata;
-
+
assert(c);
if (event == AVAHI_RESOLVER_FAILURE)
@@ -236,10 +235,10 @@ static void dns_server_browser_callback(
uint16_t port,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void* userdata) {
-
+
Client *c = userdata;
char t[AVAHI_ADDRESS_STR_MAX];
-
+
assert(c);
if (!a)
@@ -257,7 +256,7 @@ static void dns_server_browser_callback(
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;
@@ -314,7 +313,7 @@ static void handle_line(Client *c, const char *s) {
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;
@@ -376,7 +375,7 @@ static void handle_input(Client *c) {
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);
@@ -390,7 +389,7 @@ static void client_work(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEv
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));
@@ -415,7 +414,7 @@ static void client_work(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEv
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);
@@ -426,7 +425,7 @@ static void client_work(AvahiWatch *watch, AVAHI_GCC_UNUSED int fd, AvahiWatchEv
}
c->server->poll_api->watch_update(
- watch,
+ watch,
(c->outbuf_length > 0 ? AVAHI_WATCH_OUT : 0) |
(c->inbuf_length < sizeof(c->inbuf) ? AVAHI_WATCH_IN : 0));
}
@@ -445,59 +444,83 @@ static void server_work(AVAHI_GCC_UNUSED AvahiWatch *watch, int fd, AvahiWatchEv
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->bind_successful = 0;
+ 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 ((server->fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
- avahi_log_warn("socket(PF_LOCAL, SOCK_STREAM, 0): %s", strerror(errno));
+ if ((n = sd_listen_fds(1)) < 0) {
+ avahi_log_warn("Failed to acquire systemd file descriptors: %s", strerror(-n));
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));
+ if (n > 1) {
+ avahi_log_warn("Too many systemd file descriptors passed.");
goto fail;
}
- server->bind_successful = 1;
-
- if (listen(server->fd, 2) < 0) {
- avahi_log_warn("listen(): %s", strerror(errno));
- goto fail;
+ if (n == 1) {
+ int r;
+
+ if ((r = sd_is_socket(AF_LOCAL, SOCK_STREAM, 1, 0)) < 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();
@@ -508,7 +531,7 @@ void simple_protocol_shutdown(void) {
if (server) {
- if (server->bind_successful)
+ if (server->remove_socket)
#ifdef ENABLE_CHROOT
avahi_chroot_helper_unlink(AVAHI_SOCKET);
#else
@@ -520,12 +543,12 @@ void simple_protocol_shutdown(void) {
if (server->watch)
server->poll_api->watch_free(server->watch);
-
+
if (server->fd >= 0)
close(server->fd);
avahi_free(server);
-
+
server = NULL;
}
}
@@ -534,7 +557,7 @@ 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)
@@ -543,5 +566,3 @@ void simple_protocol_restart_queries(void) {
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
index 1e64036..bcbffc3 100644
--- a/avahi-daemon/simple-protocol.h
+++ b/avahi-daemon/simple-protocol.h
@@ -1,21 +1,19 @@
#ifndef foosimpleprotocolhfoo
#define foosimpleprotocolhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/ssh.service b/avahi-daemon/ssh.service
index a493444..c66e0c1 100644
--- a/avahi-daemon/ssh.service
+++ b/avahi-daemon/ssh.service
@@ -1,8 +1,6 @@
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
diff --git a/avahi-daemon/static-hosts.c b/avahi-daemon/static-hosts.c
index c0a5952..34f531f 100644
--- a/avahi-daemon/static-hosts.c
+++ b/avahi-daemon/static-hosts.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -75,7 +73,7 @@ static void entry_group_callback(AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGro
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:
;
@@ -84,7 +82,7 @@ static void entry_group_callback(AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGro
static StaticHost *static_host_new(void) {
StaticHost *s;
-
+
s = avahi_new(StaticHost, 1);
s->group = NULL;
@@ -105,7 +103,7 @@ static void static_host_free(StaticHost *s) {
avahi_s_entry_group_free (s->group);
avahi_free(s->host);
-
+
avahi_free(s);
}
@@ -114,7 +112,7 @@ static StaticHost *static_host_find(const char *host, const AvahiAddress *a) {
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;
@@ -136,10 +134,10 @@ static void add_static_host_to_server(StaticHost *h)
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;
@@ -154,7 +152,7 @@ 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;
@@ -182,7 +180,7 @@ void static_hosts_load(int in_chroot) {
}
current_iteration++;
-
+
while (!feof(f)) {
unsigned int len;
char ln[256], *s;
@@ -228,7 +226,7 @@ void static_hosts_load(int in_chroot) {
/* 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);
@@ -261,7 +259,7 @@ void static_hosts_load(int in_chroot) {
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);
@@ -269,7 +267,7 @@ void static_hosts_load(int in_chroot) {
}
fail:
-
+
fclose(f);
}
diff --git a/avahi-daemon/static-hosts.h b/avahi-daemon/static-hosts.h
index 2fdb0bd..5d63995 100644
--- a/avahi-daemon/static-hosts.h
+++ b/avahi-daemon/static-hosts.h
@@ -1,21 +1,19 @@
#ifndef foostatichostshfoo
#define foostatichostshfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-daemon/static-services.c b/avahi-daemon/static-services.c
index 0c160f2..588ff8a 100644
--- a/avahi-daemon/static-services.c
+++ b/avahi-daemon/static-services.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-daemon/static-services.h b/avahi-daemon/static-services.h
index a2bc355..62edc36 100644
--- a/avahi-daemon/static-services.h
+++ b/avahi-daemon/static-services.h
@@ -1,21 +1,19 @@
#ifndef foostaticserviceshfoo
#define foostaticserviceshfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-discover-standalone/Makefile.am b/avahi-discover-standalone/Makefile.am
index 542aeae..3995c0a 100644
--- a/avahi-discover-standalone/Makefile.am
+++ b/avahi-discover-standalone/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
@@ -20,13 +18,13 @@
AM_CFLAGS=-I$(top_srcdir)
interfaces = \
- avahi-discover.glade
+ avahi-discover.ui
# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-if HAVE_GTK
-if HAVE_GLIB
+if HAVE_GTK2OR3
+if HAVE_GLIB
bin_PROGRAMS = \
avahi-discover-standalone
@@ -35,20 +33,30 @@ avahi_discover_standalone_SOURCES = \
avahi_discover_standalone_CFLAGS = \
$(AM_CFLAGS) \
- $(GLIB20_CFLAGS) $(GTK20_CFLAGS) $(GLADE20_CFLAGS)\
-DAVAHI_INTERFACES_DIR=\"$(interfacesdir)\"
avahi_discover_standalone_LDADD = \
$(AM_LDADD) \
../avahi-common/libavahi-common.la \
../avahi-glib/libavahi-glib.la \
- ../avahi-core/libavahi-core.la \
- $(GLIB20_LIBS) $(GTK20_LIBS) $(GLADE20_LIBS)
+ ../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
+else
if HAVE_PYTHON_DBUS
@@ -58,5 +66,4 @@ endif
endif
EXTRA_DIST = \
- $(interfaces) \
- avahi-discover.gladep
+ $(interfaces)
diff --git a/avahi-discover-standalone/avahi-discover.glade b/avahi-discover-standalone/avahi-discover.glade
deleted file mode 100644
index bb456c2..0000000
--- a/avahi-discover-standalone/avahi-discover.glade
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkWindow" id="main_window">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Avahi Discovery</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="default_width">500</property>
- <property name="default_height">400</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="focus_on_map">True</property>
- <signal handler="gtk_main_quit" name="destroy" after="False"/>
-
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="border_width">12</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkTreeView" id="tree_view">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</property>
- <signal name="cursor_changed" handler="on_tree_view_cursor_changed" last_modification_time="Sat, 30 Jul 2005 21:39:13 GMT"/>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="info_label">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">&lt;i&gt;No service currently selected.&lt;/i&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/avahi-discover-standalone/avahi-discover.gladep b/avahi-discover-standalone/avahi-discover.gladep
deleted file mode 100644
index a9feaa6..0000000
--- a/avahi-discover-standalone/avahi-discover.gladep
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
-
-<glade-project>
- <name>Avahi-discover</name>
- <program_name>avahi-discover</program_name>
- <gnome_support>FALSE</gnome_support>
-</glade-project>
diff --git a/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
index 90c74f3..2f000a4 100644
--- a/avahi-discover-standalone/main.c
+++ b/avahi-discover-standalone/main.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,7 +29,6 @@
#include <unistd.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <avahi-core/core.h>
#include <avahi-core/lookup.h>
@@ -83,7 +80,7 @@ static struct Service *get_service(const gchar *service_type, const gchar *servi
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) &&
@@ -105,17 +102,17 @@ static void free_service(struct Service *s) {
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);
@@ -142,7 +139,7 @@ static void service_browser_callback(
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);
@@ -150,7 +147,7 @@ static void service_browser_callback(
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);
@@ -168,7 +165,7 @@ static void service_browser_callback(
gtk_tree_view_expand_row(tree_view, ppath, FALSE);
gtk_tree_path_free(ppath);
-
+
} else if (event == AVAHI_BROWSER_REMOVE) {
struct Service* s;
@@ -186,7 +183,7 @@ static void service_type_browser_callback(
const char *domain,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void * userdata) {
-
+
struct ServiceType *st;
GtkTreePath *path;
GtkTreeIter iter;
@@ -200,7 +197,7 @@ static void service_type_browser_callback(
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);
@@ -230,7 +227,7 @@ static void update_label(struct Service *s, const gchar *hostname, const AvahiAd
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"
@@ -254,12 +251,12 @@ 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);
@@ -279,9 +276,9 @@ static void service_resolver_callback(
const AvahiAddress *a,
uint16_t port,
AvahiStringList *txt,
- AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
+ AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void* userdata) {
-
+
struct Service *s;
g_assert(r);
@@ -302,7 +299,7 @@ static void service_resolver_callback(
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;
@@ -320,27 +317,27 @@ static gboolean main_window_on_delete_event(AVAHI_GCC_UNUSED GtkWidget *widget,
}
int main(int argc, char *argv[]) {
- GladeXML *xml;
+ GtkBuilder *ui;
AvahiServerConfig config;
GtkTreeViewColumn *c;
gint error;
AvahiGLibPoll *poll_api;
gtk_init(&argc, &argv);
- glade_init();
avahi_set_allocator(avahi_glib_allocator());
poll_api = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
- xml = glade_xml_new(AVAHI_INTERFACES_DIR"avahi-discover.glade", NULL, NULL);
- main_window = glade_xml_get_widget(xml, "main_window");
+ 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(glade_xml_get_widget(xml, "tree_view"));
+
+ 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(glade_xml_get_widget(xml, "info_label"));
+ 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));
@@ -350,9 +347,9 @@ int main(int argc, char *argv[]) {
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);
diff --git a/avahi-dnsconfd/.gitignore b/avahi-dnsconfd/.gitignore
index 581c3ce..2c6d07f 100644
--- a/avahi-dnsconfd/.gitignore
+++ b/avahi-dnsconfd/.gitignore
@@ -1 +1,2 @@
+avahi-dnsconfd.service
avahi-dnsconfd
diff --git a/avahi-dnsconfd/Makefile.am b/avahi-dnsconfd/Makefile.am
index d358734..4e74429 100644
--- a/avahi-dnsconfd/Makefile.am
+++ b/avahi-dnsconfd/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
@@ -17,6 +15,8 @@
# 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
@@ -33,13 +33,21 @@ AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
sbin_PROGRAMS = avahi-dnsconfd
-avahi_dnsconfd_SOURCES = main.c
+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
-endif
-EXTRA_DIST=avahi-dnsconfd.action
+CLEANFILES = $(systemdsystemunit_DATA)
+
+endif
+endif
diff --git a/avahi-dnsconfd/avahi-dnsconfd.action b/avahi-dnsconfd/avahi-dnsconfd.action
index f7d3aa4..f0ace51 100755
--- a/avahi-dnsconfd/avahi-dnsconfd.action
+++ b/avahi-dnsconfd/avahi-dnsconfd.action
@@ -1,7 +1,5 @@
#!/bin/sh
-# $Id$
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-dnsconfd/avahi-dnsconfd.service.in b/avahi-dnsconfd/avahi-dnsconfd.service.in
new file mode 100644
index 0000000..2db23d1
--- /dev/null
+++ b/avahi-dnsconfd/avahi-dnsconfd.service.in
@@ -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 of the
+# License, or (at your option) any later version.
+#
+# avahi is distributed in the hope that 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]
+Requires=basic.target avahi-daemon.socket avahi-daemon.service
+After=basic.target syslog.target avahi-daemon.socket
+Conflicts=shutdown.target
+
+[Service]
+Type=simple
+ExecStart=@sbindir@/avahi-dnsconfd -s
+ExecReload=@sbindir@/avahi-dnsconfd -r
+
+[Install]
+WantedBy=multi-user.target
+Also=avahi-daemon.socket
diff --git a/avahi-dnsconfd/main.c b/avahi-dnsconfd/main.c
index d10374b..719fbeb 100644
--- a/avahi-dnsconfd/main.c
+++ b/avahi-dnsconfd/main.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -72,6 +70,7 @@ static enum {
static int quit = 0;
static int daemonize = 0;
+static int use_syslog = 0;
#if !HAVE_DECL_ENVIRON
extern char **environ;
@@ -92,7 +91,7 @@ static void server_info_free(DNSServerInfo *i) {
assert(i);
avahi_free(i->address);
-
+
AVAHI_LLIST_REMOVE(DNSServerInfo, servers, servers, i);
avahi_free(i);
}
@@ -112,7 +111,7 @@ static DNSServerInfo* get_server_info(AvahiIfIndex interface, AvahiProtocol prot
static DNSServerInfo* new_server_info(AvahiIfIndex interface, AvahiProtocol protocol, const char *address) {
DNSServerInfo *i;
-
+
assert(address);
i = avahi_new(DNSServerInfo, 1);
@@ -121,7 +120,7 @@ static DNSServerInfo* new_server_info(AvahiIfIndex interface, AvahiProtocol prot
i->address = avahi_strdup(address);
AVAHI_LLIST_PREPEND(DNSServerInfo, servers, servers, i);
-
+
return i;
}
@@ -129,7 +128,7 @@ static int set_cloexec(int fd) {
int n;
assert(fd >= 0);
-
+
if ((n = fcntl(fd, F_GETFD)) < 0)
return -1;
@@ -152,7 +151,7 @@ static int open_socket(void) {
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);
@@ -160,13 +159,13 @@ static int open_socket(void) {
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.");
+ 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);
@@ -199,7 +198,7 @@ static ssize_t loop_write(int fd, const void*data, size_t size) {
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;
@@ -213,7 +212,7 @@ static char *concat_dns_servers(AvahiIfIndex interface) {
if (j != i)
continue;
-
+
if (!r)
t = avahi_strdup(i->address);
else
@@ -229,7 +228,7 @@ static char *concat_dns_servers(AvahiIfIndex interface) {
static void set_env(const char *name, const char *value) {
char **e;
size_t l;
-
+
assert(name);
assert(value);
@@ -239,7 +238,7 @@ static void set_env(const char *name, const char *value) {
/* Search for the variable */
if (strlen(*e) < l+1)
continue;
-
+
if (strncmp(*e, name, l) != 0 || (*e)[l] != '=')
continue;
@@ -260,19 +259,19 @@ static void run_script(int new, AvahiIfIndex interface, AvahiProtocol protocol,
assert(interface > 0);
- if (!if_indextoname(interface, name))
+ if (!if_indextoname(interface, name))
return;
-
+
p = concat_dns_servers(interface);
set_env(ENV_INTERFACE_DNS_SERVERS, p ? p : "");
- avahi_free(p);
+ avahi_free(p);
p = concat_dns_servers(-1);
set_env(ENV_DNS_SERVERS, p ? p : "");
- avahi_free(p);
+ avahi_free(p);
set_env(ENV_INTERFACE, name);
-
+
snprintf(ia, sizeof(ia), "%i", (int) interface);
snprintf(pa, sizeof(pa), "%i", (int) protocol);
@@ -298,8 +297,8 @@ static int new_line(const char *l) {
AvahiProtocol protocol;
int i_interface, i_protocol, port;
char a[AVAHI_ADDRESS_STR_MAX];
-
- assert(state == BROWSING);
+
+ assert(state == BROWSING);
if (*l != '<' && *l != '>') {
daemon_log(LOG_ERR, "Avahi sent us an invalid browsing line: %s", l);
@@ -325,7 +324,7 @@ static int new_line(const char *l) {
} else {
DNSServerInfo *i;
- if (port == 53)
+ 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);
@@ -334,13 +333,13 @@ static int new_line(const char *l) {
}
}
-
+
return 0;
}
static int do_connect(void) {
int fd = -1;
-
+
if ((fd = open_socket()) < 0)
goto fail;
@@ -355,7 +354,7 @@ static int do_connect(void) {
fail:
if (fd >= 0)
close(fd);
-
+
return -1;
}
@@ -365,7 +364,7 @@ static void free_dns_server_info_list(void) {
AvahiProtocol protocol = servers->protocol;
char *address = avahi_strdup(servers->address);
server_info_free(servers);
-
+
run_script(0, interface, protocol, address);
avahi_free(address);
}
@@ -376,6 +375,7 @@ static void help(FILE *f, const char *argv0) {
"%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"
@@ -385,10 +385,11 @@ static void help(FILE *f, const char *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' },
@@ -396,7 +397,7 @@ static int parse_command_line(int argc, char *argv[]) {
{ NULL, 0, NULL, 0 }
};
- while ((c = getopt_long(argc, argv, "hDkVrc", long_options, NULL)) >= 0) {
+ while ((c = getopt_long(argc, argv, "hDkVrcs", long_options, NULL)) >= 0) {
switch(c) {
case 'h':
@@ -405,6 +406,9 @@ static int parse_command_line(int argc, char *argv[]) {
case 'D':
daemonize = 1;
break;
+ case 's':
+ use_syslog = 1;
+ break;
case 'k':
command = DAEMON_KILL;
break;
@@ -426,7 +430,7 @@ static int parse_command_line(int argc, char *argv[]) {
fprintf(stderr, "Too many arguments\n");
return -1;
}
-
+
return 0;
}
@@ -436,14 +440,14 @@ static int run_daemon(void) {
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;
@@ -492,19 +496,19 @@ static int run_daemon(void) {
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;
@@ -530,27 +534,27 @@ static int run_daemon(void) {
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;
}
@@ -570,7 +574,7 @@ int main(int argc, char *argv[]) {
daemon_pid_file_ident = daemon_log_ident = argv0;
daemon_pid_file_proc = pid_file_proc;
-
+
if (parse_command_line(argc, argv) < 0)
goto finish;
@@ -589,7 +593,7 @@ int main(int argc, char *argv[]) {
if (daemonize) {
daemon_retval_init();
-
+
if ((pid = daemon_fork()) < 0)
goto finish;
else if (pid != 0) {
@@ -608,6 +612,9 @@ int main(int argc, char *argv[]) {
/* Child */
}
+ if (use_syslog || daemonize)
+ daemon_log_use = DAEMON_LOG_SYSLOG;
+
chdir("/");
if (daemon_pid_file_create() < 0) {
@@ -625,18 +632,18 @@ int main(int argc, char *argv[]) {
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) {
@@ -653,7 +660,7 @@ finish:
if (daemonize)
daemon_retval_done();
-
+
if (wrote_pid_file)
daemon_pid_file_remove();
diff --git a/avahi-glib/Makefile.am b/avahi-glib/Makefile.am
index 12aa6f9..b5d5fba 100644
--- a/avahi-glib/Makefile.am
+++ b/avahi-glib/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-glib/glib-malloc.c b/avahi-glib/glib-malloc.c
index 2968abc..20ac1d1 100644
--- a/avahi-glib/glib-malloc.c
+++ b/avahi-glib/glib-malloc.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-glib/glib-malloc.h b/avahi-glib/glib-malloc.h
index 675ccb5..8b189d2 100644
--- a/avahi-glib/glib-malloc.h
+++ b/avahi-glib/glib-malloc.h
@@ -1,21 +1,19 @@
#ifndef fooglibmallochfoo
#define fooglibmallochfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-glib/glib-watch-test.c b/avahi-glib/glib-watch-test.c
index 733c81f..53c6683 100644
--- a/avahi-glib/glib-watch-test.c
+++ b/avahi-glib/glib-watch-test.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -43,7 +41,7 @@ static void callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_GCC_UNU
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);
@@ -70,7 +68,7 @@ static void wakeup(AvahiTimeout *t, AVAHI_GCC_UNUSED void *userdata) {
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);
@@ -86,6 +84,6 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) {
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
index f0fd934..5b60bbc 100644
--- a/avahi-glib/glib-watch.c
+++ b/avahi-glib/glib-watch.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -32,10 +30,10 @@
struct AvahiWatch {
AvahiGLibPoll *glib_poll;
int dead;
-
+
GPollFD pollfd;
int pollfd_added;
-
+
AvahiWatchCallback callback;
void *userdata;
@@ -51,7 +49,7 @@ struct AvahiTimeout {
AvahiTimeoutCallback callback;
void *userdata;
-
+
AVAHI_LLIST_FIELDS(AvahiTimeout, timeouts);
};
@@ -62,7 +60,7 @@ struct AvahiGLibPoll {
gboolean timeout_req_cleanup;
gboolean watch_req_cleanup;
-
+
AVAHI_LLIST_HEAD(AvahiWatch, watches);
AVAHI_LLIST_HEAD(AvahiTimeout, timeouts);
};
@@ -111,7 +109,7 @@ static AvahiWatchEvent map_events_from_glib(gushort events) {
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);
@@ -121,7 +119,7 @@ static AvahiWatch* watch_new(const AvahiPoll *api, int fd, AvahiWatchEvent event
if (!(w = avahi_new(AvahiWatch, 1)))
return NULL;
-
+
w->glib_poll = g;
w->pollfd.fd = fd;
w->pollfd.events = map_events_to_glib(events);
@@ -160,7 +158,7 @@ static void watch_free(AvahiWatch *w) {
g_source_remove_poll(&w->glib_poll->source, &w->pollfd);
w->pollfd_added = FALSE;
}
-
+
w->dead = TRUE;
w->glib_poll->timeout_req_cleanup = TRUE;
}
@@ -168,7 +166,7 @@ static void watch_free(AvahiWatch *w) {
static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
AvahiTimeout *t;
AvahiGLibPoll *g;
-
+
assert(api);
assert(callback);
@@ -177,13 +175,13 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
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;
@@ -195,7 +193,7 @@ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv,
static void timeout_update(AvahiTimeout *t, const struct timeval *tv) {
assert(t);
assert(!t->dead);
-
+
if ((t->enabled = !!tv))
t->expiry = *tv;
}
@@ -234,10 +232,10 @@ static AvahiTimeout* find_next_timeout(AvahiGLibPoll *g) {
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;
}
@@ -266,7 +264,7 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
if (g->timeout_req_cleanup)
cleanup_timeouts(g, 0);
-
+
if ((next_timeout = find_next_timeout(g))) {
GTimeVal now;
struct timeval tvnow;
@@ -275,7 +273,7 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
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) {
@@ -286,7 +284,7 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
*timeout = (gint) (usec / 1000);
} else
*timeout = -1;
-
+
return FALSE;
}
@@ -303,7 +301,7 @@ static gboolean check_func(GSource *source) {
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;
}
@@ -311,7 +309,7 @@ static gboolean check_func(GSource *source) {
for (w = g->watches; w; w = w->watches_next)
if (w->pollfd.revents > 0)
return TRUE;
-
+
return FALSE;
}
@@ -319,7 +317,7 @@ static gboolean dispatch_func(GSource *source, AVAHI_GCC_UNUSED GSourceFunc call
AvahiGLibPoll* g = (AvahiGLibPoll*) source;
AvahiWatch *w;
AvahiTimeout *next_timeout;
-
+
g_assert(g);
if ((next_timeout = find_next_timeout(g))) {
@@ -328,13 +326,13 @@ static gboolean dispatch_func(GSource *source, AVAHI_GCC_UNUSED GSourceFunc call
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);
@@ -348,7 +346,7 @@ static gboolean dispatch_func(GSource *source, AVAHI_GCC_UNUSED GSourceFunc call
AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority) {
AvahiGLibPoll *g;
-
+
static GSourceFuncs source_funcs = {
prepare_func,
check_func,
@@ -362,22 +360,22 @@ AvahiGLibPoll *avahi_glib_poll_new(GMainContext *context, gint priority) {
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);
diff --git a/avahi-glib/glib-watch.h b/avahi-glib/glib-watch.h
index 78f7742..ffc3aac 100644
--- a/avahi-glib/glib-watch.h
+++ b/avahi-glib/glib-watch.h
@@ -1,21 +1,19 @@
#ifndef fooglibwatchhfoo
#define fooglibwatchhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-gobject/.gitignore b/avahi-gobject/.gitignore
index 1466c78..402b45c 100644
--- a/avahi-gobject/.gitignore
+++ b/avahi-gobject/.gitignore
@@ -1,3 +1,5 @@
+*.typelib
+Avahi-0.6.gir
ga-*-enumtypes.c
ga-*-enumtypes.h
*.o
diff --git a/avahi-gobject/AvahiCore-0.6.gir b/avahi-gobject/AvahiCore-0.6.gir
new file mode 100644
index 0000000..8b25fc1
--- /dev/null
+++ b/avahi-gobject/AvahiCore-0.6.gir
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<repository version="1.0"
+ 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" target="int" c:type="AvahiIfIndex"/>
+ <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
index 15d00df..02f2b94 100644
--- a/avahi-gobject/Makefile.am
+++ b/avahi-gobject/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-#
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -22,6 +20,9 @@ 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
@@ -74,10 +75,10 @@ dist-hook:
$(shell for x in $(BUILT_SOURCES); do rm -f $(distdir)/$$x ; done)
signals-marshal.list: $(CORE_SOURCES) Makefile.am
- ( cd $(srcdir) && \
+ $(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
+ | sed -e 's/__/:/' -e 'y/_/,/' | sort -u > $@.tmp && \
if cmp -s $@.tmp $@; then \
rm $@.tmp; \
else \
@@ -85,15 +86,14 @@ signals-marshal.list: $(CORE_SOURCES) Makefile.am
fi
signals-marshal.h: signals-marshal.list
- glib-genmarshal --header --prefix=_ga_signals_marshal $< > $@
+ $(AM_V_GEN)glib-genmarshal --header --prefix=_ga_signals_marshal $< > $@
signals-marshal.c: signals-marshal.list
- glib-genmarshal --body --prefix=_ga_signals_marshal $< > $@
-
+ $(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
- glib-mkenums \
+ $(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" \
@@ -101,14 +101,40 @@ signals-marshal.c: signals-marshal.list
$< > $@
%-enumtypes.c: %.h Makefile.in
- glib-mkenums \
- --fhead "#include <$*.h>" \
+ $(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
diff --git a/avahi-gobject/ga-entry-group.c b/avahi-gobject/ga-entry-group.c
index c4f2e37..0f0ab74 100644
--- a/avahi-gobject/ga-entry-group.c
+++ b/avahi-gobject/ga-entry-group.c
@@ -558,7 +558,7 @@ gboolean ga_entry_group_service_remove_key(GaEntryGroupService * service,
GaEntryGroupServicePrivate *priv = (GaEntryGroupServicePrivate *) service;
GaEntryGroupServiceEntry entry;
- entry.value = key;
+ entry.value = (void*) key;
entry.size = strlen(key);
g_hash_table_remove(priv->entries, &entry);
diff --git a/avahi-python/Makefile.am b/avahi-python/Makefile.am
index 4989b4b..7381a48 100644
--- a/avahi-python/Makefile.am
+++ b/avahi-python/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -34,7 +32,7 @@ pythonscripts = \
avahi-bookmarks
avahi-bookmarks: avahi-bookmarks.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' $< > $@
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' $< > $@ && \
chmod +x $@
bin_SCRIPTS = $(pythonscripts)
diff --git a/avahi-python/avahi-bookmarks.in b/avahi-python/avahi-bookmarks.in
index 172abb3..dea7bef 100755
--- a/avahi-python/avahi-bookmarks.in
+++ b/avahi-python/avahi-bookmarks.in
@@ -1,7 +1,5 @@
#!@PYTHON@
# -*-python-*-
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-python/avahi-discover/Makefile.am b/avahi-python/avahi-discover/Makefile.am
index a44a071..454fd57 100644
--- a/avahi-python/avahi-discover/Makefile.am
+++ b/avahi-python/avahi-discover/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -21,7 +19,6 @@ AM_CFLAGS=-I$(top_srcdir)
EXTRA_DIST = \
__init__.py \
- SimpleGladeApp.py \
avahi-discover.in \
avahi-discover.desktop.in.in
@@ -32,7 +29,7 @@ if HAVE_PYGTK
pythonscripts =
desktopdir = $(datadir)/applications
-desktop_DATA =
+desktop_DATA =
avahi_discoverdir = $(pythondir)/avahi_discover
avahi_discover_PYTHON =
@@ -42,7 +39,7 @@ pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
@INTLTOOL_DESKTOP_RULE@
-avahi_discover_PYTHON += __init__.py SimpleGladeApp.py
+avahi_discover_PYTHON += __init__.py
endif
if HAVE_DBM
@@ -50,17 +47,17 @@ pythonscripts += \
avahi-discover
desktop_DATA += avahi-discover.desktop
@INTLTOOL_DESKTOP_RULE@
-avahi_discover_PYTHON += __init__.py SimpleGladeApp.py
+avahi_discover_PYTHON += __init__.py
endif
avahi-discover.desktop.in: avahi-discover.desktop.in.in
- sed -e 's,@bindir\@,$(bindir),g' $< > $@
+ $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
avahi-discover: avahi-discover.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
-e 's,@GETTEXT_PACKAGE\@,"$(GETTEXT_PACKAGE)",g' \
-e 's,@LOCALEDIR\@,"$(datadir)/locale",g' \
- -e 's,@interfacesdir\@,$(interfacesdir),g' $< > $@
+ -e 's,@interfacesdir\@,$(interfacesdir),g' $< > $@ && \
chmod +x $@
bin_SCRIPTS = $(pythonscripts)
diff --git a/avahi-python/avahi-discover/SimpleGladeApp.py b/avahi-python/avahi-discover/SimpleGladeApp.py
deleted file mode 100644
index 90c598c..0000000
--- a/avahi-python/avahi-discover/SimpleGladeApp.py
+++ /dev/null
@@ -1,341 +0,0 @@
-"""
- SimpleGladeApp.py
- Module that provides an object oriented abstraction to pygtk and libglade.
- Copyright (C) 2004 Sandino Flores Moreno
-"""
-
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-import os
-import sys
-import re
-
-import tokenize
-import gtk
-import gtk.glade
-import weakref
-import inspect
-
-__version__ = "1.0"
-__author__ = 'Sandino "tigrux" Flores-Moreno'
-
-def bindtextdomain(app_name, locale_dir=None):
- """
- Bind the domain represented by app_name to the locale directory locale_dir.
- It has the effect of loading translations, enabling applications for different
- languages.
-
- app_name:
- a domain to look for translations, tipically the name of an application.
-
- locale_dir:
- a directory with locales like locale_dir/lang_isocode/LC_MESSAGES/app_name.mo
- If omitted or None, then the current binding for app_name is used.
- """
- try:
- import locale
- import gettext
- locale.setlocale(locale.LC_ALL, "")
- gtk.glade.bindtextdomain(app_name, locale_dir)
- gettext.install(app_name, locale_dir, unicode=1)
- except (IOError,locale.Error), e:
- print "Warning", app_name, e
- __builtins__.__dict__["_"] = lambda x : x
-
-
-class SimpleGladeApp:
-
- def __init__(self, path, root=None, domain=None, **kwargs):
- """
- Load a glade file specified by glade_filename, using root as
- root widget and domain as the domain for translations.
-
- If it receives extra named arguments (argname=value), then they are used
- as attributes of the instance.
-
- path:
- path to a glade filename.
- If glade_filename cannot be found, then it will be searched in the
- same directory of the program (sys.argv[0])
-
- root:
- the name of the widget that is the root of the user interface,
- usually a window or dialog (a top level widget).
- If None or ommited, the full user interface is loaded.
-
- domain:
- A domain to use for loading translations.
- If None or ommited, no translation is loaded.
-
- **kwargs:
- a dictionary representing the named extra arguments.
- It is useful to set attributes of new instances, for example:
- glade_app = SimpleGladeApp("ui.glade", foo="some value", bar="another value")
- sets two attributes (foo and bar) to glade_app.
- """
- if os.path.isfile(path):
- self.glade_path = path
- else:
- glade_dir = os.path.dirname( sys.argv[0] )
- self.glade_path = os.path.join(glade_dir, path)
- for key, value in kwargs.items():
- try:
- setattr(self, key, weakref.proxy(value) )
- except TypeError:
- setattr(self, key, value)
- self.glade = None
- self.install_custom_handler(self.custom_handler)
- self.glade = self.create_glade(self.glade_path, root, domain)
- if root:
- self.main_widget = self.get_widget(root)
- else:
- self.main_widget = None
- self.normalize_names()
- self.add_callbacks(self)
- self.new()
-
- def __repr__(self):
- class_name = self.__class__.__name__
- if self.main_widget:
- root = gtk.Widget.get_name(self.main_widget)
- repr = '%s(path="%s", root="%s")' % (class_name, self.glade_path, root)
- else:
- repr = '%s(path="%s")' % (class_name, self.glade_path)
- return repr
-
- def new(self):
- """
- Method called when the user interface is loaded and ready to be used.
- At this moment, the widgets are loaded and can be refered as self.widget_name
- """
- pass
-
- def add_callbacks(self, callbacks_proxy):
- """
- It uses the methods of callbacks_proxy as callbacks.
- The callbacks are specified by using:
- Properties window -> Signals tab
- in glade-2 (or any other gui designer like gazpacho).
-
- Methods of classes inheriting from SimpleGladeApp are used as
- callbacks automatically.
-
- callbacks_proxy:
- an instance with methods as code of callbacks.
- It means it has methods like on_button1_clicked, on_entry1_activate, etc.
- """
- self.glade.signal_autoconnect(callbacks_proxy)
-
- def normalize_names(self):
- """
- It is internally used to normalize the name of the widgets.
- It means a widget named foo:vbox-dialog in glade
- is refered self.vbox_dialog in the code.
-
- It also sets a data "prefixes" with the list of
- prefixes a widget has for each widget.
- """
- for widget in self.get_widgets():
- widget_name = gtk.Widget.get_name(widget)
- prefixes_name_l = widget_name.split(":")
- prefixes = prefixes_name_l[ : -1]
- widget_api_name = prefixes_name_l[-1]
- widget_api_name = "_".join( re.findall(tokenize.Name, widget_api_name) )
- gtk.Widget.set_name(widget, widget_api_name)
- if hasattr(self, widget_api_name):
- raise AttributeError("instance %s already has an attribute %s" % (self,widget_api_name))
- else:
- setattr(self, widget_api_name, widget)
- if prefixes:
- gtk.Widget.set_data(widget, "prefixes", prefixes)
-
- def add_prefix_actions(self, prefix_actions_proxy):
- """
- By using a gui designer (glade-2, gazpacho, etc)
- widgets can have a prefix in theirs names
- like foo:entry1 or foo:label3
- It means entry1 and label3 has a prefix action named foo.
-
- Then, prefix_actions_proxy must have a method named prefix_foo which
- is called everytime a widget with prefix foo is found, using the found widget
- as argument.
-
- prefix_actions_proxy:
- An instance with methods as prefix actions.
- It means it has methods like prefix_foo, prefix_bar, etc.
- """
- prefix_s = "prefix_"
- prefix_pos = len(prefix_s)
-
- is_method = lambda t : callable( t[1] )
- is_prefix_action = lambda t : t[0].startswith(prefix_s)
- drop_prefix = lambda (k,w): (k[prefix_pos:],w)
-
- members_t = inspect.getmembers(prefix_actions_proxy)
- methods_t = filter(is_method, members_t)
- prefix_actions_t = filter(is_prefix_action, methods_t)
- prefix_actions_d = dict( map(drop_prefix, prefix_actions_t) )
-
- for widget in self.get_widgets():
- prefixes = gtk.Widget.get_data(widget, "prefixes")
- if prefixes:
- for prefix in prefixes:
- if prefix in prefix_actions_d:
- prefix_action = prefix_actions_d[prefix]
- prefix_action(widget)
-
- def custom_handler(self,
- glade, function_name, widget_name,
- str1, str2, int1, int2):
- """
- Generic handler for creating custom widgets, internally used to
- enable custom widgets (custom widgets of glade).
-
- The custom widgets have a creation function specified in design time.
- Those creation functions are always called with str1,str2,int1,int2 as
- arguments, that are values specified in design time.
-
- Methods of classes inheriting from SimpleGladeApp are used as
- creation functions automatically.
-
- If a custom widget has create_foo as creation function, then the
- method named create_foo is called with str1,str2,int1,int2 as arguments.
- """
- try:
- handler = getattr(self, function_name)
- return handler(str1, str2, int1, int2)
- except AttributeError:
- return None
-
- def gtk_widget_show(self, widget, *args):
- """
- Predefined callback.
- The widget is showed.
- Equivalent to widget.show()
- """
- widget.show()
-
- def gtk_widget_hide(self, widget, *args):
- """
- Predefined callback.
- The widget is hidden.
- Equivalent to widget.hide()
- """
- widget.hide()
-
- def gtk_widget_grab_focus(self, widget, *args):
- """
- Predefined callback.
- The widget grabs the focus.
- Equivalent to widget.grab_focus()
- """
- widget.grab_focus()
-
- def gtk_widget_destroy(self, widget, *args):
- """
- Predefined callback.
- The widget is destroyed.
- Equivalent to widget.destroy()
- """
- widget.destroy()
-
- def gtk_window_activate_default(self, window, *args):
- """
- Predefined callback.
- The default widget of the window is activated.
- Equivalent to window.activate_default()
- """
- widget.activate_default()
-
- def gtk_true(self, *args):
- """
- Predefined callback.
- Equivalent to return True in a callback.
- Useful for stopping propagation of signals.
- """
- return True
-
- def gtk_false(self, *args):
- """
- Predefined callback.
- Equivalent to return False in a callback.
- """
- return False
-
- def gtk_main_quit(self, *args):
- """
- Predefined callback.
- Equivalent to self.quit()
- """
- self.quit()
-
- def main(self):
- """
- Starts the main loop of processing events.
- The default implementation calls gtk.main()
-
- Useful for applications that needs a non gtk main loop.
- For example, applications based on gstreamer needs to override
- this method with gst.main()
-
- Do not directly call this method in your programs.
- Use the method run() instead.
- """
- gtk.main()
-
- def quit(self):
- """
- Quit processing events.
- The default implementation calls gtk.main_quit()
-
- Useful for applications that needs a non gtk main loop.
- For example, applications based on gstreamer needs to override
- this method with gst.main_quit()
- """
- gtk.main_quit()
-
- def run(self):
- """
- Starts the main loop of processing events checking for Control-C.
-
- The default implementation checks wheter a Control-C is pressed,
- then calls on_keyboard_interrupt().
-
- Use this method for starting programs.
- """
- try:
- self.main()
- except KeyboardInterrupt:
- self.on_keyboard_interrupt()
-
- def on_keyboard_interrupt(self):
- """
- This method is called by the default implementation of run()
- after a program is finished by pressing Control-C.
- """
- pass
-
- def install_custom_handler(self, custom_handler):
- gtk.glade.set_custom_handler(custom_handler)
-
- def create_glade(self, glade_path, root, domain):
- return gtk.glade.XML(self.glade_path, root, domain)
-
- def get_widget(self, widget_name):
- return self.glade.get_widget(widget_name)
-
- def get_widgets(self):
- return self.glade.get_widget_prefix("")
diff --git a/avahi-python/avahi-discover/__init__.py b/avahi-python/avahi-discover/__init__.py
index b2cd7d8..6f3ec7f 100755
--- a/avahi-python/avahi-discover/__init__.py
+++ b/avahi-python/avahi-discover/__init__.py
@@ -1,7 +1,5 @@
#!@PYTHON@
# -*-python-*-
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-python/avahi-discover/avahi-discover.in b/avahi-python/avahi-discover/avahi-discover.in
index 0558424..ac6b657 100755
--- a/avahi-python/avahi-discover/avahi-discover.in
+++ b/avahi-python/avahi-discover/avahi-discover.in
@@ -1,7 +1,5 @@
#!@PYTHON@
# -*-python-*-
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -23,13 +21,13 @@ import os, sys
try:
import avahi, gettext, gtk, gobject, dbus, avahi.ServiceTypeDatabase
- from avahi_discover.SimpleGladeApp import SimpleGladeApp
- gtk.glade.bindtextdomain(@GETTEXT_PACKAGE@, @LOCALEDIR@)
- gtk.glade.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!! ##
@@ -52,15 +50,20 @@ def error_msg(msg):
d.run()
d.destroy()
-glade_dir = "@interfacesdir@"
+ui_dir = "@interfacesdir@"
service_type_db = avahi.ServiceTypeDatabase.ServiceTypeDatabase()
-class Main_window(SimpleGladeApp):
- def __init__(self, path="avahi-discover.glade", root="main_window", domain=None, **kwargs):
- path = os.path.join(glade_dir, path)
+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")
- SimpleGladeApp.__init__(self, path, root, domain, **kwargs)
+ 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()
@@ -79,7 +82,7 @@ class Main_window(SimpleGladeApp):
if protocol == avahi.PROTO_INET6:
return "IPv6"
return "n/a"
-
+
def siocgifname(self, interface):
if interface <= 0:
return "n/a"
@@ -91,14 +94,14 @@ class Main_window(SimpleGladeApp):
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)
@@ -111,13 +114,13 @@ class Main_window(SimpleGladeApp):
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)
@@ -151,16 +154,16 @@ class Main_window(SimpleGladeApp):
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?
+ # 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)
@@ -183,7 +186,7 @@ class Main_window(SimpleGladeApp):
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
@@ -209,7 +212,7 @@ class Main_window(SimpleGladeApp):
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:
@@ -230,7 +233,6 @@ class Main_window(SimpleGladeApp):
return myiter
def new(self):
- print "A new main_window has been created"
self.treemodel=gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
self.tree_view.set_model(self.treemodel)
@@ -249,14 +251,18 @@ class Main_window(SimpleGladeApp):
self.zc_domains = {}
self.zc_types = {}
self.services_browsed = {}
-
- self.bus = dbus.SystemBus()
- self.server = dbus.Interface(self.bus.get_object(avahi.DBUS_NAME, avahi.DBUS_PATH_SERVER), avahi.DBUS_INTERFACE_SERVER)
+
+ 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)
@@ -264,13 +270,12 @@ class Main_window(SimpleGladeApp):
# 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()
- main_window.run()
-
if __name__ == "__main__":
main()
-
-
diff --git a/avahi-python/avahi/Makefile.am b/avahi-python/avahi/Makefile.am
index c0c9c34..907c5eb 100644
--- a/avahi-python/avahi/Makefile.am
+++ b/avahi-python/avahi/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -28,12 +26,12 @@ if HAVE_GDBM
nodist_avahi_SCRIPTS = ServiceTypeDatabase.py
ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ $(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,@pkglibdir\@,$(pkglibdir),g' $< > $@
+ -e 's,@pkglibdir\@,$(pkglibdir),g' $< > $@ && \
chmod +x $@
endif
@@ -41,12 +39,12 @@ if HAVE_DBM
nodist_avahi_SCRIPTS = ServiceTypeDatabase.py
ServiceTypeDatabase.py: ServiceTypeDatabase.py.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ $(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,@pkglibdir\@,$(pkglibdir),g' $< > $@
+ -e 's,@pkglibdir\@,$(pkglibdir),g' $< > $@ && \
chmod +x $@
endif
diff --git a/avahi-python/avahi/ServiceTypeDatabase.py.in b/avahi-python/avahi/ServiceTypeDatabase.py.in
index d134510..8ad8d5e 100644
--- a/avahi-python/avahi/ServiceTypeDatabase.py.in
+++ b/avahi-python/avahi/ServiceTypeDatabase.py.in
@@ -1,7 +1,5 @@
#!@PYTHON@
# -*-python-*-
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -26,6 +24,7 @@ import re
locale.setlocale(locale.LC_ALL, '')
class ServiceTypeDatabase:
+ """ServiceTypeDatabase maps service types to descriptions"""
def __init__(self, filename = "@pkglibdir@/service-types.db"):
@@ -68,14 +67,7 @@ class ServiceTypeDatabase:
def items(self):
- items = []
- @FIRST_KEY@
- @CHECK_KEY@
- if re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+', key) and not re.search('_[a-zA-Z0-9-]+\._[a-zA-Z0-9-]+\[.*\]', key):
- localized_service_name = self[key]
- items.append((key, localized_service_name))
- @NEXT_KEY@
- return items
+ return list(self.iteritems())
def has_key(self, key):
@@ -96,6 +88,52 @@ class ServiceTypeDatabase:
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__":
@@ -107,4 +145,17 @@ if __name__ == "__main__":
print b["_webdav._tcp"]
print b["_webdavs._tcp"]
- print b["gurki._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
index 81e2754..7b45029 100644
--- a/avahi-python/avahi/__init__.py
+++ b/avahi-python/avahi/__init__.py
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-qt/Makefile.am b/avahi-qt/Makefile.am
index de13595..64356a5 100644
--- a/avahi-qt/Makefile.am
+++ b/avahi-qt/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -19,15 +17,15 @@
AM_CFLAGS=-I$(top_srcdir)
-lib_LTLIBRARIES =
-BUILT_SOURCES =
+lib_LTLIBRARIES =
+BUILT_SOURCES =
if HAVE_QT3
avahiqt3includedir=$(includedir)/avahi-qt3
avahiqt3include_HEADERS = \
- qt-watch.h
+ qt-watch.h
lib_LTLIBRARIES += \
libavahi-qt3.la
@@ -35,10 +33,10 @@ lib_LTLIBRARIES += \
BUILT_SOURCES += qt-watch.moc3
libavahi_qt3_la_SOURCES = \
- qt-watch.cpp
+ qt-watch.cpp
qt-watch.moc3: qt-watch.cpp
- $(MOC_QT3) $^ > $@
+ $(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)
@@ -49,7 +47,7 @@ if HAVE_QT4
avahiqt4includedir=$(includedir)/avahi-qt4
avahiqt4include_HEADERS = \
- qt-watch.h
+ qt-watch.h
lib_LTLIBRARIES += \
libavahi-qt4.la
@@ -57,10 +55,10 @@ lib_LTLIBRARIES += \
BUILT_SOURCES += qt-watch.moc4
libavahi_qt4_la_SOURCES = \
- qt-watch.cpp
+ qt-watch.cpp
qt-watch.moc4: qt-watch.cpp
- $(MOC_QT4) $^ > $@
+ $(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)
diff --git a/avahi-qt/qt-watch.cpp b/avahi-qt/qt-watch.cpp
index f29b517..dac9dcc 100644
--- a/avahi-qt/qt-watch.cpp
+++ b/avahi-qt/qt-watch.cpp
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-qt/qt-watch.h b/avahi-qt/qt-watch.h
index a702a76..cd7130d 100644
--- a/avahi-qt/qt-watch.h
+++ b/avahi-qt/qt-watch.h
@@ -1,21 +1,19 @@
#ifndef QAVAHI_H
#define QAVAHI_H
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-sharp/AddressResolver.cs b/avahi-sharp/AddressResolver.cs
index 3025102..c11e97d 100644
--- a/avahi-sharp/AddressResolver.cs
+++ b/avahi-sharp/AddressResolver.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -55,7 +53,7 @@ namespace Avahi
this.address = address;
}
}
-
+
public class AddressResolver : ResolverBase, IDisposable
{
private IntPtr handle;
@@ -71,7 +69,7 @@ namespace Avahi
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,
@@ -92,7 +90,7 @@ namespace Avahi
Stop (false);
}
}
-
+
public event EventHandler Timeout
{
add {
@@ -155,7 +153,7 @@ namespace Avahi
if (handle == IntPtr.Zero)
client.ThrowError ();
}
-
+
Utility.Free (addrPtr);
}
diff --git a/avahi-sharp/AssemblyInfo.cs b/avahi-sharp/AssemblyInfo.cs
index f8dd4ed..aff09d9 100644
--- a/avahi-sharp/AssemblyInfo.cs
+++ b/avahi-sharp/AssemblyInfo.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -23,7 +21,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
//
-// General Information about an assembly is controlled through the following
+// 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.
//
@@ -34,17 +32,17 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("(C) 2005 James Willcox <snorp@snorp.net>")]
[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
+[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Revision and Build Numbers
+// 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
index ba4d59b..6ccfd57 100644
--- a/avahi-sharp/AvahiTest.cs
+++ b/avahi-sharp/AvahiTest.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -51,7 +49,7 @@ public class AvahiTest {
if (args.State == EntryGroupState.Established) {
DomainBrowser browser = new DomainBrowser (client);
objects.Add (browser);
-
+
browser.DomainAdded += OnDomainAdded;
}
}
@@ -66,7 +64,7 @@ public class AvahiTest {
{
ServiceTypeBrowser stb = new ServiceTypeBrowser (client, domain);
objects.Add (stb);
-
+
stb.CacheExhausted += OnCacheExhausted;
stb.ServiceTypeAdded += OnServiceTypeAdded;
}
@@ -81,7 +79,7 @@ public class AvahiTest {
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;
}
@@ -96,7 +94,7 @@ public class AvahiTest {
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));
@@ -117,11 +115,11 @@ public class AvahiTest {
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;
}
diff --git a/avahi-sharp/BrowserBase.cs b/avahi-sharp/BrowserBase.cs
index 0a1e3a7..3af0086 100644
--- a/avahi-sharp/BrowserBase.cs
+++ b/avahi-sharp/BrowserBase.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-sharp/Client.cs b/avahi-sharp/Client.cs
index 02763d4..b3815b3 100644
--- a/avahi-sharp/Client.cs
+++ b/avahi-sharp/Client.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -35,7 +33,7 @@ namespace Avahi
Found,
Failure
}
-
+
internal enum BrowserEvent {
Added,
Removed,
@@ -70,7 +68,7 @@ namespace Avahi
this.error = error;
}
}
-
+
public enum Protocol {
Unspecified = -1,
IPv4 = 0,
@@ -83,7 +81,7 @@ namespace Avahi
Running,
Collision
}
-
+
public enum ClientState {
Registering = ServerState.Registering,
Running = ServerState.Running,
@@ -117,7 +115,7 @@ namespace Avahi
IgnoreUserConfig = 1,
NoFail = 2
}
-
+
public class Client : IDisposable
{
private IntPtr handle;
@@ -151,7 +149,7 @@ namespace Avahi
[DllImport ("avahi-client")]
private static extern int avahi_client_errno (IntPtr handle);
-
+
[DllImport ("avahi-common")]
private static extern IntPtr avahi_simple_poll_new ();
@@ -192,7 +190,7 @@ namespace Avahi
{
get { return handle; }
}
-
+
public string Version
{
get {
@@ -292,7 +290,7 @@ namespace Avahi
avahi_simple_poll_quit (spoll);
Monitor.Wait (this);
-
+
avahi_simple_poll_free (spoll);
}
}
@@ -326,7 +324,7 @@ namespace Avahi
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);
@@ -334,7 +332,7 @@ namespace Avahi
Utility.Free (namePtr);
Utility.Free (typePtr);
Utility.Free (domainPtr);
-
+
name = null;
type = null;
domain = null;
@@ -357,7 +355,7 @@ namespace Avahi
if (error != ErrorCode.Ok)
throw new ClientException (error);
}
-
+
private void OnClientCallback (IntPtr client, ClientState state, IntPtr userData)
{
if (StateChanged != null)
diff --git a/avahi-sharp/ClientException.cs b/avahi-sharp/ClientException.cs
index fadcce9..0f511ac 100644
--- a/avahi-sharp/ClientException.cs
+++ b/avahi-sharp/ClientException.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -95,14 +93,14 @@ namespace Avahi
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; }
@@ -110,7 +108,7 @@ namespace Avahi
internal ClientException (int code) : this ((ErrorCode) code) {
}
-
+
internal ClientException (ErrorCode code) : base (GetErrorString (code))
{
this.code = code;
diff --git a/avahi-sharp/DomainBrowser.cs b/avahi-sharp/DomainBrowser.cs
index 50da54e..a1165dc 100644
--- a/avahi-sharp/DomainBrowser.cs
+++ b/avahi-sharp/DomainBrowser.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -61,7 +59,7 @@ namespace Avahi
}
public delegate void DomainInfoHandler (object o, DomainInfoArgs args);
-
+
public class DomainBrowser : BrowserBase, IDisposable
{
private IntPtr handle;
@@ -76,7 +74,7 @@ namespace Avahi
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,
@@ -97,7 +95,7 @@ namespace Avahi
Stop (false);
}
}
-
+
public event DomainInfoHandler DomainRemoved
{
add {
@@ -118,7 +116,7 @@ namespace Avahi
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)
{
diff --git a/avahi-sharp/EntryGroup.cs b/avahi-sharp/EntryGroup.cs
index 02be643..24abae4 100644
--- a/avahi-sharp/EntryGroup.cs
+++ b/avahi-sharp/EntryGroup.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -41,7 +39,7 @@ namespace Avahi
UseWideArea = 128,
UseMulticast = 256
}
-
+
public enum EntryGroupState {
Uncommited,
Registering,
@@ -58,7 +56,7 @@ namespace Avahi
{
get { return state; }
}
-
+
public EntryGroupStateArgs (EntryGroupState state)
{
this.state = state;
@@ -67,13 +65,13 @@ namespace Avahi
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);
@@ -114,7 +112,7 @@ namespace Avahi
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);
@@ -131,7 +129,7 @@ namespace Avahi
private static extern IntPtr avahi_alternative_service_name (byte[] name);
public event EntryGroupStateHandler StateChanged;
-
+
public EntryGroupState State
{
get {
@@ -149,7 +147,7 @@ namespace Avahi
}
}
}
-
+
public EntryGroup (Client client)
{
this.client = client;
@@ -245,9 +243,9 @@ namespace Avahi
Utility.StringToBytes (domain),
Utility.StringToBytes (host), port, list);
}
-
+
avahi_string_list_free (list);
-
+
if (ret < 0) {
client.ThrowError ();
}
@@ -285,7 +283,7 @@ namespace Avahi
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)
{
diff --git a/avahi-sharp/HostNameResolver.cs b/avahi-sharp/HostNameResolver.cs
index 81305fd..b9fe7f4 100644
--- a/avahi-sharp/HostNameResolver.cs
+++ b/avahi-sharp/HostNameResolver.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -49,7 +47,7 @@ namespace Avahi
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,
@@ -69,7 +67,7 @@ namespace Avahi
Stop (false);
}
}
-
+
public event EventHandler Timeout
{
add {
diff --git a/avahi-sharp/Makefile.am b/avahi-sharp/Makefile.am
index 43ab428..1fdb1ca 100644
--- a/avahi-sharp/Makefile.am
+++ b/avahi-sharp/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -48,11 +46,11 @@ EXTRA_DIST = \
$(srcdir)/gencfg.sh
$(ASSEMBLY): $(AVAHISOURCES)
- mcs -keyfile:$(srcdir)/avahi.snk -target:library -out:$@ -debug $(AVAHISOURCES) -r:Mono.Posix
+ $(AM_V_GEN)MONO_SHARED_DIR=. mcs -keyfile:$(srcdir)/avahi.snk -target:library -out:$@ -debug $(AVAHISOURCES) -r:Mono.Posix
$(ASSEMBLY).config: $(ASSEMBLY).config.in
- $(srcdir)/gencfg.sh $(top_builddir)/avahi-client/libavahi-client.la \
+ $(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 < $< > $@
@@ -62,12 +60,12 @@ all: $(ASSEMBLY) $(ASSEMBLY).config
if HAVE_MONODOC
update-docs: $(ASSEMBLY)
- $(MONODOCER) -assembly:$(ASSEMBLY) -path:en
+ $(AM_V_GEN)$(MONODOCER) -assembly:$(ASSEMBLY) -path:en
avahi-sharp-docs.zip: avahi-sharp-docs.tree
avahi-sharp-docs.tree: $(srcdir)/en/*/*
- $(MDASSEMBLER) --out avahi-sharp-docs --ecma $(srcdir)/en
+ $(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
@@ -75,10 +73,10 @@ monodoc_DATA = avahi-sharp-docs.zip avahi-sharp-docs.tree avahi-sharp-docs.sourc
endif
install-data-hook: $(ASSEMBLY)
- $(GACUTIL) /i $(ASSEMBLY) /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+ $(AM_V_GEN)MONO_SHARED_DIR=. $(GACUTIL) /i $(ASSEMBLY) /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
uninstall-hook: $(ASSEMBLY)
- $(GACUTIL) /u avahi-sharp /package avahi-sharp /gacdir $(libdir) /root $(DESTDIR)$(libdir)
+ $(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
index f65f8ac..ba5a983 100644
--- a/avahi-sharp/RecordBrowser.cs
+++ b/avahi-sharp/RecordBrowser.cs
@@ -1,5 +1,3 @@
-/* $Id: ServiceBrowser.cs 635 2005-09-26 03:57:30Z snorp $ */
-
/***
This file is part of avahi.
@@ -29,7 +27,7 @@ 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);
@@ -50,7 +48,7 @@ namespace Avahi
Aaa = 28,
Srv = 33
}
-
+
public struct RecordInfo
{
public int NetworkInterface;
@@ -91,7 +89,7 @@ namespace Avahi
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,
@@ -113,7 +111,7 @@ namespace Avahi
Stop (false);
}
}
-
+
public event RecordInfoHandler RecordRemoved
{
add {
@@ -135,7 +133,7 @@ namespace Avahi
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)
{
@@ -178,7 +176,7 @@ namespace Avahi
{
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;
diff --git a/avahi-sharp/ResolverBase.cs b/avahi-sharp/ResolverBase.cs
index 0a5a2a8..d546aba 100644
--- a/avahi-sharp/ResolverBase.cs
+++ b/avahi-sharp/ResolverBase.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-sharp/ServiceBrowser.cs b/avahi-sharp/ServiceBrowser.cs
index 520e339..5c39ad4 100644
--- a/avahi-sharp/ServiceBrowser.cs
+++ b/avahi-sharp/ServiceBrowser.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -30,7 +28,7 @@ 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;
@@ -63,7 +61,7 @@ namespace Avahi
}
public delegate void ServiceInfoHandler (object o, ServiceInfoArgs args);
-
+
public class ServiceBrowser : BrowserBase, IDisposable
{
private IntPtr handle;
@@ -78,7 +76,7 @@ namespace Avahi
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,
@@ -99,7 +97,7 @@ namespace Avahi
Stop (false);
}
}
-
+
public event ServiceInfoHandler ServiceRemoved
{
add {
@@ -120,12 +118,12 @@ namespace Avahi
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;
@@ -167,7 +165,7 @@ namespace Avahi
{
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;
diff --git a/avahi-sharp/ServiceResolver.cs b/avahi-sharp/ServiceResolver.cs
index a32efca..7f8901a 100644
--- a/avahi-sharp/ServiceResolver.cs
+++ b/avahi-sharp/ServiceResolver.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -51,7 +49,7 @@ namespace Avahi
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,
@@ -82,7 +80,7 @@ namespace Avahi
Stop (false);
}
}
-
+
public event EventHandler Timeout
{
add {
@@ -115,7 +113,7 @@ namespace Avahi
GetLookupFlags (service.Flags))
{
}
-
+
public ServiceResolver (Client client, int iface, Protocol proto, string name,
string type, string domain, Protocol aproto, LookupFlags flags)
{
diff --git a/avahi-sharp/ServiceTypeBrowser.cs b/avahi-sharp/ServiceTypeBrowser.cs
index 3796d60..e1356d0 100644
--- a/avahi-sharp/ServiceTypeBrowser.cs
+++ b/avahi-sharp/ServiceTypeBrowser.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -29,7 +27,7 @@ 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;
@@ -55,7 +53,7 @@ namespace Avahi
}
public delegate void ServiceTypeInfoHandler (object o, ServiceTypeInfoArgs args);
-
+
public class ServiceTypeBrowser : BrowserBase, IDisposable
{
private IntPtr handle;
@@ -69,7 +67,7 @@ namespace Avahi
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,
@@ -90,7 +88,7 @@ namespace Avahi
Stop (false);
}
}
-
+
public event ServiceTypeInfoHandler ServiceTypeRemoved
{
add {
diff --git a/avahi-sharp/Utility.cs b/avahi-sharp/Utility.cs
index 9081b01..a1d0a66 100644
--- a/avahi-sharp/Utility.cs
+++ b/avahi-sharp/Utility.cs
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -45,7 +43,7 @@ namespace Avahi
{
if (ptr == IntPtr.Zero)
return null;
-
+
int len = strlen (ptr);
byte[] bytes = new byte[len];
Marshal.Copy (ptr, bytes, 0, len);
@@ -56,7 +54,7 @@ namespace Avahi
{
if (ptr == IntPtr.Zero)
return null;
-
+
string ret = PtrToString (ptr);
Free (ptr);
return ret;
@@ -100,7 +98,7 @@ namespace Avahi
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);
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/Makefile.am b/avahi-ui-sharp/Makefile.am
index 6183f48..28ea64f 100644
--- a/avahi-ui-sharp/Makefile.am
+++ b/avahi-ui-sharp/Makefile.am
@@ -1,5 +1,3 @@
-# $Id: Makefile.am 1251 2006-08-21 23:31:59Z lennart $
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -34,13 +32,13 @@ EXTRA_DIST = \
$(srcdir)/bssh.cs
$(ASSEMBLY): $(AVAHISOURCES)
- 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
+ $(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
- $(srcdir)/gencfg.sh $(top_builddir)/avahi-common/libavahi-common.la < $< > $@
+ $(AM_V_GEN)$(srcdir)/gencfg.sh $(top_builddir)/avahi-common/libavahi-common.la < $< > $@
bssh.exe: $(srcdir)/bssh.cs $(ASSEMBLY)
- mcs -out:$@ $(srcdir)/bssh.cs -r:./avahi-ui-sharp.dll -r:../avahi-sharp/avahi-sharp.dll -pkg:gtk-sharp-2.0 -r:Mono.Posix
+ $(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
@@ -49,12 +47,12 @@ all: $(ASSEMBLY) $(ASSEMBLY).config bssh.exe
if HAVE_MONODOC
update-docs: $(ASSEMBLY)
- $(MONODOCER) -assembly:$(ASSEMBLY) -path:en
+ $(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/*/*
- $(MDASSEMBLER) --out avahi-ui-sharp-docs --ecma $(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
diff --git a/avahi-ui-sharp/ServiceDialog.cs b/avahi-ui-sharp/ServiceDialog.cs
index e0306e1..31f7479 100644
--- a/avahi-ui-sharp/ServiceDialog.cs
+++ b/avahi-ui-sharp/ServiceDialog.cs
@@ -27,13 +27,13 @@ namespace Avahi.UI
[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);
@@ -114,7 +114,7 @@ namespace Avahi.UI
for (int i = 0;;i++) {
if (types[i] != IntPtr.Zero)
break;
-
+
GLib.Marshaller.Free (types[i]);
}
}
@@ -172,11 +172,11 @@ namespace Avahi.UI
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);
@@ -209,7 +209,7 @@ namespace Avahi.UI
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,
@@ -223,7 +223,7 @@ namespace Avahi.UI
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);
diff --git a/avahi-ui-sharp/bssh.cs b/avahi-ui-sharp/bssh.cs
index 003a3a6..fa3d4d4 100644
--- a/avahi-ui-sharp/bssh.cs
+++ b/avahi-ui-sharp/bssh.cs
@@ -5,8 +5,8 @@ using Avahi.UI;
public class EntryPoint {
public static void Main () {
- Application.Init ();
-
+ Application.Init ();
+
ServiceDialog dialog = new ServiceDialog ("Choose SSH Server", null,
Stock.Cancel, ResponseType.Cancel,
Stock.Connect, ResponseType.Accept);
@@ -17,11 +17,11 @@ public class EntryPoint {
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;
diff --git a/avahi-ui.pc.in b/avahi-ui.pc.in
index ca9c2ef..9edeea9 100644
--- a/avahi-ui.pc.in
+++ b/avahi-ui.pc.in
@@ -4,7 +4,7 @@ libdir=@libdir@
includedir=${prefix}/include
Name: avahi-ui
-Description: Avahi Multicast DNS Responder (Common GTK UI support)
+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
diff --git a/avahi-ui/Makefile.am b/avahi-ui/Makefile.am
index 6dbbd24..72d6023 100644
--- a/avahi-ui/Makefile.am
+++ b/avahi-ui/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
@@ -23,13 +21,13 @@ AM_CFLAGS=-I$(top_srcdir) -DG_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED=1 -D
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
desktopdir = $(datadir)/applications
-desktop_DATA =
+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_GTK
+if HAVE_GTK2OR3
AM_CFLAGS += -DGNOMELOCALEDIR=\"$(datadir)/locale\"
if HAVE_DBUS
if HAVE_GLIB
@@ -39,8 +37,17 @@ avahiincludedir=$(includedir)/avahi-ui
avahiinclude_HEADERS = \
avahi-ui.h
-lib_LTLIBRARIES = \
- libavahi-ui.la
+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
@@ -48,15 +55,25 @@ 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=\"$(pkglibdir)/service-types.db\"
libavahi_ui_la_LIBADD += -lgdbm
+
+libavahi_ui_gtk3_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdir)/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=\"$(pkglibdir)/service-types.db\"
+
+libavahi_ui_gtk3_la_CFLAGS += -DDATABASE_FILE=\"$(pkglibdir)/service-types.db\"
endif
bin_PROGRAMS = bssh
@@ -64,8 +81,14 @@ 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) && \
@@ -74,10 +97,10 @@ install-exec-local:
$(LN_S) bssh bshell
bssh.desktop.in: bssh.desktop.in.in
- sed -e 's,@bindir\@,$(bindir),g' $< > $@
+ $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
bvnc.desktop.in: bvnc.desktop.in.in
- sed -e 's,@bindir\@,$(bindir),g' $< > $@
+ $(AM_V_GEN)sed -e 's,@bindir\@,$(bindir),g' $< > $@
endif # HAVE_GLIB
endif
diff --git a/avahi-ui/avahi-ui.c b/avahi-ui/avahi-ui.c
index bd2b3cc..6f2fcbe 100644
--- a/avahi-ui/avahi-ui.c
+++ b/avahi-ui/avahi-ui.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -30,7 +28,6 @@
#include <net/if.h>
#include <gtk/gtk.h>
-#include <glib/gi18n.h>
#include <avahi-glib/glib-watch.h>
#include <avahi-client/client.h>
@@ -131,16 +128,16 @@ static void aui_service_dialog_get_property(GObject *object, guint prop_id, GVal
static int get_default_response(GtkDialog *dlg) {
gint ret = GTK_RESPONSE_NONE;
- if (GTK_WINDOW(dlg)->default_widget)
+ 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(dlg)->default_widget);
+ 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(dlg->action_area));
+ t = children = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_action_area(dlg)));
while (t) {
GtkWidget *child = t->data;
@@ -890,7 +887,7 @@ static void response_callback(GtkDialog *dialog, gint response, gpointer user_da
gtk_widget_set_sensitive(GTK_WIDGET(dialog), FALSE);
cursor = gdk_cursor_new(GDK_WATCH);
- gdk_window_set_cursor(GTK_WIDGET(dialog)->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(dialog)), cursor);
gdk_cursor_unref(cursor);
if (!(d->priv->resolver = avahi_service_resolver_new(
@@ -992,7 +989,7 @@ static void domain_button_clicked(GtkButton *button G_GNUC_UNUSED, gpointer user
vbox = gtk_vbox_new(FALSE, 8);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(p->domain_dialog)->vbox), vbox, TRUE, TRUE, 0);
+ 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);
@@ -1114,7 +1111,7 @@ static void aui_service_dialog_init(AuiServiceDialog *d) {
vbox = gtk_vbox_new(FALSE, 8);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 8);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->vbox), vbox, TRUE, TRUE, 0);
+ 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);
@@ -1165,8 +1162,8 @@ static void aui_service_dialog_init(AuiServiceDialog *d) {
p->domain_button = gtk_button_new_with_mnemonic(_("_Domain..."));
gtk_button_set_image(GTK_BUTTON(p->domain_button), gtk_image_new_from_stock(GTK_STOCK_NETWORK, GTK_ICON_SIZE_BUTTON));
g_signal_connect(p->domain_button, "clicked", G_CALLBACK(domain_button_clicked), d);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(d)->action_area), p->domain_button, FALSE, TRUE, 0);
- gtk_button_box_set_child_secondary(GTK_BUTTON_BOX(GTK_DIALOG(d)->action_area), p->domain_button, TRUE);
+ gtk_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);
diff --git a/avahi-ui/avahi-ui.h b/avahi-ui/avahi-ui.h
index d780f83..aae61dc 100644
--- a/avahi-ui/avahi-ui.h
+++ b/avahi-ui/avahi-ui.h
@@ -1,8 +1,6 @@
#ifndef fooavahiuihfoo
#define fooavahiuihfoo
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-ui/bssh.c b/avahi-ui/bssh.c
index e4a190b..491380f 100644
--- a/avahi-ui/bssh.c
+++ b/avahi-ui/bssh.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -31,7 +29,6 @@
#include <getopt.h>
#include <gtk/gtk.h>
-#include <glib/gi18n.h>
#include <avahi-client/client.h>
#include <avahi-common/strlst.h>
diff --git a/avahi-utils/Makefile.am b/avahi-utils/Makefile.am
index 21993c3..1b0443c 100644
--- a/avahi-utils/Makefile.am
+++ b/avahi-utils/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/avahi-utils/avahi-browse.c b/avahi-utils/avahi-browse.c
index 8cbd6d5..6e808a4 100644
--- a/avahi-utils/avahi-browse.c
+++ b/avahi-utils/avahi-browse.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-utils/avahi-publish.c b/avahi-utils/avahi-publish.c
index 9c9a93c..485de3a 100644
--- a/avahi-utils/avahi-publish.c
+++ b/avahi-utils/avahi-publish.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -51,7 +49,7 @@ typedef enum {
} Command;
typedef struct Config {
- int verbose, no_fail;
+ int verbose, no_fail, no_reverse;
Command command;
char *name, *stype, *domain, *host;
uint16_t port;
@@ -122,7 +120,7 @@ static int register_stuff(Config *config) {
if (config->command == COMMAND_PUBLISH_ADDRESS) {
- if (avahi_entry_group_add_address(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, &config->address) < 0) {
+ 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;
}
@@ -225,6 +223,7 @@ static void help(FILE *f, const char *argv0) {
" -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");
@@ -246,6 +245,7 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
{ "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 }
};
@@ -253,12 +253,12 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
assert(c);
c->command = strstr(argv0, "address") ? COMMAND_PUBLISH_ADDRESS : (strstr(argv0, "service") ? COMMAND_PUBLISH_SERVICE : COMMAND_UNSPEC);
- c->verbose = c->no_fail = 0;
+ c->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, "hVsavd:H:f", long_options, NULL)) >= 0) {
+ while ((o = getopt_long(argc, argv, "hVsavRd:H:f", long_options, NULL)) >= 0) {
switch(o) {
case 'h':
@@ -276,6 +276,9 @@ static int parse_command_line(Config *c, const char *argv0, int argc, char *argv
case 'v':
c->verbose = 1;
break;
+ case 'R':
+ c->no_reverse = 1;
+ break;
case 'd':
avahi_free(c->domain);
c->domain = avahi_strdup(optarg);
diff --git a/avahi-utils/avahi-resolve.c b/avahi-utils/avahi-resolve.c
index 0077248..bf1730b 100644
--- a/avahi-utils/avahi-resolve.c
+++ b/avahi-utils/avahi-resolve.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-utils/avahi-set-host-name.c b/avahi-utils/avahi-set-host-name.c
index 737ca3b..34fbbeb 100644
--- a/avahi-utils/avahi-set-host-name.c
+++ b/avahi-utils/avahi-set-host-name.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/avahi-utils/sigint.c b/avahi-utils/sigint.c
index eb97f38..b726654 100644
--- a/avahi-utils/sigint.c
+++ b/avahi-utils/sigint.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -41,7 +39,7 @@ static AvahiWatch *watch = NULL;
static int set_nonblock(int fd) {
int n;
-
+
assert(fd >= 0);
if ((n = fcntl(fd, F_GETFL)) < 0)
@@ -69,7 +67,7 @@ static void close_pipe_fds(void) {
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);
@@ -84,7 +82,7 @@ static void watch_callback(AvahiWatch *w, int fd, AvahiWatchEvent event, AVAHI_G
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);
@@ -106,7 +104,7 @@ int sigint_install(AvahiSimplePoll *spoll) {
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));
@@ -117,13 +115,13 @@ int sigint_install(AvahiSimplePoll *spoll) {
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;
diff --git a/avahi-utils/sigint.h b/avahi-utils/sigint.h
index 0bc5c34..ae66fd4 100644
--- a/avahi-utils/sigint.h
+++ b/avahi-utils/sigint.h
@@ -1,21 +1,19 @@
#ifndef foosigchfoo
#define foosigchfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/avahi-utils/stdb.c b/avahi-utils/stdb.c
index b7a5ed3..6602c97 100644
--- a/avahi-utils/stdb.c
+++ b/avahi-utils/stdb.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -74,10 +72,10 @@ const char* stdb_lookup(const char *name) {
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);
@@ -91,7 +89,7 @@ const char* stdb_lookup(const char *name) {
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);
@@ -139,9 +137,9 @@ const char* stdb_lookup(const char *name) {
avahi_free(buffer);
buffer = avahi_strndup(data.dptr, data.dsize);
free(data.dptr);
-
+
return buffer;
-
+
fail:
return name;
@@ -169,12 +167,12 @@ void stdb_shutdown(void) {
char *stdb_getent(void) {
datum key;
-
+
if (init() < 0)
return NULL;
for (;;) {
-
+
if (!enum_key) {
#ifdef HAVE_GDBM
key = gdbm_firstkey(gdbm_file);
@@ -185,7 +183,7 @@ char *stdb_getent(void) {
} else {
key.dptr = enum_key;
key.dsize = strlen(enum_key);
-
+
#ifdef HAVE_GDBM
key = gdbm_nextkey(gdbm_file, key);
#endif
@@ -196,10 +194,10 @@ char *stdb_getent(void) {
avahi_free(enum_key);
enum_key = NULL;
-
+
if (!key.dptr)
return NULL;
-
+
enum_key = avahi_strndup(key.dptr, key.dsize);
free(key.dptr);
diff --git a/avahi-utils/stdb.h b/avahi-utils/stdb.h
index 3f8ccc0..d1e1a91 100644
--- a/avahi-utils/stdb.h
+++ b/avahi-utils/stdb.h
@@ -1,21 +1,19 @@
#ifndef foostdbhfoo
#define foostdbhfoo
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
diff --git a/bootstrap.sh b/bootstrap.sh
index ada993f..105bdbf 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,5 +1,4 @@
#!/bin/sh
-# $Id$
# This file is part of avahi.
#
@@ -59,4 +58,4 @@ case "$USER" in
;;
esac
-CFLAGS="$CFLAGS -g -O0" exec ./autogen.sh $FLAGS "$@"
+CFLAGS="$CFLAGS -g -O0" exec ./autogen.sh $FLAGS "$@" --enable-qt3=no
diff --git a/common/.gitignore b/common/.gitignore
index de8ddd7..1012b7f 100644
--- a/common/.gitignore
+++ b/common/.gitignore
@@ -1,3 +1,4 @@
+intltool.m4
ChangeLog
gettext.m4
iconv.m4
diff --git a/common/Makefile.am b/common/Makefile.am
index 3f88c28..7379965 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
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/configure.ac b/configure.ac
index cb6e151..1be1f60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,6 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -20,11 +18,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-AC_PREREQ(2.57)
+AC_PREREQ(2.63)
AC_INIT([avahi],[0.6.25],[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.9 -Wall])
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
AC_SUBST(PACKAGE_URL, [http://avahi.org/])
@@ -42,23 +41,29 @@ AC_SUBST(LIBAVAHI_COMPAT_LIBDNS_SD_VERSION_INFO, [1:0:0])
AC_SUBST(LIBAVAHI_COMPAT_HOWL_VERSION_INFO, [0:0:0])
AC_SUBST(HOWL_COMPAT_VERSION, [0.9.8])
-if type -p stow > /dev/null && test -d /usr/local/stow ; then
- AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
- ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
-fi
+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
-AC_GNU_SOURCE
+AM_PROG_CC_C_O
+AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_GCC_TRADITIONAL
-AM_PROG_CC_C_O
-
# -fstack-protector
AC_ARG_ENABLE([stack-protector],
[AS_HELP_STRING([--disable-stack-protector],
@@ -169,6 +174,7 @@ 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 ])
@@ -301,7 +307,7 @@ test_gcc_flag() {
# If using GCC specify some additional parameters
if test "x$GCC" = "xyes" ; then
- DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline"
+ DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -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
@@ -350,7 +356,7 @@ 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__")
+ AC_CHECK_DECL([CMSG_SPACE],,CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__", [[#include <sys/socket.h>]])
# Checks for library functions.
AC_FUNC_MEMCMP
@@ -415,7 +421,6 @@ 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)
@@ -465,6 +470,11 @@ fi
AM_CONDITIONAL(HAVE_GOBJECT, test "x$HAVE_GOBJECT" = "xyes")
#
+# Introspection support.
+#
+GOBJECT_INTROSPECTION_CHECK([0.6.7])
+
+#
# Check for Qt 3
#
AC_ARG_ENABLE(qt3,
@@ -515,10 +525,10 @@ fi
AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
#
-# Check for GTK+
+# Check for GTK+ 2.0
#
AC_ARG_ENABLE(gtk,
- AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
+ AS_HELP_STRING([--disable-gtk],[Disable use of GTK+ 2]),
[case "${enableval}" in
yes) HAVE_GTK=yes ;;
no) HAVE_GTK=no ;;
@@ -528,18 +538,35 @@ AC_ARG_ENABLE(gtk,
if test "x$HAVE_GTK" = "xyes" ; then
# Check for GTK 2.0
- PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
+ PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.14.0 ])
AC_SUBST(GTK20_CFLAGS)
AC_SUBST(GTK20_LIBS)
-
- # Check for GLADE 2.0
- PKG_CHECK_MODULES(GLADE20, [ libglade-2.0 >= 2.4.0 ])
- AC_SUBST(GLADE20_CFLAGS)
- AC_SUBST(GLADE20_LIBS)
fi
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
#
+# 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_GTK2" = "xyes" )
+
+#
# D-Bus
#
AC_ARG_ENABLE(dbus,
@@ -1046,6 +1073,15 @@ AC_ARG_ENABLE(compat-howl,
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)])
+AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
# ==========================================================================
AC_CONFIG_FILES([
@@ -1106,7 +1142,9 @@ echo "
CFLAGS: ${CFLAGS}
Enable GLIB: ${HAVE_GLIB}
Enable GLIB GObject: ${HAVE_GOBJECT}
- Enable GTK: ${HAVE_GTK}
+ 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}
@@ -1128,6 +1166,7 @@ echo "
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!)"
@@ -1158,8 +1197,13 @@ 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_GTK" = "xyes" -a "x$BUILD_CLIENT" = "xyes" ; then
+if test "x$HAVE_GTK2OR3" = "xyes" -a "x$BUILD_CLIENT" = "xyes" ; then
BUILD_UI="yes"
fi
@@ -1177,7 +1221,7 @@ echo "\
Building avahi-python: ${BUILD_PYTHON}
Building libavahi-glib: ${HAVE_GLIB}
Building libavahi-gobject: ${BUILD_GOBJECT}
- Building avahi-discover-standalone: ${HAVE_GTK}
+ Building avahi-discover-standalone: ${HAVE_GTK2OR3}
Building libavahi-qt3: ${HAVE_QT3}
Building libavahi-qt4: ${HAVE_QT4}
Building avahi-sharp: ${HAVE_MONO}
diff --git a/docs/API-CHANGES-0.6 b/docs/API-CHANGES-0.6
index c29dd56..7c08446 100644
--- a/docs/API-CHANGES-0.6
+++ b/docs/API-CHANGES-0.6
@@ -1,6 +1,5 @@
-*-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
@@ -73,5 +72,3 @@ A terse (and incomplete) list of API changes between 0.5.2 and 0.6:
* There's now a client side AvahiRecordBrowser, and
avahi_entry_group_add_record().
-
-$Id$
diff --git a/docs/COMPAT-LAYERS b/docs/COMPAT-LAYERS
index 050c988..01b01f2 100644
--- a/docs/COMPAT-LAYERS
+++ b/docs/COMPAT-LAYERS
@@ -14,5 +14,3 @@ ABI/API compatibility should:
$(includedir)/dns_sd.h
-- Lennart
-
-$Id$
diff --git a/docs/DBUS-API b/docs/DBUS-API
index 99e16da..7a57aaa 100644
--- a/docs/DBUS-API
+++ b/docs/DBUS-API
@@ -1,5 +1,3 @@
-$Id$
-
* NOTE *
This file used to contain an overview of the DBUS API for Avahi, however
since it was no longer up to date you should now read the XML-formatted DBUS
diff --git a/docs/HACKING b/docs/HACKING
index eec7eb7..94a8366 100644
--- a/docs/HACKING
+++ b/docs/HACKING
@@ -1,19 +1,14 @@
Please comply with the following rules when hacking on Avahi:
- * When you add a new textual file to the repository please enable SVN
- keyword expansion for it:
-
- svn ps svn:keywords Id foo.c
+ * Before commiting check with "git st" that all built files are ignored
+ by git. To change the list of ignored files use
- * Before commiting check with "svn st" that all built files are ignored
- by svn. To change the list of ignored files use
-
- svn pe svn:ignore .
+ $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
@@ -42,8 +37,6 @@ Please comply with the following rules when hacking on Avahi:
For Makefile.am, python and shell code:
<snip>
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -65,8 +58,6 @@ Please comply with the following rules when hacking on Avahi:
For C source code:
<snip>
-/* $Id$ */
-
/***
This file is part of avahi.
@@ -86,6 +77,3 @@ Please comply with the following rules when hacking on Avahi:
USA.
***/
</snip>
-
-
-$Id$
diff --git a/docs/INSTALL b/docs/INSTALL
index 8feac51..419ac3e 100644
--- a/docs/INSTALL
+++ b/docs/INSTALL
@@ -51,5 +51,3 @@ To start the two daemons at boot time on Debian based distributions:
If you plan to use avahi-autoipd you have to create the user/group
"avahi-autoipd" much the same way as "avahi".
-
-$Id$
diff --git a/docs/MALLOC b/docs/MALLOC
index 5c7db9e..7c452af 100644
--- a/docs/MALLOC
+++ b/docs/MALLOC
@@ -6,5 +6,3 @@ situations. Therefore we recommend the usage of memory allocators that
abort() in case of OOM. The default allocator used by Avahi does this.
Eventually we will improve Avahi to deal with these things better.
-
-$Id$
diff --git a/docs/NEWS b/docs/NEWS
index 8adc667..3cf1cbb 100644
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -189,7 +189,7 @@ from the last release
* Fix potential endless loop in dns label unpacking code (Closes: #84)
* Fix bogus assertion in client-publish-service.c example
* Mild fix to some doxygen docs for avahi-common/address.h
- * Fix passing in custom priviledged group (previously ignored setting)
+ * Fix passing in custom privileged group (previously ignored setting)
(Closes: #85)
This release is backwards compatible with Avahi 0.6.x with x < 16.
@@ -219,7 +219,7 @@ Changes:
Windows under the name APIPA. While it is not the first implemenatation of
this technology for Free operating systems it is clearly the most powerful
and hopefully even the most secure. (Because it chroot()s and drops
- priviliges and suchlike) For more information, especially about packaging
+ 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
@@ -744,5 +744,3 @@ contribution to Avahi 0.1.
Cheers,
The Avahi Team
-
-$Id$
diff --git a/docs/socket-auto-port.c b/docs/socket-auto-port.c
index 75dffaf..3c68c70 100644
--- a/docs/socket-auto-port.c
+++ b/docs/socket-auto-port.c
@@ -12,11 +12,11 @@ int main(int argc, char *argv[]) {
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;
@@ -44,6 +44,6 @@ int main(int argc, char *argv[]) {
/* ... hic sunt leones ... */
sleep(60);
-
+
return 0;
}
diff --git a/examples/Makefile.am b/examples/Makefile.am
index e6e66f5..dbb7f00 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
diff --git a/examples/client-browse-services.c b/examples/client-browse-services.c
index de6a970..f7ded2a 100644
--- a/examples/client-browse-services.c
+++ b/examples/client-browse-services.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -63,9 +61,9 @@ static void resolve_callback(
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,
@@ -85,7 +83,7 @@ static void resolve_callback(
!!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA),
!!(flags & AVAHI_LOOKUP_RESULT_MULTICAST),
!!(flags & AVAHI_LOOKUP_RESULT_CACHED));
-
+
avahi_free(t);
}
}
@@ -103,7 +101,7 @@ static void browse_callback(
const char *domain,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiClient *c = userdata;
assert(b);
@@ -111,7 +109,7 @@ static void browse_callback(
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;
@@ -126,7 +124,7 @@ static void browse_callback(
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:
@@ -171,7 +169,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
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)));
@@ -180,15 +178,15 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
/* 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);
diff --git a/examples/client-publish-service.c b/examples/client-publish-service.c
index 73ee01b..facc965 100644
--- a/examples/client-publish-service.c
+++ b/examples/client-publish-service.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/examples/core-browse-services.c b/examples/core-browse-services.c
index 53b18ee..e062e3e 100644
--- a/examples/core-browse-services.c
+++ b/examples/core-browse-services.c
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/* PLEASE NOTE *
* This file demonstrates how to use Avahi's core API, this is
* the embeddable mDNS stack for embedded applications.
@@ -7,23 +5,23 @@
* 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
@@ -62,7 +60,7 @@ static void resolve_callback(
AvahiStringList *txt,
AvahiLookupResultFlags flags,
AVAHI_GCC_UNUSED void* userdata) {
-
+
assert(r);
/* Called whenever a service has been resolved successfully or timed out */
@@ -74,9 +72,9 @@ static void resolve_callback(
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,
@@ -97,7 +95,7 @@ static void resolve_callback(
avahi_free(t);
}
}
-
+
avahi_s_service_resolver_free(r);
}
@@ -111,7 +109,7 @@ static void browse_callback(
const char *domain,
AVAHI_GCC_UNUSED AvahiLookupResultFlags flags,
void* userdata) {
-
+
AvahiServer *s = userdata;
assert(b);
@@ -120,7 +118,7 @@ static void browse_callback(
switch (event) {
case AVAHI_BROWSER_FAILURE:
-
+
fprintf(stderr, "(Browser) %s\n", avahi_strerror(avahi_server_errno(server)));
avahi_simple_poll_quit(simple_poll);
return;
@@ -132,10 +130,10 @@ static void browse_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:
@@ -175,7 +173,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
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);
@@ -187,24 +185,24 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
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);
diff --git a/examples/core-publish-service.c b/examples/core-publish-service.c
index 6370383..a78a464 100644
--- a/examples/core-publish-service.c
+++ b/examples/core-publish-service.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -48,7 +46,7 @@ static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntry
/* Called whenever the entry group state changes */
switch (state) {
-
+
case AVAHI_ENTRY_GROUP_ESTABLISHED:
/* The entry group has been established successfully */
@@ -57,23 +55,23 @@ static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntry
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;
@@ -95,7 +93,7 @@ static void create_services(AvahiServer *s) {
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 */
@@ -141,7 +139,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
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);
@@ -150,16 +148,16 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
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;
}
@@ -169,7 +167,7 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
/* 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. */
@@ -179,9 +177,9 @@ static void server_callback(AvahiServer *s, AvahiServerState state, AVAHI_GCC_UN
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;
@@ -196,7 +194,7 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
AvahiServer *server = NULL;
int error;
int ret = 1;
-
+
/* Initialize the pseudo-RNG */
srand(time(NULL));
@@ -205,14 +203,14 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
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);
@@ -227,11 +225,11 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
/* Run the main loop */
avahi_simple_poll_loop(simple_poll);
-
+
ret = 0;
-
+
fail:
-
+
/* Cleanup things */
if (server)
@@ -241,6 +239,6 @@ fail:
avahi_simple_poll_free(simple_poll);
avahi_free(name);
-
+
return ret;
}
diff --git a/examples/glib-integration.c b/examples/glib-integration.c
index ab53687..d2a2457 100644
--- a/examples/glib-integration.c
+++ b/examples/glib-integration.c
@@ -1,18 +1,16 @@
-/* $Id$ */
-
/***
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -45,7 +43,7 @@ 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);
@@ -121,7 +119,7 @@ main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[])
goto fail;
}
-
+
/* Make a call to get the version string from the daemon */
version = avahi_client_get_version_string (client);
@@ -132,7 +130,7 @@ main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[])
goto fail;
}
-
+
g_message ("Avahi Server Version: %s", version);
/* Start the GLIB Main Loop */
diff --git a/initscript/Makefile.am b/initscript/Makefile.am
index d5fadda..e5e1928 100644
--- a/initscript/Makefile.am
+++ b/initscript/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -17,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-SUBDIRS =
+SUBDIRS =
if TARGET_LFS
SUBDIRS += lfs
diff --git a/initscript/archlinux/Makefile.am b/initscript/archlinux/Makefile.am
index 22096b4..2070975 100644
--- a/initscript/archlinux/Makefile.am
+++ b/initscript/archlinux/Makefile.am
@@ -1,5 +1,3 @@
-# $Id: Makefile.am 267 2005-08-08 10:19:22Z lennart $
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/archlinux/avahi-daemon.in b/initscript/archlinux/avahi-daemon.in
index 1050cb0..6ae252d 100644
--- a/initscript/archlinux/avahi-daemon.in
+++ b/initscript/archlinux/avahi-daemon.in
@@ -1,7 +1,5 @@
#!/bin/bash
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/archlinux/avahi-dnsconfd.in b/initscript/archlinux/avahi-dnsconfd.in
index 667a0f6..c57260e 100755
--- a/initscript/archlinux/avahi-dnsconfd.in
+++ b/initscript/archlinux/avahi-dnsconfd.in
@@ -1,7 +1,5 @@
#!/bin/bash
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/darwin/Makefile.am b/initscript/darwin/Makefile.am
index 3c5cecc..d01e5a4 100644
--- a/initscript/darwin/Makefile.am
+++ b/initscript/darwin/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -33,8 +31,6 @@ CLEANFILES = \
org.freedesktop.avahi-daemon.plist: org.freedesktop.avahi-daemon.plist.in
sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
org.freedesktop.avahi-dnsconfd.plist: org.freedesktop.avahi-dnsconfd.plist.in
sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
- chmod +x $@
diff --git a/initscript/debian/Makefile.am b/initscript/debian/Makefile.am
index 7991ea6..314983d 100644
--- a/initscript/debian/Makefile.am
+++ b/initscript/debian/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/debian/avahi-daemon.in b/initscript/debian/avahi-daemon.in
index 30a2c2f..97fa157 100755
--- a/initscript/debian/avahi-daemon.in
+++ b/initscript/debian/avahi-daemon.in
@@ -1,7 +1,5 @@
#!/bin/sh
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/debian/avahi-dnsconfd.in b/initscript/debian/avahi-dnsconfd.in
index ac34804..67c2873 100755
--- a/initscript/debian/avahi-dnsconfd.in
+++ b/initscript/debian/avahi-dnsconfd.in
@@ -1,7 +1,5 @@
#!/bin/sh
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/fedora/Makefile.am b/initscript/fedora/Makefile.am
index e18f0f6..2e2f017 100644
--- a/initscript/fedora/Makefile.am
+++ b/initscript/fedora/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -26,9 +24,15 @@ initd_SCRIPTS = avahi-daemon avahi-dnsconfd
CLEANFILES = avahi-daemon avahi-dnsconfd
avahi-daemon: avahi-daemon.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
+ $(AM_V_GEN)sed \
+ -e 's,@sbindir\@,$(sbindir),g' \
+ -e 's,@localstatedir\@,$(localstatedir),g' \
+ $< > $@ && \
chmod +x $@
avahi-dnsconfd: avahi-dnsconfd.in
- sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
+ $(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
index c5b3230..b1b6124 100644
--- a/initscript/fedora/avahi-daemon.in
+++ b/initscript/fedora/avahi-daemon.in
@@ -1,16 +1,17 @@
-#! /bin/sh
+#!/bin/sh
#
-# avahi-daemon: Starts the Avahi Daemon
+# avahi-daemon: Starts the Avahi Daemon
#
-# chkconfig: 345 24 02
+# 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
-# config:
+# pidfile: @localstatedir@/run/avahi-daemon/pid
AVAHI_BIN=@sbindir@/avahi-daemon
+AVAHI_OPTS="-D"
if [ "$1" = 'status' ]; then
test -x $AVAHI_BIN || exit 4
@@ -18,13 +19,13 @@ else
test -x $AVAHI_BIN || exit 5
fi
-OTHER_AVAHI_OPTS=""
-
# Source function library.
. /etc/init.d/functions
. /etc/sysconfig/network
-LOCKFILE=/var/lock/subsys/avahi-daemon
+LOCKFILE=@localstatedir@/lock/subsys/avahi-daemon
+PIDFILE=@localstatedir@/run/avahi-daemon/pid
+RETVAL=0
base=${0##*/}
@@ -36,33 +37,26 @@ start() {
if [ -s /etc/localtime ]; then
cp -fp /etc/localtime /etc/avahi/etc >/dev/null 2>&1
fi;
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch $LOCKFILE
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
+ daemon --pidfile=${PIDFILE} $AVAHI_BIN $AVAHI_OPTS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch ${LOCKFILE}
return $RETVAL
}
stop() {
echo -n $"Shutting down Avahi daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
- rm -f $LOCKFILE
- echo
+ killproc -p ${PIDFILE} $AVAHI_BIN
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
+ echo
return $RETVAL
}
reload() {
echo -n $"Reloading Avahi daemon... "
- $AVAHI_BIN -r
+ killproc -p ${PIDFILE} $AVAHI_BIN -HUP
RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base reload" || failure $"$base reload"
echo
return $RETVAL
}
@@ -83,9 +77,8 @@ case "$1" in
stop
;;
status)
- $AVAHI_BIN -c
- RETVAL=$?
- [ $RETVAL = 0 ] && echo $"Avahi daemon is running" || echo $"Avahi daemon is not running"
+ status -p ${PIDFILE} $AVAHI_BIN
+ RETVAL=$?
;;
restart)
restart
diff --git a/initscript/fedora/avahi-dnsconfd.in b/initscript/fedora/avahi-dnsconfd.in
index de49d7f..df8b964 100644
--- a/initscript/fedora/avahi-dnsconfd.in
+++ b/initscript/fedora/avahi-dnsconfd.in
@@ -1,16 +1,17 @@
-#! /bin/sh
+#!/bin/sh
#
-# avahi-dnsconfd: Starts the Avahi dns configuration daemon
+# avahi-dnsconfd: Starts the Avahi dns configuration daemon
#
-# chkconfig: - 96 02
+# 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.
+# /etc/avahi/dnsconf.action for each unicast DNS server that is announced \
+# on the local LAN. This is useful for configuring unicast DNS servers in \
+# a DHCP-like fashion with mDNS.
# processname: avahi-dnsconfd
-# config:
+# pidfile: @localstatedir@/run/avahi-dnsconfd.pid
AVAHI_BIN=@sbindir@/avahi-dnsconfd
+AVAHI_OPTS="-D"
if [ "$1" = 'status' ]; then
test -x $AVAHI_BIN || exit 4
@@ -18,13 +19,13 @@ else
test -x $AVAHI_BIN || exit 5
fi
-OTHER_AVAHI_OPTS=""
-
# Source function library.
. /etc/init.d/functions
. /etc/sysconfig/network
-LOCKFILE=/var/lock/subsys/avahi-dnsconfd
+LOCKFILE=@localstatedir@/lock/subsys/avahi-dnsconfd
+PIDFILE=@localstatedir@/run/avahi-dnsconfd.pid
+RETVAL=0
base=${0##*/}
@@ -33,35 +34,28 @@ start() {
[ ${NETWORKING} = "no" ] && exit 1
echo -n $"Starting Avahi DNS daemon... "
- $AVAHI_BIN -D
- RETVAL=$?
- if [ $RETVAL = 0 ]; then
- touch $LOCKFILE
- success $"$base startup"
- else
- failure $"$base startup"
- fi
- echo
- return $RETVAL
+ daemon --pidfile=${PIDFILE} $AVAHI_BIN $AVAHI_OPTS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch ${LOCKFILE}
+ return $RETVAL
}
stop() {
echo -n $"Shutting down Avahi DNS daemon: "
- $AVAHI_BIN -k
- RETVAL=$?
- [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
- rm -f $LOCKFILE
- echo
- return $RETVAL
+ killproc -p ${PIDFILE} $AVAHI_BIN
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
+ 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
+ killproc -p ${PIDFILE} $AVAHI_BIN -HUP
+ RETVAL=$?
+ echo
+ return $RETVAL
}
restart() {
@@ -80,9 +74,8 @@ case "$1" in
stop
;;
status)
- $AVAHI_BIN -c
+ status -p ${PIDFILE} $AVAHI_BIN
RETVAL=$?
- [ $RETVAL = 0 ] && echo $"Avahi DNS daemon is running" || echo $"Avahi DNS daemon is not running"
;;
restart)
restart
diff --git a/initscript/freebsd/Makefile.am b/initscript/freebsd/Makefile.am
index 0ee75d5..c32830e 100644
--- a/initscript/freebsd/Makefile.am
+++ b/initscript/freebsd/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/gentoo/Makefile.am b/initscript/gentoo/Makefile.am
index 398e345..0d20ca6 100644
--- a/initscript/gentoo/Makefile.am
+++ b/initscript/gentoo/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -36,7 +34,7 @@ CLEANFILES = \
avahi-dnsconfd
avahi-daemon: avahi-daemon.in
-
+
sed -e 's,@sbindir\@,$(sbindir),g; $(NO_DBUS_DEPENDENCY)' $< > $@
chmod +x $@
diff --git a/initscript/gentoo/avahi-daemon.in b/initscript/gentoo/avahi-daemon.in
index 25edb2a..02eefe6 100644
--- a/initscript/gentoo/avahi-daemon.in
+++ b/initscript/gentoo/avahi-daemon.in
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# $Id$
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/initscript/gentoo/avahi-dnsconfd.in b/initscript/gentoo/avahi-dnsconfd.in
index 18efc05..376067e 100644
--- a/initscript/gentoo/avahi-dnsconfd.in
+++ b/initscript/gentoo/avahi-dnsconfd.in
@@ -1,5 +1,4 @@
#!/sbin/runscript
-# $Id$
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
diff --git a/initscript/lfs/Makefile.am b/initscript/lfs/Makefile.am
index d5e33f8..e8386e8 100644
--- a/initscript/lfs/Makefile.am
+++ b/initscript/lfs/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/mandriva/Makefile.am b/initscript/mandriva/Makefile.am
index 10fd4cf..480426b 100644
--- a/initscript/mandriva/Makefile.am
+++ b/initscript/mandriva/Makefile.am
@@ -1,5 +1,3 @@
-# $Id: Makefile.am 838 2005-10-22 21:23:02Z lennart $
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/mandriva/avahi-daemon.in b/initscript/mandriva/avahi-daemon.in
index f285d3b..d81b9a2 100644
--- a/initscript/mandriva/avahi-daemon.in
+++ b/initscript/mandriva/avahi-daemon.in
@@ -17,7 +17,7 @@ test -x $AVAHI_BIN || exit 5
. /etc/sysconfig/network
# Check that networking is configured.
-[ ${NETWORKING} = "no" ] && exit 0
+[ "${NETWORKING}" = "no" ] && exit 0
start() {
echo -n $"Starting Avahi daemon: "
diff --git a/initscript/slackware/Makefile.am b/initscript/slackware/Makefile.am
index 3175a15..d415387 100644
--- a/initscript/slackware/Makefile.am
+++ b/initscript/slackware/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/slackware/avahi-daemon.in b/initscript/slackware/avahi-daemon.in
index acd377d..76bf2f2 100644
--- a/initscript/slackware/avahi-daemon.in
+++ b/initscript/slackware/avahi-daemon.in
@@ -1,7 +1,5 @@
#!/bin/bash
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/slackware/avahi-dnsconfd.in b/initscript/slackware/avahi-dnsconfd.in
index 4da14fa..ea1554d 100644
--- a/initscript/slackware/avahi-dnsconfd.in
+++ b/initscript/slackware/avahi-dnsconfd.in
@@ -1,7 +1,5 @@
#!/bin/bash
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/suse/Makefile.am b/initscript/suse/Makefile.am
index e18f0f6..5624bdc 100644
--- a/initscript/suse/Makefile.am
+++ b/initscript/suse/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/initscript/suse/avahi-daemon.in b/initscript/suse/avahi-daemon.in
index e1fd201..851006c 100644
--- a/initscript/suse/avahi-daemon.in
+++ b/initscript/suse/avahi-daemon.in
@@ -37,7 +37,7 @@ case "$1" in
;;
status)
echo -n "Checking for Avahi daemon: "
- $AVAHI_BIN -c
+ $AVAHI_BIN -c || _rc_status=3
rc_status -v
;;
*)
diff --git a/man/Makefile.am b/man/Makefile.am
index 7d08828..d38267c 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -83,125 +81,24 @@ man_MANS += \
endif
endif
-avahi-browse.1.xml: avahi-browse.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-publish.1.xml: avahi-publish.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-resolve.1.xml: avahi-resolve.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-set-host-name.1.xml: avahi-set-host-name.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-daemon.8.xml: avahi-daemon.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@servicedir\@,$(servicedir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-discover.1.xml: avahi-discover.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-bookmarks.1.xml: avahi-bookmarks.1.xml.in Makefile
- sed -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-dnsconfd.8.xml: avahi-dnsconfd.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-daemon.conf.5.xml: avahi-daemon.conf.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-dnsconfd.action.8.xml: avahi-dnsconfd.action.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi.service.5.xml: avahi.service.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
+%.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' $< > $@
-
-avahi.hosts.5.xml: avahi.hosts.5.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-autoipd.action.8.xml: avahi-autoipd.action.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-avahi-autoipd.8.xml: avahi-autoipd.8.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
-
-bssh.1.xml: bssh.1.xml.in Makefile
- sed -e 's,@pkgsysconfdir\@,$(pkgsysconfdir),g' \
- -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
- -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
+ -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' $< > $@
if USE_XMLTOMAN
CLEANFILES += $(man_MANS)
-avahi-browse.1: avahi-browse.1.xml Makefile
- xmltoman $< > $@
-
-avahi-publish.1: avahi-publish.1.xml Makefile
- xmltoman $< > $@
-
-avahi-resolve.1: avahi-resolve.1.xml Makefile
- xmltoman $< > $@
-
-avahi-set-host-name.1: avahi-set-host-name.1.xml Makefile
- xmltoman $< > $@
-
-avahi-daemon.8: avahi-daemon.8.xml Makefile
- xmltoman $< > $@
-
-avahi-discover.1: avahi-discover.1.xml Makefile
- xmltoman $< > $@
-
-avahi-bookmarks.1: avahi-bookmarks.1.xml Makefile
- xmltoman $< > $@
-
-avahi-dnsconfd.8: avahi-dnsconfd.8.xml Makefile
- xmltoman $< > $@
-
-avahi-daemon.conf.5: avahi-daemon.conf.5.xml Makefile
- xmltoman $< > $@
-
-avahi-dnsconfd.action.8: avahi-dnsconfd.action.8.xml Makefile
- xmltoman $< > $@
-
-avahi.service.5: avahi.service.5.xml Makefile
- xmltoman $< > $@
-
-avahi.hosts.5: avahi.hosts.5.xml Makefile
- xmltoman $< > $@
-
-avahi-autoipd.action.8: avahi-autoipd.action.8.xml Makefile
- xmltoman $< > $@
+%.1: %.1.xml Makefile
+ $(AM_V_GEN)xmltoman $< > $@
-avahi-autoipd.8: avahi-autoipd.8.xml Makefile
- xmltoman $< > $@
+%.5: %.5.xml Makefile
+ $(AM_V_GEN)xmltoman $< > $@
-bssh.1: bssh.1.xml Makefile
- xmltoman $< > $@
+%.8: %.8.xml Makefile
+ $(AM_V_GEN)xmltoman $< > $@
xmllint: $(noinst_DATA)
for f in $(noinst_DATA) ; do \
diff --git a/man/avahi-autoipd.8.xml.in b/man/avahi-autoipd.8.xml.in
index 2e7bb67..477beb8 100644
--- a/man/avahi-autoipd.8.xml.in
+++ b/man/avahi-autoipd.8.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,7 +29,7 @@
<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
@@ -56,7 +54,7 @@
<p>See http://developer.apple.com/qa/qa2004/qa1357.html for more information.</p>
</description>
-
+
<options>
<option>
@@ -91,7 +89,7 @@
<option>
<p><opt>--no-drop-root</opt></p>
- <optdesc><p>Don't drop root priviliges after startup. We recommend not to use this option.</p></optdesc>
+ <optdesc><p>Don't drop root privileges after startup. We recommend not to use this option.</p></optdesc>
</option>
<option>
@@ -108,7 +106,7 @@
<p><opt>-w | --wait</opt></p>
<optdesc><p>Wait until a IP address has been sucessfully 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>
@@ -135,9 +133,9 @@
</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">
@@ -149,7 +147,7 @@
<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"/>
@@ -157,10 +155,10 @@
<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
index 1eb6750..9dea446 100644
--- a/man/avahi-autoipd.action.8.xml.in
+++ b/man/avahi-autoipd.action.8.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id: avahi-autoipd.action.8.xml.in 263 2005-08-07 19:53:39Z lennart $ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,7 +26,7 @@
<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
@@ -36,7 +34,7 @@
script should add or remove the specified address from the
specified network interface.</p>
</description>
-
+
<section name="Parameters">
<option>
@@ -70,16 +68,16 @@
<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
index 9bebd76..d863e2b 100644
--- a/man/avahi-bookmarks.1.xml.in
+++ b/man/avahi-bookmarks.1.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,7 +26,7 @@
<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
@@ -36,9 +34,9 @@
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>
@@ -69,11 +67,11 @@
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>
<option>
<p><opt>-h | --help</opt></p>
@@ -86,16 +84,16 @@
<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
index 90b2d35..b13d4fc 100644
--- a/man/avahi-browse.1.xml.in
+++ b/man/avahi-browse.1.xml.in
@@ -2,8 +2,6 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
@@ -93,7 +91,7 @@
<option>
<p><opt>-p | --parsable</opt></p>
- <optdesc><p>Make output easily parsable for usage in scripts. If enabled fields are seperated by semicolons (;), service names are escaped. It is recommended to combine this with <opt>--no-db-lookup</opt>.</p></optdesc>
+ <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>
diff --git a/man/avahi-daemon.8.xml.in b/man/avahi-daemon.8.xml.in
index b45e8c1..e93fc73 100644
--- a/man/avahi-daemon.8.xml.in
+++ b/man/avahi-daemon.8.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,7 +29,7 @@
<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
@@ -44,7 +42,7 @@
(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
@@ -53,7 +51,7 @@
<file>avahi-daemon.conf</file> the file
<file>/etc/resolv.conf</file> will be read, too.</p>
</description>
-
+
<options>
<option>
@@ -83,7 +81,7 @@
<option>
<p><opt>--no-drop-root</opt></p>
- <optdesc><p>Don't drop root priviliges after startup and don't require daemon to be started as root. We recommend not to use this option.</p></optdesc>
+ <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>
@@ -134,13 +132,13 @@
</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">
@@ -155,7 +153,7 @@
<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"/>
@@ -163,10 +161,10 @@
<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
index 08992fa..62f3a9d 100644
--- a/man/avahi-daemon.conf.5.xml.in
+++ b/man/avahi-daemon.conf.5.xml.in
@@ -2,8 +2,6 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
@@ -23,315 +21,343 @@
USA.
-->
- <manpage name="avahi-daemon.conf" section="5" desc="avahi-daemon configuration file">
-
- <synopsis>
- <cmd>@pkgsysconfdir@/avahi-daemon.conf</cmd>
- </synopsis>
-
- <description>
- <p><file>avahi-daemon.conf</file> is the configuration file for avahi-daemon.</p>
- </description>
-
- <section name="Section [Server]">
-
- <option>
- <p><opt>host-name=</opt> Set the host name avahi-daemon tries
- to register on the LAN. If omited defaults to the system host
- name as set with the sethostname() system call.</p>
- </option>
-
- <option>
- <p><opt>domain-name=</opt> Set the default domain name avahi-daemon
- tries to register its host name and services on the LAN in. If
- omitted defaults to ".local".</p>
- </option>
-
- <option>
- <p><opt>browse-domains=</opt> Set a comma seperated list of
- browsing domains (in addition to the default one and those
- announced inside the default browsing domain). Please note
- that the user may specify additional browsing domains on the
- client side, either by setting $AVAHI_BROWSE_DOMAINS to a list
- of colon seperated domains or by adding them to the XDG config
- file <file>~/.config/avahi/browse-domains</file> (seperated by
- newlines).</p>
-
- </option>
-
- <option>
- <p><opt>use-ipv4=</opt> Takes a boolean value ("yes" or
- "no"). If set to "no" avahi-daemon will not use IPv4
- sockets. Default is "yes".</p>
- </option>
-
- <option>
- <p><opt>use-ipv6=</opt> Takes a boolean value ("yes" or
- "no"). If set to "no" avahi-daemon will not use IPv6
- sockets. Default is "yes".</p>
- </option>
-
- <option>
- <p><opt>allow-interfaces=</opt> Set a comma seperated list of
- allowed network interfaces that should be used by the
- avahi-daemon. Other interfaces will be ignored. If set to the
- 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 seperated 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>deny-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>
-
- </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
- "yes."</p>
- </option>
-
- <option>
- <p><opt>publish-workstation=</opt> Takes a boolean value
- ("yes" or "no"). If set to "yes" avahi-daemon will register a
- service of type "_workstation._tcp" on the local LAN. This
- might be useful for administrative purposes (i.e. browse for
- all PCs on the LAN), but is not required or recommended by any
- specification. Newer MacOS X releases register a service of
- this type. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-domain=</opt> Takes a boolean value ("yes" or
- "no"). If set to "yes" avahi-daemon will announce the locally
- used domain name (see above) for browsing by other
- hosts. Defaults to "yes".</p>
- </option>
-
- <option>
- <p><opt>publish-dns-servers=</opt> Takes a comma seperated
- list of IP addresses for unicast DNS servers. You can use this
- to announce unicast DNS servers via mDNS. When used in
- conjunction with avahi-dnsconfd on the client
- side this allows DHCP-like configuration of unicast DNS
- servers.</p>
- </option>
-
- <option>
- <p><opt>publish-resolv-conf-dns-servers=</opt> Takes a boolean
- value ("yes" or "no"). If set to "yes" avahi-daemon will
- publish the unicast DNS servers specified in
- <file>/etc/resolv.conf</file> in addition to those specified
- with <opt>publish-dns-servers</opt>. Send avahi-daemon a
- SIGHUP to have it reload this file. Defaults to "no".</p>
- </option>
-
- <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>
+<manpage name="avahi-daemon.conf" section="5" desc="avahi-daemon configuration file">
+
+ <synopsis>
+ <cmd>@pkgsysconfdir@/avahi-daemon.conf</cmd>
+ </synopsis>
+
+ <description>
+ <p><file>avahi-daemon.conf</file> is the configuration file for avahi-daemon.</p>
+ </description>
+
+ <section name="Section [Server]">
+
+ <option>
+ <p><opt>host-name=</opt> Set the host name avahi-daemon tries
+ to register on the LAN. If omited defaults to the system host
+ name as set with the sethostname() system call.</p>
+ </option>
+
+ <option>
+ <p><opt>domain-name=</opt> Set the default domain name avahi-daemon
+ tries to register its host name and services on the LAN in. If
+ omitted defaults to ".local".</p>
+ </option>
+
+ <option>
+ <p><opt>browse-domains=</opt> Set a comma 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 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 at a time. If the maximum number is reached further
+ resource records may not be added to an entry group.</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
+ "yes."</p>
+ </option>
+
+ <option>
+ <p><opt>publish-workstation=</opt> Takes a boolean value
+ ("yes" or "no"). If set to "yes" avahi-daemon will register a
+ service of type "_workstation._tcp" on the local LAN. This
+ might be useful for administrative purposes (i.e. browse for
+ all PCs on the LAN), but is not required or recommended by any
+ specification. Newer MacOS X releases register a service of
+ this type. Defaults to "yes".</p>
+ </option>
+
+ <option>
+ <p><opt>publish-domain=</opt> Takes a boolean value ("yes" or
+ "no"). If set to "yes" avahi-daemon will announce the locally
+ used domain name (see above) for browsing by other
+ hosts. Defaults to "yes".</p>
+ </option>
+
+ <option>
+ <p><opt>publish-dns-servers=</opt> Takes a comma 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
index 5d4f878..e311f1f 100644
--- a/man/avahi-discover.1.xml.in
+++ b/man/avahi-discover.1.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,34 +26,34 @@
<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
index c74e1ba..e01ab44 100644
--- a/man/avahi-dnsconfd.8.xml.in
+++ b/man/avahi-dnsconfd.8.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,7 +29,7 @@
<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
@@ -39,7 +37,7 @@
configuring unicast DNS servers in a DHCP-like fashion with
mDNS.</p>
</description>
-
+
<options>
<option>
@@ -47,6 +45,11 @@
<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>
@@ -75,9 +78,9 @@
</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">
@@ -89,16 +92,16 @@
<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
index 6811422..f4ae37e 100644
--- a/man/avahi-dnsconfd.action.8.xml.in
+++ b/man/avahi-dnsconfd.action.8.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,7 +26,7 @@
<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
@@ -36,7 +34,7 @@
with avahi patches <file>/etc/resolv.conf</file> to reflect the
changed unicast DNS server configuration.</p>
</description>
-
+
<section name="Parameters">
<option>
@@ -61,7 +59,7 @@
<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
@@ -71,22 +69,22 @@
DNS server that avahi-dnsconfd found on all interfaces,
separated by spaces.</p></option>
- </section>
+ </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
index 5ab476a..bb8dbda 100644
--- a/man/avahi-publish.1.xml.in
+++ b/man/avahi-publish.1.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,11 +29,11 @@
<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
@@ -45,7 +43,7 @@
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>
@@ -102,12 +100,12 @@
</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
@@ -115,10 +113,10 @@
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
index 3f9bbc6..e444cb9 100644
--- a/man/avahi-resolve.1.xml.in
+++ b/man/avahi-resolve.1.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -31,13 +29,13 @@
<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
@@ -90,18 +88,18 @@
<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-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
index a49db10..407bbe7 100644
--- a/man/avahi-set-host-name.1.xml.in
+++ b/man/avahi-set-host-name.1.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,15 +26,15 @@
<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>
@@ -60,16 +58,16 @@
<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
index 5a92547..eff2848 100644
--- a/man/avahi.hosts.5.xml.in
+++ b/man/avahi.hosts.5.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,7 +26,7 @@
<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
@@ -46,17 +44,17 @@
<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
index 0005903..6598617 100644
--- a/man/avahi.service.5.xml.in
+++ b/man/avahi.service.5.xml.in
@@ -2,21 +2,19 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
-
+
avahi is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
-
+
avahi is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with avahi; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
@@ -28,16 +26,16 @@
<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
@@ -108,17 +106,17 @@
<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
index 2a3fdcf..6df640d 100644
--- a/man/bssh.1.xml.in
+++ b/man/bssh.1.xml.in
@@ -2,8 +2,6 @@
<!DOCTYPE manpage SYSTEM "xmltoman.dtd">
<?xml-stylesheet type="text/xsl" href="xmltoman.xsl" ?>
-<!-- $Id$ -->
-
<!--
This file is part of avahi.
diff --git a/man/xmltoman.css b/man/xmltoman.css
index 4c80847..6b3235b 100644
--- a/man/xmltoman.css
+++ b/man/xmltoman.css
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.
diff --git a/man/xmltoman.dtd b/man/xmltoman.dtd
index 50158dc..968dd5f 100644
--- a/man/xmltoman.dtd
+++ b/man/xmltoman.dtd
@@ -1,6 +1,4 @@
-<!-- $Id$ -->
-
-<!--
+<!--
This file is part of avahi.
avahi is free software; you can redistribute it and/or modify it under
@@ -15,7 +13,7 @@
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.
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-->
<!ELEMENT manpage (synopsis | description | section | options | seealso)*>
diff --git a/man/xmltoman.xsl b/man/xmltoman.xsl
index 96c9d81..1a344c2 100644
--- a/man/xmltoman.xsl
+++ b/man/xmltoman.xsl
@@ -19,8 +19,6 @@
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-->
-<!-- $Id$ -->
-
<xsl:output method="xml" version="1.0" encoding="iso-8859-15" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes"/>
<xsl:template match="/manpage">
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f3e48de..9e9a0cc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,6 @@
# List of source files which contain translatable strings.
avahi-common/error.c
-avahi-discover-standalone/avahi-discover.glade
+[type: gettext/glade]avahi-discover-standalone/avahi-discover.ui
avahi-python/avahi-discover/avahi-discover.desktop.in.in
avahi-ui/avahi-ui.c
avahi-ui/bssh.c
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 90541bb..ce6337d 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,4 +1,3 @@
-avahi-discover-standalone/avahi-discover.glade
avahi-ui/bssh.desktop.in
avahi-ui/bvnc.desktop.in
tests/c-plus-plus-test-gen.py
diff --git a/service-type-database/Makefile.am b/service-type-database/Makefile.am
index 60fda45..fa1bd40 100644
--- a/service-type-database/Makefile.am
+++ b/service-type-database/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
@@ -29,12 +27,12 @@ noinst_SCRIPTS=build-db
pkglib_DATA+=service-types.db
build-db: build-db.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,gdbm,g' $< > $@
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,gdbm,g' $< > $@ && \
chmod +x $@
service-types.db: service-types build-db
- $(PYTHON) build-db $< $@.coming
+ $(AM_V_GEN)$(PYTHON) build-db $< $@.coming && \
mv $@.coming $@
CLEANFILES = service-types.db build-db
@@ -46,16 +44,16 @@ noinst_SCRIPTS=build-db
pkglib_DATA+=service-types.db.pag service-types.db.dir
build-db: build-db.in
- sed -e 's,@PYTHON\@,$(PYTHON),g' \
- -e 's,@DBM\@,dbm,g' $< > $@
+ $(AM_V_GEN)sed -e 's,@PYTHON\@,$(PYTHON),g' \
+ -e 's,@DBM\@,dbm,g' $< > $@ && \
chmod +x $@
service-types.db.pag: service-types.db
- mv service-types.db.coming.pag service-types.db.pag
+ $(AM_V_GEN)mv service-types.db.coming.pag service-types.db.pag
service-types.db.dir: service-types.db
- mv service-types.db.coming.dir service-types.db.dir
+ $(AM_V_GEN)mv service-types.db.coming.dir service-types.db.dir
service-types.db: service-types build-db
- $(PYTHON) build-db $< $@.coming
+ $(AM_V_GEN)$(PYTHON) build-db $< $@.coming && \
if test -f "$@.coming"; then mv $@.coming $@; fi
CLEANFILES = service-types.db* build-db
diff --git a/service-type-database/build-db.in b/service-type-database/build-db.in
index 44f6068..4cda425 100755
--- a/service-type-database/build-db.in
+++ b/service-type-database/build-db.in
@@ -1,7 +1,5 @@
#!@PYTHON@
# -*-python-*-
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
diff --git a/service-type-database/service-types b/service-type-database/service-types
index 97e6858..0e9d7cc 100644
--- a/service-type-database/service-types
+++ b/service-type-database/service-types
@@ -1,5 +1,3 @@
-# $Id$
-
# This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
@@ -22,7 +20,7 @@
# available database unless its license is known and compatible with
# our project! The database available on
#
-# http://www.dns-sd.org/ServiceTypes.html
+# http://www.dns-sd.org/ServiceTypes.html
#
# is not a source that complies with the criterion!
@@ -86,6 +84,10 @@ _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
@@ -94,7 +96,7 @@ _ssh._tcp[de]:SSH-Fernzugriff
_ssh._tcp[it]:SSH Terminale remoto
_rfb._tcp:VNC Remote Access
-_rfb._tcp[it]:Controllo remoto VNC
+_rfb._tcp[it]:Controllo remoto VNC
_telnet._tcp:Telnet Remote Terminal
_telnet._tcp[it]:Telnet Terminale Remoto
@@ -103,6 +105,7 @@ _timbuktu._tcp:Timbuktu Remote Desktop Control
_net-assistant._udp:Apple Net Assistant
+_udisks-ssh._tcp:Remote Disk Management
# Mail
@@ -149,6 +152,8 @@ _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
@@ -192,6 +197,8 @@ _distcc._tcp:Distributed Compiler
_distcc._tcp[de]:Verteilter Compiler
_distcc._tcp[it]:Compilatore Distribuito
+_bzr._tcp:Bazaar
+
# Vendor specific
@@ -205,6 +212,8 @@ _acrobatSRV._tcp:Adobe Acrobat
_adobe-vc._tcp:Adobe Version Cue
+_home-sharing._tcp:Apple Home Sharing
+
# Other
@@ -216,3 +225,7 @@ _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/tests/Makefile.am b/tests/Makefile.am
index c91cea4..e28b0b7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,5 @@
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it 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
diff --git a/tests/c-plus-plus-test-gen.py b/tests/c-plus-plus-test-gen.py
index 46d6762..a2836f0 100755
--- a/tests/c-plus-plus-test-gen.py
+++ b/tests/c-plus-plus-test-gen.py
@@ -1,9 +1,7 @@
#!/usr/bin/python
-# $Id$
-#
# This file is part of avahi.
-#
+#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
@@ -31,21 +29,19 @@ def print_includes(dir):
print "#include <%s/%s>" % (dir, f)
-print """/* $Id$ */
-
-/***
+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
diff --git a/tests/c-plus-plus-test.cc b/tests/c-plus-plus-test.cc
index 947aa44..ad7a529 100644
--- a/tests/c-plus-plus-test.cc
+++ b/tests/c-plus-plus-test.cc
@@ -1,5 +1,3 @@
-/* $Id$ */
-
/***
This file is part of avahi.