/// <summary> /// Initialises a new instance of the MXInfo class for a domain that has no /// mail exchanges specified. /// </summary> /// <param name="domain">The domain.</param> public MXInfo(DnsName domain) { Guard.NotNull(domain, "domain"); _domain = domain; _exchanges = EMPTY_EXCHANGES; }
/// <summary> /// Initialises a new instance of the DnsQuestion class and specifies /// the class of query, the query type and the domain being queried. /// </summary> /// <param name="name">The domain to query.</param> /// <param name="type">The type of query.</param> /// <param name="cls">The class of the query.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="name"/> is <see langword="null"/>. /// </exception> public DnsQuestion(DnsName name, DnsQueryType type, DnsQueryClass cls) { Guard.NotNull(name, "name"); _class = cls; _type = type; _name = name; }
/// <summary> /// Initialises a new instance of the MXInfo class and specifies the owner /// domain and the exchanges which are sorted in order of preference. /// </summary> /// <param name="domain">The owner domain.</param> /// <param name="exchanges">The mail exchanges sorted in order of preference.</param> public MXInfo(DnsName domain, DnsName[] exchanges) { Guard.NotNull(domain, "domain"); Guard.NotNull(exchanges, "exchanges"); _domain = domain; _exchanges = exchanges.Length > 0 ? Array.AsReadOnly(exchanges) : EMPTY_EXCHANGES; }
/// <summary> /// Initialises a new instance of the DnsRecord class and specifies the /// owner name, the resource record class and the TTL of the record. /// </summary> /// <param name="owner">The owner name.</param> /// <param name="type">The class of resource record.</param> /// <param name="cls">The class of resource record.</param> /// <param name="ttl">The TTL.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="owner"/> is <see langword="null"/>. /// </exception> protected DnsRecord(DnsName owner, DnsRecordType type, DnsRecordClass cls, TimeSpan ttl) { Guard.NotNull(owner, "owner"); _owner = owner; _type = type; _class = cls; _ttl = ttl; _expires = DnsClock.Now() + ttl; }
/// <summary> /// Initialises a new instance of the DnsQuestion class and the reply /// reader from which the question will be decoded. /// </summary> /// <param name="reader">The reader.</param> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="reader"/> is <see langword="null"/>. /// </exception> /// <exception cref="AK.Net.Dns.DnsFormatException"> /// Thrown when question data could not be read from the /// <paramref name="reader"/>. /// </exception> public DnsQuestion(IDnsReader reader) { Guard.NotNull(reader, "reader"); try { _name = reader.ReadName(); _type = reader.ReadQueryType(); _class = reader.ReadQueryClass(); } catch (DnsException exc) { throw Guard.InvalidDnsQuestionFormat(exc); } }
/// <summary> /// Begins an asynchronous operation to resolve a <see cref="AK.Net.Dns.DnsName"/> /// instance for each of the authoritative name servers for the specified /// <paramref name="domain"/>. /// </summary> /// <param name="domain">The domain name.</param> /// <param name="callback">The method to invoke once the asynchronous operation /// has completed.</param> /// <param name="state">The user-defined state object to associate with the /// asynchronous operation.</param> /// <returns>The asynchronous operation result.</returns> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="domain"/> is <see langword="null"/>. /// </exception> public static IAsyncResult BeginGetNameServers(DnsName domain, AsyncCallback callback, object state) { return(AKDns.Resolver.BeginGetNameServers(domain, callback, state)); }
/// <summary> /// Resolves and returns a <see cref="AK.Net.Dns.DnsName"/> instance for /// each of the authoritative name servers for the specified /// <paramref name="domain"/>. /// </summary> /// <param name="domain">The domain.</param> /// <returns> /// The list of <see cref="AK.Net.Dns.DnsName"/> instances for each of the /// authoritative name servers for the specified <paramref name="domain"/>. /// </returns> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="domain"/> is <see langword="null"/>. /// </exception> /// <exception cref="AK.Net.Dns.DnsTransportException"> /// Thrown when a transport error occurs. /// </exception> /// <exception cref="AK.Net.Dns.DnsResolutionException"> /// Thrown when an error occurs during the resolution, such as the query /// not being answered. /// </exception> public static DnsName[] GetNameServers(DnsName domain) { return(AKDns.Resolver.GetNameServers(domain)); }
/// <summary> /// Resolves and returns the <see cref="AK.Net.Dns.MXInfo"/> instance for the /// specified <paramref name="domain"/>. /// </summary> /// <param name="domain">The domain name.</param> /// <returns>The mail exchange information associated with the /// <paramref name="domain"/>.</returns> /// <exception cref="System.ArgumentNullException"> /// Thrown when <paramref name="domain"/> is <see langword="null"/>. /// </exception> /// <exception cref="AK.Net.Dns.DnsTransportException"> /// Thrown when a transport error occurs. /// </exception> /// <exception cref="AK.Net.Dns.DnsResolutionException"> /// Thrown when an error occurs during the resolution, such as the query /// not being answered. /// </exception> public static MXInfo GetMXInfo(DnsName domain) { return(AKDns.Resolver.GetMXInfo(domain)); }
internal static ArgumentException UnableToMakeRelativeNotAChildOfName(DnsName @this, DnsName name, string paramName) { return(new ArgumentException(Format(Messages.UnableToMakeRelativeNotASubDomainOfName, @this, name), paramName)); }