Class: DNS::ResourceRecord::IN::MX

Inherits:
Data
  • Object
show all
Defined in:
lib/faildns/resourcerecord/IN/MX.rb

Overview

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|                  PREFERENCE                   |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/                   EXCHANGE                    /
/                                               /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:

PREFERENCE A 16 bit integer which specifies the preference given to

this RR among others at the same owner.  Lower values
are preferred.

EXCHANGE A <domain-name> which specifies a host willing to act as

a mail exchange for the owner name.

MX records cause type A additional section processing for the host specified by EXCHANGE. The use of MX RRs is explained in detail in [RFC-974]. ++

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Data

parse

Constructor Details

#initialize(preference, exchange) ⇒ MX

Returns a new instance of MX.



57
58
59
60
# File 'lib/faildns/resourcerecord/IN/MX.rb', line 57

def initialize (preference, exchange)
  @preference = preference
  @exchange   = exchange
end

Instance Attribute Details

#exchangeObject (readonly)

Returns the value of attribute exchange.



55
56
57
# File 'lib/faildns/resourcerecord/IN/MX.rb', line 55

def exchange
  @exchange
end

#preferenceObject (readonly)

Returns the value of attribute preference.



55
56
57
# File 'lib/faildns/resourcerecord/IN/MX.rb', line 55

def preference
  @preference
end

Class Method Details

._parse(string, original) ⇒ Object



51
52
53
# File 'lib/faildns/resourcerecord/IN/MX.rb', line 51

def self._parse (string, original)
  MX.new(string.unpack('n'), DomainName.parse(string[2, 255], original))
end

Instance Method Details

#packObject



62
63
64
# File 'lib/faildns/resourcerecord/IN/MX.rb', line 62

def pack
  [@preference].pack('n') + @exchange.pack
end

#to_sObject



66
67
68
# File 'lib/faildns/resourcerecord/IN/MX.rb', line 66

def to_s
  "#{@preference}) #{@exchange}"
end