Class: Dnsruby::RR::CAA
- Inherits:
-
Dnsruby::RR
- Object
- Dnsruby::RR
- Dnsruby::RR::CAA
- Defined in:
- lib/dnsruby/resource/CAA.rb
Overview
Class for CAA resource records. RFC 6844
Constant Summary collapse
Constants inherited from Dnsruby::RR
Instance Attribute Summary collapse
- #flag ⇒ Object
-
#property_tag ⇒ Object
The property tag for the record (issue|issuewild|iodef).
-
#property_value ⇒ Object
The value for the property_tag.
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
#flag ⇒ Object
41 42 43 |
# File 'lib/dnsruby/resource/CAA.rb', line 41 def flag @flag.to_i end |
#property_tag ⇒ Object
The property tag for the record (issue|issuewild|iodef)
25 26 27 |
# File 'lib/dnsruby/resource/CAA.rb', line 25 def property_tag @property_tag end |
#property_value ⇒ Object
The value for the property_tag
27 28 29 |
# File 'lib/dnsruby/resource/CAA.rb', line 27 def property_value @property_value end |
Class Method Details
.decode_rdata(msg) ⇒ Object
:nodoc: all
66 67 68 69 70 71 72 |
# File 'lib/dnsruby/resource/CAA.rb', line 66 def self.decode_rdata(msg) #:nodoc: all flag, = msg.get_unpack('C') property_tag = msg.get_string # The final string has no length byte - its length is implicit as the remainder of the packet length property_value = msg.get_bytes return self.new("#{flag} #{property_tag} \"#{property_value}\"") end |
Instance Method Details
#encode_rdata(msg, canonical = false) ⇒ Object
:nodoc: all
59 60 61 62 63 64 |
# File 'lib/dnsruby/resource/CAA.rb', line 59 def encode_rdata(msg, canonical=false) #:nodoc: all msg.put_pack('C', flag) msg.put_string(@property_tag) # We don't put a length byte on the final string. msg.put_bytes(@property_value) end |
#from_data(data) ⇒ Object
:nodoc: all
37 38 39 |
# File 'lib/dnsruby/resource/CAA.rb', line 37 def from_data(data) #:nodoc: all @flag, @property_tag, @property_value = data end |
#from_hash(hash) ⇒ Object
:nodoc: all
31 32 33 34 35 |
# File 'lib/dnsruby/resource/CAA.rb', line 31 def from_hash(hash) #:nodoc: all @property_tag = hash[:property_tag] @property_value = hash[:property_value] @flag = hash[:flag] end |
#from_string(input) ⇒ Object
:nodoc: all
45 46 47 48 49 50 51 52 53 |
# File 'lib/dnsruby/resource/CAA.rb', line 45 def from_string(input) #:nodoc: all matches = (/(\d+) (issuewild|issuemail|issue|iodef|contactemail|contactphone) "(.+)"$/).match(input) if matches.nil? raise DecodeError.new("Cannot parse record: #{input[0...1000]}") end @flag = matches[1] @property_tag = matches[2] @property_value = matches[3] end |
#rdata_to_string ⇒ Object
:nodoc: all
55 56 57 |
# File 'lib/dnsruby/resource/CAA.rb', line 55 def rdata_to_string #:nodoc: all "#{flag} #{@property_tag} \"#{@property_value}\"" end |