1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
diff -Nurd avahi-0.1.orig/avahi-daemon/static-services.c avahi-0.1/avahi-daemon/static-services.c
--- avahi-0.1.orig/avahi-daemon/static-services.c 2005-08-21 23:27:09 +0200
+++ avahi-0.1/avahi-daemon/static-services.c 2005-08-28 00:34:50 +0200
@@ -251,7 +251,6 @@
XML_TAG_DOMAIN_NAME,
XML_TAG_HOST_NAME,
XML_TAG_PORT,
- XML_TAG_PROTOCOL,
XML_TAG_TXT_RECORD
} xml_tag_name;
@@ -285,19 +284,41 @@
u->group->replace_wildcards = strcmp(attr[1], "yes") == 0;
else
goto invalid_attr;
- }
- if (attr[2])
- goto invalid_attr;
+ if (attr[2])
+ goto invalid_attr;
+ }
} else if (u->current_tag == XML_TAG_SERVICE_GROUP && strcmp(el, "service") == 0) {
- if (attr[0])
- goto invalid_attr;
+ u->current_tag = XML_TAG_SERVICE;
assert(!u->service);
u->service = static_service_new(u->group);
- u->current_tag = XML_TAG_SERVICE;
+ if (attr[0]) {
+ if (strcmp(attr[0], "protocol") == 0) {
+ AvahiProtocol protocol;
+
+ if (strcmp(attr[1], "ipv4") == 0) {
+ protocol = AVAHI_PROTO_INET;
+ } else if (strcmp(attr[1], "ipv6") == 0) {
+ protocol = AVAHI_PROTO_INET6;
+ } else if (strcmp(attr[1], "any") == 0) {
+ protocol = AVAHI_PROTO_UNSPEC;
+ } else {
+ avahi_log_error("%s: parse failure: invalid protocol specification \"%s\".", u->group->filename, attr[1]);
+ u->failed = 1;
+ return;
+ }
+
+ u->service->protocol = protocol;
+ } else
+ goto invalid_attr;
+
+ if (attr[2])
+ goto invalid_attr;
+ }
+
} else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "type") == 0) {
if (attr[0])
goto invalid_attr;
@@ -318,11 +339,6 @@
goto invalid_attr;
u->current_tag = XML_TAG_PORT;
- } else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "protocol") == 0) {
- if (attr[0])
- goto invalid_attr;
-
- u->current_tag = XML_TAG_PROTOCOL;
} else if (u->current_tag == XML_TAG_SERVICE && strcmp(el, "txt-record") == 0) {
if (attr[0])
goto invalid_attr;
@@ -394,27 +410,6 @@
break;
}
- case XML_TAG_PROTOCOL: {
- int protocol;
- assert(u->service);
-
- if (u->buf && strcasecmp (u->buf, "ipv4") == 0) {
- protocol = AVAHI_PROTO_INET;
- } else if (u->buf && strcasecmp (u->buf, "ipv6") == 0) {
- protocol = AVAHI_PROTO_INET6;
- } else if (u->buf && strcasecmp (u->buf, "any") == 0) {
- protocol = AVAHI_PROTO_UNSPEC;
- } else {
- avahi_log_error("%s: parse failure: invalid protocol specification \"%s\".", u->group->filename, u->buf);
- u->failed = 1;
- return;
- }
-
- u->service->protocol = protocol;
- u->current_tag = XML_TAG_SERVICE;
- break;
- }
-
case XML_TAG_TXT_RECORD: {
assert(u->service);
@@ -484,7 +479,6 @@
break;
case XML_TAG_PORT:
- case XML_TAG_PROTOCOL:
case XML_TAG_TXT_RECORD:
assert(u->service);
u->buf = append_cdata(u->buf, s, len);
diff -Nurd avahi-0.1.orig/avahi-daemon/example.service avahi-0.1/avahi-daemon/example.service
--- avahi-0.1.orig/avahi-daemon/example.service 2005-08-21 23:27:09 +0200
+++ avahi-0.1/avahi-daemon/example.service 2005-08-28 00:34:50 +0200
@@ -16,12 +16,11 @@
<port>631</port>
</service>
- <service>
+ <service protocol="ipv6">
<type>_uberprinter._tcp</type>
<domain-name>local</domain-name>
<host-name>quux.local</host-name>
<port>4711</port>
- <protocol>any</protocol>
<txt-record>this=is</txt-record>
<txt-record>a=really</txt-record>
<txt-record>bad=example</txt-record>
diff -Nurd avahi-0.1.orig/avahi-daemon/avahi-service.dtd avahi-0.1/avahi-daemon/avahi-service.dtd
--- avahi-0.1.orig/avahi-daemon/avahi-service.dtd 2005-08-21 23:27:09 +0200
+++ avahi-0.1/avahi-daemon/avahi-service.dtd 2005-08-28 00:34:50 +0200
@@ -5,7 +5,7 @@
<!ELEMENT name (#PCDATA)>
<!ATTLIST name replace-wildcards (yes|no) "no">
<!ELEMENT service (type,domain-name?,host-name?,port,txt-record*)>
-<!ATTLIST service>
+<!ATTLIST service protocol (ipv4|ipv6|any) "any">
<!ELEMENT type (#PCDATA)>
<!ATTLIST type>
<!ELEMENT domain-name (#PCDATA)>
@@ -14,7 +14,5 @@
<!ATTLIST host-name>
<!ELEMENT port (#PCDATA)>
<!ATTLIST port>
-<!ELEMENT protocol (#PCDATA)>
-<!ATTLIST protocol>
<!ELEMENT txt-record (#PCDATA)>
<!ATTLIST txt-record>
diff -Nurd avahi-0.1.orig/man/avahi.service.5.xml.in avahi-0.1/man/avahi.service.5.xml.in
--- avahi-0.1.orig/man/avahi.service.5.xml.in 2005-08-21 23:27:10 +0200
+++ avahi-0.1/man/avahi.service.5.xml.in 2005-08-28 00:34:50 +0200
@@ -45,7 +45,7 @@
</option>
<option>
- <p><opt><name replace-wildcards="yes|no"/></opt> The
+ <p><opt><name replace-wildcards="yes|no"></opt> The
service name. If <opt>replace-wildcards</opt> is "yes", any
occurence of the string "%h" will be replaced by the local
host name. This can be used for service names like "Remote
@@ -54,16 +54,19 @@
</option>
<option>
- <p><opt><service></opt> Contains the service information
- for exactly one service type. Should contain one
- <opt><type></opt> and one <opt><port></opt>
- element. Optionally it may contain one
+ <p><opt><service protocol="ipv4|ipv6|any"></opt>
+ Contains the service information for exactly one service
+ type. Should contain one <opt><type></opt> and one
+ <opt><port></opt> element. Optionally it may contain one
<opt><domain-name></opt>, one
<opt><host-name></opt> and multiple
- <opt><txt-record></opt> elements.</p>
+ <opt><txt-record></opt> elements. The attribute
+ <opt>protocol</opt> specifies the protocol to
+ advertise the service on. If <opt>any</opt> is used (which is
+ the default), the service will be advertised on both IPv4 and
+ IPv6.</p>
</option>
-
<option>
<p><opt><type></opt> Contains the DNS-SD service type for this service. e.g. "_http._tcp".</p>
</option>
@@ -88,10 +91,6 @@
</option>
<option>
- <p><opt><protocol></opt> The protocol to advertise the service on, can be any of <opt>ipv4</opt>, <opt>ipv6</opt> or <opt>any</opt>.</p>
- </option>
-
- <option>
<p><opt><txt-record></opt> DNS-SD TXT record data.</p>
</option>
|