Class: Dnsruby::RR::IN::PX
- Inherits:
-
Dnsruby::RR
- Object
- Dnsruby::RR
- Dnsruby::RR::IN::PX
- Defined in:
- lib/dnsruby/resource/PX.rb
Constant Summary
Constants inherited from Dnsruby::RR
Instance Attribute Summary collapse
-
#map822 ⇒ Object
The RFC822 part of the RFC1327 mapping information.
-
#mapx400 ⇒ Object
The X.400 part of the RFC1327 mapping information.
-
#preference ⇒ Object
The preference given to this RR.
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
#map822 ⇒ Object
The RFC822 part of the RFC1327 mapping information.
25 26 27 |
# File 'lib/dnsruby/resource/PX.rb', line 25 def map822 @map822 end |
#mapx400 ⇒ Object
The X.400 part of the RFC1327 mapping information.
27 28 29 |
# File 'lib/dnsruby/resource/PX.rb', line 27 def mapx400 @mapx400 end |
#preference ⇒ Object
The preference given to this RR.
23 24 25 |
# File 'lib/dnsruby/resource/PX.rb', line 23 def preference @preference end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc: all
62 63 64 65 66 67 |
# File 'lib/dnsruby/resource/PX.rb', line 62 def self.decode_rdata(msg) #:nodoc: all preference, = msg.get_unpack('n') map822 = msg.get_name mapx400 = msg.get_name return self.new([preference, map822, mapx400]) end |
Instance Method Details
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all
56 57 58 59 60 |
# File 'lib/dnsruby/resource/PX.rb', line 56 def encode_rdata(msg, canonical=false) #:nodoc: all msg.put_pack('n', @preference) msg.put_name(@map822, canonical) msg.put_name(@mapx400, canonical) end |
#from_data(data) ⇒ Object
:nodoc: all
35 36 37 |
# File 'lib/dnsruby/resource/PX.rb', line 35 def from_data(data) #:nodoc: all @preference, @map822, @mapx400 = data end |
#from_hash(hash) ⇒ Object
:nodoc: all
29 30 31 32 33 |
# File 'lib/dnsruby/resource/PX.rb', line 29 def from_hash(hash) #:nodoc: all @preference = hash[:preference] @map822 = Name.create(hash[:map822]) @mapx400 = Name.create(hash[:mapx400]) end |
#from_string(input) ⇒ Object
:nodoc: all
39 40 41 42 43 44 45 46 |
# File 'lib/dnsruby/resource/PX.rb', line 39 def from_string(input) #:nodoc: all if (input.length > 0) names = input.split(" ") @preference = names[0].to_i @map822 = Name.create(names[1]) @mapx400 = Name.create(names[2]) end end |
#rdata_to_string ⇒ Object
:nodoc: all
48 49 50 51 52 53 54 |
# File 'lib/dnsruby/resource/PX.rb', line 48 def rdata_to_string #:nodoc: all if (@preference!=nil) return "#{@preference} #{@map822.to_s(true)} #{@mapx400.to_s(true)}" else return "" end end |