dnssd 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.txt +10 -0
- data/Manifest.txt +0 -1
- data/ext/dnssd/extconf.rb +7 -0
- data/lib/dnssd.rb +2 -2
- data/lib/dnssd/reply/resolve.rb +0 -2
- data/test/test_dnssd.rb +1 -4
- data/test/test_dnssd_reply_resolve.rb +12 -2
- data/test/test_dnssd_service.rb +15 -0
- data/test/test_dnssd_text_record.rb +13 -16
- metadata +4 -6
- metadata.gz.sig +0 -0
- data/test/test_dnssd_getaddrinfo.rb +0 -23
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 1.3.3 / 2010-08-29
|
2
|
+
|
3
|
+
* Bug fixes
|
4
|
+
* Fix LocalJumpError issue on 1.9. Patch by Tim Lucas.
|
5
|
+
* Force reverse lookup on 1.9 for tests. Patch by Tim Lucas.
|
6
|
+
* Fix default protocol for DNSSD::Service.getaddrinfo to prevent a crash.
|
7
|
+
Patch by Adam Elliot.
|
8
|
+
* Possibly fix solaris compilation by adding -lxnet. Issue #5 by Pedro
|
9
|
+
Palazón Candel.
|
10
|
+
|
1
11
|
=== 1.3.2 / 2010-08-28
|
2
12
|
|
3
13
|
* Bug fixes
|
data/Manifest.txt
CHANGED
data/ext/dnssd/extconf.rb
CHANGED
@@ -33,6 +33,13 @@ if have_header 'iphlpapi.h' then
|
|
33
33
|
have_func('if_nametoindex', %w[iphlpapi.h netioapi.h]) ||
|
34
34
|
abort('unable to find if_indextoname or if_nametoindex')
|
35
35
|
else
|
36
|
+
if RUBY_PLATFORM =~ /solaris/ then
|
37
|
+
have_library('xnet') ||
|
38
|
+
abort('unable to find xnet library for if_indextoname/if_nametoindex')
|
39
|
+
|
40
|
+
$CFLAGS << ' -lxnet'
|
41
|
+
end
|
42
|
+
|
36
43
|
have_func('if_indextoname', %w[sys/types.h sys/socket.h net/if.h]) &&
|
37
44
|
have_func('if_nametoindex', %w[sys/types.h sys/socket.h net/if.h]) ||
|
38
45
|
abort('unable to find if_indextoname or if_nametoindex')
|
data/lib/dnssd.rb
CHANGED
@@ -13,7 +13,7 @@ module DNSSD
|
|
13
13
|
##
|
14
14
|
# The version of DNSSD you're using.
|
15
15
|
|
16
|
-
VERSION = '1.3.
|
16
|
+
VERSION = '1.3.3'
|
17
17
|
|
18
18
|
##
|
19
19
|
# Registers +socket+ with DNSSD as +name+. If +service+ is omitted it is
|
@@ -28,7 +28,7 @@ module DNSSD
|
|
28
28
|
|
29
29
|
def self.announce(socket, name, service = nil, text_record = nil, flags = 0,
|
30
30
|
interface = DNSSD::InterfaceAny, &block)
|
31
|
-
_, port,
|
31
|
+
_, port, = socket.addr
|
32
32
|
|
33
33
|
raise ArgumentError, 'socket not bound' if port == 0
|
34
34
|
|
data/lib/dnssd/reply/resolve.rb
CHANGED
data/test/test_dnssd.rb
CHANGED
@@ -20,7 +20,6 @@ class TestDNSSD < MiniTest::Unit::TestCase
|
|
20
20
|
DNSSD.browse '_blackjack._tcp' do |reply|
|
21
21
|
next unless 'blackjack tcp server' == reply.name
|
22
22
|
t[:reply] = reply
|
23
|
-
break
|
24
23
|
end
|
25
24
|
|
26
25
|
s = TCPServer.new 'localhost', @port
|
@@ -37,10 +36,8 @@ class TestDNSSD < MiniTest::Unit::TestCase
|
|
37
36
|
def test_class_announce_tcp_server_service
|
38
37
|
t = Thread.current
|
39
38
|
|
40
|
-
|
41
|
-
'local.' do |reply|
|
39
|
+
DNSSD.resolve 'blackjack resolve', '_blackjack._tcp', 'local.' do |reply|
|
42
40
|
t[:reply] = reply
|
43
|
-
break
|
44
41
|
end
|
45
42
|
|
46
43
|
s = TCPServer.new 'localhost', @port + 1
|
@@ -19,7 +19,12 @@ class TestDNSSDReplyResolve < MiniTest::Unit::TestCase
|
|
19
19
|
|
20
20
|
assert_instance_of TCPSocket, socket
|
21
21
|
assert_equal @port, socket.peeraddr[1]
|
22
|
-
|
22
|
+
|
23
|
+
if socket.method(:peeraddr).arity.zero? then
|
24
|
+
assert_equal 'localhost', socket.peeraddr[2]
|
25
|
+
else
|
26
|
+
assert_equal 'localhost', socket.peeraddr(true)[2]
|
27
|
+
end
|
23
28
|
ensure
|
24
29
|
socket.close if socket
|
25
30
|
server.close if server
|
@@ -37,7 +42,12 @@ class TestDNSSDReplyResolve < MiniTest::Unit::TestCase
|
|
37
42
|
|
38
43
|
assert_instance_of UDPSocket, socket
|
39
44
|
assert_equal @port, socket.peeraddr[1]
|
40
|
-
|
45
|
+
|
46
|
+
if socket.method(:peeraddr).arity.zero? then
|
47
|
+
assert_equal 'localhost', socket.peeraddr[2]
|
48
|
+
else
|
49
|
+
assert_equal 'localhost', socket.peeraddr(true)[2]
|
50
|
+
end
|
41
51
|
ensure
|
42
52
|
socket.close if socket
|
43
53
|
server.close if server
|
data/test/test_dnssd_service.rb
CHANGED
@@ -8,5 +8,20 @@ class TestDNSSDService < MiniTest::Unit::TestCase
|
|
8
8
|
DNSSD::Service.get_property(DNSSD::Service::DaemonVersion)
|
9
9
|
end if DNSSD::Service.respond_to? :get_property
|
10
10
|
|
11
|
+
def test_class_getaddrinfo
|
12
|
+
service = DNSSD::Service.new
|
13
|
+
|
14
|
+
addresses = []
|
15
|
+
begin
|
16
|
+
service.getaddrinfo 'localhost' do |addrinfo|
|
17
|
+
addresses << addrinfo.address
|
18
|
+
break unless addrinfo.flags.more_coming?
|
19
|
+
end
|
20
|
+
ensure
|
21
|
+
service.stop
|
22
|
+
end
|
23
|
+
assert addresses.index('127.0.0.1')
|
24
|
+
end
|
25
|
+
|
11
26
|
end
|
12
27
|
|
@@ -2,13 +2,10 @@ require 'minitest/autorun'
|
|
2
2
|
require 'dnssd'
|
3
3
|
|
4
4
|
class TestDNSSDTextRecord < MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
def setup
|
7
|
-
@TR = DNSSD::TextRecord
|
8
|
-
end
|
5
|
+
TR = DNSSD::TextRecord
|
9
6
|
|
10
7
|
def test_encode
|
11
|
-
tr =
|
8
|
+
tr = TR.new
|
12
9
|
|
13
10
|
tr['key1'] = nil
|
14
11
|
tr['key2'] = ''
|
@@ -18,7 +15,7 @@ class TestDNSSDTextRecord < MiniTest::Unit::TestCase
|
|
18
15
|
end
|
19
16
|
|
20
17
|
def test_encode_long
|
21
|
-
tr =
|
18
|
+
tr = TR.new
|
22
19
|
|
23
20
|
tr['key'] = 'X' * 252
|
24
21
|
|
@@ -48,35 +45,35 @@ class TestDNSSDTextRecord < MiniTest::Unit::TestCase
|
|
48
45
|
'email' => ''
|
49
46
|
}
|
50
47
|
|
51
|
-
assert_equal expected,
|
48
|
+
assert_equal expected, TR.new(text_record).to_hash
|
52
49
|
end
|
53
50
|
|
54
51
|
def test_decode_bad
|
55
52
|
assert_raises ArgumentError do
|
56
|
-
|
53
|
+
TR.new("\x01") # length past end-of-record
|
57
54
|
end
|
58
55
|
|
59
56
|
assert_raises ArgumentError do
|
60
57
|
# no key
|
61
|
-
|
58
|
+
TR.new("\x01=")
|
62
59
|
end
|
63
60
|
|
64
61
|
assert_raises ArgumentError do
|
65
62
|
# 0-length key
|
66
|
-
|
63
|
+
TR.new("\x02=v")
|
67
64
|
end
|
68
65
|
end
|
69
66
|
|
70
67
|
def test_decode_empty
|
71
|
-
assert_equal({},
|
72
|
-
assert_equal({},
|
73
|
-
assert_equal({},
|
68
|
+
assert_equal({}, TR.new(""))
|
69
|
+
assert_equal({}, TR.new("\x00"))
|
70
|
+
assert_equal({}, TR.new("\x00\x00"))
|
74
71
|
end
|
75
72
|
|
76
73
|
def test_decode_value
|
77
|
-
assert_equal({ 'k' => nil },
|
78
|
-
assert_equal({ 'k' => '' },
|
79
|
-
assert_equal({ 'k' => 'v' },
|
74
|
+
assert_equal({ 'k' => nil }, TR.new("\x01k").to_hash)
|
75
|
+
assert_equal({ 'k' => '' }, TR.new("\x02k=").to_hash)
|
76
|
+
assert_equal({ 'k' => 'v' }, TR.new("\x03k=v").to_hash)
|
80
77
|
end
|
81
78
|
|
82
79
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dnssd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 3
|
10
|
+
version: 1.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Eric Hodel
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
x52qPcexcYZR7w==
|
42
42
|
-----END CERTIFICATE-----
|
43
43
|
|
44
|
-
date: 2010-08-
|
44
|
+
date: 2010-08-29 00:00:00 +09:00
|
45
45
|
default_executable:
|
46
46
|
dependencies:
|
47
47
|
- !ruby/object:Gem::Dependency
|
@@ -193,7 +193,6 @@ files:
|
|
193
193
|
- sample/socket.rb
|
194
194
|
- test/test_dnssd.rb
|
195
195
|
- test/test_dnssd_flags.rb
|
196
|
-
- test/test_dnssd_getaddrinfo.rb
|
197
196
|
- test/test_dnssd_record.rb
|
198
197
|
- test/test_dnssd_reply.rb
|
199
198
|
- test/test_dnssd_reply_browse.rb
|
@@ -239,7 +238,6 @@ summary: DNS Service Discovery (aka Bonjour, MDNS) API for Ruby
|
|
239
238
|
test_files:
|
240
239
|
- test/test_dnssd.rb
|
241
240
|
- test/test_dnssd_flags.rb
|
242
|
-
- test/test_dnssd_getaddrinfo.rb
|
243
241
|
- test/test_dnssd_record.rb
|
244
242
|
- test/test_dnssd_reply.rb
|
245
243
|
- test/test_dnssd_reply_browse.rb
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'dnssd'
|
3
|
-
require 'socket'
|
4
|
-
|
5
|
-
class TestDNSSD < MiniTest::Unit::TestCase
|
6
|
-
|
7
|
-
def test_getaddrinfo
|
8
|
-
service = DNSSD::Service.new
|
9
|
-
|
10
|
-
addresses = []
|
11
|
-
begin
|
12
|
-
service.getaddrinfo 'localhost' do |addrinfo|
|
13
|
-
addresses << addrinfo.address
|
14
|
-
break unless addrinfo.flags.more_coming?
|
15
|
-
end
|
16
|
-
ensure
|
17
|
-
service.stop
|
18
|
-
end
|
19
|
-
assert addresses.index('127.0.0.1')
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|