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
#<=>, #==, #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
#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
89 90 91 92 93 94 95 96 97 |
# File 'lib/dnsruby/resource/NAPTR.rb', line 89 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
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/dnsruby/resource/NAPTR.rb', line 78 def encode_rdata(msg, canonical=false) #:nodoc: all if (@order != nil) 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, true) end 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
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dnsruby/resource/NAPTR.rb', line 54 def from_string(input) #:nodoc: all if (input.strip.length > 0) values = input.split(" ") @order = values [0].to_i @preference = values [1].to_i @flags = values [2].gsub!("\"", "") @service = values [3].gsub!("\"", "") @regexp = TXT.parse(values[4])[0] @replacement = Name.create(values[5]) end end |
#rdata_to_string ⇒ Object
:nodoc: all
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/dnsruby/resource/NAPTR.rb', line 66 def rdata_to_string #:nodoc: all if (@order!=nil) ret = "#{@order} #{@preference} \"#{@flags}\" \"#{@service}\" \"" ret += TXT.display(@regexp) ret += "\" #{@replacement.to_s(true)}" return ret else return "" end end |