internal static bool TryRead(out DnsDomainName first, out DnsDomainName second, DnsDatagram dns, int offsetInDns, int length) { List<DnsDomainName> domainNames = ReadDomainNames(dns, offsetInDns, length, NumDomains); if (domainNames == null || domainNames.Count != NumDomains) { first = null; second = null; return false; } first = domainNames[0]; second = domainNames[1]; return true; }
internal DnsResourceData2DomainNames(DnsDomainName first, DnsDomainName second) : base(first, second) { }
/// <summary> /// Constructs mail exchange resource data from preference and host. /// </summary> /// <param name="preference"> /// Specifies the preference given to this RR among others at the same owner. /// Lower values are preferred. /// </param> /// <param name="mailExchangeHost"> /// Specifies a host willing to act as a mail exchange for the owner name. /// </param> public DnsResourceDataMailExchange(ushort preference, DnsDomainName mailExchangeHost) : base(preference, mailExchangeHost) { }
private static string GetWiresharkDomainName(DnsDomainName domainName) { if (domainName.IsRoot) return "<Root>"; return domainName.ToString().TrimEnd('.'); }
/// <summary> /// Constructs a key exchanger resource data from the given preference and key exchanger domain. /// </summary> /// <param name="preference"> /// Specifies the preference given to this RR among other KX records at the same owner. /// Lower values are preferred. /// </param> /// <param name="keyExchanger"> /// Specifies a host willing to act as a key exchange for the owner name. /// </param> public DnsResourceDataKeyExchanger(ushort preference, DnsDomainName keyExchanger) : base(preference, keyExchanger) { }
/// <summary> /// Constructs a mailing list info resource data from mailing list and error mailbox. /// </summary> /// <param name="mailingList"> /// Specifies a mailbox which is responsible for the mailing list or mailbox. /// If this domain name names the root, the owner of the MINFO RR is responsible for itself. /// Note that many existing mailing lists use a mailbox X-request for the RMAILBX field of mailing list X, e.g., Msgroup-request for Msgroup. /// This field provides a more general mechanism. /// </param> /// <param name="errorMailbox"> /// Specifies a mailbox which is to receive error messages related to the mailing list or mailbox specified by the owner of the MINFO RR /// (similar to the ERRORS-TO: field which has been proposed). /// If this domain name names the root, errors should be returned to the sender of the message. /// </param> public DnsResourceDataMailingListInfo(DnsDomainName mailingList, DnsDomainName errorMailbox) : base(mailingList, errorMailbox) { }
internal DnsOptResourceRecord(DnsDomainName domainName, DnsClass dnsClass, int ttl, DnsResourceData data) : base(domainName, DnsType.Opt, dnsClass, ttl, data) { }
/// <summary> /// Constructs a responsible person resource data from the given mailbox and text domain. /// </summary> /// <param name="mailbox"> /// A domain name that specifies the mailbox for the responsible person. /// Its format in master files uses the DNS convention for mailbox encoding, identical to that used for the RNAME mailbox field in the SOA RR. /// The root domain name (just ".") may be specified for Mailbox to indicate that no mailbox is available. /// </param> /// <param name="textDomain"> /// A domain name for which TXT RR's exist. /// A subsequent query can be performed to retrieve the associated TXT resource records at TextDomain. /// This provides a level of indirection so that the entity can be referred to from multiple places in the DNS. /// The root domain name (just ".") may be specified for TextDomain to indicate that the TXT_DNAME is absent, and no associated TXT RR exists. /// </param> public DnsResourceDataResponsiblePerson(DnsDomainName mailbox, DnsDomainName textDomain) : base(mailbox, textDomain) { }
/// <summary> /// Constructs mail exchange resource data from preference and host. /// </summary> /// <param name="preference"> /// Specifies the preference given to this RR among others at the same owner. /// Lower values are preferred. /// </param> /// <param name="mailExchangeHost"> /// Specifies a host willing to act as a mail exchange for the owner name. /// </param> public DnsResourceDataMailExchange(ushort preference, DnsDomainName mailExchangeHost) : base(preference, mailExchangeHost) { }
public DnsResourceDataRouteThrough(ushort preference, DnsDomainName intermediateHost) : base(preference, intermediateHost) { }
internal DnsResourceRecord(DnsDomainName domainName, DnsType type, DnsClass dnsClass) { DomainName = domainName; DnsType = type; DnsClass = dnsClass; }
internal static bool TryParseBase(DnsDatagram dns, int offsetInDns, out DnsDomainName domainName, out DnsType type, out DnsClass dnsClass, out int numBytesRead) { type = DnsType.Any; dnsClass = DnsClass.Any; if (!DnsDomainName.TryParse(dns, offsetInDns, dns.Length - offsetInDns, out domainName, out numBytesRead)) return false; if (offsetInDns + numBytesRead + MinimumLengthAfterDomainName > dns.Length) return false; type = (DnsType)dns.ReadUShort(offsetInDns + numBytesRead + OffsetAfterDomainName.Type, Endianity.Big); dnsClass = (DnsClass)dns.ReadUShort(offsetInDns + numBytesRead + OffsetAfterDomainName.DnsClass, Endianity.Big); numBytesRead += MinimumLengthAfterDomainName; return true; }
/// <summary> /// Constructs a responsible person resource data from the given mailbox and text domain. /// </summary> /// <param name="mailbox"> /// A domain name that specifies the mailbox for the responsible person. /// Its format in master files uses the DNS convention for mailbox encoding, identical to that used for the RNAME mailbox field in the SOA RR. /// The root domain name (just ".") may be specified for Mailbox to indicate that no mailbox is available. /// </param> /// <param name="textDomain"> /// A domain name for which TXT RR's exist. /// A subsequent query can be performed to retrieve the associated TXT resource records at TextDomain. /// This provides a level of indirection so that the entity can be referred to from multiple places in the DNS. /// The root domain name (just ".") may be specified for TextDomain to indicate that the TXT_DNAME is absent, and no associated TXT RR exists. /// </param> public DnsResourceDataResponsiblePerson(DnsDomainName mailbox, DnsDomainName textDomain) : base(mailbox, textDomain) { }
public DnsResourceDataAfsDatabase(DnsAfsDatabaseSubtype subtype, DnsDomainName hostName) : base((ushort)subtype, hostName) { }
/// <summary> /// Constructs a route through resource data from the given preference and intermediate host. /// </summary> /// <param name="preference"> /// Representing the preference of the route. /// Smaller numbers indicate more preferred routes. /// </param> /// <param name="intermediateHost"> /// The domain name of a host which will serve as an intermediate in reaching the host specified by the owner. /// The DNS RRs associated with IntermediateHost are expected to include at least one A, X25, or ISDN record. /// </param> public DnsResourceDataRouteThrough(ushort preference, DnsDomainName intermediateHost) : base(preference, intermediateHost) { }
/// <summary> /// Constructs a mailing list info resource data from mailing list and error mailbox. /// </summary> /// <param name="mailingList"> /// Specifies a mailbox which is responsible for the mailing list or mailbox. /// If this domain name names the root, the owner of the MINFO RR is responsible for itself. /// Note that many existing mailing lists use a mailbox X-request for the RMAILBX field of mailing list X, e.g., Msgroup-request for Msgroup. /// This field provides a more general mechanism. /// </param> /// <param name="errorMailbox"> /// Specifies a mailbox which is to receive error messages related to the mailing list or mailbox specified by the owner of the MINFO RR /// (similar to the ERRORS-TO: field which has been proposed). /// If this domain name names the root, errors should be returned to the sender of the message. /// </param> public DnsResourceDataMailingListInfo(DnsDomainName mailingList, DnsDomainName errorMailbox) : base(mailingList, errorMailbox) { }
public void DnsDomainNameConstructorNullStringTest() { DnsDomainName domainName = new DnsDomainName(null); Assert.IsNotNull(domainName); Assert.Fail(); }
public DnsResourceDataKeyExchanger(ushort preference, DnsDomainName keyExchanger) : base(preference, keyExchanger) { }
/// <summary> /// Constructs an AFS database resource data from the given subtype and host name. /// </summary> /// <param name="subtype">The subtype of the resource data.</param> /// <param name="hostName">A host that has a server for the cell named by the owner name of the RR.</param> public DnsResourceDataAfsDatabase(DnsAfsDatabaseSubtype subtype, DnsDomainName hostName) : base((ushort)subtype, hostName) { }
public DnsOptResourceRecord(DnsDomainName domainName, ushort sendersUdpPayloadSize, byte extendedReturnCode, DnsOptVersion version, DnsOptFlags flags, DnsResourceDataOptions data) : this(domainName, (DnsClass)sendersUdpPayloadSize, (int)BitSequence.Merge(extendedReturnCode, (byte)version, (ushort)flags), data) { }