Class: Dnsruby::RR::RT
- Inherits:
-
Dnsruby::RR
- Object
- Dnsruby::RR
- Dnsruby::RR::RT
- Defined in:
- lib/dnsruby/resource/RT.rb
Overview
Class for DNS Route Through (RT) resource records. RFC 1183 Section 3.3
Constant Summary collapse
Constants inherited from Dnsruby::RR
Instance Attribute Summary collapse
-
#intermediate ⇒ Object
The domain name of the intermediate host.
-
#preference ⇒ Object
The preference for this route.
Attributes inherited from Dnsruby::RR
#klass, #name, #rdata, #ttl, #type
Class Method Summary collapse
-
.decode_rdata(msg) ⇒ Object
:nodoc: all.
Instance Method Summary collapse
-
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all.
-
#from_data(data) ⇒ Object
:nodoc: all.
-
#from_hash(hash) ⇒ Object
:nodoc: all.
-
#from_string(input) ⇒ Object
:nodoc: all.
-
#rdata_to_string ⇒ Object
:nodoc: all.
Methods inherited from Dnsruby::RR
#<=>, #==, #clone, create, #eql?, find_class, get_class, get_num, #hash, implemented_rrs, #init_defaults, new_from_data, new_from_hash, new_from_string, #rdlength, #sameRRset, #to_s
Instance Attribute Details
#intermediate ⇒ Object
The domain name of the intermediate host.
28 29 30 |
# File 'lib/dnsruby/resource/RT.rb', line 28 def intermediate @intermediate end |
#preference ⇒ Object
The preference for this route.
25 26 27 |
# File 'lib/dnsruby/resource/RT.rb', line 25 def preference @preference end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc: all
60 61 62 63 64 |
# File 'lib/dnsruby/resource/RT.rb', line 60 def self.decode_rdata(msg) #:nodoc: all preference, = msg.get_unpack('n') intermediate = msg.get_name return self.new([preference, intermediate]) end |
Instance Method Details
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all
55 56 57 58 |
# File 'lib/dnsruby/resource/RT.rb', line 55 def encode_rdata(msg, canonical = false) #:nodoc: all msg.put_pack('n', @preference) msg.put_name(@intermediate, canonical) end |
#from_data(data) ⇒ Object
:nodoc: all
35 36 37 |
# File 'lib/dnsruby/resource/RT.rb', line 35 def from_data(data) #:nodoc: all @preference, @intermediate = data end |
#from_hash(hash) ⇒ Object
:nodoc: all
30 31 32 33 |
# File 'lib/dnsruby/resource/RT.rb', line 30 def from_hash(hash) #:nodoc: all @preference = hash[:preference] @intermediate = Name.create(hash[:intermediate]) end |
#from_string(input) ⇒ Object
:nodoc: all
39 40 41 42 43 44 45 |
# File 'lib/dnsruby/resource/RT.rb', line 39 def from_string(input) #:nodoc: all if (input.length > 0) names = input.split(" ") @preference = names[0].to_i @intermediate = Name.create(names[1]) end end |
#rdata_to_string ⇒ Object
:nodoc: all
47 48 49 50 51 52 53 |
# File 'lib/dnsruby/resource/RT.rb', line 47 def rdata_to_string #:nodoc: all if (@preference!=nil) return "#{@preference} #{@intermediate.to_s(true)}" else return "" end end |