using System; namespace DnsClient.Protocol { /* https://tools.ietf.org/html/rfc1035#section-3.3.9 3.3.9. MX RDATA format +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ | 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 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]. */ /// /// A represending a mail exchange. /// /// RFC 1035 /// RFC 974 public class MxRecord : DnsResourceRecord { /// /// Gets a 16 bit integer which specifies the preference given to /// this RR among others at the same owner. /// Lower values are preferred. /// public ushort Preference { get; } /// /// A domain name which specifies a host willing to act as a mail exchange. /// public DnsString Exchange { get; } /// /// Initializes a new instance of the class. /// /// The information. /// The preference. /// Name of the domain. /// If or is null. public MxRecord(ResourceRecordInfo info, ushort preference, DnsString domainName) : base(info) { Preference = preference; Exchange = domainName ?? throw new ArgumentNullException(nameof(domainName)); } private protected override string RecordToString() { return string.Format("{0} {1}", Preference, Exchange); } } }