Class Dnsruby::RR
In: lib/Dnsruby/resource/A.rb
lib/Dnsruby/resource/AAAA.rb
lib/Dnsruby/resource/AFSDB.rb
lib/Dnsruby/resource/CERT.rb
lib/Dnsruby/resource/DHCID.rb
lib/Dnsruby/resource/DLV.rb
lib/Dnsruby/resource/DNSKEY.rb
lib/Dnsruby/resource/domain_name.rb
lib/Dnsruby/resource/DS.rb
lib/Dnsruby/resource/generic.rb
lib/Dnsruby/resource/HINFO.rb
lib/Dnsruby/resource/HIP.rb
lib/Dnsruby/resource/IN.rb
lib/Dnsruby/resource/IPSECKEY.rb
lib/Dnsruby/resource/ISDN.rb
lib/Dnsruby/resource/KX.rb
lib/Dnsruby/resource/LOC.rb
lib/Dnsruby/resource/MINFO.rb
lib/Dnsruby/resource/MX.rb
lib/Dnsruby/resource/NAPTR.rb
lib/Dnsruby/resource/NSAP.rb
lib/Dnsruby/resource/NSEC.rb
lib/Dnsruby/resource/NSEC3.rb
lib/Dnsruby/resource/NSEC3PARAM.rb
lib/Dnsruby/resource/OPT.rb
lib/Dnsruby/resource/PX.rb
lib/Dnsruby/resource/resource.rb
lib/Dnsruby/resource/RP.rb
lib/Dnsruby/resource/RRSIG.rb
lib/Dnsruby/resource/RT.rb
lib/Dnsruby/resource/SOA.rb
lib/Dnsruby/resource/SPF.rb
lib/Dnsruby/resource/SRV.rb
lib/Dnsruby/resource/SSHFP.rb
lib/Dnsruby/resource/TKEY.rb
lib/Dnsruby/resource/TSIG.rb
lib/Dnsruby/resource/TXT.rb
lib/Dnsruby/resource/X25.rb
Parent: Object

Superclass for all Dnsruby resource records.

Represents a DNS RR (resource record) [RFC1035, section 3.2]

Use Dnsruby::RR::create(…) to create a new RR record.

   mx = Dnsruby::RR.create("example.com. 7200 MX 10 mailhost.example.com.")

   rr = Dnsruby::RR.create({:name => "example.com", :type => "MX", :ttl => 7200,
                                  :preference => 10, :exchange => "mailhost.example.com"})

   s = rr.to_s # Get a String representation of the RR (in zone file format)
   rr_again = Dnsruby::RR.create(s)

Methods

Classes and Modules

Module Dnsruby::RR::IN
Class Dnsruby::RR::ANY
Class Dnsruby::RR::CERT
Class Dnsruby::RR::CNAME
Class Dnsruby::RR::DHCID
Class Dnsruby::RR::DLV
Class Dnsruby::RR::DNAME
Class Dnsruby::RR::DNSKEY
Class Dnsruby::RR::DS
Class Dnsruby::RR::DomainName
Class Dnsruby::RR::Generic
Class Dnsruby::RR::HINFO
Class Dnsruby::RR::HIP
Class Dnsruby::RR::IPSECKEY
Class Dnsruby::RR::ISDN
Class Dnsruby::RR::KX
Class Dnsruby::RR::LOC
Class Dnsruby::RR::MB
Class Dnsruby::RR::MG
Class Dnsruby::RR::MINFO
Class Dnsruby::RR::MR
Class Dnsruby::RR::MX
Class Dnsruby::RR::NAPTR
Class Dnsruby::RR::NS
Class Dnsruby::RR::NSAP
Class Dnsruby::RR::NSEC
Class Dnsruby::RR::NSEC3
Class Dnsruby::RR::NSEC3PARAM
Class Dnsruby::RR::PTR
Class Dnsruby::RR::RP
Class Dnsruby::RR::RRSIG
Class Dnsruby::RR::RT
Class Dnsruby::RR::SOA
Class Dnsruby::RR::SPF
Class Dnsruby::RR::SSHFP
Class Dnsruby::RR::TKEY
Class Dnsruby::RR::TSIG
Class Dnsruby::RR::TXT
Class Dnsruby::RR::X25

Constants

ClassInsensitiveTypes = { Types::NS => NS, Types::CNAME => CNAME, Types::DNAME => DNAME, Types::DNSKEY => DNSKEY, Types::SOA => SOA, Types::PTR => PTR, Types::HINFO => HINFO, Types::MINFO => MINFO, Types::MX => MX, Types::TXT => TXT, Types::ISDN => ISDN, Types::MB => MB, Types::MG => MG, Types::MR => MR, Types::NAPTR => NAPTR, Types::NSAP => NSAP, Types::OPT => OPT, Types::RP => RP, Types::RT => RT, Types::X25 => X25, Types::KX => KX, Types::SPF => SPF, Types::CERT => CERT, Types::LOC => LOC, Types::TSIG => TSIG, Types::TKEY => TKEY, Types::ANY => ANY, Types::RRSIG => RRSIG, Types::NSEC => NSEC, Types::DS => DS, Types::NSEC3 => NSEC3, Types::NSEC3PARAM => NSEC3PARAM, Types::DLV => DLV, Types::SSHFP => SSHFP, Types::IPSECKEY => IPSECKEY, Types::HIP => HIP, Types::DHCID => DHCID

External Aliases

type -> rr_type

Attributes

klass  [R]  The Resource class
name  [R]  The Resource‘s domain name
rdata  [RW]  The Resource data section
ttl  [RW]  The Resource Time-To-Live
type  [R]  The Resource type

Public Class methods

Create a new RR from the arguments, which can be either a String or a Hash. See new_from_string and new_from_hash for details

   a     = Dnsruby::RR.create("foo.example.com. 86400 A 10.1.2.3")
   mx    = Dnsruby::RR.create("example.com. 7200 MX 10 mailhost.example.com.")
   cname = Dnsruby::RR.create("www.example.com 300 IN CNAME www1.example.com")
   txt   = Dnsruby::RR.create('baz.example.com 3600 HS TXT "text record"')

   rr = Dnsruby::RR.create({:name => "example.com"})
   rr = Dnsruby::RR.create({:name => "example.com", :type => "MX", :ttl => 10,
                                  :preference => 5, :exchange => "mx1.example.com"})

Return an array of all the currently implemented RR types

Create a new RR from the hash. The name is required; all other fields are optional. Type defaults to ANY and the Class defaults to IN. The TTL defaults to 0.

If the type is specified, then it is necessary to provide ALL of the resource record fields which are specific to that record; i.e. for an MX record, you would need to specify the exchange and the preference

   require 'Dnsruby'
   rr = Dnsruby::RR.new_from_hash({:name => "example.com"})
   rr = Dnsruby::RR.new_from_hash({:name => "example.com", :type => Types.MX, :ttl => 10, :preference => 5, :exchange => "mx1.example.com"})

Returns a Dnsruby::RR object of the appropriate type and initialized from the string passed by the user. The format of the string is that used in zone files, and is compatible with the string returned by Net::DNS::RR.inspect

The name and RR type are required; all other information is optional. If omitted, the TTL defaults to 0 and the RR class defaults to IN.

All names must be fully qualified. The trailing dot (.) is optional.

   a     = Dnsruby::RR.new_from_string("foo.example.com. 86400 A 10.1.2.3")
   mx    = Dnsruby::RR.new_from_string("example.com. 7200 MX 10 mailhost.example.com.")
   cname = Dnsruby::RR.new_from_string("www.example.com 300 IN CNAME www1.example.com")
   txt   = Dnsruby::RR.new_from_string('baz.example.com 3600 HS TXT "text record"')

Public Instance methods

Get a string representation of the data section of the RR (in zone file format)

Determines if two Records could be part of the same RRset. This compares the name, type, and class of the Records; the ttl and rdata are not compared.

Returns a string representation of the RR in zone file format

[Validate]