Class: DNS::Zone::RR::RRSIG

Inherits:
Record
  • Object
show all
Defined in:
lib/dns/zone/rr/rrsig.rb

Overview

`RRSIG` resource record.

RFC 4034

Constant Summary collapse

REGEX_RRSIG_RDATA =
%r{
  (?<type_covered>\S+)\s*
  (?<algorithm>\d+)\s*
  (?<labels>\d+)\s*
  (?<original_ttl>#{DNS::Zone::RR::REGEX_TTL})\s*
  (?<signature_expiration>\d+)\s*
  (?<signature_inception>\d+)\s*
  (?<key_tag>\d+)\s*
  (?<signer>#{DNS::Zone::RR::REGEX_DOMAINNAME})\s*
  (?<signature>#{DNS::Zone::RR::REGEX_CHARACTER_STRING})\s*
}mx

Instance Attribute Summary collapse

Attributes inherited from Record

#klass, #label, #ttl

Instance Method Summary collapse

Methods inherited from Record

#general_prefix, #initialize, #load_general_and_get_rdata, #type

Constructor Details

This class inherits a constructor from DNS::Zone::RR::Record

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def algorithm
  @algorithm
end

#key_tagObject

Returns the value of attribute key_tag


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def key_tag
  @key_tag
end

#labelsObject

Returns the value of attribute labels


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def labels
  @labels
end

#original_ttlObject

Returns the value of attribute original_ttl


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def original_ttl
  @original_ttl
end

#signatureObject

Returns the value of attribute signature


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def signature
  @signature
end

#signature_expirationObject

Returns the value of attribute signature_expiration


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def signature_expiration
  @signature_expiration
end

#signature_inceptionObject

Returns the value of attribute signature_inception


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def signature_inception
  @signature_inception
end

#signerObject

Returns the value of attribute signer


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def signer
  @signer
end

#type_coveredObject

Returns the value of attribute type_covered


18
19
20
# File 'lib/dns/zone/rr/rrsig.rb', line 18

def type_covered
  @type_covered
end

Instance Method Details

#dumpObject


21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dns/zone/rr/rrsig.rb', line 21

def dump
  parts = general_prefix
  parts << type_covered
  parts << algorithm
  parts << labels
  parts << original_ttl
  parts << signature_expiration
  parts << signature_inception
  parts << key_tag
  parts << signer
  parts << signature
  parts.join(' ')
end

#load(string, options = {}) ⇒ Object


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/dns/zone/rr/rrsig.rb', line 35

def load(string, options = {})
  rdata = load_general_and_get_rdata(string, options)
  return nil unless rdata

  captures = rdata.match(REGEX_RRSIG_RDATA)
  return nil unless captures

  @type_covered = captures[:type_covered]
  @algorithm = captures[:algorithm].to_i
  @labels = captures[:labels].to_i
  @original_ttl = captures[:original_ttl].to_i
  @signature_expiration = captures[:signature_expiration].to_i
  @signature_inception = captures[:signature_inception].to_i
  @key_tag = captures[:key_tag].to_i
  @signer = captures[:signer]
  @signature = captures[:signature]
  self
end