Class: Dnsruby::RR::NAPTR
- Inherits:
-
Dnsruby::RR
- Object
- Dnsruby::RR
- Dnsruby::RR::NAPTR
- Defined in:
- lib/Dnsruby/resource/NAPTR.rb
Overview
Class for DNS Naming Authority Pointer (NAPTR) resource records. RFC 2168
Constant Summary collapse
Constants inherited from Dnsruby::RR
Instance Attribute Summary collapse
-
#flags ⇒ Object
The NAPTR RR flags field.
-
#order ⇒ Object
The NAPTR RR order field.
-
#preference ⇒ Object
The NAPTR RR preference field.
-
#regexp ⇒ Object
The NAPTR RR regexp field.
-
#replacement ⇒ Object
The NAPTR RR replacement field.
-
#service ⇒ Object
The NAPTR RR service field.
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
#==, create, #eql?, get_class, #hash, implemented_rrs, #init_defaults, new_from_data, new_from_hash, new_from_string, #rdlength, #sameRRset, #to_s
Instance Attribute Details
#flags ⇒ Object
The NAPTR RR flags field
29 30 31 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 29 def flags @flags end |
#order ⇒ Object
The NAPTR RR order field
25 26 27 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 25 def order @order end |
#preference ⇒ Object
The NAPTR RR preference field
27 28 29 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 27 def preference @preference end |
#regexp ⇒ Object
The NAPTR RR regexp field
33 34 35 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 33 def regexp @regexp end |
#replacement ⇒ Object
The NAPTR RR replacement field
35 36 37 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 35 def replacement @replacement end |
#service ⇒ Object
The NAPTR RR service field
31 32 33 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 31 def service @service end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc: all
79 80 81 82 83 84 85 86 87 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 79 def self.decode_rdata(msg) #:nodoc: all order, = msg.get_unpack('n') preference, = msg.get_unpack('n') flags, = msg.get_string service, = msg.get_string regexp, = msg.get_string replacement = msg.get_name return self.new([order, preference, flags, service, regexp, replacement]) end |
Instance Method Details
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all
70 71 72 73 74 75 76 77 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 70 def encode_rdata(msg, canonical=false) #:nodoc: all msg.put_pack('n', @order) msg.put_pack('n', @preference) msg.put_string(@flags) msg.put_string(@service) msg.put_string(@regexp) msg.put_name(@replacement, canonical) end |
#from_data(data) ⇒ Object
:nodoc: all
46 47 48 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 46 def from_data(data) #:nodoc: all @order, @preference, @flags, @service, @regexp, @replacement = data end |
#from_hash(hash) ⇒ Object
:nodoc: all
37 38 39 40 41 42 43 44 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 37 def from_hash(hash) #:nodoc: all @order = hash[:order] @preference = hash[:preference] @flags = hash[:flags] @service = hash[:service] @regexp = hash[:regexp] @replacement = Name.create(hash[:replacement]) end |
#from_string(input) ⇒ Object
:nodoc: all
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 50 def from_string(input) #:nodoc: all if (input.length > 0) values = input.split(" ") @order = values [0] @preference = values [1] @flags = values [2] @service = values [3] @regexp = values [4] @replacement = Name.create(values[5]) end end |
#rdata_to_string ⇒ Object
:nodoc: all
62 63 64 65 66 67 68 |
# File 'lib/Dnsruby/resource/NAPTR.rb', line 62 def rdata_to_string #:nodoc: all if (@order!=nil) return "#{@order} #{@preference} #{@flags} #{@service} #{@regexp} #{@replacement}" else return "" end end |