annotate lisp/net/zeroconf.el @ 109294:6e3815c69ab4

* net/zeroconf.el (zeroconf-resolve-service) (zeroconf-service-resolver-handler): Use `dbus-byte-array-to-string'. (zeroconf-publish-service): Use `dbus-string-to-byte-array'.
author Michael Albinus <albinus@detlef>
date Sat, 03 Jul 2010 13:12:53 +0200
parents 1cedbb610cc1
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
1 ;;; zeroconf.el --- Service browser using Avahi.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105170
diff changeset
3 ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
4
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
5 ;; Author: Michael Albinus <michael.albinus@gmx.de>
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
6 ;; Keywords: comm, hardware
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
7
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
9
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94624
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94624
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94624
diff changeset
13 ;; (at your option) any later version.
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
14
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
18 ;; GNU General Public License for more details.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
19
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94624
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
22
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
23 ;;; Commentary:
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
24
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
25 ;; This package provides an interface to the Avahi, the zeroconf
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
26 ;; daemon under GNU/Linux. The communication mean with Avahi is
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
27 ;; D-Bus.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
28
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
29 ;; In order to activate this package, you must add the following code
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
30 ;; into your .emacs:
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
31
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
32 ;; (require 'zeroconf)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
33 ;; (zeroconf-init "dns-sd.org")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
34
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
35 ;; "dns-sd.org" is an example the domain you wish to resolve services
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
36 ;; for. It can also be nil or "", which means the default local
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
37 ;; domain "local".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
38
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
39 ;; The `zeroconf-init' function installs several handlers, which are
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
40 ;; activated by D-Bus signals sent from the Avahi daemon.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
41 ;; Immediately, when a service is added or removed in the domain, a
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
42 ;; corresponding handler in Emacs is called.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
43
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
44 ;; Service Discovery
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
45 ;; -----------------
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
46
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
47 ;; The main purpose of zeroconf is service discovery. This means,
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
48 ;; that services are detected as soon as they appear or disappear in a
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
49 ;; given domain. A service is offered by a network device. It is
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
50 ;; assigned to a service type.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
51
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
52 ;; In order to see all offered service types of the initialized
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
53 ;; domain, you can call
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
54
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
55 ;; (zeroconf-list-service-types)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
56
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
57 ;; Service types are described at <http://www.dns-sd.org/ServiceTypes.html>.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
58 ;; Detected services for a given service type, let's say "_ipp._tcp",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
59 ;; are listed by
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
60
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
61 ;; (zeroconf-list-services "_ipp._tcp")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
62
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
63 ;; It is possible to register an own handler (function) to be called
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
64 ;; when a service has been added or removed in the domain. The
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
65 ;; service type "_ipp._tcp" is used for printer services supporting
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
66 ;; the Internet Printing Protocol.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
67
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
68 ;; (defun my-add-printer (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
69 ;; (message "Printer `%s' detected" (zeroconf-service-name service)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
70
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
71 ;; (defun my-remove-printer (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
72 ;; (message "Printer `%s' removed" (zeroconf-service-name service)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
73
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
74 ;; (zeroconf-service-add-hook "_ipp._tcp" :new 'my-add-printer)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
75 ;; (zeroconf-service-add-hook "_ipp._tcp" :removed 'my-remove-printer)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
76
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
77 ;; There are several functions returning information about a service,
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
78 ;; see the doc string of `zeroconf-service-add-hook'.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
79
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
80 ;; Service Publishing
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
81 ;; ------------------
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
82
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
83 ;; The function `zeroconf-publish-service' publishes a new service to
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
84 ;; the Avahi daemon. Although the domain, where to the service is
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
85 ;; published, can be specified by this function, it is usally the
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
86 ;; default domain "local" (also written as nil or "").
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
87
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
88 ;; (zeroconf-publish-service
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
89 ;; "Example service" ;; Service name.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
90 ;; "_example._tcp" ;; Service type.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
91 ;; nil ;; Default domain ("local").
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
92 ;; nil ;; Default host (concat (getenv "HOST") ".local").
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
93 ;; 111 ;; Port number of the host, the service is offered.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
94 ;; "1.2.3.4" ;; IPv4 address of the host.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
95 ;; '("version=1.0" ;; TXT fields describing the service.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
96 ;; "abc=456"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
97
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
98 ;; The lifetime of a published service is the lifetime of Emacs.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
99
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
100 ;;; Code:
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
101
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
102 ;; Pacify byte-compiler. D-Bus support in the Emacs core can be
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
103 ;; disabled with configuration option "--without-dbus". Declare used
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
104 ;; subroutines and variables of `dbus' therefore.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
105 (eval-when-compile
94624
c199ac3029ed (dbus-call-method, dbus-register-signal)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94144
diff changeset
106 (require 'cl))
c199ac3029ed (dbus-call-method, dbus-register-signal)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94144
diff changeset
107
c199ac3029ed (dbus-call-method, dbus-register-signal)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94144
diff changeset
108 (declare-function dbus-call-method "dbusbind.c")
c199ac3029ed (dbus-call-method, dbus-register-signal)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94144
diff changeset
109 (declare-function dbus-register-signal "dbusbind.c")
c199ac3029ed (dbus-call-method, dbus-register-signal)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94144
diff changeset
110 (defvar dbus-debug)
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
111
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
112 (require 'dbus)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
113
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
114 (defvar zeroconf-debug nil
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
115 "Write messages during service discovery")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
116
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
117 (defconst zeroconf-service-avahi "org.freedesktop.Avahi"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
118 "The D-Bus name used to talk to Avahi.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
119
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
120 (defconst zeroconf-path-avahi "/"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
121 "The D-Bus root object path used to talk to Avahi.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
122
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
123 (defvar zeroconf-path-avahi-service-type-browser nil
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
124 "The D-Bus object path used to talk to the Avahi service type browser.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
125
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
126 (defvar zeroconf-path-avahi-service-browser-hash (make-hash-table :test 'equal)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
127 "The D-Bus object paths used to talk to the Avahi service browser.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
128
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
129 (defvar zeroconf-path-avahi-service-resolver-hash (make-hash-table :test 'equal)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
130 "The D-Bus object paths used to talk to the Avahi service resolver.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
131
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
132 ;; Methods: "Free", "Commit", "Reset", "GetState", "IsEmpty",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
133 ;; "AddService", "AddServiceSubtype", "UpdateServiceTxt", "AddAddress"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
134 ;; and "AddRecord".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
135 ;; Signals: "StateChanged".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
136 (defconst zeroconf-interface-avahi-entry-group
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
137 (concat zeroconf-service-avahi ".EntryGroup")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
138 "The D-Bus entry group interface exported by Avahi.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
139
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
140 ;; Methods: "GetVersionString", "GetAPIVersion", "GetHostName",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
141 ;; "SetHostName", "GetHostNameFqdn", "GetDomainName",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
142 ;; "IsNSSSupportAvailable", "GetState", "GetLocalServiceCookie",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
143 ;; "GetAlternativeHostName", "GetAlternativeServiceName",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
144 ;; "GetNetworkInterfaceNameByIndex", "GetNetworkInterfaceIndexByName",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
145 ;; "ResolveHostName", "ResolveAddress", "ResolveService",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
146 ;; "EntryGroupNew", "DomainBrowserNew", "ServiceTypeBrowserNew",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
147 ;; "ServiceBrowserNew", "ServiceResolverNew", "HostNameResolverNew",
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
148 ;; "AddressResolverNew" and "RecordBrowserNew".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
149 ;; Signals: "StateChanged".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
150 (defconst zeroconf-interface-avahi-server
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
151 (concat zeroconf-service-avahi ".Server")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
152 "The D-Bus server interface exported by Avahi.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
153
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
154 ;; Methods: "Free".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
155 ;; Signals: "ItemNew", "ItemRemove", "CacheExhausted", "AllForNow" and
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
156 ;; "Failure".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
157 (defconst zeroconf-interface-avahi-service-type-browser
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
158 (concat zeroconf-service-avahi ".ServiceTypeBrowser")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
159 "The D-Bus service type browser interface exported by Avahi.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
160
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
161 ;; Methods: "Free".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
162 ;; Signals: "ItemNew", "ItemRemove", "CacheExhausted", "AllForNow" and
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
163 ;; "Failure".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
164 (defconst zeroconf-interface-avahi-service-browser
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
165 (concat zeroconf-service-avahi ".ServiceBrowser")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
166 "The D-Bus service browser interface exported by Avahi.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
167
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
168 ;; Methods: "Free".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
169 ;; Available signals are "Found" and "Failure".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
170 (defconst zeroconf-interface-avahi-service-resolver
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
171 (concat zeroconf-service-avahi ".ServiceResolver")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
172 "The D-Bus service resolver interface exported by Avahi.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
173
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
174 (defconst zeroconf-avahi-interface-unspec -1
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
175 "Wildcard Avahi interface spec.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
176
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
177 (defconst zeroconf-avahi-protocol-unspec -1
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
178 "Wildcard Avahi protocol spec.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
179
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
180 (defconst zeroconf-avahi-protocol-inet4 0
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
181 "Avahi INET4 address protocol family.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
182
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
183 (defconst zeroconf-avahi-protocol-inet6 1
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
184 "Avahi INET6 address protocol family.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
185
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
186 (defconst zeroconf-avahi-domain-unspec ""
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
187 "Empty Avahi domain.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
188
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
189 (defvar zeroconf-avahi-current-domain zeroconf-avahi-domain-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
190 "Domain name services are resolved for.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
191
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
192 (defconst zeroconf-avahi-flags-unspec 0
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
193 "No Avahi flags.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
194
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
195
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
196 ;;; Services retrieval.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
197
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
198 (defvar zeroconf-services-hash (make-hash-table :test 'equal)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
199 "Hash table of discovered Avahi services.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
200
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
201 The key of an entry is the concatenation of the service name and
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
202 service type of a discovered service. The value is the service
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
203 itself. The format of a service is
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
204
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
205 \(INTERFACE PROTOCOL NAME TYPE DOMAIN FLAGS\)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
206
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
207 The INTERFACE is a number, which represents the network interface
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
208 the service is located at. The corresponding network interface
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
209 name, like \"eth0\", can be retrieved with the function
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
210 `zeroconf-get-interface-name'.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
211
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
212 PROTOCOL describes the used network protocol family the service
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
213 can be accessed. `zeroconf-avahi-protocol-inet4' means INET4,
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
214 `zeroconf-avahi-protocol-inet6' means INET6. An unspecified
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
215 protocol family is coded with `zeroconf-avahi-protocol-unspec'.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
216
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
217 NAME is the string the service is known at Avahi. A service can
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
218 be known under the same name for different service types.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
219
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
220 Each TYPE stands for a discovered service type of Avahi. The
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
221 format is described in RFC 2782. It is of the form
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
222
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
223 \"_APPLICATION-PROTOCOL._TRANSPORT-PROTOCOL\".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
224
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
225 TRANSPORT-PROTOCOL must be either \"tcp\" or \"udp\".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
226 APPLICATION-PROTOCOL must be a protocol name as specified in URL
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
227 `http://www.dns-sd.org/ServiceTypes.html'. Typical service types
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
228 are \"_workstation._tcp\" or \"_printer._tcp\".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
229
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
230 DOMAIN is the domain name the service is registered in, like \"local\".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
231
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
232 FLAGS, an integer, is used inside Avahi. When publishing a
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
233 service (see `zeroconf-publish-service', the flag 0 is used.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
234
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
235 (defvar zeroconf-resolved-services-hash (make-hash-table :test 'equal)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
236 "Hash table of resolved Avahi services.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
237 The key of an entry is the concatenation of the service name and
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
238 service type of a resolved service. The value is the service
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
239 itself. The format of a service is
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
240
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
241 \(INTERFACE PROTOCOL NAME TYPE DOMAIN HOST APROTOCOL ADDRESS PORT TXT FLAGS\)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
242
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
243 INTERFACE, PROTOCOL, NAME, TYPE, DOMAIN and FLAGS have the same
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
244 meaning as in `zeroconf-services-hash'.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
245
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
246 HOST is the host name the service is registered. It is a fully
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
247 qualified name, i.e., it contains DOMAIN.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
248
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
249 APROTOCOL stands for the network protocol family ADDRESS is
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
250 encoded (`zeroconf-avahi-protocol-inet4' means INET4,
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
251 `zeroconf-avahi-protocol-inet6' means INET6). It can be
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
252 different from PROTOCOL, when an adrress resolution has been
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
253 requested for another protocol family but the default one.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
254
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
255 ADDRESS is the service address, encoded according to the
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
256 APROTOCOL network protocol family. PORT is the corresponding
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
257 port the service can be reached on ADDRESS.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
258
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
259 TXT is an array of strings, describing additional attributes of
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
260 the service. Usually, every string is a key=value pair. The
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
261 supported keys depend on the service type.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
262
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
263 (defun zeroconf-list-service-names ()
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
264 "Returns all discovered Avahi service names as list."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
265 (let (result)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
266 (maphash
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
267 (lambda (key value) (add-to-list 'result (zeroconf-service-name value)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
268 zeroconf-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
269 result))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
270
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
271 (defun zeroconf-list-service-types ()
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
272 "Returns all discovered Avahi service types as list."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
273 (let (result)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
274 (maphash
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
275 (lambda (key value) (add-to-list 'result (zeroconf-service-type value)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
276 zeroconf-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
277 result))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
278
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
279 (defun zeroconf-list-services (type)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
280 "Returns all discovered Avahi services for a given service type TYPE.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
281 The service type is one of the returned values of
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
282 `zeroconf-list-service-types'. The return value is a list
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
283 \(SERVICE1 SERVICE2 ...\). See `zeroconf-services-hash' for the
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
284 format of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
285 (let (result)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
286 (maphash
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
287 (lambda (key value)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
288 (when (equal type (zeroconf-service-type value))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
289 (add-to-list 'result value)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
290 zeroconf-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
291 result))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
292
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
293 (defvar zeroconf-service-added-hooks-hash (make-hash-table :test 'equal)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
294 "Hash table of hooks for newly added services.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
295 The key of an entry is a service type.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
296
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
297 (defvar zeroconf-service-removed-hooks-hash (make-hash-table :test 'equal)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
298 "Hash table of hooks for removed services.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
299 The key of an entry is a service type.")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
300
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
301 (defun zeroconf-service-add-hook (type event function)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
302 "Add FUNCTION to the hook of service type TYPE.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
303
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
304 EVENT must be either :new or :removed, indicating whether
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
305 FUNCTION shall be called when a new service has been newly
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
306 detected, or removed.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
307
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
308 FUNCTION must accept one argument SERVICE, which identifies the
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
309 new service. Initially, when EVENT is :new, FUNCTION is called
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
310 for all already detected services of service type TYPE.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
311
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
312 The attributes of SERVICE can be retrieved via the functions
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
313
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
314 `zeroconf-service-interface'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
315 `zeroconf-service-protocol'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
316 `zeroconf-service-name'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
317 `zeroconf-service-type'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
318 `zeroconf-service-domain'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
319 `zeroconf-service-flags'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
320 `zeroconf-service-host'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
321 `zeroconf-service-aprotocol'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
322 `zeroconf-service-address'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
323 `zeroconf-service-port'
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
324 `zeroconf-service-txt'"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
325
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
326 (cond
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
327 ((equal event :new)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
328 (let ((l-hook (gethash type zeroconf-service-added-hooks-hash nil)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
329 (add-hook 'l-hook function)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
330 (puthash type l-hook zeroconf-service-added-hooks-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
331 (dolist (service (zeroconf-list-services type))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
332 (funcall function service))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
333 ((equal event :removed)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
334 (let ((l-hook (gethash type zeroconf-service-removed-hooks-hash nil)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
335 (add-hook 'l-hook function)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
336 (puthash type l-hook zeroconf-service-removed-hooks-hash)))
105170
f8ba8d6fd250 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 104062
diff changeset
337 (t (error "EVENT must be either `:new' or `:removed'"))))
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
338
109293
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
339 (defun zeroconf-service-remove-hook (type event function)
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
340 "Remove FUNCTION from the hook of service type TYPE.
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
341
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
342 EVENT must be either :new or :removed and has to match the event
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
343 type used when registering FUNCTION."
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
344 (let* ((table (cond
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
345 ((equal event :new)
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
346 zeroconf-service-added-hooks-hash)
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
347 ((equal event :removed)
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
348 zeroconf-service-removed-hooks-hash)
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
349 (t (error "EVENT must be either `:new' or `:removed'"))))
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
350 (l-hook (gethash type table nil)))
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
351 (remove-hook 'l-hook function)
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
352 (if l-hook
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
353 (puthash type l-hook table)
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
354 (remhash type table))))
1cedbb610cc1 * net/zeroconf.el (zeroconf-service-remove-hook): New defun.
Michael Albinus <albinus@detlef>
parents: 106815
diff changeset
355
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
356 (defun zeroconf-get-host ()
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
357 "Returns the local host name as string."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
358 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
359 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
360 zeroconf-interface-avahi-server "GetHostName"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
361
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
362 (defun zeroconf-get-domain ()
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
363 "Returns the domain name as string."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
364 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
365 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
366 zeroconf-interface-avahi-server "GetDomainName"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
367
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
368 (defun zeroconf-get-host-domain ()
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
369 "Returns the local host name FQDN as string."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
370 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
371 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
372 zeroconf-interface-avahi-server "GetHostNameFqdn"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
373
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
374 (defun zeroconf-get-interface-name (number)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
375 "Return the interface name of internal interface NUMBER."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
376 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
377 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
378 zeroconf-interface-avahi-server "GetNetworkInterfaceNameByIndex"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
379 :int32 number))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
380
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
381 (defun zeroconf-get-interface-number (name)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
382 "Return the internal interface number of interface NAME."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
383 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
384 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
385 zeroconf-interface-avahi-server "GetNetworkInterfaceIndexByName"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
386 name))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
387
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
388 (defun zeroconf-get-service (name type)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
389 "Return the service description of service NAME as list.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
390 NAME must be a string. The service must be of service type
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
391 TYPE. The resulting list has the format
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
392
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
393 \(INTERFACE PROTOCOL NAME TYPE DOMAIN FLAGS\)."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
394 ;; Due to the service browser, all known services are kept in
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
395 ;; `zeroconf-services-hash'.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
396 (gethash (concat name "/" type) zeroconf-services-hash nil))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
397
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
398 (defun zeroconf-resolve-service (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
399 "Return all service attributes SERVICE as list.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
400 NAME must be a string. The service must be of service type
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
401 TYPE. The resulting list has the format
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
402
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
403 \(INTERFACE PROTOCOL NAME TYPE DOMAIN HOST APROTOCOL ADDRESS PORT TXT FLAGS\)."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
404 (let* ((name (zeroconf-service-name service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
405 (type (zeroconf-service-type service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
406 (key (concat name "/" type)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
407
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
408 (or
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
409 ;; Check whether we know this service already.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
410 (gethash key zeroconf-resolved-services-hash nil)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
411
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
412 ;; Resolve the service. We don't propagate D-Bus errors.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
413 (dbus-ignore-errors
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
414 (let* ((result
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
415 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
416 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
417 zeroconf-interface-avahi-server "ResolveService"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
418 zeroconf-avahi-interface-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
419 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
420 name type
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
421 zeroconf-avahi-current-domain
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
422 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
423 zeroconf-avahi-flags-unspec))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
424 (elt (nth 9 result))) ;; TXT.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
425 ;; The TXT field has the signature "aay". Transform to "as".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
426 (while elt
109294
6e3815c69ab4 * net/zeroconf.el (zeroconf-resolve-service)
Michael Albinus <albinus@detlef>
parents: 109293
diff changeset
427 (setcar elt (dbus-byte-array-to-string (car elt)))
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
428 (setq elt (cdr elt)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
429
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
430 (when nil ;; We discard it, no use so far.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
431 ;; Register a service resolver.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
432 (let ((object-path (zeroconf-register-service-resolver name type)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
433 ;; Register the signals.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
434 (dolist (member '("Found" "Failure"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
435 (dbus-register-signal
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
436 :system zeroconf-service-avahi object-path
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
437 zeroconf-interface-avahi-service-resolver member
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
438 'zeroconf-service-resolver-handler)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
439 )
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
440
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
441 ;; Return the resolved service.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
442 (puthash key result zeroconf-resolved-services-hash))))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
443
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
444 (defun zeroconf-service-interface (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
445 "Return the internal interface number of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
446 (nth 0 service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
447
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
448 (defun zeroconf-service-protocol (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
449 "Return the protocol number of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
450 (nth 1 service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
451
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
452 (defun zeroconf-service-name (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
453 "Return the service name of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
454 (nth 2 service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
455
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
456 (defun zeroconf-service-type (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
457 "Return the type name of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
458 (nth 3 service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
459
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
460 (defun zeroconf-service-domain (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
461 "Return the domain name of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
462 (nth 4 service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
463
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
464 (defun zeroconf-service-flags (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
465 "Return the flags of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
466 (nth 5 service))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
467
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
468 (defun zeroconf-service-host (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
469 "Return the host name of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
470 (nth 5 (zeroconf-resolve-service service)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
471
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
472 (defun zeroconf-service-aprotocol (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
473 "Return the aprotocol number of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
474 (nth 6 (zeroconf-resolve-service service)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
475
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
476 (defun zeroconf-service-address (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
477 "Return the IP address of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
478 (nth 7 (zeroconf-resolve-service service)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
479
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
480 (defun zeroconf-service-port (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
481 "Return the port number of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
482 (nth 8 (zeroconf-resolve-service service)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
483
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
484 (defun zeroconf-service-txt (service)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
485 "Return the text strings of SERVICE."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
486 (nth 9 (zeroconf-resolve-service service)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
487
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
488
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
489 ;;; Services signalling.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
490
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
491 ;; Register for the service type browser. Service registrations will
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
492 ;; happen in `zeroconf-service-type-browser-handler', when there is an
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
493 ;; "ItemNew" signal from the service type browser.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
494 (defun zeroconf-init (&optional domain)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
495 "Instantiate an Avahi service type browser for domain DOMAIN.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
496 DOMAIN is a string, like \"dns-sd.org\" or \"local\". When
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
497 DOMAIN is nil, the local domain is used."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
498 (when (and (or (null domain) (stringp domain))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
499 (dbus-ping :system zeroconf-service-avahi)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
500 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
501 :system zeroconf-service-avahi zeroconf-path-avahi
104062
e29040dd9586 * net/zeroconf.el (zeroconf-init): Check for "GetVersionString"
Michael Albinus <michael.albinus@gmx.de>
parents: 100908
diff changeset
502 zeroconf-interface-avahi-server "GetVersionString"))
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
503
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
504 ;; Reset all stored values.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
505 (setq zeroconf-path-avahi-service-type-browser nil
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
506 zeroconf-avahi-current-domain (or domain
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
507 zeroconf-avahi-domain-unspec))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
508 (clrhash zeroconf-path-avahi-service-browser-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
509 (clrhash zeroconf-path-avahi-service-resolver-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
510 (clrhash zeroconf-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
511 (clrhash zeroconf-resolved-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
512 (clrhash zeroconf-service-added-hooks-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
513 (clrhash zeroconf-service-removed-hooks-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
514
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
515 ;; Register a service type browser.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
516 (let ((object-path (zeroconf-register-service-type-browser)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
517 ;; Register the signals.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
518 (dolist (member '("ItemNew" "ItemRemove" "Failure"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
519 (dbus-register-signal
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
520 :system zeroconf-service-avahi object-path
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
521 zeroconf-interface-avahi-service-type-browser member
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
522 'zeroconf-service-type-browser-handler)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
523
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
524 ;; Register state changed signal.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
525 (dbus-register-signal
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
526 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
527 zeroconf-interface-avahi-service-type-browser "StateChanged"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
528 'zeroconf-service-type-browser-handler)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
529
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
530 (defun zeroconf-register-service-type-browser ()
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
531 "Register a service type browser at the Avahi daemon."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
532 (or zeroconf-path-avahi-service-type-browser
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
533 (setq zeroconf-path-avahi-service-type-browser
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
534 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
535 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
536 zeroconf-interface-avahi-server "ServiceTypeBrowserNew"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
537 zeroconf-avahi-interface-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
538 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
539 zeroconf-avahi-current-domain
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
540 zeroconf-avahi-flags-unspec))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
541
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
542 (defun zeroconf-service-type-browser-handler (&rest val)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
543 "Registered service type browser handler at the Avahi daemon."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
544 (when zeroconf-debug
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
545 (message "zeroconf-service-type-browser-handler: %s %S"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
546 (dbus-event-member-name last-input-event) val))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
547 (cond
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
548 ((string-equal (dbus-event-member-name last-input-event) "ItemNew")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
549 ;; Parameters: (interface protocol type domain flags)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
550 ;; Register a service browser.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
551 (let ((object-path (zeroconf-register-service-browser (nth-value 2 val))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
552 ;; Register the signals.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
553 (dolist (member '("ItemNew" "ItemRemove" "Failure"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
554 (dbus-register-signal
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
555 :system zeroconf-service-avahi object-path
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
556 zeroconf-interface-avahi-service-browser member
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
557 'zeroconf-service-browser-handler))))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
558
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
559 (defun zeroconf-register-service-browser (type)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
560 "Register a service browser at the Avahi daemon."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
561 (or (gethash type zeroconf-path-avahi-service-browser-hash nil)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
562 (puthash type
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
563 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
564 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
565 zeroconf-interface-avahi-server "ServiceBrowserNew"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
566 zeroconf-avahi-interface-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
567 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
568 type
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
569 zeroconf-avahi-current-domain
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
570 zeroconf-avahi-flags-unspec)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
571 zeroconf-path-avahi-service-browser-hash)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
572
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
573 (defun zeroconf-service-browser-handler (&rest val)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
574 "Registered service browser handler at the Avahi daemon."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
575 ;; Parameters: (interface protocol name type domain flags)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
576 (when zeroconf-debug
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
577 (message "zeroconf-service-browser-handler: %s %S"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
578 (dbus-event-member-name last-input-event) val))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
579 (let* ((name (zeroconf-service-name val))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
580 (type (zeroconf-service-type val))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
581 (key (concat name "/" type))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
582 (ahook (gethash type zeroconf-service-added-hooks-hash nil))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
583 (rhook (gethash type zeroconf-service-removed-hooks-hash nil)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
584 (cond
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
585 ((string-equal (dbus-event-member-name last-input-event) "ItemNew")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
586 ;; Add new service.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
587 (puthash key val zeroconf-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
588 (run-hook-with-args 'ahook val))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
589
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
590 ((string-equal (dbus-event-member-name last-input-event) "ItemRemove")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
591 ;; Remove the service.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
592 (remhash key zeroconf-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
593 (remhash key zeroconf-resolved-services-hash)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
594 (run-hook-with-args 'rhook val)))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
595
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
596 (defun zeroconf-register-service-resolver (name type)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
597 "Register a service resolver at the Avahi daemon."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
598 (let ((key (concat name "/" type)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
599 (or (gethash key zeroconf-path-avahi-service-resolver-hash nil)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
600 (puthash key
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
601 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
602 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
603 zeroconf-interface-avahi-server "ServiceResolverNew"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
604 zeroconf-avahi-interface-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
605 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
606 name type
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
607 zeroconf-avahi-current-domain
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
608 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
609 zeroconf-avahi-flags-unspec)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
610 zeroconf-resolved-services-hash))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
611
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
612 (defun zeroconf-service-resolver-handler (&rest val)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
613 "Registered service resolver handler at the Avahi daemon."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
614 ;; Parameters: (interface protocol name type domain host aprotocol
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
615 ;; address port txt flags)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
616 ;; The "TXT" field has the signature "aay". Transform to "as".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
617 (let ((elt (nth 9 val)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
618 (while elt
109294
6e3815c69ab4 * net/zeroconf.el (zeroconf-resolve-service)
Michael Albinus <albinus@detlef>
parents: 109293
diff changeset
619 (setcar elt (dbus-byte-array-to-string (car elt)))
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
620 (setq elt (cdr elt))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
621 (when zeroconf-debug
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
622 (message "zeroconf-service-resolver-handler: %s %S"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
623 (dbus-event-member-name last-input-event) val))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
624 (cond
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
625 ;; A new service has been detected. Add it to
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
626 ;; `zeroconf-resolved-services-hash'.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
627 ((string-equal (dbus-event-member-name last-input-event) "Found")
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
628 (puthash
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
629 (concat (zeroconf-service-name val) "/" (zeroconf-service-type val))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
630 val zeroconf-resolved-services-hash))))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
631
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
632
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
633 ;;; Services publishing.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
634
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
635 (defun zeroconf-publish-service (name type domain host port address txt)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
636 "Publish a service at the Avahi daemon.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
637 For the description of arguments, see `zeroconf-resolved-services-hash'."
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
638 ;; NAME and TYPE must not be empty.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
639 (when (zerop (length name))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
640 (error "Invalid argument NAME: %s" name))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
641 (when (zerop (length type))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
642 (error "Invalid argument TYPE: %s" type))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
643
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
644 ;; Set default values for DOMAIN, HOST and PORT.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
645 (when (zerop (length domain))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
646 (setq domain (zeroconf-get-domain)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
647 (when (zerop (length host))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
648 (setq host (zeroconf-get-host-domain)))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
649 (when (null port)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
650 (setq port 0))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
651
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
652 ;; Create an entry in the daemon.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
653 (let ((object-path
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
654 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
655 :system zeroconf-service-avahi zeroconf-path-avahi
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
656 zeroconf-interface-avahi-server "EntryGroupNew"))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
657 result)
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
658
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
659 ;; The TXT field has the signature "as". Transform to "aay".
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
660 (dolist (elt txt)
109294
6e3815c69ab4 * net/zeroconf.el (zeroconf-resolve-service)
Michael Albinus <albinus@detlef>
parents: 109293
diff changeset
661 (add-to-list 'result (dbus-string-to-byte-array elt)))
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
662
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
663 ;; Add the service.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
664 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
665 :system zeroconf-service-avahi object-path
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
666 zeroconf-interface-avahi-entry-group "AddService"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
667 zeroconf-avahi-interface-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
668 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
669 zeroconf-avahi-flags-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
670 name type domain host :uint16 port (append '(:array) result))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
671
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
672 ;; Add the address.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
673 (unless (zerop (length address))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
674 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
675 :system zeroconf-service-avahi object-path
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
676 zeroconf-interface-avahi-entry-group "AddAddress"
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
677 zeroconf-avahi-interface-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
678 zeroconf-avahi-protocol-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
679 zeroconf-avahi-flags-unspec
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
680 host address))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
681
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
682 ;; Make it persistent in the daemon.
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
683 (dbus-call-method
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
684 :system zeroconf-service-avahi object-path
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
685 zeroconf-interface-avahi-entry-group "Commit")))
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
686
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
687 (provide 'zeroconf)
94144
40901fec25aa Add arch tagline
Miles Bader <miles@gnu.org>
parents: 93874
diff changeset
688
40901fec25aa Add arch tagline
Miles Bader <miles@gnu.org>
parents: 93874
diff changeset
689 ;; arch-tag: ea578165-7fa8-44f4-90f0-de3940aec69f
93874
ca56553dfa9b * net/zeroconf.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff changeset
690 ;;; zeroconf.el ends here