namespace Swan.Net.Dns { using System.Collections.Generic; /// /// Represents a response from a DNS server. /// public class DnsQueryResult { private readonly List _mAnswerRecords = new List(); private readonly List _mAdditionalRecords = new List(); private readonly List _mAuthorityRecords = new List(); /// /// Initializes a new instance of the class. /// /// The response. internal DnsQueryResult(DnsClient.IDnsResponse response) : this() { this.Id = response.Id; this.IsAuthoritativeServer = response.IsAuthorativeServer; this.IsRecursionAvailable = response.IsRecursionAvailable; this.IsTruncated = response.IsTruncated; this.OperationCode = response.OperationCode; this.ResponseCode = response.ResponseCode; if(response.AnswerRecords != null) { foreach(DnsClient.IDnsResourceRecord record in response.AnswerRecords) { this.AnswerRecords.Add(new DnsRecord(record)); } } if(response.AuthorityRecords != null) { foreach(DnsClient.IDnsResourceRecord record in response.AuthorityRecords) { this.AuthorityRecords.Add(new DnsRecord(record)); } } if(response.AdditionalRecords != null) { foreach(DnsClient.IDnsResourceRecord record in response.AdditionalRecords) { this.AdditionalRecords.Add(new DnsRecord(record)); } } } private DnsQueryResult() { } /// /// Gets the identifier. /// /// /// The identifier. /// public System.Int32 Id { get; } /// /// Gets a value indicating whether this instance is authoritative server. /// /// /// true if this instance is authoritative server; otherwise, false. /// public System.Boolean IsAuthoritativeServer { get; } /// /// Gets a value indicating whether this instance is truncated. /// /// /// true if this instance is truncated; otherwise, false. /// public System.Boolean IsTruncated { get; } /// /// Gets a value indicating whether this instance is recursion available. /// /// /// true if this instance is recursion available; otherwise, false. /// public System.Boolean IsRecursionAvailable { get; } /// /// Gets the operation code. /// /// /// The operation code. /// public DnsOperationCode OperationCode { get; } /// /// Gets the response code. /// /// /// The response code. /// public DnsResponseCode ResponseCode { get; } /// /// Gets the answer records. /// /// /// The answer records. /// public IList AnswerRecords => this._mAnswerRecords; /// /// Gets the additional records. /// /// /// The additional records. /// public IList AdditionalRecords => this._mAdditionalRecords; /// /// Gets the authority records. /// /// /// The authority records. /// public IList AuthorityRecords => this._mAuthorityRecords; } }