Class: Dnsruby::RR::SOA

Inherits:
Dnsruby::RR show all
Defined in:
lib/dnsruby/resource/SOA.rb

Constant Summary collapse

ClassValue =

:nodoc: all

nil
TypeValue =

:nodoc: all

Types::SOA

Constants inherited from Dnsruby::RR

ClassInsensitiveTypes

Instance Attribute Summary collapse

Attributes inherited from Dnsruby::RR

#klass, #name, #rdata, #ttl, #type

Class Method Summary collapse

Instance Method Summary collapse

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

#expireObject

The zone’s expire interval. How often, in seconds, a secondary nameserver is to use the data before refreshing from the primary nameserver



41
42
43
# File 'lib/dnsruby/resource/SOA.rb', line 41

def expire
  @expire
end

#minimumObject

The minimum (default) TTL for records in this zone.



43
44
45
# File 'lib/dnsruby/resource/SOA.rb', line 43

def minimum
  @minimum
end

#mnameObject

The domain name of the original or primary nameserver for this zone.



24
25
26
# File 'lib/dnsruby/resource/SOA.rb', line 24

def mname
  @mname
end

#refreshObject

The zone’s refresh interval. How often, in seconds, a secondary nameserver is to check for updates from the primary nameserver.



33
34
35
# File 'lib/dnsruby/resource/SOA.rb', line 33

def refresh
  @refresh
end

#retryObject

The zone’s retry interval. How often, in seconds, a secondary nameserver is to retry, after a failure to check for a refresh



37
38
39
# File 'lib/dnsruby/resource/SOA.rb', line 37

def retry
  @retry
end

#rnameObject

A domain name that specifies the mailbox for the person responsible for this zone.



27
28
29
# File 'lib/dnsruby/resource/SOA.rb', line 27

def rname
  @rname
end

#serialObject

The zone’s serial number.



29
30
31
# File 'lib/dnsruby/resource/SOA.rb', line 29

def serial
  @serial
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc: all



86
87
88
89
90
91
92
# File 'lib/dnsruby/resource/SOA.rb', line 86

def self.decode_rdata(msg) #:nodoc: all
  mname = msg.get_name
  rname = msg.get_name
  serial, refresh, retry_, expire, minimum = msg.get_unpack('NNNNN')
  return self.new(
                  [mname, rname, serial, refresh, retry_, expire, minimum])
end

Instance Method Details

#encode_rdata(msg, canonical = false) ⇒ Object

:nodoc: all



80
81
82
83
84
# File 'lib/dnsruby/resource/SOA.rb', line 80

def encode_rdata(msg, canonical=false) #:nodoc: all
  msg.put_name(@mname, canonical)
  msg.put_name(@rname, canonical)
  msg.put_pack('NNNNN', @serial, @refresh, @retry, @expire, @minimum)
end

#from_data(data) ⇒ Object

:nodoc: all



45
46
47
# File 'lib/dnsruby/resource/SOA.rb', line 45

def from_data(data) #:nodoc: all
  @mname, @rname, @serial, @refresh, @retry, @expire, @minimum = data
end

#from_hash(hash) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/dnsruby/resource/SOA.rb', line 49

def from_hash(hash)
  @mname = Name.create(hash[:mname])
  @rname = Name.create(hash[:rname])
  @serial = hash[:serial].to_i
  @refresh = hash[:refresh].to_i
  @retry = hash[:retry].to_i
  @expire = hash[:expire].to_i
  @minimum = hash[:minimum].to_i
end

#from_string(input) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/dnsruby/resource/SOA.rb', line 59

def from_string(input)
  if (input.length > 0)
    names = input.split(" ")
    @mname = Name.create(names[0])
    @rname = Name.create(names[1])
    @serial = names[2].to_i
    @refresh = names[3].to_i
    @retry = names[4].to_i
    @expire = names[5].to_i
    @minimum = names[6].to_i
  end
end

#rdata_to_stringObject

:nodoc: all



72
73
74
75
76
77
78
# File 'lib/dnsruby/resource/SOA.rb', line 72

def rdata_to_string #:nodoc: all
  if (@mname!=nil)
    return "#{@mname.to_s(true)} #{@rname.to_s(true)} #{@serial} #{@refresh} #{@retry} #{@expire} #{@minimum}"
  else
    return ""
  end
end