Example #1
0
        /// <summary>
        /// Server Selection
        /// </summary>
        /// <param name="Name">Name</param>
        /// <param name="Type">Resource Record Type</param>
        /// <param name="Class">Resource Record Class</param>
        /// <param name="Ttl">Time to live</param>
        /// <param name="Data">RR-specific binary data.</param>
        public SRV(string Name, TYPE Type, CLASS Class, uint Ttl, Stream Data)
            : base(Name, Type, Class, Ttl)
        {
            Match M;

            lock (srvName)
            {
                M = srvName.Match(Name);
            }

            if (!M.Success || M.Index > 0 || M.Length < Name.Length)
            {
                throw new ArgumentException("Invalid service name.", nameof(Name));
            }

            this.service  = M.Groups["Service"].Value;
            this.protocol = M.Groups["Protocol"].Value;
            this.Name     = M.Groups["Name"].Value;

            this.priority   = DnsClient.ReadUInt16(Data);
            this.weight     = DnsClient.ReadUInt16(Data);
            this.port       = DnsClient.ReadUInt16(Data);
            this.targetHost = DnsClient.ReadName(Data);
        }
Example #2
0
 /// <summary>
 /// Mailbox eXchange
 /// </summary>
 /// <param name="Name">Name</param>
 /// <param name="Type">Resource Record Type</param>
 /// <param name="Class">Resource Record Class</param>
 /// <param name="Ttl">Time to live</param>
 /// <param name="Data">RR-specific binary data.</param>
 public MX(string Name, TYPE Type, CLASS Class, uint Ttl, Stream Data)
     : base(Name, Type, Class, Ttl)
 {
     this.preference = DnsClient.ReadUInt16(Data);
     this.exchange   = DnsClient.ReadName(Data);
 }