dnsruby 1.55 → 1.56.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +96 -0
- data/Rakefile +30 -29
- data/demo/axfr.rb +93 -93
- data/demo/check_soa.rb +99 -99
- data/demo/check_zone.rb +59 -59
- data/demo/digdlv.rb +43 -43
- data/demo/digroot.rb +34 -34
- data/demo/example_recurse.rb +14 -14
- data/demo/mresolv.rb +30 -30
- data/demo/mx.rb +31 -31
- data/demo/rubydig.rb +37 -37
- data/demo/to_resolve.txt +3088 -3088
- data/demo/trace_dns.rb +46 -46
- data/lib/dnsruby.rb +161 -526
- data/lib/dnsruby/DNS.rb +305 -0
- data/lib/{Dnsruby/Cache.rb → dnsruby/cache.rb} +152 -152
- data/lib/{Dnsruby → dnsruby}/code_mapper.rb +48 -52
- data/lib/dnsruby/code_mappers.rb +295 -0
- data/lib/{Dnsruby/Config.rb → dnsruby/config.rb} +454 -454
- data/lib/{Dnsruby → dnsruby}/dnssec.rb +91 -91
- data/lib/{Dnsruby/Hosts.rb → dnsruby/hosts.rb} +125 -125
- data/lib/{Dnsruby → dnsruby}/ipv4.rb +26 -26
- data/lib/{Dnsruby → dnsruby}/ipv6.rb +42 -42
- data/lib/{Dnsruby → dnsruby}/key_cache.rb +29 -29
- data/lib/dnsruby/message/decoder.rb +164 -0
- data/lib/dnsruby/message/encoder.rb +75 -0
- data/lib/dnsruby/message/header.rb +249 -0
- data/lib/dnsruby/message/message.rb +629 -0
- data/lib/dnsruby/message/question.rb +86 -0
- data/lib/dnsruby/message/section.rb +96 -0
- data/lib/{Dnsruby → dnsruby}/name.rb +141 -141
- data/lib/dnsruby/packet_sender.rb +661 -0
- data/lib/{Dnsruby/Recursor.rb → dnsruby/recursor.rb} +235 -233
- data/lib/dnsruby/resolv.rb +113 -0
- data/lib/dnsruby/resolver.rb +1192 -0
- data/lib/dnsruby/resource/A.rb +56 -0
- data/lib/dnsruby/resource/AAAA.rb +54 -0
- data/lib/{Dnsruby → dnsruby}/resource/AFSDB.rb +68 -68
- data/lib/{Dnsruby → dnsruby}/resource/CERT.rb +105 -105
- data/lib/{Dnsruby → dnsruby}/resource/DHCID.rb +54 -54
- data/lib/dnsruby/resource/DLV.rb +27 -0
- data/lib/{Dnsruby → dnsruby}/resource/DNSKEY.rb +372 -372
- data/lib/{Dnsruby → dnsruby}/resource/DS.rb +255 -255
- data/lib/{Dnsruby → dnsruby}/resource/HINFO.rb +71 -71
- data/lib/{Dnsruby → dnsruby}/resource/HIP.rb +29 -29
- data/lib/{Dnsruby → dnsruby}/resource/IN.rb +30 -30
- data/lib/{Dnsruby → dnsruby}/resource/IPSECKEY.rb +31 -31
- data/lib/{Dnsruby → dnsruby}/resource/ISDN.rb +62 -62
- data/lib/{Dnsruby → dnsruby}/resource/KX.rb +65 -65
- data/lib/{Dnsruby → dnsruby}/resource/LOC.rb +263 -263
- data/lib/{Dnsruby → dnsruby}/resource/MINFO.rb +69 -69
- data/lib/{Dnsruby → dnsruby}/resource/MX.rb +65 -65
- data/lib/{Dnsruby → dnsruby}/resource/NAPTR.rb +98 -98
- data/lib/{Dnsruby → dnsruby}/resource/NSAP.rb +171 -171
- data/lib/dnsruby/resource/NSEC.rb +275 -0
- data/lib/dnsruby/resource/NSEC3.rb +332 -0
- data/lib/dnsruby/resource/NSEC3PARAM.rb +135 -0
- data/lib/dnsruby/resource/OPT.rb +272 -0
- data/lib/{Dnsruby → dnsruby}/resource/PX.rb +70 -70
- data/lib/{Dnsruby → dnsruby}/resource/RP.rb +75 -75
- data/lib/dnsruby/resource/RR.rb +421 -0
- data/lib/dnsruby/resource/RRSIG.rb +275 -0
- data/lib/dnsruby/resource/RRSet.rb +190 -0
- data/lib/{Dnsruby → dnsruby}/resource/RT.rb +67 -67
- data/lib/{Dnsruby → dnsruby}/resource/SOA.rb +94 -94
- data/lib/dnsruby/resource/SPF.rb +29 -0
- data/lib/dnsruby/resource/SRV.rb +112 -0
- data/lib/{Dnsruby → dnsruby}/resource/SSHFP.rb +14 -14
- data/lib/dnsruby/resource/TKEY.rb +163 -0
- data/lib/dnsruby/resource/TSIG.rb +593 -0
- data/lib/{Dnsruby → dnsruby}/resource/TXT.rb +191 -191
- data/lib/dnsruby/resource/X25.rb +55 -0
- data/lib/{Dnsruby → dnsruby}/resource/domain_name.rb +25 -25
- data/lib/{Dnsruby → dnsruby}/resource/generic.rb +80 -80
- data/lib/dnsruby/resource/resource.rb +25 -0
- data/lib/{Dnsruby → dnsruby}/select_thread.rb +148 -148
- data/lib/{Dnsruby/SingleResolver.rb → dnsruby/single_resolver.rb} +60 -60
- data/lib/{Dnsruby → dnsruby}/single_verifier.rb +344 -344
- data/lib/dnsruby/the_log.rb +44 -0
- data/lib/dnsruby/update.rb +278 -0
- data/lib/dnsruby/validator_thread.rb +124 -0
- data/lib/dnsruby/version.rb +3 -0
- data/lib/{Dnsruby → dnsruby}/zone_reader.rb +93 -93
- data/lib/{Dnsruby → dnsruby}/zone_transfer.rb +377 -377
- data/test/spec_helper.rb +16 -0
- data/test/tc_axfr.rb +31 -34
- data/test/tc_cache.rb +32 -32
- data/test/tc_dlv.rb +28 -28
- data/test/tc_dns.rb +73 -76
- data/test/tc_dnskey.rb +31 -32
- data/test/tc_dnsruby.rb +50 -44
- data/test/tc_ds.rb +36 -36
- data/test/tc_escapedchars.rb +252 -255
- data/test/tc_hash.rb +17 -21
- data/test/tc_header.rb +48 -57
- data/test/tc_hip.rb +19 -22
- data/test/tc_ipseckey.rb +18 -21
- data/test/tc_keith.rb +300 -0
- data/test/tc_message.rb +87 -0
- data/test/tc_misc.rb +83 -87
- data/test/tc_name.rb +81 -84
- data/test/tc_naptr.rb +18 -21
- data/test/tc_nsec.rb +55 -55
- data/test/tc_nsec3.rb +23 -24
- data/test/tc_nsec3param.rb +20 -21
- data/test/tc_packet.rb +90 -93
- data/test/tc_packet_unique_push.rb +48 -51
- data/test/tc_question.rb +30 -33
- data/test/tc_queue.rb +16 -17
- data/test/tc_recur.rb +16 -17
- data/test/tc_res_config.rb +38 -41
- data/test/tc_res_env.rb +29 -32
- data/test/tc_res_file.rb +26 -29
- data/test/tc_res_opt.rb +62 -65
- data/test/tc_resolver.rb +287 -242
- data/test/tc_rr-opt.rb +70 -63
- data/test/tc_rr-txt.rb +68 -71
- data/test/tc_rr-unknown.rb +45 -48
- data/test/tc_rr.rb +76 -70
- data/test/tc_rrset.rb +21 -22
- data/test/tc_rrsig.rb +19 -20
- data/test/tc_single_resolver.rb +294 -297
- data/test/tc_soak.rb +199 -202
- data/test/tc_soak_base.rb +29 -34
- data/test/tc_sshfp.rb +20 -23
- data/test/tc_tcp.rb +32 -35
- data/test/tc_tkey.rb +41 -44
- data/test/tc_tsig.rb +81 -84
- data/test/tc_update.rb +108 -111
- data/test/tc_validator.rb +29 -29
- data/test/tc_verifier.rb +81 -82
- data/test/ts_dnsruby.rb +16 -15
- data/test/ts_offline.rb +62 -63
- data/test/ts_online.rb +115 -115
- metadata +155 -90
- data/README +0 -59
- data/lib/Dnsruby/DNS.rb +0 -305
- data/lib/Dnsruby/PacketSender.rb +0 -656
- data/lib/Dnsruby/Resolver.rb +0 -1189
- data/lib/Dnsruby/TheLog.rb +0 -44
- data/lib/Dnsruby/message.rb +0 -1230
- data/lib/Dnsruby/resource/A.rb +0 -56
- data/lib/Dnsruby/resource/AAAA.rb +0 -54
- data/lib/Dnsruby/resource/DLV.rb +0 -27
- data/lib/Dnsruby/resource/NSEC.rb +0 -298
- data/lib/Dnsruby/resource/NSEC3.rb +0 -340
- data/lib/Dnsruby/resource/NSEC3PARAM.rb +0 -135
- data/lib/Dnsruby/resource/OPT.rb +0 -213
- data/lib/Dnsruby/resource/RRSIG.rb +0 -275
- data/lib/Dnsruby/resource/SPF.rb +0 -29
- data/lib/Dnsruby/resource/SRV.rb +0 -112
- data/lib/Dnsruby/resource/TKEY.rb +0 -163
- data/lib/Dnsruby/resource/TSIG.rb +0 -593
- data/lib/Dnsruby/resource/X25.rb +0 -55
- data/lib/Dnsruby/resource/resource.rb +0 -678
- data/lib/Dnsruby/update.rb +0 -278
- data/lib/Dnsruby/validator_thread.rb +0 -124
@@ -1,72 +1,72 @@
|
|
1
|
-
|
2
|
-
#Copyright 2007 Nominet UK
|
3
|
-
#
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
#you may not use this file except in compliance with the License.
|
6
|
-
#You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
#See the License for the specific language governing permissions and
|
14
|
-
#limitations under the License.
|
15
|
-
|
16
|
-
module Dnsruby
|
17
|
-
class RR
|
18
|
-
#Class for DNS Host Information (HINFO) resource records.
|
19
|
-
class HINFO < RR
|
20
|
-
ClassValue = nil #:nodoc: all
|
21
|
-
TypeValue = Types::HINFO #:nodoc: all
|
22
|
-
|
23
|
-
#The CPU type for this RR.
|
24
|
-
attr_accessor :cpu
|
25
|
-
#The operating system type for this RR.
|
26
|
-
attr_accessor :os
|
27
|
-
|
28
|
-
def from_data(data) #:nodoc: all
|
29
|
-
@cpu, @os= data
|
30
|
-
end
|
31
|
-
|
32
|
-
def from_string(input) #:nodoc: all
|
33
|
-
strings = TXT.parse(input)
|
34
|
-
cpu = ""
|
35
|
-
os = ""
|
36
|
-
if (strings.length == 1)
|
37
|
-
cpu, os = input.split(" ")
|
38
|
-
else
|
39
|
-
cpu = strings[0]
|
40
|
-
os = strings[1]
|
41
|
-
end
|
42
|
-
cpu.sub!(/^\"/, "")
|
43
|
-
@cpu = cpu.sub(/\"$/, "")
|
44
|
-
os.sub!(/^\"/, "")
|
45
|
-
@os = os.sub(/\"$/, "")
|
46
|
-
end
|
47
|
-
|
48
|
-
def rdata_to_string #:nodoc: all
|
49
|
-
if (defined?@cpu)
|
50
|
-
temp = []
|
51
|
-
[@cpu, @os].each {|str|
|
52
|
-
output = TXT.display(str)
|
53
|
-
temp.push("\"#{output}\"")
|
54
|
-
}
|
55
|
-
return temp.join(' ')
|
56
|
-
end
|
57
|
-
return ''
|
58
|
-
end
|
59
|
-
|
60
|
-
def encode_rdata(msg, canonical=false) #:nodoc: all
|
61
|
-
msg.put_string(@cpu)
|
62
|
-
msg.put_string(@os)
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.decode_rdata(msg) #:nodoc: all
|
66
|
-
cpu = msg.get_string
|
67
|
-
os = msg.get_string
|
68
|
-
return self.new([cpu, os])
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
1
|
+
# --
|
2
|
+
# Copyright 2007 Nominet UK
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
# ++
|
16
|
+
module Dnsruby
|
17
|
+
class RR
|
18
|
+
# Class for DNS Host Information (HINFO) resource records.
|
19
|
+
class HINFO < RR
|
20
|
+
ClassValue = nil #:nodoc: all
|
21
|
+
TypeValue = Types::HINFO #:nodoc: all
|
22
|
+
|
23
|
+
# The CPU type for this RR.
|
24
|
+
attr_accessor :cpu
|
25
|
+
# The operating system type for this RR.
|
26
|
+
attr_accessor :os
|
27
|
+
|
28
|
+
def from_data(data) #:nodoc: all
|
29
|
+
@cpu, @os= data
|
30
|
+
end
|
31
|
+
|
32
|
+
def from_string(input) #:nodoc: all
|
33
|
+
strings = TXT.parse(input)
|
34
|
+
cpu = ""
|
35
|
+
os = ""
|
36
|
+
if (strings.length == 1)
|
37
|
+
cpu, os = input.split(" ")
|
38
|
+
else
|
39
|
+
cpu = strings[0]
|
40
|
+
os = strings[1]
|
41
|
+
end
|
42
|
+
cpu.sub!(/^\"/, "")
|
43
|
+
@cpu = cpu.sub(/\"$/, "")
|
44
|
+
os.sub!(/^\"/, "")
|
45
|
+
@os = os.sub(/\"$/, "")
|
46
|
+
end
|
47
|
+
|
48
|
+
def rdata_to_string #:nodoc: all
|
49
|
+
if (defined?@cpu)
|
50
|
+
temp = []
|
51
|
+
[@cpu, @os].each {|str|
|
52
|
+
output = TXT.display(str)
|
53
|
+
temp.push("\"#{output}\"")
|
54
|
+
}
|
55
|
+
return temp.join(' ')
|
56
|
+
end
|
57
|
+
return ''
|
58
|
+
end
|
59
|
+
|
60
|
+
def encode_rdata(msg, canonical=false) #:nodoc: all
|
61
|
+
msg.put_string(@cpu)
|
62
|
+
msg.put_string(@os)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.decode_rdata(msg) #:nodoc: all
|
66
|
+
cpu = msg.get_string
|
67
|
+
os = msg.get_string
|
68
|
+
return self.new([cpu, os])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
72
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#Copyright 2009 Nominet UK
|
4
|
-
#
|
5
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
#you may not use this file except in compliance with the License.
|
7
|
-
#You may obtain a copy of the License at
|
8
|
-
#
|
1
|
+
|
2
|
+
# --
|
3
|
+
# Copyright 2009 Nominet UK
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
9
|
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
#Unless required by applicable law or agreed to in writing, software
|
12
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
#See the License for the specific language governing permissions and
|
15
|
-
#limitations under the License.
|
16
|
-
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
# ++
|
17
17
|
module Dnsruby
|
18
18
|
class RR
|
19
19
|
class HIP < RR
|
@@ -21,17 +21,17 @@ module Dnsruby
|
|
21
21
|
ClassValue = nil #:nodoc: all
|
22
22
|
TypeValue = Types::HIP #:nodoc: all
|
23
23
|
|
24
|
-
#An 8-bit length for the HIT field
|
24
|
+
# An 8-bit length for the HIT field
|
25
25
|
attr_accessor :hit_length
|
26
|
-
#The PK algorithm used :
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
26
|
+
# The PK algorithm used :
|
27
|
+
# 0 - no key present
|
28
|
+
# 1 - DSA key present
|
29
|
+
# 2 - RSA key present
|
30
30
|
attr_accessor :pk_algorithm
|
31
|
-
#An 8-bit length for the Public Key field
|
31
|
+
# An 8-bit length for the Public Key field
|
32
32
|
attr_accessor :pk_length
|
33
33
|
|
34
|
-
#An array of Rendezvous Servers
|
34
|
+
# An array of Rendezvous Servers
|
35
35
|
attr_accessor :rsvs
|
36
36
|
|
37
37
|
def from_data(data) #:nodoc: all
|
@@ -58,19 +58,19 @@ module Dnsruby
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
#HIT field - stored in binary : client methods should handle base16(hex) encoding
|
61
|
+
# HIT field - stored in binary : client methods should handle base16(hex) encoding
|
62
62
|
def hit_string
|
63
|
-
#
|
63
|
+
# Return hex value
|
64
64
|
[@hit.to_s].pack("H*").gsub("\n", "")
|
65
65
|
end
|
66
66
|
def hit_from_string(hit_text)
|
67
|
-
#
|
67
|
+
# Decode the hex value
|
68
68
|
hit_text.gsub!(/\n/, "")
|
69
69
|
hit_text.gsub!(/ /, "")
|
70
70
|
return hit_text.unpack("H*")[0]
|
71
71
|
end
|
72
72
|
|
73
|
-
#Public Key field - presentation format is base64 - public_key methods reused from IPSECKEY
|
73
|
+
# Public Key field - presentation format is base64 - public_key methods reused from IPSECKEY
|
74
74
|
def public_key_string
|
75
75
|
[@public_key.to_s].pack("m*").gsub("\n", "")
|
76
76
|
end
|
@@ -92,7 +92,7 @@ module Dnsruby
|
|
92
92
|
@public_key = public_key_from_string(split[2])
|
93
93
|
@pk_length = @public_key.length
|
94
94
|
|
95
|
-
#
|
95
|
+
# Now load in any RSVs there may be
|
96
96
|
count = 3
|
97
97
|
while (split[count])
|
98
98
|
@rsvs.push(Name.create(split[count]))
|
@@ -115,7 +115,7 @@ module Dnsruby
|
|
115
115
|
msg.put_bytes(@hit)
|
116
116
|
msg.put_bytes(@public_key)
|
117
117
|
@rsvs.each {|rsv|
|
118
|
-
#
|
118
|
+
# RSVs MUST NOT be compressed
|
119
119
|
msg.put_name(rsv, true)
|
120
120
|
}
|
121
121
|
end
|
@@ -125,7 +125,7 @@ module Dnsruby
|
|
125
125
|
hit = msg.get_bytes(hit_length)
|
126
126
|
public_key = msg.get_bytes(pk_length)
|
127
127
|
rsvs = []
|
128
|
-
#
|
128
|
+
# Load in the RSV names, if there are any
|
129
129
|
while (msg.has_remaining)
|
130
130
|
name = msg.get_name
|
131
131
|
rsvs.push(name)
|
@@ -1,18 +1,18 @@
|
|
1
|
-
|
2
|
-
#Copyright 2007 Nominet UK
|
3
|
-
#
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
#you may not use this file except in compliance with the License.
|
6
|
-
#You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
#See the License for the specific language governing permissions and
|
14
|
-
#limitations under the License.
|
15
|
-
|
1
|
+
# --
|
2
|
+
# Copyright 2007 Nominet UK
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
# ++
|
16
16
|
module Dnsruby
|
17
17
|
class RR
|
18
18
|
ClassInsensitiveTypes = {
|
@@ -54,37 +54,37 @@ module Dnsruby
|
|
54
54
|
Types::HIP => HIP,
|
55
55
|
Types::DHCID => DHCID
|
56
56
|
} #:nodoc: all
|
57
|
-
|
58
|
-
#
|
57
|
+
|
58
|
+
# module IN contains ARPA Internet specific RRs
|
59
59
|
module IN
|
60
60
|
ClassValue = Classes::IN
|
61
|
-
|
61
|
+
|
62
62
|
ClassInsensitiveTypes::values::each {|s|
|
63
63
|
c = Class.new(s)
|
64
|
-
#
|
64
|
+
# c < Record
|
65
65
|
c.const_set(:TypeValue, s::TypeValue)
|
66
66
|
c.const_set(:ClassValue, ClassValue)
|
67
67
|
ClassHash[[s::TypeValue, ClassValue]] = c
|
68
68
|
self.const_set(s.name.sub(/.*::/, ''), c)
|
69
69
|
}
|
70
|
-
|
71
|
-
#
|
70
|
+
|
71
|
+
# RFC 1035, Section 3.4.2 (deprecated)
|
72
72
|
class WKS < RR
|
73
73
|
ClassHash[[TypeValue = Types::WKS, ClassValue = ClassValue]] = self #:nodoc: all
|
74
|
-
|
74
|
+
|
75
75
|
def initialize(address, protocol, bitmap)
|
76
76
|
@address = IPv4.create(address)
|
77
77
|
@protocol = protocol
|
78
78
|
@bitmap = bitmap
|
79
79
|
end
|
80
80
|
attr_reader :address, :protocol, :bitmap
|
81
|
-
|
81
|
+
|
82
82
|
def encode_rdata(msg, canonical=false) #:nodoc: all
|
83
83
|
msg.put_bytes(@address.address)
|
84
84
|
msg.put_pack("n", @protocol)
|
85
85
|
msg.put_bytes(@bitmap)
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
def self.decode_rdata(msg) #:nodoc: all
|
89
89
|
address = IPv4.new(msg.get_bytes(4))
|
90
90
|
protocol, = msg.get_unpack("n")
|
@@ -92,12 +92,12 @@ module Dnsruby
|
|
92
92
|
return self.new(address, protocol, bitmap)
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
99
|
-
require '
|
100
|
-
require '
|
101
|
-
require '
|
102
|
-
require '
|
103
|
-
require '
|
99
|
+
require 'dnsruby/resource/A'
|
100
|
+
require 'dnsruby/resource/AAAA'
|
101
|
+
require 'dnsruby/resource/AFSDB'
|
102
|
+
require 'dnsruby/resource/PX'
|
103
|
+
require 'dnsruby/resource/SRV'
|
@@ -1,18 +1,18 @@
|
|
1
|
-
|
2
|
-
#Copyright 2009 Nominet UK
|
3
|
-
#
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
#you may not use this file except in compliance with the License.
|
6
|
-
#You may obtain a copy of the License at
|
7
|
-
#
|
1
|
+
# --
|
2
|
+
# Copyright 2009 Nominet UK
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
8
|
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
#See the License for the specific language governing permissions and
|
14
|
-
#limitations under the License.
|
15
|
-
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
# ++
|
16
16
|
module Dnsruby
|
17
17
|
class RR
|
18
18
|
class IPSECKEY < RR
|
@@ -20,21 +20,21 @@ module Dnsruby
|
|
20
20
|
ClassValue = nil #:nodoc: all
|
21
21
|
TypeValue = Types::IPSECKEY #:nodoc: all
|
22
22
|
|
23
|
-
#An 8-bit precedence for this field. Lower values are preferred.
|
23
|
+
# An 8-bit precedence for this field. Lower values are preferred.
|
24
24
|
attr_accessor :precedence
|
25
|
-
#Specifies the type of gateway :
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
25
|
+
# Specifies the type of gateway :
|
26
|
+
# 0 - no gateway present
|
27
|
+
# 1 - 4 byte IPv4 address present
|
28
|
+
# 2 - 16 byte IPv6 address present
|
29
|
+
# 3 - wire-encoded domain name present
|
30
30
|
attr_accessor :gateway_type
|
31
|
-
#The algorithm used by this key :
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
31
|
+
# The algorithm used by this key :
|
32
|
+
# 0 - no key present
|
33
|
+
# 1 - DSA key present
|
34
|
+
# 2 - RSA key present
|
35
35
|
attr_accessor :algorithm
|
36
|
-
#The gateway. May either be a 32-bit network order IPv4 address, or a
|
37
|
-
#128-bit IPv6 address, or a domain name, or may not be present.
|
36
|
+
# The gateway. May either be a 32-bit network order IPv4 address, or a
|
37
|
+
# 128-bit IPv6 address, or a domain name, or may not be present.
|
38
38
|
attr_accessor :gateway
|
39
39
|
|
40
40
|
def from_data(data) #:nodoc: all
|
@@ -57,22 +57,22 @@ module Dnsruby
|
|
57
57
|
@gateway = load_gateway_from_string(@gateway_type, hash[:gateway])
|
58
58
|
@public_key = hash[:public_key]
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
def load_gateway_from_string(gateway_type, s)
|
62
62
|
gateway = nil
|
63
63
|
if (gateway_type == 0)
|
64
64
|
gateway = nil
|
65
65
|
elsif (gateway_type == 1)
|
66
|
-
#
|
66
|
+
# Load IPv4 gateway
|
67
67
|
gateway = IPv4.create(s)
|
68
68
|
elsif (gateway_type == 2)
|
69
|
-
#
|
69
|
+
# Load IPv6 gateway
|
70
70
|
gateway = IPv6.create(s)
|
71
71
|
else
|
72
|
-
#
|
72
|
+
# Load gateway domain name
|
73
73
|
gateway = Name.create(s)
|
74
74
|
end
|
75
|
-
return gateway
|
75
|
+
return gateway
|
76
76
|
end
|
77
77
|
|
78
78
|
def public_key_string
|
@@ -1,62 +1,62 @@
|
|
1
|
-
|
2
|
-
#Copyright 2007 Nominet UK
|
3
|
-
#
|
4
|
-
#Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
#you may not use this file except in compliance with the License.
|
6
|
-
#You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
#Unless required by applicable law or agreed to in writing, software
|
11
|
-
#distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
#See the License for the specific language governing permissions and
|
14
|
-
#limitations under the License.
|
15
|
-
|
16
|
-
module Dnsruby
|
17
|
-
class RR
|
18
|
-
#Net::DNS::RR::ISDN - DNS ISDN resource record
|
19
|
-
#RFC 1183 Section 3.2
|
20
|
-
class ISDN < RR
|
21
|
-
ClassValue = nil #:nodoc: all
|
22
|
-
TypeValue = Types::ISDN #:nodoc: all
|
23
|
-
|
24
|
-
#The RR's address field.
|
25
|
-
attr_accessor :address
|
26
|
-
|
27
|
-
#The RR's sub-address field.
|
28
|
-
attr_accessor :subaddress
|
29
|
-
|
30
|
-
def from_data(data) #:nodoc: all
|
31
|
-
@address, @subaddress= data
|
32
|
-
end
|
33
|
-
|
34
|
-
def from_string(input) #:nodoc: all
|
35
|
-
address, subaddress = input.split(" ")
|
36
|
-
address.sub!(/^\"/, "")
|
37
|
-
@address = address.sub(/\"$/, "")
|
38
|
-
if (subaddress)
|
39
|
-
subaddress.sub!(/^\"/, "")
|
40
|
-
@subaddress = subaddress.sub(/\"$/, "")
|
41
|
-
else
|
42
|
-
@subaddress = nil
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def rdata_to_string #:nodoc: all
|
47
|
-
return "#{@address} #{@subaddress}"
|
48
|
-
end
|
49
|
-
|
50
|
-
def encode_rdata(msg, canonical=false) #:nodoc: all
|
51
|
-
msg.put_string(@address)
|
52
|
-
msg.put_string(@subaddress)
|
53
|
-
end
|
54
|
-
|
55
|
-
def self.decode_rdata(msg) #:nodoc: all
|
56
|
-
address = msg.get_string
|
57
|
-
subaddress = msg.get_string
|
58
|
-
return self.new([address, subaddress])
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
1
|
+
# --
|
2
|
+
# Copyright 2007 Nominet UK
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
# ++
|
16
|
+
module Dnsruby
|
17
|
+
class RR
|
18
|
+
# Net::DNS::RR::ISDN - DNS ISDN resource record
|
19
|
+
# RFC 1183 Section 3.2
|
20
|
+
class ISDN < RR
|
21
|
+
ClassValue = nil #:nodoc: all
|
22
|
+
TypeValue = Types::ISDN #:nodoc: all
|
23
|
+
|
24
|
+
# The RR's address field.
|
25
|
+
attr_accessor :address
|
26
|
+
|
27
|
+
# The RR's sub-address field.
|
28
|
+
attr_accessor :subaddress
|
29
|
+
|
30
|
+
def from_data(data) #:nodoc: all
|
31
|
+
@address, @subaddress= data
|
32
|
+
end
|
33
|
+
|
34
|
+
def from_string(input) #:nodoc: all
|
35
|
+
address, subaddress = input.split(" ")
|
36
|
+
address.sub!(/^\"/, "")
|
37
|
+
@address = address.sub(/\"$/, "")
|
38
|
+
if (subaddress)
|
39
|
+
subaddress.sub!(/^\"/, "")
|
40
|
+
@subaddress = subaddress.sub(/\"$/, "")
|
41
|
+
else
|
42
|
+
@subaddress = nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def rdata_to_string #:nodoc: all
|
47
|
+
return "#{@address} #{@subaddress}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def encode_rdata(msg, canonical=false) #:nodoc: all
|
51
|
+
msg.put_string(@address)
|
52
|
+
msg.put_string(@subaddress)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.decode_rdata(msg) #:nodoc: all
|
56
|
+
address = msg.get_string
|
57
|
+
subaddress = msg.get_string
|
58
|
+
return self.new([address, subaddress])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|